import{i as f}from"./config-option-form-Dp5do6i1.js";document.addEventListener("DOMContentLoaded",function(){const t=f(document);if(!t)return;const n=t.form;n.addEventListener("submit",function(c){var i;c.preventDefault(),t.toggleDisabledByVisibility();const s=new FormData(n);s.get("hidden")||s.set("hidden","0"),s.get("is_required")||s.set("is_required","0");const d=n.action,a=((i=document.querySelector('meta[name="csrf-token"]'))==null?void 0:i.content)||"";fetch(d,{method:"POST",body:s,headers:{Accept:"application/json","X-CSRF-TOKEN":a,"X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"}).then(o=>o.json()).then(o=>{if(o&&o.success)window.showToast?window.showToast("success",o.message):window.showSuccess&&window.showSuccess(o.message),setTimeout(()=>{var r,w;const e=(w=(r=window.pageConfig)==null?void 0:r.routes)==null?void 0:w.index;e?window.location.href=e:window.location.reload()},1200);else{const e=o&&o.message||"Hata oluştu";window.showToast?window.showToast("error",e):window.showError&&window.showError(e)}}).catch(o=>{console.error("Error:",o);const e="Bir hata oluştu. Lütfen tekrar deneyin.";window.showToast?window.showToast("error",e):window.showError&&window.showError(e)})})});
