/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";var tslib_es6=require("./tslib.es6-7DbU_BSw.js"),index=require("./index-D0FxsaCe.js"),clsx=require("./clsx-CkZlkaek.js");require("./common-Cd2qH809.js");var reuse=require("./reuse-Cs36Ddzu.js"),FormFieldStateWrapper=require("./FormFieldStateWrapper-BeAW0hiT.js");const InputContainer=(e,l)=>{var{class:o}=e,r=tslib_es6.__rest(e,["class"]);return index.h("div",Object.assign({class:clsx.clsx("kol-field-control__input",o)},r),l)},KolFieldControlFc=(e,l)=>{const{class:o,id:r,disabled:i,label:t,hideLabel:s,labelAlign:n,renderNoTooltip:a,hint:d,renderNoHint:c,tooltipAlign:p,accessKey:b,shortKey:u,msg:h,touched:_,required:F,readonly:g,fieldControlInputProps:x,fieldControlLabelProps:f,fieldControlTooltipProps:C,fieldControlHintProps:y}=e,m=tslib_es6.__rest(e,["class","id","disabled","label","hideLabel","labelAlign","renderNoTooltip","hint","renderNoHint","tooltipAlign","accessKey","shortKey","msg","touched","required","readonly","fieldControlInputProps","fieldControlLabelProps","fieldControlTooltipProps","fieldControlHintProps"]),k=!c,K=!a,j=FormFieldStateWrapper.checkHasMsg(h,_),q=reuse.showExpertSlot(t),S=K&&!q&&s,B=reuse.buildBadgeTextString(b,u),v="string"==typeof h?"error":null==h?void 0:h._type,P=[index.h(index.Fragment,null,index.h(InputContainer,Object.assign({},x),l),S&&index.h(FormFieldStateWrapper.FormFieldTooltipFc,Object.assign({},C||{},{id:r,label:t,align:p,badgeText:B}))),index.h(FormFieldStateWrapper.KolFormFieldLabelFc,Object.assign({},f||{},{id:r,baseClassName:"kol-field-control",class:clsx.clsx(null==f?void 0:f.class,{"kol-field-control__label--visually-hidden":Boolean(s)}),hasExpertSlot:q,label:t,accessKey:b,shortKey:u}))];"left"===n&&P.reverse();const W={"kol-field-control--disabled":Boolean(i),"kol-field-control--required":Boolean(F),"kol-field-control--touched":Boolean(_),"kol-field-control--hide-label":Boolean(s),"kol-field-control--read-only":Boolean(g),[`kol-field-control--${v||"error"}`]:Boolean(j),[`kol-field-control--label-align-${n}`]:Boolean(n)};return index.h("div",Object.assign({class:clsx.clsx("kol-field-control",W,o)},m),P,k&&index.h(FormFieldStateWrapper.KolFormFieldHintFc,Object.assign({},y||{},{baseClassName:"kol-field-control",id:r,hint:d})))};function getFieldControlProps(e){const l={id:e._id,disabled:e._disabled,msg:e._msg,hint:e._hint,label:e._label,hideLabel:e._hideLabel,touched:e._touched};return"_required"in e&&(l.required=e._required),"_readOnly"in e&&(l.readonly=e._readOnly),"_labelAlign"in e&&(l.labelAlign=e._labelAlign),"_accessKey"in e&&(l.accessKey=e._accessKey),"_shortKey"in e&&(l.shortKey=e._shortKey),l}const FieldControlStateWrapper=(e,l)=>{var{state:o}=e,r=tslib_es6.__rest(e,["state"]);return index.h(KolFieldControlFc,Object.assign({},getFieldControlProps(o),r),l)};exports.FieldControlStateWrapper=FieldControlStateWrapper;