import{d as c,r as u,b as y,c as p,w as v,ar as g,ez as m,u as h,bV as w,cz as C}from"./outputWidgets.9e8e14b2.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[s]="9f6a6243-7590-42f1-9b75-8fbd9f1eb4ba",a._sentryDebugIdIdentifier="sentry-dbid-9f6a6243-7590-42f1-9b75-8fbd9f1eb4ba")}catch{}})();const _=c({__name:"SaveButton",props:{model:{},disabled:{type:Boolean},type:{}},emits:["error"],setup(a,{emit:s}){const n=a,t=u(!1),b=u(null);async function r(){t.value=!0;try{await n.model.save()}catch(e){e instanceof Error&&(s("error",e),C.error({message:"Error",description:e.message}),b.value=e)}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,o)=>{var d,l,f,i;return y(),p(h(w),{class:m(["save-button",{changes:(d=e.model)==null?void 0:d.hasChanges()}]),loading:t.value,disabled:(f=e.disabled)!=null?f:!((l=e.model)!=null&&l.hasChanges()),type:(i=e.type)!=null?i:"default",onClick:o[0]||(o[0]=k=>r())},{default:v(()=>[g(" Save ")]),_:1},8,["class","loading","disabled","type"])}}});export{_};
//# sourceMappingURL=SaveButton.vue_vue_type_script_setup_true_lang.6e85ac27.js.map
