import{u as Le,F as ke,i as Ce,V as B,_ as A,a as De,C as qe,r as b,s as Fe,v as We}from"./form-model.53f397fa.js";import{i as Ie,_ as Me}from"./helper.423f0a4e.js";import{u as Z,_ as j}from"./useConfig.f6485710.js";import{d as Pe,i as xe,c as p,f as V,t as we,r as Ae,o as He,b as Ke,w as je,aI as M,p as Oe,n as Ue}from"./arco.7f845a67.js";import{c as Re,d as Ge,N as Je,i as Ee,e as Xe,O as Y,M as ze,w as Ne}from"./index.4eb55f07.js";import{i as _e}from"./useDisabled.110213c8.js";import{g as se,r as Qe}from"./index.70f5a9a5.js";import{a as Ye,C as Ze,E as er}from"./dialog.9bb37d96.js";/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */var rr={for:{type:String,default:""},help:{type:[String,Function]},label:{type:[String,Function],default:""},labelAlign:{type:String,validator:function(e){return e?["left","right","top"].includes(e):!0}},labelWidth:{type:[String,Number]},name:{type:String,default:""},requiredMark:{type:Boolean,default:void 0},rules:{type:Array},showErrorMessage:{type:Boolean,default:void 0},status:{type:String,default:""},statusIcon:{type:[Boolean,Function],default:void 0},successBorder:Boolean,tips:{type:[String,Function]}};/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */function ar(c,e){return c.replace(/\${(.*?)}/g,function(f,v){return e[v.trim()]||""})}/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */function Ve(c,e){var f=Object.keys(c);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(c);e&&(v=v.filter(function(_){return Object.getOwnPropertyDescriptor(c,_).enumerable})),f.push.apply(f,v)}return f}function Se(c){for(var e=1;e0;return a!=null?a:d}),ae=p(function(){return v.label||e.label}),de=p(function(){return!!(r!=null&&r.colon&&ae.value)}),q=Z("form__label"),W=p(function(){return Ce(e.labelAlign)?r==null?void 0:r.labelAlign:e.labelAlign}),w=p(function(){return Ce(e.labelWidth)?r==null?void 0:r.labelWidth:e.labelWidth}),me=p(function(){return[y.value.label,j(j(j(j(j({},"".concat(q.value,"--required"),fe.value),"".concat(q.value,"--colon"),de.value),"".concat(q.value,"--top"),ae.value&&(W.value==="top"||!w.value)),"".concat(q.value,"--left"),W.value==="left"&&w.value),"".concat(q.value,"--right"),W.value==="right"&&w.value)]}),ge=function(){if(Number(w.value)!==0){var n={};return w.value&&W.value!=="top"&&(Ie(w.value)?n={width:"".concat(w.value,"px")}:n={width:w.value}),M("div",{class:me.value,style:n},[M("label",{for:e.for||null},[_("label")])])}},X=function(){var n=function(h){return M("span",{class:y.value.status},[M(h,null,null)])},a=L.value;if(N.value===B.SUCCESS)return n(C);if(a!=null&&a[0]){var d=a[0].type||"error",o={error:ce,warning:ve}[d]||C;return n(o)}return null},pe=function(){var n=e.statusIcon;if(n!==!1){var a=_("statusIcon",{defaultNode:X()});if(a)return M("span",{class:y.value.status},[a]);if(a!==!1&&(a=r==null?void 0:r.renderContent("statusIcon",{defaultNode:X(),params:e}),a))return a}},H=p(function(){if(!I.value)return"";if(N.value===B.SUCCESS)return e.successBorder?[y.value.success,y.value.successBorder].join(" "):y.value.success;if(!!L.value.length){var t=L.value[0].type||"error";return t==="error"?y.value.error:y.value.warning}}),te=p(function(){return[y.value.controls,H.value]}),ne=p(function(){var t={};return w.value&&W.value!=="top"&&(Ie(w.value)?t={marginLeft:"".concat(w.value,"px")}:t={marginLeft:w.value}),t}),L=V([]),R=V([]),N=V(B.TO_BE_VALIDATED),z=V(!1),T=V(!1),Q=function(){T.value=!1,L.value=[],R.value=[],N.value=B.TO_BE_VALIDATED},be=function(){var n=Object.prototype.toString.call(se(r==null?void 0:r.data,e.name)),a;return n==="[object String]"&&(a=""),n==="[object Array]"&&(a=[]),n==="[object Object]"&&(a={}),a},ye=function(){var t=A(b.mark(function n(){var a,d=arguments;return b.wrap(function(O){for(;;)switch(O.prev=O.next){case 0:if(a=d.length>0&&d[0]!==void 0?d[0]:r==null?void 0:r.resetType,e.name){O.next=3;break}return O.abrupt("return");case 3:return a==="empty"?Fe(r==null?void 0:r.data,e.name,be()):a==="initial"&&Fe(r==null?void 0:r.data,e.name,F.value),O.next=6,Ue();case 6:z.value?T.value=!0:Q();case 7:case"end":return O.stop()}},n)}));return function(){return t.apply(this,arguments)}}(),le=p(function(){var t;return(t=r==null?void 0:r.errorMessage)!==null&&t!==void 0?t:D.value.errorMessage}),g=p(function(){var t;if((t=e.rules)!==null&&t!==void 0&&t.length)return e.rules;if(!e.name)return[];var n="".concat(e.name).lastIndexOf(".")||-1,a="".concat(e.name).slice(n+1);return se(r==null?void 0:r.rules,e.name)||se(r==null?void 0:r.rules,a)||[]}),l=function(){var t=A(b.mark(function n(a){var d,o;return b.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(o={successList:[],errorList:[],rules:[],resultList:[],allowSetValue:!1},o.rules=a==="all"?g.value:g.value.filter(function(m){return(m.trigger||"change")===a}),!(g.value.length&&!((d=o.rules)!==null&&d!==void 0&&d.length))){h.next=4;break}return h.abrupt("return",o);case 4:return o.allowSetValue=!0,h.next=7,We(S.value,o.rules);case 7:return o.resultList=h.sent,o.errorList=o.resultList.filter(function(m){return m.result!==!0}).map(function(m){return Object.keys(m).forEach(function(G){if(!m.message&&le.value[G]){var ie=Xe(e.label)?e.label:e.name;m.message=ar(le.value[G],{name:ie,validate:m[G]})}}),m}),o.successList=o.resultList.filter(function(m){return m.result===!0&&m.message&&m.type==="success"}),h.abrupt("return",o);case 11:case"end":return h.stop()}},n)}));return function(a){return t.apply(this,arguments)}}(),u=function(){var t=A(b.mark(function n(a,d){var o,O,h,m,G,ie;return b.wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return z.value=!0,E.value=d,J.next=4,l(a);case 4:return o=J.sent,O=o.successList,h=o.errorList,m=o.rules,G=o.resultList,ie=o.allowSetValue,ie&&(R.value=O,L.value=h),m.length&&(N.value=h.length?B.FAIL:B.SUCCESS),T.value&&Q(),z.value=!1,J.abrupt("return",j({},e.name,h.length===0?!0:G));case 15:case"end":return J.stop()}},n)}));return function(a,d){return t.apply(this,arguments)}}(),s=function(){var t=A(b.mark(function n(a){var d,o,O;return b.wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,l(a);case 2:return d=m.sent,o=d.errorList,O=d.resultList,m.abrupt("return",j({},e.name,o.length===0?!0:O));case 6:case"end":return m.stop()}},n)}));return function(a){return t.apply(this,arguments)}}(),i=function(n){!n&&!Ee(n)||(n.length===0&&(L.value=[],N.value=B.SUCCESS),L.value=n.map(function(a){return Se(Se({},a),{},{result:!1})}),N.value=B.FAIL)},S=p(function(){return(r==null?void 0:r.data)&&se(r==null?void 0:r.data,e.name)}),F=V(void 0),k=we(e),x=k.name,K=Ae({name:x,resetHandler:Q,resetField:ye,validate:u,validateOnly:s,setValidateMessage:i});He(function(){F.value=Je(S.value),r==null||r.children.push(K)}),Ke(function(){r&&(r.children=r==null?void 0:r.children.filter(function(t){return t!==K}))}),je(S,A(b.mark(function t(){return b.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,u("change");case 2:case"end":return a.stop()}},t)})),{deep:!0}),je(function(){return[e.name,JSON.stringify(e.rules)].join(",")},function(){u("change")});var E=V(void 0),I=p(function(){return _e(E.value)?E.value:_e(e.showErrorMessage)?e.showErrorMessage:r==null?void 0:r.showErrorMessage}),ue=p(function(){return[y.value.formItem,Te(re.value,e.name),j(j({},y.value.formItemWithHelp,he.value),y.value.formItemWithExtra,P.value)]}),he=p(function(){var t=_("help");return t?M("div",{class:y.value.help},[t]):null}),P=p(function(){var t,n=function(o){return M("div",{class:y.value.extra,title:o},[o])},a=L.value;return I.value&&a!==null&&a!==void 0&&(t=a[0])!==null&&t!==void 0&&t.message?n(a[0].message):R.value.length?n(R.value[0].message):null}),U=p(function(){var t=_("tips");if(!t)return null;var n=["".concat(re.value,"-tips"),"".concat(ee.value,"-tips"),"".concat(ee.value,"-is-").concat(e.status||"default")];return M("div",{class:n},[t])}),Be=function(){var t=A(b.mark(function n(){return b.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,u("blur");case 2:case"end":return d.stop()}},n)}));return function(){return t.apply(this,arguments)}}();return Oe(De,{handleBlur:Be}),function(){return M("div",{class:ue.value},[ge(),M("div",{class:te.value,style:ne.value},[M("div",{class:y.value.controlsContent},[_("default"),pe()]),he.value,U.value,P.value])])}}});/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */var nr={colon:Boolean,data:{type:Object,default:function(){return{}}},disabled:{type:Boolean,default:void 0},errorMessage:{type:Object},formControlledComponents:{type:Array},labelAlign:{type:String,default:"right",validator:function(e){return e?["left","right","top"].includes(e):!0}},labelWidth:{type:[String,Number],default:"100px"},layout:{type:String,default:"vertical",validator:function(e){return e?["vertical","inline"].includes(e):!0}},preventSubmitDefault:{type:Boolean,default:!0},requiredMark:{type:Boolean,default:void 0},resetType:{type:String,default:"empty",validator:function(e){return e?["empty","initial"].includes(e):!0}},rules:{type:Object},scrollToFirstError:{type:String,validator:function(e){return e?["","smooth","auto"].includes(e):!0}},showErrorMessage:{type:Boolean,default:!0},statusIcon:{type:[Boolean,Function],default:void 0},submitWithWarningMessage:Boolean,onReset:Function,onSubmit:Function,onValidate:Function};/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */function $e(c,e){var f=Object.keys(c);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(c);e&&(v=v.filter(function(_){return Object.getOwnPropertyDescriptor(c,_).enumerable})),f.push.apply(f,v)}return f}function lr(c){for(var e=1;e