@opentiny/tiny-robot 0.5.2-beta.0 → 0.5.2-rc.0

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.
@@ -1,970 +0,0 @@
1
- const X = Math.min, D = Math.max, Q = Math.round, J = Math.floor, P = (t) => ({
2
- x: t,
3
- y: t
4
- }), Mt = {
5
- left: "right",
6
- right: "left",
7
- bottom: "top",
8
- top: "bottom"
9
- };
10
- function Nt(t, e, n) {
11
- return D(t, X(e, n));
12
- }
13
- function U(t, e) {
14
- return typeof t == "function" ? t(e) : t;
15
- }
16
- function B(t) {
17
- return t.split("-")[0];
18
- }
19
- function G(t) {
20
- return t.split("-")[1];
21
- }
22
- function At(t) {
23
- return t === "x" ? "y" : "x";
24
- }
25
- function Ct(t) {
26
- return t === "y" ? "height" : "width";
27
- }
28
- function T(t) {
29
- const e = t[0];
30
- return e === "t" || e === "b" ? "y" : "x";
31
- }
32
- function Ot(t) {
33
- return At(T(t));
34
- }
35
- function Vt(t, e, n) {
36
- n === void 0 && (n = !1);
37
- const o = G(t), i = Ot(t), s = Ct(i);
38
- let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
39
- return e.reference[s] > e.floating[s] && (r = Z(r)), [r, Z(r)];
40
- }
41
- function kt(t) {
42
- const e = Z(t);
43
- return [ft(t), e, ft(e)];
44
- }
45
- function ft(t) {
46
- return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
47
- }
48
- const wt = ["left", "right"], xt = ["right", "left"], _t = ["top", "bottom"], $t = ["bottom", "top"];
49
- function Bt(t, e, n) {
50
- switch (t) {
51
- case "top":
52
- case "bottom":
53
- return n ? e ? xt : wt : e ? wt : xt;
54
- case "left":
55
- case "right":
56
- return e ? _t : $t;
57
- default:
58
- return [];
59
- }
60
- }
61
- function Ht(t, e, n, o) {
62
- const i = G(t);
63
- let s = Bt(B(t), n === "start", o);
64
- return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(ft)))), s;
65
- }
66
- function Z(t) {
67
- const e = B(t);
68
- return Mt[e] + t.slice(e.length);
69
- }
70
- function zt(t) {
71
- var e, n, o, i;
72
- return {
73
- top: (e = t.top) != null ? e : 0,
74
- right: (n = t.right) != null ? n : 0,
75
- bottom: (o = t.bottom) != null ? o : 0,
76
- left: (i = t.left) != null ? i : 0
77
- };
78
- }
79
- function It(t) {
80
- return typeof t != "number" ? zt(t) : {
81
- top: t,
82
- right: t,
83
- bottom: t,
84
- left: t
85
- };
86
- }
87
- function tt(t) {
88
- const {
89
- x: e,
90
- y: n,
91
- width: o,
92
- height: i
93
- } = t;
94
- return {
95
- width: o,
96
- height: i,
97
- top: n,
98
- left: e,
99
- right: e + o,
100
- bottom: n + i,
101
- x: e,
102
- y: n
103
- };
104
- }
105
- function yt(t, e, n) {
106
- let {
107
- reference: o,
108
- floating: i
109
- } = t;
110
- const s = T(e), r = Ot(e), c = Ct(r), l = B(e), f = s === "y", u = o.x + o.width / 2 - i.width / 2, d = o.y + o.height / 2 - i.height / 2, h = o[c] / 2 - i[c] / 2;
111
- let a;
112
- switch (l) {
113
- case "top":
114
- a = {
115
- x: u,
116
- y: o.y - i.height
117
- };
118
- break;
119
- case "bottom":
120
- a = {
121
- x: u,
122
- y: o.y + o.height
123
- };
124
- break;
125
- case "right":
126
- a = {
127
- x: o.x + o.width,
128
- y: d
129
- };
130
- break;
131
- case "left":
132
- a = {
133
- x: o.x - i.width,
134
- y: d
135
- };
136
- break;
137
- default:
138
- a = {
139
- x: o.x,
140
- y: o.y
141
- };
142
- }
143
- const m = G(e);
144
- return m && (a[r] += h * (m === "end" ? 1 : -1) * (n && f ? -1 : 1)), a;
145
- }
146
- async function Xt(t, e) {
147
- var n;
148
- e === void 0 && (e = {});
149
- const {
150
- x: o,
151
- y: i,
152
- platform: s,
153
- rects: r,
154
- elements: c,
155
- strategy: l
156
- } = t, {
157
- boundary: f = "clippingAncestors",
158
- rootBoundary: u = "viewport",
159
- elementContext: d = "floating",
160
- altBoundary: h = !1,
161
- padding: a = 0
162
- } = U(e, t), m = It(a), w = c[h ? d === "floating" ? "reference" : "floating" : d], g = tt(await s.getClippingRect({
163
- element: (n = await (s.isElement == null ? void 0 : s.isElement(w))) == null || n ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
164
- boundary: f,
165
- rootBoundary: u,
166
- strategy: l
167
- })), x = d === "floating" ? {
168
- x: o,
169
- y: i,
170
- width: r.floating.width,
171
- height: r.floating.height
172
- } : r.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), v = await (s.isElement == null ? void 0 : s.isElement(y)) && await (s.getScale == null ? void 0 : s.getScale(y)) || {
173
- x: 1,
174
- y: 1
175
- }, A = tt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
176
- elements: c,
177
- rect: x,
178
- offsetParent: y,
179
- strategy: l
180
- }) : x);
181
- return {
182
- top: (g.top - A.top + m.top) / v.y,
183
- bottom: (A.bottom - g.bottom + m.bottom) / v.y,
184
- left: (g.left - A.left + m.left) / v.x,
185
- right: (A.right - g.right + m.right) / v.x
186
- };
187
- }
188
- const jt = 50, Yt = async (t, e, n) => {
189
- const {
190
- placement: o = "bottom",
191
- strategy: i = "absolute",
192
- middleware: s = [],
193
- platform: r
194
- } = n, c = r.detectOverflow ? r : {
195
- ...r,
196
- detectOverflow: Xt
197
- }, l = await (r.isRTL == null ? void 0 : r.isRTL(e));
198
- let f = await r.getElementRects({
199
- reference: t,
200
- floating: e,
201
- strategy: i
202
- }), {
203
- x: u,
204
- y: d
205
- } = yt(f, o, l), h = o, a = 0;
206
- const m = {};
207
- for (let p = 0; p < s.length; p++) {
208
- const w = s[p];
209
- if (!w)
210
- continue;
211
- const {
212
- name: g,
213
- fn: x
214
- } = w, {
215
- x: y,
216
- y: v,
217
- data: A,
218
- reset: b
219
- } = await x({
220
- x: u,
221
- y: d,
222
- initialPlacement: o,
223
- placement: h,
224
- strategy: i,
225
- middlewareData: m,
226
- rects: f,
227
- platform: c,
228
- elements: {
229
- reference: t,
230
- floating: e
231
- }
232
- });
233
- u = y ?? u, d = v ?? d, m[g] = {
234
- ...m[g],
235
- ...A
236
- }, b && a < jt && (a++, typeof b == "object" && (b.placement && (h = b.placement), b.rects && (f = b.rects === !0 ? await r.getElementRects({
237
- reference: t,
238
- floating: e,
239
- strategy: i
240
- }) : b.rects), {
241
- x: u,
242
- y: d
243
- } = yt(f, h, l)), p = -1);
244
- }
245
- return {
246
- x: u,
247
- y: d,
248
- placement: h,
249
- strategy: i,
250
- middlewareData: m
251
- };
252
- }, qt = function(t) {
253
- return t === void 0 && (t = {}), {
254
- name: "flip",
255
- options: t,
256
- async fn(e) {
257
- var n, o;
258
- const {
259
- placement: i,
260
- middlewareData: s,
261
- rects: r,
262
- initialPlacement: c,
263
- platform: l,
264
- elements: f
265
- } = e, {
266
- mainAxis: u = !0,
267
- crossAxis: d = !0,
268
- fallbackPlacements: h,
269
- fallbackStrategy: a = "bestFit",
270
- fallbackAxisSideDirection: m = "none",
271
- flipAlignment: p = !0,
272
- ...w
273
- } = U(t, e);
274
- if ((n = s.arrow) != null && n.alignmentOffset)
275
- return {};
276
- const g = B(i), x = T(c), y = B(c) === c, v = await (l.isRTL == null ? void 0 : l.isRTL(f.floating)), A = h || (y || !p ? [Z(c)] : kt(c)), b = m !== "none";
277
- !h && b && A.push(...Ht(c, p, m, v));
278
- const W = [c, ...A], S = await l.detectOverflow(e, w), V = [];
279
- let O = ((o = s.flip) == null ? void 0 : o.overflows) || [];
280
- if (u && V.push(S[g]), d) {
281
- const k = Vt(i, r, v);
282
- V.push(S[k[0]], S[k[1]]);
283
- }
284
- if (O = [...O, {
285
- placement: i,
286
- overflows: V
287
- }], !V.every((k) => k <= 0)) {
288
- var mt, gt;
289
- const k = (((mt = s.flip) == null ? void 0 : mt.index) || 0) + 1, rt = W[k];
290
- if (rt && (!(d === "alignment" ? x !== T(rt) : !1) || // We leave the current main axis only if every placement on that axis
291
- // overflows the main axis.
292
- O.every((C) => T(C.placement) === x ? C.overflows[0] > 0 : !0)))
293
- return {
294
- data: {
295
- index: k,
296
- overflows: O
297
- },
298
- reset: {
299
- placement: rt
300
- }
301
- };
302
- let Y = (gt = O.filter((_) => _.overflows[0] <= 0).sort((_, C) => _.overflows[1] - C.overflows[1])[0]) == null ? void 0 : gt.placement;
303
- if (!Y)
304
- switch (a) {
305
- case "bestFit": {
306
- var pt;
307
- const _ = (pt = O.filter((C) => {
308
- if (b) {
309
- const M = T(C.placement);
310
- return M === x || // Create a bias to the `y` side axis due to horizontal
311
- // reading directions favoring greater width.
312
- M === "y";
313
- }
314
- return !0;
315
- }).map((C) => [C.placement, C.overflows.filter((M) => M > 0).reduce((M, Wt) => M + Wt, 0)]).sort((C, M) => C[1] - M[1])[0]) == null ? void 0 : pt[0];
316
- _ && (Y = _);
317
- break;
318
- }
319
- case "initialPlacement":
320
- Y = c;
321
- break;
322
- }
323
- if (i !== Y)
324
- return {
325
- reset: {
326
- placement: Y
327
- }
328
- };
329
- }
330
- return {};
331
- }
332
- };
333
- }, Kt = /* @__PURE__ */ new Set(["left", "top"]);
334
- async function Ut(t, e) {
335
- const {
336
- placement: n,
337
- platform: o,
338
- elements: i
339
- } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = B(n), c = G(n), l = T(n) === "y", f = Kt.has(r) ? -1 : 1, u = s && l ? -1 : 1, d = U(e, t);
340
- let {
341
- mainAxis: h,
342
- crossAxis: a,
343
- alignmentAxis: m
344
- } = typeof d == "number" ? {
345
- mainAxis: d,
346
- crossAxis: 0,
347
- alignmentAxis: null
348
- } : {
349
- mainAxis: d.mainAxis || 0,
350
- crossAxis: d.crossAxis || 0,
351
- alignmentAxis: d.alignmentAxis
352
- };
353
- return c && typeof m == "number" && (a = c === "end" ? m * -1 : m), l ? {
354
- x: a * u,
355
- y: h * f
356
- } : {
357
- x: h * f,
358
- y: a * u
359
- };
360
- }
361
- const Gt = function(t) {
362
- return t === void 0 && (t = 0), {
363
- name: "offset",
364
- options: t,
365
- async fn(e) {
366
- var n, o;
367
- const {
368
- x: i,
369
- y: s,
370
- placement: r,
371
- middlewareData: c
372
- } = e, l = await Ut(e, t);
373
- return r === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
374
- x: i + l.x,
375
- y: s + l.y,
376
- data: {
377
- ...l,
378
- placement: r
379
- }
380
- };
381
- }
382
- };
383
- }, Jt = function(t) {
384
- return t === void 0 && (t = {}), {
385
- name: "shift",
386
- options: t,
387
- async fn(e) {
388
- const {
389
- x: n,
390
- y: o,
391
- placement: i,
392
- platform: s
393
- } = e, {
394
- mainAxis: r = !0,
395
- crossAxis: c = !1,
396
- limiter: l = {
397
- fn: (x) => {
398
- let {
399
- x: y,
400
- y: v
401
- } = x;
402
- return {
403
- x: y,
404
- y: v
405
- };
406
- }
407
- },
408
- ...f
409
- } = U(t, e), u = {
410
- x: n,
411
- y: o
412
- }, d = await s.detectOverflow(e, f), h = T(i), a = At(h);
413
- let m = u[a], p = u[h];
414
- const w = (x, y) => Nt(y + d[x === "y" ? "top" : "left"], y, y - d[x === "y" ? "bottom" : "right"]);
415
- r && (m = w(a, m)), c && (p = w(h, p));
416
- const g = l.fn({
417
- ...e,
418
- [a]: m,
419
- [h]: p
420
- });
421
- return {
422
- ...g,
423
- data: {
424
- x: g.x - n,
425
- y: g.y - o,
426
- enabled: {
427
- [a]: r,
428
- [h]: c
429
- }
430
- }
431
- };
432
- }
433
- };
434
- }, Qt = function(t) {
435
- return t === void 0 && (t = {}), {
436
- name: "size",
437
- options: t,
438
- async fn(e) {
439
- const {
440
- placement: n,
441
- rects: o,
442
- platform: i,
443
- elements: s
444
- } = e, {
445
- apply: r = () => {
446
- },
447
- ...c
448
- } = U(t, e), l = await i.detectOverflow(e, c), f = B(n), u = G(n), d = T(n) === "y", {
449
- width: h,
450
- height: a
451
- } = o.floating;
452
- let m, p;
453
- f === "top" || f === "bottom" ? (m = f, p = u === (await (i.isRTL == null ? void 0 : i.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (p = f, m = u === "end" ? "top" : "bottom");
454
- const w = a - l.top - l.bottom, g = h - l.left - l.right, x = X(a - l[m], w), y = X(h - l[p], g), v = e.middlewareData.shift, A = !v;
455
- let b = x, W = y;
456
- v != null && v.enabled.x && (W = g), v != null && v.enabled.y && (b = w), A && !u && (d ? W = h - 2 * D(l.left, l.right) : b = a - 2 * D(l.top, l.bottom)), await r({
457
- ...e,
458
- availableWidth: W,
459
- availableHeight: b
460
- });
461
- const S = await i.getDimensions(s.floating);
462
- return h !== S.width || a !== S.height ? {
463
- reset: {
464
- rects: !0
465
- }
466
- } : {};
467
- }
468
- };
469
- };
470
- function et() {
471
- return typeof window < "u";
472
- }
473
- function j(t) {
474
- return Lt(t) ? (t.nodeName || "").toLowerCase() : "#document";
475
- }
476
- function R(t) {
477
- var e;
478
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
479
- }
480
- function F(t) {
481
- var e;
482
- return (e = (Lt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
483
- }
484
- function Lt(t) {
485
- return et() ? t instanceof Node || t instanceof R(t).Node : !1;
486
- }
487
- function L(t) {
488
- return et() ? t instanceof Element || t instanceof R(t).Element : !1;
489
- }
490
- function N(t) {
491
- return et() ? t instanceof HTMLElement || t instanceof R(t).HTMLElement : !1;
492
- }
493
- function vt(t) {
494
- return !et() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof R(t).ShadowRoot;
495
- }
496
- function nt(t) {
497
- const {
498
- overflow: e,
499
- overflowX: n,
500
- overflowY: o,
501
- display: i
502
- } = E(t);
503
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && i !== "inline" && i !== "contents";
504
- }
505
- function Zt(t) {
506
- return /^(table|td|th)$/.test(j(t));
507
- }
508
- function ot(t) {
509
- try {
510
- if (t.matches(":popover-open"))
511
- return !0;
512
- } catch {
513
- }
514
- try {
515
- return t.matches(":modal");
516
- } catch {
517
- return !1;
518
- }
519
- }
520
- const te = /transform|translate|scale|rotate|perspective|filter/, ee = /paint|layout|strict|content/, $ = (t) => !!t && t !== "none";
521
- let ct;
522
- function ut(t) {
523
- const e = L(t) ? E(t) : t;
524
- return $(e.transform) || $(e.translate) || $(e.scale) || $(e.rotate) || $(e.perspective) || !dt() && ($(e.backdropFilter) || $(e.filter)) || te.test(e.willChange || "") || ee.test(e.contain || "");
525
- }
526
- function ne(t) {
527
- let e = H(t);
528
- for (; N(e) && !q(e); ) {
529
- if (ut(e))
530
- return e;
531
- if (ot(e))
532
- return null;
533
- e = H(e);
534
- }
535
- return null;
536
- }
537
- function dt() {
538
- return ct == null && (ct = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), ct;
539
- }
540
- function q(t) {
541
- return /^(html|body|#document)$/.test(j(t));
542
- }
543
- function E(t) {
544
- return R(t).getComputedStyle(t);
545
- }
546
- function it(t) {
547
- return L(t) ? {
548
- scrollLeft: t.scrollLeft,
549
- scrollTop: t.scrollTop
550
- } : {
551
- scrollLeft: t.scrollX,
552
- scrollTop: t.scrollY
553
- };
554
- }
555
- function H(t) {
556
- if (j(t) === "html")
557
- return t;
558
- const e = (
559
- // Step into the shadow DOM of the parent of a slotted node.
560
- t.assignedSlot || // DOM Element detected.
561
- t.parentNode || // ShadowRoot detected.
562
- vt(t) && t.host || // Fallback.
563
- F(t)
564
- );
565
- return vt(e) ? e.host : e;
566
- }
567
- function Et(t) {
568
- const e = H(t);
569
- return q(e) ? (t.ownerDocument || t).body : N(e) && nt(e) ? e : Et(e);
570
- }
571
- function K(t, e, n) {
572
- var o;
573
- e === void 0 && (e = []), n === void 0 && (n = !0);
574
- const i = Et(t), s = i === ((o = t.ownerDocument) == null ? void 0 : o.body), r = R(i);
575
- if (s) {
576
- const c = at(r);
577
- return e.concat(r, r.visualViewport || [], nt(i) ? i : [], c && n ? K(c) : []);
578
- } else
579
- return e.concat(i, K(i, [], n));
580
- }
581
- function at(t) {
582
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
583
- }
584
- function St(t) {
585
- const e = E(t);
586
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
587
- const i = N(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, c = Q(n) !== s || Q(o) !== r;
588
- return c && (n = s, o = r), {
589
- width: n,
590
- height: o,
591
- $: c
592
- };
593
- }
594
- function ht(t) {
595
- return L(t) ? t : t.contextElement;
596
- }
597
- function I(t) {
598
- const e = ht(t);
599
- if (!N(e))
600
- return P(1);
601
- const n = e.getBoundingClientRect(), {
602
- width: o,
603
- height: i,
604
- $: s
605
- } = St(e);
606
- let r = (s ? Q(n.width) : n.width) / o, c = (s ? Q(n.height) : n.height) / i;
607
- return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
608
- x: r,
609
- y: c
610
- };
611
- }
612
- const oe = /* @__PURE__ */ P(0);
613
- function Tt(t) {
614
- const e = R(t);
615
- return !dt() || !e.visualViewport ? oe : {
616
- x: e.visualViewport.offsetLeft,
617
- y: e.visualViewport.offsetTop
618
- };
619
- }
620
- function ie(t, e, n) {
621
- return e === void 0 && (e = !1), !!n && e && n === R(t);
622
- }
623
- function z(t, e, n, o) {
624
- e === void 0 && (e = !1), n === void 0 && (n = !1);
625
- const i = t.getBoundingClientRect(), s = ht(t);
626
- let r = P(1);
627
- e && (o ? L(o) && (r = I(o)) : r = I(t));
628
- const c = ie(s, n, o) ? Tt(s) : P(0);
629
- let l = (i.left + c.x) / r.x, f = (i.top + c.y) / r.y, u = i.width / r.x, d = i.height / r.y;
630
- if (s && o) {
631
- const h = R(s), a = L(o) ? R(o) : o;
632
- let m = h, p = at(m);
633
- for (; p && a !== m; ) {
634
- const w = I(p), g = p.getBoundingClientRect(), x = E(p), y = g.left + (p.clientLeft + parseFloat(x.paddingLeft)) * w.x, v = g.top + (p.clientTop + parseFloat(x.paddingTop)) * w.y;
635
- l *= w.x, f *= w.y, u *= w.x, d *= w.y, l += y, f += v, m = R(p), p = at(m);
636
- }
637
- }
638
- return tt({
639
- width: u,
640
- height: d,
641
- x: l,
642
- y: f
643
- });
644
- }
645
- function st(t, e) {
646
- const n = it(t).scrollLeft;
647
- return e ? e.left + n : z(F(t)).left + n;
648
- }
649
- function Dt(t, e) {
650
- const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - st(t, n), i = n.top + e.scrollTop;
651
- return {
652
- x: o,
653
- y: i
654
- };
655
- }
656
- function se(t) {
657
- let {
658
- elements: e,
659
- rect: n,
660
- offsetParent: o,
661
- strategy: i
662
- } = t;
663
- const s = i === "fixed", r = F(o), c = e ? ot(e.floating) : !1;
664
- if (o === r || c && s)
665
- return n;
666
- let l = {
667
- scrollLeft: 0,
668
- scrollTop: 0
669
- }, f = P(1);
670
- const u = P(0), d = N(o);
671
- if ((d || !s) && ((j(o) !== "body" || nt(r)) && (l = it(o)), d)) {
672
- const a = z(o);
673
- f = I(o), u.x = a.x + o.clientLeft, u.y = a.y + o.clientTop;
674
- }
675
- const h = r && !d && !s ? Dt(r, l) : P(0);
676
- return {
677
- width: n.width * f.x,
678
- height: n.height * f.y,
679
- x: n.x * f.x - l.scrollLeft * f.x + u.x + h.x,
680
- y: n.y * f.y - l.scrollTop * f.y + u.y + h.y
681
- };
682
- }
683
- function re(t) {
684
- return t.getClientRects ? Array.from(t.getClientRects()) : [];
685
- }
686
- function ce(t) {
687
- const e = it(t), n = t.ownerDocument.body, o = D(t.scrollWidth, t.clientWidth, n.scrollWidth, n.clientWidth), i = D(t.scrollHeight, t.clientHeight, n.scrollHeight, n.clientHeight);
688
- let s = -e.scrollLeft + st(t);
689
- const r = -e.scrollTop;
690
- return E(n).direction === "rtl" && (s += D(t.clientWidth, n.clientWidth) - o), {
691
- width: o,
692
- height: i,
693
- x: s,
694
- y: r
695
- };
696
- }
697
- const le = 25;
698
- function fe(t, e, n) {
699
- n === void 0 && (n = "viewport");
700
- const o = n === "layoutViewport", i = R(t), s = F(t), r = i.visualViewport;
701
- let c = s.clientWidth, l = s.clientHeight, f = 0, u = 0;
702
- if (r) {
703
- const h = !dt() || e === "fixed";
704
- o ? h || (f = -r.offsetLeft, u = -r.offsetTop) : (c = r.width, l = r.height, h && (f = r.offsetLeft, u = r.offsetTop));
705
- }
706
- if (st(s) <= 0) {
707
- const h = s.ownerDocument, a = h.body, m = getComputedStyle(a), p = h.compatMode === "CSS1Compat" && parseFloat(m.marginLeft) + parseFloat(m.marginRight) || 0, w = Math.abs(s.clientWidth - a.clientWidth - p), g = getComputedStyle(s).scrollbarGutter === "stable both-edges" ? w / 2 : w;
708
- g <= le && (c -= g);
709
- }
710
- return {
711
- width: c,
712
- height: l,
713
- x: f,
714
- y: u
715
- };
716
- }
717
- function ae(t, e) {
718
- const n = z(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = I(t), r = t.clientWidth * s.x, c = t.clientHeight * s.y, l = i * s.x, f = o * s.y;
719
- return {
720
- width: r,
721
- height: c,
722
- x: l,
723
- y: f
724
- };
725
- }
726
- function bt(t, e, n) {
727
- let o;
728
- if (e === "viewport" || e === "layoutViewport")
729
- o = fe(t, n, e);
730
- else if (e === "document")
731
- o = ce(F(t));
732
- else if (L(e))
733
- o = ae(e, n);
734
- else {
735
- const i = Tt(t);
736
- o = {
737
- x: e.x - i.x,
738
- y: e.y - i.y,
739
- width: e.width,
740
- height: e.height
741
- };
742
- }
743
- return tt(o);
744
- }
745
- function ue(t, e) {
746
- const n = e.get(t);
747
- if (n)
748
- return n;
749
- let o = K(t, [], !1).filter((c) => L(c) && j(c) !== "body"), i = null;
750
- const s = E(t).position === "fixed";
751
- let r = s ? H(t) : t;
752
- for (; L(r) && !q(r); ) {
753
- const c = E(r), l = ut(r), f = i ? i.position : s ? "fixed" : "";
754
- !l && (f === "fixed" || f === "absolute" && c.position === "static") ? o = o.filter((d) => d !== r) : i = c, r = H(r);
755
- }
756
- return e.set(t, o), o;
757
- }
758
- function de(t) {
759
- let {
760
- element: e,
761
- boundary: n,
762
- rootBoundary: o,
763
- strategy: i
764
- } = t;
765
- const r = [...n === "clippingAncestors" ? ot(e) ? [] : ue(e, this._c) : [].concat(n), o], c = bt(e, r[0], i);
766
- let l = c.top, f = c.right, u = c.bottom, d = c.left;
767
- for (let h = 1; h < r.length; h++) {
768
- const a = bt(e, r[h], i);
769
- l = D(a.top, l), f = X(a.right, f), u = X(a.bottom, u), d = D(a.left, d);
770
- }
771
- return {
772
- width: f - d,
773
- height: u - l,
774
- x: d,
775
- y: l
776
- };
777
- }
778
- function he(t) {
779
- const {
780
- width: e,
781
- height: n
782
- } = St(t);
783
- return {
784
- width: e,
785
- height: n
786
- };
787
- }
788
- function me(t, e, n) {
789
- const o = N(e), i = F(e), s = n === "fixed", r = z(t, !0, s, e);
790
- let c = {
791
- scrollLeft: 0,
792
- scrollTop: 0
793
- };
794
- const l = P(0);
795
- if ((o || !s) && ((j(e) !== "body" || nt(i)) && (c = it(e)), o)) {
796
- const h = z(e, !0, s, e);
797
- l.x = h.x + e.clientLeft, l.y = h.y + e.clientTop;
798
- }
799
- !o && i && (l.x = st(i));
800
- const f = i && !o && !s ? Dt(i, c) : P(0), u = r.left + c.scrollLeft - l.x - f.x, d = r.top + c.scrollTop - l.y - f.y;
801
- return {
802
- x: u,
803
- y: d,
804
- width: r.width,
805
- height: r.height
806
- };
807
- }
808
- function lt(t) {
809
- return E(t).position === "static";
810
- }
811
- function Rt(t, e) {
812
- if (!N(t) || E(t).position === "fixed")
813
- return null;
814
- if (e)
815
- return e(t);
816
- let n = t.offsetParent;
817
- return F(t) === n && (n = n.ownerDocument.body), n;
818
- }
819
- function Pt(t, e) {
820
- const n = R(t);
821
- if (ot(t))
822
- return n;
823
- if (!N(t)) {
824
- let i = H(t);
825
- for (; i && !q(i); ) {
826
- if (L(i) && !lt(i))
827
- return i;
828
- i = H(i);
829
- }
830
- return n;
831
- }
832
- let o = Rt(t, e);
833
- for (; o && Zt(o) && lt(o); )
834
- o = Rt(o, e);
835
- return o && q(o) && lt(o) && !ut(o) ? n : o || ne(t) || n;
836
- }
837
- const ge = async function(t) {
838
- const e = this.getOffsetParent || Pt, n = this.getDimensions, o = await n(t.floating);
839
- return {
840
- reference: me(t.reference, await e(t.floating), t.strategy),
841
- floating: {
842
- x: 0,
843
- y: 0,
844
- width: o.width,
845
- height: o.height
846
- }
847
- };
848
- };
849
- function pe(t) {
850
- return E(t).direction === "rtl";
851
- }
852
- const we = {
853
- convertOffsetParentRelativeRectToViewportRelativeRect: se,
854
- getDocumentElement: F,
855
- getClippingRect: de,
856
- getOffsetParent: Pt,
857
- getElementRects: ge,
858
- getClientRects: re,
859
- getDimensions: he,
860
- getScale: I,
861
- isElement: L,
862
- isRTL: pe
863
- };
864
- function Ft(t, e) {
865
- return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
866
- }
867
- function xe(t, e, n) {
868
- let o = null, i;
869
- const s = F(t);
870
- function r() {
871
- var u;
872
- clearTimeout(i), (u = o) == null || u.disconnect(), o = null;
873
- }
874
- function c(u, d) {
875
- u === void 0 && (u = !1), d === void 0 && (d = 1), r();
876
- const h = t.getBoundingClientRect(), {
877
- left: a,
878
- top: m,
879
- width: p,
880
- height: w
881
- } = h;
882
- if (u || e(), !p || !w)
883
- return;
884
- const g = J(m), x = J(s.clientWidth - (a + p)), y = J(s.clientHeight - (m + w)), v = J(a), b = {
885
- rootMargin: -g + "px " + -x + "px " + -y + "px " + -v + "px",
886
- threshold: D(0, X(1, d)) || 1
887
- };
888
- let W = !0;
889
- function S(V) {
890
- const O = V[0].intersectionRatio;
891
- if (!Ft(h, t.getBoundingClientRect()))
892
- return c();
893
- if (O !== d) {
894
- if (!W)
895
- return c();
896
- O ? c(!1, O) : i = setTimeout(() => {
897
- c(!1, 1e-7);
898
- }, 1e3);
899
- }
900
- W = !1;
901
- }
902
- try {
903
- o = new IntersectionObserver(S, {
904
- ...b,
905
- // Handle <iframe>s
906
- root: s.ownerDocument
907
- });
908
- } catch {
909
- o = new IntersectionObserver(S, b);
910
- }
911
- o.observe(t);
912
- }
913
- const l = R(t), f = () => c(n);
914
- return l.addEventListener("resize", f), c(!0), () => {
915
- l.removeEventListener("resize", f), r();
916
- };
917
- }
918
- function ye(t, e, n, o) {
919
- o === void 0 && (o = {});
920
- const {
921
- ancestorScroll: i = !0,
922
- ancestorResize: s = !0,
923
- elementResize: r = typeof ResizeObserver == "function",
924
- layoutShift: c = typeof IntersectionObserver == "function",
925
- animationFrame: l = !1
926
- } = o, f = ht(t), u = i || s ? [...f ? K(f) : [], ...e ? K(e) : []] : [];
927
- u.forEach((g) => {
928
- i && g.addEventListener("scroll", n), s && g.addEventListener("resize", n);
929
- });
930
- const d = f && c ? xe(f, n, s) : null;
931
- let h = -1, a = null;
932
- r && (a = new ResizeObserver((g) => {
933
- let [x] = g;
934
- x && x.target === f && a && e && (a.unobserve(e), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
935
- var y;
936
- (y = a) == null || y.observe(e);
937
- })), n();
938
- }), f && !l && a.observe(f), e && a.observe(e));
939
- let m, p = l ? z(t) : null;
940
- l && w();
941
- function w() {
942
- const g = z(t);
943
- p && !Ft(p, g) && n(), p = g, m = requestAnimationFrame(w);
944
- }
945
- return n(), () => {
946
- var g;
947
- u.forEach((x) => {
948
- i && x.removeEventListener("scroll", n), s && x.removeEventListener("resize", n);
949
- }), d == null || d(), (g = a) == null || g.disconnect(), a = null, l && cancelAnimationFrame(m);
950
- };
951
- }
952
- const ve = Gt, be = Jt, Re = qt, Ae = Qt, Ce = (t, e, n) => {
953
- const o = /* @__PURE__ */ new Map(), i = n ?? {}, s = {
954
- ...we,
955
- ...i.platform,
956
- _c: o
957
- };
958
- return Yt(t, e, {
959
- ...i,
960
- platform: s
961
- });
962
- };
963
- export {
964
- ye as a,
965
- Ae as b,
966
- Ce as c,
967
- Re as f,
968
- ve as o,
969
- be as s
970
- };