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