@devopness/ui-react
Version:
Devopness Design System React Components - Painless essential DevOps to everyone
1,168 lines (1,167 loc) • 31 kB
JavaScript
var Me = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Fe(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var yt = function() {
return yt = Object.assign || function(e) {
for (var o, n = 1, i = arguments.length; n < i; n++) {
o = arguments[n];
for (var s in o) Object.prototype.hasOwnProperty.call(o, s) && (e[s] = o[s]);
}
return e;
}, yt.apply(this, arguments);
};
function ke(t, e) {
var o = {};
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (o[n] = t[n]);
if (t != null && typeof Object.getOwnPropertySymbols == "function")
for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++)
e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (o[n[i]] = t[n[i]]);
return o;
}
function We(t, e, o) {
if (o || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++)
(s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]);
return t.concat(s || Array.prototype.slice.call(e));
}
const Vt = ["top", "right", "bottom", "left"], X = Math.min, R = Math.max, nt = Math.round, et = Math.floor, W = (t) => ({
x: t,
y: t
}), jt = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, $t = {
start: "end",
end: "start"
};
function at(t, e, o) {
return R(t, X(e, o));
}
function V(t, e) {
return typeof t == "function" ? t(e) : t;
}
function j(t) {
return t.split("-")[0];
}
function J(t) {
return t.split("-")[1];
}
function mt(t) {
return t === "x" ? "y" : "x";
}
function ht(t) {
return t === "y" ? "height" : "width";
}
const zt = /* @__PURE__ */ new Set(["top", "bottom"]);
function k(t) {
return zt.has(j(t)) ? "y" : "x";
}
function gt(t) {
return mt(k(t));
}
function It(t, e, o) {
o === void 0 && (o = !1);
const n = J(t), i = gt(t), s = ht(i);
let r = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
return e.reference[s] > e.floating[s] && (r = ot(r)), [r, ot(r)];
}
function Xt(t) {
const e = ot(t);
return [ut(t), e, ut(e)];
}
function ut(t) {
return t.replace(/start|end/g, (e) => $t[e]);
}
const vt = ["left", "right"], bt = ["right", "left"], Yt = ["top", "bottom"], qt = ["bottom", "top"];
function Ut(t, e, o) {
switch (t) {
case "top":
case "bottom":
return o ? e ? bt : vt : e ? vt : bt;
case "left":
case "right":
return e ? Yt : qt;
default:
return [];
}
}
function Gt(t, e, o, n) {
const i = J(t);
let s = Ut(j(t), o === "start", n);
return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(ut)))), s;
}
function ot(t) {
return t.replace(/left|right|bottom|top/g, (e) => jt[e]);
}
function Kt(t) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...t
};
}
function Tt(t) {
return typeof t != "number" ? Kt(t) : {
top: t,
right: t,
bottom: t,
left: t
};
}
function it(t) {
const {
x: e,
y: o,
width: n,
height: i
} = t;
return {
width: n,
height: i,
top: o,
left: e,
right: e + n,
bottom: o + i,
x: e,
y: o
};
}
function Ot(t, e, o) {
let {
reference: n,
floating: i
} = t;
const s = k(e), r = gt(e), c = ht(r), l = j(e), a = s === "y", u = n.x + n.width / 2 - i.width / 2, d = n.y + n.height / 2 - i.height / 2, m = n[c] / 2 - i[c] / 2;
let f;
switch (l) {
case "top":
f = {
x: u,
y: n.y - i.height
};
break;
case "bottom":
f = {
x: u,
y: n.y + n.height
};
break;
case "right":
f = {
x: n.x + n.width,
y: d
};
break;
case "left":
f = {
x: n.x - i.width,
y: d
};
break;
default:
f = {
x: n.x,
y: n.y
};
}
switch (J(e)) {
case "start":
f[r] -= m * (o && a ? -1 : 1);
break;
case "end":
f[r] += m * (o && a ? -1 : 1);
break;
}
return f;
}
async function Jt(t, e) {
var o;
e === void 0 && (e = {});
const {
x: n,
y: i,
platform: s,
rects: r,
elements: c,
strategy: l
} = t, {
boundary: a = "clippingAncestors",
rootBoundary: u = "viewport",
elementContext: d = "floating",
altBoundary: m = !1,
padding: f = 0
} = V(e, t), h = Tt(f), w = c[m ? d === "floating" ? "reference" : "floating" : d], p = it(await s.getClippingRect({
element: (o = await (s.isElement == null ? void 0 : s.isElement(w))) == null || o ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
boundary: a,
rootBoundary: u,
strategy: l
})), y = d === "floating" ? {
x: n,
y: i,
width: r.floating.width,
height: r.floating.height
} : r.reference, x = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), v = await (s.isElement == null ? void 0 : s.isElement(x)) ? await (s.getScale == null ? void 0 : s.getScale(x)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, b = it(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: c,
rect: y,
offsetParent: x,
strategy: l
}) : y);
return {
top: (p.top - b.top + h.top) / v.y,
bottom: (b.bottom - p.bottom + h.bottom) / v.y,
left: (p.left - b.left + h.left) / v.x,
right: (b.right - p.right + h.right) / v.x
};
}
const Qt = async (t, e, o) => {
const {
placement: n = "bottom",
strategy: i = "absolute",
middleware: s = [],
platform: r
} = o, c = s.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(e));
let a = await r.getElementRects({
reference: t,
floating: e,
strategy: i
}), {
x: u,
y: d
} = Ot(a, n, l), m = n, f = {}, h = 0;
for (let w = 0; w < c.length; w++) {
var g;
const {
name: p,
fn: y
} = c[w], {
x,
y: v,
data: b,
reset: O
} = await y({
x: u,
y: d,
initialPlacement: n,
placement: m,
strategy: i,
middlewareData: f,
rects: a,
platform: {
...r,
detectOverflow: (g = r.detectOverflow) != null ? g : Jt
},
elements: {
reference: t,
floating: e
}
});
u = x ?? u, d = v ?? d, f = {
...f,
[p]: {
...f[p],
...b
}
}, O && h <= 50 && (h++, typeof O == "object" && (O.placement && (m = O.placement), O.rects && (a = O.rects === !0 ? await r.getElementRects({
reference: t,
floating: e,
strategy: i
}) : O.rects), {
x: u,
y: d
} = Ot(a, m, l)), w = -1);
}
return {
x: u,
y: d,
placement: m,
strategy: i,
middlewareData: f
};
}, Zt = (t) => ({
name: "arrow",
options: t,
async fn(e) {
const {
x: o,
y: n,
placement: i,
rects: s,
platform: r,
elements: c,
middlewareData: l
} = e, {
element: a,
padding: u = 0
} = V(t, e) || {};
if (a == null)
return {};
const d = Tt(u), m = {
x: o,
y: n
}, f = gt(i), h = ht(f), g = await r.getDimensions(a), w = f === "y", p = w ? "top" : "left", y = w ? "bottom" : "right", x = w ? "clientHeight" : "clientWidth", v = s.reference[h] + s.reference[f] - m[f] - s.floating[h], b = m[f] - s.reference[f], O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
let A = O ? O[x] : 0;
(!A || !await (r.isElement == null ? void 0 : r.isElement(O))) && (A = c.floating[x] || s.floating[h]);
const H = v / 2 - b / 2, M = A / 2 - g[h] / 2 - 1, E = X(d[p], M), $ = X(d[y], M), F = E, z = A - g[h] - $, S = A / 2 - g[h] / 2 + H, q = at(F, S, z), N = !l.arrow && J(i) != null && S !== q && s.reference[h] / 2 - (S < F ? E : $) - g[h] / 2 < 0, L = N ? S < F ? S - F : S - z : 0;
return {
[f]: m[f] + L,
data: {
[f]: q,
centerOffset: S - q - L,
...N && {
alignmentOffset: L
}
},
reset: N
};
}
}), te = function(t) {
return t === void 0 && (t = {}), {
name: "flip",
options: t,
async fn(e) {
var o, n;
const {
placement: i,
middlewareData: s,
rects: r,
initialPlacement: c,
platform: l,
elements: a
} = e, {
mainAxis: u = !0,
crossAxis: d = !0,
fallbackPlacements: m,
fallbackStrategy: f = "bestFit",
fallbackAxisSideDirection: h = "none",
flipAlignment: g = !0,
...w
} = V(t, e);
if ((o = s.arrow) != null && o.alignmentOffset)
return {};
const p = j(i), y = k(c), x = j(c) === c, v = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), b = m || (x || !g ? [ot(c)] : Xt(c)), O = h !== "none";
!m && O && b.push(...Gt(c, g, h, v));
const A = [c, ...b], H = await l.detectOverflow(e, w), M = [];
let E = ((n = s.flip) == null ? void 0 : n.overflows) || [];
if (u && M.push(H[p]), d) {
const S = It(i, r, v);
M.push(H[S[0]], H[S[1]]);
}
if (E = [...E, {
placement: i,
overflows: M
}], !M.every((S) => S <= 0)) {
var $, F;
const S = ((($ = s.flip) == null ? void 0 : $.index) || 0) + 1, q = A[S];
if (q && (!(d === "alignment" ? y !== k(q) : !1) || // We leave the current main axis only if every placement on that axis
// overflows the main axis.
E.every((T) => k(T.placement) === y ? T.overflows[0] > 0 : !0)))
return {
data: {
index: S,
overflows: E
},
reset: {
placement: q
}
};
let N = (F = E.filter((L) => L.overflows[0] <= 0).sort((L, T) => L.overflows[1] - T.overflows[1])[0]) == null ? void 0 : F.placement;
if (!N)
switch (f) {
case "bestFit": {
var z;
const L = (z = E.filter((T) => {
if (O) {
const I = k(T.placement);
return I === y || // Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
I === "y";
}
return !0;
}).map((T) => [T.placement, T.overflows.filter((I) => I > 0).reduce((I, Nt) => I + Nt, 0)]).sort((T, I) => T[1] - I[1])[0]) == null ? void 0 : z[0];
L && (N = L);
break;
}
case "initialPlacement":
N = c;
break;
}
if (i !== N)
return {
reset: {
placement: N
}
};
}
return {};
}
};
};
function At(t, e) {
return {
top: t.top - e.height,
right: t.right - e.width,
bottom: t.bottom - e.height,
left: t.left - e.width
};
}
function St(t) {
return Vt.some((e) => t[e] >= 0);
}
const ee = function(t) {
return t === void 0 && (t = {}), {
name: "hide",
options: t,
async fn(e) {
const {
rects: o,
platform: n
} = e, {
strategy: i = "referenceHidden",
...s
} = V(t, e);
switch (i) {
case "referenceHidden": {
const r = await n.detectOverflow(e, {
...s,
elementContext: "reference"
}), c = At(r, o.reference);
return {
data: {
referenceHiddenOffsets: c,
referenceHidden: St(c)
}
};
}
case "escaped": {
const r = await n.detectOverflow(e, {
...s,
altBoundary: !0
}), c = At(r, o.floating);
return {
data: {
escapedOffsets: c,
escaped: St(c)
}
};
}
default:
return {};
}
}
};
}, Pt = /* @__PURE__ */ new Set(["left", "top"]);
async function ne(t, e) {
const {
placement: o,
platform: n,
elements: i
} = t, s = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), r = j(o), c = J(o), l = k(o) === "y", a = Pt.has(r) ? -1 : 1, u = s && l ? -1 : 1, d = V(e, t);
let {
mainAxis: m,
crossAxis: f,
alignmentAxis: h
} = typeof d == "number" ? {
mainAxis: d,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: d.mainAxis || 0,
crossAxis: d.crossAxis || 0,
alignmentAxis: d.alignmentAxis
};
return c && typeof h == "number" && (f = c === "end" ? h * -1 : h), l ? {
x: f * u,
y: m * a
} : {
x: m * a,
y: f * u
};
}
const oe = function(t) {
return t === void 0 && (t = 0), {
name: "offset",
options: t,
async fn(e) {
var o, n;
const {
x: i,
y: s,
placement: r,
middlewareData: c
} = e, l = await ne(e, t);
return r === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
x: i + l.x,
y: s + l.y,
data: {
...l,
placement: r
}
};
}
};
}, ie = function(t) {
return t === void 0 && (t = {}), {
name: "shift",
options: t,
async fn(e) {
const {
x: o,
y: n,
placement: i,
platform: s
} = e, {
mainAxis: r = !0,
crossAxis: c = !1,
limiter: l = {
fn: (p) => {
let {
x: y,
y: x
} = p;
return {
x: y,
y: x
};
}
},
...a
} = V(t, e), u = {
x: o,
y: n
}, d = await s.detectOverflow(e, a), m = k(j(i)), f = mt(m);
let h = u[f], g = u[m];
if (r) {
const p = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", x = h + d[p], v = h - d[y];
h = at(x, h, v);
}
if (c) {
const p = m === "y" ? "top" : "left", y = m === "y" ? "bottom" : "right", x = g + d[p], v = g - d[y];
g = at(x, g, v);
}
const w = l.fn({
...e,
[f]: h,
[m]: g
});
return {
...w,
data: {
x: w.x - o,
y: w.y - n,
enabled: {
[f]: r,
[m]: c
}
}
};
}
};
}, se = function(t) {
return t === void 0 && (t = {}), {
options: t,
fn(e) {
const {
x: o,
y: n,
placement: i,
rects: s,
middlewareData: r
} = e, {
offset: c = 0,
mainAxis: l = !0,
crossAxis: a = !0
} = V(t, e), u = {
x: o,
y: n
}, d = k(i), m = mt(d);
let f = u[m], h = u[d];
const g = V(c, e), w = typeof g == "number" ? {
mainAxis: g,
crossAxis: 0
} : {
mainAxis: 0,
crossAxis: 0,
...g
};
if (l) {
const x = m === "y" ? "height" : "width", v = s.reference[m] - s.floating[x] + w.mainAxis, b = s.reference[m] + s.reference[x] - w.mainAxis;
f < v ? f = v : f > b && (f = b);
}
if (a) {
var p, y;
const x = m === "y" ? "width" : "height", v = Pt.has(j(i)), b = s.reference[d] - s.floating[x] + (v && ((p = r.offset) == null ? void 0 : p[d]) || 0) + (v ? 0 : w.crossAxis), O = s.reference[d] + s.reference[x] + (v ? 0 : ((y = r.offset) == null ? void 0 : y[d]) || 0) - (v ? w.crossAxis : 0);
h < b ? h = b : h > O && (h = O);
}
return {
[m]: f,
[d]: h
};
}
};
}, re = function(t) {
return t === void 0 && (t = {}), {
name: "size",
options: t,
async fn(e) {
var o, n;
const {
placement: i,
rects: s,
platform: r,
elements: c
} = e, {
apply: l = () => {
},
...a
} = V(t, e), u = await r.detectOverflow(e, a), d = j(i), m = J(i), f = k(i) === "y", {
width: h,
height: g
} = s.floating;
let w, p;
d === "top" || d === "bottom" ? (w = d, p = m === (await (r.isRTL == null ? void 0 : r.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (p = d, w = m === "end" ? "top" : "bottom");
const y = g - u.top - u.bottom, x = h - u.left - u.right, v = X(g - u[w], y), b = X(h - u[p], x), O = !e.middlewareData.shift;
let A = v, H = b;
if ((o = e.middlewareData.shift) != null && o.enabled.x && (H = x), (n = e.middlewareData.shift) != null && n.enabled.y && (A = y), O && !m) {
const E = R(u.left, 0), $ = R(u.right, 0), F = R(u.top, 0), z = R(u.bottom, 0);
f ? H = h - 2 * (E !== 0 || $ !== 0 ? E + $ : R(u.left, u.right)) : A = g - 2 * (F !== 0 || z !== 0 ? F + z : R(u.top, u.bottom));
}
await l({
...e,
availableWidth: H,
availableHeight: A
});
const M = await r.getDimensions(c.floating);
return h !== M.width || g !== M.height ? {
reset: {
rects: !0
}
} : {};
}
};
};
function st() {
return typeof window < "u";
}
function Q(t) {
return Dt(t) ? (t.nodeName || "").toLowerCase() : "#document";
}
function C(t) {
var e;
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
}
function B(t) {
var e;
return (e = (Dt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
}
function Dt(t) {
return st() ? t instanceof Node || t instanceof C(t).Node : !1;
}
function P(t) {
return st() ? t instanceof Element || t instanceof C(t).Element : !1;
}
function _(t) {
return st() ? t instanceof HTMLElement || t instanceof C(t).HTMLElement : !1;
}
function Rt(t) {
return !st() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof C(t).ShadowRoot;
}
const ce = /* @__PURE__ */ new Set(["inline", "contents"]);
function tt(t) {
const {
overflow: e,
overflowX: o,
overflowY: n,
display: i
} = D(t);
return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !ce.has(i);
}
const le = /* @__PURE__ */ new Set(["table", "td", "th"]);
function fe(t) {
return le.has(Q(t));
}
const ae = [":popover-open", ":modal"];
function rt(t) {
return ae.some((e) => {
try {
return t.matches(e);
} catch {
return !1;
}
});
}
const ue = ["transform", "translate", "scale", "rotate", "perspective"], de = ["transform", "translate", "scale", "rotate", "perspective", "filter"], me = ["paint", "layout", "strict", "content"];
function pt(t) {
const e = wt(), o = P(t) ? D(t) : t;
return ue.some((n) => o[n] ? o[n] !== "none" : !1) || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || de.some((n) => (o.willChange || "").includes(n)) || me.some((n) => (o.contain || "").includes(n));
}
function he(t) {
let e = Y(t);
for (; _(e) && !K(e); ) {
if (pt(e))
return e;
if (rt(e))
return null;
e = Y(e);
}
return null;
}
function wt() {
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
const ge = /* @__PURE__ */ new Set(["html", "body", "#document"]);
function K(t) {
return ge.has(Q(t));
}
function D(t) {
return C(t).getComputedStyle(t);
}
function ct(t) {
return P(t) ? {
scrollLeft: t.scrollLeft,
scrollTop: t.scrollTop
} : {
scrollLeft: t.scrollX,
scrollTop: t.scrollY
};
}
function Y(t) {
if (Q(t) === "html")
return t;
const e = (
// Step into the shadow DOM of the parent of a slotted node.
t.assignedSlot || // DOM Element detected.
t.parentNode || // ShadowRoot detected.
Rt(t) && t.host || // Fallback.
B(t)
);
return Rt(e) ? e.host : e;
}
function Mt(t) {
const e = Y(t);
return K(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : _(e) && tt(e) ? e : Mt(e);
}
function Z(t, e, o) {
var n;
e === void 0 && (e = []), o === void 0 && (o = !0);
const i = Mt(t), s = i === ((n = t.ownerDocument) == null ? void 0 : n.body), r = C(i);
if (s) {
const c = dt(r);
return e.concat(r, r.visualViewport || [], tt(i) ? i : [], c && o ? Z(c) : []);
}
return e.concat(i, Z(i, [], o));
}
function dt(t) {
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
}
function Ft(t) {
const e = D(t);
let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
const i = _(t), s = i ? t.offsetWidth : o, r = i ? t.offsetHeight : n, c = nt(o) !== s || nt(n) !== r;
return c && (o = s, n = r), {
width: o,
height: n,
$: c
};
}
function xt(t) {
return P(t) ? t : t.contextElement;
}
function G(t) {
const e = xt(t);
if (!_(e))
return W(1);
const o = e.getBoundingClientRect(), {
width: n,
height: i,
$: s
} = Ft(e);
let r = (s ? nt(o.width) : o.width) / n, c = (s ? nt(o.height) : o.height) / i;
return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
x: r,
y: c
};
}
const pe = /* @__PURE__ */ W(0);
function kt(t) {
const e = C(t);
return !wt() || !e.visualViewport ? pe : {
x: e.visualViewport.offsetLeft,
y: e.visualViewport.offsetTop
};
}
function we(t, e, o) {
return e === void 0 && (e = !1), !o || e && o !== C(t) ? !1 : e;
}
function U(t, e, o, n) {
e === void 0 && (e = !1), o === void 0 && (o = !1);
const i = t.getBoundingClientRect(), s = xt(t);
let r = W(1);
e && (n ? P(n) && (r = G(n)) : r = G(t));
const c = we(s, o, n) ? kt(s) : W(0);
let l = (i.left + c.x) / r.x, a = (i.top + c.y) / r.y, u = i.width / r.x, d = i.height / r.y;
if (s) {
const m = C(s), f = n && P(n) ? C(n) : n;
let h = m, g = dt(h);
for (; g && n && f !== h; ) {
const w = G(g), p = g.getBoundingClientRect(), y = D(g), x = p.left + (g.clientLeft + parseFloat(y.paddingLeft)) * w.x, v = p.top + (g.clientTop + parseFloat(y.paddingTop)) * w.y;
l *= w.x, a *= w.y, u *= w.x, d *= w.y, l += x, a += v, h = C(g), g = dt(h);
}
}
return it({
width: u,
height: d,
x: l,
y: a
});
}
function lt(t, e) {
const o = ct(t).scrollLeft;
return e ? e.left + o : U(B(t)).left + o;
}
function Wt(t, e) {
const o = t.getBoundingClientRect(), n = o.left + e.scrollLeft - lt(t, o), i = o.top + e.scrollTop;
return {
x: n,
y: i
};
}
function xe(t) {
let {
elements: e,
rect: o,
offsetParent: n,
strategy: i
} = t;
const s = i === "fixed", r = B(n), c = e ? rt(e.floating) : !1;
if (n === r || c && s)
return o;
let l = {
scrollLeft: 0,
scrollTop: 0
}, a = W(1);
const u = W(0), d = _(n);
if ((d || !d && !s) && ((Q(n) !== "body" || tt(r)) && (l = ct(n)), _(n))) {
const f = U(n);
a = G(n), u.x = f.x + n.clientLeft, u.y = f.y + n.clientTop;
}
const m = r && !d && !s ? Wt(r, l) : W(0);
return {
width: o.width * a.x,
height: o.height * a.y,
x: o.x * a.x - l.scrollLeft * a.x + u.x + m.x,
y: o.y * a.y - l.scrollTop * a.y + u.y + m.y
};
}
function ye(t) {
return Array.from(t.getClientRects());
}
function ve(t) {
const e = B(t), o = ct(t), n = t.ownerDocument.body, i = R(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = R(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
let r = -o.scrollLeft + lt(t);
const c = -o.scrollTop;
return D(n).direction === "rtl" && (r += R(e.clientWidth, n.clientWidth) - i), {
width: i,
height: s,
x: r,
y: c
};
}
const Ct = 25;
function be(t, e) {
const o = C(t), n = B(t), i = o.visualViewport;
let s = n.clientWidth, r = n.clientHeight, c = 0, l = 0;
if (i) {
s = i.width, r = i.height;
const u = wt();
(!u || u && e === "fixed") && (c = i.offsetLeft, l = i.offsetTop);
}
const a = lt(n);
if (a <= 0) {
const u = n.ownerDocument, d = u.body, m = getComputedStyle(d), f = u.compatMode === "CSS1Compat" && parseFloat(m.marginLeft) + parseFloat(m.marginRight) || 0, h = Math.abs(n.clientWidth - d.clientWidth - f);
h <= Ct && (s -= h);
} else a <= Ct && (s += a);
return {
width: s,
height: r,
x: c,
y: l
};
}
const Oe = /* @__PURE__ */ new Set(["absolute", "fixed"]);
function Ae(t, e) {
const o = U(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, s = _(t) ? G(t) : W(1), r = t.clientWidth * s.x, c = t.clientHeight * s.y, l = i * s.x, a = n * s.y;
return {
width: r,
height: c,
x: l,
y: a
};
}
function Et(t, e, o) {
let n;
if (e === "viewport")
n = be(t, o);
else if (e === "document")
n = ve(B(t));
else if (P(e))
n = Ae(e, o);
else {
const i = kt(t);
n = {
x: e.x - i.x,
y: e.y - i.y,
width: e.width,
height: e.height
};
}
return it(n);
}
function _t(t, e) {
const o = Y(t);
return o === e || !P(o) || K(o) ? !1 : D(o).position === "fixed" || _t(o, e);
}
function Se(t, e) {
const o = e.get(t);
if (o)
return o;
let n = Z(t, [], !1).filter((c) => P(c) && Q(c) !== "body"), i = null;
const s = D(t).position === "fixed";
let r = s ? Y(t) : t;
for (; P(r) && !K(r); ) {
const c = D(r), l = pt(r);
!l && c.position === "fixed" && (i = null), (s ? !l && !i : !l && c.position === "static" && !!i && Oe.has(i.position) || tt(r) && !l && _t(t, r)) ? n = n.filter((u) => u !== r) : i = c, r = Y(r);
}
return e.set(t, n), n;
}
function Re(t) {
let {
element: e,
boundary: o,
rootBoundary: n,
strategy: i
} = t;
const r = [...o === "clippingAncestors" ? rt(e) ? [] : Se(e, this._c) : [].concat(o), n], c = r[0], l = r.reduce((a, u) => {
const d = Et(e, u, i);
return a.top = R(d.top, a.top), a.right = X(d.right, a.right), a.bottom = X(d.bottom, a.bottom), a.left = R(d.left, a.left), a;
}, Et(e, c, i));
return {
width: l.right - l.left,
height: l.bottom - l.top,
x: l.left,
y: l.top
};
}
function Ce(t) {
const {
width: e,
height: o
} = Ft(t);
return {
width: e,
height: o
};
}
function Ee(t, e, o) {
const n = _(e), i = B(e), s = o === "fixed", r = U(t, !0, s, e);
let c = {
scrollLeft: 0,
scrollTop: 0
};
const l = W(0);
function a() {
l.x = lt(i);
}
if (n || !n && !s)
if ((Q(e) !== "body" || tt(i)) && (c = ct(e)), n) {
const f = U(e, !0, s, e);
l.x = f.x + e.clientLeft, l.y = f.y + e.clientTop;
} else i && a();
s && !n && i && a();
const u = i && !n && !s ? Wt(i, c) : W(0), d = r.left + c.scrollLeft - l.x - u.x, m = r.top + c.scrollTop - l.y - u.y;
return {
x: d,
y: m,
width: r.width,
height: r.height
};
}
function ft(t) {
return D(t).position === "static";
}
function Lt(t, e) {
if (!_(t) || D(t).position === "fixed")
return null;
if (e)
return e(t);
let o = t.offsetParent;
return B(t) === o && (o = o.ownerDocument.body), o;
}
function Bt(t, e) {
const o = C(t);
if (rt(t))
return o;
if (!_(t)) {
let i = Y(t);
for (; i && !K(i); ) {
if (P(i) && !ft(i))
return i;
i = Y(i);
}
return o;
}
let n = Lt(t, e);
for (; n && fe(n) && ft(n); )
n = Lt(n, e);
return n && K(n) && ft(n) && !pt(n) ? o : n || he(t) || o;
}
const Le = async function(t) {
const e = this.getOffsetParent || Bt, o = this.getDimensions, n = await o(t.floating);
return {
reference: Ee(t.reference, await e(t.floating), t.strategy),
floating: {
x: 0,
y: 0,
width: n.width,
height: n.height
}
};
};
function Te(t) {
return D(t).direction === "rtl";
}
const Pe = {
convertOffsetParentRelativeRectToViewportRelativeRect: xe,
getDocumentElement: B,
getClippingRect: Re,
getOffsetParent: Bt,
getElementRects: Le,
getClientRects: ye,
getDimensions: Ce,
getScale: G,
isElement: P,
isRTL: Te
};
function Ht(t, e) {
return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
}
function De(t, e) {
let o = null, n;
const i = B(t);
function s() {
var c;
clearTimeout(n), (c = o) == null || c.disconnect(), o = null;
}
function r(c, l) {
c === void 0 && (c = !1), l === void 0 && (l = 1), s();
const a = t.getBoundingClientRect(), {
left: u,
top: d,
width: m,
height: f
} = a;
if (c || e(), !m || !f)
return;
const h = et(d), g = et(i.clientWidth - (u + m)), w = et(i.clientHeight - (d + f)), p = et(u), x = {
rootMargin: -h + "px " + -g + "px " + -w + "px " + -p + "px",
threshold: R(0, X(1, l)) || 1
};
let v = !0;
function b(O) {
const A = O[0].intersectionRatio;
if (A !== l) {
if (!v)
return r();
A ? r(!1, A) : n = setTimeout(() => {
r(!1, 1e-7);
}, 1e3);
}
A === 1 && !Ht(a, t.getBoundingClientRect()) && r(), v = !1;
}
try {
o = new IntersectionObserver(b, {
...x,
// Handle <iframe>s
root: i.ownerDocument
});
} catch {
o = new IntersectionObserver(b, x);
}
o.observe(t);
}
return r(!0), s;
}
function _e(t, e, o, n) {
n === void 0 && (n = {});
const {
ancestorScroll: i = !0,
ancestorResize: s = !0,
elementResize: r = typeof ResizeObserver == "function",
layoutShift: c = typeof IntersectionObserver == "function",
animationFrame: l = !1
} = n, a = xt(t), u = i || s ? [...a ? Z(a) : [], ...Z(e)] : [];
u.forEach((p) => {
i && p.addEventListener("scroll", o, {
passive: !0
}), s && p.addEventListener("resize", o);
});
const d = a && c ? De(a, o) : null;
let m = -1, f = null;
r && (f = new ResizeObserver((p) => {
let [y] = p;
y && y.target === a && f && (f.unobserve(e), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
var x;
(x = f) == null || x.observe(e);
})), o();
}), a && !l && f.observe(a), f.observe(e));
let h, g = l ? U(t) : null;
l && w();
function w() {
const p = U(t);
g && !Ht(g, p) && o(), g = p, h = requestAnimationFrame(w);
}
return o(), () => {
var p;
u.forEach((y) => {
i && y.removeEventListener("scroll", o), s && y.removeEventListener("resize", o);
}), d?.(), (p = f) == null || p.disconnect(), f = null, l && cancelAnimationFrame(h);
};
}
const Be = oe, He = ie, Ne = te, Ve = re, je = ee, $e = Zt, ze = se, Ie = (t, e, o) => {
const n = /* @__PURE__ */ new Map(), i = {
platform: Pe,
...o
}, s = {
...i.platform,
_c: n
};
return Qt(t, e, {
...i,
platform: s
});
};
export {
We as _,
yt as a,
_e as b,
Me as c,
ke as d,
Ie as e,
Ne as f,
Fe as g,
Ve as h,
je as i,
$e as j,
ze as l,
Be as o,
He as s
};