"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),w=require("../node_modules/.pnpm/throttle-debounce@5.0.2/node_modules/throttle-debounce/esm/index.js"),$=require("../_util/props-util/index.js"),I=require("../_util/props-util/initDefaultProps.js"),y=require("../_util/vue-types/index.js"),C=require("../config-provider/hooks/useConfigInject.js"),P=require("./style/index.js"),V=()=>({prefixCls:String,spinning:{type:Boolean,default:void 0},size:String,wrapperClassName:String,tip:y.default.any,delay:Number,indicator:y.default.any});let r=null;function D(n,a){return!!n&&!!a&&!isNaN(Number(a))}function A(n){const a=n.indicator;r=typeof a=="function"?a:()=>e.createVNode(a,null,null)}const x=e.defineComponent({compatConfig:{MODE:3},name:"ASpin",inheritAttrs:!1,props:I.default(V(),{size:"default",spinning:!0,wrapperClassName:""}),setup(n,{attrs:a,slots:o}){const{prefixCls:t,size:f,direction:S}=C.default("spin",n),[N,g]=P.default(t),s=e.shallowRef(n.spinning&&!D(n.spinning,n.delay));let u;return e.watch([()=>n.spinning,()=>n.delay],()=>{u?.cancel(),u=w.debounce(n.delay,()=>{s.value=n.spinning}),u?.()},{immediate:!0,flush:"post"}),e.onBeforeUnmount(()=>{u?.cancel()}),()=>{const{class:m,...h}=a,{tip:c=o.tip?.()}=n,d=o.default?.(),b={[g.value]:!0,[t.value]:!0,[`${t.value}-sm`]:f.value==="small",[`${t.value}-lg`]:f.value==="large",[`${t.value}-spinning`]:s.value,[`${t.value}-show-text`]:!!c,[`${t.value}-rtl`]:S.value==="rtl",[m]:!!m};function q(i){const v=`${i}-dot`;let l=$.getPropsSlot(o,n,"indicator");return l===null?null:(Array.isArray(l)&&(l=l.length===1?l[0]:l),e.isVNode(l)?e.cloneVNode(l,{class:v}):r&&e.isVNode(r())?e.cloneVNode(r(),{class:v}):e.createVNode("span",{class:`${v} ${i}-dot-spin`},[e.createVNode("i",{class:`${i}-dot-item`},null),e.createVNode("i",{class:`${i}-dot-item`},null),e.createVNode("i",{class:`${i}-dot-item`},null),e.createVNode("i",{class:`${i}-dot-item`},null)]))}const p=e.createVNode("div",{...h,class:b,"aria-live":"polite","aria-busy":s.value},[q(t.value),c?e.createVNode("div",{class:`${t.value}-text`},[c]):null]);if(d&&$.filterEmpty(d).length){const i={[`${t.value}-container`]:!0,[`${t.value}-blur`]:s.value};return N(e.createVNode("div",{class:[`${t.value}-nested-loading`,n.wrapperClassName,g.value]},[s.value&&e.createVNode("div",{key:"loading"},[p]),e.createVNode("div",{class:i,key:"container"},[d])]))}return N(p)}}});exports.default=x;exports.setDefaultIndicator=A;exports.spinProps=V;
