import{anyType as e,tuple as t}from"../_util/type.mjs";import n from"../_util/classNames.mjs";import r from"../_util/vue-types/index.mjs";import{getMergedStatus as i,getStatusClassNames as a}from"../_util/statusUtils.mjs";import{FormItemInputContext as o}from"../form/FormItemContext.mjs";import{cloneElement as s}from"../_util/vnode.mjs";import{hasAddon as c}from"./util.mjs";import{createVNode as l,defineComponent as u}from"vue";import{CloseCircleFilled as d}from"@antsoo-lib/icons";var f=[`text`,`input`],p=u({compatConfig:{MODE:3},name:`ClearableLabeledInput`,inheritAttrs:!1,props:{prefixCls:String,inputType:r.oneOf(t(`text`,`input`)),value:e(),defaultValue:e(),allowClear:{type:Boolean,default:void 0},element:e(),handleReset:Function,disabled:{type:Boolean,default:void 0},direction:{type:String},size:{type:String},suffix:e(),prefix:e(),addonBefore:e(),addonAfter:e(),readonly:{type:Boolean,default:void 0},focused:{type:Boolean,default:void 0},bordered:{type:Boolean,default:!0},triggerFocus:{type:Function},hidden:Boolean,status:String,hashId:String},setup(e,{slots:t,attrs:r}){let u=o.useInject(),p=r=>{let{value:i,disabled:a,readonly:o,handleReset:s,suffix:c=t.suffix}=e,u=!a&&!o&&i,f=`${r}-clear-icon`;return l(d,{onClick:s,onMousedown:e=>e.preventDefault(),class:n({[`${f}-hidden`]:!u,[`${f}-has-suffix`]:!!c},f),role:`button`},null)},m=(o,d)=>{let{value:f,allowClear:m,direction:h,bordered:g,hidden:_,status:v,addonAfter:y=t.addonAfter,addonBefore:b=t.addonBefore,hashId:x}=e,{status:S,hasFeedback:C}=u;return m?l(`span`,{class:n(`${o}-affix-wrapper`,`${o}-affix-wrapper-textarea-with-clear-btn`,a(`${o}-affix-wrapper`,i(S,v),C),{[`${o}-affix-wrapper-rtl`]:h===`rtl`,[`${o}-affix-wrapper-borderless`]:!g,[`${r.class}`]:!c({addonAfter:y,addonBefore:b})&&r.class},x),style:r.style,hidden:_},[s(d,{style:null,value:f,disabled:e.disabled}),p(o)]):s(d,{value:f,disabled:e.disabled})};return()=>{let{prefixCls:n,inputType:r,element:i=t.element?.()}=e;return r===f[0]?m(n,i):null}}});export{p as default};