99AI/public/assets/Input-4816b01d.js
2024-04-20 22:15:08 +08:00

259 lines
32 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{g as E,v as n,cZ as lr,a as x,c as C,d as l,a2 as ir,bT as Ae,t as de,aa as sr,y as j,bH as oe,ab as cr,c3 as ur,r as w,w as fe,aK as dr,k as B,c_ as fr,b as z,a3 as K,u as hr,h as _e,bU as vr,c$ as pr,bV as gr,l as br,j as xr,bZ as me,L as mr,I as wr,aN as we,aT as yr,b6 as Cr,a5 as ue,cM as zr,n as Sr,a9 as Q,ba as Ar,O as _r,cn as Rr,D as ye,B as Ce,A as y,C as ze}from"./index-2efe4620.js";const Br=E({name:"Eye",render(){return n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},n("path",{d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),n("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}))}}),Fr=E({name:"EyeOff",render(){return n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},n("path",{d:"M432 448a15.92 15.92 0 0 1-11.31-4.69l-352-352a16 16 0 0 1 22.62-22.62l352 352A16 16 0 0 1 432 448z",fill:"currentColor"}),n("path",{d:"M255.66 384c-41.49 0-81.5-12.28-118.92-36.5c-34.07-22-64.74-53.51-88.7-91v-.08c19.94-28.57 41.78-52.73 65.24-72.21a2 2 0 0 0 .14-2.94L93.5 161.38a2 2 0 0 0-2.71-.12c-24.92 21-48.05 46.76-69.08 76.92a31.92 31.92 0 0 0-.64 35.54c26.41 41.33 60.4 76.14 98.28 100.65C162 402 207.9 416 255.66 416a239.13 239.13 0 0 0 75.8-12.58a2 2 0 0 0 .77-3.31l-21.58-21.58a4 4 0 0 0-3.83-1a204.8 204.8 0 0 1-51.16 6.47z",fill:"currentColor"}),n("path",{d:"M490.84 238.6c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.66 96a227.34 227.34 0 0 0-74.89 12.83a2 2 0 0 0-.75 3.31l21.55 21.55a4 4 0 0 0 3.88 1a192.82 192.82 0 0 1 50.21-6.69c40.69 0 80.58 12.43 118.55 37c34.71 22.4 65.74 53.88 89.76 91a.13.13 0 0 1 0 .16a310.72 310.72 0 0 1-64.12 72.73a2 2 0 0 0-.15 2.95l19.9 19.89a2 2 0 0 0 2.7.13a343.49 343.49 0 0 0 68.64-78.48a32.2 32.2 0 0 0-.1-34.78z",fill:"currentColor"}),n("path",{d:"M256 160a95.88 95.88 0 0 0-21.37 2.4a2 2 0 0 0-1 3.38l112.59 112.56a2 2 0 0 0 3.38-1A96 96 0 0 0 256 160z",fill:"currentColor"}),n("path",{d:"M165.78 233.66a2 2 0 0 0-3.38 1a96 96 0 0 0 115 115a2 2 0 0 0 1-3.38z",fill:"currentColor"}))}}),Pr=E({name:"ChevronDown",render(){return n("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M3.14645 5.64645C3.34171 5.45118 3.65829 5.45118 3.85355 5.64645L8 9.79289L12.1464 5.64645C12.3417 5.45118 12.6583 5.45118 12.8536 5.64645C13.0488 5.84171 13.0488 6.15829 12.8536 6.35355L8.35355 10.8536C8.15829 11.0488 7.84171 11.0488 7.64645 10.8536L3.14645 6.35355C2.95118 6.15829 2.95118 5.84171 3.14645 5.64645Z",fill:"currentColor"}))}}),$r=lr("clear",n("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},n("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},n("g",{fill:"currentColor","fill-rule":"nonzero"},n("path",{d:"M8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 C2,4.6862915 4.6862915,2 8,2 Z M6.5343055,5.83859116 C6.33943736,5.70359511 6.07001296,5.72288026 5.89644661,5.89644661 L5.89644661,5.89644661 L5.83859116,5.9656945 C5.70359511,6.16056264 5.72288026,6.42998704 5.89644661,6.60355339 L5.89644661,6.60355339 L7.293,8 L5.89644661,9.39644661 L5.83859116,9.4656945 C5.70359511,9.66056264 5.72288026,9.92998704 5.89644661,10.1035534 L5.89644661,10.1035534 L5.9656945,10.1614088 C6.16056264,10.2964049 6.42998704,10.2771197 6.60355339,10.1035534 L6.60355339,10.1035534 L8,8.707 L9.39644661,10.1035534 L9.4656945,10.1614088 C9.66056264,10.2964049 9.92998704,10.2771197 10.1035534,10.1035534 L10.1035534,10.1035534 L10.1614088,10.0343055 C10.2964049,9.83943736 10.2771197,9.57001296 10.1035534,9.39644661 L10.1035534,9.39644661 L8.707,8 L10.1035534,6.60355339 L10.1614088,6.5343055 C10.2964049,6.33943736 10.2771197,6.07001296 10.1035534,5.89644661 L10.1035534,5.89644661 L10.0343055,5.83859116 C9.83943736,5.70359511 9.57001296,5.72288026 9.39644661,5.89644661 L9.39644661,5.89644661 L8,7.293 L6.60355339,5.89644661 Z"}))))),kr=x("base-clear",`
flex-shrink: 0;
height: 1em;
width: 1em;
position: relative;
`,[C(">",[l("clear",`
font-size: var(--n-clear-size);
height: 1em;
width: 1em;
cursor: pointer;
color: var(--n-clear-color);
transition: color .3s var(--n-bezier);
display: flex;
`,[C("&:hover",`
color: var(--n-clear-color-hover)!important;
`),C("&:active",`
color: var(--n-clear-color-pressed)!important;
`)]),l("placeholder",`
display: flex;
`),l("clear, placeholder",`
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
`,[ir({originalTransform:"translateX(-50%) translateY(-50%)",left:"50%",top:"50%"})])])]),he=E({name:"BaseClear",props:{clsPrefix:{type:String,required:!0},show:Boolean,onClear:Function},setup(r){return Ae("-base-clear",kr,de(r,"clsPrefix")),{handleMouseDown(v){v.preventDefault()}}},render(){const{clsPrefix:r}=this;return n("div",{class:`${r}-base-clear`},n(sr,null,{default:()=>{var v,t;return this.show?n("div",{key:"dismiss",class:`${r}-base-clear__clear`,onClick:this.onClear,onMousedown:this.handleMouseDown,"data-clear":!0},j(this.$slots.icon,()=>[n(oe,{clsPrefix:r},{default:()=>n($r,null)})])):n("div",{key:"icon",class:`${r}-base-clear__placeholder`},(t=(v=this.$slots).placeholder)===null||t===void 0?void 0:t.call(v))}}))}}),Er=E({name:"InternalSelectionSuffix",props:{clsPrefix:{type:String,required:!0},showArrow:{type:Boolean,default:void 0},showClear:{type:Boolean,default:void 0},loading:{type:Boolean,default:!1},onClear:Function},setup(r,{slots:v}){return()=>{const{clsPrefix:t}=r;return n(cr,{clsPrefix:t,class:`${t}-base-suffix`,strokeWidth:24,scale:.85,show:r.loading},{default:()=>r.showArrow?n(he,{clsPrefix:t,show:r.showClear,onClear:r.onClear},{placeholder:()=>n(oe,{clsPrefix:t,class:`${t}-base-suffix__arrow`},{default:()=>j(v.default,()=>[n(Pr,null)])})}):null})}}}),Re=ur("n-input");function Tr(r){let v=0;for(const t of r)v++;return v}function ee(r){return r===""||r==null}function Ir(r){const v=w(null);function t(){const{value:b}=r;if(!(b!=null&&b.focus)){_();return}const{selectionStart:f,selectionEnd:s,value:u}=b;if(f==null||s==null){_();return}v.value={start:f,end:s,beforeText:u.slice(0,f),afterText:u.slice(s)}}function A(){var b;const{value:f}=v,{value:s}=r;if(!f||!s)return;const{value:u}=s,{start:c,beforeText:i,afterText:g}=f;let m=u.length;if(u.endsWith(g))m=u.length-g.length;else if(u.startsWith(i))m=i.length;else{const T=i[c-1],S=u.indexOf(T,c-1);S!==-1&&(m=S+1)}(b=s.setSelectionRange)===null||b===void 0||b.call(s,m,m)}function _(){v.value=null}return fe(r,_),{recordCursor:t,restoreCursor:A}}const Se=E({name:"InputWordCount",setup(r,{slots:v}){const{mergedValueRef:t,maxlengthRef:A,mergedClsPrefixRef:_,countGraphemesRef:b}=dr(Re),f=B(()=>{const{value:s}=t;return s===null||Array.isArray(s)?0:(b.value||Tr)(s)});return()=>{const{value:s}=A,{value:u}=t;return n("span",{class:`${_.value}-input-word-count`},fr(v.default,{value:u===null||Array.isArray(u)?"":u},()=>[s===void 0?f.value:`${f.value} / ${s}`]))}}}),Mr=x("input",`
max-width: 100%;
cursor: text;
line-height: 1.5;
z-index: auto;
outline: none;
box-sizing: border-box;
position: relative;
display: inline-flex;
border-radius: var(--n-border-radius);
background-color: var(--n-color);
transition: background-color .3s var(--n-bezier);
font-size: var(--n-font-size);
--n-padding-vertical: calc((var(--n-height) - 1.5 * var(--n-font-size)) / 2);
`,[l("input, textarea",`
overflow: hidden;
flex-grow: 1;
position: relative;
`),l("input-el, textarea-el, input-mirror, textarea-mirror, separator, placeholder",`
box-sizing: border-box;
font-size: inherit;
line-height: 1.5;
font-family: inherit;
border: none;
outline: none;
background-color: #0000;
text-align: inherit;
transition:
-webkit-text-fill-color .3s var(--n-bezier),
caret-color .3s var(--n-bezier),
color .3s var(--n-bezier),
text-decoration-color .3s var(--n-bezier);
`),l("input-el, textarea-el",`
-webkit-appearance: none;
scrollbar-width: none;
width: 100%;
min-width: 0;
text-decoration-color: var(--n-text-decoration-color);
color: var(--n-text-color);
caret-color: var(--n-caret-color);
background-color: transparent;
`,[C("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",`
width: 0;
height: 0;
display: none;
`),C("&::placeholder",`
color: #0000;
-webkit-text-fill-color: transparent !important;
`),C("&:-webkit-autofill ~",[l("placeholder","display: none;")])]),z("round",[K("textarea","border-radius: calc(var(--n-height) / 2);")]),l("placeholder",`
pointer-events: none;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
overflow: hidden;
color: var(--n-placeholder-color);
`,[C("span",`
width: 100%;
display: inline-block;
`)]),z("textarea",[l("placeholder","overflow: visible;")]),K("autosize","width: 100%;"),z("autosize",[l("textarea-el, input-el",`
position: absolute;
top: 0;
left: 0;
height: 100%;
`)]),x("input-wrapper",`
overflow: hidden;
display: inline-flex;
flex-grow: 1;
position: relative;
padding-left: var(--n-padding-left);
padding-right: var(--n-padding-right);
`),l("input-mirror",`
padding: 0;
height: var(--n-height);
line-height: var(--n-height);
overflow: hidden;
visibility: hidden;
position: static;
white-space: pre;
pointer-events: none;
`),l("input-el",`
padding: 0;
height: var(--n-height);
line-height: var(--n-height);
`,[C("&[type=password]::-ms-reveal","display: none;"),C("+",[l("placeholder",`
display: flex;
align-items: center;
`)])]),K("textarea",[l("placeholder","white-space: nowrap;")]),l("eye",`
display: flex;
align-items: center;
justify-content: center;
transition: color .3s var(--n-bezier);
`),z("textarea","width: 100%;",[x("input-word-count",`
position: absolute;
right: var(--n-padding-right);
bottom: var(--n-padding-vertical);
`),z("resizable",[x("input-wrapper",`
resize: vertical;
min-height: var(--n-height);
`)]),l("textarea-el, textarea-mirror, placeholder",`
height: 100%;
padding-left: 0;
padding-right: 0;
padding-top: var(--n-padding-vertical);
padding-bottom: var(--n-padding-vertical);
word-break: break-word;
display: inline-block;
vertical-align: bottom;
box-sizing: border-box;
line-height: var(--n-line-height-textarea);
margin: 0;
resize: none;
white-space: pre-wrap;
scroll-padding-block-end: var(--n-padding-vertical);
`),l("textarea-mirror",`
width: 100%;
pointer-events: none;
overflow: hidden;
visibility: hidden;
position: static;
white-space: pre-wrap;
overflow-wrap: break-word;
`)]),z("pair",[l("input-el, placeholder","text-align: center;"),l("separator",`
display: flex;
align-items: center;
transition: color .3s var(--n-bezier);
color: var(--n-text-color);
white-space: nowrap;
`,[x("icon",`
color: var(--n-icon-color);
`),x("base-icon",`
color: var(--n-icon-color);
`)])]),z("disabled",`
cursor: not-allowed;
background-color: var(--n-color-disabled);
`,[l("border","border: var(--n-border-disabled);"),l("input-el, textarea-el",`
cursor: not-allowed;
color: var(--n-text-color-disabled);
text-decoration-color: var(--n-text-color-disabled);
`),l("placeholder","color: var(--n-placeholder-color-disabled);"),l("separator","color: var(--n-text-color-disabled);",[x("icon",`
color: var(--n-icon-color-disabled);
`),x("base-icon",`
color: var(--n-icon-color-disabled);
`)]),x("input-word-count",`
color: var(--n-count-text-color-disabled);
`),l("suffix, prefix","color: var(--n-text-color-disabled);",[x("icon",`
color: var(--n-icon-color-disabled);
`),x("internal-icon",`
color: var(--n-icon-color-disabled);
`)])]),K("disabled",[l("eye",`
color: var(--n-icon-color);
cursor: pointer;
`,[C("&:hover",`
color: var(--n-icon-color-hover);
`),C("&:active",`
color: var(--n-icon-color-pressed);
`)]),C("&:hover",[l("state-border","border: var(--n-border-hover);")]),z("focus","background-color: var(--n-color-focus);",[l("state-border",`
border: var(--n-border-focus);
box-shadow: var(--n-box-shadow-focus);
`)])]),l("border, state-border",`
box-sizing: border-box;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
pointer-events: none;
border-radius: inherit;
border: var(--n-border);
transition:
box-shadow .3s var(--n-bezier),
border-color .3s var(--n-bezier);
`),l("state-border",`
border-color: #0000;
z-index: 1;
`),l("prefix","margin-right: 4px;"),l("suffix",`
margin-left: 4px;
`),l("suffix, prefix",`
transition: color .3s var(--n-bezier);
flex-wrap: nowrap;
flex-shrink: 0;
line-height: var(--n-height);
white-space: nowrap;
display: inline-flex;
align-items: center;
justify-content: center;
color: var(--n-suffix-text-color);
`,[x("base-loading",`
font-size: var(--n-icon-size);
margin: 0 2px;
color: var(--n-loading-color);
`),x("base-clear",`
font-size: var(--n-icon-size);
`,[l("placeholder",[x("base-icon",`
transition: color .3s var(--n-bezier);
color: var(--n-icon-color);
font-size: var(--n-icon-size);
`)])]),C(">",[x("icon",`
transition: color .3s var(--n-bezier);
color: var(--n-icon-color);
font-size: var(--n-icon-size);
`)]),x("base-icon",`
font-size: var(--n-icon-size);
`)]),x("input-word-count",`
pointer-events: none;
line-height: 1.5;
font-size: .85em;
color: var(--n-count-text-color);
transition: color .3s var(--n-bezier);
margin-left: 4px;
font-variant: tabular-nums;
`),["warning","error"].map(r=>z(`${r}-status`,[K("disabled",[x("base-loading",`
color: var(--n-loading-color-${r})
`),l("input-el, textarea-el",`
caret-color: var(--n-caret-color-${r});
`),l("state-border",`
border: var(--n-border-${r});
`),C("&:hover",[l("state-border",`
border: var(--n-border-hover-${r});
`)]),C("&:focus",`
background-color: var(--n-color-focus-${r});
`,[l("state-border",`
box-shadow: var(--n-box-shadow-focus-${r});
border: var(--n-border-focus-${r});
`)]),z("focus",`
background-color: var(--n-color-focus-${r});
`,[l("state-border",`
box-shadow: var(--n-box-shadow-focus-${r});
border: var(--n-border-focus-${r});
`)])])]))]),Dr=x("input",[z("disabled",[l("input-el, textarea-el",`
-webkit-text-fill-color: var(--n-text-color-disabled);
`)])]),Lr=Object.assign(Object.assign({},_e.props),{bordered:{type:Boolean,default:void 0},type:{type:String,default:"text"},placeholder:[Array,String],defaultValue:{type:[String,Array],default:null},value:[String,Array],disabled:{type:Boolean,default:void 0},size:String,rows:{type:[Number,String],default:3},round:Boolean,minlength:[String,Number],maxlength:[String,Number],clearable:Boolean,autosize:{type:[Boolean,Object],default:!1},pair:Boolean,separator:String,readonly:{type:[String,Boolean],default:!1},passivelyActivated:Boolean,showPasswordOn:String,stateful:{type:Boolean,default:!0},autofocus:Boolean,inputProps:Object,resizable:{type:Boolean,default:!0},showCount:Boolean,loading:{type:Boolean,default:void 0},allowInput:Function,renderCount:Function,onMousedown:Function,onKeydown:Function,onKeyup:[Function,Array],onInput:[Function,Array],onFocus:[Function,Array],onBlur:[Function,Array],onClick:[Function,Array],onChange:[Function,Array],onClear:[Function,Array],countGraphemes:Function,status:String,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],textDecoration:[String,Array],attrSize:{type:Number,default:20},onInputBlur:[Function,Array],onInputFocus:[Function,Array],onDeactivate:[Function,Array],onActivate:[Function,Array],onWrapperFocus:[Function,Array],onWrapperBlur:[Function,Array],internalDeactivateOnEnter:Boolean,internalForceFocus:Boolean,internalLoadingBeforeSuffix:{type:Boolean,default:!0},showPasswordToggle:Boolean}),Wr=E({name:"Input",props:Lr,setup(r){const{mergedClsPrefixRef:v,mergedBorderedRef:t,inlineThemeDisabled:A,mergedRtlRef:_}=hr(r),b=_e("Input","-input",Mr,vr,r,v);pr&&Ae("-input-safari",Dr,v);const f=w(null),s=w(null),u=w(null),c=w(null),i=w(null),g=w(null),m=w(null),T=Ir(m),S=w(null),{localeRef:Be}=gr("Input"),U=w(r.defaultValue),Fe=de(r,"value"),R=br(Fe,U),L=xr(r),{mergedSizeRef:re,mergedDisabledRef:I,mergedStatusRef:Pe}=L,M=w(!1),V=w(!1),F=w(!1),W=w(!1);let ne=null;const te=B(()=>{const{placeholder:e,pair:o}=r;return o?Array.isArray(e)?e:e===void 0?["",""]:[e,e]:e===void 0?[Be.value.placeholder]:[e]}),$e=B(()=>{const{value:e}=F,{value:o}=R,{value:a}=te;return!e&&(ee(o)||Array.isArray(o)&&ee(o[0]))&&a[0]}),ke=B(()=>{const{value:e}=F,{value:o}=R,{value:a}=te;return!e&&a[1]&&(ee(o)||Array.isArray(o)&&ee(o[1]))}),ae=me(()=>r.internalForceFocus||M.value),Ee=me(()=>{if(I.value||r.readonly||!r.clearable||!ae.value&&!V.value)return!1;const{value:e}=R,{value:o}=ae;return r.pair?!!(Array.isArray(e)&&(e[0]||e[1]))&&(V.value||o):!!e&&(V.value||o)}),le=B(()=>{const{showPasswordOn:e}=r;if(e)return e;if(r.showPasswordToggle)return"click"}),O=w(!1),Te=B(()=>{const{textDecoration:e}=r;return e?Array.isArray(e)?e.map(o=>({textDecoration:o})):[{textDecoration:e}]:["",""]}),ve=w(void 0),Ie=()=>{var e,o;if(r.type==="textarea"){const{autosize:a}=r;if(a&&(ve.value=(o=(e=S.value)===null||e===void 0?void 0:e.$el)===null||o===void 0?void 0:o.offsetWidth),!s.value||typeof a=="boolean")return;const{paddingTop:h,paddingBottom:p,lineHeight:d}=window.getComputedStyle(s.value),P=Number(h.slice(0,-2)),$=Number(p.slice(0,-2)),k=Number(d.slice(0,-2)),{value:N}=u;if(!N)return;if(a.minRows){const H=Math.max(a.minRows,1),ce=`${P+$+k*H}px`;N.style.minHeight=ce}if(a.maxRows){const H=`${P+$+k*a.maxRows}px`;N.style.maxHeight=H}}},Me=B(()=>{const{maxlength:e}=r;return e===void 0?void 0:Number(e)});mr(()=>{const{value:e}=R;Array.isArray(e)||se(e)});const De=wr().proxy;function G(e,o){const{onUpdateValue:a,"onUpdate:value":h,onInput:p}=r,{nTriggerFormInput:d}=L;a&&y(a,e,o),h&&y(h,e,o),p&&y(p,e,o),U.value=e,d()}function X(e,o){const{onChange:a}=r,{nTriggerFormChange:h}=L;a&&y(a,e,o),U.value=e,h()}function Le(e){const{onBlur:o}=r,{nTriggerFormBlur:a}=L;o&&y(o,e),a()}function Ve(e){const{onFocus:o}=r,{nTriggerFormFocus:a}=L;o&&y(o,e),a()}function We(e){const{onClear:o}=r;o&&y(o,e)}function Oe(e){const{onInputBlur:o}=r;o&&y(o,e)}function Ne(e){const{onInputFocus:o}=r;o&&y(o,e)}function He(){const{onDeactivate:e}=r;e&&y(e)}function Ke(){const{onActivate:e}=r;e&&y(e)}function je(e){const{onClick:o}=r;o&&y(o,e)}function Ue(e){const{onWrapperFocus:o}=r;o&&y(o,e)}function Ge(e){const{onWrapperBlur:o}=r;o&&y(o,e)}function Xe(){F.value=!0}function Ye(e){F.value=!1,e.target===g.value?Y(e,1):Y(e,0)}function Y(e,o=0,a="input"){const h=e.target.value;if(se(h),e instanceof InputEvent&&!e.isComposing&&(F.value=!1),r.type==="textarea"){const{value:d}=S;d&&d.syncUnifiedContainer()}if(ne=h,F.value)return;T.recordCursor();const p=Ze(h);if(p)if(!r.pair)a==="input"?G(h,{source:o}):X(h,{source:o});else{let{value:d}=R;Array.isArray(d)?d=[d[0],d[1]]:d=["",""],d[o]=h,a==="input"?G(d,{source:o}):X(d,{source:o})}De.$forceUpdate(),p||ye(T.restoreCursor)}function Ze(e){const{countGraphemes:o,maxlength:a,minlength:h}=r;if(o){let d;if(a!==void 0&&(d===void 0&&(d=o(e)),d>Number(a))||h!==void 0&&(d===void 0&&(d=o(e)),d<Number(a)))return!1}const{allowInput:p}=r;return typeof p=="function"?p(e):!0}function qe(e){Oe(e),e.relatedTarget===f.value&&He(),e.relatedTarget!==null&&(e.relatedTarget===i.value||e.relatedTarget===g.value||e.relatedTarget===s.value)||(W.value=!1),Z(e,"blur"),m.value=null}function Je(e,o){Ne(e),M.value=!0,W.value=!0,Ke(),Z(e,"focus"),o===0?m.value=i.value:o===1?m.value=g.value:o===2&&(m.value=s.value)}function Qe(e){r.passivelyActivated&&(Ge(e),Z(e,"blur"))}function eo(e){r.passivelyActivated&&(M.value=!0,Ue(e),Z(e,"focus"))}function Z(e,o){e.relatedTarget!==null&&(e.relatedTarget===i.value||e.relatedTarget===g.value||e.relatedTarget===s.value||e.relatedTarget===f.value)||(o==="focus"?(Ve(e),M.value=!0):o==="blur"&&(Le(e),M.value=!1))}function oo(e,o){Y(e,o,"change")}function ro(e){je(e)}function no(e){We(e),pe()}function pe(){r.pair?(G(["",""],{source:"clear"}),X(["",""],{source:"clear"})):(G("",{source:"clear"}),X("",{source:"clear"}))}function to(e){const{onMousedown:o}=r;o&&o(e);const{tagName:a}=e.target;if(a!=="INPUT"&&a!=="TEXTAREA"){if(r.resizable){const{value:h}=f;if(h){const{left:p,top:d,width:P,height:$}=h.getBoundingClientRect(),k=14;if(p+P-k<e.clientX&&e.clientX<p+P&&d+$-k<e.clientY&&e.clientY<d+$)return}}e.preventDefault(),M.value||ge()}}function ao(){var e;V.value=!0,r.type==="textarea"&&((e=S.value)===null||e===void 0||e.handleMouseEnterWrapper())}function lo(){var e;V.value=!1,r.type==="textarea"&&((e=S.value)===null||e===void 0||e.handleMouseLeaveWrapper())}function io(){I.value||le.value==="click"&&(O.value=!O.value)}function so(e){if(I.value)return;e.preventDefault();const o=h=>{h.preventDefault(),ze("mouseup",document,o)};if(Ce("mouseup",document,o),le.value!=="mousedown")return;O.value=!0;const a=()=>{O.value=!1,ze("mouseup",document,a)};Ce("mouseup",document,a)}function co(e){r.onKeyup&&y(r.onKeyup,e)}function uo(e){switch(r.onKeydown&&y(r.onKeydown,e),e.key){case"Escape":ie();break;case"Enter":fo(e);break}}function fo(e){var o,a;if(r.passivelyActivated){const{value:h}=W;if(h){r.internalDeactivateOnEnter&&ie();return}e.preventDefault(),r.type==="textarea"?(o=s.value)===null||o===void 0||o.focus():(a=i.value)===null||a===void 0||a.focus()}}function ie(){r.passivelyActivated&&(W.value=!1,ye(()=>{var e;(e=f.value)===null||e===void 0||e.focus()}))}function ge(){var e,o,a;I.value||(r.passivelyActivated?(e=f.value)===null||e===void 0||e.focus():((o=s.value)===null||o===void 0||o.focus(),(a=i.value)===null||a===void 0||a.focus()))}function ho(){var e;!((e=f.value)===null||e===void 0)&&e.contains(document.activeElement)&&document.activeElement.blur()}function vo(){var e,o;(e=s.value)===null||e===void 0||e.select(),(o=i.value)===null||o===void 0||o.select()}function po(){I.value||(s.value?s.value.focus():i.value&&i.value.focus())}function go(){const{value:e}=f;e!=null&&e.contains(document.activeElement)&&e!==document.activeElement&&ie()}function bo(e){if(r.type==="textarea"){const{value:o}=s;o==null||o.scrollTo(e)}else{const{value:o}=i;o==null||o.scrollTo(e)}}function se(e){const{type:o,pair:a,autosize:h}=r;if(!a&&h)if(o==="textarea"){const{value:p}=u;p&&(p.textContent=(e??"")+`\r
`)}else{const{value:p}=c;p&&(e?p.textContent=e:p.innerHTML="&nbsp;")}}function xo(){Ie()}const be=w({top:"0"});function mo(e){var o;const{scrollTop:a}=e.target;be.value.top=`${-a}px`,(o=S.value)===null||o===void 0||o.syncUnifiedContainer()}let q=null;we(()=>{const{autosize:e,type:o}=r;e&&o==="textarea"?q=fe(R,a=>{!Array.isArray(a)&&a!==ne&&se(a)}):q==null||q()});let J=null;we(()=>{r.type==="textarea"?J=fe(R,e=>{var o;!Array.isArray(e)&&e!==ne&&((o=S.value)===null||o===void 0||o.syncUnifiedContainer())}):J==null||J()}),yr(Re,{mergedValueRef:R,maxlengthRef:Me,mergedClsPrefixRef:v,countGraphemesRef:de(r,"countGraphemes")});const wo={wrapperElRef:f,inputElRef:i,textareaElRef:s,isCompositing:F,clear:pe,focus:ge,blur:ho,select:vo,deactivate:go,activate:po,scrollTo:bo},yo=Cr("Input",_,v),xe=B(()=>{const{value:e}=re,{common:{cubicBezierEaseInOut:o},self:{color:a,borderRadius:h,textColor:p,caretColor:d,caretColorError:P,caretColorWarning:$,textDecorationColor:k,border:N,borderDisabled:H,borderHover:ce,borderFocus:Co,placeholderColor:zo,placeholderColorDisabled:So,lineHeightTextarea:Ao,colorDisabled:_o,colorFocus:Ro,textColorDisabled:Bo,boxShadowFocus:Fo,iconSize:Po,colorFocusWarning:$o,boxShadowFocusWarning:ko,borderWarning:Eo,borderFocusWarning:To,borderHoverWarning:Io,colorFocusError:Mo,boxShadowFocusError:Do,borderError:Lo,borderFocusError:Vo,borderHoverError:Wo,clearSize:Oo,clearColor:No,clearColorHover:Ho,clearColorPressed:Ko,iconColor:jo,iconColorDisabled:Uo,suffixTextColor:Go,countTextColor:Xo,countTextColorDisabled:Yo,iconColorHover:Zo,iconColorPressed:qo,loadingColor:Jo,loadingColorError:Qo,loadingColorWarning:er,[ue("padding",e)]:or,[ue("fontSize",e)]:rr,[ue("height",e)]:nr}}=b.value,{left:tr,right:ar}=zr(or);return{"--n-bezier":o,"--n-count-text-color":Xo,"--n-count-text-color-disabled":Yo,"--n-color":a,"--n-font-size":rr,"--n-border-radius":h,"--n-height":nr,"--n-padding-left":tr,"--n-padding-right":ar,"--n-text-color":p,"--n-caret-color":d,"--n-text-decoration-color":k,"--n-border":N,"--n-border-disabled":H,"--n-border-hover":ce,"--n-border-focus":Co,"--n-placeholder-color":zo,"--n-placeholder-color-disabled":So,"--n-icon-size":Po,"--n-line-height-textarea":Ao,"--n-color-disabled":_o,"--n-color-focus":Ro,"--n-text-color-disabled":Bo,"--n-box-shadow-focus":Fo,"--n-loading-color":Jo,"--n-caret-color-warning":$,"--n-color-focus-warning":$o,"--n-box-shadow-focus-warning":ko,"--n-border-warning":Eo,"--n-border-focus-warning":To,"--n-border-hover-warning":Io,"--n-loading-color-warning":er,"--n-caret-color-error":P,"--n-color-focus-error":Mo,"--n-box-shadow-focus-error":Do,"--n-border-error":Lo,"--n-border-focus-error":Vo,"--n-border-hover-error":Wo,"--n-loading-color-error":Qo,"--n-clear-color":No,"--n-clear-size":Oo,"--n-clear-color-hover":Ho,"--n-clear-color-pressed":Ko,"--n-icon-color":jo,"--n-icon-color-hover":Zo,"--n-icon-color-pressed":qo,"--n-icon-color-disabled":Uo,"--n-suffix-text-color":Go}}),D=A?Sr("input",B(()=>{const{value:e}=re;return e[0]}),xe,r):void 0;return Object.assign(Object.assign({},wo),{wrapperElRef:f,inputElRef:i,inputMirrorElRef:c,inputEl2Ref:g,textareaElRef:s,textareaMirrorElRef:u,textareaScrollbarInstRef:S,rtlEnabled:yo,uncontrolledValue:U,mergedValue:R,passwordVisible:O,mergedPlaceholder:te,showPlaceholder1:$e,showPlaceholder2:ke,mergedFocus:ae,isComposing:F,activated:W,showClearButton:Ee,mergedSize:re,mergedDisabled:I,textDecorationStyle:Te,mergedClsPrefix:v,mergedBordered:t,mergedShowPasswordOn:le,placeholderStyle:be,mergedStatus:Pe,textAreaScrollContainerWidth:ve,handleTextAreaScroll:mo,handleCompositionStart:Xe,handleCompositionEnd:Ye,handleInput:Y,handleInputBlur:qe,handleInputFocus:Je,handleWrapperBlur:Qe,handleWrapperFocus:eo,handleMouseEnter:ao,handleMouseLeave:lo,handleMouseDown:to,handleChange:oo,handleClick:ro,handleClear:no,handlePasswordToggleClick:io,handlePasswordToggleMousedown:so,handleWrapperKeydown:uo,handleWrapperKeyup:co,handleTextAreaMirrorResize:xo,getTextareaScrollContainer:()=>s.value,mergedTheme:b,cssVars:A?void 0:xe,themeClass:D==null?void 0:D.themeClass,onRender:D==null?void 0:D.onRender})},render(){var r,v;const{mergedClsPrefix:t,mergedStatus:A,themeClass:_,type:b,countGraphemes:f,onRender:s}=this,u=this.$slots;return s==null||s(),n("div",{ref:"wrapperElRef",class:[`${t}-input`,_,A&&`${t}-input--${A}-status`,{[`${t}-input--rtl`]:this.rtlEnabled,[`${t}-input--disabled`]:this.mergedDisabled,[`${t}-input--textarea`]:b==="textarea",[`${t}-input--resizable`]:this.resizable&&!this.autosize,[`${t}-input--autosize`]:this.autosize,[`${t}-input--round`]:this.round&&b!=="textarea",[`${t}-input--pair`]:this.pair,[`${t}-input--focus`]:this.mergedFocus,[`${t}-input--stateful`]:this.stateful}],style:this.cssVars,tabindex:!this.mergedDisabled&&this.passivelyActivated&&!this.activated?0:void 0,onFocus:this.handleWrapperFocus,onBlur:this.handleWrapperBlur,onClick:this.handleClick,onMousedown:this.handleMouseDown,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd,onKeyup:this.handleWrapperKeyup,onKeydown:this.handleWrapperKeydown},n("div",{class:`${t}-input-wrapper`},Q(u.prefix,c=>c&&n("div",{class:`${t}-input__prefix`},c)),b==="textarea"?n(Ar,{ref:"textareaScrollbarInstRef",class:`${t}-input__textarea`,container:this.getTextareaScrollContainer,triggerDisplayManually:!0,useUnifiedContainer:!0,internalHoistYRail:!0},{default:()=>{var c,i;const{textAreaScrollContainerWidth:g}=this,m={width:this.autosize&&g&&`${g}px`};return n(_r,null,n("textarea",Object.assign({},this.inputProps,{ref:"textareaElRef",class:[`${t}-input__textarea-el`,(c=this.inputProps)===null||c===void 0?void 0:c.class],autofocus:this.autofocus,rows:Number(this.rows),placeholder:this.placeholder,value:this.mergedValue,disabled:this.mergedDisabled,maxlength:f?void 0:this.maxlength,minlength:f?void 0:this.minlength,readonly:this.readonly,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,style:[this.textDecorationStyle[0],(i=this.inputProps)===null||i===void 0?void 0:i.style,m],onBlur:this.handleInputBlur,onFocus:T=>{this.handleInputFocus(T,2)},onInput:this.handleInput,onChange:this.handleChange,onScroll:this.handleTextAreaScroll})),this.showPlaceholder1?n("div",{class:`${t}-input__placeholder`,style:[this.placeholderStyle,m],key:"placeholder"},this.mergedPlaceholder[0]):null,this.autosize?n(Rr,{onResize:this.handleTextAreaMirrorResize},{default:()=>n("div",{ref:"textareaMirrorElRef",class:`${t}-input__textarea-mirror`,key:"mirror"})}):null)}}):n("div",{class:`${t}-input__input`},n("input",Object.assign({type:b==="password"&&this.mergedShowPasswordOn&&this.passwordVisible?"text":b},this.inputProps,{ref:"inputElRef",class:[`${t}-input__input-el`,(r=this.inputProps)===null||r===void 0?void 0:r.class],style:[this.textDecorationStyle[0],(v=this.inputProps)===null||v===void 0?void 0:v.style],tabindex:this.passivelyActivated&&!this.activated?-1:void 0,placeholder:this.mergedPlaceholder[0],disabled:this.mergedDisabled,maxlength:f?void 0:this.maxlength,minlength:f?void 0:this.minlength,value:Array.isArray(this.mergedValue)?this.mergedValue[0]:this.mergedValue,readonly:this.readonly,autofocus:this.autofocus,size:this.attrSize,onBlur:this.handleInputBlur,onFocus:c=>{this.handleInputFocus(c,0)},onInput:c=>{this.handleInput(c,0)},onChange:c=>{this.handleChange(c,0)}})),this.showPlaceholder1?n("div",{class:`${t}-input__placeholder`},n("span",null,this.mergedPlaceholder[0])):null,this.autosize?n("div",{class:`${t}-input__input-mirror`,key:"mirror",ref:"inputMirrorElRef"}," "):null),!this.pair&&Q(u.suffix,c=>c||this.clearable||this.showCount||this.mergedShowPasswordOn||this.loading!==void 0?n("div",{class:`${t}-input__suffix`},[Q(u["clear-icon-placeholder"],i=>(this.clearable||i)&&n(he,{clsPrefix:t,show:this.showClearButton,onClear:this.handleClear},{placeholder:()=>i,icon:()=>{var g,m;return(m=(g=this.$slots)["clear-icon"])===null||m===void 0?void 0:m.call(g)}})),this.internalLoadingBeforeSuffix?null:c,this.loading!==void 0?n(Er,{clsPrefix:t,loading:this.loading,showArrow:!1,showClear:!1,style:this.cssVars}):null,this.internalLoadingBeforeSuffix?c:null,this.showCount&&this.type!=="textarea"?n(Se,null,{default:i=>{var g;return(g=u.count)===null||g===void 0?void 0:g.call(u,i)}}):null,this.mergedShowPasswordOn&&this.type==="password"?n("div",{class:`${t}-input__eye`,onMousedown:this.handlePasswordToggleMousedown,onClick:this.handlePasswordToggleClick},this.passwordVisible?j(u["password-visible-icon"],()=>[n(oe,{clsPrefix:t},{default:()=>n(Br,null)})]):j(u["password-invisible-icon"],()=>[n(oe,{clsPrefix:t},{default:()=>n(Fr,null)})])):null]):null)),this.pair?n("span",{class:`${t}-input__separator`},j(u.separator,()=>[this.separator])):null,this.pair?n("div",{class:`${t}-input-wrapper`},n("div",{class:`${t}-input__input`},n("input",{ref:"inputEl2Ref",type:this.type,class:`${t}-input__input-el`,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,placeholder:this.mergedPlaceholder[1],disabled:this.mergedDisabled,maxlength:f?void 0:this.maxlength,minlength:f?void 0:this.minlength,value:Array.isArray(this.mergedValue)?this.mergedValue[1]:void 0,readonly:this.readonly,style:this.textDecorationStyle[1],onBlur:this.handleInputBlur,onFocus:c=>{this.handleInputFocus(c,1)},onInput:c=>{this.handleInput(c,1)},onChange:c=>{this.handleChange(c,1)}}),this.showPlaceholder2?n("div",{class:`${t}-input__placeholder`},n("span",null,this.mergedPlaceholder[1])):null),Q(u.suffix,c=>(this.clearable||c)&&n("div",{class:`${t}-input__suffix`},[this.clearable&&n(he,{clsPrefix:t,show:this.showClearButton,onClear:this.handleClear},{icon:()=>{var i;return(i=u["clear-icon"])===null||i===void 0?void 0:i.call(u)},placeholder:()=>{var i;return(i=u["clear-icon-placeholder"])===null||i===void 0?void 0:i.call(u)}}),c]))):null,this.mergedBordered?n("div",{class:`${t}-input__border`}):null,this.mergedBordered?n("div",{class:`${t}-input__state-border`}):null,this.showCount&&b==="textarea"?n(Se,null,{default:c=>{var i;const{renderCount:g}=this;return g?g(c):(i=u.count)===null||i===void 0?void 0:i.call(u,c)}}):null)}});export{Pr as C,Wr as N,Er as a};