const t=window.webmapgl.h;let e;function i(t,e,i,n){return e="ios"===(e=(e||"md").toLowerCase())?"ios":"md",i&&"ios"===e?t=i.toLowerCase():n&&"md"===e?t=n.toLowerCase():t&&(t=t.toLowerCase(),/^md-|^ios-|^logo-/.test(t)||(t=`${e}-${t}`)),"string"!=typeof t||""===t.trim()?null:""!==t.replace(/[a-z]|-|\d/gi,"")?null:t}function n(t){return"string"==typeof t&&s(t=t.trim())?t:null}function s(t){return t.length>0&&/(\/|\.)/.test(t)}class o{constructor(){this.isVisible=!1,this.lazy=!1}componentWillLoad(){this.waitUntilVisible(this.el,"50px",()=>{this.isVisible=!0,this.loadIcon()})}componentDidUnload(){this.io&&(this.io.disconnect(),this.io=void 0)}waitUntilVisible(t,e,i){if(this.lazy&&this.win&&this.win.IntersectionObserver){const n=this.io=new this.win.IntersectionObserver(t=>{t[0].isIntersecting&&(n.disconnect(),this.io=void 0,i())},{rootMargin:e});n.observe(t)}else i()}loadIcon(){if(!this.isServer&&this.isVisible){const t=this.getUrl();t?function(t,e,i){let n=r.get(e);return n||(n=fetch(e,{cache:"force-cache"}).then(t=>!function(e){return t.status<=299}()?Promise.resolve(null):t.text()).then(e=>(function(t,e,i){if(e){const i=t.createDocumentFragment(),n=t.createElement("div");n.innerHTML=e,i.appendChild(n);for(let t=n.childNodes.length-1;t>=0;t--)"svg"!==n.childNodes[t].nodeName.toLowerCase()&&n.removeChild(n.childNodes[t]);const s=n.firstElementChild;if(s&&"svg"===s.nodeName.toLowerCase()&&(s.setAttribute("class","s-ion-icon"),function t(e){if(1===e.nodeType){if("script"===e.nodeName.toLowerCase())return!1;for(let t=0;t<e.attributes.length;t++){const i=e.attributes[t].value;if("string"==typeof i&&0===i.toLowerCase().indexOf("on"))return!1}for(let i=0;i<e.childNodes.length;i++)if(!t(e.childNodes[i]))return!1}return!0}(s)))return n.innerHTML}return""})(t,e)),r.set(e,n)),n}(this.doc,t).then(t=>this.svgContent=t):console.error("icon was not resolved")}if(!this.ariaLabel){const t=i(this.getName(),this.mode,this.ios,this.md);t&&(this.ariaLabel=t.replace("ios-","").replace("md-","").replace(/\-/g," "))}}getName(){return void 0!==this.name?this.name:this.icon&&!s(this.icon)?this.icon:void 0}getUrl(){let t=n(this.src);return t||((t=i(this.getName(),this.mode,this.ios,this.md))?this.getNamedUrl(t):(t=n(this.icon))||null)}getNamedUrl(t){return function(){if(!e){const t=window;t.Ionicons=t.Ionicons||{},e=t.Ionicons.map=t.Ionicons.map||new Map}return e}().get(t)||`${this.resourcesUrl}svg/${t}.svg`}hostData(){const t=this.mode||"md",e=this.flipRtl||this.ariaLabel&&this.ariaLabel.indexOf("arrow")>-1&&!1!==this.flipRtl;return{role:"img",class:Object.assign({[`${t}`]:!0},(i=this.color,i?{"ion-color":!0,[`ion-color-${i}`]:!0}:null),{[`icon-${this.size}`]:!!this.size,"flip-rtl":e&&"rtl"===this.doc.dir})};var i}render(){return t("div",!this.isServer&&this.svgContent?{class:"icon-inner",innerHTML:this.svgContent}:{class:"icon-inner"})}static get is(){return"ion-icon"}static get encapsulation(){return"shadow"}static get properties(){return{ariaLabel:{type:String,attr:"aria-label",reflectToAttr:!0,mutable:!0},color:{type:String,attr:"color"},doc:{context:"document"},el:{elementRef:!0},flipRtl:{type:Boolean,attr:"flip-rtl"},icon:{type:String,attr:"icon",watchCallbacks:["loadIcon"]},ios:{type:String,attr:"ios"},isServer:{context:"isServer"},isVisible:{state:!0},lazy:{type:Boolean,attr:"lazy"},md:{type:String,attr:"md"},mode:{type:String,attr:"mode"},name:{type:String,attr:"name",watchCallbacks:["loadIcon"]},resourcesUrl:{context:"resourcesUrl"},size:{type:String,attr:"size"},src:{type:String,attr:"src",watchCallbacks:["loadIcon"]},svgContent:{state:!0},win:{context:"window"}}}static get style(){return".sc-ion-icon-h{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;-webkit-box-sizing:content-box!important;box-sizing:content-box!important}.icon-inner.sc-ion-icon, svg.sc-ion-icon{display:block;height:100%;width:100%}.flip-rtl.sc-ion-icon-h   .icon-inner.sc-ion-icon{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.icon-small.sc-ion-icon-h{font-size:18px!important}.icon-large.sc-ion-icon-h{font-size:32px!important}.ion-color.sc-ion-icon-h{color:var(--ion-color-base)!important}.ion-color-primary.sc-ion-icon-h{--ion-color-base:var(--ion-color-primary,#3880ff)}.ion-color-secondary.sc-ion-icon-h{--ion-color-base:var(--ion-color-secondary,#0cd1e8)}.ion-color-tertiary.sc-ion-icon-h{--ion-color-base:var(--ion-color-tertiary,#f4a942)}.ion-color-success.sc-ion-icon-h{--ion-color-base:var(--ion-color-success,#10dc60)}.ion-color-warning.sc-ion-icon-h{--ion-color-base:var(--ion-color-warning,#ffce00)}.ion-color-danger.sc-ion-icon-h{--ion-color-base:var(--ion-color-danger,#f14141)}.ion-color-light.sc-ion-icon-h{--ion-color-base:var(--ion-color-light,#f4f5f8)}.ion-color-medium.sc-ion-icon-h{--ion-color-base:var(--ion-color-medium,#989aa2)}.ion-color-dark.sc-ion-icon-h{--ion-color-base:var(--ion-color-dark,#222428)}"}}const r=new Map;export{o as IonIcon};