text: import{r as t,c as e,h as i,H as s,d as n}from"./p-8bba27c4.js";import{i as o,g as r,b as c}from"./p-c6f371b6.js";const l=t=>{if(1===t.nodeType){if("script"===t.nodeName.toLowerCase())return!1;for(let e=0;e<t.attributes.length;e++){const i=t.attributes[e].value;if(o(i)&&0===i.toLowerCase().indexOf("on"))return!1}for(let e=0;e<t.childNodes.length;e++)if(!l(t.childNodes[e]))return!1}return!0},a=new Map,h=t=>{let e=a.get(t);return e||(e=fetch(t).then(t=>t.status<=299?t.text():Promise.resolve(null)).then(t=>(t=>{if(t){const e=document.createElement("div");e.innerHTML=t;for(let t=e.childNodes.length-1;t>=0;t--)"svg"!==e.childNodes[t].nodeName.toLowerCase()&&e.removeChild(e.childNodes[t]);const i=e.firstElementChild;if(i&&"svg"===i.nodeName.toLowerCase()&&(i.setAttribute("class","s-ion-icon"),l(i)))return e.innerHTML}return""})(t)),a.set(t,e)),e};class d{constructor(e){t(this,e),this.mode=m(this),this.isVisible=!1,this.lazy=!1}connectedCallback(){this.waitUntilVisible(this.el,"50px",()=>{this.isVisible=!0,this.loadIcon()})}disconnectedCallback(){this.io&&(this.io.disconnect(),this.io=void 0)}waitUntilVisible(t,e,i){if(this.lazy&&"undefined"!=typeof window&&window.IntersectionObserver){const s=this.io=new window.IntersectionObserver(t=>{t[0].isIntersecting&&(s.disconnect(),this.io=void 0,i())},{rootMargin:e});s.observe(t)}else i()}loadIcon(){if(this.isVisible){const t=r(this);t&&h(t).then(t=>this.svgContent=t)}if(!this.ariaLabel){const t=c(this.name,this.icon,this.mode,this.ios,this.md);t&&(this.ariaLabel=t.replace("ios-","").replace("md-","").replace(/\-/g," "))}}render(){const t=this.mode||"md",e=this.flipRtl||this.ariaLabel&&this.ariaLabel.indexOf("arrow")>-1&&!1!==this.flipRtl;return i(s,{role:"img",class:Object.assign({[t]:!0},u(this.color),{[`icon-${this.size}`]:!!this.size,"flip-rtl":!!e&&"rtl"===this.el.ownerDocument.dir})},i("div",this.svgContent?{class:"icon-inner",innerHTML:this.svgContent}:{class:"icon-inner"}))}static get assetsDirs(){return["svg"]}get el(){return n(this)}static get watchers(){return{name:["loadIcon"],src:["loadIcon"],icon:["loadIcon"]}}static get style(){return":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;-webkit-box-sizing:content-box!important;box-sizing:content-box!important}.icon-inner,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.icon-small){font-size:18px!important}:host(.icon-large){font-size:32px!important}:host(.ion-color){color:var(--ion-color-base)!important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary,#3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary,#0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary,#f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success,#10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning,#ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger,#f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light,#f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium,#989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark,#222428)}"}}const m=t=>e(t)||document.documentElement.getAttribute("mode")||"md",u=t=>t?{"ion-color":!0,[`ion-color-${t}`]:!0}:null;export{d as ion_icon};