import{d as l,eO as f,O as _,o as h,R as p,dq as g,f as m,E as v}from"./outputWidgets.52571dac.js";import{E as y}from"./ExclamationCircleOutlined.70211d7b.js";import{M as b}from"./Modal.514213ca.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]="89e3603c-b118-4e1b-9105-6cf8eca5aaed",n._sentryDebugIdIdentifier="sentry-dbid-89e3603c-b118-4e1b-9105-6cf8eca5aaed")}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(r=>{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(){r(!0)},onCancel(){r(!1)}})})?s():s(!1)});const t=()=>window.removeEventListener("beforeunload",o),d=e=>e?i():t();return _(()=>a.hasChanges,d),h(()=>d(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.27f75b7f.js.map
