import{d as u,eL as f,J as l,o as _,N as h,f as p,v as g}from"./outputWidgets.a321903e.js";import{E as m}from"./ExclamationCircleOutlined.ae38a1f5.js";import{M as v}from"./Modal.bcb9f272.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="cd92f571-594b-40c4-9645-a79eac7305d2",n._sentryDebugIdIdentifier="sentry-dbid-cd92f571-594b-40c4-9645-a79eac7305d2")}catch{}})();const c="You have unsaved changes. Are you sure you want to leave?",y=u({__name:"UnsavedChangesHandler",props:{hasChanges:{type:Boolean}},setup(n){const a=n,o=e=>(e=e||window.event,e&&(e.returnValue=c),c),i=()=>{window.addEventListener("beforeunload",o)};f(async(e,w,s)=>{if(!a.hasChanges)return s();await new Promise(r=>{v.confirm({title:"You have unsaved changes.",icon:p(m),content:"Are you sure you want to discard them?",okText:"Discard Changes",okType:"danger",cancelText:"Cancel",onOk(){r(!0)},onCancel(){r(!1)}})})?s():s(!1)});const t=()=>window.removeEventListener("beforeunload",o),d=e=>e?i():t();return l(()=>a.hasChanges,d),_(()=>d(a.hasChanges)),h(t),()=>{}}});const I=g(y,[["__scopeId","data-v-0a2660df"]]);export{I as U};
//# sourceMappingURL=UnsavedChangesHandler.e9ab6e15.js.map
