System.register(["./preload-helper-legacy.CIXZiioE.js","./index-legacy.BpZDMFyf.js"],function(e,t){"use strict";var n,o,u,l,r,i,a,s,c,v;return{setters:[e=>{n=e.v,o=e.s,u=e.d,l=e.o,r=e.aC,i=e.h,a=e._,s=e.y},e=>{c=e.B,v=e.c}],execute:function(){const t=e("u",()=>{const e=o(!1);return n(()=>{e.value=!0}),e}),f={type:{type:String},actionFn:Function,close:Function,autofocus:Boolean,prefixCls:String,buttonProps:s(),emitEvent:Boolean,quitOnNullishReturnValue:Boolean};function p(e){return!(!e||!e.then)}e("A",u({compatConfig:{MODE:3},name:"ActionButton",props:f,setup(e,u){let{slots:s}=u;const f=o(!1),d=o(),g=o(!1);let h;const m=t();l(()=>{e.autofocus&&(h=setTimeout(()=>{var e,t;return null===(t=null===(e=r(d.value))||void 0===e?void 0:e.focus)||void 0===t?void 0:t.call(e)}))}),n(()=>{clearTimeout(h)});const y=function(){for(var t,n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];null===(t=e.close)||void 0===t||t.call(e,...o)},C=t=>{const{actionFn:n}=e;if(f.value)return;if(f.value=!0,!n)return void y();let o;if(e.emitEvent){if(o=n(t),e.quitOnNullishReturnValue&&!p(o))return f.value=!1,void y(t)}else if(n.length)o=n(e.close),f.value=!1;else if(o=n(),!o)return void y();(e=>{p(e)&&(g.value=!0,e.then(function(){m.value||(g.value=!1),y(...arguments),f.value=!1},e=>(m.value||(g.value=!1),f.value=!1,Promise.reject(e))))})(o)};return()=>{const{type:t,prefixCls:n,buttonProps:o}=e;return i(c,a(a(a({},v(t)),{},{onClick:C,loading:g.value,prefixCls:n},o),{},{ref:d}),s)}}}))}}});
