"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6728],{77769:function(a,t,e){e.r(t),e(5769),e(98010),e(63238),e(23938),e(69217),e(61013),e(61418),e(17460),e(14078);var n=e(56705),i=e(3319),s=e(83094),l=e(44614),r=e(61097),c=(e(46650),e(78066),e(76543)),o=e(56346);function d(a,t){ApiClient.getJSON(ApiClient.getUrl("web/configurationpages")+"?pageType=PluginConfiguration").then((function(e){!function(a,t,e){var i=(t=t.sort((function(a,t){return a.Name>t.Name?1:-1}))).map((function(a){return function(a,t){var e=t.filter((function(t){return t.PluginId==a.Id}))[0],n=e?c.ZP.getPluginUrl(e.Name):null,i="";if(i+="<div data-id='".concat(a.Id,"' data-version='").concat(a.Version,"' data-name='").concat(a.Name,"' data-removable='").concat(a.CanUninstall,"' data-status='").concat(a.Status,"' class='card backdropCard'>"),i+='<div class="cardBox visualCardBox">',i+='<div class="cardScalable">',i+='<div class="cardPadder cardPadder-backdrop"></div>',i+='<div class="cardContent">',i+=n?'<a class="cardImageContainer" is="emby-linkbutton" style="margin:0;padding:0" href="'.concat(n,'">'):'<div class="cardImageContainer noConfigPluginCard noHoverEffect emby-button" style="margin:0;padding:0">',a.HasImage){var s=ApiClient.getUrl("/Plugins/".concat(a.Id,"/").concat(a.Version,"/Image"));i+='<img src="'.concat(s,'" style="width:100%" />')}else i+='<div class="cardImage flex align-items-center justify-content-center '.concat(r.getDefaultBackgroundClass(),'">'),i+='<span class="cardImageIcon material-icons extension" aria-hidden="true"></span>',i+="</div>";return i+=n?"</a>":"</div>",i+="</div>",i+="</div>",i+='<div class="cardFooter">',(e||a.CanUninstall)&&(i+='<div style="text-align:right; float:right;padding-top:5px;">',i+='<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><span class="material-icons more_vert" aria-hidden="true"></span></button>',i+="</div>"),i+='<div class="cardText">',i+="".concat(a.Name,"<span class='cardText cardText-secondary'>").concat(a.Version,"</span>"),i+="</div>",i+='<div class="cardText">'.concat(l.ZP.translate("LabelStatus")," ").concat(a.Status,"</div>"),i+="</div>",(i+="</div>")+"</div>"}(a,e)})).join(""),s=a.querySelector(".installedPlugins");s.removeEventListener("click",P),s.addEventListener("click",P),t.length?(s.classList.add("itemsContainer"),s.classList.add("vertical-wrap")):(i+='<div class="centerMessage">',i+="<h1>"+l.ZP.translate("MessageNoPluginsInstalled")+"</h1>",i+='<p><a is="emby-linkbutton" class="button-link" href="#!/availableplugins.html">',i+=l.ZP.translate("MessageBrowsePluginCatalog"),i+="</a></p>",i+="</div>"),s.innerHTML=i,n.ZP.hide()}(a,t,e)}))}function u(a){n.ZP.show(),ApiClient.getInstalledPlugins().then((function(t){d(a,t)}))}function g(){return[{href:"#!/installedplugins.html",name:l.ZP.translate("TabMyPlugins")},{href:"#!/availableplugins.html",name:l.ZP.translate("TabCatalog")},{href:"#!/repositories.html",name:l.ZP.translate("TabRepositories")}]}function P(a){if(s.ZP.parentWithClass(a.target,"noConfigPluginCard"))c.ZP.alert({message:l.ZP.translate("MessageNoPluginConfiguration")});else if(s.ZP.parentWithClass(a.target,"connectModePluginCard"))c.ZP.alert({message:l.ZP.translate("MessagePluginConfigurationRequiresLocalAccess")});else{var t=s.ZP.parentWithClass(a.target,"btnCardMenu");t&&(i=s.ZP.parentWithClass(t,"page"),r=t,d=s.ZP.parentWithClass(r,"card"),g=d.getAttribute("data-id"),P=d.getAttribute("data-name"),p=d.getAttribute("data-removable"),b=d.querySelector(".cardImageContainer").getAttribute("href"),h=d.getAttribute("data-status"),f=d.getAttribute("data-version"),m=[],b&&m.push({name:l.ZP.translate("Settings"),id:"open",icon:"mode_edit"}),"true"===p&&("Disabled"===h&&m.push({name:l.ZP.translate("EnablePlugin"),id:"enable",icon:"check_circle_outline"}),"Active"===h&&m.push({name:l.ZP.translate("DisablePlugin"),id:"disable",icon:"do_not_disturb"}),m.push({name:l.ZP.translate("ButtonUninstall"),id:"delete",icon:"delete"})),Promise.resolve().then(e.bind(e,78407)).then((function(a){a.show({items:m,positionTo:r,callback:function(a){switch(a){case"open":c.ZP.navigate(b);break;case"delete":!function(a,t,e,i){var s=l.ZP.translate("UninstallPluginConfirmation",i);(0,o.Z)({title:l.ZP.translate("HeaderUninstallPlugin"),text:s,primary:"delete",confirmText:l.ZP.translate("HeaderUninstallPlugin")}).then((function(){n.ZP.show(),ApiClient.uninstallPluginByVersion(t,e).then((function(){u(a)}))}))}(i,g,f,P);break;case"enable":!function(a,t,e){n.ZP.show(),ApiClient.enablePlugin(t,e).then((function(){u(a)}))}(i,g,f);break;case"disable":!function(a,t,e){n.ZP.show(),ApiClient.disablePlugin(t,e).then((function(){u(a)}))}(i,g,f)}}})})))}var i,r,d,g,P,p,b,h,f,m}(0,c.Xz)("pageshow","pluginsPage",(function(){i.Z.setTabs("plugins",0,g),u(this)})),window.PluginsPage={renderPlugins:d}}}]);