@nkduy/mc-easy-tooltips 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,529 @@
1
+ {
2
+ let ge = function(h) {
3
+ h.style.width = "";
4
+ const z = h.getBoundingClientRect(), I = Math.round(z.height);
5
+ if (z.width <= 0 || I <= 0)
6
+ return;
7
+ const lt = Math.ceil(z.width);
8
+ h.style.maxWidth = "none", h.style.width = "max-content";
9
+ const V = Math.ceil(h.getBoundingClientRect().width);
10
+ if (h.style.maxWidth = "", V <= lt) {
11
+ h.style.width = "";
12
+ return;
13
+ }
14
+ h.style.minWidth = "0", h.style.width = "min-content";
15
+ const W = h.getBoundingClientRect(), F = Math.ceil(W.width), $ = Math.round(W.height) <= I;
16
+ if (h.style.minWidth = "", $) {
17
+ h.style.width = `${F}px`;
18
+ return;
19
+ }
20
+ let A = F + 1, Q = lt + 1, S = lt;
21
+ for (; A <= Q; ) {
22
+ const L = Math.floor((A + Q) / 2);
23
+ h.style.width = `${L}px`, Math.round(h.getBoundingClientRect().height) <= I ? (S = L, Q = L - 1) : A = L + 1;
24
+ }
25
+ h.style.width = `${S}px`;
26
+ }, Zt = function() {
27
+ const h = document.createElement("div");
28
+ h.id = "easy-tooltips", document.body.append(h);
29
+ const z = !!h.showPopover;
30
+ function I() {
31
+ if (!(!z || h.matches(":popover-open")))
32
+ try {
33
+ h.showPopover();
34
+ } catch {
35
+ }
36
+ }
37
+ function lt() {
38
+ if (z) {
39
+ try {
40
+ h.matches(":popover-open") && h.hidePopover();
41
+ } catch {
42
+ }
43
+ I();
44
+ }
45
+ }
46
+ z && (h.popover = "manual", I(), h.addEventListener("toggle", (t) => {
47
+ t.newState === "closed" && requestAnimationFrame(I);
48
+ }));
49
+ let V, W, F, $, A, Q, S, L, St, Ct, ct, Ot = 0, gt = 0, ye = 0;
50
+ const _e = 100, ve = "input, select, textarea, button, [role=button], [role=slider], [role=checkbox], [role=radio], [role=switch]";
51
+ let B;
52
+ function Ut(t) {
53
+ lt(), t._activated = !0, oe(t);
54
+ const e = t._trigger;
55
+ if (e && $ !== void 0) {
56
+ const { pin: a, entry: d } = te(e);
57
+ (a || d) && (Jt(e, a, d), N());
58
+ }
59
+ Ot++, clearTimeout(Ct), h.classList.add("easy-tooltips-active"), t.style.zIndex = String(++ye), $e();
60
+ }
61
+ function Kt(t) {
62
+ t._activated && (t._activated = !1, oe(t), --Ot <= 0 && (Ot = 0, clearTimeout(Ct), Ct = setTimeout(
63
+ () => h.classList.remove("easy-tooltips-active"),
64
+ bt(getComputedStyle(document.documentElement).getPropertyValue("--easy-tooltip-cooldown"))
65
+ )));
66
+ }
67
+ const et = /* @__PURE__ */ new Set();
68
+ function be(t) {
69
+ var a, d;
70
+ const e = t._tooltip;
71
+ e && (clearTimeout(e._moveTimer), t === B && (B = void 0), e._dispatched && (e._dispatched = !1, vt(e, "close")), e.classList.contains("easy-tooltip-visible") && gt--, clearTimeout(e._timeout), clearTimeout(e._activateTimer), Kt(e), e.remove()), (a = t._observer) == null || a.disconnect(), (d = t._sourceObserver) == null || d.disconnect(), t._observer = t._sourceObserver = void 0, et.delete(t), t._tooltip = t._tooltipText = t._svgPath = t._clipPath = t._foreignObj = t._surfaceDiv = t._borderMask = t._borderMaskPath = t._borderForeignObj = t._borderSurfaceDiv = t._tooltipClass = t._source = t._anchorPoint = t._anchorSide = void 0, t === V && (V = void 0);
72
+ }
73
+ let kt;
74
+ new MutationObserver((t) => {
75
+ kt || !t.some((e) => e.removedNodes.length) || (kt = !0, queueMicrotask(() => {
76
+ kt = !1;
77
+ for (const e of et)
78
+ e.isConnected || be(e);
79
+ }));
80
+ }).observe(document.body, { childList: !0, subtree: !0 });
81
+ let yt;
82
+ function Gt() {
83
+ if (yt = 0, F && $ !== void 0) {
84
+ const t = document.elementFromPoint($, A);
85
+ for (const e of et) {
86
+ const a = e._tooltip;
87
+ a && !a._held && a.classList.contains("easy-tooltip-visible") && e !== t && !e.contains(t) && k(a, !1);
88
+ }
89
+ }
90
+ gt > 0 && (yt = requestAnimationFrame(Gt));
91
+ }
92
+ function $e() {
93
+ yt || (yt = requestAnimationFrame(Gt));
94
+ }
95
+ function _t(t) {
96
+ return t != null && t.endsWith("-x") ? "x" : t != null && t.endsWith("-y") ? "y" : "both";
97
+ }
98
+ function Vt(t) {
99
+ return t == null ? void 0 : t.replace(/-[xy]$/, "");
100
+ }
101
+ function Ft(t, e) {
102
+ S = $, L = A, $ = t, A = e;
103
+ }
104
+ function we(t) {
105
+ if (S === void 0)
106
+ return;
107
+ const e = $ - S, a = A - L;
108
+ let d, c = 1 / 0;
109
+ const g = (T, f, w, R, C) => {
110
+ f < 0 || f > 1 || f >= c || w < R || w > C || (c = f, d = T);
111
+ };
112
+ return e > 0 && S < t.left && g("left", (t.left - S) / e, L + a * ((t.left - S) / e), t.top, t.bottom), e < 0 && S > t.right && g("right", (t.right - S) / e, L + a * ((t.right - S) / e), t.top, t.bottom), a > 0 && L < t.top && g("above", (t.top - L) / a, S + e * ((t.top - L) / a), t.left, t.right), a < 0 && L > t.bottom && g("below", (t.bottom - L) / a, S + e * ((t.bottom - L) / a), t.left, t.right), d;
113
+ }
114
+ function Jt(t, e, a) {
115
+ const d = _t(t.dataset.easyTooltipAnchor);
116
+ if ((a || e && d === "both") && t._anchorSide === void 0) {
117
+ const f = t.getBoundingClientRect(), w = {
118
+ left: $ - f.left,
119
+ right: f.right - $,
120
+ above: A - f.top,
121
+ below: f.bottom - A
122
+ };
123
+ t._anchorSide = we(f) ?? Object.keys(w).reduce((R, C) => w[C] < w[R] ? C : R);
124
+ }
125
+ if (!e)
126
+ return;
127
+ let c = $, g = A;
128
+ const T = t._anchorSide;
129
+ if (T && d === "both") {
130
+ const f = t.getBoundingClientRect(), w = (R, C, Z) => Math.min(Math.max(R, C), Z);
131
+ c = T === "left" ? f.left : T === "right" ? f.right : w($, f.left, f.right), g = T === "above" ? f.top : T === "below" ? f.bottom : w(A, f.top, f.bottom);
132
+ }
133
+ t._anchorPoint = { x: c + window.scrollX, y: g + window.scrollY };
134
+ }
135
+ function te(t) {
136
+ const e = t.dataset.easyTooltipPrefer, a = Vt(t.dataset.easyTooltipAnchor) === "pin" && W, d = a && _t(t.dataset.easyTooltipAnchor) === "both";
137
+ return { preferAttr: e, pin: a, entry: W && (e === "entry" || !e && d) };
138
+ }
139
+ function ee(t) {
140
+ return {
141
+ x: t.left,
142
+ y: t.top,
143
+ width: t.width,
144
+ height: t.height,
145
+ top: t.top,
146
+ right: t.right,
147
+ bottom: t.bottom,
148
+ left: t.left
149
+ };
150
+ }
151
+ function vt(t, e, a) {
152
+ var g;
153
+ const d = t._trigger;
154
+ if (!d)
155
+ return;
156
+ const c = t._placement;
157
+ c && (t._reported = c), d.dispatchEvent(new CustomEvent(`easy-tooltip-${e}`, {
158
+ bubbles: !0,
159
+ composed: !0,
160
+ detail: {
161
+ trigger: d,
162
+ tooltip: t,
163
+ text: ((g = d._tooltipText) == null ? void 0 : g.textContent) ?? "",
164
+ side: c == null ? void 0 : c.side,
165
+ inside: (c == null ? void 0 : c.inside) ?? !1,
166
+ anchor: (c == null ? void 0 : c.anchor) ?? "element",
167
+ anchorRect: c == null ? void 0 : c.anchorRect,
168
+ point: c == null ? void 0 : c.point,
169
+ rect: ee(t.getBoundingClientRect()),
170
+ previous: a
171
+ }
172
+ }));
173
+ }
174
+ function Pe(t) {
175
+ const e = t._reported, a = t._placement;
176
+ if (!e || !a)
177
+ return;
178
+ const d = e.side !== a.side || e.inside !== a.inside || e.anchor !== a.anchor;
179
+ if (!d && e.point.x === a.point.x && e.point.y === a.point.y)
180
+ return;
181
+ const c = performance.now(), g = d ? 0 : _e - (c - (t._moveAt ?? 0));
182
+ if (g <= 0) {
183
+ clearTimeout(t._moveTimer), t._moveTimer = void 0, t._moveAt = c, vt(t, "move", e);
184
+ return;
185
+ }
186
+ t._moveTimer || (t._moveTimer = setTimeout(() => {
187
+ t._moveTimer = void 0, !(!t._dispatched || !t._reported || !t._placement) && (t._moveAt = performance.now(), vt(t, "move", t._reported));
188
+ }, g));
189
+ }
190
+ function oe(t) {
191
+ t._dispatchQueued || (t._dispatchQueued = !0, queueMicrotask(() => {
192
+ t._dispatchQueued = !1;
193
+ const e = !!t._activated;
194
+ e !== !!t._dispatched && (t._dispatched = e, clearTimeout(t._moveTimer), t._moveTimer = void 0, t._moveAt = e ? performance.now() : void 0, vt(t, e ? "open" : "close"));
195
+ }));
196
+ }
197
+ function bt(t) {
198
+ t = t.trim();
199
+ const e = parseFloat(t);
200
+ return t.endsWith("ms") ? e : e * 1e3;
201
+ }
202
+ function k(t, e) {
203
+ const a = getComputedStyle(t), d = bt(a.getPropertyValue("--easy-tooltip-animation-length"));
204
+ if (e) {
205
+ const c = bt(a.getPropertyValue("--easy-tooltip-delay")) + bt(a.getPropertyValue("--easy-tooltip-inactive-delay"));
206
+ c && (t._start = performance.now(), t._delay = c), t._animation_duration = d + c;
207
+ } else {
208
+ if (t._delay && performance.now() < Number(t._start) + t._delay) {
209
+ t.classList.contains("easy-tooltip-visible") && gt--, t.classList.remove("easy-tooltip-visible"), t._trigger && (t._trigger._anchorSide = t._trigger._anchorPoint = void 0), clearTimeout(t._timeout), clearTimeout(t._activateTimer), t._timeout = t._activateTimer = t._start = t._delay = void 0;
210
+ return;
211
+ }
212
+ t._animation_duration = d;
213
+ }
214
+ if (t.classList.contains("easy-tooltip-visible") === e) {
215
+ t._next = void 0;
216
+ return;
217
+ }
218
+ t._timeout === void 0 ? (t._next = void 0, t.classList.toggle("easy-tooltip-visible", e), e && (t._hold = t._clampArmed = void 0), !e && t._trigger && (t._trigger._anchorSide = t._trigger._anchorPoint = void 0), gt += e ? 1 : -1, clearTimeout(t._activateTimer), t._activateTimer = void 0, e ? t._delay ? t._activateTimer = setTimeout(() => {
219
+ t._activateTimer = void 0, Ut(t);
220
+ }, t._delay) : Ut(t) : Kt(t), t._timeout = setTimeout(() => {
221
+ t._timeout = void 0, t._next !== void 0 && k(t, t._next);
222
+ }, t._animation_duration)) : t._next = e;
223
+ }
224
+ function ie(t) {
225
+ return t.transform !== "none" || t.translate !== "none" || t.rotate !== "none" || t.scale !== "none" || t.perspective !== "none" || t.filter !== "none" || t.backdropFilter !== "none" || /paint|layout|strict|content/.test(t.contain) || /transform|translate|rotate|scale|perspective|filter/.test(t.willChange);
226
+ }
227
+ function Ae(t) {
228
+ const e = t.getBoundingClientRect();
229
+ let a = e.left, d = e.top, c = e.right, g = e.bottom, T = getComputedStyle(t).position, f = t.parentElement;
230
+ for (; f && f !== document.body; ) {
231
+ const w = getComputedStyle(f);
232
+ if (T === "fixed" ? ie(w) : T === "absolute" ? w.position !== "static" || ie(w) : !0) {
233
+ const C = w.overflowX !== "visible", Z = w.overflowY !== "visible";
234
+ if (C || Z) {
235
+ const U = f.getBoundingClientRect();
236
+ C && (a = Math.max(a, U.left), c = Math.min(c, U.right)), Z && (d = Math.max(d, U.top), g = Math.min(g, U.bottom));
237
+ }
238
+ T = w.position;
239
+ }
240
+ f = f.parentElement;
241
+ }
242
+ return { x: a, y: d, left: a, top: d, right: c, bottom: g, width: c - a, height: g - d };
243
+ }
244
+ function se() {
245
+ var t, e, a, d, c, g, T, f, w, R, C, Z, U, ce;
246
+ if (Q = !1, V) {
247
+ const K = h.getBoundingClientRect();
248
+ h.style.setProperty("--easy-tooltip-view-width", ((visualViewport == null ? void 0 : visualViewport.width) ?? document.documentElement.clientWidth) + "px");
249
+ const ut = [];
250
+ let u = V;
251
+ for (; u && u !== document.body; ) {
252
+ if (ut.length)
253
+ u._tooltip && !u._tooltip._held && k(u._tooltip, !1);
254
+ else if (u._dismissed)
255
+ u._tooltip && k(u._tooltip, !1);
256
+ else if (u.dataset.easyTooltip)
257
+ (t = u._sourceObserver) == null || t.disconnect(), u._sourceObserver = u._source = void 0, ut.push(u);
258
+ else if (u.dataset.easyTooltipSrc) {
259
+ const G = u.dataset.easyTooltipSrc, wt = u._source;
260
+ if (G === "next")
261
+ u._source = u.nextElementSibling ?? void 0;
262
+ else if (G === "prev")
263
+ u._source = u.previousElementSibling ?? void 0;
264
+ else
265
+ try {
266
+ u._source = (document.getElementById(G) || document.querySelector(G)) ?? void 0;
267
+ } catch {
268
+ }
269
+ wt !== u._source && u._sourceObserver && (u._sourceObserver.disconnect(), u._sourceObserver = void 0), u._source ? ut.push(u) : u._tooltip && !u._tooltip._held && k(u._tooltip, !1);
270
+ } else
271
+ u._tooltip && !u._tooltip._held && k(u._tooltip, !1);
272
+ u = u.parentElement;
273
+ }
274
+ for (let G = ut.length; G--; ) {
275
+ let wt = function(n, r, l, i, E, y, x) {
276
+ const P = l / 2 - Y / 2 - y - Dt, b = i + H, M = i + E - H;
277
+ let p = 0, D = 0;
278
+ return n < b ? (p = Math.min(b - n, P), n + p < b && (D = b - (n + p))) : r > M && (p = -Math.min(r - M, P), r + p > M && (D = -(r + p - M))), p && v !== void 0 && (v.style.translate = x ? `0 ${p}px` : `${p}px`), qt = D, p;
279
+ }, Te = function(n, r, l, i, E, y, x, P, b) {
280
+ const M = E / 2, p = b * Math.SQRT1_2;
281
+ if (n === "above") {
282
+ const q = b > 0 ? `L${x + p} ${l + y - p}A${b} ${b} 0 0 1 ${x - p} ${l + y - p}` : `L${x} ${l + y}`;
283
+ return `M${i} 0H${r - i}A${i} ${i} 0 0 1 ${r} ${i}V${l - i}A${i} ${i} 0 0 1 ${r - i} ${l}H${x + M}${q}L${x - M} ${l}H${i}A${i} ${i} 0 0 1 0 ${l - i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`;
284
+ }
285
+ if (n === "below") {
286
+ const q = b > 0 ? `L${x - p} ${-y + p}A${b} ${b} 0 0 1 ${x + p} ${-y + p}` : `L${x} ${-y}`;
287
+ return `M${i} 0H${x - M}${q}L${x + M} 0H${r - i}A${i} ${i} 0 0 1 ${r} ${i}V${l - i}A${i} ${i} 0 0 1 ${r - i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l - i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`;
288
+ }
289
+ if (n === "right") {
290
+ const q = b > 0 ? `L${-y + p} ${P + p}A${b} ${b} 0 0 1 ${-y + p} ${P - p}` : `L${-y} ${P}`;
291
+ return `M${i} 0H${r - i}A${i} ${i} 0 0 1 ${r} ${i}V${l - i}A${i} ${i} 0 0 1 ${r - i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l - i}V${P + M}${q}L0 ${P - M}V${i}A${i} ${i} 0 0 1 ${i} 0Z`;
292
+ }
293
+ const D = b > 0 ? `L${r + y - p} ${P - p}A${b} ${b} 0 0 1 ${r + y - p} ${P + p}` : `L${r + y} ${P}`;
294
+ return `M${i} 0H${r - i}A${i} ${i} 0 0 1 ${r} ${i}V${P - M}${D}L${r} ${P + M}V${l - i}A${i} ${i} 0 0 1 ${r - i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l - i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`;
295
+ };
296
+ const o = ut[G];
297
+ let s = o._tooltip, v = o._tooltipText;
298
+ if (!s || !v) {
299
+ s = document.createElement("div"), s.className = "easy-tooltip easy-tooltip-setup", s._trigger = o, o._tooltip = s;
300
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
301
+ n.classList.add("easy-tooltip-bg"), n.setAttribute("aria-hidden", "true");
302
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "defs"), l = document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), i = "easy-tooltip-clip-" + Math.random().toString(36).substring(2, 9);
303
+ l.id = i;
304
+ const E = document.createElementNS("http://www.w3.org/2000/svg", "path");
305
+ l.append(E), r.append(l), o._clipPath = E;
306
+ const y = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
307
+ y.setAttribute("clip-path", `url(#${i})`);
308
+ const x = document.createElement("div");
309
+ x.className = "easy-tooltip-surface", y.append(x), o._foreignObj = y, o._surfaceDiv = x;
310
+ const P = document.createElementNS("http://www.w3.org/2000/svg", "mask"), b = "easy-tooltip-mask-" + Math.random().toString(36).substring(2, 9);
311
+ P.id = b, P.setAttribute("maskUnits", "userSpaceOnUse");
312
+ const M = document.createElementNS("http://www.w3.org/2000/svg", "path");
313
+ P.append(M), r.append(P), o._borderMask = P, o._borderMaskPath = M;
314
+ const p = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
315
+ p.setAttribute("mask", `url(#${b})`);
316
+ const D = document.createElement("div");
317
+ D.className = "easy-tooltip-surface", p.append(D), o._borderForeignObj = p, o._borderSurfaceDiv = D;
318
+ const q = document.createElementNS("http://www.w3.org/2000/svg", "path");
319
+ o._svgPath = q, n.append(r, y, q, p), v = document.createElement("div"), v.className = "easy-tooltip-text", o._tooltipText = v, s.append(n, v), h.append(s);
320
+ }
321
+ const de = s.style.zIndex;
322
+ s.style.cssText = o.dataset.easyTooltipStyle ?? "", de && (s.style.zIndex = de);
323
+ const Pt = o.dataset.easyTooltipClass;
324
+ o._tooltipClass !== Pt && (o._tooltipClass && s.classList.remove(...o._tooltipClass.trim().split(/\s+/)), Pt && s.classList.add(...Pt.trim().split(/\s+/)), o._tooltipClass = Pt), o._source ? (v.replaceChildren(...o._source.cloneNode(!0).childNodes), v.classList.add("easy-tooltip-text-html")) : (v.textContent = o.dataset.easyTooltip ?? null, v.classList.remove("easy-tooltip-text-html"));
325
+ const At = o.dataset.easyTooltipAnchor, J = _t(At), ft = Vt(At) === "cursor" && W, { preferAttr: xe, pin: Tt, entry: jt } = te(o);
326
+ ft && (Q = !0);
327
+ const Me = (n, r, l) => Math.min(Math.max(n, r), l), Le = (n, r) => At ? r : ((!s._hold || s._hold.axis !== n) && (s._hold = { axis: n, pos: r }), s._hold.pos);
328
+ (Tt || jt) && !s._activated && o._anchorSide === void 0 && o._anchorPoint === void 0 && Jt(o, Tt, jt);
329
+ let m;
330
+ if (ft || Tt && o._anchorPoint) {
331
+ const n = ft ? $ : o._anchorPoint.x - window.scrollX, r = ft ? A : o._anchorPoint.y - window.scrollY, l = J === "both" ? null : o.getBoundingClientRect();
332
+ m = {
333
+ left: J === "y" ? l.left : n,
334
+ right: J === "y" ? l.right : n,
335
+ width: J === "y" ? l.width : 0,
336
+ top: J === "x" ? l.top : r,
337
+ bottom: J === "x" ? l.bottom : r,
338
+ height: J === "x" ? l.height : 0
339
+ };
340
+ } else
341
+ m = Ae(o);
342
+ const j = getComputedStyle(s), ot = parseFloat(j.getPropertyValue("--easy-tooltip-distance")), H = parseFloat(j.getPropertyValue("--easy-tooltip-viewport-padding")), Wt = j.getPropertyValue("--easy-tooltip-arrow-size").trim().split(/\s+/), Y = parseFloat(Wt[0]), xt = parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-x")), Ht = parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-y")), Dt = parseFloat(j.getPropertyValue("--easy-tooltip-border-radius")) || 0;
343
+ s.style.minWidth = `${xt * 2 + Y}px`, v.style.minHeight = "";
344
+ const Mt = Math.min(Dt, v.getBoundingClientRect().height / 2);
345
+ s.style.minWidth = `${xt * 2 + Y + Mt * 2}px`;
346
+ const pt = K.left + ((visualViewport == null ? void 0 : visualViewport.offsetLeft) ?? 0), Nt = K.top + ((visualViewport == null ? void 0 : visualViewport.offsetTop) ?? 0), Xt = (visualViewport == null ? void 0 : visualViewport.width) ?? document.documentElement.clientWidth, Yt = (visualViewport == null ? void 0 : visualViewport.height) ?? document.documentElement.clientHeight, it = jt ? o._anchorSide : xe, ue = Math.round(m.right - pt + ot - H), fe = Math.round(pt + Xt - m.left + ot - H);
347
+ s.style.translate = "", s.style.removeProperty("--easy-tooltip-left-offset"), s.style.removeProperty("--easy-tooltip-right-offset"), v.style.translate = "", v.style.width = "", s.classList.remove("easy-tooltip-below", "easy-tooltip-inside", "easy-tooltip-left", "easy-tooltip-right");
348
+ let _, tt;
349
+ if (it === "left" || it === "right") {
350
+ s.style.minWidth = `${Mt * 2}px`, v.style.width = "min-content", v.style.minWidth = "0";
351
+ const n = s.getBoundingClientRect().width;
352
+ v.style.width = "", v.style.minWidth = "";
353
+ for (const r of [it, it === "left" ? "right" : "left"])
354
+ if (!((r === "left" ? m.left - pt - ot - H : pt + Xt - m.right - ot - H) < n) && (s.classList.remove("easy-tooltip-left", "easy-tooltip-right"), s.classList.add("easy-tooltip-" + r), r === "right" ? (s.style.setProperty("--easy-tooltip-left-offset", `${ue}px`), s.style.removeProperty("--easy-tooltip-right-offset")) : (s.style.setProperty("--easy-tooltip-right-offset", `${fe}px`), s.style.removeProperty("--easy-tooltip-left-offset")), s.getBoundingClientRect().height <= Yt - H * 2)) {
355
+ _ = r;
356
+ break;
357
+ }
358
+ _ || (_ = it, tt = !0);
359
+ } else {
360
+ const { height: n } = s.getBoundingClientRect(), r = Math.round(m.top), l = r - n - ot > Nt + H, i = r + m.height + n + ot < Nt + Yt - H;
361
+ it === "below" ? _ = i ? "below" : l ? "above" : "below" : _ = l ? "above" : i ? "below" : "above", tt = !l && !i;
362
+ }
363
+ s.classList.remove("easy-tooltip-below", "easy-tooltip-inside", "easy-tooltip-left", "easy-tooltip-right"), s.style.removeProperty("--easy-tooltip-left-offset"), s.style.removeProperty("--easy-tooltip-right-offset"), s.style.top = "", s.style.left = "", _ !== "above" && s.classList.add("easy-tooltip-" + _), tt && s.classList.add("easy-tooltip-inside"), tt || (_ === "right" ? s.style.setProperty("--easy-tooltip-left-offset", `${ue}px`) : _ === "left" && s.style.setProperty("--easy-tooltip-right-offset", `${fe}px`)), ge(v), s.classList.remove("easy-tooltip-setup");
364
+ let pe = !0;
365
+ if (F && $ !== void 0) {
366
+ const n = document.elementFromPoint($, A);
367
+ pe = !!n && (o === n || o.contains(n));
368
+ }
369
+ k(s, pe || !!s._held), _ === "left" || _ === "right" ? v.style.minHeight = `${Ht * 2 + Y + Mt * 2}px` : v.style.minHeight = `${Mt * 2}px`;
370
+ let O, qt = 0, zt;
371
+ const Ee = F && $ !== void 0, Se = !!s._held || !Ee || $ >= m.left && $ <= m.right && A >= m.top && A <= m.bottom, he = (n, r, l, i) => {
372
+ const E = Le(n, r);
373
+ if (!Se)
374
+ return E;
375
+ const y = Me(E, l, i);
376
+ return y === E ? (s._clampArmed = !1, E) : s._clampArmed ? (s._hold && (s._hold.pos = y), y) : (s._clampArmed = !0, E);
377
+ };
378
+ if (_ === "left" || _ === "right") {
379
+ const n = Math.round(he("y", m.top + m.height / 2, m.top, m.bottom));
380
+ zt = { x: Math.round(_ === "right" ? m.right : m.left), y: n }, tt || (s.style.left = `${Math.round(_ === "right" ? m.right : m.left) - K.left}px`);
381
+ const r = s.getBoundingClientRect().height;
382
+ O = wt(n - r / 2, n + r / 2, r, Nt, Yt, Ht, !0), s.style.top = `${n - K.top + qt}px`;
383
+ } else {
384
+ const n = Math.round(he("x", m.left + m.width / 2, m.left, m.right)), r = Math.round(m.top);
385
+ zt = { x: n, y: Math.round(_ === "below" ? m.bottom : m.top) }, tt || (s.style.top = _ === "above" ? `${r - K.top}px` : `${r + m.height - K.top}px`);
386
+ const l = s.getBoundingClientRect().width;
387
+ O = wt(n - l / 2, n + l / 2, l, pt, Xt, xt, !1), s.style.left = `${n - K.left + qt}px`;
388
+ }
389
+ const { width: st, height: rt } = v.getBoundingClientRect(), ht = Wt[1] ? parseFloat(Wt[1]) : Y / 2, Ce = parseFloat(j.getPropertyValue("--easy-tooltip-arrow-radius")) || 0, mt = _ === "left" || _ === "right", Oe = mt ? st / 2 : st / 2 - O, ke = mt ? rt / 2 - O : rt / 2, Ve = mt ? (rt - Y - Ht * 2) / 2 : (st - Y - xt * 2) / 2, Fe = Math.max(0, Math.min(Dt, st / 2, rt / 2, Ve)), It = Te(_, st, rt, Fe, Y, ht, Oe, ke, Ce);
390
+ if ((e = o._svgPath) == null || e.setAttribute("d", It), (a = o._clipPath) == null || a.setAttribute("d", It), (d = o._borderMaskPath) == null || d.setAttribute("d", It), O) {
391
+ const n = mt ? `translate(0 ${O})` : `translate(${O} 0)`;
392
+ (c = o._svgPath) == null || c.setAttribute("transform", n), (g = o._clipPath) == null || g.setAttribute("transform", n), (T = o._borderMaskPath) == null || T.setAttribute("transform", n);
393
+ } else
394
+ (f = o._svgPath) == null || f.removeAttribute("transform"), (w = o._clipPath) == null || w.removeAttribute("transform"), (R = o._borderMaskPath) == null || R.removeAttribute("transform");
395
+ const me = o.dataset.easyTooltipBackground || j.getPropertyValue("--easy-tooltip-background").trim(), Qt = o.dataset.easyTooltipBorder || j.getPropertyValue("--easy-tooltip-border").trim();
396
+ let nt = 0, Lt = st, at = 0, Et = rt;
397
+ if (_ === "left" ? Lt += ht : _ === "right" ? nt -= ht : _ === "above" ? Et += ht : _ === "below" && (at -= ht), O && (mt ? (at += Math.min(0, O), Et += Math.max(0, O)) : (nt += Math.min(0, O), Lt += Math.max(0, O))), me && o._surfaceDiv && o._foreignObj ? (o._foreignObj.setAttribute("x", `${nt}`), o._foreignObj.setAttribute("y", `${at}`), o._foreignObj.setAttribute("width", `${Lt - nt}`), o._foreignObj.setAttribute("height", `${Et - at}`), o._surfaceDiv.style.width = "100%", o._surfaceDiv.style.height = "100%", o._surfaceDiv.style.background = me, o._foreignObj.style.display = "", (C = o._svgPath) == null || C.style.setProperty("fill", "none")) : o._foreignObj && (o._foreignObj.style.display = "none", (Z = o._svgPath) == null || Z.style.removeProperty("fill")), Qt && Qt !== "none" && o._borderMask && o._borderSurfaceDiv && o._borderForeignObj) {
398
+ const r = (parseFloat(j.getPropertyValue("--easy-tooltip-border-size")) || 0) * 2, l = nt - r, i = at - r, E = Lt - nt + r * 2, y = Et - at + r * 2;
399
+ o._borderMask.setAttribute("x", `${l}`), o._borderMask.setAttribute("y", `${i}`), o._borderMask.setAttribute("width", `${E}`), o._borderMask.setAttribute("height", `${y}`), o._borderForeignObj.setAttribute("x", `${l}`), o._borderForeignObj.setAttribute("y", `${i}`), o._borderForeignObj.setAttribute("width", `${E}`), o._borderForeignObj.setAttribute("height", `${y}`), o._borderSurfaceDiv.style.width = "100%", o._borderSurfaceDiv.style.height = "100%", o._borderSurfaceDiv.style.background = Qt, o._borderForeignObj.style.display = "", (U = o._svgPath) == null || U.style.setProperty("stroke", "none");
400
+ } else
401
+ o._borderForeignObj && (o._borderForeignObj.style.display = "none", (ce = o._svgPath) == null || ce.style.removeProperty("stroke"));
402
+ const Be = ee(m);
403
+ if (s._trigger = o, s._placement = {
404
+ side: _,
405
+ inside: !!tt,
406
+ anchor: ft || Tt ? At : "element",
407
+ anchorRect: Be,
408
+ point: zt
409
+ }, s._dispatched && Pe(s), !o._observer) {
410
+ const n = new MutationObserver(() => N());
411
+ n.observe(o, {
412
+ attributes: !0,
413
+ attributeFilter: [
414
+ "data-easy-tooltip",
415
+ "data-easy-tooltip-src",
416
+ "data-easy-tooltip-background",
417
+ "data-easy-tooltip-border",
418
+ "data-easy-tooltip-style"
419
+ ]
420
+ }), o._observer = n;
421
+ }
422
+ if (et.add(o), o._source && !o._sourceObserver) {
423
+ const n = new MutationObserver(() => N());
424
+ n.observe(o._source, { childList: !0, subtree: !0, characterData: !0 }), o._sourceObserver = n;
425
+ }
426
+ }
427
+ }
428
+ }
429
+ function re(t, e = !1) {
430
+ for (; t && t !== document.body; )
431
+ t._tooltip && !t._tooltip._held && (e || !t.matches(":hover")) && k(t._tooltip, !1), t = t.parentElement ?? void 0;
432
+ }
433
+ let Bt, $t;
434
+ function dt(t) {
435
+ if (Bt) {
436
+ $t = t;
437
+ return;
438
+ }
439
+ Bt = !0, t(), queueMicrotask(() => {
440
+ if (Bt = !1, $t) {
441
+ const e = $t;
442
+ $t = null, dt(e);
443
+ }
444
+ });
445
+ }
446
+ function N() {
447
+ dt(se);
448
+ }
449
+ function Rt(t, e = !1) {
450
+ dt(() => {
451
+ re(V, e), V = t.target ?? void 0, se();
452
+ });
453
+ }
454
+ let X = 0;
455
+ function ne(t) {
456
+ const e = t.touches[0];
457
+ return e ? (Ft(e.clientX, e.clientY), !0) : !1;
458
+ }
459
+ function ae() {
460
+ const t = B;
461
+ if (!t)
462
+ return;
463
+ B = void 0;
464
+ const e = t._tooltip;
465
+ e && (e._held = !1, t.matches(":hover") || k(e, !1));
466
+ }
467
+ document.addEventListener("pointerdown", (t) => {
468
+ var c, g, T;
469
+ ae();
470
+ let e = t.target;
471
+ for (; e && e !== document.body && !e._tooltip; )
472
+ e = e.parentElement;
473
+ if (!(e != null && e._tooltip))
474
+ return;
475
+ const a = (c = e.closest("[data-easy-tooltip-dismiss]")) == null ? void 0 : c.getAttribute("data-easy-tooltip-dismiss");
476
+ if (t.pointerType !== "touch" && a !== void 0 && a !== "false") {
477
+ const f = e;
478
+ f._dismissed = !0, k(f._tooltip, !1), f.addEventListener("pointerleave", () => f._dismissed = !1, { once: !0 });
479
+ return;
480
+ }
481
+ const d = e.dataset.easyTooltipHold;
482
+ d !== "false" && (d === void 0 && !((T = (g = t.target) == null ? void 0 : g.closest) != null && T.call(g, ve)) || (B = e, e._tooltip._held = !0));
483
+ });
484
+ for (const t of ["pointerup", "pointercancel"])
485
+ window.addEventListener(t, ae);
486
+ document.addEventListener("touchstart", (t) => {
487
+ X = performance.now(), ct = !1, W = !0, F = !1, ne(t), t.target !== V && Rt(t, !0);
488
+ }), document.addEventListener("touchmove", (t) => {
489
+ X = performance.now(), ne(t) && le();
490
+ }), document.addEventListener("mouseover", (t) => {
491
+ X && performance.now() - X < 700 || (ct = !1, W = !0, F = !0, Ft(t.clientX, t.clientY), Rt(t));
492
+ });
493
+ function le() {
494
+ let t;
495
+ for (const e of et) {
496
+ const a = e.dataset.easyTooltipAnchor;
497
+ if (Vt(a) !== "cursor" || !e._tooltip)
498
+ continue;
499
+ const d = _t(a);
500
+ t ?? (t = h.getBoundingClientRect()), d !== "x" && (e._tooltip.style.top = `${A - t.top}px`), d !== "y" && (e._tooltip.style.left = `${$ - t.left}px`);
501
+ }
502
+ Q && !St && (St = !0, requestAnimationFrame(() => {
503
+ St = !1, N();
504
+ }));
505
+ }
506
+ document.addEventListener("mousemove", (t) => {
507
+ X && performance.now() - X < 700 || (F = !0, Ft(t.clientX, t.clientY), le());
508
+ }), document.addEventListener("focusin", (t) => {
509
+ if (!(X && performance.now() - X < 700)) {
510
+ if (ct) {
511
+ ct = !1;
512
+ return;
513
+ }
514
+ W = !1, F = !1, Rt(t);
515
+ }
516
+ }), document.addEventListener("focusout", (t) => {
517
+ dt(() => {
518
+ t.target && re(t.target);
519
+ });
520
+ }), window.addEventListener("blur", () => {
521
+ B != null && B._tooltip && (B._tooltip._held = !1), B = void 0, ct = document.activeElement !== document.body, dt(() => {
522
+ V = void 0;
523
+ for (const t of et)
524
+ t._tooltip && k(t._tooltip, !1);
525
+ });
526
+ }), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), visualViewport == null || visualViewport.addEventListener("resize", N), visualViewport == null || visualViewport.addEventListener("scroll", N);
527
+ };
528
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Zt) : Zt();
529
+ }
@@ -0,0 +1 @@
1
+ (function(gt){typeof define=="function"&&define.amd?define(gt):gt()})(function(){"use strict";{let gt=function(h){h.style.width="";const z=h.getBoundingClientRect(),I=Math.round(z.height);if(z.width<=0||I<=0)return;const lt=Math.ceil(z.width);h.style.maxWidth="none",h.style.width="max-content";const V=Math.ceil(h.getBoundingClientRect().width);if(h.style.maxWidth="",V<=lt){h.style.width="";return}h.style.minWidth="0",h.style.width="min-content";const W=h.getBoundingClientRect(),F=Math.ceil(W.width),$=Math.round(W.height)<=I;if(h.style.minWidth="",$){h.style.width=`${F}px`;return}let A=F+1,Q=lt+1,S=lt;for(;A<=Q;){const L=Math.floor((A+Q)/2);h.style.width=`${L}px`,Math.round(h.getBoundingClientRect().height)<=I?(S=L,Q=L-1):A=L+1}h.style.width=`${S}px`},Ut=function(){const h=document.createElement("div");h.id="easy-tooltips",document.body.append(h);const z=!!h.showPopover;function I(){if(!(!z||h.matches(":popover-open")))try{h.showPopover()}catch{}}function lt(){if(z){try{h.matches(":popover-open")&&h.hidePopover()}catch{}I()}}z&&(h.popover="manual",I(),h.addEventListener("toggle",t=>{t.newState==="closed"&&requestAnimationFrame(I)}));let V,W,F,$,A,Q,S,L,Ct,Ot,ct,kt=0,yt=0,ye=0;const _e=100,ve="input, select, textarea, button, [role=button], [role=slider], [role=checkbox], [role=radio], [role=switch]";let B;function Kt(t){lt(),t._activated=!0,ie(t);const e=t._trigger;if(e&&$!==void 0){const{pin:a,entry:d}=ee(e);(a||d)&&(te(e,a,d),N())}kt++,clearTimeout(Ot),h.classList.add("easy-tooltips-active"),t.style.zIndex=String(++ye),$e()}function Gt(t){t._activated&&(t._activated=!1,ie(t),--kt<=0&&(kt=0,clearTimeout(Ot),Ot=setTimeout(()=>h.classList.remove("easy-tooltips-active"),$t(getComputedStyle(document.documentElement).getPropertyValue("--easy-tooltip-cooldown")))))}const et=new Set;function be(t){var a,d;const e=t._tooltip;e&&(clearTimeout(e._moveTimer),t===B&&(B=void 0),e._dispatched&&(e._dispatched=!1,bt(e,"close")),e.classList.contains("easy-tooltip-visible")&&yt--,clearTimeout(e._timeout),clearTimeout(e._activateTimer),Gt(e),e.remove()),(a=t._observer)==null||a.disconnect(),(d=t._sourceObserver)==null||d.disconnect(),t._observer=t._sourceObserver=void 0,et.delete(t),t._tooltip=t._tooltipText=t._svgPath=t._clipPath=t._foreignObj=t._surfaceDiv=t._borderMask=t._borderMaskPath=t._borderForeignObj=t._borderSurfaceDiv=t._tooltipClass=t._source=t._anchorPoint=t._anchorSide=void 0,t===V&&(V=void 0)}let Vt;new MutationObserver(t=>{Vt||!t.some(e=>e.removedNodes.length)||(Vt=!0,queueMicrotask(()=>{Vt=!1;for(const e of et)e.isConnected||be(e)}))}).observe(document.body,{childList:!0,subtree:!0});let _t;function Jt(){if(_t=0,F&&$!==void 0){const t=document.elementFromPoint($,A);for(const e of et){const a=e._tooltip;a&&!a._held&&a.classList.contains("easy-tooltip-visible")&&e!==t&&!e.contains(t)&&k(a,!1)}}yt>0&&(_t=requestAnimationFrame(Jt))}function $e(){_t||(_t=requestAnimationFrame(Jt))}function vt(t){return t!=null&&t.endsWith("-x")?"x":t!=null&&t.endsWith("-y")?"y":"both"}function Ft(t){return t==null?void 0:t.replace(/-[xy]$/,"")}function Bt(t,e){S=$,L=A,$=t,A=e}function we(t){if(S===void 0)return;const e=$-S,a=A-L;let d,c=1/0;const g=(T,f,w,R,C)=>{f<0||f>1||f>=c||w<R||w>C||(c=f,d=T)};return e>0&&S<t.left&&g("left",(t.left-S)/e,L+a*((t.left-S)/e),t.top,t.bottom),e<0&&S>t.right&&g("right",(t.right-S)/e,L+a*((t.right-S)/e),t.top,t.bottom),a>0&&L<t.top&&g("above",(t.top-L)/a,S+e*((t.top-L)/a),t.left,t.right),a<0&&L>t.bottom&&g("below",(t.bottom-L)/a,S+e*((t.bottom-L)/a),t.left,t.right),d}function te(t,e,a){const d=vt(t.dataset.easyTooltipAnchor);if((a||e&&d==="both")&&t._anchorSide===void 0){const f=t.getBoundingClientRect(),w={left:$-f.left,right:f.right-$,above:A-f.top,below:f.bottom-A};t._anchorSide=we(f)??Object.keys(w).reduce((R,C)=>w[C]<w[R]?C:R)}if(!e)return;let c=$,g=A;const T=t._anchorSide;if(T&&d==="both"){const f=t.getBoundingClientRect(),w=(R,C,Z)=>Math.min(Math.max(R,C),Z);c=T==="left"?f.left:T==="right"?f.right:w($,f.left,f.right),g=T==="above"?f.top:T==="below"?f.bottom:w(A,f.top,f.bottom)}t._anchorPoint={x:c+window.scrollX,y:g+window.scrollY}}function ee(t){const e=t.dataset.easyTooltipPrefer,a=Ft(t.dataset.easyTooltipAnchor)==="pin"&&W,d=a&&vt(t.dataset.easyTooltipAnchor)==="both";return{preferAttr:e,pin:a,entry:W&&(e==="entry"||!e&&d)}}function oe(t){return{x:t.left,y:t.top,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left}}function bt(t,e,a){var g;const d=t._trigger;if(!d)return;const c=t._placement;c&&(t._reported=c),d.dispatchEvent(new CustomEvent(`easy-tooltip-${e}`,{bubbles:!0,composed:!0,detail:{trigger:d,tooltip:t,text:((g=d._tooltipText)==null?void 0:g.textContent)??"",side:c==null?void 0:c.side,inside:(c==null?void 0:c.inside)??!1,anchor:(c==null?void 0:c.anchor)??"element",anchorRect:c==null?void 0:c.anchorRect,point:c==null?void 0:c.point,rect:oe(t.getBoundingClientRect()),previous:a}}))}function Pe(t){const e=t._reported,a=t._placement;if(!e||!a)return;const d=e.side!==a.side||e.inside!==a.inside||e.anchor!==a.anchor;if(!d&&e.point.x===a.point.x&&e.point.y===a.point.y)return;const c=performance.now(),g=d?0:_e-(c-(t._moveAt??0));if(g<=0){clearTimeout(t._moveTimer),t._moveTimer=void 0,t._moveAt=c,bt(t,"move",e);return}t._moveTimer||(t._moveTimer=setTimeout(()=>{t._moveTimer=void 0,!(!t._dispatched||!t._reported||!t._placement)&&(t._moveAt=performance.now(),bt(t,"move",t._reported))},g))}function ie(t){t._dispatchQueued||(t._dispatchQueued=!0,queueMicrotask(()=>{t._dispatchQueued=!1;const e=!!t._activated;e!==!!t._dispatched&&(t._dispatched=e,clearTimeout(t._moveTimer),t._moveTimer=void 0,t._moveAt=e?performance.now():void 0,bt(t,e?"open":"close"))}))}function $t(t){t=t.trim();const e=parseFloat(t);return t.endsWith("ms")?e:e*1e3}function k(t,e){const a=getComputedStyle(t),d=$t(a.getPropertyValue("--easy-tooltip-animation-length"));if(e){const c=$t(a.getPropertyValue("--easy-tooltip-delay"))+$t(a.getPropertyValue("--easy-tooltip-inactive-delay"));c&&(t._start=performance.now(),t._delay=c),t._animation_duration=d+c}else{if(t._delay&&performance.now()<Number(t._start)+t._delay){t.classList.contains("easy-tooltip-visible")&&yt--,t.classList.remove("easy-tooltip-visible"),t._trigger&&(t._trigger._anchorSide=t._trigger._anchorPoint=void 0),clearTimeout(t._timeout),clearTimeout(t._activateTimer),t._timeout=t._activateTimer=t._start=t._delay=void 0;return}t._animation_duration=d}if(t.classList.contains("easy-tooltip-visible")===e){t._next=void 0;return}t._timeout===void 0?(t._next=void 0,t.classList.toggle("easy-tooltip-visible",e),e&&(t._hold=t._clampArmed=void 0),!e&&t._trigger&&(t._trigger._anchorSide=t._trigger._anchorPoint=void 0),yt+=e?1:-1,clearTimeout(t._activateTimer),t._activateTimer=void 0,e?t._delay?t._activateTimer=setTimeout(()=>{t._activateTimer=void 0,Kt(t)},t._delay):Kt(t):Gt(t),t._timeout=setTimeout(()=>{t._timeout=void 0,t._next!==void 0&&k(t,t._next)},t._animation_duration)):t._next=e}function se(t){return t.transform!=="none"||t.translate!=="none"||t.rotate!=="none"||t.scale!=="none"||t.perspective!=="none"||t.filter!=="none"||t.backdropFilter!=="none"||/paint|layout|strict|content/.test(t.contain)||/transform|translate|rotate|scale|perspective|filter/.test(t.willChange)}function Ae(t){const e=t.getBoundingClientRect();let a=e.left,d=e.top,c=e.right,g=e.bottom,T=getComputedStyle(t).position,f=t.parentElement;for(;f&&f!==document.body;){const w=getComputedStyle(f);if(T==="fixed"?se(w):T==="absolute"?w.position!=="static"||se(w):!0){const C=w.overflowX!=="visible",Z=w.overflowY!=="visible";if(C||Z){const U=f.getBoundingClientRect();C&&(a=Math.max(a,U.left),c=Math.min(c,U.right)),Z&&(d=Math.max(d,U.top),g=Math.min(g,U.bottom))}T=w.position}f=f.parentElement}return{x:a,y:d,left:a,top:d,right:c,bottom:g,width:c-a,height:g-d}}function re(){var t,e,a,d,c,g,T,f,w,R,C,Z,U,de;if(Q=!1,V){const K=h.getBoundingClientRect();h.style.setProperty("--easy-tooltip-view-width",((visualViewport==null?void 0:visualViewport.width)??document.documentElement.clientWidth)+"px");const ut=[];let u=V;for(;u&&u!==document.body;){if(ut.length)u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1);else if(u._dismissed)u._tooltip&&k(u._tooltip,!1);else if(u.dataset.easyTooltip)(t=u._sourceObserver)==null||t.disconnect(),u._sourceObserver=u._source=void 0,ut.push(u);else if(u.dataset.easyTooltipSrc){const G=u.dataset.easyTooltipSrc,Pt=u._source;if(G==="next")u._source=u.nextElementSibling??void 0;else if(G==="prev")u._source=u.previousElementSibling??void 0;else try{u._source=(document.getElementById(G)||document.querySelector(G))??void 0}catch{}Pt!==u._source&&u._sourceObserver&&(u._sourceObserver.disconnect(),u._sourceObserver=void 0),u._source?ut.push(u):u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1)}else u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1);u=u.parentElement}for(let G=ut.length;G--;){let Pt=function(n,r,l,i,E,y,x){const P=l/2-Y/2-y-Nt,b=i+H,M=i+E-H;let p=0,D=0;return n<b?(p=Math.min(b-n,P),n+p<b&&(D=b-(n+p))):r>M&&(p=-Math.min(r-M,P),r+p>M&&(D=-(r+p-M))),p&&v!==void 0&&(v.style.translate=x?`0 ${p}px`:`${p}px`),zt=D,p},Te=function(n,r,l,i,E,y,x,P,b){const M=E/2,p=b*Math.SQRT1_2;if(n==="above"){const q=b>0?`L${x+p} ${l+y-p}A${b} ${b} 0 0 1 ${x-p} ${l+y-p}`:`L${x} ${l+y}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${x+M}${q}L${x-M} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}if(n==="below"){const q=b>0?`L${x-p} ${-y+p}A${b} ${b} 0 0 1 ${x+p} ${-y+p}`:`L${x} ${-y}`;return`M${i} 0H${x-M}${q}L${x+M} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}if(n==="right"){const q=b>0?`L${-y+p} ${P+p}A${b} ${b} 0 0 1 ${-y+p} ${P-p}`:`L${-y} ${P}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${P+M}${q}L0 ${P-M}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}const D=b>0?`L${r+y-p} ${P-p}A${b} ${b} 0 0 1 ${r+y-p} ${P+p}`:`L${r+y} ${P}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${P-M}${D}L${r} ${P+M}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`};const o=ut[G];let s=o._tooltip,v=o._tooltipText;if(!s||!v){s=document.createElement("div"),s.className="easy-tooltip easy-tooltip-setup",s._trigger=o,o._tooltip=s;const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.classList.add("easy-tooltip-bg"),n.setAttribute("aria-hidden","true");const r=document.createElementNS("http://www.w3.org/2000/svg","defs"),l=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),i="easy-tooltip-clip-"+Math.random().toString(36).substring(2,9);l.id=i;const E=document.createElementNS("http://www.w3.org/2000/svg","path");l.append(E),r.append(l),o._clipPath=E;const y=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");y.setAttribute("clip-path",`url(#${i})`);const x=document.createElement("div");x.className="easy-tooltip-surface",y.append(x),o._foreignObj=y,o._surfaceDiv=x;const P=document.createElementNS("http://www.w3.org/2000/svg","mask"),b="easy-tooltip-mask-"+Math.random().toString(36).substring(2,9);P.id=b,P.setAttribute("maskUnits","userSpaceOnUse");const M=document.createElementNS("http://www.w3.org/2000/svg","path");P.append(M),r.append(P),o._borderMask=P,o._borderMaskPath=M;const p=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");p.setAttribute("mask",`url(#${b})`);const D=document.createElement("div");D.className="easy-tooltip-surface",p.append(D),o._borderForeignObj=p,o._borderSurfaceDiv=D;const q=document.createElementNS("http://www.w3.org/2000/svg","path");o._svgPath=q,n.append(r,y,q,p),v=document.createElement("div"),v.className="easy-tooltip-text",o._tooltipText=v,s.append(n,v),h.append(s)}const ue=s.style.zIndex;s.style.cssText=o.dataset.easyTooltipStyle??"",ue&&(s.style.zIndex=ue);const At=o.dataset.easyTooltipClass;o._tooltipClass!==At&&(o._tooltipClass&&s.classList.remove(...o._tooltipClass.trim().split(/\s+/)),At&&s.classList.add(...At.trim().split(/\s+/)),o._tooltipClass=At),o._source?(v.replaceChildren(...o._source.cloneNode(!0).childNodes),v.classList.add("easy-tooltip-text-html")):(v.textContent=o.dataset.easyTooltip??null,v.classList.remove("easy-tooltip-text-html"));const Tt=o.dataset.easyTooltipAnchor,J=vt(Tt),ft=Ft(Tt)==="cursor"&&W,{preferAttr:xe,pin:xt,entry:Wt}=ee(o);ft&&(Q=!0);const Me=(n,r,l)=>Math.min(Math.max(n,r),l),Le=(n,r)=>Tt?r:((!s._hold||s._hold.axis!==n)&&(s._hold={axis:n,pos:r}),s._hold.pos);(xt||Wt)&&!s._activated&&o._anchorSide===void 0&&o._anchorPoint===void 0&&te(o,xt,Wt);let m;if(ft||xt&&o._anchorPoint){const n=ft?$:o._anchorPoint.x-window.scrollX,r=ft?A:o._anchorPoint.y-window.scrollY,l=J==="both"?null:o.getBoundingClientRect();m={left:J==="y"?l.left:n,right:J==="y"?l.right:n,width:J==="y"?l.width:0,top:J==="x"?l.top:r,bottom:J==="x"?l.bottom:r,height:J==="x"?l.height:0}}else m=Ae(o);const j=getComputedStyle(s),ot=parseFloat(j.getPropertyValue("--easy-tooltip-distance")),H=parseFloat(j.getPropertyValue("--easy-tooltip-viewport-padding")),Ht=j.getPropertyValue("--easy-tooltip-arrow-size").trim().split(/\s+/),Y=parseFloat(Ht[0]),Mt=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-x")),Dt=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-y")),Nt=parseFloat(j.getPropertyValue("--easy-tooltip-border-radius"))||0;s.style.minWidth=`${Mt*2+Y}px`,v.style.minHeight="";const Lt=Math.min(Nt,v.getBoundingClientRect().height/2);s.style.minWidth=`${Mt*2+Y+Lt*2}px`;const pt=K.left+((visualViewport==null?void 0:visualViewport.offsetLeft)??0),Xt=K.top+((visualViewport==null?void 0:visualViewport.offsetTop)??0),Yt=(visualViewport==null?void 0:visualViewport.width)??document.documentElement.clientWidth,qt=(visualViewport==null?void 0:visualViewport.height)??document.documentElement.clientHeight,it=Wt?o._anchorSide:xe,fe=Math.round(m.right-pt+ot-H),pe=Math.round(pt+Yt-m.left+ot-H);s.style.translate="",s.style.removeProperty("--easy-tooltip-left-offset"),s.style.removeProperty("--easy-tooltip-right-offset"),v.style.translate="",v.style.width="",s.classList.remove("easy-tooltip-below","easy-tooltip-inside","easy-tooltip-left","easy-tooltip-right");let _,tt;if(it==="left"||it==="right"){s.style.minWidth=`${Lt*2}px`,v.style.width="min-content",v.style.minWidth="0";const n=s.getBoundingClientRect().width;v.style.width="",v.style.minWidth="";for(const r of[it,it==="left"?"right":"left"])if(!((r==="left"?m.left-pt-ot-H:pt+Yt-m.right-ot-H)<n)&&(s.classList.remove("easy-tooltip-left","easy-tooltip-right"),s.classList.add("easy-tooltip-"+r),r==="right"?(s.style.setProperty("--easy-tooltip-left-offset",`${fe}px`),s.style.removeProperty("--easy-tooltip-right-offset")):(s.style.setProperty("--easy-tooltip-right-offset",`${pe}px`),s.style.removeProperty("--easy-tooltip-left-offset")),s.getBoundingClientRect().height<=qt-H*2)){_=r;break}_||(_=it,tt=!0)}else{const{height:n}=s.getBoundingClientRect(),r=Math.round(m.top),l=r-n-ot>Xt+H,i=r+m.height+n+ot<Xt+qt-H;it==="below"?_=i?"below":l?"above":"below":_=l?"above":i?"below":"above",tt=!l&&!i}s.classList.remove("easy-tooltip-below","easy-tooltip-inside","easy-tooltip-left","easy-tooltip-right"),s.style.removeProperty("--easy-tooltip-left-offset"),s.style.removeProperty("--easy-tooltip-right-offset"),s.style.top="",s.style.left="",_!=="above"&&s.classList.add("easy-tooltip-"+_),tt&&s.classList.add("easy-tooltip-inside"),tt||(_==="right"?s.style.setProperty("--easy-tooltip-left-offset",`${fe}px`):_==="left"&&s.style.setProperty("--easy-tooltip-right-offset",`${pe}px`)),gt(v),s.classList.remove("easy-tooltip-setup");let he=!0;if(F&&$!==void 0){const n=document.elementFromPoint($,A);he=!!n&&(o===n||o.contains(n))}k(s,he||!!s._held),_==="left"||_==="right"?v.style.minHeight=`${Dt*2+Y+Lt*2}px`:v.style.minHeight=`${Lt*2}px`;let O,zt=0,It;const Ee=F&&$!==void 0,Se=!!s._held||!Ee||$>=m.left&&$<=m.right&&A>=m.top&&A<=m.bottom,me=(n,r,l,i)=>{const E=Le(n,r);if(!Se)return E;const y=Me(E,l,i);return y===E?(s._clampArmed=!1,E):s._clampArmed?(s._hold&&(s._hold.pos=y),y):(s._clampArmed=!0,E)};if(_==="left"||_==="right"){const n=Math.round(me("y",m.top+m.height/2,m.top,m.bottom));It={x:Math.round(_==="right"?m.right:m.left),y:n},tt||(s.style.left=`${Math.round(_==="right"?m.right:m.left)-K.left}px`);const r=s.getBoundingClientRect().height;O=Pt(n-r/2,n+r/2,r,Xt,qt,Dt,!0),s.style.top=`${n-K.top+zt}px`}else{const n=Math.round(me("x",m.left+m.width/2,m.left,m.right)),r=Math.round(m.top);It={x:n,y:Math.round(_==="below"?m.bottom:m.top)},tt||(s.style.top=_==="above"?`${r-K.top}px`:`${r+m.height-K.top}px`);const l=s.getBoundingClientRect().width;O=Pt(n-l/2,n+l/2,l,pt,Yt,Mt,!1),s.style.left=`${n-K.left+zt}px`}const{width:st,height:rt}=v.getBoundingClientRect(),ht=Ht[1]?parseFloat(Ht[1]):Y/2,Ce=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-radius"))||0,mt=_==="left"||_==="right",Oe=mt?st/2:st/2-O,ke=mt?rt/2-O:rt/2,Ve=mt?(rt-Y-Dt*2)/2:(st-Y-Mt*2)/2,Fe=Math.max(0,Math.min(Nt,st/2,rt/2,Ve)),Qt=Te(_,st,rt,Fe,Y,ht,Oe,ke,Ce);if((e=o._svgPath)==null||e.setAttribute("d",Qt),(a=o._clipPath)==null||a.setAttribute("d",Qt),(d=o._borderMaskPath)==null||d.setAttribute("d",Qt),O){const n=mt?`translate(0 ${O})`:`translate(${O} 0)`;(c=o._svgPath)==null||c.setAttribute("transform",n),(g=o._clipPath)==null||g.setAttribute("transform",n),(T=o._borderMaskPath)==null||T.setAttribute("transform",n)}else(f=o._svgPath)==null||f.removeAttribute("transform"),(w=o._clipPath)==null||w.removeAttribute("transform"),(R=o._borderMaskPath)==null||R.removeAttribute("transform");const ge=o.dataset.easyTooltipBackground||j.getPropertyValue("--easy-tooltip-background").trim(),Zt=o.dataset.easyTooltipBorder||j.getPropertyValue("--easy-tooltip-border").trim();let nt=0,Et=st,at=0,St=rt;if(_==="left"?Et+=ht:_==="right"?nt-=ht:_==="above"?St+=ht:_==="below"&&(at-=ht),O&&(mt?(at+=Math.min(0,O),St+=Math.max(0,O)):(nt+=Math.min(0,O),Et+=Math.max(0,O))),ge&&o._surfaceDiv&&o._foreignObj?(o._foreignObj.setAttribute("x",`${nt}`),o._foreignObj.setAttribute("y",`${at}`),o._foreignObj.setAttribute("width",`${Et-nt}`),o._foreignObj.setAttribute("height",`${St-at}`),o._surfaceDiv.style.width="100%",o._surfaceDiv.style.height="100%",o._surfaceDiv.style.background=ge,o._foreignObj.style.display="",(C=o._svgPath)==null||C.style.setProperty("fill","none")):o._foreignObj&&(o._foreignObj.style.display="none",(Z=o._svgPath)==null||Z.style.removeProperty("fill")),Zt&&Zt!=="none"&&o._borderMask&&o._borderSurfaceDiv&&o._borderForeignObj){const r=(parseFloat(j.getPropertyValue("--easy-tooltip-border-size"))||0)*2,l=nt-r,i=at-r,E=Et-nt+r*2,y=St-at+r*2;o._borderMask.setAttribute("x",`${l}`),o._borderMask.setAttribute("y",`${i}`),o._borderMask.setAttribute("width",`${E}`),o._borderMask.setAttribute("height",`${y}`),o._borderForeignObj.setAttribute("x",`${l}`),o._borderForeignObj.setAttribute("y",`${i}`),o._borderForeignObj.setAttribute("width",`${E}`),o._borderForeignObj.setAttribute("height",`${y}`),o._borderSurfaceDiv.style.width="100%",o._borderSurfaceDiv.style.height="100%",o._borderSurfaceDiv.style.background=Zt,o._borderForeignObj.style.display="",(U=o._svgPath)==null||U.style.setProperty("stroke","none")}else o._borderForeignObj&&(o._borderForeignObj.style.display="none",(de=o._svgPath)==null||de.style.removeProperty("stroke"));const Be=oe(m);if(s._trigger=o,s._placement={side:_,inside:!!tt,anchor:ft||xt?Tt:"element",anchorRect:Be,point:It},s._dispatched&&Pe(s),!o._observer){const n=new MutationObserver(()=>N());n.observe(o,{attributes:!0,attributeFilter:["data-easy-tooltip","data-easy-tooltip-src","data-easy-tooltip-background","data-easy-tooltip-border","data-easy-tooltip-style"]}),o._observer=n}if(et.add(o),o._source&&!o._sourceObserver){const n=new MutationObserver(()=>N());n.observe(o._source,{childList:!0,subtree:!0,characterData:!0}),o._sourceObserver=n}}}}function ne(t,e=!1){for(;t&&t!==document.body;)t._tooltip&&!t._tooltip._held&&(e||!t.matches(":hover"))&&k(t._tooltip,!1),t=t.parentElement??void 0}let Rt,wt;function dt(t){if(Rt){wt=t;return}Rt=!0,t(),queueMicrotask(()=>{if(Rt=!1,wt){const e=wt;wt=null,dt(e)}})}function N(){dt(re)}function jt(t,e=!1){dt(()=>{ne(V,e),V=t.target??void 0,re()})}let X=0;function ae(t){const e=t.touches[0];return e?(Bt(e.clientX,e.clientY),!0):!1}function le(){const t=B;if(!t)return;B=void 0;const e=t._tooltip;e&&(e._held=!1,t.matches(":hover")||k(e,!1))}document.addEventListener("pointerdown",t=>{var c,g,T;le();let e=t.target;for(;e&&e!==document.body&&!e._tooltip;)e=e.parentElement;if(!(e!=null&&e._tooltip))return;const a=(c=e.closest("[data-easy-tooltip-dismiss]"))==null?void 0:c.getAttribute("data-easy-tooltip-dismiss");if(t.pointerType!=="touch"&&a!==void 0&&a!=="false"){const f=e;f._dismissed=!0,k(f._tooltip,!1),f.addEventListener("pointerleave",()=>f._dismissed=!1,{once:!0});return}const d=e.dataset.easyTooltipHold;d!=="false"&&(d===void 0&&!((T=(g=t.target)==null?void 0:g.closest)!=null&&T.call(g,ve))||(B=e,e._tooltip._held=!0))});for(const t of["pointerup","pointercancel"])window.addEventListener(t,le);document.addEventListener("touchstart",t=>{X=performance.now(),ct=!1,W=!0,F=!1,ae(t),t.target!==V&&jt(t,!0)}),document.addEventListener("touchmove",t=>{X=performance.now(),ae(t)&&ce()}),document.addEventListener("mouseover",t=>{X&&performance.now()-X<700||(ct=!1,W=!0,F=!0,Bt(t.clientX,t.clientY),jt(t))});function ce(){let t;for(const e of et){const a=e.dataset.easyTooltipAnchor;if(Ft(a)!=="cursor"||!e._tooltip)continue;const d=vt(a);t??(t=h.getBoundingClientRect()),d!=="x"&&(e._tooltip.style.top=`${A-t.top}px`),d!=="y"&&(e._tooltip.style.left=`${$-t.left}px`)}Q&&!Ct&&(Ct=!0,requestAnimationFrame(()=>{Ct=!1,N()}))}document.addEventListener("mousemove",t=>{X&&performance.now()-X<700||(F=!0,Bt(t.clientX,t.clientY),ce())}),document.addEventListener("focusin",t=>{if(!(X&&performance.now()-X<700)){if(ct){ct=!1;return}W=!1,F=!1,jt(t)}}),document.addEventListener("focusout",t=>{dt(()=>{t.target&&ne(t.target)})}),window.addEventListener("blur",()=>{B!=null&&B._tooltip&&(B._tooltip._held=!1),B=void 0,ct=document.activeElement!==document.body,dt(()=>{V=void 0;for(const t of et)t._tooltip&&k(t._tooltip,!1)})}),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),visualViewport==null||visualViewport.addEventListener("resize",N),visualViewport==null||visualViewport.addEventListener("scroll",N)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ut):Ut()}});
package/dist/style.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @nkduy/mc-easy-tooltips
3
- * Version : 3.6.0
3
+ * Version : 3.6.1
4
4
  * License : MPL-2.0
5
5
  * Copyright: 2026 NKDuy
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkduy/mc-easy-tooltips",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "A lightweight, zero-dependency tooltip library using modern JavaScript and CSS.",
5
5
  "author": "NKDuy",
6
6
  "license": "MPL-2.0",
@@ -1 +0,0 @@
1
- "use strict";{let ge=function(h){h.style.width="";const z=h.getBoundingClientRect(),I=Math.round(z.height);if(z.width<=0||I<=0)return;const lt=Math.ceil(z.width);h.style.maxWidth="none",h.style.width="max-content";const V=Math.ceil(h.getBoundingClientRect().width);if(h.style.maxWidth="",V<=lt){h.style.width="";return}h.style.minWidth="0",h.style.width="min-content";const W=h.getBoundingClientRect(),F=Math.ceil(W.width),$=Math.round(W.height)<=I;if(h.style.minWidth="",$){h.style.width=`${F}px`;return}let A=F+1,Q=lt+1,S=lt;for(;A<=Q;){const L=Math.floor((A+Q)/2);h.style.width=`${L}px`,Math.round(h.getBoundingClientRect().height)<=I?(S=L,Q=L-1):A=L+1}h.style.width=`${S}px`},Zt=function(){const h=document.createElement("div");h.id="easy-tooltips",document.body.append(h);const z=!!h.showPopover;function I(){if(!(!z||h.matches(":popover-open")))try{h.showPopover()}catch{}}function lt(){if(z){try{h.matches(":popover-open")&&h.hidePopover()}catch{}I()}}z&&(h.popover="manual",I(),h.addEventListener("toggle",t=>{t.newState==="closed"&&requestAnimationFrame(I)}));let V,W,F,$,A,Q,S,L,St,Ct,ct,Ot=0,gt=0,ye=0;const _e=100,ve="input, select, textarea, button, [role=button], [role=slider], [role=checkbox], [role=radio], [role=switch]";let B;function Ut(t){lt(),t._activated=!0,oe(t);const e=t._trigger;if(e&&$!==void 0){const{pin:a,entry:d}=te(e);(a||d)&&(Jt(e,a,d),N())}Ot++,clearTimeout(Ct),h.classList.add("easy-tooltips-active"),t.style.zIndex=String(++ye),$e()}function Kt(t){t._activated&&(t._activated=!1,oe(t),--Ot<=0&&(Ot=0,clearTimeout(Ct),Ct=setTimeout(()=>h.classList.remove("easy-tooltips-active"),bt(getComputedStyle(document.documentElement).getPropertyValue("--easy-tooltip-cooldown")))))}const et=new Set;function be(t){var a,d;const e=t._tooltip;e&&(clearTimeout(e._moveTimer),t===B&&(B=void 0),e._dispatched&&(e._dispatched=!1,vt(e,"close")),e.classList.contains("easy-tooltip-visible")&&gt--,clearTimeout(e._timeout),clearTimeout(e._activateTimer),Kt(e),e.remove()),(a=t._observer)==null||a.disconnect(),(d=t._sourceObserver)==null||d.disconnect(),t._observer=t._sourceObserver=void 0,et.delete(t),t._tooltip=t._tooltipText=t._svgPath=t._clipPath=t._foreignObj=t._surfaceDiv=t._borderMask=t._borderMaskPath=t._borderForeignObj=t._borderSurfaceDiv=t._tooltipClass=t._source=t._anchorPoint=t._anchorSide=void 0,t===V&&(V=void 0)}let kt;new MutationObserver(t=>{kt||!t.some(e=>e.removedNodes.length)||(kt=!0,queueMicrotask(()=>{kt=!1;for(const e of et)e.isConnected||be(e)}))}).observe(document.body,{childList:!0,subtree:!0});let yt;function Gt(){if(yt=0,F&&$!==void 0){const t=document.elementFromPoint($,A);for(const e of et){const a=e._tooltip;a&&!a._held&&a.classList.contains("easy-tooltip-visible")&&e!==t&&!e.contains(t)&&k(a,!1)}}gt>0&&(yt=requestAnimationFrame(Gt))}function $e(){yt||(yt=requestAnimationFrame(Gt))}function _t(t){return t!=null&&t.endsWith("-x")?"x":t!=null&&t.endsWith("-y")?"y":"both"}function Vt(t){return t==null?void 0:t.replace(/-[xy]$/,"")}function Ft(t,e){S=$,L=A,$=t,A=e}function we(t){if(S===void 0)return;const e=$-S,a=A-L;let d,c=1/0;const g=(T,f,w,R,C)=>{f<0||f>1||f>=c||w<R||w>C||(c=f,d=T)};return e>0&&S<t.left&&g("left",(t.left-S)/e,L+a*((t.left-S)/e),t.top,t.bottom),e<0&&S>t.right&&g("right",(t.right-S)/e,L+a*((t.right-S)/e),t.top,t.bottom),a>0&&L<t.top&&g("above",(t.top-L)/a,S+e*((t.top-L)/a),t.left,t.right),a<0&&L>t.bottom&&g("below",(t.bottom-L)/a,S+e*((t.bottom-L)/a),t.left,t.right),d}function Jt(t,e,a){const d=_t(t.dataset.easyTooltipAnchor);if((a||e&&d==="both")&&t._anchorSide===void 0){const f=t.getBoundingClientRect(),w={left:$-f.left,right:f.right-$,above:A-f.top,below:f.bottom-A};t._anchorSide=we(f)??Object.keys(w).reduce((R,C)=>w[C]<w[R]?C:R)}if(!e)return;let c=$,g=A;const T=t._anchorSide;if(T&&d==="both"){const f=t.getBoundingClientRect(),w=(R,C,Z)=>Math.min(Math.max(R,C),Z);c=T==="left"?f.left:T==="right"?f.right:w($,f.left,f.right),g=T==="above"?f.top:T==="below"?f.bottom:w(A,f.top,f.bottom)}t._anchorPoint={x:c+window.scrollX,y:g+window.scrollY}}function te(t){const e=t.dataset.easyTooltipPrefer,a=Vt(t.dataset.easyTooltipAnchor)==="pin"&&W,d=a&&_t(t.dataset.easyTooltipAnchor)==="both";return{preferAttr:e,pin:a,entry:W&&(e==="entry"||!e&&d)}}function ee(t){return{x:t.left,y:t.top,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left}}function vt(t,e,a){var g;const d=t._trigger;if(!d)return;const c=t._placement;c&&(t._reported=c),d.dispatchEvent(new CustomEvent(`easy-tooltip-${e}`,{bubbles:!0,composed:!0,detail:{trigger:d,tooltip:t,text:((g=d._tooltipText)==null?void 0:g.textContent)??"",side:c==null?void 0:c.side,inside:(c==null?void 0:c.inside)??!1,anchor:(c==null?void 0:c.anchor)??"element",anchorRect:c==null?void 0:c.anchorRect,point:c==null?void 0:c.point,rect:ee(t.getBoundingClientRect()),previous:a}}))}function Pe(t){const e=t._reported,a=t._placement;if(!e||!a)return;const d=e.side!==a.side||e.inside!==a.inside||e.anchor!==a.anchor;if(!d&&e.point.x===a.point.x&&e.point.y===a.point.y)return;const c=performance.now(),g=d?0:_e-(c-(t._moveAt??0));if(g<=0){clearTimeout(t._moveTimer),t._moveTimer=void 0,t._moveAt=c,vt(t,"move",e);return}t._moveTimer||(t._moveTimer=setTimeout(()=>{t._moveTimer=void 0,!(!t._dispatched||!t._reported||!t._placement)&&(t._moveAt=performance.now(),vt(t,"move",t._reported))},g))}function oe(t){t._dispatchQueued||(t._dispatchQueued=!0,queueMicrotask(()=>{t._dispatchQueued=!1;const e=!!t._activated;e!==!!t._dispatched&&(t._dispatched=e,clearTimeout(t._moveTimer),t._moveTimer=void 0,t._moveAt=e?performance.now():void 0,vt(t,e?"open":"close"))}))}function bt(t){t=t.trim();const e=parseFloat(t);return t.endsWith("ms")?e:e*1e3}function k(t,e){const a=getComputedStyle(t),d=bt(a.getPropertyValue("--easy-tooltip-animation-length"));if(e){const c=bt(a.getPropertyValue("--easy-tooltip-delay"))+bt(a.getPropertyValue("--easy-tooltip-inactive-delay"));c&&(t._start=performance.now(),t._delay=c),t._animation_duration=d+c}else{if(t._delay&&performance.now()<Number(t._start)+t._delay){t.classList.contains("easy-tooltip-visible")&&gt--,t.classList.remove("easy-tooltip-visible"),t._trigger&&(t._trigger._anchorSide=t._trigger._anchorPoint=void 0),clearTimeout(t._timeout),clearTimeout(t._activateTimer),t._timeout=t._activateTimer=t._start=t._delay=void 0;return}t._animation_duration=d}if(t.classList.contains("easy-tooltip-visible")===e){t._next=void 0;return}t._timeout===void 0?(t._next=void 0,t.classList.toggle("easy-tooltip-visible",e),e&&(t._hold=t._clampArmed=void 0),!e&&t._trigger&&(t._trigger._anchorSide=t._trigger._anchorPoint=void 0),gt+=e?1:-1,clearTimeout(t._activateTimer),t._activateTimer=void 0,e?t._delay?t._activateTimer=setTimeout(()=>{t._activateTimer=void 0,Ut(t)},t._delay):Ut(t):Kt(t),t._timeout=setTimeout(()=>{t._timeout=void 0,t._next!==void 0&&k(t,t._next)},t._animation_duration)):t._next=e}function ie(t){return t.transform!=="none"||t.translate!=="none"||t.rotate!=="none"||t.scale!=="none"||t.perspective!=="none"||t.filter!=="none"||t.backdropFilter!=="none"||/paint|layout|strict|content/.test(t.contain)||/transform|translate|rotate|scale|perspective|filter/.test(t.willChange)}function Ae(t){const e=t.getBoundingClientRect();let a=e.left,d=e.top,c=e.right,g=e.bottom,T=getComputedStyle(t).position,f=t.parentElement;for(;f&&f!==document.body;){const w=getComputedStyle(f);if(T==="fixed"?ie(w):T==="absolute"?w.position!=="static"||ie(w):!0){const C=w.overflowX!=="visible",Z=w.overflowY!=="visible";if(C||Z){const U=f.getBoundingClientRect();C&&(a=Math.max(a,U.left),c=Math.min(c,U.right)),Z&&(d=Math.max(d,U.top),g=Math.min(g,U.bottom))}T=w.position}f=f.parentElement}return{x:a,y:d,left:a,top:d,right:c,bottom:g,width:c-a,height:g-d}}function se(){var t,e,a,d,c,g,T,f,w,R,C,Z,U,ce;if(Q=!1,V){const K=h.getBoundingClientRect();h.style.setProperty("--easy-tooltip-view-width",((visualViewport==null?void 0:visualViewport.width)??document.documentElement.clientWidth)+"px");const ut=[];let u=V;for(;u&&u!==document.body;){if(ut.length)u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1);else if(u._dismissed)u._tooltip&&k(u._tooltip,!1);else if(u.dataset.easyTooltip)(t=u._sourceObserver)==null||t.disconnect(),u._sourceObserver=u._source=void 0,ut.push(u);else if(u.dataset.easyTooltipSrc){const G=u.dataset.easyTooltipSrc,wt=u._source;if(G==="next")u._source=u.nextElementSibling??void 0;else if(G==="prev")u._source=u.previousElementSibling??void 0;else try{u._source=(document.getElementById(G)||document.querySelector(G))??void 0}catch{}wt!==u._source&&u._sourceObserver&&(u._sourceObserver.disconnect(),u._sourceObserver=void 0),u._source?ut.push(u):u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1)}else u._tooltip&&!u._tooltip._held&&k(u._tooltip,!1);u=u.parentElement}for(let G=ut.length;G--;){let wt=function(n,r,l,i,E,y,x){const P=l/2-Y/2-y-Dt,b=i+H,M=i+E-H;let p=0,D=0;return n<b?(p=Math.min(b-n,P),n+p<b&&(D=b-(n+p))):r>M&&(p=-Math.min(r-M,P),r+p>M&&(D=-(r+p-M))),p&&v!==void 0&&(v.style.translate=x?`0 ${p}px`:`${p}px`),qt=D,p},Te=function(n,r,l,i,E,y,x,P,b){const M=E/2,p=b*Math.SQRT1_2;if(n==="above"){const q=b>0?`L${x+p} ${l+y-p}A${b} ${b} 0 0 1 ${x-p} ${l+y-p}`:`L${x} ${l+y}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${x+M}${q}L${x-M} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}if(n==="below"){const q=b>0?`L${x-p} ${-y+p}A${b} ${b} 0 0 1 ${x+p} ${-y+p}`:`L${x} ${-y}`;return`M${i} 0H${x-M}${q}L${x+M} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}if(n==="right"){const q=b>0?`L${-y+p} ${P+p}A${b} ${b} 0 0 1 ${-y+p} ${P-p}`:`L${-y} ${P}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${P+M}${q}L0 ${P-M}V${i}A${i} ${i} 0 0 1 ${i} 0Z`}const D=b>0?`L${r+y-p} ${P-p}A${b} ${b} 0 0 1 ${r+y-p} ${P+p}`:`L${r+y} ${P}`;return`M${i} 0H${r-i}A${i} ${i} 0 0 1 ${r} ${i}V${P-M}${D}L${r} ${P+M}V${l-i}A${i} ${i} 0 0 1 ${r-i} ${l}H${i}A${i} ${i} 0 0 1 0 ${l-i}V${i}A${i} ${i} 0 0 1 ${i} 0Z`};const o=ut[G];let s=o._tooltip,v=o._tooltipText;if(!s||!v){s=document.createElement("div"),s.className="easy-tooltip easy-tooltip-setup",s._trigger=o,o._tooltip=s;const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.classList.add("easy-tooltip-bg"),n.setAttribute("aria-hidden","true");const r=document.createElementNS("http://www.w3.org/2000/svg","defs"),l=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),i="easy-tooltip-clip-"+Math.random().toString(36).substring(2,9);l.id=i;const E=document.createElementNS("http://www.w3.org/2000/svg","path");l.append(E),r.append(l),o._clipPath=E;const y=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");y.setAttribute("clip-path",`url(#${i})`);const x=document.createElement("div");x.className="easy-tooltip-surface",y.append(x),o._foreignObj=y,o._surfaceDiv=x;const P=document.createElementNS("http://www.w3.org/2000/svg","mask"),b="easy-tooltip-mask-"+Math.random().toString(36).substring(2,9);P.id=b,P.setAttribute("maskUnits","userSpaceOnUse");const M=document.createElementNS("http://www.w3.org/2000/svg","path");P.append(M),r.append(P),o._borderMask=P,o._borderMaskPath=M;const p=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");p.setAttribute("mask",`url(#${b})`);const D=document.createElement("div");D.className="easy-tooltip-surface",p.append(D),o._borderForeignObj=p,o._borderSurfaceDiv=D;const q=document.createElementNS("http://www.w3.org/2000/svg","path");o._svgPath=q,n.append(r,y,q,p),v=document.createElement("div"),v.className="easy-tooltip-text",o._tooltipText=v,s.append(n,v),h.append(s)}const de=s.style.zIndex;s.style.cssText=o.dataset.easyTooltipStyle??"",de&&(s.style.zIndex=de);const Pt=o.dataset.easyTooltipClass;o._tooltipClass!==Pt&&(o._tooltipClass&&s.classList.remove(...o._tooltipClass.trim().split(/\s+/)),Pt&&s.classList.add(...Pt.trim().split(/\s+/)),o._tooltipClass=Pt),o._source?(v.replaceChildren(...o._source.cloneNode(!0).childNodes),v.classList.add("easy-tooltip-text-html")):(v.textContent=o.dataset.easyTooltip??null,v.classList.remove("easy-tooltip-text-html"));const At=o.dataset.easyTooltipAnchor,J=_t(At),ft=Vt(At)==="cursor"&&W,{preferAttr:xe,pin:Tt,entry:jt}=te(o);ft&&(Q=!0);const Me=(n,r,l)=>Math.min(Math.max(n,r),l),Le=(n,r)=>At?r:((!s._hold||s._hold.axis!==n)&&(s._hold={axis:n,pos:r}),s._hold.pos);(Tt||jt)&&!s._activated&&o._anchorSide===void 0&&o._anchorPoint===void 0&&Jt(o,Tt,jt);let m;if(ft||Tt&&o._anchorPoint){const n=ft?$:o._anchorPoint.x-window.scrollX,r=ft?A:o._anchorPoint.y-window.scrollY,l=J==="both"?null:o.getBoundingClientRect();m={left:J==="y"?l.left:n,right:J==="y"?l.right:n,width:J==="y"?l.width:0,top:J==="x"?l.top:r,bottom:J==="x"?l.bottom:r,height:J==="x"?l.height:0}}else m=Ae(o);const j=getComputedStyle(s),ot=parseFloat(j.getPropertyValue("--easy-tooltip-distance")),H=parseFloat(j.getPropertyValue("--easy-tooltip-viewport-padding")),Wt=j.getPropertyValue("--easy-tooltip-arrow-size").trim().split(/\s+/),Y=parseFloat(Wt[0]),xt=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-x")),Ht=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-edge-buffer-y")),Dt=parseFloat(j.getPropertyValue("--easy-tooltip-border-radius"))||0;s.style.minWidth=`${xt*2+Y}px`,v.style.minHeight="";const Mt=Math.min(Dt,v.getBoundingClientRect().height/2);s.style.minWidth=`${xt*2+Y+Mt*2}px`;const pt=K.left+((visualViewport==null?void 0:visualViewport.offsetLeft)??0),Nt=K.top+((visualViewport==null?void 0:visualViewport.offsetTop)??0),Xt=(visualViewport==null?void 0:visualViewport.width)??document.documentElement.clientWidth,Yt=(visualViewport==null?void 0:visualViewport.height)??document.documentElement.clientHeight,it=jt?o._anchorSide:xe,ue=Math.round(m.right-pt+ot-H),fe=Math.round(pt+Xt-m.left+ot-H);s.style.translate="",s.style.removeProperty("--easy-tooltip-left-offset"),s.style.removeProperty("--easy-tooltip-right-offset"),v.style.translate="",v.style.width="",s.classList.remove("easy-tooltip-below","easy-tooltip-inside","easy-tooltip-left","easy-tooltip-right");let _,tt;if(it==="left"||it==="right"){s.style.minWidth=`${Mt*2}px`,v.style.width="min-content",v.style.minWidth="0";const n=s.getBoundingClientRect().width;v.style.width="",v.style.minWidth="";for(const r of[it,it==="left"?"right":"left"])if(!((r==="left"?m.left-pt-ot-H:pt+Xt-m.right-ot-H)<n)&&(s.classList.remove("easy-tooltip-left","easy-tooltip-right"),s.classList.add("easy-tooltip-"+r),r==="right"?(s.style.setProperty("--easy-tooltip-left-offset",`${ue}px`),s.style.removeProperty("--easy-tooltip-right-offset")):(s.style.setProperty("--easy-tooltip-right-offset",`${fe}px`),s.style.removeProperty("--easy-tooltip-left-offset")),s.getBoundingClientRect().height<=Yt-H*2)){_=r;break}_||(_=it,tt=!0)}else{const{height:n}=s.getBoundingClientRect(),r=Math.round(m.top),l=r-n-ot>Nt+H,i=r+m.height+n+ot<Nt+Yt-H;it==="below"?_=i?"below":l?"above":"below":_=l?"above":i?"below":"above",tt=!l&&!i}s.classList.remove("easy-tooltip-below","easy-tooltip-inside","easy-tooltip-left","easy-tooltip-right"),s.style.removeProperty("--easy-tooltip-left-offset"),s.style.removeProperty("--easy-tooltip-right-offset"),s.style.top="",s.style.left="",_!=="above"&&s.classList.add("easy-tooltip-"+_),tt&&s.classList.add("easy-tooltip-inside"),tt||(_==="right"?s.style.setProperty("--easy-tooltip-left-offset",`${ue}px`):_==="left"&&s.style.setProperty("--easy-tooltip-right-offset",`${fe}px`)),ge(v),s.classList.remove("easy-tooltip-setup");let pe=!0;if(F&&$!==void 0){const n=document.elementFromPoint($,A);pe=!!n&&(o===n||o.contains(n))}k(s,pe||!!s._held),_==="left"||_==="right"?v.style.minHeight=`${Ht*2+Y+Mt*2}px`:v.style.minHeight=`${Mt*2}px`;let O,qt=0,zt;const Ee=F&&$!==void 0,Se=!!s._held||!Ee||$>=m.left&&$<=m.right&&A>=m.top&&A<=m.bottom,he=(n,r,l,i)=>{const E=Le(n,r);if(!Se)return E;const y=Me(E,l,i);return y===E?(s._clampArmed=!1,E):s._clampArmed?(s._hold&&(s._hold.pos=y),y):(s._clampArmed=!0,E)};if(_==="left"||_==="right"){const n=Math.round(he("y",m.top+m.height/2,m.top,m.bottom));zt={x:Math.round(_==="right"?m.right:m.left),y:n},tt||(s.style.left=`${Math.round(_==="right"?m.right:m.left)-K.left}px`);const r=s.getBoundingClientRect().height;O=wt(n-r/2,n+r/2,r,Nt,Yt,Ht,!0),s.style.top=`${n-K.top+qt}px`}else{const n=Math.round(he("x",m.left+m.width/2,m.left,m.right)),r=Math.round(m.top);zt={x:n,y:Math.round(_==="below"?m.bottom:m.top)},tt||(s.style.top=_==="above"?`${r-K.top}px`:`${r+m.height-K.top}px`);const l=s.getBoundingClientRect().width;O=wt(n-l/2,n+l/2,l,pt,Xt,xt,!1),s.style.left=`${n-K.left+qt}px`}const{width:st,height:rt}=v.getBoundingClientRect(),ht=Wt[1]?parseFloat(Wt[1]):Y/2,Ce=parseFloat(j.getPropertyValue("--easy-tooltip-arrow-radius"))||0,mt=_==="left"||_==="right",Oe=mt?st/2:st/2-O,ke=mt?rt/2-O:rt/2,Ve=mt?(rt-Y-Ht*2)/2:(st-Y-xt*2)/2,Fe=Math.max(0,Math.min(Dt,st/2,rt/2,Ve)),It=Te(_,st,rt,Fe,Y,ht,Oe,ke,Ce);if((e=o._svgPath)==null||e.setAttribute("d",It),(a=o._clipPath)==null||a.setAttribute("d",It),(d=o._borderMaskPath)==null||d.setAttribute("d",It),O){const n=mt?`translate(0 ${O})`:`translate(${O} 0)`;(c=o._svgPath)==null||c.setAttribute("transform",n),(g=o._clipPath)==null||g.setAttribute("transform",n),(T=o._borderMaskPath)==null||T.setAttribute("transform",n)}else(f=o._svgPath)==null||f.removeAttribute("transform"),(w=o._clipPath)==null||w.removeAttribute("transform"),(R=o._borderMaskPath)==null||R.removeAttribute("transform");const me=o.dataset.easyTooltipBackground||j.getPropertyValue("--easy-tooltip-background").trim(),Qt=o.dataset.easyTooltipBorder||j.getPropertyValue("--easy-tooltip-border").trim();let nt=0,Lt=st,at=0,Et=rt;if(_==="left"?Lt+=ht:_==="right"?nt-=ht:_==="above"?Et+=ht:_==="below"&&(at-=ht),O&&(mt?(at+=Math.min(0,O),Et+=Math.max(0,O)):(nt+=Math.min(0,O),Lt+=Math.max(0,O))),me&&o._surfaceDiv&&o._foreignObj?(o._foreignObj.setAttribute("x",`${nt}`),o._foreignObj.setAttribute("y",`${at}`),o._foreignObj.setAttribute("width",`${Lt-nt}`),o._foreignObj.setAttribute("height",`${Et-at}`),o._surfaceDiv.style.width="100%",o._surfaceDiv.style.height="100%",o._surfaceDiv.style.background=me,o._foreignObj.style.display="",(C=o._svgPath)==null||C.style.setProperty("fill","none")):o._foreignObj&&(o._foreignObj.style.display="none",(Z=o._svgPath)==null||Z.style.removeProperty("fill")),Qt&&Qt!=="none"&&o._borderMask&&o._borderSurfaceDiv&&o._borderForeignObj){const r=(parseFloat(j.getPropertyValue("--easy-tooltip-border-size"))||0)*2,l=nt-r,i=at-r,E=Lt-nt+r*2,y=Et-at+r*2;o._borderMask.setAttribute("x",`${l}`),o._borderMask.setAttribute("y",`${i}`),o._borderMask.setAttribute("width",`${E}`),o._borderMask.setAttribute("height",`${y}`),o._borderForeignObj.setAttribute("x",`${l}`),o._borderForeignObj.setAttribute("y",`${i}`),o._borderForeignObj.setAttribute("width",`${E}`),o._borderForeignObj.setAttribute("height",`${y}`),o._borderSurfaceDiv.style.width="100%",o._borderSurfaceDiv.style.height="100%",o._borderSurfaceDiv.style.background=Qt,o._borderForeignObj.style.display="",(U=o._svgPath)==null||U.style.setProperty("stroke","none")}else o._borderForeignObj&&(o._borderForeignObj.style.display="none",(ce=o._svgPath)==null||ce.style.removeProperty("stroke"));const Be=ee(m);if(s._trigger=o,s._placement={side:_,inside:!!tt,anchor:ft||Tt?At:"element",anchorRect:Be,point:zt},s._dispatched&&Pe(s),!o._observer){const n=new MutationObserver(()=>N());n.observe(o,{attributes:!0,attributeFilter:["data-easy-tooltip","data-easy-tooltip-src","data-easy-tooltip-background","data-easy-tooltip-border","data-easy-tooltip-style"]}),o._observer=n}if(et.add(o),o._source&&!o._sourceObserver){const n=new MutationObserver(()=>N());n.observe(o._source,{childList:!0,subtree:!0,characterData:!0}),o._sourceObserver=n}}}}function re(t,e=!1){for(;t&&t!==document.body;)t._tooltip&&!t._tooltip._held&&(e||!t.matches(":hover"))&&k(t._tooltip,!1),t=t.parentElement??void 0}let Bt,$t;function dt(t){if(Bt){$t=t;return}Bt=!0,t(),queueMicrotask(()=>{if(Bt=!1,$t){const e=$t;$t=null,dt(e)}})}function N(){dt(se)}function Rt(t,e=!1){dt(()=>{re(V,e),V=t.target??void 0,se()})}let X=0;function ne(t){const e=t.touches[0];return e?(Ft(e.clientX,e.clientY),!0):!1}function ae(){const t=B;if(!t)return;B=void 0;const e=t._tooltip;e&&(e._held=!1,t.matches(":hover")||k(e,!1))}document.addEventListener("pointerdown",t=>{var c,g,T;ae();let e=t.target;for(;e&&e!==document.body&&!e._tooltip;)e=e.parentElement;if(!(e!=null&&e._tooltip))return;const a=(c=e.closest("[data-easy-tooltip-dismiss]"))==null?void 0:c.getAttribute("data-easy-tooltip-dismiss");if(t.pointerType!=="touch"&&a!==void 0&&a!=="false"){const f=e;f._dismissed=!0,k(f._tooltip,!1),f.addEventListener("pointerleave",()=>f._dismissed=!1,{once:!0});return}const d=e.dataset.easyTooltipHold;d!=="false"&&(d===void 0&&!((T=(g=t.target)==null?void 0:g.closest)!=null&&T.call(g,ve))||(B=e,e._tooltip._held=!0))});for(const t of["pointerup","pointercancel"])window.addEventListener(t,ae);document.addEventListener("touchstart",t=>{X=performance.now(),ct=!1,W=!0,F=!1,ne(t),t.target!==V&&Rt(t,!0)}),document.addEventListener("touchmove",t=>{X=performance.now(),ne(t)&&le()}),document.addEventListener("mouseover",t=>{X&&performance.now()-X<700||(ct=!1,W=!0,F=!0,Ft(t.clientX,t.clientY),Rt(t))});function le(){let t;for(const e of et){const a=e.dataset.easyTooltipAnchor;if(Vt(a)!=="cursor"||!e._tooltip)continue;const d=_t(a);t??(t=h.getBoundingClientRect()),d!=="x"&&(e._tooltip.style.top=`${A-t.top}px`),d!=="y"&&(e._tooltip.style.left=`${$-t.left}px`)}Q&&!St&&(St=!0,requestAnimationFrame(()=>{St=!1,N()}))}document.addEventListener("mousemove",t=>{X&&performance.now()-X<700||(F=!0,Ft(t.clientX,t.clientY),le())}),document.addEventListener("focusin",t=>{if(!(X&&performance.now()-X<700)){if(ct){ct=!1;return}W=!1,F=!1,Rt(t)}}),document.addEventListener("focusout",t=>{dt(()=>{t.target&&re(t.target)})}),window.addEventListener("blur",()=>{B!=null&&B._tooltip&&(B._tooltip._held=!1),B=void 0,ct=document.activeElement!==document.body,dt(()=>{V=void 0;for(const t of et)t._tooltip&&k(t._tooltip,!1)})}),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),visualViewport==null||visualViewport.addEventListener("resize",N),visualViewport==null||visualViewport.addEventListener("scroll",N)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Zt):Zt()}