/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as i,h as s,F as e,H as t,g as a}from"./index-cf24d1fe.js";import{c as d}from"./clsx-09a06a12.js";import{t as o}from"./i18n-8640d789.js";import{F as l}from"./form-field-msg-22e08734.js";import{a as n,g as h,c}from"./component-names-0a8a1a6c.js";import{h as r,s as f}from"./reuse-523ba2ac.js";import"./i18n-7ea9f137.js";const u=class{constructor(t){i(this,t),this.slotName="input",this.catchInputSlot=t=>{r(this.host,t,this.slotName)},this._accessKey=void 0,this._alert=!0,this._currentLength=void 0,this._disabled=!1,this._hasCounter=!1,this._hideError=!1,this._hideLabel=!1,this._hint="",this._icons=void 0,this._id=void 0,this._label=void 0,this._maxLength=void 0,this._msg=void 0,this._readOnly=!1,this._renderNoLabel=!1,this._required=!1,this._slotName=void 0,this._suggestions=void 0,this._smartButton=void 0,this._tooltipAlign="top",this._touched=!1}componentWillRender(){this.slotName=this._slotName?this._slotName:"input"}getIconStyles(t){return t&&"object"==typeof t&&t.style?t.style:{}}render(){var i,a,r,_,u,b,m,g,p,y,v,k;const B=Boolean("error"===(null===(i=this._msg)||void 0===i?void 0:i._type)&&this._msg._description&&(null===(a=this._msg._description)||void 0===a?void 0:a.length)>0),j=!this._readOnly&&B&&!0===this._touched,L=Boolean(j||"error"!==(null===(r=this._msg)||void 0===r?void 0:r._type)&&(null===(_=this._msg)||void 0===_?void 0:_._description)),N=f(this._label),x="string"==typeof this._hint&&this._hint.length>0,A=!N&&this._hideLabel;return s(t,{key:"cb5a010dca6149a054367c7244be69a4e9facb6b",class:d("kol-input",this.getModifierClassNameByMsgType(),{disabled:!0===this._disabled,error:!0===j,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-error":!0===this._hideError})},s("label",{key:"e9d576ee7f951415fc80678196a94a243908d9a1",class:"input-label",id:A?void 0:`${this._id}-label`,hidden:A,htmlFor:this._id},s("span",{key:"8af0c623f1c552deb3cbb306c5370c8cc05539be",class:"input-label-span"},s("slot",{key:"123d4cd6e4f6e6a0e805e13a3e79a39bf049ff85",name:"label"}))),x&&s("span",{key:"4475d87afadc2d721a34511aa96cd5775d150c39",class:"hint",id:`${this._id}-hint`},this._hint),s("div",{key:"eee25913b496676e874a5123ef132048c2535b8a",class:{input:!0,"icon-left":"object"==typeof(null===(u=this._icons)||void 0===u?void 0:u.left),"icon-right":"object"==typeof(null===(b=this._icons)||void 0===b?void 0:b.right)}},(null===(m=this._icons)||void 0===m?void 0:m.left)&&s(h,{key:"84326de1ed7d3542ab0c868ba5bcc88d66d09ed2",_label:"",_icons:(null===(g=this._icons)||void 0===g?void 0:g.left).icon,style:this.getIconStyles(null===(p=this._icons)||void 0===p?void 0:p.left)}),s("div",{key:"4499d53591ef3ca4c86603481f65b09a0f65a5a9",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&s(c,{key:"cc02b46988087722bb62674e02d0a2a0922d8033",_customClass:this._smartButton._customClass,_disabled:this._smartButton._disabled,_icons:this._smartButton._icons,_hideLabel:!0,_id:this._smartButton._id,_label:this._smartButton._label,_on:this._smartButton._on,_tooltipAlign:this._smartButton._tooltipAlign,_variant:this._smartButton._variant}),(null===(y=this._icons)||void 0===y?void 0:y.right)&&s(h,{key:"7425d45bd0da5363927ff85980f47e5728c9245c",_label:"",_icons:(null===(v=this._icons)||void 0===v?void 0:v.right).icon,style:this.getIconStyles(null===(k=this._icons)||void 0===k?void 0:k.right)})),A&&s(n,{key:"66bfb816c06ec291dae8683d1f4dabf81fb4376c","aria-hidden":"true",class:"input-tooltip",_accessKey:this._accessKey,_align:this._tooltipAlign,_id:this._hideLabel?`${this._id}-label`:void 0,_label:this._label}),L&&s(l,{key:"afbfc9cb6af4e93cf18cbff41a7114ae17043af8",_alert:this._alert,_hideError:this._hideError,_msg:this._msg,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&s("datalist",{key:"7de41a5df7e95fe2ecd4756a93584fa59155efe1",id:`${this._id}-list`},this._suggestions.map((t=>s("option",{value:t})))),this._hasCounter&&s("span",{key:"e97be096b0bd1bf7622bd4daa0c0d482cf3b8c61",class:"counter","aria-atomic":"true","aria-live":"polite","data-testid":"input-counter"},this._currentLength,this._maxLength&&s(e,null,s("span",{key:"6449d0737b9123456f82ea25a0d0b289aad3df7a","aria-label":o("kol-of"),role:"img"},"/"),this._maxLength)," ",s("span",{key:"c6ad705d411bcde0769a7e7cfd1f4859fd8ce279"},o("kol-characters"))))}getModifierClassNameByMsgType(){var t,s;if(null===(t=this._msg)||void 0===t?void 0:t._type)return{default:"msg-type-default",info:"msg-type-info",success:"msg-type-success",warning:"msg-type-warning",error:"msg-type-error"}[null===(s=this._msg)||void 0===s?void 0:s._type]}get host(){return a(this)}};export{u as kol_input};