"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),p=require("@antsoo-lib/icons"),y=require("../_util/classNames.js"),q=require("../_util/omit.js"),I=require("../_util/props-util/index.js"),R=require("../_util/vnode.js"),M=require("../config-provider/hooks/useConfigInject.js"),h=require("./Input.js"),E=require("./inputProps.js"),N={click:"onClick",hover:"onMouseover"},V=e=>e?n.createVNode(p.EyeOutlined,null,null):n.createVNode(p.EyeInvisibleOutlined,null,null),S=n.defineComponent({compatConfig:{MODE:3},name:"AInputPassword",inheritAttrs:!1,props:{...E.default(),prefixCls:String,inputPrefixCls:String,action:{type:String,default:"click"},visibilityToggle:{type:Boolean,default:!0},visible:{type:Boolean,default:void 0},"onUpdate:visible":Function,iconRender:Function},setup(e,{slots:f,attrs:v,expose:b,emit:g}){const i=n.shallowRef(!1),C=()=>{const{disabled:t}=e;t||(i.value=!i.value,g("update:visible",i.value))};n.watchEffect(()=>{e.visible!==void 0&&(i.value=!!e.visible)});const u=n.shallowRef();b({focus:()=>{u.value?.focus()},blur:()=>{u.value?.blur()}});const x=t=>{const{action:c,iconRender:r=f.iconRender||V}=e,a=N[c]||"",o=r(i.value),s={[a]:C,class:`${t}-icon`,key:"passwordIcon",onMousedown:d=>{d.preventDefault()},onMouseup:d=>{d.preventDefault()}};return R.cloneElement(I.isValidElement(o)?o:n.createVNode("span",null,[o]),s)},{prefixCls:l,getPrefixCls:P}=M.default("input-password",e),m=n.computed(()=>P("input",e.inputPrefixCls)),w=()=>{const{size:t,visibilityToggle:c,...r}=e,a=c&&x(l.value),o=y.default(l.value,v.class,{[`${l.value}-${t}`]:!!t}),s={...q.default(r,["suffix","iconRender","action"]),...v,type:i.value?"text":"password",class:o,prefixCls:m.value,suffix:a};return t&&(s.size=t),n.createVNode(h.default,{ref:u,...s},f)};return()=>w()}});exports.default=S;
