/*!
 * KoliBri - The accessible HTML-Standard
 */
import{_ as __rest}from"./tslib.es6-CxX45GIN.js";import{h,F as Fragment}from"./index-C_yiBYg2.js";import{c as clsx}from"./clsx-eK3rPvPS.js";import"./common-Dd0zJQbD.js";import{b as buildBadgeTextString,s as showExpertSlot}from"./reuse-CX4AQDkS.js";import{a as FormFieldTooltipFc,K as KolFormFieldLabelFc,b as KolFormFieldHintFc,c as checkHasMsg}from"./FormFieldStateWrapper-Cj4-CJCr.js";const InputContainer=(e,l)=>{var{class:o}=e,r=__rest(e,["class"]);return h("div",Object.assign({class:clsx("kol-field-control__input",o)},r),l)},KolFieldControlFc=(e,l)=>{const{class:o,id:r,disabled:t,label:i,hideLabel:s,labelAlign:n,renderNoTooltip:a,hint:d,renderNoHint:c,tooltipAlign:b,accessKey:p,shortKey:g,msg:F,touched:_,required:f,readonly:m,fieldControlInputProps:u,fieldControlLabelProps:C,fieldControlTooltipProps:y,fieldControlHintProps:K}=e,k=__rest(e,["class","id","disabled","label","hideLabel","labelAlign","renderNoTooltip","hint","renderNoHint","tooltipAlign","accessKey","shortKey","msg","touched","required","readonly","fieldControlInputProps","fieldControlLabelProps","fieldControlTooltipProps","fieldControlHintProps"]),j=!c,x=!a,P=checkHasMsg(F,_),B=showExpertSlot(i),S=x&&!B&&s,v=buildBadgeTextString(p,g),O="string"==typeof F?"error":null==F?void 0:F._type,T=[h(Fragment,null,h(InputContainer,Object.assign({},u),l),S&&h(FormFieldTooltipFc,Object.assign({},y||{},{id:r,label:i,align:b,badgeText:v}))),h(KolFormFieldLabelFc,Object.assign({},C||{},{id:r,baseClassName:"kol-field-control",class:clsx(null==C?void 0:C.class,{"kol-field-control__label--visually-hidden":Boolean(s)}),hasExpertSlot:B,label:i,accessKey:p,shortKey:g}))];"left"===n&&T.reverse();const A={"kol-field-control--disabled":Boolean(t),"kol-field-control--required":Boolean(f),"kol-field-control--touched":Boolean(_),"kol-field-control--hide-label":Boolean(s),"kol-field-control--read-only":Boolean(m),[`kol-field-control--${O||"error"}`]:Boolean(P),[`kol-field-control--label-align-${n}`]:Boolean(n)};return h("div",Object.assign({class:clsx("kol-field-control",A,o)},k),T,j&&h(KolFormFieldHintFc,Object.assign({},K||{},{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=__rest(e,["state"]);return h(KolFieldControlFc,Object.assign({},getFieldControlProps(o),r),l)};export{FieldControlStateWrapper as F};