import{s as p,a2 as o,C as f,m as d}from"./index-yJ8X--q8.js";import{b as u,c as b}from"./label-D3d1qqIG-BD7RiEyC.js";import{I as y}from"./getRenderStates-B4Xg8PG8-CdOczHfm.js";import{v as m}from"./orientation-D3xx-ujZ-DK4pLh55.js";/*!
 * KoliBri - The accessible HTML-Standard
 */const l=e=>{if(typeof e=="object"&&e!==null){if(typeof e.label=="string"&&e.label.length>0)return e.disabled=e.disabled===!0,e.label=`${e.label}`.trim(),u(e.label,3)===!1&&b(e.label)===!1&&f(`A differing Aria-Label (${e.label}) is inaccessible. A differing Aria-Label should consist of at least three readable characters.`),Array.isArray(e.options)?e.options.find(t=>l(t)===!1)===void 0:!0;if(typeof e.label=="number")return!0}return!1},O=(e,t,s={})=>{o(e,"_options",a=>typeof a=="object"&&a!==null&&typeof a.label=="string"&&a.label.length>0,t,void 0,s)},C=(e,t,s={})=>{o(e,"_options",l,t,void 0,s)},v=(e,t)=>{d(e,"_required",t)},c=(e,t,s="")=>{t.forEach((a,i)=>{const n=`${s}-${i}`;typeof a=="object"&&a!==null&&typeof a.label=="string"&&a.label.length>0&&(Array.isArray(a.options)?c(e,a.options,n):e.set(n,a))})};class g extends y{constructor(t,s,a){super(t,s,a),this.component=t}validateRequired(t){v(this.component,t)}componentWillLoad(){super.componentWillLoad(),this.validateRequired(this.component._required)}}class I extends g{constructor(t,s,a){super(t,s,a),this.keyOptionMap=new Map,this.getOptionByKey=i=>this.keyOptionMap.get(i),this.afterPatchOptions=(i,n,r,h)=>{h==="_value"&&this.setFormAssociatedValue(i)},this.beforePatchOptions=(i,n)=>{const r=n.has("_options")?n.get("_options"):this.component.state._options;Array.isArray(r)&&r.length>0&&(this.keyOptionMap.clear(),c(this.keyOptionMap,r))},this.component=t}validateOrientation(t){m(this.component,t,"vertical")}validateOptions(t){O(this.component,t,{hooks:{afterPatch:this.afterPatchOptions,beforePatch:this.beforePatchOptions}})}validateValue(t){t=Array.isArray(t)?t[0]:t,p(this.component,"_value",t,{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{g as I,I as a,O as b,c as f,C as v};
//# sourceMappingURL=controller-BUK8x0Dz-BOTwYD01.js.map
