import{r as registerInstance,h,g as getElement,H as Host}from"./index-da72c774.js";import{f as getTooltipElement,t as tinyMDtoHTML}from"./helpers-bcb19b84.js";import{c as computePosition,a as autoPlacement,f as flip,s as shift,o as offset,b as arrow}from"./floating-ui.dom.esm-a2d21c5a.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"];var hideEvents=["mouseleave","blur"];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 t=this;showEvents.forEach((function(o){t.el.removeEventListener(o,t.showHandler)}));hideEvents.forEach((function(o){t.el.removeEventListener(o,t.hideHandler)}))};t.prototype.showHandler=function(){var t=this;this.tooltip.setAttribute("data-show","");this.tooltip.querySelector("span").innerHTML=tinyMDtoHTML(this.content)||"";var o=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:o})]}).then((function(e){var i;var a=e.x,n=e.y,s=e.middlewareData,r=e.placement;t.tooltip.style.left="".concat(a,"px");t.tooltip.style.top="".concat(n,"px");if(s.arrow){var l=s.arrow,p=l.x,d=l.y;var m={top:"bottom",right:"left",bottom:"top",left:"right"}[r.split("-")[0]];Object.assign(o.style,(i={left:p!=null?"".concat(p,"px"):"",top:d!=null?"".concat(d,"px"):"",right:"",bottom:""},i[m]="-4px",i))}}))};t.prototype.hideHandler=function(){var t=this;setTimeout((function(){t.tooltip.removeAttribute("data-show");t.tooltip.querySelector("span").innerHTML=""}),50)};t.prototype.render=function(){return h(Host,{key:"5a5634c258cb53ebbb84bf5381bdbd9727be30c9","aria-label":this.content})};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();XTooltip.style=XTooltipStyle0;export{XTooltip as x_tooltip};