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