function ViewOSD(){throw{msg:"Don't NEW a singleton."}}EventListener.apply(ViewOSD),ViewOSD.refreshView=function(){var e=ControllerFlash.getSelectedChannelInfo();if(ControllerMain.disableAbility("osd"),!e)return;ControllerMain.enableAbility("osd");var t=e.data.osd;if(t.osdChannel.enable!=$("#osd-name-select").is(":checked")&&setTimeout((function(){$("#osd-name-select").trigger("click")}),100),ControllerMain.deviceInfo.channelNum>1){$("#osd-channal-select").parents("tr").show();const e=ViewManager.getViewObject(0).getChannelId();$("#osd-channal-select").html('"),$("#osd-channal-select").attr("disabled",!0)}else $("#osd-channal-select").parents("tr").hide();$("#osd-name").val(t.osdChannel.name),$("#osd-name-postion-settings-select").html(""),$(e.limits.osd.osdChannel.pos).each((function(){$("#osd-name-postion-settings-select").append('")})),$("#osd-date-time-position-select").html(""),$(e.limits.osd.osdTime.pos).each((function(){$("#osd-date-time-position-select").append('")})),""==t.osdTime.pos?$("#osd-date-time-position-select").val(e.initials.osd.osdTime.pos):$("#osd-date-time-position-select").val(t.osdTime.pos),""==t.osdChannel.pos?$("#osd-name-postion-settings-select").val(e.initials.osd.osdChannel.pos):$("#osd-name-postion-settings-select").val(t.osdChannel.pos),t.osdTime.enable!=$("#osd-date-select").is(":checked")&&setTimeout((function(){$("#osd-date-select").trigger("click")}),100),$("#osd-date-time-position-select").val(t.osdTime.pos),ControllerLogin.chkPermission("osd","write",e.index)||ControllerMain.disableAbility("osd"),$("#osd-name-select").trigger("dblclick"),$("#osd-date-select").trigger("dblclick");const s=$("#osd-date-time-position-select"),i=$("#osd-name-postion-settings-select"),o=s.val(),n=i.val();s.find('[value="'+n+'"]').attr("disabled","disabled"),i.find('[value="'+o+'"]').attr("disabled","disabled")},ViewOSD.initUI=function(){const e=$("#osd-date-time-position-select"),t=$("#osd-name-postion-settings-select");e.on("change",(function(){t.find("option").removeAttr("disabled"),t.find('[value="'+$(this).val()+'"]').attr("disabled","disabled")})),t.on("change",(function(){e.find("option").removeAttr("disabled"),e.find('[value="'+$(this).val()+'"]').attr("disabled","disabled")})),$("#osd-name-select").on("click",(function(){$(this).is(":checked")?($("#osd-name").removeAttr("disabled"),$("#osd-name-postion-settings-select").removeAttr("disabled")):($("#osd-name").attr("disabled",!0),$("#osd-name-postion-settings-select").attr("disabled",!0))})),$("#osd-date-select").on("click",(function(){$(this).is(":checked")?$("#osd-date-time-position-select").removeAttr("disabled"):$("#osd-date-time-position-select").attr("disabled",!0)})),$("#preview-commit-osd").on("click",(function(){var e=$("#osd-name").val();if(e)if(new Blob([e],{type:"text/plain"}).size>31)bc_alert("Type in no more than 31 characters.","error");else if(/(^\s+)|(\s+$)/g.test(e))bc_alert("The first and last characters cannot be spaces.","error");else if(/\s{2,}/g.test(e))bc_alert("Please do not input consecutive spaces.","error");else if(validators.deviceName(e)){var t=ViewManager.getSelectedView();if(null!=t.getChannelId()){var s=ChannelManager.get(t.getChannelId());$("#osd-name-postion-settings-select").val()==$("#osd-date-time-position-select").val()&&"Other Configuration"!=$("#osd-name-postion-settings-select").val()&&$("#osd-name-select").is(":checked")&&$("#osd-date-select").is(":checked")?bc_alert("alert.same_position","error"):($("#preview-commit-osd").attr("disabled",!0),PlayerPreview.waiter.show("Saving OSD settings..."),CGI.sendCommand("SetOsd",{Osd:{channel:s.getId(),osdChannel:{name:e,enable:$("#osd-name-select").is(":checked")?1:0,pos:$("#osd-name-postion-settings-select").val()},osdTime:{enable:$("#osd-date-select").is(":checked")?1:0,pos:$("#osd-date-time-position-select").val()}}},(function(e){PlayerPreview.waiter.hide(),bc_alert("alert.OSD_successfully"),$("#preview-commit-osd").removeAttr("disabled")}),(function(e,t,s){PlayerPreview.waiter.hide(),CGI.autoErrorHandler(e,t,s),$("#preview-commit-osd").removeAttr("disabled")})))}}else bc_alert("Please enter valid characters.","error");else bc_alert("This field cannot be blank.","error")}))};