"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("vue"),w=require("@antsoo-lib/icons"),y=require("../_util/classNames.js"),b=require("../_util/statusUtils.js"),t=require("../_util/type.js"),x=require("../_util/vnode.js"),B=require("../_util/vue-types/index.js"),$=require("../form/FormItemContext.js"),v=require("./util.js"),F=["text","input"],A=p.defineComponent({compatConfig:{MODE:3},name:"ClearableLabeledInput",inheritAttrs:!1,props:{prefixCls:String,inputType:B.default.oneOf(t.tuple("text","input")),value:t.anyType(),defaultValue:t.anyType(),allowClear:{type:Boolean,default:void 0},element:t.anyType(),handleReset:Function,disabled:{type:Boolean,default:void 0},direction:{type:String},size:{type:String},suffix:t.anyType(),prefix:t.anyType(),addonBefore:t.anyType(),addonAfter:t.anyType(),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(r,{slots:d,attrs:o}){const h=$.FormItemInputContext.useInject(),m=e=>{const{value:n,disabled:a,readonly:s,handleReset:u,suffix:i=d.suffix}=r,c=!a&&!s&&n,l=`${e}-clear-icon`;return p.createVNode(w.CloseCircleFilled,{onClick:u,onMousedown:f=>f.preventDefault(),class:y.default({[`${l}-hidden`]:!c,[`${l}-has-suffix`]:!!i},l),role:"button"},null)},C=(e,n)=>{const{value:a,allowClear:s,direction:u,bordered:i,hidden:c,status:l,addonAfter:f=d.addonAfter,addonBefore:g=d.addonBefore,hashId:T}=r,{status:I,hasFeedback:S}=h;if(!s)return x.cloneElement(n,{value:a,disabled:r.disabled});const q=y.default(`${e}-affix-wrapper`,`${e}-affix-wrapper-textarea-with-clear-btn`,b.getStatusClassNames(`${e}-affix-wrapper`,b.getMergedStatus(I,l),S),{[`${e}-affix-wrapper-rtl`]:u==="rtl",[`${e}-affix-wrapper-borderless`]:!i,[`${o.class}`]:!v.hasAddon({addonAfter:f,addonBefore:g})&&o.class},T);return p.createVNode("span",{class:q,style:o.style,hidden:c},[x.cloneElement(n,{style:null,value:a,disabled:r.disabled}),m(e)])};return()=>{const{prefixCls:e,inputType:n,element:a=d.element?.()}=r;return n===F[0]?C(e,a):null}}});exports.default=A;
