import{d as l,eN as f,h,J as _,a8 as g,c as p,w as m,u as v,o as y,O as w,A as b,cE as C,b as k,Q as E}from"./index.b7bd503f.js";import{E as U}from"./ExclamationCircleOutlined.d04c3f35.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]="bc4870ec-816c-46ea-ac8c-695201f77a52",n._sentryDebugIdIdentifier="sentry-dbid-bc4870ec-816c-46ea-ac8c-695201f77a52")}catch{}})();const c="You have unsaved changes. Are you sure you want to leave?",I=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=>{C.confirm({title:"You have unsaved changes.",icon:k(U),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 h(()=>a.hasChanges,r),_(()=>r(a.hasChanges)),g(t),(e,u)=>(y(),p(v(b),{theme:{token:{colorPrimary:"#d14056"}}},{default:m(()=>[w(e.$slots,"default",{},void 0,!0)]),_:3}))}});const A=E(I,[["__scopeId","data-v-08510d52"]]);export{A as U};
//# sourceMappingURL=UnsavedChangesHandler.d36340f1.js.map
