function u(){return typeof window<"u"}function p(t){return x(t)?(t.nodeName||"").toLowerCase():"#document"}function a(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function D(t){var n;return(n=(x(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function x(t){return u()?t instanceof Node||t instanceof a(t).Node:!1}function S(t){return u()?t instanceof Element||t instanceof a(t).Element:!1}function A(t){return u()?t instanceof HTMLElement||t instanceof a(t).HTMLElement:!1}function h(t){return!u()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof a(t).ShadowRoot}function E(t){const{overflow:n,overflowX:e,overflowY:r,display:o}=P(t);return/auto|scroll|overlay|hidden|clip/.test(n+r+e)&&o!=="inline"&&o!=="contents"}function z(t){return/^(table|td|th)$/.test(p(t))}function M(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const O=/transform|translate|scale|rotate|perspective|filter/,v=/paint|layout|strict|content/,c=t=>!!t&&t!=="none";let l;function R(t){const n=S(t)?P(t):t;return c(n.transform)||c(n.translate)||c(n.scale)||c(n.rotate)||c(n.perspective)||!k()&&(c(n.backdropFilter)||c(n.filter))||O.test(n.willChange||"")||v.test(n.contain||"")}function G(t){let n=f(t);for(;A(n)&&!N(n);){if(R(n))return n;if(M(n))return null;n=f(n)}return null}function k(){return l==null&&(l=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),l}function N(t){return/^(html|body|#document)$/.test(p(t))}function P(t){return a(t).getComputedStyle(t)}function J(t){return S(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function f(t){if(p(t)==="html")return t;const n=t.assignedSlot||t.parentNode||h(t)&&t.host||D(t);return h(n)?n.host:n}function C(t){const n=f(t);return N(n)?t.ownerDocument?t.ownerDocument.body:t.body:A(n)&&E(n)?n:C(n)}function w(t,n,e){var r;n===void 0&&(n=[]),e===void 0&&(e=!0);const o=C(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=a(o);if(i){const g=_(s);return n.concat(s,s.visualViewport||[],E(o)?o:[],g&&e?w(g):[])}else return n.concat(o,w(o,[],e))}function _(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Q=["top","right","bottom","left"],j=Math.min,B=Math.max,U=Math.round,Z=Math.floor,I=t=>({x:t,y:t}),H={left:"right",right:"left",bottom:"top",top:"bottom"};function tt(t,n,e){return B(t,j(n,e))}function nt(t,n){return typeof t=="function"?t(n):t}function L(t){return t.split("-")[0]}function T(t){return t.split("-")[1]}function W(t){return t==="x"?"y":"x"}function $(t){return t==="y"?"height":"width"}function F(t){const n=t[0];return n==="t"||n==="b"?"y":"x"}function K(t){return W(F(t))}function et(t,n,e){e===void 0&&(e=!1);const r=T(t),o=K(t),i=$(o);let s=o==="x"?r===(e?"end":"start")?"right":"left":r==="start"?"bottom":"top";return n.reference[i]>n.floating[i]&&(s=d(s)),[s,d(s)]}function ot(t){const n=d(t);return[m(t),n,m(n)]}function m(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const b=["left","right"],y=["right","left"],V=["top","bottom"],X=["bottom","top"];function Y(t,n,e){switch(t){case"top":case"bottom":return e?n?y:b:n?b:y;case"left":case"right":return n?V:X;default:return[]}}function rt(t,n,e,r){const o=T(t);let i=Y(L(t),e==="start",r);return o&&(i=i.map(s=>s+"-"+o),n&&(i=i.concat(i.map(m)))),i}function d(t){const n=L(t);return H[n]+t.slice(n.length)}function q(t){return{top:0,right:0,bottom:0,left:0,...t}}function it(t){return typeof t!="number"?q(t):{top:t,right:t,bottom:t,left:t}}function st(t){const{x:n,y:e,width:r,height:o}=t;return{width:r,height:o,top:e,left:n,right:n+r,bottom:e+o,x:n,y:e}}export{B as A,Q as B,W as C,w as D,D as E,I as F,_ as G,U as H,M as I,z as J,R as K,G as L,J as M,h as a,S as b,p as c,x as d,a as e,Z as f,P as g,k as h,A as i,N as j,f as k,E as l,nt as m,it as n,K as o,T as p,$ as q,tt as r,L as s,F as t,st as u,d as v,ot as w,rt as x,et as y,j as z};
