/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const index=require("./index-f0fde70b.js"),index$1=require("./index-cb2ce614.js"),i18n=require("./i18n-9f4d1694.js"),formFieldMsg=require("./form-field-msg-a1c5712a.js"),componentNames=require("./component-names-4cf3e7f5.js");function r(t){var i,e,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(i=0;i<o;i++)t[i]&&(e=r(t[i]))&&(s&&(s+=" "),s+=e)}else for(e in t)t[e]&&(s&&(s+=" "),s+=e);return s}function clsx(){for(var t,i,e=0,s="",o=arguments.length;e<o;e++)(t=arguments[e])&&(i=r(t))&&(s&&(s+=" "),s+=i);return s}require("./i18n-c3fa5bd7.js");const KolInput=class{constructor(t){index.registerInstance(this,t),this.slotName="input",this.catchInputSlot=t=>{index$1.handleSlotContent(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 t,i,e,s,o,n,l,h,d,r,a,_;const c=Boolean("error"===(null===(t=this._msg)||void 0===t?void 0:t._type)&&this._msg._description&&(null===(i=this._msg._description)||void 0===i?void 0:i.length)>0),u=!this._readOnly&&c&&!0===this._touched,g=Boolean(u||"error"!==(null===(e=this._msg)||void 0===e?void 0:e._type)&&(null===(s=this._msg)||void 0===s?void 0:s._description)),m=index$1.showExpertSlot(this._label),p="string"==typeof this._hint&&this._hint.length>0,b=!m&&this._hideLabel;return index.h(index.Host,{key:"acb6294dbb3bb30298be633a4728d890d24c6dc7",class:clsx("kol-input",this.getModifierClassNameByMsgType(),{disabled:!0===this._disabled,error:!0===u,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-error":!0===this._hideError})},index.h("label",{key:"356dbae7d6b7b02202e1020131dc7e8bb70a69c2",class:"input-label",id:b?void 0:`${this._id}-label`,hidden:b,htmlFor:this._id},index.h("span",{key:"c5ee06729ca4bb5c1458085068ac6a64fcfeae1a",class:"input-label-span"},index.h("slot",{key:"146aeb9bef32ebc54b1fcbf282841d7d44fd5730",name:"label"}))),p&&index.h("span",{class:"hint",id:`${this._id}-hint`},this._hint),index.h("div",{key:"755e40c1da91b382387ddea16935235e793fff1b",class:{input:!0,"icon-left":"object"==typeof(null===(o=this._icons)||void 0===o?void 0:o.left),"icon-right":"object"==typeof(null===(n=this._icons)||void 0===n?void 0:n.right)}},(null===(l=this._icons)||void 0===l?void 0:l.left)&&index.h(componentNames.KolIconTag,{_label:"",_icons:(null===(h=this._icons)||void 0===h?void 0:h.left).icon,style:this.getIconStyles(null===(d=this._icons)||void 0===d?void 0:d.left)}),index.h("div",{key:"49c2557719125b83a696987ee88ec72a254b5077",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&index.h(componentNames.KolButtonWcTag,{_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===(r=this._icons)||void 0===r?void 0:r.right)&&index.h(componentNames.KolIconTag,{_label:"",_icons:(null===(a=this._icons)||void 0===a?void 0:a.right).icon,style:this.getIconStyles(null===(_=this._icons)||void 0===_?void 0:_.right)})),b&&index.h(componentNames.KolTooltipWcTag,{"aria-hidden":"true",class:"input-tooltip",_accessKey:this._accessKey,_align:this._tooltipAlign,_id:this._hideLabel?`${this._id}-label`:void 0,_label:this._label}),g&&index.h(formFieldMsg.FormFieldMsg,{_alert:this._alert,_hideError:this._hideError,_msg:this._msg,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&index.h("datalist",{id:`${this._id}-list`},this._suggestions.map((t=>index.h("option",{value:t})))),this._hasCounter&&index.h("span",{class:"counter","aria-atomic":"true","aria-live":"polite"},this._currentLength,this._maxLength&&index.h(index.Fragment,null,index.h("span",{"aria-label":i18n.translate("kol-of"),role:"img"},"/"),this._maxLength)," ",index.h("span",null,i18n.translate("kol-characters"))))}getModifierClassNameByMsgType(){var t,i;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===(i=this._msg)||void 0===i?void 0:i._type]}get host(){return index.getElement(this)}};exports.kol_input=KolInput;