const e=require("../_util/classNames.js"),t=require("../_util/omit.js"),n=require("../_util/BaseInput.js"),r=require("./inputProps.js"),i=require("./utils/commonUtils.js"),a=require("./BaseInput.js");let o=require("vue");var s=(0,o.defineComponent)({name:`VCInput`,inheritAttrs:!1,props:r.inputProps(),setup(r,{slots:s,attrs:c,expose:l,emit:u}){let d=(0,o.shallowRef)(r.value===void 0?r.defaultValue:r.value),f=(0,o.shallowRef)(!1),p=(0,o.shallowRef)(),m=(0,o.shallowRef)();(0,o.watch)(()=>r.value,()=>{d.value=r.value}),(0,o.watch)(()=>r.disabled,()=>{r.disabled&&(f.value=!1)});let h=e=>{p.value&&i.triggerFocus(p.value.input,e)};l({focus:h,blur:()=>{p.value.input?.blur()},input:(0,o.computed)(()=>p.value.input?.input),stateValue:d,setSelectionRange:(e,t,n)=>{p.value.input?.setSelectionRange(e,t,n)},select:()=>{p.value.input?.select()}});let g=e=>{u(`change`,e)},_=(e,t)=>{d.value!==e&&(r.value===void 0?d.value=e:(0,o.nextTick)(()=>{p.value.input.value!==d.value&&m.value?.$forceUpdate()}),(0,o.nextTick)(()=>{t&&t()}))},v=e=>{let{value:t}=e.target;if(d.value===t)return;let n=e.target.value;i.resolveOnChange(p.value.input,e,g),_(n)},y=e=>{e.keyCode===13&&u(`pressEnter`,e),u(`keydown`,e)},b=e=>{f.value=!0,u(`focus`,e)},x=e=>{f.value=!1,u(`blur`,e)},S=e=>{i.resolveOnChange(p.value.input,e,g),_(``,()=>{h()})},C=()=>{let{addonBefore:a=s.addonBefore,addonAfter:l=s.addonAfter,disabled:u,valueModifiers:d={},htmlSize:f,autocomplete:m,prefixCls:h,inputClassName:g,prefix:_=s.prefix?.(),suffix:S=s.suffix?.(),allowClear:C,type:w=`text`}=r,T={...t.default(r,[`prefixCls`,`onPressEnter`,`addonBefore`,`addonAfter`,`prefix`,`suffix`,`allowClear`,`defaultValue`,`size`,`bordered`,`htmlSize`,`lazy`,`showCount`,`valueModifiers`,`showCount`,`affixWrapperClassName`,`groupClassName`,`inputClassName`,`wrapperClassName`]),...c,autocomplete:m,onChange:v,onInput:v,onFocus:b,onBlur:x,onKeydown:y,class:e.default(h,{[`${h}-disabled`]:u},g,!i.hasAddon({addonAfter:l,addonBefore:a})&&!i.hasPrefixSuffix({prefix:_,suffix:S,allowClear:C})&&c.class),ref:p,key:`ant-input`,size:f,type:w,lazy:r.lazy};return d.lazy&&delete T.onInput,T.autofocus||delete T.autofocus,(0,o.createVNode)(n.default,t.default(T,[`size`]),null)},w=()=>{let{maxlength:t,suffix:n=s.suffix?.(),showCount:a,prefixCls:c}=r,l=Number(t)>0;if(n||a){let r=[...i.fixControlledValue(d.value)].length,s=typeof a==`object`?a.formatter({count:r,maxlength:t}):`${r}${l?` / ${t}`:``}`;return(0,o.createVNode)(o.Fragment,null,[!!a&&(0,o.createVNode)(`span`,{class:e.default(`${c}-show-count-suffix`,{[`${c}-show-count-has-suffix`]:!!n})},[s]),n])}return null};return(0,o.onMounted)(()=>{}),()=>{let{prefixCls:e,disabled:t,...n}=r;return(0,o.createVNode)(a.default,{...n,...c,ref:m,prefixCls:e,inputElement:C(),handleReset:S,value:i.fixControlledValue(d.value),focused:f.value,triggerFocus:h,suffix:w(),disabled:t},s)}}});exports.default=s;