Liferay.Loader.define("layout-admin-web@5.0.145/js/LookAndFeelThemeEdit",["module","exports","require","frontend-js-web"],(function(e,t,n){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function _default({changeThemeButtonId:e,initialSelectedThemeId:t,lookAndFeelDetailURL:n,namespace:o,selectThemeURL:c,themeContainerId:d}){let l=t;const m=document.getElementById(d),onChangeThemeButtonClick=e=>{e.preventDefault();const t=new URL(c);t.searchParams.set("".concat(o,"themeId"),l),(0,a.openSelectionModal)({onSelect:e=>{const t=JSON.parse(e.value);if(t.themeId&&l!==t.themeId){m.innerHTML="";const e=document.createElement("div");e.classList.add("loading-animation"),m.appendChild(e),(0,a.fetch)(n,{body:(0,a.objectToFormData)({["".concat(o,"themeId")]:t.themeId}),method:"POST"}).then((e=>e.text())).then((n=>{const a=document.createRange().createContextualFragment(n);m.removeChild(e),m.appendChild(a),l=t.themeId,function updateCheckboxNames(e,t){const n=Array.from(t.querySelectorAll("input[type=checkbox]")).map((t=>t.name.replace(e,""))).join(","),a=document.getElementById("".concat(e,"checkboxNames"));a&&(a.value=n)}(o,m)}))}},selectEventName:"".concat(o,"selectTheme"),title:Liferay.Language.get("available-themes"),url:t.href})},i=document.getElementById(e);return i.addEventListener("click",onChangeThemeButtonClick),{dispose(){i.removeEventListener("click",onChangeThemeButtonClick)}}};var a=n("frontend-js-web")}));
//# sourceMappingURL=LookAndFeelThemeEdit.js.map