/*!
 * KoliBri - The accessible HTML-Standard
 */
import{_ as __rest}from"./tslib.es6-1173d062.js";import{h,F as Fragment}from"./index-91489a9f.js";import{c as clsx}from"./clsx-09a06a12.js";import{a as KolFieldControlTooltipFc,b as KolFieldControlLabelFc,c as KolFieldControlHintFc}from"./getRenderStates-a7a33541.js";import{s as showExpertSlot,b as buildBadgeTextString}from"./reuse-32931294.js";import{c as checkHasError,a as convertMsgToInternMsg}from"./FormFieldMsg-1ed3f51d.js";const InputContainer=(l,e)=>{var{class:o}=l,r=__rest(l,["class"]);return h("div",Object.assign({class:clsx("kol-field-control__input",o)},r),e)},KolFieldControlFc=(l,e)=>{const{class:o,id:r,disabled:t,label:i,hideLabel:n,labelAlign:s,renderNoTooltip:a,hint:d,renderNoHint:c,tooltipAlign:b,accessKey:p,shortKey:g,msg:F,touched:f,required:u,readonly:C,fieldControlInputProps:_,fieldControlLabelProps:K,fieldControlTooltipProps:m,fieldControlHintProps:y}=l,k=__rest(l,["class","id","disabled","label","hideLabel","labelAlign","renderNoTooltip","hint","renderNoHint","tooltipAlign","accessKey","shortKey","msg","touched","required","readonly","fieldControlInputProps","fieldControlLabelProps","fieldControlTooltipProps","fieldControlHintProps"]),j=!c,x=!a,T=checkHasError(F,f),v=showExpertSlot(i),B=x&&!v&&n,P=buildBadgeTextString(p,g),S=[h(Fragment,null,h(InputContainer,Object.assign({},_),e),B&&h(KolFieldControlTooltipFc,Object.assign({},m||{},{id:r,label:i,hideLabel:n,align:b,badgeText:P}))),h(KolFieldControlLabelFc,Object.assign({},K||{},{id:r,baseClassName:"kol-field-control",class:clsx(null==K?void 0:K.class,{"kol-field-control__label--visually-hidden":Boolean(n)}),hasExpertSlot:v,label:i,accessKey:p,shortKey:g}))];"left"===s&&S.reverse();const L={"kol-field-control--disabled":Boolean(t),"kol-field-control--required":Boolean(u),"kol-field-control--touched":Boolean(f),"kol-field-control--hide-label":Boolean(n),"kol-field-control--read-only":Boolean(C),[`kol-field-control--${(null==F?void 0:F.type)||"error"}`]:Boolean(T),[`kol-field-control--label-align-${s}`]:Boolean(s)};return h("div",Object.assign({class:clsx("kol-field-control",L,o)},k),S,j&&h(KolFieldControlHintFc,Object.assign({},y||{},{baseClassName:"kol-field-control",id:r,hint:d})))},KolFieldControlFc$1=KolFieldControlFc;function getFieldControlProps(l){const e={accessKey:l._accessKey,shortKey:l._shortKey,id:l._id,disabled:l._disabled,msg:convertMsgToInternMsg(l._msg),hint:l._hint,label:l._label,hideLabel:l._hideLabel,touched:l._touched};return"_required"in l&&(e.required=l._required),"_readOnly"in l&&(e.readonly=l._readOnly),"_labelAlign"in l&&(e.labelAlign=l._labelAlign),e}const FieldControlStateWrapper=(l,e)=>{var{state:o}=l,r=__rest(l,["state"]);return h(KolFieldControlFc$1,Object.assign({},getFieldControlProps(o),r),e)},KolFieldControlStateWrapperFc=FieldControlStateWrapper;export{KolFieldControlStateWrapperFc as K};