/*!
 * KoliBri - The accessible HTML-Standard
 */
import{a as o}from"./tslib.es6-QNbPBOk5.js";import{h as l,F as e}from"./index-Brmny3Vg.js";import{B as t}from"./variant-quote-BMV8GZX8.js";import{T as i}from"./component-DTx6ZVqq.js";import{T as n}from"./controller-oT8Y98Yc.js";import"./common-DEEjER7G.js";import{b as s,s as r}from"./component-CQaxTS4u.js";import{K as a,b as d,g as c,i as f}from"./FormFieldStateWrapper-DCXQnRBu.js";import{c as p}from"./clsx-COFh-Vc8.js";import{a as b}from"./dev.utils-HhhlYW_9.js";const u=new Map;const m=o=>{const l=u.get(o);if(l){return l}const e=new n(t.stateLess);e.componentWillLoad({label:""});u.set(o,e);return e};const h=o=>{const l=u.get(o);if(l){l.destroy();u.delete(o)}};const v=(e,t)=>{var{class:i}=e,n=o(e,["class"]);return l("div",Object.assign({class:p("kol-field-control__input",i)},n),t)};const j=(t,n)=>{const{class:u,id:j,disabled:g,label:k,hideLabel:y,labelAlign:B,renderNoTooltip:C,hint:_,renderNoHint:T,accessKey:K,shortKey:O,msg:P,touched:F,required:q,readonly:x,tooltipAlign:N,tooltipFloatingRef:A,fieldControlInputProps:H,fieldControlLabelProps:L,fieldControlTooltipProps:E,fieldControlHintProps:R}=t,V=o(t,["class","id","disabled","label","hideLabel","labelAlign","renderNoTooltip","hint","renderNoHint","accessKey","shortKey","msg","touched","required","readonly","tooltipAlign","tooltipFloatingRef","fieldControlInputProps","fieldControlLabelProps","fieldControlTooltipProps","fieldControlHintProps"]);const D=!T;const Q=!C;const S=r(k);const Y=Q&&!S&&y;const w=s(K,O);const G=b(j,"label");const I=Y?m(j):undefined;if(I){I.watchAlign(N);I.watchBadgeText(w||"");I.watchId(G);I.watchLabel(k)}else{h(j)}const M=H===null||H===void 0?void 0:H.ref;const W=o=>{M===null||M===void 0?void 0:M(o);if(I&&o){I.initContext(o);I.syncListeners(undefined,o,true)}};const X=[l(e,null,l(v,Object.assign({},H,{ref:W}),n),Y&&l("div",{class:p("kol-form-field__tooltip",E===null||E===void 0?void 0:E.class)},l(i,{badgeText:w||"",label:k,align:N,id:G,refFloating:A!==null&&A!==void 0?A:o=>{I===null||I===void 0?void 0:I.setTooltipElementRef(o)}}))),l(a,Object.assign({},L||{},{id:j,baseClassName:"kol-field-control",class:p(L===null||L===void 0?void 0:L.class,{["kol-field-control__label--visually-hidden"]:Boolean(y)}),hasExpertSlot:S,label:k,accessKey:K,shortKey:O}))];if(B==="left"){X.reverse()}const Z={["kol-field-control--disabled"]:Boolean(g),["kol-field-control--required"]:Boolean(q),["kol-field-control--touched"]:Boolean(F),["kol-field-control--hide-label"]:Boolean(y),["kol-field-control--read-only"]:Boolean(x),[`kol-field-control--${c(P)}`]:Boolean(f(P,F)),[`kol-field-control--label-align-${B}`]:Boolean(B)};return l("div",Object.assign({class:p("kol-field-control",Z,u)},V),X,D&&l(d,Object.assign({},R||{},{baseClassName:"kol-field-control",id:j,hint:_})))};function g(o){const l={id:o._id,disabled:o._disabled,msg:o._msg,hint:o._hint,label:o._label,hideLabel:o._hideLabel,touched:o._touched};if("_required"in o){l.required=o._required}if("_readOnly"in o){l.readonly=o._readOnly}if("_labelAlign"in o){l.labelAlign=o._labelAlign}if("_accessKey"in o){l.accessKey=o._accessKey}if("_shortKey"in o){l.shortKey=o._shortKey}return l}const k=(e,t)=>{var{state:i}=e,n=o(e,["state"]);return l(j,Object.assign({},g(i),n),t)};export{k as F};
//# sourceMappingURL=FieldControlStateWrapper-CCrS0kX3.js.map