import{aq as Je,ar as oe,as as Oe,at as qt,au as Ze,av as Pe,aw as jt,ax as He,ay as ne,az as Qe,aA as Et,aB as Tt,aC as St,aD as _t,aE as Pt,aF as $t,aG as It,Q as Xe,a0 as ge,aH as ke,aI as Mt,aJ as ye,a2 as et,r as V,V as T,a as H,aK as tt,af as qe,M as ie,aL as Nt,ag as rt,f as nt,aM as it,aN as je,o as me,h as at,X as ee,Y as K,u as E,Z as st,O as ot,T as ae,aO as ve,aP as Rt,aa as ft,aQ as lt,aR as Lt,aS as Bt,j as se,H as Vt,a9 as ut,ad as Wt,a4 as Ct,aT as Dt,a7 as $e,aU as de,k as ce,c as Ut,D as zt,B as Ie,m as Gt,t as Me,p as Ne,i as Re,an as Kt,ap as Yt,aV as Jt}from"./entry.834fe740.js";import{k as dt,g as ct,s as Zt,a as Ht,b as Qt,c as Ee,d as Xt}from"./_getTag.02a17137.js";function kt(r,e){for(var t=-1,n=r==null?0:r.length;++t(Mt(r)||ye(r))&&et(e)&&ye(t)};function hn(){const r=V([]),e=T(()=>{if(!r.value.length)return"0";const s=Math.max(...r.value);return s?`${s}px`:""});function t(s){const a=r.value.indexOf(s);return a===-1&&e.value,a}function n(s,a){if(s&&a){const o=t(a);r.value.splice(o,1,s)}else s&&r.value.push(s)}function i(s){const a=t(s);a>-1&&r.value.splice(a,1)}return{autoLabelWidth:e,registerLabelWidth:n,deregisterLabelWidth:i}}const X=(r,e)=>{const t=he(e);return t.length>0?r.filter(n=>n.prop&&t.includes(n.prop)):r},bn="ElForm",wn=H({name:bn}),Fn=H({...wn,props:mn,emits:vn,setup(r,{expose:e,emit:t}){const n=r,i=[],s=tt(),a=qe("form"),o=T(()=>{const{labelPosition:m,inline:l}=n;return[a.b(),a.m(s.value||"default"),{[a.m(`label-${m}`)]:m,[a.m("inline")]:l}]}),u=m=>{i.push(m)},w=m=>{m.prop&&i.splice(i.indexOf(m),1)},c=(m=[])=>{!n.model||X(i,m).forEach(l=>l.resetField())},g=(m=[])=>{X(i,m).forEach(l=>l.clearValidate())},b=T(()=>!!n.model),q=m=>{if(i.length===0)return[];const l=X(i,m);return l.length?l:[]},j=async m=>y(void 0,m),d=async(m=[])=>{if(!b.value)return!1;const l=q(m);if(l.length===0)return!0;let h={};for(const O of l)try{await O.validate("")}catch(x){h={...h,...x}}return Object.keys(h).length===0?!0:Promise.reject(h)},y=async(m=[],l)=>{const h=!ot(l);try{const O=await d(m);return O===!0&&(l==null||l(O)),O}catch(O){const x=O;return n.scrollToError&&f(Object.keys(x)[0]),l==null||l(!1,x),h&&Promise.reject(x)}},f=m=>{var l;const h=X(i,m)[0];h&&((l=h.$el)==null||l.scrollIntoView())};return ie(()=>n.rules,()=>{n.validateOnRuleChange&&j().catch(m=>Nt())},{deep:!0}),rt(je,nt({...it(n),emit:t,resetFields:c,clearValidate:g,validateField:y,addField:u,removeField:w,...hn()})),e({validate:j,validateField:y,resetFields:c,clearValidate:g,scrollToField:f}),(m,l)=>(me(),at("form",{class:K(E(o))},[ee(m.$slots,"default")],2))}});var An=st(Fn,[["__file","/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);function W(){return W=Object.assign?Object.assign.bind():function(r){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function re(r,e,t){return On()?re=Reflect.construct.bind():re=function(i,s,a){var o=[null];o.push.apply(o,s);var u=Function.bind.apply(i,o),w=new u;return a&&Z(w,a.prototype),w},re.apply(null,arguments)}function qn(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function we(r){var e=typeof Map=="function"?new Map:void 0;return we=function(n){if(n===null||!qn(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return re(n,arguments,be(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Z(i,n)},we(r)}var jn=/%[sdj%]/g,En=function(){};typeof process<"u"&&process.env;function Fe(r){if(!r||!r.length)return null;var e={};return r.forEach(function(t){var n=t.field;e[n]=e[n]||[],e[n].push(t)}),e}function I(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n=s)return o;switch(o){case"%s":return String(t[i++]);case"%d":return Number(t[i++]);case"%j":try{return JSON.stringify(t[i++])}catch{return"[Circular]"}break;default:return o}});return a}return r}function Tn(r){return r==="string"||r==="url"||r==="hex"||r==="email"||r==="date"||r==="pattern"}function S(r,e){return!!(r==null||e==="array"&&Array.isArray(r)&&!r.length||Tn(e)&&typeof r=="string"&&!r)}function Sn(r,e,t){var n=[],i=0,s=r.length;function a(o){n.push.apply(n,o||[]),i++,i===s&&t(n)}r.forEach(function(o){e(o,a)})}function De(r,e,t){var n=0,i=r.length;function s(a){if(a&&a.length){t(a);return}var o=n;n=n+1,o()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},Y={integer:function(e){return Y.number(e)&&parseInt(e,10)===e},float:function(e){return Y.number(e)&&!Y.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return typeof e=="object"&&!Y.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(Ke.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(Nn())},hex:function(e){return typeof e=="string"&&!!e.match(Ke.hex)}},Rn=function(e,t,n,i,s){if(e.required&&t===void 0){vt(e,t,n,i,s);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],o=e.type;a.indexOf(o)>-1?Y[o](t)||i.push(I(s.messages.types[o],e.fullField,e.type)):o&&typeof t!==e.type&&i.push(I(s.messages.types[o],e.fullField,e.type))},Ln=function(e,t,n,i,s){var a=typeof e.len=="number",o=typeof e.min=="number",u=typeof e.max=="number",w=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,c=t,g=null,b=typeof t=="number",q=typeof t=="string",j=Array.isArray(t);if(b?g="number":q?g="string":j&&(g="array"),!g)return!1;j&&(c=t.length),q&&(c=t.replace(w,"_").length),a?c!==e.len&&i.push(I(s.messages[g].len,e.fullField,e.len)):o&&!u&&ce.max?i.push(I(s.messages[g].max,e.fullField,e.max)):o&&u&&(ce.max)&&i.push(I(s.messages[g].range,e.fullField,e.min,e.max))},z="enum",Bn=function(e,t,n,i,s){e[z]=Array.isArray(e[z])?e[z]:[],e[z].indexOf(t)===-1&&i.push(I(s.messages[z],e.fullField,e[z].join(", ")))},Vn=function(e,t,n,i,s){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||i.push(I(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if(typeof e.pattern=="string"){var a=new RegExp(e.pattern);a.test(t)||i.push(I(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}},v={required:vt,whitespace:Mn,type:Rn,range:Ln,enum:Bn,pattern:Vn},Wn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t,"string")&&!e.required)return n();v.required(e,t,i,a,s,"string"),S(t,"string")||(v.type(e,t,i,a,s),v.range(e,t,i,a,s),v.pattern(e,t,i,a,s),e.whitespace===!0&&v.whitespace(e,t,i,a,s))}n(a)},Cn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s),t!==void 0&&v.type(e,t,i,a,s)}n(a)},Dn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(t===""&&(t=void 0),S(t)&&!e.required)return n();v.required(e,t,i,a,s),t!==void 0&&(v.type(e,t,i,a,s),v.range(e,t,i,a,s))}n(a)},Un=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s),t!==void 0&&v.type(e,t,i,a,s)}n(a)},zn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s),S(t)||v.type(e,t,i,a,s)}n(a)},Gn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s),t!==void 0&&(v.type(e,t,i,a,s),v.range(e,t,i,a,s))}n(a)},Kn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s),t!==void 0&&(v.type(e,t,i,a,s),v.range(e,t,i,a,s))}n(a)},Yn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(t==null&&!e.required)return n();v.required(e,t,i,a,s,"array"),t!=null&&(v.type(e,t,i,a,s),v.range(e,t,i,a,s))}n(a)},Jn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s),t!==void 0&&v.type(e,t,i,a,s)}n(a)},Zn="enum",Hn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s),t!==void 0&&v[Zn](e,t,i,a,s)}n(a)},Qn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t,"string")&&!e.required)return n();v.required(e,t,i,a,s),S(t,"string")||v.pattern(e,t,i,a,s)}n(a)},Xn=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t,"date")&&!e.required)return n();if(v.required(e,t,i,a,s),!S(t,"date")){var u;t instanceof Date?u=t:u=new Date(t),v.type(e,u,i,a,s),u&&v.range(e,u.getTime(),i,a,s)}}n(a)},kn=function(e,t,n,i,s){var a=[],o=Array.isArray(t)?"array":typeof t;v.required(e,t,i,a,s,o),n(a)},pe=function(e,t,n,i,s){var a=e.type,o=[],u=e.required||!e.required&&i.hasOwnProperty(e.field);if(u){if(S(t,a)&&!e.required)return n();v.required(e,t,i,o,s,a),S(t,a)||v.type(e,t,i,o,s)}n(o)},ei=function(e,t,n,i,s){var a=[],o=e.required||!e.required&&i.hasOwnProperty(e.field);if(o){if(S(t)&&!e.required)return n();v.required(e,t,i,a,s)}n(a)},J={string:Wn,method:Cn,number:Dn,boolean:Un,regexp:zn,integer:Gn,float:Kn,array:Yn,object:Jn,enum:Hn,pattern:Qn,date:Xn,url:pe,hex:pe,email:pe,required:kn,any:ei};function Ae(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var xe=Ae(),Q=function(){function r(t){this.rules=null,this._messages=xe,this.define(t)}var e=r.prototype;return e.define=function(n){var i=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(typeof n!="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(s){var a=n[s];i.rules[s]=Array.isArray(a)?a:[a]})},e.messages=function(n){return n&&(this._messages=Ge(Ae(),n)),this._messages},e.validate=function(n,i,s){var a=this;i===void 0&&(i={}),s===void 0&&(s=function(){});var o=n,u=i,w=s;if(typeof u=="function"&&(w=u,u={}),!this.rules||Object.keys(this.rules).length===0)return w&&w(null,o),Promise.resolve(o);function c(d){var y=[],f={};function m(h){if(Array.isArray(h)){var O;y=(O=y).concat.apply(O,h)}else y.push(h)}for(var l=0;l");const i=qe("form"),s=V(),a=V(0),o=()=>{var c;if((c=s.value)!=null&&c.firstElementChild){const g=window.getComputedStyle(s.value.firstElementChild).width;return Math.ceil(Number.parseFloat(g))}else return 0},u=(c="update")=>{ut(()=>{e.default&&r.isAutoWidth&&(c==="update"?a.value=o():c==="remove"&&(t==null||t.deregisterLabelWidth(a.value)))})},w=()=>u("update");return ft(()=>{w()}),lt(()=>{u("remove")}),Lt(()=>w()),ie(a,(c,g)=>{r.updateAll&&(t==null||t.registerLabelWidth(c,g))}),Bt(T(()=>{var c,g;return(g=(c=s.value)==null?void 0:c.firstElementChild)!=null?g:null}),w),()=>{var c,g;if(!e)return null;const{isAutoWidth:b}=r;if(b){const q=t==null?void 0:t.autoLabelWidth,j=n==null?void 0:n.hasLabel,d={};if(j&&q&&q!=="auto"){const y=Math.max(0,Number.parseInt(q,10)-a.value),f=t.labelPosition==="left"?"marginRight":"marginLeft";y&&(d[f]=`${y}px`)}return se("div",{ref:s,class:[i.be("item","label-wrap")],style:d},[(c=e.default)==null?void 0:c.call(e)])}else return se(Vt,{ref:s},[(g=e.default)==null?void 0:g.call(e)])}}});const ii=["role","aria-labelledby"],ai=H({name:"ElFormItem"}),si=H({...ai,props:ri,setup(r,{expose:e}){const t=r,n=Wt(),i=ae(je,void 0),s=ae(ve,void 0),a=tt(void 0,{formItem:!1}),o=qe("form-item"),u=Ct().value,w=V([]),c=V(""),g=Dt(c,100),b=V(""),q=V();let j,d=!1;const y=T(()=>{if((i==null?void 0:i.labelPosition)==="top")return{};const p=$e(t.labelWidth||(i==null?void 0:i.labelWidth)||"");return p?{width:p}:{}}),f=T(()=>{if((i==null?void 0:i.labelPosition)==="top"||(i==null?void 0:i.inline))return{};if(!t.label&&!t.labelWidth&&B)return{};const p=$e(t.labelWidth||(i==null?void 0:i.labelWidth)||"");return!t.label&&!n.label?{marginLeft:p}:{}}),m=T(()=>[o.b(),o.m(a.value),o.is("error",c.value==="error"),o.is("validating",c.value==="validating"),o.is("success",c.value==="success"),o.is("required",fe.value||t.required),o.is("no-asterisk",i==null?void 0:i.hideRequiredAsterisk),(i==null?void 0:i.requireAsteriskPosition)==="right"?"asterisk-right":"asterisk-left",{[o.m("feedback")]:i==null?void 0:i.statusIcon}]),l=T(()=>et(t.inlineMessage)?t.inlineMessage:(i==null?void 0:i.inlineMessage)||!1),h=T(()=>[o.e("error"),{[o.em("error","inline")]:l.value}]),O=T(()=>t.prop?ye(t.prop)?t.prop:t.prop.join("."):""),x=T(()=>!!(t.label||n.label)),N=T(()=>t.for||w.value.length===1?w.value[0]:void 0),$=T(()=>!N.value&&x.value),B=!!s,G=T(()=>{const p=i==null?void 0:i.model;if(!(!p||!t.prop))return de(p,t.prop).value}),C=T(()=>{const{required:p}=t,F=[];t.rules&&F.push(...he(t.rules));const P=i==null?void 0:i.rules;if(P&&t.prop){const _=de(P,t.prop).value;_&&F.push(...he(_))}if(p!==void 0){const _=F.map((L,U)=>[L,U]).filter(([L])=>Object.keys(L).includes("required"));if(_.length>0)for(const[L,U]of _)L.required!==p&&(F[U]={...L,required:p});else F.push({required:p})}return F}),R=T(()=>C.value.length>0),M=p=>C.value.filter(P=>!P.trigger||!p?!0:Array.isArray(P.trigger)?P.trigger.includes(p):P.trigger===p).map(({trigger:P,..._})=>_),fe=T(()=>C.value.some(p=>p.required)),bt=T(()=>{var p;return g.value==="error"&&t.showMessage&&((p=i==null?void 0:i.showMessage)!=null?p:!0)}),Te=T(()=>`${t.label||""}${(i==null?void 0:i.labelSuffix)||""}`),D=p=>{c.value=p},wt=p=>{var F,P;const{errors:_,fields:L}=p;(!_||!L)&&console.error(p),D("error"),b.value=_?(P=(F=_==null?void 0:_[0])==null?void 0:F.message)!=null?P:`${t.prop} is required`:"",i==null||i.emit("validate",t.prop,!1,b.value)},Ft=()=>{D("success"),i==null||i.emit("validate",t.prop,!0,"")},At=async p=>{const F=O.value;return new Q({[F]:p}).validate({[F]:G.value},{firstFields:!0}).then(()=>(Ft(),!0)).catch(_=>(wt(_),Promise.reject(_)))},Se=async(p,F)=>{if(d||!t.prop)return!1;const P=ot(F);if(!R.value)return F==null||F(!1),!1;const _=M(p);return _.length===0?(F==null||F(!0),!0):(D("validating"),At(_).then(()=>(F==null||F(!0),!0)).catch(L=>{const{fields:U}=L;return F==null||F(!1,U),P?!1:Promise.reject(U)}))},le=()=>{D(""),b.value="",d=!1},_e=async()=>{const p=i==null?void 0:i.model;if(!p||!t.prop)return;const F=de(p,t.prop);d=!0,F.value=Ce(j),await ut(),le(),d=!1},xt=p=>{w.value.includes(p)||w.value.push(p)},Ot=p=>{w.value=w.value.filter(F=>F!==p)};ie(()=>t.error,p=>{b.value=p||"",D(p?"error":"")},{immediate:!0}),ie(()=>t.validateStatus,p=>D(p||""));const ue=nt({...it(t),$el:q,size:a,validateState:c,labelId:u,inputIds:w,isGroup:$,hasLabel:x,addInputId:xt,removeInputId:Ot,resetField:_e,clearValidate:le,validate:Se});return rt(ve,ue),ft(()=>{t.prop&&(i==null||i.addField(ue),j=Ce(G.value))}),lt(()=>{i==null||i.removeField(ue)}),e({size:a,validateMessage:b,validateState:c,validate:Se,clearValidate:le,resetField:_e}),(p,F)=>{var P;return me(),at("div",{ref_key:"formItemRef",ref:q,class:K(E(m)),role:E($)?"group":void 0,"aria-labelledby":E($)?E(u):void 0},[se(E(ni),{"is-auto-width":E(y).width==="auto","update-all":((P=E(i))==null?void 0:P.labelWidth)==="auto"},{default:ce(()=>[E(x)?(me(),Ut(zt(E(N)?"label":"div"),{key:0,id:E(u),for:E(N),class:K(E(o).e("label")),style:Ie(E(y))},{default:ce(()=>[ee(p.$slots,"label",{label:E(Te)},()=>[Gt(Me(E(Te)),1)])]),_:3},8,["id","for","class","style"])):Ne("v-if",!0)]),_:3},8,["is-auto-width","update-all"]),Re("div",{class:K(E(o).e("content")),style:Ie(E(f))},[ee(p.$slots,"default"),se(Kt,{name:`${E(o).namespace.value}-zoom-in-top`},{default:ce(()=>[E(bt)?ee(p.$slots,"error",{key:0,error:b.value},()=>[Re("div",{class:K(E(h))},Me(b.value),3)]):Ne("v-if",!0)]),_:3},8,["name"])],6)],10,ii)}}});var ht=st(si,[["__file","/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);const li=Yt(An,{FormItem:ht}),ui=Jt(ht);export{li as E,ui as a};