import{d as u,eL as f,J as l,o as _,N as h,f as p,v as g}from"./outputWidgets.0112c29a.js";import{E as m}from"./ExclamationCircleOutlined.1e7dd7f9.js";import{M as v}from"./Modal.4672b2be.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]="06792515-a768-432e-b670-88b4ad1e683c",n._sentryDebugIdIdentifier="sentry-dbid-06792515-a768-432e-b670-88b4ad1e683c")}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.a8cef32a.js.map
