(self.webpackChunk=self.webpackChunk||[]).push([[1916],{61916:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return l}}),t(23938),t(61013),t(69217),t(63238),t(61418);var a=t(83094),i=t(1115),r=t(6594),o=t(53754),s=t(32465),d=(t(30983),t(21865),t(78066),t(17734),t(56561),t(16589),t(53913)),l=function e(n){function t(e){var t=a.ZP.parentWithClass(e.target,"btnMap");if(t){var i=t.getAttribute("data-id"),o=t.getAttribute("data-providerid"),u=c.ProviderChannels.map((function(e){return{name:e.Name,id:e.Id,selected:e.Id.toLowerCase()===o.toLowerCase()}})).sort((function(e,n){return e.name.localeCompare(n.name)}));s.default.show({positionTo:t,items:u}).then((function(e){!function(e,t,i){r.ZP.show();var o=n.providerId;d.ZP.getApiClient(n.serverId).ajax({type:"POST",url:ApiClient.getUrl("LiveTv/ChannelMappings"),data:JSON.stringify({providerId:o,tunerChannelId:t,providerChannelId:i}),contentType:"application/json",dataType:"json"}).then((function(n){var t=a.ZP.parentWithClass(e,"listItem");e.setAttribute("data-providerid",n.ProviderChannelId),t.querySelector(".secondary").innerHTML=l(n,c.ProviderName),r.ZP.hide()}))}(t,i,e)}))}}function l(e,n){return"".concat(e.ProviderChannelName||""," - ").concat(n)}var c;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.show=function(){var e=i.default.createDialog({removeOnClose:!0,size:"small"});e.classList.add("formDialog"),e.classList.add("ui-body-a"),e.classList.add("background-theme-a");var a="";return a+='<div class="formDialogHeader">',a+='<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>',a+='<h3 class="formDialogHeaderTitle">',a+=o.ZP.translate("MapChannels"),a+="</h3>",a+="</div>",a+=function(){var e="";return e+='<div class="formDialogContent smoothScrollY">',e+='<div class="dialogContentInner dialog-content-centered">',e+='<form style="margin:auto;">',e+="<h1>".concat(o.ZP.translate("Channels"),"</h1>"),e+='<div class="channels paperList">',e+="</div>",e+="</form>",(e+="</div>")+"</div>"}(),e.innerHTML=a,function(e,n){var a,i,r;(a=n.serverId,i=n.providerId,r=d.ZP.getApiClient(a),r.getJSON(r.getUrl("LiveTv/ChannelMappingOptions",{providerId:i}))).then((function(n){c=n;var a=e.querySelector(".channels");a.innerHTML=n.TunerChannels.map((function(e){return function(e,n){var t="";return t+='<div class="listItem">',t+='<span class="material-icons listItemIcon dvr"></span>',t+='<div class="listItemBody two-line">',t+='<h3 class="listItemBodyText">',t+=e.Name,t+="</h3>",t+='<div class="secondary listItemBodyText">',e.ProviderChannelName&&(t+=l(e,n)),t+="</div>",t+="</div>",(t+='<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-id="'.concat(e.Id,'" data-providerid="').concat(e.ProviderChannelId,'"><span class="material-icons mode_edit"></span></button>'))+"</div>"}(e,n.ProviderName)})).join(""),a.addEventListener("click",t)}))}(e,n),e.querySelector(".btnCancel").addEventListener("click",(function(){i.default.close(e)})),new Promise((function(n){e.addEventListener("close",n),i.default.open(e)}))}}}}]);