import{r as t,h as s,H as i,g as e}from"./p-d85247d2.js";import{c as o}from"./p-efbc3883.js";import{c as n,f as a,s as d,o as h}from"./p-384ed661.js";const r=class{constructor(s){t(this,s),this.show=!1,this.align="bottom",this.hover=!1,this.syncWidth=!1,this.offset=0}onAlignWatch(){this.updateDropdownContainer()}componentDidLoad(){this.container=this.el.querySelector(".dropdown-container"),this.updateDropdownContainer(),this.el.addEventListener("mouseenter",this.onMouseEnterOnContainer.bind(this)),this.el.addEventListener("mouseleave",this.onMouseLeaveOnContainer.bind(this))}disconectedCallback(){this.el&&(this.el.removeEventListener("mouseenter",this.onMouseEnterOnContainer),this.el.removeEventListener("mouseleave",this.onMouseLeaveOnContainer))}onMouseEnterOnContainer(){this.hover&&(this.show=!0)}onMouseLeaveOnContainer(){this.hover&&(this.show=!1)}updateDropdownContainer(){this.syncWidth?(this.container.style.maxWidth=`${this.el.offsetWidth}px`,this.container.style.width="100%"):(this.container.style.maxWidth="auto",this.container.style.width="auto"),setTimeout((()=>{n(this.el,this.container,{placement:this.align,middleware:[a(),d({padding:10}),h(this.offset)]}).then((({x:t,y:s})=>{this.container.style.left=`${t}px`,this.container.style.top=`${s}px`}))}),50)}async display(t){this.show=t}render(){return s(i,{key:"71e5bd83345ae6f95e820a7c4bbe477c2593436d"},s("slot",{key:"c68838e07e036ad4196ac0c44d16708c89c67313"}),s("div",{key:"ddb1c6581583632112eccf1a00163e75dbe9b243",class:o("dropdown-container",{"dropdown-show":this.show,"dropdown-hover":this.hover})},s("slot",{key:"6be924779eae483e258cdb9ade1c9fbe72677fae",name:"dropdown"})))}get el(){return e(this)}static get watchers(){return{align:["onAlignWatch"],show:["onAlignWatch"]}}};r.style="x-dropdown{display:inherit;text-align:inherit}x-dropdown .dropdown-container{display:none;width:-webkit-max-content;width:-moz-max-content;width:max-content;top:0;left:0;position:absolute;z-index:10000}x-dropdown .dropdown-container.dropdown-show{display:block;-webkit-animation:0.3s fadeIn;animation:0.3s fadeIn}";export{r as x_dropdown}