/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";const index=require("./index-cb2ce614.js"),controller=require("./controller-1332def9.js"),fillKeyOptionMap=(t,e,o="")=>{e.forEach(((e,n)=>{const i=`${o}-${n}`;"object"==typeof e&&null!==e&&"string"==typeof e.label&&e.label.length>0&&(Array.isArray(e.options)?fillKeyOptionMap(t,e.options,i):t.set(i,e))}))};class InputCheckboxRadioController extends controller.InputController{constructor(t,e,o){super(t,e,o),this.component=t}validateRequired(t){index.validateRequired(this.component,t)}componentWillLoad(){super.componentWillLoad(),this.validateRequired(this.component._required)}}class InputRadioController extends InputCheckboxRadioController{constructor(t,e,o){super(t,e,o),this.keyOptionMap=new Map,this.getOptionByKey=t=>this.keyOptionMap.get(t),this.afterPatchOptions=(t,e,o,n)=>{"_value"===n&&this.setFormAssociatedValue(t)},this.component=t}validateOrientation(t){index.watchValidator(this.component,"_orientation",(t=>"string"==typeof t&&index.orientationOptions.includes(t)),new Set([`Orientation {${index.orientationOptions.join(", ")}`]),t,{defaultValue:"vertical"})}validateOptions(t){index.validateOptions(this.component,t,{hooks:{afterPatch:this.afterPatchOptions}})}validateValue(t){t=index.mapString2Unknown(t),t=Array.isArray(t)?t[0]:t,index.setState(this.component,"_value",t,{afterPatch:this.afterPatchOptions})}componentWillLoad(){super.componentWillLoad(),this.validateOrientation(this.component._orientation),this.validateOptions(this.component._options),this.validateValue(this.component._value)}}exports.InputCheckboxRadioController=InputCheckboxRadioController,exports.InputRadioController=InputRadioController,exports.fillKeyOptionMap=fillKeyOptionMap;