Liferay.Loader.define("redirect-web@2.0.49/js/editRedirectEntry",["module","exports","require","frontend-js-web"],(function(e,t,n){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function _default({getRedirectEntryChainCauseURL:e,initialDestinationURL:t,initialIsPermanent:n,namespace:a}){const r=document["".concat(a,"fm")];r.addEventListener("submit",(function saveRedirectEntry(){const t=r.elements["".concat(a,"destinationURL")],n=r.elements["".concat(a,"sourceURL")];n.value?!t.value||t.closest(".form-group").classList.contains("has-error")?(t.focus(),t.blur()):(0,o.fetch)((0,o.createResourceURL)(e,{destinationURL:t.value,sourceURL:n.value})).then((e=>e.json())).then((e=>{e.redirectEntryChainCause?function showModal(e){Liferay.componentReady("".concat(a,"RedirectsChainedRedirections")).then((t=>{t.open(e,(e=>{(0,o.postForm)(r,{data:{updateChainedRedirectEntries:e}})}))}))}(e.redirectEntryChainCause):submitForm(r)})).catch((()=>{(0,o.openToast)({message:Liferay.Language.get("an-unexpected-error-occurred"),type:"danger"})})):n.focus()}));const c=document.getElementById("".concat(a,"typeInfoAlert")),i=document.getElementById("".concat(a,"destinationURL")),s=document.getElementById("".concat(a,"permanent"));c&&n&&(i.addEventListener("input",showTypeInfoAlert),s.addEventListener("input",showTypeInfoAlert));function showTypeInfoAlert(){c.classList.toggle("hide","true"===s.value&&i.value===t)}};var o=n("frontend-js-web")}));
//# sourceMappingURL=editRedirectEntry.js.map