import{defineComponent as z,shallowRef as K,ref as i,watch as M,computed as p,createVNode as O}from"vue";import{styleObjectToString as P}from"../vc-util/Dom/css.mjs";import R from"./BaseInputInner.mjs";import s from"./vue-types/index.mjs";const x=z({compatConfig:{MODE:3},inheritAttrs:!1,props:{disabled:s.looseBool,type:s.string,value:s.any,lazy:s.bool.def(!0),tag:{type:String,default:"input"},size:s.string,style:s.oneOfType([String,Object]),class:s.string},emits:["change","input","blur","keydown","focus","compositionstart","compositionend","keyup","paste","mousedown"],setup(o,{emit:n,attrs:d,expose:g}){const t=K(null),u=i(),l=i(!1);M([()=>o.value,l],()=>{l.value||(u.value=o.value)},{immediate:!0});const c=e=>{n("change",e)},v=e=>{l.value=!0,e.target.composing=!0,n("compositionstart",e)},f=e=>{l.value=!1,e.target.composing=!1,n("compositionend",e);const a=document.createEvent("HTMLEvents");a.initEvent("input",!0,!0),e.target.dispatchEvent(a),c(e)},y=e=>{if(l.value&&o.lazy){u.value=e.target.value;return}n("input",e)},m=e=>{n("blur",e)},h=e=>{n("focus",e)},S=()=>{t.value&&t.value.focus()},w=()=>{t.value&&t.value.blur()},C=e=>{n("keydown",e)},b=e=>{n("keyup",e)},E=(e,a,r)=>{t.value?.setSelectionRange(e,a,r)},T=()=>{t.value?.select()};g({focus:S,blur:w,input:p(()=>t.value?.input),setSelectionRange:E,select:T,getSelectionStart:()=>t.value?.getSelectionStart(),getSelectionEnd:()=>t.value?.getSelectionEnd(),getScrollTop:()=>t.value?.getScrollTop()});const B=e=>{n("mousedown",e)},I=e=>{n("paste",e)},k=p(()=>o.style&&typeof o.style!="string"?P(o.style):o.style);return()=>{const{style:e,lazy:a,...r}=o;return O(R,{...r,...d,style:k.value,onInput:y,onChange:c,onBlur:m,onFocus:h,ref:t,value:u.value,onCompositionstart:v,onCompositionend:f,onKeyup:b,onKeydown:C,onPaste:I,onMousedown:B},null)}}});export{x as default};
