import{c as u,o as l,f as w,s as m}from"./Tooltip-BvQfm2Tj.js";const b=()=>{const a=document.querySelectorAll("[data-dropdown='button']");for(let s=0;s<a.length;s++){const e=a[s];if(e.dataset.dropdownTarget){const t=document.getElementById(e.dataset?.dropdownTarget);if(t){document.body.appendChild(t);const r=()=>{const o=t.dataset.dropdownOffsetX?parseInt(t.dataset.dropdownOffsetX):0,d=t.dataset.dropdownOffsetY?parseInt(t.dataset.dropdownOffsetY):0;u(e,t,{placement:t.dataset.dropdownPlacement,middleware:[l({mainAxis:d,crossAxis:o}),w(),m()]}).then(({x:n,y:f})=>{Object.assign(t.style,{left:`${n}px`,top:`${f}px`})})},c=()=>{t.setAttribute("data-show",""),e.setAttribute("aria-expanded","true"),r()},p=()=>{t.removeAttribute("data-show"),e.setAttribute("aria-expanded","false")},i=()=>{t.hasAttribute("data-show")?p():c()};e.addEventListener("click",i),document.addEventListener("click",function(o){const d=t.hasAttribute("data-show"),n=!t.contains(o.target)&&!e.contains(o.target);d&&n&&i()})}}}};export{b as D};
