import{Q as w,S as D,c as o,d as m,p as $,n as b}from"./index.fdb8061e.js";import{c as v,n as g,m as u,A as L,h as N,w as B,p as U,C as q,D as A,I as O,y as V}from"./index.555136dd.js";function Y(e,{args:a=[],done:t,canceled:l}){if(e){const i=e.apply(null,a);w(i)?i.then(r=>{r?t():l&&l()}).catch(D):i?t():l&&l()}else t()}const[E,d]=v("loading"),Q=Array(12).fill(null).map((e,a)=>o("i",{class:d("line",String(a+1))},null)),j=o("svg",{class:d("circular"),viewBox:"25 25 50 50"},[o("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),F={size:g,type:u("circular"),color:String,vertical:Boolean,textSize:g,textColor:String};var G=m({name:E,props:F,setup(e,{slots:a}){const t=$(()=>b({color:e.color},L(e.size))),l=()=>{var i;if(a.default)return o("span",{class:d("text"),style:{fontSize:N(e.textSize),color:(i=e.textColor)!=null?i:e.color}},[a.default()])};return()=>{const{type:i,vertical:r}=e;return o("div",{class:d([i,{vertical:r}]),"aria-live":"polite","aria-busy":!0},[o("span",{class:d("spinner",i),style:t.value},[i==="spinner"?Q:j]),l()])}}});const H=B(G),[J,c]=v("button"),K=b({},U,{tag:u("button"),text:String,icon:String,type:u("default"),size:u("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:u("button"),loadingSize:g,loadingText:String,loadingType:String,iconPosition:u("left")});var M=m({name:J,props:K,emits:["click"],setup(e,{emit:a,slots:t}){const l=q(),i=()=>t.loading?t.loading():o(H,{size:e.loadingSize,type:e.loadingType,class:c("loading")},null),r=()=>{if(e.loading)return i();if(t.icon)return o("div",{class:c("icon")},[t.icon()]);if(e.icon)return o(O,{name:e.icon,class:c("icon"),classPrefix:e.iconPrefix},null)},p=()=>{let n;if(e.loading?n=e.loadingText:n=t.default?t.default():e.text,n)return o("span",{class:c("text")},[n])},z=()=>{const{color:n,plain:f}=e;if(n){const s={color:f?n:"white"};return f||(s.background=n),n.includes("gradient")?s.border=0:s.borderColor=n,s}},P=n=>{e.loading?V(n):e.disabled||(a("click",n),l())};return()=>{const{tag:n,type:f,size:s,block:h,round:k,plain:C,square:I,loading:T,disabled:x,hairline:y,nativeType:R,iconPosition:S}=e,_=[c([f,s,{plain:C,block:h,round:k,square:I,loading:T,disabled:x,hairline:y}]),{[A]:y}];return o(n,{type:R,class:_,style:z(),disabled:x,onClick:P},{default:()=>[o("div",{class:c("content")},[S==="left"&&r(),p(),S==="right"&&r()])]})}}});const Z=B(M);export{Z as B,H as L,Y as c};
