1(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/app/apscatalog"],{1170:(e,t,n)=>{"use strict";n.r(t);var a=n(89),s=n(85),o=n(399);const l=e=>{const t=Element.getLayout(e);return parseInt(Element.getHeight(e)+t.get("border-top")+t.get("border-bottom")+t.get("margin-top")+t.get("margin-bottom"))},c=()=>{const e=document.querySelector(".apps-manager.objects-management-box");if(!e)return void window.removeEventListener("resize",c,!1);const t=Element.getLayout(e);let n=document.body.clientHeight-Element.cumulativeOffset(e)[1]-t.get("border-top")-t.get("border-bottom")-parseInt(Element.getStyle(document.querySelector(".pul-layout__main-inner"),"paddingBottom"));document.querySelector(".pul-layout__footer")&&(n-=Element.getHeight(document.querySelector(".pul-layout__footer"))),n<200&&(n=200),document.getElementById("objects-list-content-area").parentNode.style.height=`${n}px`;const a=document.getElementById("catalog-actions-box");if(a&&!a.parentNode.previousElementSibling){const e=a.nextElementSibling;"none"!==a.style.display?e.style.height=n-Element.getHeight(a)+"px":e.style.height=`${n}px`}else{const e=document.querySelector(".objects-details-content-area").children;let t=null,a=0;for(let n=0;n<e.length;n++)"script"!==e[n].tagName.toLowerCase()&&(t=e[n],a+=l(t));const s=n-a+(t?l(t):0),o=document.querySelectorAll("#objects-details-content .objects-content");o.length&&(o[o.length-1].style.height=`${s}px`)}r(),i()},r=()=>{const e=document.getElementById("category-info");if(!document.getElementById("catalog-actions-box"))return;const t=document.getElementById("catalog-actions-box").nextElementSibling;Element.getHeight(t)<Element.getHeight(e)?t.classList.add("with-scroll"):t.classList.remove("with-scroll")},i=()=>{const e=document.querySelector(".aps-marketplace-list");if(e){let t=!0,n=null,a=null;e.querySelectorAll(".package-content").forEach((e=>{t?(n=e,t=!1):(a=e,Element.getHeight(n)>Element.getHeight(a)?a.style.height=`${Element.getHeight(n)}px`:Element.getHeight(n)<Element.getHeight(a)&&(n.style.height=`${Element.getHeight(a)}px`),t=!0)}));const s=document.getElementById("catalog-actions-box").nextElementSibling,o=Math.round(e.querySelectorAll(".package-block").length/2);let l=1,c=0;e.querySelectorAll(".package-block").forEach((e=>{if(c++,l===o){const t=e.querySelector(".btn-group");t&&(s.classList.contains("with-scroll")?t.classList.add("dropup"):t.classList.remove("dropup"))}2===c&&(c=0,l++)}))}};class d extends s.FormAjax{constructor(...e){super(...e),(0,a.default)(this,"_isSearchResultsShown",!1),(0,a.default)(this,"_catalogType","apscatalog"),(0,a.default)(this,"_isCategoriesLoaded",!1)}_initConfiguration(e){super._initConfiguration({locale:s.Locale.getSection("smb.components.forms.aps.catalog"),...e}),this._catalogType=document.getElementById("catalogType").value}_initComponentElement(){super._initComponentElement(),(0,s.render)(this._componentElement,new s.SmallTools({id:"catalog-actions-box",locale:this.getLocale(),searchCollapsed:"false"===o.default.get(`${this._id}-search-show`),searchFilters:{name:{}},quickSearchInputId:"quick-search-name"})),(0,s.render)(document.getElementById("catalog-actions-box").querySelector(".objects-toolbar"),(0,s.createElement)("span#current-action.list-actions",(0,s.createElement)("span#current-action-navigation"),(0,s.createElement)("span#current-action-buttons",(0,s.createElement)("span.link-back-to-category",(0,s.createElement)("a",{href:"#tolist"},this.lmsg("returnToCategories"))))),"top"),(0,s.render)(document.getElementById("catalog-actions-box").querySelector(".quick-search-box"),(0,s.createElement)("span.search-control",(0,s.createElement)("a.s-btn.sb-search-show",this.lmsg("showSearch")),(0,s.createElement)("a.s-btn.sb-search-hide",this.lmsg("hideSearch")))),(0,s.render)(document.getElementById("catalog-actions-box"),(0,s.createElement)("#search-box.search-box",(0,s.createElement)("ul",(0,s.createElement)("li",`<div><span>${this.lmsg("searchName")}</span><input id="search-name" type="text" value=""/></div>`),(0,s.createElement)("input#search-vendor",{type:"hidden",value:""}),(0,s.createElement)("li",`<div><span>${this.lmsg("searchPackager")}</span><input id="search-packager" type="text" value=""/></div>`),(0,s.createElement)("li",(0,s.createElement)("",(0,s.createElement)("span",this.lmsg("searchLicenseType")),(0,s.createElement)("select#search-lice
1nse-type",(0,s.createElement)("option",{value:"any",selected:"selected"},this.lmsg("searchLicenseTypeAny")),(0,s.createElement)("option",{value:"freeware"},this.lmsg("searchLicenseTypeFreeware")),(0,s.createElement)("option",{value:"commercial"},this.lmsg("searchLicenseTypeCommercial")))))),(0,s.createElement)("a.s-btn.sb-search",{href:"#"},this.lmsg("buttonSearch")),(0,s.createElement)("a.s-btn.sb-show-all",{href:"#"},this.lmsg("buttonResetSearch")))),(0,s.render)(this._componentElement,(0,s.createElement)(".objects-content",(0,s.createElement)("#overview-catalog.objects-content-area"),(0,s.createElement)("#category-info.objects-content-area"),(0,s.createElement)("#details-info.objects-content-area")))}_executeResizeCallback(){c()}render(){super.render(),this._addSearchHandlers(),this._initBlocksResize(),"apscatalog"===this._catalogType&&"#show-all"!==document.location.hash?this.showCategories():this.showSearchResults(!1);const e=this._getConfigParam("category");e&&this.showCategory(e);const t=this._getConfigParam("details");
1t&&this.showDetails(t),this._executeResizeCallback()}_showPanel(e){document.getElementById("overview-catalog").style.display="overview-catalog"===e?"":"none",document.getElementById("category-info").style.display="category-info"===e?"":"none","details-info"===e?(document.getElementById("details-info").style.display="",document.getElementById("current-action-navigation").style.display="none",document.getElementById("current-action-buttons").style.display="",document.getElementById("catalog-actions-box").querySelector(".quick-search-box").style.display="none",document.getElementById("search-box").style.display="none"):(document.getElementById("details-info").style.display="none",document.getElementById("current-action-navigation").style.display="",document.getElementById("current-action-buttons").style.display="none",document.getElementById("catalog-actions-box").querySelector(".quick-search-box").style.display="",document.getElementById("search-box").style.display=""),"marketplace"===this._catalogType&&"category-info"===e?document.getElementById("catalog-actions-box").style.display="none":document.getElementById("catalog-actions-box").style.display="",this._executeResizeCallback()}returnToHome(){return this.showCategories(),!1}returnToCategory(){return document.getElementById("category-info").innerHTML.trim()?this._showPanel("category-info"):this.showCategories(),!1}showCategories(){return this._showPanel("overview-catalog"),document.getElementById("current-action-navigation").innerHTML=this.lmsg("showCategories"),this._isSearchResultsShown=!1,this._isCategoriesLoaded||(document.getElementById("overview-catalog").innerHTML=`<div class="ajax-loading">${this.lmsg("loading")}</div>`,new Ajax.Updater("overview-catalog",(0,s.prepareUrl)(`/app/categories-data/catalogId/${document.getElementById("catalogId").value}`),{method:"get"}),this._isCategoriesLoaded=!0),!1}showDetails(e){document.getElementById("details-info").innerHTML=`<div class="ajax-loading">${this.lmsg("loading")}</div>`,this._showPanel("details-info");const t=$H(e);return new Ajax.Updater({success:"details-info"},(0,s.prepareUrl)(`/app/details-data/catalogId/${document.getElementById("catalogId").value}`),{method:"post",parameters:{applicationDetails:JSON.stringify(t)},evalScripts:!0,onFailure:this.onErrorShowDetails.bind(this,e)}),!1}onErrorShowDetails(e){document.getElementById("details-info").innerHTML=this.lmsg("connectionFailed",{retryLink:`<a href="#">${this.lmsg("retry")}</a>`}),document.getElementById("details-info").querySelectorAll("a").forEach((t=>
1{t.addEventListener("click",this.showDetailsRetry.bind(this,e))}))}showDetailsRetry(e){this.showDetails(e)}showCategory(e){return this.resetSearchResults(!0),this._showPanel("category-info"),document.getElementById("category-info").innerHTML=`<div class="ajax-loading">${this.lmsg("loading")}</div>`,new Ajax.Request((0,s.prepareUrl)(`/app/applications-list-data/catalogId/${document.getElementById("catalogId").value}`),{method:"get",parameters:{category:e,cert:"any"},onSuccess:e=>{try{const t=JSON.parse(e.responseText);t.list&&Element.update(document.getElementById("category-info"),t.list),t.navigation&&Element.update(document.getElementById("current-action-navigation"),t.navigation),this._executeResizeCallback()}catch{}}}),this._isSearchResultsShown=!1,!1}showCategoryRetry(e){this.showCategory(e)}install(e){document.getElementById("name").value=e.name;const t=["version","release","packager","vendor","advancedInstall"];for(let n=0;n<t.length;n++)""===document.getElementById(t[n]).value&&(document.getElementById(t[n]).value=e[t[n]]);return this._componentElement.action=(0,s.prepareUrl)("/app/download/"),this._componentElement.submit(),!1}renderVersionsList(e,t,n){const a=Object.keys(n),o=new Element("li");o.innerHTML=`<a href="#">${this.lmsg("moreVersions")}</a>`,o.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation(),e.target.closest("ul").querySelectorAll("li").forEach((e=>{e.style.display=""})),e.target.style.display="none"})),e.innerHTML="";for(let o=0;o<a.length;o++){const l=n[a[o]],c=new Element("a",{href:"#"});c.innerHTML=l.version,c.addEventListener("click",(e=>{e.preventDefault(),["version","release","packager","vendor"].forEach((e=>{document.getElementById(e).value=l[e]})),t.advancedInstall=1,apsCatalog.install(t)}));const r=new Element("li");(0,s.render)(r,c),o>=9&&(r.style.display="none"),(0,s.render)(e,r)}a.length>9&&(0,s.render)(e,o)}showAppVersions(e,t){Object.keys(e.versions).length?apsCatalog.renderVersionsList(t,e,e.versions):(t.innerHTML=`<div class="ajax-loading">${this.lmsg("loading")}</div>`,new Ajax.Request((0,s.prepareUrl)(`/app/versions-data/catalogId/${document.getElementById("catalogId").value}`),{method:"post",parameters:{applicationDetails:JSON.stringify(e)},onSuccess(n){const a=JSON.parse(n.responseText);apsCatalog.renderVersionsList(t,e,a.versions)}}))}uninstall(e){return document.getElementById("packageId").value=e,this._componentElement.action=(0,s.prepareUrl)("/app/remove/"),this._componentElement.submit(),!1}_addSearchHandlers(){this._componentElement.querySelectorAll(".search-control .s-btn").forEach((e=>{e.addEventListener("click",(e=>(e.target.closest(".actions-box").classList.toggle("actions-box-search-show"),o.default.set(`${this._id}-search-show`,e.target.closest(".actions-box").classList.contains("actions-box-search-show")),this._executeResizeCallback(),!1)))}));this._componentElement.querySelector(".quick-search-box").querySelector("em").addEventListener("click",(()=>{this.showSearchResults(!0)}));this._componentElement.querySelector(".sb-search").addEventListener("click",(()=>{this.showSearchResults(!1)}));this._componentElement.querySelector(".sb-show-all").addEventListener("click",(()=>{this.resetSearchResults()})),["quick-search-name","search-name","search-vendor","search-packager","search-license-type"].forEach((e=>{document.getElementById(e).addEventListener("keydown",(t=>{if(13===t.keyCode){let n=!1;"quick-search-name"===e&&(n=!0),this.showSearchResults(n),t.stopPropagation()}}))})),this._componentElement.querySelectorAll(".link-back-to-category a").forEach((e=>{e.addEventListener("click",this.returnToCategory.bind(this))}))}showSearchResults(e){return e?(document.getElementById("search-packager").value="",document.getElementById("search-license-type").value="any",document.getElementById("search-name").value=document.getElementById("quick-search-name").value):document.getElementById("quick-search-name").value=document.getElementById("search-name").value,this._showPanel("category-info"),(0,s.render)(document.getElementById("current-action-navigation"),[(0,s.createElement)("a",{onclick:e=>{e.preventDefault(),this.resetSearchResults(!0),this.showCategories()}},this.lmsg("gotoHome")),` > ${this.lmsg("searchResults")}`],"inner"),document.getElementById("category-info").innerHTML=`<div class="ajax-loading">${this.lmsg("loading")}</div>`,new Ajax.Updater("category-info",(0,s.prepareUrl)(`/app/search-data/catalogId/${document.getElementById("catalogId").value}`),{method:"get",evalScripts:!0,parameters:{name:document.getElementById("search-name").value,vendor:document.getElementById("search-vendor").value,packager:document.getElementById("search-packager").value,cert:"any",licenseType:document.getElementById("search-lice
1nse-type").value},onComplete(){r(),i()}}),this._isSearchResultsShown=!0,!1}resetSearchResults(e){document.getElementById("quick-search-name").value="",document.getElementById("search-name").value="",document.getElementById("search-vendor").value="",document.getElementById("search-packager").value="",document.getElementById("search-license-type").value="any",this._isSearchResultsShown&&!e&&(this._isSearchResultsShown=!1,this.showSearchResults(!1))}_initBlocksResize(){try{this._resizeBlocks(),this._resizeBlocks(),window.addEventListener("resize",(()=>{this._resizeBlocks(),this._resizeBlocks()}),!1)}catch{}}_resizeBlocks(){try{const e=document.body.clientHeight-12,t=Element.cumulativeOffset(document.getElementById("application-info"))[1],n=Element.getHeight("footer-wrapper"),a=Math.max(e-t-n,200);document.getElementById("application-info").style.height=`${a}px`,document.getElementById("category-select").style.height=`${a}px`}catch{}}}d.initLayout=()=>{window.addEventListener("resize",c,!1),document.getElementById("form-aps-catalog")||c(),document.getElementById("objects-list").querySelectorAll(".objects-nav-item").forEach((e=>{e.addEventListener("click",(t=>{const n=e.closest(".objects-nav");n.classList.contains("objects-nav-active")&&(t.stopPropagation(),t.preventDefault()),n.closest(".objects-nav-container").classList.toggle("responsive-items-visible")}))}))},t.default=d}}]); 2//# sourceMappingURL=apscatalog.js.map?abd3f5dad4123fca5b27
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.