import{r as t,h as o,g as i,H as e}from"./p-444192d7.js";import{h as s,t as a}from"./p-9c6e275c.js";import{c as r,d as n,f as l,s as h,o as d,e as p}from"./p-384ed661.js";const c=["mouseenter","touchstart"],m=["mouseleave","blur","touchend"],b=class{constructor(o){t(this,o),this.content=void 0,this.align="top"}onPropChange(){b.activeElements.has(this.el)&&(this.hideHandler(),setTimeout((()=>{this.showHandler()}),10))}componentDidLoad(){this.tooltip=s(),c.forEach((t=>{this.el.addEventListener(t,this.showHandler.bind(this))})),m.forEach((t=>{this.el.addEventListener(t,this.hideHandler.bind(this))})),window.addEventListener("scroll",this.hideHandler,!0),window.addEventListener("resize",this.hideHandler,!0),document.addEventListener("visibilitychange",this.hideHandler,!0),document.addEventListener("touchmove",this.hideHandler,!0)}disconectedCallback(){this.hideHandler(),b.activeElements.delete(this.el),c.forEach((t=>{this.el.removeEventListener(t,this.showHandler)})),m.forEach((t=>{this.el.removeEventListener(t,this.hideHandler)})),window.removeEventListener("scroll",this.hideHandler,!0),window.removeEventListener("resize",this.hideHandler,!0),document.removeEventListener("visibilitychange",this.hideHandler,!0),document.removeEventListener("touchmove",this.hideHandler,!0)}showHandler(){b.activeElements.add(this.el),this.tooltip.setAttribute("data-show",""),this.tooltip.querySelector("span").innerHTML=a(this.content)||"";const t=this.tooltip.querySelector(".tooltip-arrow");r(this.el,this.tooltip,{placement:this.align,middleware:["auto"==this.align?n():l(),h({padding:10}),d(4),p({element:t})]}).then((({x:o,y:i,middlewareData:e,placement:s})=>{if(this.tooltip.style.left=`${o}px`,this.tooltip.style.top=`${i}px`,e.arrow){const{x:o,y:i}=e.arrow,a={top:"bottom",right:"left",bottom:"top",left:"right"}[s.split("-")[0]];Object.assign(t.style,{left:null!=o?`${o}px`:"",top:null!=i?`${i}px`:"",right:"",bottom:"",[a]:"-4px"})}}))}hideHandler(){b.activeElements.delete(this.el),0===b.activeElements.size&&this.tooltip&&(this.tooltip.setAttribute("data-show",""),this.tooltip.removeAttribute("data-show"),this.tooltip.querySelector("span").innerHTML="")}render(){return o(e,{key:"8acb5f55c7305bdc1985c6fa422b04719f68e6dd","aria-label":this.content})}get el(){return i(this)}static get watchers(){return{content:["onPropChange"],align:["onPropChange"]}}};b.activeElements=new Set,b.style='x-tooltip{display:inherit}x-tooltip-overlay{font-family:"Poppins", "Arial", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";background:var(--color-dark-tinted, #626262);color:var(--color-text-light, #FEFEFE);padding:4px 8px;font-size:0.9rem;border-radius:4px;display:none;-webkit-box-shadow:0 0 1em rgba(0, 0, 0, 0.2);box-shadow:0 0 1em rgba(0, 0, 0, 0.2);z-index:10000;position:absolute;text-align:inherit;top:0;left:0;width:-webkit-max-content;width:-moz-max-content;width:max-content}x-tooltip-overlay:empty{display:none}.is-dark-mode x-tooltip-overlay{background:var(--color-light-shade, #d8d8d8);color:var(--color-text, #4A4A4A)}x-tooltip-overlay[data-show]{display:block;-webkit-animation:0.4s fadeIn;animation:0.4s fadeIn}x-tooltip-overlay>p{margin:0px;font-family:"Poppins", "Arial", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}x-tooltip-overlay .tooltip-arrow{position:absolute;background:var(--color-dark-tinted, #626262);width:8px;height:8px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.is-dark-mode x-tooltip-overlay .tooltip-arrow{background:var(--color-light-shade, #d8d8d8)}';export{b as x_tooltip}