import{d as l,f9 as f,O as _,o as h,R as p,dy as b,f as g,E as m}from"./outputWidgets.ac6cd083.js";import{E as y}from"./ExclamationCircleOutlined.214d4295.js";import{M as v}from"./Modal.1a3291a2.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]="066474e3-5bb6-4908-a14f-26ca672b00cc",n._sentryDebugIdIdentifier="sentry-dbid-066474e3-5bb6-4908-a14f-26ca672b00cc")}catch{}})();const c="You have unsaved changes. Are you sure you want to leave?",w=l({__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,u,s)=>{if(!a.hasChanges)return s();await new Promise(d=>{v.confirm({title:"You have unsaved changes.",icon:g(y),content:"Are you sure you want to discard them?",okText:"Discard Changes",okType:"danger",cancelText:"Cancel",onOk(){d(!0)},onCancel(){d(!1)}})})?s():s(!1)});const t=()=>window.removeEventListener("beforeunload",o),r=e=>e?i():t();return _(()=>a.hasChanges,r),h(()=>r(a.hasChanges)),p(t),(e,u)=>b(e.$slots,"default",{},void 0,!0)}});const D=m(w,[["__scopeId","data-v-79207dcb"]]);export{D as U};
//# sourceMappingURL=UnsavedChangesHandler.00fe2f65.js.map
