System.register(["./index-legacy-26bc1086.js","./index-legacy-37cb4646.js"],(function(e,t){"use strict";var a,r,l,n,o,i,s,u,c,d,g,f,p,m,v,b,h,y,x,k,w,S,C,M,V,I,A,B,E,P,T,z,W,L,$,j,q,F;return{setters:[e=>{a=e.bl,r=e.bm,l=e.bn,n=e.bo,o=e.bp,i=e.c,s=e.n,u=e.m,c=e.b,d=e.ab,g=e.a3,f=e.d,p=e.bq,m=e.x,v=e.r,b=e.ac,h=e.e,y=e.o,x=e.X,k=e.aE,w=e.br,S=e.w,C=e.z,M=e.y,V=e.Y,I=e.a,A=e.bs,B=e.W,E=e.bt,P=e.bd,T=e.p,z=e.I,W=e.h,L=e.A,$=e.be,j=e.k},e=>{q=e.c,F=e.C}],execute:function(){function t(e){return Array.isArray(e)?!e.length:0!==e&&!e}function H(e,t){const{message:a}=t;return o(a)?a(e,t):a||""}function R({target:e}){e.composing=!0}function D({target:e}){e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}function O(e){return[...e].length}function K(e,t){return[...e].slice(0,t).join("")}const[X,Y]=i("field"),G=e("f",{id:String,name:String,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:s,formatter:Function,clearIcon:u("clear"),modelValue:c(""),inputAlign:String,placeholder:String,autocomplete:String,errorMessage:String,enterkeyhint:String,clearTrigger:u("focus"),formatTrigger:u("onChange"),error:{type:Boolean,default:null},disabled:{type:Boolean,default:null},readonly:{type:Boolean,default:null}}),J=d({},q,G,{rows:s,type:u("text"),rules:Array,autosize:[Boolean,Object],labelWidth:s,labelClass:g,labelAlign:String,showWordLimit:Boolean,errorMessageAlign:String,colon:{type:Boolean,default:null}});var N=f({name:X,props:J,emits:["blur","focus","clear","keypress","clickInput","endValidate","startValidate","clickLeftIcon","clickRightIcon","update:modelValue"],setup(e,{emit:o,slots:i}){const s=p(),u=m({status:"unvalidated",focused:!1,validateMessage:""}),c=v(),d=v(),g=v(),{parent:f}=b(A),j=()=>{var t;return String(null!=(t=e.modelValue)?t:"")},q=t=>B(e[t])?e[t]:f&&B(f.props[t])?f.props[t]:void 0,X=h((()=>{const t=q("readonly");if(e.clearable&&!t){const t=""!==j(),a="always"===e.clearTrigger||"focus"===e.clearTrigger&&u.focused;return t&&a}return!1})),G=h((()=>g.value&&i.input?g.value():e.modelValue)),J=e=>e.reduce(((e,a)=>e.then((()=>{if("failed"===u.status)return;let{value:e}=G;if(a.formatter&&(e=a.formatter(e,a)),!function(e,a){if(t(e)){if(a.required)return!1;if(!1===a.validateEmpty)return!0}return!(a.pattern&&!a.pattern.test(String(e)))}(e,a))return u.status="failed",void(u.validateMessage=H(e,a));if(a.validator){if(t(e)&&!1===a.validateEmpty)return;return function(e,t){return new Promise((a=>{const r=t.validator(e,t);n(r)?r.then(a):a(r)}))}(e,a).then((t=>{t&&"string"==typeof t?(u.status="failed",u.validateMessage=t):!1===t&&(u.status="failed",u.validateMessage=H(e,a))}))}}))),Promise.resolve()),N=()=>{u.status="unvalidated",u.validateMessage=""},Q=()=>o("endValidate",{status:u.status,message:u.validateMessage}),U=(t=e.rules)=>new Promise((a=>{N(),t?(o("startValidate"),J(t).then((()=>{"failed"===u.status?(a({name:e.name,message:u.validateMessage}),Q()):(u.status="passed",a(),Q())}))):a()})),Z=t=>{if(f&&e.rules){const{validateTrigger:a}=f.props,r=E(a).includes(t),l=e.rules.filter((e=>e.trigger?E(e.trigger).includes(t):r));l.length&&U(l)}},_=(t,a="onChange")=>{const r=t;t=(t=>{var a;const{maxlength:r}=e;if(B(r)&&O(t)>+r){const e=j();if(e&&O(e)===+r)return e;const l=null==(a=c.value)?void 0:a.selectionEnd;if(u.focused&&l){const e=[...t],a=e.length-+r;return e.splice(l-a,a),e.join("")}return K(t,+r)}return t})(t);const l=O(r)-O(t);if("number"===e.type||"digit"===e.type){const a="number"===e.type;t=P(t,a,a)}let n=0;if(e.formatter&&a===e.formatTrigger){const{formatter:a,maxlength:l}=e;if(t=a(t),B(l)&&O(t)>+l&&(t=K(t,+l)),c.value&&u.focused){const{selectionEnd:e}=c.value,t=K(r,e);n=O(a(t))-O(t)}}if(c.value&&c.value.value!==t)if(u.focused){let{selectionStart:e,selectionEnd:a}=c.value;if(c.value.value=t,B(e)&&B(a)){const r=O(t);l?(e-=l,a-=l):n&&(e+=n,a+=n),c.value.setSelectionRange(Math.min(e,r),Math.min(a,r))}}else c.value.value=t;t!==e.modelValue&&o("update:modelValue",t)},ee=e=>{e.target.composing||_(e.target.value)},te=()=>{var e;return null==(e=c.value)?void 0:e.blur()},ae=()=>{var e;return null==(e=c.value)?void 0:e.focus()},re=()=>{const t=c.value;"textarea"===e.type&&e.autosize&&t&&function(e,t){const n=a();e.style.height="auto";let o=e.scrollHeight;if(l(t)){const{maxHeight:e,minHeight:a}=t;void 0!==e&&(o=Math.min(o,e)),void 0!==a&&(o=Math.max(o,a))}o&&(e.style.height=`${o}px`,r(n))}(t,e.autosize)},le=e=>{u.focused=!0,o("focus",e),C(re),q("readonly")&&te()},ne=e=>{u.focused=!1,_(j(),"onBlur"),o("blur",e),q("readonly")||(Z("onBlur"),C(re),$())},oe=e=>o("clickInput",e),ie=e=>o("clickLeftIcon",e),se=e=>o("clickRightIcon",e),ue=h((()=>"boolean"==typeof e.error?e.error:!(!f||!f.props.showError||"failed"!==u.status)||void 0)),ce=h((()=>{const e=q("labelWidth"),t=q("labelAlign");if(e&&"top"!==t)return{width:y(e)}})),de=t=>{13===t.keyCode&&(f&&f.props.submitOnEnter||"textarea"===e.type||T(t),"search"===e.type&&te()),o("keypress",t)},ge=()=>e.id||`${s}-input`,fe=()=>{const t=Y("control",[q("inputAlign"),{error:ue.value,custom:!!i.input,"min-height":"textarea"===e.type&&!e.autosize}]);if(i.input)return I("div",{class:t,onClick:oe},[i.input()]);const a={id:ge(),ref:c,name:e.name,rows:void 0!==e.rows?+e.rows:void 0,class:t,disabled:q("disabled"),readonly:q("readonly"),autofocus:e.autofocus,placeholder:e.placeholder,autocomplete:e.autocomplete,enterkeyhint:e.enterkeyhint,"aria-labelledby":e.label?`${s}-label`:void 0,onBlur:ne,onFocus:le,onInput:ee,onClick:oe,onChange:D,onKeypress:de,onCompositionend:D,onCompositionstart:R};return"textarea"===e.type?I("textarea",a,null):I("input",W("number"===(r=e.type)?{type:"text",inputmode:"decimal"}:"digit"===r?{type:"tel",inputmode:"numeric"}:{type:r},a),null);var r},pe=()=>{const t=i["right-icon"];if(e.rightIcon||t)return I("div",{class:Y("right-icon"),onClick:se},[t?t():I(z,{name:e.rightIcon,classPrefix:e.iconPrefix},null)])},me=()=>{if(e.showWordLimit&&e.maxlength){const t=O(j());return I("div",{class:Y("word-limit")},[I("span",{class:Y("word-num")},[t]),L("/"),e.maxlength])}},ve=()=>{if(f&&!1===f.props.showErrorMessage)return;const t=e.errorMessage||u.validateMessage;if(t){const e=i["error-message"],a=q("errorMessageAlign");return I("div",{class:Y("error-message",a)},[e?e({message:t}):t])}},be=()=>[I("div",{class:Y("body")},[fe(),X.value&&I(z,{ref:d,name:e.clearIcon,class:Y("clear")},null),pe(),i.button&&I("div",{class:Y("button")},[i.button()])]),me(),ve()];return x({blur:te,focus:ae,validate:U,formValue:G,resetValidation:N,getValidationStatus:()=>u.status}),k(w,{customValue:g,resetValidation:N,validateWithTrigger:Z}),S((()=>e.modelValue),(()=>{_(j()),N(),Z("onChange"),C(re)})),M((()=>{_(j(),e.formatTrigger),C(re)})),V("touchstart",(e=>{T(e),o("update:modelValue",""),o("clear",e)}),{target:h((()=>{var e;return null==(e=d.value)?void 0:e.$el}))}),()=>{const t=q("disabled"),a=q("labelAlign"),r=(()=>{const t=i["left-icon"];if(e.leftIcon||t)return I("div",{class:Y("left-icon"),onClick:ie},[t?t():I(z,{name:e.leftIcon,classPrefix:e.iconPrefix},null)])})();return I(F,{size:e.size,class:Y({error:ue.value,disabled:t,[`label-${a}`]:a}),center:e.center,border:e.border,isLink:e.isLink,clickable:e.clickable,titleStyle:ce.value,valueClass:Y("value"),titleClass:[Y("label",[a,{required:e.required}]),e.labelClass],arrowDirection:e.arrowDirection},{icon:r&&"top"!==a?()=>r:null,title:()=>{const t=(()=>{const t=q("labelWidth"),a=q("labelAlign"),r=q("colon")?":":"";return i.label?[i.label(),r]:e.label?I("label",{id:`${s}-label`,for:i.input?void 0:ge(),onClick:e=>{T(e),ae()},style:"top"===a&&t?{width:y(t)}:void 0},[e.label+r]):void 0})();return"top"===a?[r,t].filter(Boolean):t||[]},value:be,extra:i.extra})}}});e("F",j(N))}}}));