"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6968],{44754:function(e,n,t){t.r(n),t.d(n,{default:function(){return c}}),t(69217),t(98010),t(63238),t(25901),t(92189),t(90938),t(5769),t(61418),t(17460),t(14078),t(72326);var r=t(93629),i=t(31699),s=t.n(i),o=t(56705),a=t(44614),l=(t(78066),t(76543)),u=t(61642),v=t(56346);function h(e){(0,u.Z)(e)}function c(e,n){$(".addPluginForm",e).on("submit",(function(){o.ZP.show();var e=$(this).parents("#addPluginPage")[0],t=n.name,r=n.guid;return ApiClient.getInstalledPlugins().then((function(n){var i=n.filter((function(e){return e.Name==t}))[0],s=$("#selectVersion",e).val();i&&i.Version===s?(o.ZP.hide(),l.ZP.alert({message:a.ZP.translate("MessageAlreadyInstalled"),title:a.ZP.translate("HeaderPluginInstallation")})):function(e,n,t,r){var i=$("#repositoryUrl",e).html().toLowerCase(),s=function(){o.ZP.show(),e.querySelector("#btnInstall").disabled=!0,ApiClient.installPlugin(n,t,r).then((function(){o.ZP.hide(),h(a.ZP.translate("MessagePluginInstalled"))})).catch((function(){h(a.ZP.translate("MessagePluginInstallError"))}))};if(i.startsWith("https://repo.jellyfin.org/"))s();else{o.ZP.hide();var l=a.ZP.translate("MessagePluginInstallDisclaimer");l+="<br/>",l+="<br/>",l+=a.ZP.translate("PleaseConfirmPluginInstallation"),(0,v.Z)(l,a.ZP.translate("HeaderConfirmPluginInstallation")).then((function(){s()})).catch((function(){console.debug("plugin not installed")}))}}(e,t,r,s)})).catch((function(){h(a.ZP.translate("MessageGetInstalledPluginsError"))})),!1})),e.addEventListener("viewshow",(function(){var e=this;o.ZP.show();var t=n.name,i=n.guid,l=ApiClient.getPackageInfo(t,i),u=ApiClient.getInstalledPlugins();Promise.all([l,u]).then((function(n){!function(e,n,t){var i=n.filter((function(n){return n.Name==e.name}))[0];if(function(e,n,t){var r="";e.versions.sort((function(e,n){return n.timestamp<e.timestamp?-1:1}));for(var i=0;i<e.versions.length;i++){var s=e.versions[i];r+='<option value="'+s.version+'">'+a.ZP.translate("PluginFromRepo",s.version,s.repositoryName)+"</option>"}var o=$("#selectVersion",n).html(r);t||$("#pCurrentVersion",n).hide().html("");var l=e.versions[0];l&&o.val(l.version)}(e,t,i),function(e,n){for(var t="",i=Math.min(e.versions.length,10),o=0;o<i;o++){var a=e.versions[o];t+='<h2 style="margin:.5em 0;">'+a.version+"</h2>",t+='<div style="margin-bottom:1.5em;">'+s().sanitize((0,r.TU)(a.changelog))+"</div>"}$("#revisionHistory",n).html(t)}(e,t),$(".pluginName",t).text(e.name),$("#btnInstallDiv",t).removeClass("hide"),$("#pSelectVersion",t).removeClass("hide"),e.overview?$("#overview",t).show().text(e.overview):$("#overview",t).hide(),$("#description",t).text(e.description),$("#developer",t).text(e.owner),e.versions.length?($("#repositoryName",t).text(e.versions[0].repositoryName),$("#repositoryUrl",t).text(e.versions[0].repositoryUrl)):($("#repositoryName",t).text(a.ZP.translate("Unknown")),$("#repositoryUrl",t).text(a.ZP.translate("Unknown"))),i){var l=a.ZP.translate("MessageYouHaveVersionInstalled","<strong>"+i.Version+"</strong>");$("#pCurrentVersion",t).show().html(l)}else $("#pCurrentVersion",t).hide().text("");o.ZP.hide()}(n[0],n[1],e)}))}))}}}]);