import{d as f,eO as l,O as _,o as h,R as p,dq as g,f as m,E as v}from"./outputWidgets.e5f9ffc6.js";import{E as y}from"./ExclamationCircleOutlined.556f3eda.js";import{M as b}from"./Modal.e18542c5.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]="56f4fc3e-306a-4ab2-b6e8-2aa736e032a5",n._sentryDebugIdIdentifier="sentry-dbid-56f4fc3e-306a-4ab2-b6e8-2aa736e032a5")}catch{}})();const c="You have unsaved changes. Are you sure you want to leave?",w=f({__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)};l(async(e,u,s)=>{if(!a.hasChanges)return s();await new Promise(d=>{b.confirm({title:"You have unsaved changes.",icon:m(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)=>g(e.$slots,"default",{},void 0,!0)}});const D=v(w,[["__scopeId","data-v-79207dcb"]]);export{D as U};
//# sourceMappingURL=UnsavedChangesHandler.98d89cb4.js.map
