text: import{A as t,B as n,a4 as e,f as a,a1 as u,a_ as o,r as s,a as r,Z as l,k as i,aI as c,K as d,o as f,n as v,P as p,X as m,s as C,N as S,ac as h,q as b}from"./vendor.0482ef83.js";import{p as x,d as y,h as g,c as w}from"./index.bfefd9f4.js";function z(s,r="value",l="change"){const i=u(),c=null==i?void 0:i.emit,d=t({value:s[r]}),f=n(d);e((()=>{d.value=s[r]}));return[a({get:()=>d.value,set(t){o(t,f.value)||(d.value=t,null==c||c(l,t))}}),t=>{d.value=t},f]}var A=i({name:"CountButton",components:{Button:c},props:{value:x.any,count:x.number.def(60),beforeStartFunc:{type:Function,default:null}},setup(t){const n=s(!1),{currentCount:a,isStart:u,start:o,reset:i}=function(t){const n=s(t),e=s(!1);let a;function u(){a&&window.clearInterval(a)}function o(){e.value=!1,u(),a=null}function i(){r(e)||a||(e.value=!0,a=setInterval((()=>{1===r(n)?(o(),n.value=t):n.value-=1}),1e3))}function c(){n.value=t,o()}return l((()=>{c()})),{start:i,reset:c,restart:function(){c(),i()},clear:u,stop:o,currentCount:n,isStart:e}}(t.count),{t:c}=y();return e((()=>{void 0===t.value&&i()})),{handleStart:function(){return e=this,a=null,u=function*(){const{beforeStartFunc:e}=t;if(e&&g(e)){n.value=!0;try{(yield e())&&o()}finally{n.value=!1}}else o()},new Promise(((t,n)=>{var o=t=>{try{r(u.next(t))}catch(e){n(e)}},s=t=>{try{r(u.throw(t))}catch(e){n(e)}},r=n=>n.done?t(n.value):Promise.resolve(n.value).then(o,s);r((u=u.apply(e,a)).next())}));var e,a,u},isStart:u,currentCount:a,loading:n,t:c}}});A.render=function(t,n,e,a,u,o){const s=d("Button");return f(),v(s,S(t.$attrs,{disabled:t.isStart,onClick:t.handleStart,loading:t.loading}),{default:p((()=>[m(C(t.isStart?t.t("component.countdown.sendText",[t.currentCount]):t.t("component.countdown.normalText")),1)])),_:1},16,["disabled","onClick","loading"])};var B=i({name:"CountDownInput",components:{[h.name]:h,CountButton:A},inheritAttrs:!1,props:{value:x.string,size:x.oneOf(["default","large","small"]),count:x.number.def(60),sendCodeApi:{type:Function,default:null}},setup(t){const{prefixCls:n}=w("countdown-input"),[e]=z(t);return{prefixCls:n,state:e}}});B.render=function(t,n,e,a,u,o){const s=d("CountButton"),r=d("AInput");return f(),v(r,S(t.$attrs,{class:t.prefixCls,size:t.size,value:t.state}),{addonAfter:p((()=>[b(s,{size:t.size,count:t.count,value:t.state,beforeStartFunc:t.sendCodeApi},null,8,["size","count","value","beforeStartFunc"])])),_:1},16,["class","size","value"])};export{B as _,z as u};
  