import{s as d,a0 as h,A as u}from"./index-DCi8lcS0.js";import{b,c as m}from"./label-pIlPsS_A-DDeB9XCl.js";import{v as y}from"./required-U8Z2uWB--DwNTsM0U.js";import{v as O}from"./orientation-DgLUKPfF-eqowjCvN.js";import{I as v}from"./FormFieldStateWrapper-dDuHhzJa-2UFDj4Vr.js";const f=t=>{if(typeof t=="object"&&t!==null){if(typeof t.label=="string"&&t.label.length>0)return t.disabled=t.disabled===!0,t.label=`${t.label}`.trim(),b(t.label,3)===!1&&m(t.label)===!1&&u(`A differing Aria-Label (${t.label}) is inaccessible. A differing Aria-Label should consist of at least three readable characters.`),Array.isArray(t.options)?t.options.find(e=>f(e)===!1)===void 0:!0;if(typeof t.label=="number")return!0}return!1},g=(t,e,s={})=>{h(t,"_options",a=>typeof a=="object"&&a!==null&&typeof a.label=="string"&&a.label.length>0,e,void 0,s)},L=(t,e,s={})=>{h(t,"_options",f,e,void 0,s)},p=(t,e,s="")=>{e.forEach((a,r)=>{const n=`${s}-${r}`;typeof a=="object"&&a!==null&&typeof a.label=="string"&&a.label.length>0&&(Array.isArray(a.options)?p(t,a.options,n):t.set(n,a))})};class A extends v{constructor(e,s,a){super(e,s,a),this.component=e}validateRequired(e){y(this.component,e)}componentWillLoad(){super.componentWillLoad(),this.validateRequired(this.component._required)}}class R extends A{constructor(e,s,a){super(e,s,a),this.keyOptionMap=new Map,this.getOptionByKey=r=>this.keyOptionMap.get(r),this.afterPatchOptions=(r,n,l,o)=>{o==="_value"&&this.setFormAssociatedValue(r)},this.beforePatchOptions=(r,n)=>{const l=n.has("_options")?n.get("_options"):this.component.state._options;if(Array.isArray(l)&&l.length>0){this.keyOptionMap.clear();const o=l.map(i=>{var c;return typeof i=="object"&&i!==null&&typeof i.label=="string"?Object.assign(Object.assign({},i),{value:(c=i.value)!==null&&c!==void 0?c:i.label}):i});p(this.keyOptionMap,o)}},this.component=e}validateOrientation(e){O(this.component,e,"vertical")}validateOptions(e){g(this.component,e,{hooks:{afterPatch:this.afterPatchOptions,beforePatch:this.beforePatchOptions}})}validateValue(e){e=Array.isArray(e)?e[0]:e,d(this.component,"_value",e,{afterPatch:this.afterPatchOptions,beforePatch:this.beforePatchOptions})}componentWillLoad(){super.componentWillLoad(),this.validateOrientation(this.component._orientation),this.validateOptions(this.component._options),this.validateValue(this.component._value)}}export{A as I,R as a,g as b,p as f,L as v};
//# sourceMappingURL=controller-2HqfMnWB-BeEtILr_.js.map
