import{a as _}from"./ant-design.dc5fef0a.js";import{d as f,eJ as g,H as m,o as p,K as b,b as i,eu as h,t as y,r as w,f as u,w as C,aq as k,ey as E,u as L,bU as U,a_ as B}from"./outputWidgets.e60ab380.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[n]="fbdcc258-337c-4fc9-89fe-0e3ed2bdc9b4",s._sentryDebugIdIdentifier="sentry-dbid-fbdcc258-337c-4fc9-89fe-0e3ed2bdc9b4")}catch{}})();const D={class:"unsaved-changes-handler"},c="You have unsaved changes. Are you sure you want to leave?",I=f({__name:"UnsavedChangesHandler",props:{hasChanges:{type:Boolean}},setup(s){const n=s,t=a=>(a=a||window.event,a&&(a.returnValue=c),c),r=()=>{window.addEventListener("beforeunload",t)};g(async(a,l,o)=>{if(!n.hasChanges)return o();await _(c)?o():o(!1)});const e=()=>window.removeEventListener("beforeunload",t),d=a=>a?r():e();return m(()=>n.hasChanges,d),p(()=>d(n.hasChanges)),b(e),(a,l)=>(i(),h("div",D))}});const H=y(I,[["__scopeId","data-v-fa94acdd"]]),x=f({__name:"SaveButton",props:{model:{}},setup(s){const n=s,t=w(!1);async function r(){t.value=!0;try{await n.model.save()}finally{t.value=!1}}return addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&e.key==="s"&&(e.preventDefault(),r())}),addEventListener("beforeunload",e=>{n.model.hasChanges()&&(e.preventDefault(),e.returnValue="")}),(e,d)=>{var a,l,o;return i(),h(B,null,[u(L(U),{class:E(["save-button",{changes:(a=e.model)==null?void 0:a.hasChanges()}]),loading:t.value,disabled:!((l=e.model)!=null&&l.hasChanges()),onClick:d[0]||(d[0]=v=>r())},{default:C(()=>[k(" Save ")]),_:1},8,["class","loading","disabled"]),u(H,{"has-changes":(o=e.model)==null?void 0:o.hasChanges()},null,8,["has-changes"])],64)}}});export{x as _};
//# sourceMappingURL=SaveButton.vue_vue_type_script_setup_true_lang.e7cd0ec8.js.map
