Liferay.Loader.define("asset-categories-admin-web@5.0.63/js/ItemSelectorAddCategory",["module","exports","require","frontend-js-web"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({currentURL:t,namespace:a,redirect:n}){document.querySelector(".lfr-form-content .sheet").classList.add("border-0");const d=(0,o.getOpener)(),c=d.document.querySelector(".modal-title"),r=c.textContent;c.textContent="".concat(c.textContent," - ").concat(Liferay.Language.get("add-new"));const s=d.document.querySelectorAll(".liferay-modal .modal-footer .btn-group-item");s.forEach((e=>{e.classList.add("hide")}));const l=d.document.querySelector(".modal-footer .btn-group"),i=l.querySelectorAll(".add-category-toolbar-button");if(i.length)i.forEach((e=>{e.parentElement.classList.remove("hide")}));else{[e({action:"cancel",buttonClasses:["btn-outline-borderless","btn-outline-secondary"],label:Liferay.Language.get("cancel"),type:"button"}),e({action:"saveAndAddNew",buttonClasses:["btn-secondary"],label:Liferay.Language.get("save-and-add-a-new-one")}),e({action:"save",buttonClasses:["btn-primary"],label:Liferay.Language.get("save")})].forEach((e=>l.appendChild(e)))}const u=(0,o.delegate)(l,"click",".add-category-toolbar-button",(e=>{const d=e.delegateTarget.dataset.action;"cancel"===d?(0,o.navigate)(n):"saveAndAddNew"===d?(document.getElementById("".concat(a,"redirect")).value=t,submitForm(document.getElementById("".concat(a,"fm")))):"save"===d&&submitForm(document.getElementById("".concat(a,"fm")))}));return{dispose:()=>{s.forEach((e=>{e.classList.remove("hide")})),l.querySelectorAll(".add-category-toolbar-button").forEach((e=>e.parentElement.classList.add("hide"))),c.textContent=r,u.dispose()}}};var o=a("frontend-js-web");const e=({action:e,buttonClasses:t,label:a,type:o="submit"})=>{const n=document.createElement("div");n.classList.add("btn-group-item");const d=document.createElement("button");d.classList.add("add-category-toolbar-button","btn");for(const e of t)d.classList.add(e);return d.dataset.action=e,d.textContent=a,d.type=o,n.appendChild(d),n}}}));
//# sourceMappingURL=ItemSelectorAddCategory.js.map