"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("../_util/classNames.js"),w=require("../_util/vnode.js"),P=require("./inputProps.js"),m=require("./utils/commonUtils.js"),B=e.defineComponent({name:"BaseInput",inheritAttrs:!1,props:P.baseInputProps(),setup(C,{slots:t,attrs:f}){const y=e.ref(),v=d=>{if(y.value?.contains(d.target)){const{triggerFocus:r}=C;r?.()}},V=()=>{const{allowClear:d,value:r,disabled:N,readonly:c,handleReset:h,suffix:u=t.suffix,prefixCls:n}=C;if(!d)return null;const i=!N&&!c&&r,s=`${n}-clear-icon`,o=t.clearIcon?.()||"*";return e.createVNode("span",{onClick:h,onMousedown:l=>l.preventDefault(),class:x.default({[`${s}-hidden`]:!i,[`${s}-has-suffix`]:!!u},s),role:"button",tabindex:-1},[o])};return()=>{const{focused:d,value:r,disabled:N,allowClear:c,readonly:h,hidden:u,prefixCls:n,prefix:i=t.prefix?.(),suffix:s=t.suffix?.(),addonAfter:o=t.addonAfter,addonBefore:l=t.addonBefore,inputElement:b,affixWrapperClassName:A,wrapperClassName:I,groupClassName:q}=C;let $=w.cloneElement(b,{value:r,hidden:u});if(m.hasPrefixSuffix({prefix:i,suffix:s,allowClear:c})){const a=`${n}-affix-wrapper`,p=x.default(a,{[`${a}-disabled`]:N,[`${a}-focused`]:d,[`${a}-readonly`]:h,[`${a}-input-with-clear-btn`]:s&&c&&r},!m.hasAddon({addonAfter:o,addonBefore:l})&&f.class,A),g=(s||c)&&e.createVNode("span",{class:`${n}-suffix`},[V(),s]);$=e.createVNode("span",{class:p,style:f.style,hidden:!m.hasAddon({addonAfter:o,addonBefore:l})&&u,onMousedown:v,ref:y},[i&&e.createVNode("span",{class:`${n}-prefix`},[i]),w.cloneElement(b,{style:null,value:r,hidden:null}),g])}if(m.hasAddon({addonAfter:o,addonBefore:l})){const a=`${n}-group`,p=`${a}-addon`,g=x.default(`${n}-wrapper`,a,I),M=x.default(`${n}-group-wrapper`,f.class,q);return e.createVNode("span",{class:M,style:f.style,hidden:u},[e.createVNode("span",{class:g},[l&&e.createVNode("span",{class:p},[l]),w.cloneElement($,{style:null,hidden:null}),o&&e.createVNode("span",{class:p},[o])])])}return $}}});exports.default=B;
