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