import{r as t,c as i,a as s,h as e,d as n}from"./p-wX3eJOEL.js";import{g as o}from"./p-BqOxJCFA.js";import{i as r}from"./p-CtINY9El.js";import{d as c,t as a}from"./p-DNHOWgWh.js";const h=class{constructor(s){t(this,s),this.consoleError=i(this,"consoleError",7)}get el(){return s(this)}icon="";consoleError;iconSvg;updateIcon(t){this.setIcon()}convertStringToHtml(t){const i=document.createElement("div");return i.innerHTML=t,i.firstChild}convertHtmlToObject(t){return Array.from(t.attributes,(({name:t,value:i})=>({name:t,value:i}))).reduce(((t,i)=>(t[i.name]=i.value,t)),{})}convertPathsToVnode(t){const i=[],s=this.convertHtmlToObject(t),n=e("path",s);if(i.push(n),t.firstChild){const s=t.querySelectorAll("path"),n=t.querySelectorAll("path").length;for(let t=0;t<n;t++){const n=this.convertHtmlToObject(s[t]),o=e("path",n);i.push(o)}}return i}getSVG(t){const i=this.convertStringToHtml(this.iconSvg),s=i.getAttribute("width"),n=i.getAttribute("height"),o=i.getAttribute("fill"),r=i.getAttribute("viewBox");return e("svg",{class:"inline-svg",width:s,height:n,xmlns:"http://www.w3.org/2000/svg",fill:o,viewBox:r,focusable:"false",role:"presentation","aria-hidden":"true"},...t)}constructIcon(){if(this.iconSvg){const t=this.convertStringToHtml(this.iconSvg),i=this.convertPathsToVnode(t);return this.getSVG(i)}return""!==this.icon?void this.consoleError.emit(!0):void 0}setIcon(){const t=this.icon.replace(/[-_]+(.)/g,((t,i)=>i.toUpperCase())).replace(/^(.)/,(t=>t.toLowerCase()));this.iconSvg=o(t)}isInsideAgGrid(t){let i=t;for(;i;){if(i.className?.toLowerCase().startsWith("ag-"))return!0;i=i.parentElement}return!1}isInsideChoices(t){let i=t;for(;i;){if(i.className?.toLowerCase().startsWith("choices__"))return!0;i=i.parentElement}return!1}componentWillLoad(){this.setIcon()}async componentDidLoad(){if(!r(this.el)&&!this.isInsideAgGrid(this.el)&&!this.isInsideChoices(this.el)){const t=c();a("ifx-icon",await t)}}render(){return e(n,{key:"197846ea1ba83ce9d0c11abb0c1613623fd98845"},this.constructIcon())}static get watchers(){return{icon:[{updateIcon:0}]}}};h.style="ifx-icon{display:inline-flex;justify-content:center}ifx-icon svg{outline:none}ifx-icon:empty{display:none}";export{h as ifx_icon}