(function(){function e(){var e;this.initialize=function(e){this.device=e.device||null,this.showTitle=e.showTitle,this.scrubberView=new App.Views.ScrubberView({percent:0}),this.zone=this.device.getZone()||null,this.uuid=Math.random().toString(36).substring(2)+(new Date).getTime().toString(36),this.setZone(this.zone)},this.attachHandlers=function(){var e=this;this.zone&&($(this.scrubberView).on("DOWN",function(){e.zone.devices.forEach(function(e){e.markStartingVolume()})}),this.scrubberView.registerOnMove(function(){e.block(function(){e.syncScrubber()});var t=e.scrubberView.getDelta();e.zone.setDisplayVolumeDelta(t)}),e.zone.devices&&e.zone.devices.forEach(function(t){$(t).on("DISPLAY_VOLUME_CHANGED."+e.uuid,function(){if(e.blocked)return;var t=e.zone.getMaxDisplayVolume();e.scrubberView.setPercent(t)})}))},this.syncScrubber=function(){if(!this.zone)return;var e=this,t=e.zone.getMaxDisplayVolume(),n=e.scrubberView.getPercent();Math.abs(t-n)>.02&&e.scrubberView.setPercent(e.device.getCachedVolume())},this.detachHandlers=function(){var e=this;$(this.scrubberView).off("DOWN"),this.scrubberView.registerOnMove(null),e.zone&&e.zone.devices&&e.zone.devices.forEach(function(t){$(t).off("DISPLAY_VOLUME_CHANGED."+e.uuid)})},this.destroy=function(){this.detachHandlers()},this.setZone=function(e){this.zone=e,this.detachHandlers(),this.attachHandlers(),this.render()},this.render=function(){var t=this;this.zone=this.device.getZone(),this.$el.empty();var n="<div class='volume_title'><%= groupTitle %></div><div class='volume_row'>    <div class='tray_min_icon volume_icon'></div>    <div class='scrubber'></div></div>";return e||(e=_.template(n)),this.$el.html(e({groupTitle:this.device===null?"":this.device.getDisplayName()+" "+funcObj.langCon.getString("GroupVolume")})),this.$el.addClass("volume_view_wrapper"),this.showTitle===!1&&this.$el.find(".volume_title").hide(),this.zone&&(this.scrubberView.setElement(this.$(".scrubber")).render(),this.scrubberView.postAttach(),this.scrubberView.setPercent(this.zone.getMaxVolume())),this}}App.Views.ZoneVolumeView=App.Views.BlockableView.extend(new e)})();