import{r as registerInstance,h,g as getElement,H as Host}from"./index-6191c26c.js";import{h as getTooltipElement,t as tinyMDtoHTML}from"./helpers-3d0ba5b1.js";import{c as computePosition,d as autoPlacement,f as flip,s as shift,o as offset,e as arrow}from"./floating-ui.dom.esm-6802681c.js";var styleCss='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)}';var XTooltipStyle0=styleCss;var showEvents=["mouseenter","touchstart"];var hideEvents=["mouseleave","blur","touchend"];var XTooltip=function(){function t(t){registerInstance(this,t);this.content=undefined;this.align="top"}t.prototype.componentDidLoad=function(){var t=this;this.tooltip=getTooltipElement();showEvents.forEach((function(o){t.el.addEventListener(o,t.showHandler.bind(t))}));hideEvents.forEach((function(o){t.el.addEventListener(o,t.hideHandler.bind(t))}))};t.prototype.disconectedCallback=function(){var o=this;t.activeElements.delete(this.el);showEvents.forEach((function(t){o.el.removeEventListener(t,o.showHandler)}));hideEvents.forEach((function(t){o.el.removeEventListener(t,o.hideHandler)}))};t.prototype.showHandler=function(){var o=this;t.activeElements.add(this.el);this.tooltip.setAttribute("data-show","");this.tooltip.querySelector("span").innerHTML=tinyMDtoHTML(this.content)||"";var e=this.tooltip.querySelector(".tooltip-arrow");computePosition(this.el,this.tooltip,{placement:this.align,middleware:[this.align=="auto"?autoPlacement():flip(),shift({padding:10}),offset(4),arrow({element:e})]}).then((function(t){var i;var a=t.x,n=t.y,s=t.middlewareData,r=t.placement;o.tooltip.style.left="".concat(a,"px");o.tooltip.style.top="".concat(n,"px");if(s.arrow){var l=s.arrow,p=l.x,d=l.y;var h={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]];Object.assign(e.style,(i={left:p!=null?"".concat(p,"px"):"",top:d!=null?"".concat(d,"px"):"",right:"",bottom:""},i[h]="-4px",i))}}))};t.prototype.hideHandler=function(){t.activeElements.delete(this.el);if(t.activeElements.size===0){this.tooltip.removeAttribute("data-show");this.tooltip.querySelector("span").innerHTML=""}};t.prototype.render=function(){return h(Host,{key:"9205e005c475445b4aa61f98a113aef33cde3ab4","aria-label":this.content})};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();XTooltip.activeElements=new Set;XTooltip.style=XTooltipStyle0;export{XTooltip as x_tooltip};