import{booleanType as e,stringType as t}from"../_util/type.mjs";import n from"../_util/classNames.mjs";import r from"../_util/omit.mjs";import{useInjectDisabled as i}from"../config-provider/DisabledContext.mjs";import a from"../config-provider/hooks/useConfigInject.mjs";import o from"../_util/vue-types/index.mjs";import{getMergedStatus as s,getStatusClassNames as c}from"../_util/statusUtils.mjs";import{FormItemInputContext as l,NoFormStatus as u,useInjectFormItemContext as d}from"../form/FormItemContext.mjs";import{NoCompactStyle as f,useCompactItemContext as p}from"../space/Compact.mjs";import{cloneElement as m}from"../_util/vnode.mjs";import h from"../_util/isValidValue.mjs";import g,{inputNumberProps as _}from"./src/InputNumber.mjs";import v from"./style/index.mjs";import{computed as y,createVNode as b,defineComponent as x,shallowRef as S,watch as C}from"vue";import{DownOutlined as w,UpOutlined as T}from"@antsoo-lib/icons";var E=_(),D=()=>({...E,size:t(),bordered:e(!0),placeholder:String,name:String,id:String,controls:e(!1),type:String,addonBefore:o.any,addonAfter:o.any,prefix:o.any,"onUpdate:value":E.onChange,valueModifiers:Object,status:t()}),O=x({compatConfig:{MODE:3},name:`AInputNumber`,inheritAttrs:!1,props:D(),slots:Object,setup(e,{emit:t,expose:o,attrs:_,slots:x}){let E=d(),D=l.useInject(),O=y(()=>s(D.status,e.status)),{prefixCls:k,size:A,direction:j,disabled:M}=a(`input-number`,e),{compactSize:N,compactItemClassnames:P}=p(k,j),F=i(),I=y(()=>M.value??F.value),[L,R]=v(k),z=y(()=>N.value||A.value),B=S(e.value??e.defaultValue),V=S(!1);C(()=>e.value,()=>{B.value=e.value});let H=S(null),U=()=>{H.value?.focus()};o({focus:U,blur:()=>{H.value?.blur()}});let W=n=>{e.value===void 0&&(B.value=n),t(`update:value`,n),t(`change`,n),E.onFieldChange()},G=e=>{V.value=!1,t(`blur`,e),E.onFieldBlur()},K=e=>{V.value=!0,t(`focus`,e)};return()=>{let{hasFeedback:t,isFormItemInput:i,feedbackIcon:a}=D,o=e.id??E.id.value,{class:s,bordered:l,readonly:d,style:p,addonBefore:v=x.addonBefore?.(),addonAfter:y=x.addonAfter?.(),prefix:S=x.prefix?.(),valueModifiers:C={},...A}={..._,...e,id:o,disabled:I.value},M=k.value,N=n({[`${M}-lg`]:z.value===`large`,[`${M}-sm`]:z.value===`small`,[`${M}-rtl`]:j.value===`rtl`,[`${M}-readonly`]:d,[`${M}-borderless`]:!l,[`${M}-in-form-item`]:i},c(M,O.value),s,P.value,R.value),F=b(g,{...r(A,[`size`,`defaultValue`]),ref:H,lazy:!!C.lazy,value:B.value,class:N,prefixCls:M,readonly:d,onChange:W,onBlur:G,onFocus:K},{upHandler:x.upIcon?()=>b(`span`,{class:`${M}-handler-up-inner`},[x.upIcon()]):()=>b(T,{class:`${M}-handler-up-inner`},null),downHandler:x.downIcon?()=>b(`span`,{class:`${M}-handler-down-inner`},[x.downIcon()]):()=>b(w,{class:`${M}-handler-down-inner`},null)}),q=h(v)||h(y),J=h(S);if((J||t)&&(F=b(`div`,{class:n(`${M}-affix-wrapper`,c(`${M}-affix-wrapper`,O.value,t),{[`${M}-affix-wrapper-focused`]:V.value,[`${M}-affix-wrapper-disabled`]:I.value,[`${M}-affix-wrapper-sm`]:z.value===`small`,[`${M}-affix-wrapper-lg`]:z.value===`large`,[`${M}-affix-wrapper-rtl`]:j.value===`rtl`,[`${M}-affix-wrapper-readonly`]:d,[`${M}-affix-wrapper-borderless`]:!l,[`${s}`]:!q&&s},R.value),style:p,onClick:U},[J&&b(`span`,{class:`${M}-prefix`},[S]),F,t&&b(`span`,{class:`${M}-suffix`},[a])])),q){let e=`${M}-group`,r=`${e}-addon`,i=v?b(`div`,{class:r},[v]):null,a=y?b(`div`,{class:r},[y]):null,o=n(`${M}-wrapper`,e,{[`${e}-rtl`]:j.value===`rtl`},R.value);F=b(`div`,{class:n(`${M}-group-wrapper`,{[`${M}-group-wrapper-sm`]:z.value===`small`,[`${M}-group-wrapper-lg`]:z.value===`large`,[`${M}-group-wrapper-rtl`]:j.value===`rtl`},c(`${k}-group-wrapper`,O.value,t),s,R.value),style:p},[b(`div`,{class:o},[i&&b(f,null,{default:()=>[b(u,null,{default:()=>[i]})]}),F,a&&b(f,null,{default:()=>[b(u,null,{default:()=>[a]})]})])])}return L(m(F,{style:p}))}}}),k=Object.assign(O,{install:e=>(e.component(O.name,O),e)});export{k as default,D as inputNumberProps};