Liferay.Loader.define("asset-categories-admin-web@5.0.34/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:o}){document.querySelector(".lfr-form-content .sheet").classList.add("border-0");const c=Liferay.Util.getOpener(),d=c.document.querySelector(".modal-title"),r=d.textContent;d.textContent="".concat(d.textContent," - ").concat(Liferay.Language.get("add-new"));const l=c.document.querySelectorAll(".liferay-modal .modal-footer .btn-group-item");l.forEach((e=>{e.classList.add("hide")}));const s=c.document.querySelector(".modal-footer .btn-group"),i=s.querySelectorAll(".add-category-toolbar-button");if(i.length)i.forEach((e=>{e.parentElement.classList.remove("hide")}));else{[e({action:"cancel",buttonClass:"btn-link",label:Liferay.Language.get("cancel"),type:"button"}),e({action:"saveAndAddNew",buttonClass:"btn-secondary",label:Liferay.Language.get("save-and-add-a-new-one")}),e({action:"save",buttonClass:"btn-primary",label:Liferay.Language.get("save")})].forEach((e=>s.appendChild(e)))}const u=(0,n.delegate)(s,"click",".add-category-toolbar-button",(e=>{const c=e.delegateTarget;d.textContent=r,l.forEach((e=>{e.classList.remove("hide")}));const i=()=>{s.querySelectorAll(".add-category-toolbar-button").forEach((e=>e.parentElement.classList.add("hide")))},u=c.dataset.action;"cancel"===u?(i(),(0,n.navigate)(o)):"saveAndAddNew"===u?(document.getElementById("".concat(a,"redirect")).value=t,submitForm(document.getElementById("".concat(a,"fm")))):"save"===u&&(i(),submitForm(document.getElementById("".concat(a,"fm"))))}));return{dispose:()=>u.dispose()}};var n=a("frontend-js-web");const e=({action:e,buttonClass:t,label:a,type:n="submit"})=>{const o=document.createElement("div");o.classList.add("btn-group-item");const c=document.createElement("button");return c.classList.add("add-category-toolbar-button","btn",t),c.dataset.action=e,c.textContent=a,c.type=n,o.appendChild(c),o}}}));
//# sourceMappingURL=ItemSelectorAddCategory.js.map