@kommo-crm/crm-react-ui-kit 1.1.1-beta.13 → 1.1.1-beta.15

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.
Files changed (48) hide show
  1. package/dist/components/ContextMenu/ContextMenu.js +1 -1
  2. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +1 -1
  3. package/dist/components/ContextMenu/components/Content/Content.d.ts +1 -1
  4. package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
  5. package/dist/components/ContextMenu/components/Content/Content.js +1 -1
  6. package/dist/components/ContextMenu/components/Content/Content.props.d.ts +5 -1
  7. package/dist/components/ContextMenu/components/Content/Content.props.d.ts.map +1 -1
  8. package/dist/components/ContextMenu/components/Content/index.js +1 -1
  9. package/dist/components/ContextMenu/components/FocusBlocker/FocusBlocker.js +1 -1
  10. package/dist/components/ContextMenu/components/FocusBlocker/index.js +1 -1
  11. package/dist/components/ContextMenu/components/Item/Item.js +1 -1
  12. package/dist/components/ContextMenu/components/ItemRightSlot/ItemRightSlot.js +1 -1
  13. package/dist/components/ContextMenu/components/Label/Label.js +1 -1
  14. package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +1 -1
  15. package/dist/components/ContextMenu/components/Sub/Sub.js +1 -1
  16. package/dist/components/ContextMenu/components/SubContent/SubContent.d.ts +1 -0
  17. package/dist/components/ContextMenu/components/SubContent/SubContent.d.ts.map +1 -1
  18. package/dist/components/ContextMenu/components/SubContent/SubContent.js +60 -58
  19. package/dist/components/ContextMenu/components/SubContent/SubContent.props.d.ts +4 -0
  20. package/dist/components/ContextMenu/components/SubContent/SubContent.props.d.ts.map +1 -1
  21. package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +1 -1
  22. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.d.ts +1 -1
  23. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.d.ts.map +1 -1
  24. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +59 -57
  25. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +1 -1
  26. package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +1 -1
  27. package/dist/components/ContextMenu/hooks/index.d.ts +1 -0
  28. package/dist/components/ContextMenu/hooks/index.d.ts.map +1 -1
  29. package/dist/components/ContextMenu/hooks/index.js +9 -7
  30. package/dist/components/ContextMenu/hooks/useChildrenWithBlocker/useChildrenWithBlocker.js +1 -1
  31. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.d.ts +1 -1
  32. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.d.ts.map +1 -1
  33. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +2 -1
  34. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.types.d.ts +4 -0
  35. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.types.d.ts.map +1 -1
  36. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +1 -1
  37. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +1 -1
  38. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +1 -1
  39. package/dist/components/ContextMenu/hooks/useInheritedArrowColor/useInheritedArrowColor.d.ts.map +1 -1
  40. package/dist/components/ContextMenu/hooks/useInheritedArrowColor/useInheritedArrowColor.js +12 -12
  41. package/dist/components/ContextMenu/hooks/useItemInnerFocus/useItemInnerFocus.js +1 -1
  42. package/dist/components/ContextMenu/hooks/usePrevious/usePrevious.d.ts +2 -0
  43. package/dist/components/ContextMenu/hooks/usePrevious/usePrevious.d.ts.map +1 -0
  44. package/dist/components/ContextMenu/hooks/usePrevious/usePrevious.js +10 -0
  45. package/dist/components/ContextMenu/index.js +1 -1
  46. package/dist/useContentPositioning-CLU2E_Oz.mjs +2433 -0
  47. package/package.json +1 -1
  48. package/dist/useContentPositioning-BokVuzge.mjs +0 -2425
@@ -1,2425 +0,0 @@
1
- import * as Qt from "react";
2
- import { forwardRef as it, useEffect as Ee, useLayoutEffect as We, useState as J, useRef as Y, useCallback as Nn, useMemo as Ae, useContext as Un } from "react";
3
- import { jsx as Ie, jsxs as Dn } from "react/jsx-runtime";
4
- import { g as qn } from "./index-DmGLJEdp.mjs";
5
- import { c as Gt } from "./index-L8X2o7IH.mjs";
6
- import jn, { unstable_batchedUpdates as $n } from "react-dom";
7
- import { mergeRefs as zn } from "./lib/utils.js";
8
- import { LevelProvider as Ln } from "./components/ContextMenu/providers/LevelProvider/LevelProvider.js";
9
- import { useContextMenuContext as Qn } from "./components/ContextMenu/ContextMenu.context.js";
10
- import { ContextMenuMode as _t } from "./components/ContextMenu/ContextMenu.enums.js";
11
- import "./components/ContextMenu/providers/SubMenuProvider/SubMenuProvider.js";
12
- import { directionToSide as Gn } from "./components/ContextMenu/components/Content/Content.utils.js";
13
- import { useStopContextMenuEvents as Mn } from "./components/ContextMenu/hooks/useStopContextMenuEvents/useStopContextMenuEvents.js";
14
- import { Direction as k } from "./components/ContextMenu/components/Content/Content.enums.js";
15
- import './assets/useContentPositioning.css';var bt, Se = jn;
16
- if (process.env.NODE_ENV === "production")
17
- bt = Se.createRoot, Se.hydrateRoot;
18
- else {
19
- var wt = Se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
20
- bt = function(e, t) {
21
- wt.usingClientEntryPoint = !0;
22
- try {
23
- return Se.createRoot(e, t);
24
- } finally {
25
- wt.usingClientEntryPoint = !1;
26
- }
27
- };
28
- }
29
- const Hn = "_blocker_1msg5_1", Bn = {
30
- blocker: Hn
31
- }, Mt = it(
32
- (e, t) => {
33
- const {
34
- className: n,
35
- onFocus: i,
36
- onClick: s,
37
- onKeyDown: r,
38
- onKeyUp: a,
39
- onKeyPress: o,
40
- onPointerDown: c,
41
- onPointerUp: u,
42
- onPointerEnter: h,
43
- onPointerLeave: d,
44
- onPointerMove: p,
45
- ...y
46
- } = e, g = Mn({
47
- onClick: s,
48
- onKeyDown: r,
49
- onKeyUp: a,
50
- onKeyPress: o,
51
- onPointerDown: c,
52
- onPointerUp: u,
53
- onPointerEnter: h,
54
- onPointerLeave: d,
55
- onPointerMove: p
56
- });
57
- return /* @__PURE__ */ Ie(
58
- "div",
59
- {
60
- ref: t,
61
- className: Gt(Bn.blocker, n),
62
- tabIndex: 0,
63
- onFocus: (_) => {
64
- _.preventDefault(), i == null || i(_);
65
- },
66
- "data-blocker": !0,
67
- ...g,
68
- ...y
69
- }
70
- );
71
- }
72
- );
73
- Mt.displayName = "FocusBlocker";
74
- var st = we(), w = (e) => be(e, st), rt = we();
75
- w.write = (e) => be(e, rt);
76
- var Oe = we();
77
- w.onStart = (e) => be(e, Oe);
78
- var at = we();
79
- w.onFrame = (e) => be(e, at);
80
- var ot = we();
81
- w.onFinish = (e) => be(e, ot);
82
- var ee = [];
83
- w.setTimeout = (e, t) => {
84
- const n = w.now() + t, i = () => {
85
- const r = ee.findIndex((a) => a.cancel == i);
86
- ~r && ee.splice(r, 1), B -= ~r ? 1 : 0;
87
- }, s = { time: n, handler: e, cancel: i };
88
- return ee.splice(Ht(n), 0, s), B += 1, Bt(), s;
89
- };
90
- var Ht = (e) => ~(~ee.findIndex((t) => t.time > e) || ~ee.length);
91
- w.cancel = (e) => {
92
- Oe.delete(e), at.delete(e), ot.delete(e), st.delete(e), rt.delete(e);
93
- };
94
- w.sync = (e) => {
95
- Ke = !0, w.batchedUpdates(e), Ke = !1;
96
- };
97
- w.throttle = (e) => {
98
- let t;
99
- function n() {
100
- try {
101
- e(...t);
102
- } finally {
103
- t = null;
104
- }
105
- }
106
- function i(...s) {
107
- t = s, w.onStart(n);
108
- }
109
- return i.handler = e, i.cancel = () => {
110
- Oe.delete(n), t = null;
111
- }, i;
112
- };
113
- var ut = typeof window < "u" ? window.requestAnimationFrame : (
114
- // eslint-disable-next-line @typescript-eslint/no-empty-function
115
- () => {
116
- }
117
- );
118
- w.use = (e) => ut = e;
119
- w.now = typeof performance < "u" ? () => performance.now() : Date.now;
120
- w.batchedUpdates = (e) => e();
121
- w.catch = console.error;
122
- w.frameLoop = "always";
123
- w.advance = () => {
124
- w.frameLoop !== "demand" ? console.warn(
125
- "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"
126
- ) : Kt();
127
- };
128
- var H = -1, B = 0, Ke = !1;
129
- function be(e, t) {
130
- Ke ? (t.delete(e), e(0)) : (t.add(e), Bt());
131
- }
132
- function Bt() {
133
- H < 0 && (H = 0, w.frameLoop !== "demand" && ut(Wt));
134
- }
135
- function Wn() {
136
- H = -1;
137
- }
138
- function Wt() {
139
- ~H && (ut(Wt), w.batchedUpdates(Kt));
140
- }
141
- function Kt() {
142
- const e = H;
143
- H = w.now();
144
- const t = Ht(H);
145
- if (t && (Yt(ee.splice(0, t), (n) => n.handler()), B -= t), !B) {
146
- Wn();
147
- return;
148
- }
149
- Oe.flush(), st.flush(e ? Math.min(64, H - e) : 16.667), at.flush(), rt.flush(), ot.flush();
150
- }
151
- function we() {
152
- let e = /* @__PURE__ */ new Set(), t = e;
153
- return {
154
- add(n) {
155
- B += t == e && !e.has(n) ? 1 : 0, e.add(n);
156
- },
157
- delete(n) {
158
- return B -= t == e && e.has(n) ? 1 : 0, e.delete(n);
159
- },
160
- flush(n) {
161
- t.size && (e = /* @__PURE__ */ new Set(), B -= t.size, Yt(t, (i) => i(n) && e.add(i)), B += e.size, t = e);
162
- }
163
- };
164
- }
165
- function Yt(e, t) {
166
- e.forEach((n) => {
167
- try {
168
- t(n);
169
- } catch (i) {
170
- w.catch(i);
171
- }
172
- });
173
- }
174
- var Kn = Object.defineProperty, Yn = (e, t) => {
175
- for (var n in t)
176
- Kn(e, n, { get: t[n], enumerable: !0 });
177
- }, j = {};
178
- Yn(j, {
179
- assign: () => Xn,
180
- colors: () => W,
181
- createStringInterpolator: () => ct,
182
- skipAnimation: () => Xt,
183
- to: () => Zt,
184
- willAdvance: () => dt
185
- });
186
- function Ye() {
187
- }
188
- var Zn = (e, t, n) => Object.defineProperty(e, t, { value: n, writable: !0, configurable: !0 }), l = {
189
- arr: Array.isArray,
190
- obj: (e) => !!e && e.constructor.name === "Object",
191
- fun: (e) => typeof e == "function",
192
- str: (e) => typeof e == "string",
193
- num: (e) => typeof e == "number",
194
- und: (e) => e === void 0
195
- };
196
- function Q(e, t) {
197
- if (l.arr(e)) {
198
- if (!l.arr(t) || e.length !== t.length) return !1;
199
- for (let n = 0; n < e.length; n++)
200
- if (e[n] !== t[n]) return !1;
201
- return !0;
202
- }
203
- return e === t;
204
- }
205
- var S = (e, t) => e.forEach(t);
206
- function z(e, t, n) {
207
- if (l.arr(e)) {
208
- for (let i = 0; i < e.length; i++)
209
- t.call(n, e[i], `${i}`);
210
- return;
211
- }
212
- for (const i in e)
213
- e.hasOwnProperty(i) && t.call(n, e[i], i);
214
- }
215
- var E = (e) => l.und(e) ? [] : l.arr(e) ? e : [e];
216
- function ue(e, t) {
217
- if (e.size) {
218
- const n = Array.from(e);
219
- e.clear(), S(n, t);
220
- }
221
- }
222
- var oe = (e, ...t) => ue(e, (n) => n(...t)), lt = () => typeof window > "u" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent), ct, Zt, W = null, Xt = !1, dt = Ye, Xn = (e) => {
223
- e.to && (Zt = e.to), e.now && (w.now = e.now), e.colors !== void 0 && (W = e.colors), e.skipAnimation != null && (Xt = e.skipAnimation), e.createStringInterpolator && (ct = e.createStringInterpolator), e.requestAnimationFrame && w.use(e.requestAnimationFrame), e.batchedUpdates && (w.batchedUpdates = e.batchedUpdates), e.willAdvance && (dt = e.willAdvance), e.frameLoop && (w.frameLoop = e.frameLoop);
224
- }, le = /* @__PURE__ */ new Set(), V = [], Le = [], Ce = 0, Ve = {
225
- get idle() {
226
- return !le.size && !V.length;
227
- },
228
- /** Advance the given animation on every frame until idle. */
229
- start(e) {
230
- Ce > e.priority ? (le.add(e), w.onStart(Jn)) : (Jt(e), w(Ze));
231
- },
232
- /** Advance all animations by the given time. */
233
- advance: Ze,
234
- /** Call this when an animation's priority changes. */
235
- sort(e) {
236
- if (Ce)
237
- w.onFrame(() => Ve.sort(e));
238
- else {
239
- const t = V.indexOf(e);
240
- ~t && (V.splice(t, 1), en(e));
241
- }
242
- },
243
- /**
244
- * Clear all animations. For testing purposes.
245
- *
246
- * ☠️ Never call this from within the frameloop.
247
- */
248
- clear() {
249
- V = [], le.clear();
250
- }
251
- };
252
- function Jn() {
253
- le.forEach(Jt), le.clear(), w(Ze);
254
- }
255
- function Jt(e) {
256
- V.includes(e) || en(e);
257
- }
258
- function en(e) {
259
- V.splice(
260
- ei(V, (t) => t.priority > e.priority),
261
- 0,
262
- e
263
- );
264
- }
265
- function Ze(e) {
266
- const t = Le;
267
- for (let n = 0; n < V.length; n++) {
268
- const i = V[n];
269
- Ce = i.priority, i.idle || (dt(i), i.advance(e), i.idle || t.push(i));
270
- }
271
- return Ce = 0, Le = V, Le.length = 0, V = t, V.length > 0;
272
- }
273
- function ei(e, t) {
274
- const n = e.findIndex(t);
275
- return n < 0 ? e.length : n;
276
- }
277
- var ti = {
278
- transparent: 0,
279
- aliceblue: 4042850303,
280
- antiquewhite: 4209760255,
281
- aqua: 16777215,
282
- aquamarine: 2147472639,
283
- azure: 4043309055,
284
- beige: 4126530815,
285
- bisque: 4293182719,
286
- black: 255,
287
- blanchedalmond: 4293643775,
288
- blue: 65535,
289
- blueviolet: 2318131967,
290
- brown: 2771004159,
291
- burlywood: 3736635391,
292
- burntsienna: 3934150143,
293
- cadetblue: 1604231423,
294
- chartreuse: 2147418367,
295
- chocolate: 3530104575,
296
- coral: 4286533887,
297
- cornflowerblue: 1687547391,
298
- cornsilk: 4294499583,
299
- crimson: 3692313855,
300
- cyan: 16777215,
301
- darkblue: 35839,
302
- darkcyan: 9145343,
303
- darkgoldenrod: 3095792639,
304
- darkgray: 2846468607,
305
- darkgreen: 6553855,
306
- darkgrey: 2846468607,
307
- darkkhaki: 3182914559,
308
- darkmagenta: 2332068863,
309
- darkolivegreen: 1433087999,
310
- darkorange: 4287365375,
311
- darkorchid: 2570243327,
312
- darkred: 2332033279,
313
- darksalmon: 3918953215,
314
- darkseagreen: 2411499519,
315
- darkslateblue: 1211993087,
316
- darkslategray: 793726975,
317
- darkslategrey: 793726975,
318
- darkturquoise: 13554175,
319
- darkviolet: 2483082239,
320
- deeppink: 4279538687,
321
- deepskyblue: 12582911,
322
- dimgray: 1768516095,
323
- dimgrey: 1768516095,
324
- dodgerblue: 512819199,
325
- firebrick: 2988581631,
326
- floralwhite: 4294635775,
327
- forestgreen: 579543807,
328
- fuchsia: 4278255615,
329
- gainsboro: 3705462015,
330
- ghostwhite: 4177068031,
331
- gold: 4292280575,
332
- goldenrod: 3668254975,
333
- gray: 2155905279,
334
- green: 8388863,
335
- greenyellow: 2919182335,
336
- grey: 2155905279,
337
- honeydew: 4043305215,
338
- hotpink: 4285117695,
339
- indianred: 3445382399,
340
- indigo: 1258324735,
341
- ivory: 4294963455,
342
- khaki: 4041641215,
343
- lavender: 3873897215,
344
- lavenderblush: 4293981695,
345
- lawngreen: 2096890111,
346
- lemonchiffon: 4294626815,
347
- lightblue: 2916673279,
348
- lightcoral: 4034953471,
349
- lightcyan: 3774873599,
350
- lightgoldenrodyellow: 4210742015,
351
- lightgray: 3553874943,
352
- lightgreen: 2431553791,
353
- lightgrey: 3553874943,
354
- lightpink: 4290167295,
355
- lightsalmon: 4288707327,
356
- lightseagreen: 548580095,
357
- lightskyblue: 2278488831,
358
- lightslategray: 2005441023,
359
- lightslategrey: 2005441023,
360
- lightsteelblue: 2965692159,
361
- lightyellow: 4294959359,
362
- lime: 16711935,
363
- limegreen: 852308735,
364
- linen: 4210091775,
365
- magenta: 4278255615,
366
- maroon: 2147483903,
367
- mediumaquamarine: 1724754687,
368
- mediumblue: 52735,
369
- mediumorchid: 3126187007,
370
- mediumpurple: 2473647103,
371
- mediumseagreen: 1018393087,
372
- mediumslateblue: 2070474495,
373
- mediumspringgreen: 16423679,
374
- mediumturquoise: 1221709055,
375
- mediumvioletred: 3340076543,
376
- midnightblue: 421097727,
377
- mintcream: 4127193855,
378
- mistyrose: 4293190143,
379
- moccasin: 4293178879,
380
- navajowhite: 4292783615,
381
- navy: 33023,
382
- oldlace: 4260751103,
383
- olive: 2155872511,
384
- olivedrab: 1804477439,
385
- orange: 4289003775,
386
- orangered: 4282712319,
387
- orchid: 3664828159,
388
- palegoldenrod: 4008225535,
389
- palegreen: 2566625535,
390
- paleturquoise: 2951671551,
391
- palevioletred: 3681588223,
392
- papayawhip: 4293907967,
393
- peachpuff: 4292524543,
394
- peru: 3448061951,
395
- pink: 4290825215,
396
- plum: 3718307327,
397
- powderblue: 2967529215,
398
- purple: 2147516671,
399
- rebeccapurple: 1714657791,
400
- red: 4278190335,
401
- rosybrown: 3163525119,
402
- royalblue: 1097458175,
403
- saddlebrown: 2336560127,
404
- salmon: 4202722047,
405
- sandybrown: 4104413439,
406
- seagreen: 780883967,
407
- seashell: 4294307583,
408
- sienna: 2689740287,
409
- silver: 3233857791,
410
- skyblue: 2278484991,
411
- slateblue: 1784335871,
412
- slategray: 1887473919,
413
- slategrey: 1887473919,
414
- snow: 4294638335,
415
- springgreen: 16744447,
416
- steelblue: 1182971135,
417
- tan: 3535047935,
418
- teal: 8421631,
419
- thistle: 3636451583,
420
- tomato: 4284696575,
421
- turquoise: 1088475391,
422
- violet: 4001558271,
423
- wheat: 4125012991,
424
- white: 4294967295,
425
- whitesmoke: 4126537215,
426
- yellow: 4294902015,
427
- yellowgreen: 2597139199
428
- }, q = "[-+]?\\d*\\.?\\d+", ke = q + "%";
429
- function Ne(...e) {
430
- return "\\(\\s*(" + e.join(")\\s*,\\s*(") + ")\\s*\\)";
431
- }
432
- var ni = new RegExp("rgb" + Ne(q, q, q)), ii = new RegExp("rgba" + Ne(q, q, q, q)), si = new RegExp("hsl" + Ne(q, ke, ke)), ri = new RegExp(
433
- "hsla" + Ne(q, ke, ke, q)
434
- ), ai = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, oi = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, ui = /^#([0-9a-fA-F]{6})$/, li = /^#([0-9a-fA-F]{8})$/;
435
- function ci(e) {
436
- let t;
437
- return typeof e == "number" ? e >>> 0 === e && e >= 0 && e <= 4294967295 ? e : null : (t = ui.exec(e)) ? parseInt(t[1] + "ff", 16) >>> 0 : W && W[e] !== void 0 ? W[e] : (t = ni.exec(e)) ? (X(t[1]) << 24 | // r
438
- X(t[2]) << 16 | // g
439
- X(t[3]) << 8 | // b
440
- 255) >>> // a
441
- 0 : (t = ii.exec(e)) ? (X(t[1]) << 24 | // r
442
- X(t[2]) << 16 | // g
443
- X(t[3]) << 8 | // b
444
- Pt(t[4])) >>> // a
445
- 0 : (t = ai.exec(e)) ? parseInt(
446
- t[1] + t[1] + // r
447
- t[2] + t[2] + // g
448
- t[3] + t[3] + // b
449
- "ff",
450
- // a
451
- 16
452
- ) >>> 0 : (t = li.exec(e)) ? parseInt(t[1], 16) >>> 0 : (t = oi.exec(e)) ? parseInt(
453
- t[1] + t[1] + // r
454
- t[2] + t[2] + // g
455
- t[3] + t[3] + // b
456
- t[4] + t[4],
457
- // a
458
- 16
459
- ) >>> 0 : (t = si.exec(e)) ? (At(
460
- St(t[1]),
461
- // h
462
- Pe(t[2]),
463
- // s
464
- Pe(t[3])
465
- // l
466
- ) | 255) >>> // a
467
- 0 : (t = ri.exec(e)) ? (At(
468
- St(t[1]),
469
- // h
470
- Pe(t[2]),
471
- // s
472
- Pe(t[3])
473
- // l
474
- ) | Pt(t[4])) >>> // a
475
- 0 : null;
476
- }
477
- function Qe(e, t, n) {
478
- return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
479
- }
480
- function At(e, t, n) {
481
- const i = n < 0.5 ? n * (1 + t) : n + t - n * t, s = 2 * n - i, r = Qe(s, i, e + 1 / 3), a = Qe(s, i, e), o = Qe(s, i, e - 1 / 3);
482
- return Math.round(r * 255) << 24 | Math.round(a * 255) << 16 | Math.round(o * 255) << 8;
483
- }
484
- function X(e) {
485
- const t = parseInt(e, 10);
486
- return t < 0 ? 0 : t > 255 ? 255 : t;
487
- }
488
- function St(e) {
489
- return (parseFloat(e) % 360 + 360) % 360 / 360;
490
- }
491
- function Pt(e) {
492
- const t = parseFloat(e);
493
- return t < 0 ? 0 : t > 1 ? 255 : Math.round(t * 255);
494
- }
495
- function Pe(e) {
496
- const t = parseFloat(e);
497
- return t < 0 ? 0 : t > 100 ? 1 : t / 100;
498
- }
499
- function It(e) {
500
- let t = ci(e);
501
- if (t === null) return e;
502
- t = t || 0;
503
- const n = (t & 4278190080) >>> 24, i = (t & 16711680) >>> 16, s = (t & 65280) >>> 8, r = (t & 255) / 255;
504
- return `rgba(${n}, ${i}, ${s}, ${r})`;
505
- }
506
- var fe = (e, t, n) => {
507
- if (l.fun(e))
508
- return e;
509
- if (l.arr(e))
510
- return fe({
511
- range: e,
512
- output: t,
513
- extrapolate: n
514
- });
515
- if (l.str(e.output[0]))
516
- return ct(e);
517
- const i = e, s = i.output, r = i.range || [0, 1], a = i.extrapolateLeft || i.extrapolate || "extend", o = i.extrapolateRight || i.extrapolate || "extend", c = i.easing || ((u) => u);
518
- return (u) => {
519
- const h = fi(u, r);
520
- return di(
521
- u,
522
- r[h],
523
- r[h + 1],
524
- s[h],
525
- s[h + 1],
526
- c,
527
- a,
528
- o,
529
- i.map
530
- );
531
- };
532
- };
533
- function di(e, t, n, i, s, r, a, o, c) {
534
- let u = c ? c(e) : e;
535
- if (u < t) {
536
- if (a === "identity") return u;
537
- a === "clamp" && (u = t);
538
- }
539
- if (u > n) {
540
- if (o === "identity") return u;
541
- o === "clamp" && (u = n);
542
- }
543
- return i === s ? i : t === n ? e <= t ? i : s : (t === -1 / 0 ? u = -u : n === 1 / 0 ? u = u - t : u = (u - t) / (n - t), u = r(u), i === -1 / 0 ? u = -u : s === 1 / 0 ? u = u + i : u = u * (s - i) + i, u);
544
- }
545
- function fi(e, t) {
546
- for (var n = 1; n < t.length - 1 && !(t[n] >= e); ++n)
547
- ;
548
- return n - 1;
549
- }
550
- var tn = {
551
- linear: (e) => e,
552
- easeInOutCubic: (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2
553
- }, he = Symbol.for("FluidValue.get"), ne = Symbol.for("FluidValue.observers"), O = (e) => !!(e && e[he]), T = (e) => e && e[he] ? e[he]() : e, Rt = (e) => e[ne] || null;
554
- function hi(e, t) {
555
- e.eventObserved ? e.eventObserved(t) : e(t);
556
- }
557
- function me(e, t) {
558
- const n = e[ne];
559
- n && n.forEach((i) => {
560
- hi(i, t);
561
- });
562
- }
563
- var nn = class {
564
- constructor(e) {
565
- if (!e && !(e = this.get))
566
- throw Error("Unknown getter");
567
- mi(this, e);
568
- }
569
- }, mi = (e, t) => sn(e, he, t);
570
- function ie(e, t) {
571
- if (e[he]) {
572
- let n = e[ne];
573
- n || sn(e, ne, n = /* @__PURE__ */ new Set()), n.has(t) || (n.add(t), e.observerAdded && e.observerAdded(n.size, t));
574
- }
575
- return t;
576
- }
577
- function pe(e, t) {
578
- const n = e[ne];
579
- if (n && n.has(t)) {
580
- const i = n.size - 1;
581
- i ? n.delete(t) : e[ne] = null, e.observerRemoved && e.observerRemoved(i, t);
582
- }
583
- }
584
- var sn = (e, t, n) => Object.defineProperty(e, t, {
585
- value: n,
586
- writable: !0,
587
- configurable: !0
588
- }), Re = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, pi = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi, xt = new RegExp(`(${Re.source})(%|[a-z]+)`, "i"), gi = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, Ue = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/, rn = (e) => {
589
- const [t, n] = vi(e);
590
- if (!t || lt())
591
- return e;
592
- const i = window.getComputedStyle(document.documentElement).getPropertyValue(t);
593
- if (i)
594
- return i.trim();
595
- if (n && n.startsWith("--")) {
596
- const s = window.getComputedStyle(document.documentElement).getPropertyValue(n);
597
- return s || e;
598
- } else {
599
- if (n && Ue.test(n))
600
- return rn(n);
601
- if (n)
602
- return n;
603
- }
604
- return e;
605
- }, vi = (e) => {
606
- const t = Ue.exec(e);
607
- if (!t) return [,];
608
- const [, n, i] = t;
609
- return [n, i];
610
- }, Ge, yi = (e, t, n, i, s) => `rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(i)}, ${s})`, an = (e) => {
611
- Ge || (Ge = W ? (
612
- // match color names, ignore partial matches
613
- new RegExp(`(${Object.keys(W).join("|")})(?!\\w)`, "g")
614
- ) : (
615
- // never match
616
- /^\b$/
617
- ));
618
- const t = e.output.map((r) => T(r).replace(Ue, rn).replace(pi, It).replace(Ge, It)), n = t.map((r) => r.match(Re).map(Number)), s = n[0].map(
619
- (r, a) => n.map((o) => {
620
- if (!(a in o))
621
- throw Error('The arity of each "output" value must be equal');
622
- return o[a];
623
- })
624
- ).map(
625
- (r) => fe({ ...e, output: r })
626
- );
627
- return (r) => {
628
- var c;
629
- const a = !xt.test(t[0]) && ((c = t.find((u) => xt.test(u))) == null ? void 0 : c.replace(Re, ""));
630
- let o = 0;
631
- return t[0].replace(
632
- Re,
633
- () => `${s[o++](r)}${a || ""}`
634
- ).replace(gi, yi);
635
- };
636
- }, ft = "react-spring: ", on = (e) => {
637
- const t = e;
638
- let n = !1;
639
- if (typeof t != "function")
640
- throw new TypeError(`${ft}once requires a function parameter`);
641
- return (...i) => {
642
- n || (t(...i), n = !0);
643
- };
644
- }, _i = on(console.warn);
645
- function bi() {
646
- _i(
647
- `${ft}The "interpolate" function is deprecated in v9 (use "to" instead)`
648
- );
649
- }
650
- var wi = on(console.warn);
651
- function Ai() {
652
- wi(
653
- `${ft}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`
654
- );
655
- }
656
- function De(e) {
657
- return l.str(e) && (e[0] == "#" || /\d/.test(e) || // Do not identify a CSS variable as an AnimatedString if its SSR
658
- !lt() && Ue.test(e) || e in (W || {}));
659
- }
660
- var ht = lt() ? Ee : We, Si = () => {
661
- const e = Y(!1);
662
- return ht(() => (e.current = !0, () => {
663
- e.current = !1;
664
- }), []), e;
665
- };
666
- function un() {
667
- const e = J()[1], t = Si();
668
- return () => {
669
- t.current && e(Math.random());
670
- };
671
- }
672
- var ln = (e) => Ee(e, Pi), Pi = [];
673
- function Ct(e) {
674
- const t = Y(void 0);
675
- return Ee(() => {
676
- t.current = e;
677
- }), t.current;
678
- }
679
- var ge = Symbol.for("Animated:node"), Ii = (e) => !!e && e[ge] === e, $ = (e) => e && e[ge], mt = (e, t) => Zn(e, ge, t), qe = (e) => e && e[ge] && e[ge].getPayload(), cn = class {
680
- constructor() {
681
- mt(this, this);
682
- }
683
- /** Get every `AnimatedValue` used by this node. */
684
- getPayload() {
685
- return this.payload || [];
686
- }
687
- }, je = class dn extends cn {
688
- constructor(t) {
689
- super(), this._value = t, this.done = !0, this.durationProgress = 0, l.num(this._value) && (this.lastPosition = this._value);
690
- }
691
- /** @internal */
692
- static create(t) {
693
- return new dn(t);
694
- }
695
- getPayload() {
696
- return [this];
697
- }
698
- getValue() {
699
- return this._value;
700
- }
701
- setValue(t, n) {
702
- return l.num(t) && (this.lastPosition = t, n && (t = Math.round(t / n) * n, this.done && (this.lastPosition = t))), this._value === t ? !1 : (this._value = t, !0);
703
- }
704
- reset() {
705
- const { done: t } = this;
706
- this.done = !1, l.num(this._value) && (this.elapsedTime = 0, this.durationProgress = 0, this.lastPosition = this._value, t && (this.lastVelocity = null), this.v0 = null);
707
- }
708
- }, Te = class fn extends je {
709
- constructor(t) {
710
- super(0), this._string = null, this._toString = fe({
711
- output: [t, t]
712
- });
713
- }
714
- /** @internal */
715
- static create(t) {
716
- return new fn(t);
717
- }
718
- getValue() {
719
- const t = this._string;
720
- return t ?? (this._string = this._toString(this._value));
721
- }
722
- setValue(t) {
723
- if (l.str(t)) {
724
- if (t == this._string)
725
- return !1;
726
- this._string = t, this._value = 1;
727
- } else if (super.setValue(t))
728
- this._string = null;
729
- else
730
- return !1;
731
- return !0;
732
- }
733
- reset(t) {
734
- t && (this._toString = fe({
735
- output: [this.getValue(), t]
736
- })), this._value = 0, super.reset();
737
- }
738
- }, Fe = { dependencies: null }, $e = class extends cn {
739
- constructor(e) {
740
- super(), this.source = e, this.setValue(e);
741
- }
742
- getValue(e) {
743
- const t = {};
744
- return z(this.source, (n, i) => {
745
- Ii(n) ? t[i] = n.getValue(e) : O(n) ? t[i] = T(n) : e || (t[i] = n);
746
- }), t;
747
- }
748
- /** Replace the raw object data */
749
- setValue(e) {
750
- this.source = e, this.payload = this._makePayload(e);
751
- }
752
- reset() {
753
- this.payload && S(this.payload, (e) => e.reset());
754
- }
755
- /** Create a payload set. */
756
- _makePayload(e) {
757
- if (e) {
758
- const t = /* @__PURE__ */ new Set();
759
- return z(e, this._addToPayload, t), Array.from(t);
760
- }
761
- }
762
- /** Add to a payload set. */
763
- _addToPayload(e) {
764
- Fe.dependencies && O(e) && Fe.dependencies.add(e);
765
- const t = qe(e);
766
- t && S(t, (n) => this.add(n));
767
- }
768
- }, Ri = class hn extends $e {
769
- constructor(t) {
770
- super(t);
771
- }
772
- /** @internal */
773
- static create(t) {
774
- return new hn(t);
775
- }
776
- getValue() {
777
- return this.source.map((t) => t.getValue());
778
- }
779
- setValue(t) {
780
- const n = this.getPayload();
781
- return t.length == n.length ? n.map((i, s) => i.setValue(t[s])).some(Boolean) : (super.setValue(t.map(xi)), !0);
782
- }
783
- };
784
- function xi(e) {
785
- return (De(e) ? Te : je).create(e);
786
- }
787
- function Xe(e) {
788
- const t = $(e);
789
- return t ? t.constructor : l.arr(e) ? Ri : De(e) ? Te : je;
790
- }
791
- var kt = (e, t) => {
792
- const n = (
793
- // Function components must use "forwardRef" to avoid being
794
- // re-rendered on every animation frame.
795
- !l.fun(e) || e.prototype && e.prototype.isReactComponent
796
- );
797
- return it((i, s) => {
798
- const r = Y(null), a = n && // eslint-disable-next-line react-hooks/rules-of-hooks
799
- Nn(
800
- (f) => {
801
- r.current = Ti(s, f);
802
- },
803
- [s]
804
- ), [o, c] = ki(i, t), u = un(), h = () => {
805
- const f = r.current;
806
- if (n && !f)
807
- return;
808
- (f ? t.applyAnimatedValues(f, o.getValue(!0)) : !1) === !1 && u();
809
- }, d = new Ci(h, c), p = Y(void 0);
810
- ht(() => (p.current = d, S(c, (f) => ie(f, d)), () => {
811
- p.current && (S(
812
- p.current.deps,
813
- (f) => pe(f, p.current)
814
- ), w.cancel(p.current.update));
815
- })), Ee(h, []), ln(() => () => {
816
- const f = p.current;
817
- S(f.deps, (g) => pe(g, f));
818
- });
819
- const y = t.getComponentProps(o.getValue());
820
- return /* @__PURE__ */ Qt.createElement(e, { ...y, ref: a });
821
- });
822
- }, Ci = class {
823
- constructor(e, t) {
824
- this.update = e, this.deps = t;
825
- }
826
- eventObserved(e) {
827
- e.type == "change" && w.write(this.update);
828
- }
829
- };
830
- function ki(e, t) {
831
- const n = /* @__PURE__ */ new Set();
832
- return Fe.dependencies = n, e.style && (e = {
833
- ...e,
834
- style: t.createAnimatedStyle(e.style)
835
- }), e = new $e(e), Fe.dependencies = null, [e, n];
836
- }
837
- function Ti(e, t) {
838
- return e && (l.fun(e) ? e(t) : e.current = t), t;
839
- }
840
- var Tt = Symbol.for("AnimatedComponent"), Fi = (e, {
841
- applyAnimatedValues: t = () => !1,
842
- createAnimatedStyle: n = (s) => new $e(s),
843
- getComponentProps: i = (s) => s
844
- } = {}) => {
845
- const s = {
846
- applyAnimatedValues: t,
847
- createAnimatedStyle: n,
848
- getComponentProps: i
849
- }, r = (a) => {
850
- const o = Ft(a) || "Anonymous";
851
- return l.str(a) ? a = r[a] || (r[a] = kt(a, s)) : a = a[Tt] || (a[Tt] = kt(a, s)), a.displayName = `Animated(${o})`, a;
852
- };
853
- return z(e, (a, o) => {
854
- l.arr(e) && (o = Ft(a)), r[o] = r(a);
855
- }), {
856
- animated: r
857
- };
858
- }, Ft = (e) => l.str(e) ? e : e && l.str(e.displayName) ? e.displayName : l.fun(e) && e.name || null;
859
- function K(e, ...t) {
860
- return l.fun(e) ? e(...t) : e;
861
- }
862
- var ce = (e, t) => e === !0 || !!(t && e && (l.fun(e) ? e(t) : E(e).includes(t))), mn = (e, t) => l.obj(e) ? t && e[t] : e, pn = (e, t) => e.default === !0 ? e[t] : e.default ? e.default[t] : void 0, Ei = (e) => e, pt = (e, t = Ei) => {
863
- let n = Oi;
864
- e.default && e.default !== !0 && (e = e.default, n = Object.keys(e));
865
- const i = {};
866
- for (const s of n) {
867
- const r = t(e[s], s);
868
- l.und(r) || (i[s] = r);
869
- }
870
- return i;
871
- }, Oi = [
872
- "config",
873
- "onProps",
874
- "onStart",
875
- "onChange",
876
- "onPause",
877
- "onResume",
878
- "onRest"
879
- ], Vi = {
880
- config: 1,
881
- from: 1,
882
- to: 1,
883
- ref: 1,
884
- loop: 1,
885
- reset: 1,
886
- pause: 1,
887
- cancel: 1,
888
- reverse: 1,
889
- immediate: 1,
890
- default: 1,
891
- delay: 1,
892
- onProps: 1,
893
- onStart: 1,
894
- onChange: 1,
895
- onPause: 1,
896
- onResume: 1,
897
- onRest: 1,
898
- onResolve: 1,
899
- // Transition props
900
- items: 1,
901
- trail: 1,
902
- sort: 1,
903
- expires: 1,
904
- initial: 1,
905
- enter: 1,
906
- update: 1,
907
- leave: 1,
908
- children: 1,
909
- onDestroyed: 1,
910
- // Internal props
911
- keys: 1,
912
- callId: 1,
913
- parentId: 1
914
- };
915
- function Ni(e) {
916
- const t = {};
917
- let n = 0;
918
- if (z(e, (i, s) => {
919
- Vi[s] || (t[s] = i, n++);
920
- }), n)
921
- return t;
922
- }
923
- function gn(e) {
924
- const t = Ni(e);
925
- if (t) {
926
- const n = { to: t };
927
- return z(e, (i, s) => s in t || (n[s] = i)), n;
928
- }
929
- return { ...e };
930
- }
931
- function ve(e) {
932
- return e = T(e), l.arr(e) ? e.map(ve) : De(e) ? j.createStringInterpolator({
933
- range: [0, 1],
934
- output: [e, e]
935
- })(1) : e;
936
- }
937
- function Ui(e) {
938
- for (const t in e) return !0;
939
- return !1;
940
- }
941
- function Je(e) {
942
- return l.fun(e) || l.arr(e) && l.obj(e[0]);
943
- }
944
- function Di(e, t) {
945
- var n;
946
- (n = e.ref) == null || n.delete(e), t == null || t.delete(e);
947
- }
948
- function qi(e, t) {
949
- var n;
950
- t && e.ref !== t && ((n = e.ref) == null || n.delete(e), t.add(e), e.ref = t);
951
- }
952
- var ji = {
953
- default: { tension: 170, friction: 26 }
954
- }, et = {
955
- ...ji.default,
956
- mass: 1,
957
- damping: 1,
958
- easing: tn.linear,
959
- clamp: !1
960
- }, $i = class {
961
- constructor() {
962
- this.velocity = 0, Object.assign(this, et);
963
- }
964
- };
965
- function zi(e, t, n) {
966
- n && (n = { ...n }, Et(n, t), t = { ...n, ...t }), Et(e, t), Object.assign(e, t);
967
- for (const a in et)
968
- e[a] == null && (e[a] = et[a]);
969
- let { frequency: i, damping: s } = e;
970
- const { mass: r } = e;
971
- return l.und(i) || (i < 0.01 && (i = 0.01), s < 0 && (s = 0), e.tension = Math.pow(2 * Math.PI / i, 2) * r, e.friction = 4 * Math.PI * s * r / i), e;
972
- }
973
- function Et(e, t) {
974
- if (!l.und(t.decay))
975
- e.duration = void 0;
976
- else {
977
- const n = !l.und(t.tension) || !l.und(t.friction);
978
- (n || !l.und(t.frequency) || !l.und(t.damping) || !l.und(t.mass)) && (e.duration = void 0, e.decay = void 0), n && (e.frequency = void 0);
979
- }
980
- }
981
- var Ot = [], Li = class {
982
- constructor() {
983
- this.changed = !1, this.values = Ot, this.toValues = null, this.fromValues = Ot, this.config = new $i(), this.immediate = !1;
984
- }
985
- };
986
- function vn(e, { key: t, props: n, defaultProps: i, state: s, actions: r }) {
987
- return new Promise((a, o) => {
988
- let c, u, h = ce(n.cancel ?? (i == null ? void 0 : i.cancel), t);
989
- if (h)
990
- y();
991
- else {
992
- l.und(n.pause) || (s.paused = ce(n.pause, t));
993
- let f = i == null ? void 0 : i.pause;
994
- f !== !0 && (f = s.paused || ce(f, t)), c = K(n.delay || 0, t), f ? (s.resumeQueue.add(p), r.pause()) : (r.resume(), p());
995
- }
996
- function d() {
997
- s.resumeQueue.add(p), s.timeouts.delete(u), u.cancel(), c = u.time - w.now();
998
- }
999
- function p() {
1000
- c > 0 && !j.skipAnimation ? (s.delayed = !0, u = w.setTimeout(y, c), s.pauseQueue.add(d), s.timeouts.add(u)) : y();
1001
- }
1002
- function y() {
1003
- s.delayed && (s.delayed = !1), s.pauseQueue.delete(d), s.timeouts.delete(u), e <= (s.cancelId || 0) && (h = !0);
1004
- try {
1005
- r.start({ ...n, callId: e, cancel: h }, a);
1006
- } catch (f) {
1007
- o(f);
1008
- }
1009
- }
1010
- });
1011
- }
1012
- var gt = (e, t) => t.length == 1 ? t[0] : t.some((n) => n.cancelled) ? te(e.get()) : t.every((n) => n.noop) ? yn(e.get()) : D(
1013
- e.get(),
1014
- t.every((n) => n.finished)
1015
- ), yn = (e) => ({
1016
- value: e,
1017
- noop: !0,
1018
- finished: !0,
1019
- cancelled: !1
1020
- }), D = (e, t, n = !1) => ({
1021
- value: e,
1022
- finished: t,
1023
- cancelled: n
1024
- }), te = (e) => ({
1025
- value: e,
1026
- cancelled: !0,
1027
- finished: !1
1028
- });
1029
- function _n(e, t, n, i) {
1030
- const { callId: s, parentId: r, onRest: a } = t, { asyncTo: o, promise: c } = n;
1031
- return !r && e === o && !t.reset ? c : n.promise = (async () => {
1032
- n.asyncId = s, n.asyncTo = e;
1033
- const u = pt(
1034
- t,
1035
- (_, m) => (
1036
- // The `onRest` prop is only called when the `runAsync` promise is resolved.
1037
- m === "onRest" ? void 0 : _
1038
- )
1039
- );
1040
- let h, d;
1041
- const p = new Promise(
1042
- (_, m) => (h = _, d = m)
1043
- ), y = (_) => {
1044
- const m = (
1045
- // The `cancel` prop or `stop` method was used.
1046
- s <= (n.cancelId || 0) && te(i) || // The async `to` prop was replaced.
1047
- s !== n.asyncId && D(i, !1)
1048
- );
1049
- if (m)
1050
- throw _.result = m, d(_), _;
1051
- }, f = (_, m) => {
1052
- const b = new Vt(), v = new Nt();
1053
- return (async () => {
1054
- if (j.skipAnimation)
1055
- throw ye(n), v.result = D(i, !1), d(v), v;
1056
- y(b);
1057
- const A = l.obj(_) ? { ..._ } : { ...m, to: _ };
1058
- A.parentId = s, z(u, (x, I) => {
1059
- l.und(A[I]) && (A[I] = x);
1060
- });
1061
- const P = await i.start(A);
1062
- return y(b), n.paused && await new Promise((x) => {
1063
- n.resumeQueue.add(x);
1064
- }), P;
1065
- })();
1066
- };
1067
- let g;
1068
- if (j.skipAnimation)
1069
- return ye(n), D(i, !1);
1070
- try {
1071
- let _;
1072
- l.arr(e) ? _ = (async (m) => {
1073
- for (const b of m)
1074
- await f(b);
1075
- })(e) : _ = Promise.resolve(e(f, i.stop.bind(i))), await Promise.all([_.then(h), p]), g = D(i.get(), !0, !1);
1076
- } catch (_) {
1077
- if (_ instanceof Vt)
1078
- g = _.result;
1079
- else if (_ instanceof Nt)
1080
- g = _.result;
1081
- else
1082
- throw _;
1083
- } finally {
1084
- s == n.asyncId && (n.asyncId = r, n.asyncTo = r ? o : void 0, n.promise = r ? c : void 0);
1085
- }
1086
- return l.fun(a) && w.batchedUpdates(() => {
1087
- a(g, i, i.item);
1088
- }), g;
1089
- })();
1090
- }
1091
- function ye(e, t) {
1092
- ue(e.timeouts, (n) => n.cancel()), e.pauseQueue.clear(), e.resumeQueue.clear(), e.asyncId = e.asyncTo = e.promise = void 0, t && (e.cancelId = t);
1093
- }
1094
- var Vt = class extends Error {
1095
- constructor() {
1096
- super(
1097
- "An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."
1098
- );
1099
- }
1100
- }, Nt = class extends Error {
1101
- constructor() {
1102
- super("SkipAnimationSignal");
1103
- }
1104
- }, tt = (e) => e instanceof vt, Qi = 1, vt = class extends nn {
1105
- constructor() {
1106
- super(...arguments), this.id = Qi++, this._priority = 0;
1107
- }
1108
- get priority() {
1109
- return this._priority;
1110
- }
1111
- set priority(e) {
1112
- this._priority != e && (this._priority = e, this._onPriorityChange(e));
1113
- }
1114
- /** Get the current value */
1115
- get() {
1116
- const e = $(this);
1117
- return e && e.getValue();
1118
- }
1119
- /** Create a spring that maps our value to another value */
1120
- to(...e) {
1121
- return j.to(this, e);
1122
- }
1123
- /** @deprecated Use the `to` method instead. */
1124
- interpolate(...e) {
1125
- return bi(), j.to(this, e);
1126
- }
1127
- toJSON() {
1128
- return this.get();
1129
- }
1130
- observerAdded(e) {
1131
- e == 1 && this._attach();
1132
- }
1133
- observerRemoved(e) {
1134
- e == 0 && this._detach();
1135
- }
1136
- /** Called when the first child is added. */
1137
- _attach() {
1138
- }
1139
- /** Called when the last child is removed. */
1140
- _detach() {
1141
- }
1142
- /** Tell our children about our new value */
1143
- _onChange(e, t = !1) {
1144
- me(this, {
1145
- type: "change",
1146
- parent: this,
1147
- value: e,
1148
- idle: t
1149
- });
1150
- }
1151
- /** Tell our children about our new priority */
1152
- _onPriorityChange(e) {
1153
- this.idle || Ve.sort(this), me(this, {
1154
- type: "priority",
1155
- parent: this,
1156
- priority: e
1157
- });
1158
- }
1159
- }, Z = Symbol.for("SpringPhase"), bn = 1, wn = 2, An = 4, Me = (e) => (e[Z] & bn) > 0, M = (e) => (e[Z] & wn) > 0, se = (e) => (e[Z] & An) > 0, Ut = (e, t) => t ? e[Z] |= wn | bn : e[Z] &= -3, Dt = (e, t) => t ? e[Z] |= An : e[Z] &= -5, Gi = class extends vt {
1160
- constructor(e, t) {
1161
- if (super(), this.animation = new Li(), this.defaultProps = {}, this._state = {
1162
- paused: !1,
1163
- delayed: !1,
1164
- pauseQueue: /* @__PURE__ */ new Set(),
1165
- resumeQueue: /* @__PURE__ */ new Set(),
1166
- timeouts: /* @__PURE__ */ new Set()
1167
- }, this._pendingCalls = /* @__PURE__ */ new Set(), this._lastCallId = 0, this._lastToId = 0, this._memoizedDuration = 0, !l.und(e) || !l.und(t)) {
1168
- const n = l.obj(e) ? { ...e } : { ...t, from: e };
1169
- l.und(n.default) && (n.default = !0), this.start(n);
1170
- }
1171
- }
1172
- /** Equals true when not advancing on each frame. */
1173
- get idle() {
1174
- return !(M(this) || this._state.asyncTo) || se(this);
1175
- }
1176
- get goal() {
1177
- return T(this.animation.to);
1178
- }
1179
- get velocity() {
1180
- const e = $(this);
1181
- return e instanceof je ? e.lastVelocity || 0 : e.getPayload().map((t) => t.lastVelocity || 0);
1182
- }
1183
- /**
1184
- * When true, this value has been animated at least once.
1185
- */
1186
- get hasAnimated() {
1187
- return Me(this);
1188
- }
1189
- /**
1190
- * When true, this value has an unfinished animation,
1191
- * which is either active or paused.
1192
- */
1193
- get isAnimating() {
1194
- return M(this);
1195
- }
1196
- /**
1197
- * When true, all current and future animations are paused.
1198
- */
1199
- get isPaused() {
1200
- return se(this);
1201
- }
1202
- /**
1203
- *
1204
- *
1205
- */
1206
- get isDelayed() {
1207
- return this._state.delayed;
1208
- }
1209
- /** Advance the current animation by a number of milliseconds */
1210
- advance(e) {
1211
- let t = !0, n = !1;
1212
- const i = this.animation;
1213
- let { toValues: s } = i;
1214
- const { config: r } = i, a = qe(i.to);
1215
- !a && O(i.to) && (s = E(T(i.to))), i.values.forEach((u, h) => {
1216
- if (u.done) return;
1217
- const d = (
1218
- // Animated strings always go from 0 to 1.
1219
- u.constructor == Te ? 1 : a ? a[h].lastPosition : s[h]
1220
- );
1221
- let p = i.immediate, y = d;
1222
- if (!p) {
1223
- if (y = u.lastPosition, r.tension <= 0) {
1224
- u.done = !0;
1225
- return;
1226
- }
1227
- let f = u.elapsedTime += e;
1228
- const g = i.fromValues[h], _ = u.v0 != null ? u.v0 : u.v0 = l.arr(r.velocity) ? r.velocity[h] : r.velocity;
1229
- let m;
1230
- const b = r.precision || (g == d ? 5e-3 : Math.min(1, Math.abs(d - g) * 1e-3));
1231
- if (l.und(r.duration))
1232
- if (r.decay) {
1233
- const v = r.decay === !0 ? 0.998 : r.decay, A = Math.exp(-(1 - v) * f);
1234
- y = g + _ / (1 - v) * (1 - A), p = Math.abs(u.lastPosition - y) <= b, m = _ * A;
1235
- } else {
1236
- m = u.lastVelocity == null ? _ : u.lastVelocity;
1237
- const v = r.restVelocity || b / 10, A = r.clamp ? 0 : r.bounce, P = !l.und(A), x = g == d ? u.v0 > 0 : g < d;
1238
- let I, R = !1;
1239
- const C = 1, N = Math.ceil(e / C);
1240
- for (let F = 0; F < N && (I = Math.abs(m) > v, !(!I && (p = Math.abs(d - y) <= b, p))); ++F) {
1241
- P && (R = y == d || y > d == x, R && (m = -m * A, y = d));
1242
- const G = -r.tension * 1e-6 * (y - d), L = -r.friction * 1e-3 * m, ze = (G + L) / r.mass;
1243
- m = m + ze * C, y = y + m * C;
1244
- }
1245
- }
1246
- else {
1247
- let v = 1;
1248
- r.duration > 0 && (this._memoizedDuration !== r.duration && (this._memoizedDuration = r.duration, u.durationProgress > 0 && (u.elapsedTime = r.duration * u.durationProgress, f = u.elapsedTime += e)), v = (r.progress || 0) + f / this._memoizedDuration, v = v > 1 ? 1 : v < 0 ? 0 : v, u.durationProgress = v), y = g + r.easing(v) * (d - g), m = (y - u.lastPosition) / e, p = v == 1;
1249
- }
1250
- u.lastVelocity = m, Number.isNaN(y) && (console.warn("Got NaN while animating:", this), p = !0);
1251
- }
1252
- a && !a[h].done && (p = !1), p ? u.done = !0 : t = !1, u.setValue(y, r.round) && (n = !0);
1253
- });
1254
- const o = $(this), c = o.getValue();
1255
- if (t) {
1256
- const u = T(i.to);
1257
- (c !== u || n) && !r.decay ? (o.setValue(u), this._onChange(u)) : n && r.decay && this._onChange(c), this._stop();
1258
- } else n && this._onChange(c);
1259
- }
1260
- /** Set the current value, while stopping the current animation */
1261
- set(e) {
1262
- return w.batchedUpdates(() => {
1263
- this._stop(), this._focus(e), this._set(e);
1264
- }), this;
1265
- }
1266
- /**
1267
- * Freeze the active animation in time, as well as any updates merged
1268
- * before `resume` is called.
1269
- */
1270
- pause() {
1271
- this._update({ pause: !0 });
1272
- }
1273
- /** Resume the animation if paused. */
1274
- resume() {
1275
- this._update({ pause: !1 });
1276
- }
1277
- /** Skip to the end of the current animation. */
1278
- finish() {
1279
- if (M(this)) {
1280
- const { to: e, config: t } = this.animation;
1281
- w.batchedUpdates(() => {
1282
- this._onStart(), t.decay || this._set(e, !1), this._stop();
1283
- });
1284
- }
1285
- return this;
1286
- }
1287
- /** Push props into the pending queue. */
1288
- update(e) {
1289
- return (this.queue || (this.queue = [])).push(e), this;
1290
- }
1291
- start(e, t) {
1292
- let n;
1293
- return l.und(e) ? (n = this.queue || [], this.queue = []) : n = [l.obj(e) ? e : { ...t, to: e }], Promise.all(
1294
- n.map((i) => this._update(i))
1295
- ).then((i) => gt(this, i));
1296
- }
1297
- /**
1298
- * Stop the current animation, and cancel any delayed updates.
1299
- *
1300
- * Pass `true` to call `onRest` with `cancelled: true`.
1301
- */
1302
- stop(e) {
1303
- const { to: t } = this.animation;
1304
- return this._focus(this.get()), ye(this._state, e && this._lastCallId), w.batchedUpdates(() => this._stop(t, e)), this;
1305
- }
1306
- /** Restart the animation. */
1307
- reset() {
1308
- this._update({ reset: !0 });
1309
- }
1310
- /** @internal */
1311
- eventObserved(e) {
1312
- e.type == "change" ? this._start() : e.type == "priority" && (this.priority = e.priority + 1);
1313
- }
1314
- /**
1315
- * Parse the `to` and `from` range from the given `props` object.
1316
- *
1317
- * This also ensures the initial value is available to animated components
1318
- * during the render phase.
1319
- */
1320
- _prepareNode(e) {
1321
- const t = this.key || "";
1322
- let { to: n, from: i } = e;
1323
- n = l.obj(n) ? n[t] : n, (n == null || Je(n)) && (n = void 0), i = l.obj(i) ? i[t] : i, i == null && (i = void 0);
1324
- const s = { to: n, from: i };
1325
- return Me(this) || (e.reverse && ([n, i] = [i, n]), i = T(i), l.und(i) ? $(this) || this._set(n) : this._set(i)), s;
1326
- }
1327
- /** Every update is processed by this method before merging. */
1328
- _update({ ...e }, t) {
1329
- const { key: n, defaultProps: i } = this;
1330
- e.default && Object.assign(
1331
- i,
1332
- pt(
1333
- e,
1334
- (a, o) => /^on/.test(o) ? mn(a, n) : a
1335
- )
1336
- ), jt(this, e, "onProps"), ae(this, "onProps", e, this);
1337
- const s = this._prepareNode(e);
1338
- if (Object.isFrozen(this))
1339
- throw Error(
1340
- "Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?"
1341
- );
1342
- const r = this._state;
1343
- return vn(++this._lastCallId, {
1344
- key: n,
1345
- props: e,
1346
- defaultProps: i,
1347
- state: r,
1348
- actions: {
1349
- pause: () => {
1350
- se(this) || (Dt(this, !0), oe(r.pauseQueue), ae(
1351
- this,
1352
- "onPause",
1353
- D(this, re(this, this.animation.to)),
1354
- this
1355
- ));
1356
- },
1357
- resume: () => {
1358
- se(this) && (Dt(this, !1), M(this) && this._resume(), oe(r.resumeQueue), ae(
1359
- this,
1360
- "onResume",
1361
- D(this, re(this, this.animation.to)),
1362
- this
1363
- ));
1364
- },
1365
- start: this._merge.bind(this, s)
1366
- }
1367
- }).then((a) => {
1368
- if (e.loop && a.finished && !(t && a.noop)) {
1369
- const o = Sn(e);
1370
- if (o)
1371
- return this._update(o, !0);
1372
- }
1373
- return a;
1374
- });
1375
- }
1376
- /** Merge props into the current animation */
1377
- _merge(e, t, n) {
1378
- if (t.cancel)
1379
- return this.stop(!0), n(te(this));
1380
- const i = !l.und(e.to), s = !l.und(e.from);
1381
- if (i || s)
1382
- if (t.callId > this._lastToId)
1383
- this._lastToId = t.callId;
1384
- else
1385
- return n(te(this));
1386
- const { key: r, defaultProps: a, animation: o } = this, { to: c, from: u } = o;
1387
- let { to: h = c, from: d = u } = e;
1388
- s && !i && (!t.default || l.und(h)) && (h = d), t.reverse && ([h, d] = [d, h]);
1389
- const p = !Q(d, u);
1390
- p && (o.from = d), d = T(d);
1391
- const y = !Q(h, c);
1392
- y && this._focus(h);
1393
- const f = Je(t.to), { config: g } = o, { decay: _, velocity: m } = g;
1394
- (i || s) && (g.velocity = 0), t.config && !f && zi(
1395
- g,
1396
- K(t.config, r),
1397
- // Avoid calling the same "config" prop twice.
1398
- t.config !== a.config ? K(a.config, r) : void 0
1399
- );
1400
- let b = $(this);
1401
- if (!b || l.und(h))
1402
- return n(D(this, !0));
1403
- const v = (
1404
- // When `reset` is undefined, the `from` prop implies `reset: true`,
1405
- // except for declarative updates. When `reset` is defined, there
1406
- // must exist a value to animate from.
1407
- l.und(t.reset) ? s && !t.default : !l.und(d) && ce(t.reset, r)
1408
- ), A = v ? d : this.get(), P = ve(h), x = l.num(P) || l.arr(P) || De(P), I = !f && (!x || ce(a.immediate || t.immediate, r));
1409
- if (y) {
1410
- const F = Xe(h);
1411
- if (F !== b.constructor)
1412
- if (I)
1413
- b = this._set(P);
1414
- else
1415
- throw Error(
1416
- `Cannot animate between ${b.constructor.name} and ${F.name}, as the "to" prop suggests`
1417
- );
1418
- }
1419
- const R = b.constructor;
1420
- let C = O(h), N = !1;
1421
- if (!C) {
1422
- const F = v || !Me(this) && p;
1423
- (y || F) && (N = Q(ve(A), P), C = !N), (!Q(o.immediate, I) && !I || !Q(g.decay, _) || !Q(g.velocity, m)) && (C = !0);
1424
- }
1425
- if (N && M(this) && (o.changed && !v ? C = !0 : C || this._stop(c)), !f && ((C || O(c)) && (o.values = b.getPayload(), o.toValues = O(h) ? null : R == Te ? [1] : E(P)), o.immediate != I && (o.immediate = I, !I && !v && this._set(c)), C)) {
1426
- const { onRest: F } = o;
1427
- S(Hi, (L) => jt(this, t, L));
1428
- const G = D(this, re(this, c));
1429
- oe(this._pendingCalls, G), this._pendingCalls.add(n), o.changed && w.batchedUpdates(() => {
1430
- var L;
1431
- o.changed = !v, F == null || F(G, this), v ? K(a.onRest, G) : (L = o.onStart) == null || L.call(o, G, this);
1432
- });
1433
- }
1434
- v && this._set(A), f ? n(_n(t.to, t, this._state, this)) : C ? this._start() : M(this) && !y ? this._pendingCalls.add(n) : n(yn(A));
1435
- }
1436
- /** Update the `animation.to` value, which might be a `FluidValue` */
1437
- _focus(e) {
1438
- const t = this.animation;
1439
- e !== t.to && (Rt(this) && this._detach(), t.to = e, Rt(this) && this._attach());
1440
- }
1441
- _attach() {
1442
- let e = 0;
1443
- const { to: t } = this.animation;
1444
- O(t) && (ie(t, this), tt(t) && (e = t.priority + 1)), this.priority = e;
1445
- }
1446
- _detach() {
1447
- const { to: e } = this.animation;
1448
- O(e) && pe(e, this);
1449
- }
1450
- /**
1451
- * Update the current value from outside the frameloop,
1452
- * and return the `Animated` node.
1453
- */
1454
- _set(e, t = !0) {
1455
- const n = T(e);
1456
- if (!l.und(n)) {
1457
- const i = $(this);
1458
- if (!i || !Q(n, i.getValue())) {
1459
- const s = Xe(n);
1460
- !i || i.constructor != s ? mt(this, s.create(n)) : i.setValue(n), i && w.batchedUpdates(() => {
1461
- this._onChange(n, t);
1462
- });
1463
- }
1464
- }
1465
- return $(this);
1466
- }
1467
- _onStart() {
1468
- const e = this.animation;
1469
- e.changed || (e.changed = !0, ae(
1470
- this,
1471
- "onStart",
1472
- D(this, re(this, e.to)),
1473
- this
1474
- ));
1475
- }
1476
- _onChange(e, t) {
1477
- t || (this._onStart(), K(this.animation.onChange, e, this)), K(this.defaultProps.onChange, e, this), super._onChange(e, t);
1478
- }
1479
- // This method resets the animation state (even if already animating) to
1480
- // ensure the latest from/to range is used, and it also ensures this spring
1481
- // is added to the frameloop.
1482
- _start() {
1483
- const e = this.animation;
1484
- $(this).reset(T(e.to)), e.immediate || (e.fromValues = e.values.map((t) => t.lastPosition)), M(this) || (Ut(this, !0), se(this) || this._resume());
1485
- }
1486
- _resume() {
1487
- j.skipAnimation ? this.finish() : Ve.start(this);
1488
- }
1489
- /**
1490
- * Exit the frameloop and notify `onRest` listeners.
1491
- *
1492
- * Always wrap `_stop` calls with `batchedUpdates`.
1493
- */
1494
- _stop(e, t) {
1495
- if (M(this)) {
1496
- Ut(this, !1);
1497
- const n = this.animation;
1498
- S(n.values, (s) => {
1499
- s.done = !0;
1500
- }), n.toValues && (n.onChange = n.onPause = n.onResume = void 0), me(this, {
1501
- type: "idle",
1502
- parent: this
1503
- });
1504
- const i = t ? te(this.get()) : D(this.get(), re(this, e ?? n.to));
1505
- oe(this._pendingCalls, i), n.changed && (n.changed = !1, ae(this, "onRest", i, this));
1506
- }
1507
- }
1508
- };
1509
- function re(e, t) {
1510
- const n = ve(t), i = ve(e.get());
1511
- return Q(i, n);
1512
- }
1513
- function Sn(e, t = e.loop, n = e.to) {
1514
- const i = K(t);
1515
- if (i) {
1516
- const s = i !== !0 && gn(i), r = (s || e).reverse, a = !s || s.reset;
1517
- return _e({
1518
- ...e,
1519
- loop: t,
1520
- // Avoid updating default props when looping.
1521
- default: !1,
1522
- // Never loop the `pause` prop.
1523
- pause: void 0,
1524
- // For the "reverse" prop to loop as expected, the "to" prop
1525
- // must be undefined. The "reverse" prop is ignored when the
1526
- // "to" prop is an array or function.
1527
- to: !r || Je(n) ? n : void 0,
1528
- // Ignore the "from" prop except on reset.
1529
- from: a ? e.from : void 0,
1530
- reset: a,
1531
- // The "loop" prop can return a "useSpring" props object to
1532
- // override any of the original props.
1533
- ...s
1534
- });
1535
- }
1536
- }
1537
- function _e(e) {
1538
- const { to: t, from: n } = e = gn(e), i = /* @__PURE__ */ new Set();
1539
- return l.obj(t) && qt(t, i), l.obj(n) && qt(n, i), e.keys = i.size ? Array.from(i) : null, e;
1540
- }
1541
- function Mi(e) {
1542
- const t = _e(e);
1543
- return l.und(t.default) && (t.default = pt(t)), t;
1544
- }
1545
- function qt(e, t) {
1546
- z(e, (n, i) => n != null && t.add(i));
1547
- }
1548
- var Hi = [
1549
- "onStart",
1550
- "onRest",
1551
- "onChange",
1552
- "onPause",
1553
- "onResume"
1554
- ];
1555
- function jt(e, t, n) {
1556
- e.animation[n] = t[n] !== pn(t, n) ? mn(t[n], e.key) : void 0;
1557
- }
1558
- function ae(e, t, ...n) {
1559
- var i, s, r, a;
1560
- (s = (i = e.animation)[t]) == null || s.call(i, ...n), (a = (r = e.defaultProps)[t]) == null || a.call(r, ...n);
1561
- }
1562
- var Bi = ["onStart", "onChange", "onRest"], Wi = 1, Ki = class {
1563
- constructor(e, t) {
1564
- this.id = Wi++, this.springs = {}, this.queue = [], this._lastAsyncId = 0, this._active = /* @__PURE__ */ new Set(), this._changed = /* @__PURE__ */ new Set(), this._started = !1, this._state = {
1565
- paused: !1,
1566
- pauseQueue: /* @__PURE__ */ new Set(),
1567
- resumeQueue: /* @__PURE__ */ new Set(),
1568
- timeouts: /* @__PURE__ */ new Set()
1569
- }, this._events = {
1570
- onStart: /* @__PURE__ */ new Map(),
1571
- onChange: /* @__PURE__ */ new Map(),
1572
- onRest: /* @__PURE__ */ new Map()
1573
- }, this._onFrame = this._onFrame.bind(this), t && (this._flush = t), e && this.start({ default: !0, ...e });
1574
- }
1575
- /**
1576
- * Equals `true` when no spring values are in the frameloop, and
1577
- * no async animation is currently active.
1578
- */
1579
- get idle() {
1580
- return !this._state.asyncTo && Object.values(this.springs).every((e) => e.idle && !e.isDelayed && !e.isPaused);
1581
- }
1582
- get item() {
1583
- return this._item;
1584
- }
1585
- set item(e) {
1586
- this._item = e;
1587
- }
1588
- /** Get the current values of our springs */
1589
- get() {
1590
- const e = {};
1591
- return this.each((t, n) => e[n] = t.get()), e;
1592
- }
1593
- /** Set the current values without animating. */
1594
- set(e) {
1595
- for (const t in e) {
1596
- const n = e[t];
1597
- l.und(n) || this.springs[t].set(n);
1598
- }
1599
- }
1600
- /** Push an update onto the queue of each value. */
1601
- update(e) {
1602
- return e && this.queue.push(_e(e)), this;
1603
- }
1604
- /**
1605
- * Start the queued animations for every spring, and resolve the returned
1606
- * promise once all queued animations have finished or been cancelled.
1607
- *
1608
- * When you pass a queue (instead of nothing), that queue is used instead of
1609
- * the queued animations added with the `update` method, which are left alone.
1610
- */
1611
- start(e) {
1612
- let { queue: t } = this;
1613
- return e ? t = E(e).map(_e) : this.queue = [], this._flush ? this._flush(this, t) : (Cn(this, t), nt(this, t));
1614
- }
1615
- /** @internal */
1616
- stop(e, t) {
1617
- if (e !== !!e && (t = e), t) {
1618
- const n = this.springs;
1619
- S(E(t), (i) => n[i].stop(!!e));
1620
- } else
1621
- ye(this._state, this._lastAsyncId), this.each((n) => n.stop(!!e));
1622
- return this;
1623
- }
1624
- /** Freeze the active animation in time */
1625
- pause(e) {
1626
- if (l.und(e))
1627
- this.start({ pause: !0 });
1628
- else {
1629
- const t = this.springs;
1630
- S(E(e), (n) => t[n].pause());
1631
- }
1632
- return this;
1633
- }
1634
- /** Resume the animation if paused. */
1635
- resume(e) {
1636
- if (l.und(e))
1637
- this.start({ pause: !1 });
1638
- else {
1639
- const t = this.springs;
1640
- S(E(e), (n) => t[n].resume());
1641
- }
1642
- return this;
1643
- }
1644
- /** Call a function once per spring value */
1645
- each(e) {
1646
- z(this.springs, e);
1647
- }
1648
- /** @internal Called at the end of every animation frame */
1649
- _onFrame() {
1650
- const { onStart: e, onChange: t, onRest: n } = this._events, i = this._active.size > 0, s = this._changed.size > 0;
1651
- (i && !this._started || s && !this._started) && (this._started = !0, ue(e, ([o, c]) => {
1652
- c.value = this.get(), o(c, this, this._item);
1653
- }));
1654
- const r = !i && this._started, a = s || r && n.size ? this.get() : null;
1655
- s && t.size && ue(t, ([o, c]) => {
1656
- c.value = a, o(c, this, this._item);
1657
- }), r && (this._started = !1, ue(n, ([o, c]) => {
1658
- c.value = a, o(c, this, this._item);
1659
- }));
1660
- }
1661
- /** @internal */
1662
- eventObserved(e) {
1663
- if (e.type == "change")
1664
- this._changed.add(e.parent), e.idle || this._active.add(e.parent);
1665
- else if (e.type == "idle")
1666
- this._active.delete(e.parent);
1667
- else return;
1668
- w.onFrame(this._onFrame);
1669
- }
1670
- };
1671
- function nt(e, t) {
1672
- return Promise.all(t.map((n) => Pn(e, n))).then(
1673
- (n) => gt(e, n)
1674
- );
1675
- }
1676
- async function Pn(e, t, n) {
1677
- const { keys: i, to: s, from: r, loop: a, onRest: o, onResolve: c } = t, u = l.obj(t.default) && t.default;
1678
- a && (t.loop = !1), s === !1 && (t.to = null), r === !1 && (t.from = null);
1679
- const h = l.arr(s) || l.fun(s) ? s : void 0;
1680
- h ? (t.to = void 0, t.onRest = void 0, u && (u.onRest = void 0)) : S(Bi, (g) => {
1681
- const _ = t[g];
1682
- if (l.fun(_)) {
1683
- const m = e._events[g];
1684
- t[g] = ({ finished: b, cancelled: v }) => {
1685
- const A = m.get(_);
1686
- A ? (b || (A.finished = !1), v && (A.cancelled = !0)) : m.set(_, {
1687
- value: null,
1688
- finished: b || !1,
1689
- cancelled: v || !1
1690
- });
1691
- }, u && (u[g] = t[g]);
1692
- }
1693
- });
1694
- const d = e._state;
1695
- t.pause === !d.paused ? (d.paused = t.pause, oe(t.pause ? d.pauseQueue : d.resumeQueue)) : d.paused && (t.pause = !0);
1696
- const p = (i || Object.keys(e.springs)).map(
1697
- (g) => e.springs[g].start(t)
1698
- ), y = t.cancel === !0 || pn(t, "cancel") === !0;
1699
- (h || y && d.asyncId) && p.push(
1700
- vn(++e._lastAsyncId, {
1701
- props: t,
1702
- state: d,
1703
- actions: {
1704
- pause: Ye,
1705
- resume: Ye,
1706
- start(g, _) {
1707
- y ? (ye(d, e._lastAsyncId), _(te(e))) : (g.onRest = o, _(
1708
- _n(
1709
- h,
1710
- g,
1711
- d,
1712
- e
1713
- )
1714
- ));
1715
- }
1716
- }
1717
- })
1718
- ), d.paused && await new Promise((g) => {
1719
- d.resumeQueue.add(g);
1720
- });
1721
- const f = gt(e, await Promise.all(p));
1722
- if (a && f.finished && !(n && f.noop)) {
1723
- const g = Sn(t, a, s);
1724
- if (g)
1725
- return Cn(e, [g]), Pn(e, g, !0);
1726
- }
1727
- return c && w.batchedUpdates(() => c(f, e, e.item)), f;
1728
- }
1729
- function $t(e, t) {
1730
- const n = { ...e.springs };
1731
- return t && S(E(t), (i) => {
1732
- l.und(i.keys) && (i = _e(i)), l.obj(i.to) || (i = { ...i, to: void 0 }), xn(n, i, (s) => Rn(s));
1733
- }), In(e, n), n;
1734
- }
1735
- function In(e, t) {
1736
- z(t, (n, i) => {
1737
- e.springs[i] || (e.springs[i] = n, ie(n, e));
1738
- });
1739
- }
1740
- function Rn(e, t) {
1741
- const n = new Gi();
1742
- return n.key = e, t && ie(n, t), n;
1743
- }
1744
- function xn(e, t, n) {
1745
- t.keys && S(t.keys, (i) => {
1746
- (e[i] || (e[i] = n(i)))._prepareNode(t);
1747
- });
1748
- }
1749
- function Cn(e, t) {
1750
- S(t, (n) => {
1751
- xn(e.springs, n, (i) => Rn(i, e));
1752
- });
1753
- }
1754
- var Yi = Qt.createContext({
1755
- pause: !1,
1756
- immediate: !1
1757
- }), Zi = () => {
1758
- const e = [], t = function(i) {
1759
- Ai();
1760
- const s = [];
1761
- return S(e, (r, a) => {
1762
- if (l.und(i))
1763
- s.push(r.start());
1764
- else {
1765
- const o = n(i, r, a);
1766
- o && s.push(r.start(o));
1767
- }
1768
- }), s;
1769
- };
1770
- t.current = e, t.add = function(i) {
1771
- e.includes(i) || e.push(i);
1772
- }, t.delete = function(i) {
1773
- const s = e.indexOf(i);
1774
- ~s && e.splice(s, 1);
1775
- }, t.pause = function() {
1776
- return S(e, (i) => i.pause(...arguments)), this;
1777
- }, t.resume = function() {
1778
- return S(e, (i) => i.resume(...arguments)), this;
1779
- }, t.set = function(i) {
1780
- S(e, (s, r) => {
1781
- const a = l.fun(i) ? i(r, s) : i;
1782
- a && s.set(a);
1783
- });
1784
- }, t.start = function(i) {
1785
- const s = [];
1786
- return S(e, (r, a) => {
1787
- if (l.und(i))
1788
- s.push(r.start());
1789
- else {
1790
- const o = this._getProps(i, r, a);
1791
- o && s.push(r.start(o));
1792
- }
1793
- }), s;
1794
- }, t.stop = function() {
1795
- return S(e, (i) => i.stop(...arguments)), this;
1796
- }, t.update = function(i) {
1797
- return S(e, (s, r) => s.update(this._getProps(i, s, r))), this;
1798
- };
1799
- const n = function(i, s, r) {
1800
- return l.fun(i) ? i(r, s) : i;
1801
- };
1802
- return t._getProps = n, t;
1803
- };
1804
- function Xi(e, t, n) {
1805
- const i = l.fun(t) && t;
1806
- i && !n && (n = []);
1807
- const s = Ae(
1808
- () => i || arguments.length == 3 ? Zi() : void 0,
1809
- []
1810
- ), r = Y(0), a = un(), o = Ae(
1811
- () => ({
1812
- ctrls: [],
1813
- queue: [],
1814
- flush(m, b) {
1815
- const v = $t(m, b);
1816
- return r.current > 0 && !o.queue.length && !Object.keys(v).some((P) => !m.springs[P]) ? nt(m, b) : new Promise((P) => {
1817
- In(m, v), o.queue.push(() => {
1818
- P(nt(m, b));
1819
- }), a();
1820
- });
1821
- }
1822
- }),
1823
- []
1824
- ), c = Y([...o.ctrls]), u = Y([]), h = Ct(e) || 0;
1825
- Ae(() => {
1826
- S(c.current.slice(e, h), (m) => {
1827
- Di(m, s), m.stop(!0);
1828
- }), c.current.length = e, d(h, e);
1829
- }, [e]), Ae(() => {
1830
- d(0, Math.min(h, e));
1831
- }, n);
1832
- function d(m, b) {
1833
- for (let v = m; v < b; v++) {
1834
- const A = c.current[v] || (c.current[v] = new Ki(null, o.flush)), P = i ? i(v, A) : t[v];
1835
- P && (u.current[v] = Mi(P));
1836
- }
1837
- }
1838
- const p = c.current.map(
1839
- (m, b) => $t(m, u.current[b])
1840
- ), y = Un(Yi), f = Ct(y), g = y !== f && Ui(y);
1841
- ht(() => {
1842
- r.current++, o.ctrls = c.current;
1843
- const { queue: m } = o;
1844
- m.length && (o.queue = [], S(m, (b) => b())), S(c.current, (b, v) => {
1845
- s == null || s.add(b), g && b.start({ default: y });
1846
- const A = u.current[v];
1847
- A && (qi(b, A.ref), b.ref ? b.queue.push(A) : b.start(A));
1848
- });
1849
- }), ln(() => () => {
1850
- S(o.ctrls, (m) => m.stop(!0));
1851
- });
1852
- const _ = p.map((m) => ({ ...m }));
1853
- return s ? [_, s] : _;
1854
- }
1855
- function Ji(e, t) {
1856
- const n = l.fun(e), [[i], s] = Xi(
1857
- 1,
1858
- n ? e : [e],
1859
- n ? [] : t
1860
- );
1861
- return n || arguments.length == 2 ? [i, s] : i;
1862
- }
1863
- var es = class extends vt {
1864
- constructor(e, t) {
1865
- super(), this.source = e, this.idle = !0, this._active = /* @__PURE__ */ new Set(), this.calc = fe(...t);
1866
- const n = this._get(), i = Xe(n);
1867
- mt(this, i.create(n));
1868
- }
1869
- advance(e) {
1870
- const t = this._get(), n = this.get();
1871
- Q(t, n) || ($(this).setValue(t), this._onChange(t, this.idle)), !this.idle && zt(this._active) && He(this);
1872
- }
1873
- _get() {
1874
- const e = l.arr(this.source) ? this.source.map(T) : E(T(this.source));
1875
- return this.calc(...e);
1876
- }
1877
- _start() {
1878
- this.idle && !zt(this._active) && (this.idle = !1, S(qe(this), (e) => {
1879
- e.done = !1;
1880
- }), j.skipAnimation ? (w.batchedUpdates(() => this.advance()), He(this)) : Ve.start(this));
1881
- }
1882
- // Observe our sources only when we're observed.
1883
- _attach() {
1884
- let e = 1;
1885
- S(E(this.source), (t) => {
1886
- O(t) && ie(t, this), tt(t) && (t.idle || this._active.add(t), e = Math.max(e, t.priority + 1));
1887
- }), this.priority = e, this._start();
1888
- }
1889
- // Stop observing our sources once we have no observers.
1890
- _detach() {
1891
- S(E(this.source), (e) => {
1892
- O(e) && pe(e, this);
1893
- }), this._active.clear(), He(this);
1894
- }
1895
- /** @internal */
1896
- eventObserved(e) {
1897
- e.type == "change" ? e.idle ? this.advance() : (this._active.add(e.parent), this._start()) : e.type == "idle" ? this._active.delete(e.parent) : e.type == "priority" && (this.priority = E(this.source).reduce(
1898
- (t, n) => Math.max(t, (tt(n) ? n.priority : 0) + 1),
1899
- 0
1900
- ));
1901
- }
1902
- };
1903
- function ts(e) {
1904
- return e.idle !== !1;
1905
- }
1906
- function zt(e) {
1907
- return !e.size || Array.from(e).every(ts);
1908
- }
1909
- function He(e) {
1910
- e.idle || (e.idle = !0, S(qe(e), (t) => {
1911
- t.done = !0;
1912
- }), me(e, {
1913
- type: "idle",
1914
- parent: e
1915
- }));
1916
- }
1917
- j.assign({
1918
- createStringInterpolator: an,
1919
- to: (e, t) => new es(e, t)
1920
- });
1921
- var kn = /^--/;
1922
- function ns(e, t) {
1923
- return t == null || typeof t == "boolean" || t === "" ? "" : typeof t == "number" && t !== 0 && !kn.test(e) && !(de.hasOwnProperty(e) && de[e]) ? t + "px" : ("" + t).trim();
1924
- }
1925
- var Lt = {};
1926
- function is(e, t) {
1927
- if (!e.nodeType || !e.setAttribute)
1928
- return !1;
1929
- const n = e.nodeName === "filter" || e.parentNode && e.parentNode.nodeName === "filter", {
1930
- className: i,
1931
- style: s,
1932
- children: r,
1933
- scrollTop: a,
1934
- scrollLeft: o,
1935
- viewBox: c,
1936
- ...u
1937
- } = t, h = Object.values(u), d = Object.keys(u).map(
1938
- (p) => n || e.hasAttribute(p) ? p : Lt[p] || (Lt[p] = p.replace(
1939
- /([A-Z])/g,
1940
- // Attributes are written in dash case
1941
- (y) => "-" + y.toLowerCase()
1942
- ))
1943
- );
1944
- r !== void 0 && (e.textContent = r);
1945
- for (const p in s)
1946
- if (s.hasOwnProperty(p)) {
1947
- const y = ns(p, s[p]);
1948
- kn.test(p) ? e.style.setProperty(p, y) : e.style[p] = y;
1949
- }
1950
- d.forEach((p, y) => {
1951
- e.setAttribute(p, h[y]);
1952
- }), i !== void 0 && (e.className = i), a !== void 0 && (e.scrollTop = a), o !== void 0 && (e.scrollLeft = o), c !== void 0 && e.setAttribute("viewBox", c);
1953
- }
1954
- var de = {
1955
- animationIterationCount: !0,
1956
- borderImageOutset: !0,
1957
- borderImageSlice: !0,
1958
- borderImageWidth: !0,
1959
- boxFlex: !0,
1960
- boxFlexGroup: !0,
1961
- boxOrdinalGroup: !0,
1962
- columnCount: !0,
1963
- columns: !0,
1964
- flex: !0,
1965
- flexGrow: !0,
1966
- flexPositive: !0,
1967
- flexShrink: !0,
1968
- flexNegative: !0,
1969
- flexOrder: !0,
1970
- gridRow: !0,
1971
- gridRowEnd: !0,
1972
- gridRowSpan: !0,
1973
- gridRowStart: !0,
1974
- gridColumn: !0,
1975
- gridColumnEnd: !0,
1976
- gridColumnSpan: !0,
1977
- gridColumnStart: !0,
1978
- fontWeight: !0,
1979
- lineClamp: !0,
1980
- lineHeight: !0,
1981
- opacity: !0,
1982
- order: !0,
1983
- orphans: !0,
1984
- tabSize: !0,
1985
- widows: !0,
1986
- zIndex: !0,
1987
- zoom: !0,
1988
- // SVG-related properties
1989
- fillOpacity: !0,
1990
- floodOpacity: !0,
1991
- stopOpacity: !0,
1992
- strokeDasharray: !0,
1993
- strokeDashoffset: !0,
1994
- strokeMiterlimit: !0,
1995
- strokeOpacity: !0,
1996
- strokeWidth: !0
1997
- }, ss = (e, t) => e + t.charAt(0).toUpperCase() + t.substring(1), rs = ["Webkit", "Ms", "Moz", "O"];
1998
- de = Object.keys(de).reduce((e, t) => (rs.forEach((n) => e[ss(n, t)] = e[t]), e), de);
1999
- var as = /^(matrix|translate|scale|rotate|skew)/, os = /^(translate)/, us = /^(rotate|skew)/, Be = (e, t) => l.num(e) && e !== 0 ? e + t : e, xe = (e, t) => l.arr(e) ? e.every((n) => xe(n, t)) : l.num(e) ? e === t : parseFloat(e) === t, ls = class extends $e {
2000
- constructor({ x: e, y: t, z: n, ...i }) {
2001
- const s = [], r = [];
2002
- (e || t || n) && (s.push([e || 0, t || 0, n || 0]), r.push((a) => [
2003
- `translate3d(${a.map((o) => Be(o, "px")).join(",")})`,
2004
- // prettier-ignore
2005
- xe(a, 0)
2006
- ])), z(i, (a, o) => {
2007
- if (o === "transform")
2008
- s.push([a || ""]), r.push((c) => [c, c === ""]);
2009
- else if (as.test(o)) {
2010
- if (delete i[o], l.und(a)) return;
2011
- const c = os.test(o) ? "px" : us.test(o) ? "deg" : "";
2012
- s.push(E(a)), r.push(
2013
- o === "rotate3d" ? ([u, h, d, p]) => [
2014
- `rotate3d(${u},${h},${d},${Be(p, c)})`,
2015
- xe(p, 0)
2016
- ] : (u) => [
2017
- `${o}(${u.map((h) => Be(h, c)).join(",")})`,
2018
- xe(u, o.startsWith("scale") ? 1 : 0)
2019
- ]
2020
- );
2021
- }
2022
- }), s.length && (i.transform = new cs(s, r)), super(i);
2023
- }
2024
- }, cs = class extends nn {
2025
- constructor(e, t) {
2026
- super(), this.inputs = e, this.transforms = t, this._value = null;
2027
- }
2028
- get() {
2029
- return this._value || (this._value = this._get());
2030
- }
2031
- _get() {
2032
- let e = "", t = !0;
2033
- return S(this.inputs, (n, i) => {
2034
- const s = T(n[0]), [r, a] = this.transforms[i](
2035
- l.arr(s) ? s : n.map(T)
2036
- );
2037
- e += " " + r, t = t && a;
2038
- }), t ? "none" : e;
2039
- }
2040
- // Start observing our inputs once we have an observer.
2041
- observerAdded(e) {
2042
- e == 1 && S(
2043
- this.inputs,
2044
- (t) => S(
2045
- t,
2046
- (n) => O(n) && ie(n, this)
2047
- )
2048
- );
2049
- }
2050
- // Stop observing our inputs once we have no observers.
2051
- observerRemoved(e) {
2052
- e == 0 && S(
2053
- this.inputs,
2054
- (t) => S(
2055
- t,
2056
- (n) => O(n) && pe(n, this)
2057
- )
2058
- );
2059
- }
2060
- eventObserved(e) {
2061
- e.type == "change" && (this._value = null), me(this, e);
2062
- }
2063
- }, ds = [
2064
- "a",
2065
- "abbr",
2066
- "address",
2067
- "area",
2068
- "article",
2069
- "aside",
2070
- "audio",
2071
- "b",
2072
- "base",
2073
- "bdi",
2074
- "bdo",
2075
- "big",
2076
- "blockquote",
2077
- "body",
2078
- "br",
2079
- "button",
2080
- "canvas",
2081
- "caption",
2082
- "cite",
2083
- "code",
2084
- "col",
2085
- "colgroup",
2086
- "data",
2087
- "datalist",
2088
- "dd",
2089
- "del",
2090
- "details",
2091
- "dfn",
2092
- "dialog",
2093
- "div",
2094
- "dl",
2095
- "dt",
2096
- "em",
2097
- "embed",
2098
- "fieldset",
2099
- "figcaption",
2100
- "figure",
2101
- "footer",
2102
- "form",
2103
- "h1",
2104
- "h2",
2105
- "h3",
2106
- "h4",
2107
- "h5",
2108
- "h6",
2109
- "head",
2110
- "header",
2111
- "hgroup",
2112
- "hr",
2113
- "html",
2114
- "i",
2115
- "iframe",
2116
- "img",
2117
- "input",
2118
- "ins",
2119
- "kbd",
2120
- "keygen",
2121
- "label",
2122
- "legend",
2123
- "li",
2124
- "link",
2125
- "main",
2126
- "map",
2127
- "mark",
2128
- "menu",
2129
- "menuitem",
2130
- "meta",
2131
- "meter",
2132
- "nav",
2133
- "noscript",
2134
- "object",
2135
- "ol",
2136
- "optgroup",
2137
- "option",
2138
- "output",
2139
- "p",
2140
- "param",
2141
- "picture",
2142
- "pre",
2143
- "progress",
2144
- "q",
2145
- "rp",
2146
- "rt",
2147
- "ruby",
2148
- "s",
2149
- "samp",
2150
- "script",
2151
- "section",
2152
- "select",
2153
- "small",
2154
- "source",
2155
- "span",
2156
- "strong",
2157
- "style",
2158
- "sub",
2159
- "summary",
2160
- "sup",
2161
- "table",
2162
- "tbody",
2163
- "td",
2164
- "textarea",
2165
- "tfoot",
2166
- "th",
2167
- "thead",
2168
- "time",
2169
- "title",
2170
- "tr",
2171
- "track",
2172
- "u",
2173
- "ul",
2174
- "var",
2175
- "video",
2176
- "wbr",
2177
- // SVG
2178
- "circle",
2179
- "clipPath",
2180
- "defs",
2181
- "ellipse",
2182
- "foreignObject",
2183
- "g",
2184
- "image",
2185
- "line",
2186
- "linearGradient",
2187
- "mask",
2188
- "path",
2189
- "pattern",
2190
- "polygon",
2191
- "polyline",
2192
- "radialGradient",
2193
- "rect",
2194
- "stop",
2195
- "svg",
2196
- "text",
2197
- "tspan"
2198
- ];
2199
- j.assign({
2200
- batchedUpdates: $n,
2201
- createStringInterpolator: an,
2202
- colors: ti
2203
- });
2204
- var fs = Fi(ds, {
2205
- applyAnimatedValues: is,
2206
- createAnimatedStyle: (e) => new ls(e),
2207
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2208
- getComponentProps: ({ scrollTop: e, scrollLeft: t, ...n }) => n
2209
- }), hs = fs.animated;
2210
- const ms = "_content_12gg8_1", ps = {
2211
- content: ms
2212
- }, Tn = "ContextMenu.Content", gs = it(
2213
- ({
2214
- style: e,
2215
- className: t,
2216
- children: n,
2217
- alignOffset: i,
2218
- arrowPadding: s = 5,
2219
- collisionBoundary: r,
2220
- direction: a = k.DOWN_RIGHT,
2221
- disableAutoPositioning: o = !1,
2222
- onMouseEnter: c,
2223
- onMouseLeave: u,
2224
- onInteractOutside: h,
2225
- onEscapeKeyDown: d,
2226
- ...p
2227
- }, y) => {
2228
- const [f, g] = J(!1), [_, m] = J(null), {
2229
- triggerRef: b,
2230
- contentRef: v,
2231
- isOpen: A,
2232
- animatedOpen: P,
2233
- animationDuration: x,
2234
- mode: I,
2235
- temporaryHoverClose: R,
2236
- onMouseEnter: C,
2237
- onMouseLeave: N,
2238
- onChildOpen: F,
2239
- isRootContentBlocked: G,
2240
- isChildOpen: L,
2241
- closeMenuImmediately: ze,
2242
- isCloseOnClick: Fn
2243
- } = Qn(Tn), { align: En, offset: On, isPositioned: yt } = vs({
2244
- direction: a,
2245
- alignOffset: i,
2246
- disableAutoPositioning: o,
2247
- triggerRef: b,
2248
- contentRef: v,
2249
- collisionBoundary: r,
2250
- children: n
2251
- }), Vn = Ji({
2252
- opacity: yt && (I === _t.CLICK && !R || P) ? 1 : 0,
2253
- config: I === _t.CLICK && !R ? { duration: 0 } : { duration: x, easing: tn.easeInOutCubic }
2254
- });
2255
- return /* @__PURE__ */ Ie(
2256
- Ln,
2257
- {
2258
- hasItemWithIcon: f,
2259
- setHasItemWithIcon: g,
2260
- activeItemId: _,
2261
- setActiveItemId: m,
2262
- onChildOpen: F,
2263
- isCloseOnClick: Fn,
2264
- closeMenuImmediately: ze,
2265
- shouldCloseRootMenuOnClick: !1,
2266
- level: 1,
2267
- children: A && /* @__PURE__ */ Ie(
2268
- hs.div,
2269
- {
2270
- style: {
2271
- zIndex: Number.MAX_SAFE_INTEGER - 10,
2272
- position: "fixed",
2273
- ...Vn
2274
- },
2275
- "data-content-wrapper": !0,
2276
- children: /* @__PURE__ */ Dn(
2277
- qn,
2278
- {
2279
- ref: zn(v, y),
2280
- className: Gt(ps.content, t),
2281
- style: {
2282
- ...e || {},
2283
- pointerEvents: o || yt ? "auto" : "none"
2284
- },
2285
- collisionBoundary: r,
2286
- side: Gn[a],
2287
- align: En,
2288
- arrowPadding: s,
2289
- alignOffset: On,
2290
- onMouseEnter: (U) => {
2291
- C == null || C(U), c == null || c(U);
2292
- },
2293
- onMouseLeave: (U) => {
2294
- N == null || N(U), u == null || u(U);
2295
- },
2296
- onInteractOutside: (U) => {
2297
- L && U.preventDefault(), h == null || h(U);
2298
- },
2299
- onEscapeKeyDown: (U) => {
2300
- L && U.preventDefault(), d == null || d(U);
2301
- },
2302
- ...p,
2303
- children: [
2304
- n,
2305
- G && /* @__PURE__ */ Ie(Mt, {})
2306
- ]
2307
- }
2308
- )
2309
- }
2310
- )
2311
- }
2312
- );
2313
- }
2314
- );
2315
- gs.displayName = Tn;
2316
- function vs({
2317
- direction: e,
2318
- alignOffset: t = 0,
2319
- disableAutoPositioning: n,
2320
- triggerRef: i,
2321
- contentRef: s,
2322
- collisionBoundary: r,
2323
- children: a
2324
- }) {
2325
- const [o, c] = J(
2326
- e === k.UP_RIGHT || e === k.DOWN_RIGHT || e === k.RIGHT_UP || e === k.RIGHT_DOWN || !e ? "start" : "end"
2327
- ), [u, h] = J(t), [d, p] = J(!1), y = (f) => !f.width || !f.height || !isFinite(f.top) || !isFinite(f.left);
2328
- return We(() => {
2329
- const f = s == null ? void 0 : s.current, g = i == null ? void 0 : i.current;
2330
- if (!f || !g || n || [
2331
- k.DOWN_LEFT,
2332
- k.DOWN_RIGHT,
2333
- k.UP_LEFT,
2334
- k.UP_RIGHT
2335
- ].includes(e))
2336
- return;
2337
- const _ = Array.from(f.querySelectorAll("[data-item]"));
2338
- if (_.length === 0)
2339
- return;
2340
- const m = o === "start" ? _[0] : _[_.length - 1], b = () => {
2341
- const A = g.getBoundingClientRect(), P = f.getBoundingClientRect(), x = m.getBoundingClientRect();
2342
- if ([A, P, x].some(y)) {
2343
- requestAnimationFrame(b);
2344
- return;
2345
- }
2346
- const I = A.height / 2, R = x.height / 2, C = x.top - P.top, N = x.bottom - P.bottom;
2347
- h(o === "start" ? t + I - C - R : t + I + N - R);
2348
- };
2349
- requestAnimationFrame(b);
2350
- const v = new ResizeObserver(() => {
2351
- requestAnimationFrame(b);
2352
- });
2353
- return v.observe(m), v.observe(g), () => v.disconnect();
2354
- }, [
2355
- a,
2356
- e,
2357
- s,
2358
- i,
2359
- o,
2360
- t,
2361
- n
2362
- ]), We(() => {
2363
- if (n || !(i != null && i.current) || !e)
2364
- return;
2365
- let f = null, g = !0;
2366
- const _ = r instanceof Element && r || document.documentElement, m = () => {
2367
- if (!g)
2368
- return;
2369
- const b = i.current, v = s.current;
2370
- if (!b || !v)
2371
- return;
2372
- const A = b.getBoundingClientRect(), P = v.getBoundingClientRect();
2373
- if (P.width <= 0)
2374
- return;
2375
- const x = _.getBoundingClientRect(), I = {
2376
- right: x.right - A.right >= P.width,
2377
- left: A.left - x.left >= P.width,
2378
- bottom: x.bottom - A.bottom >= P.height,
2379
- top: A.top - x.top >= P.height
2380
- };
2381
- let R = "start";
2382
- switch (e) {
2383
- case k.UP_RIGHT:
2384
- case k.DOWN_RIGHT: {
2385
- I.right ? R = "start" : I.left ? R = "end" : R = "start";
2386
- break;
2387
- }
2388
- case k.UP_LEFT:
2389
- case k.DOWN_LEFT: {
2390
- I.left ? R = "end" : I.right ? R = "start" : R = "end";
2391
- break;
2392
- }
2393
- case k.RIGHT_DOWN:
2394
- case k.LEFT_DOWN: {
2395
- I.bottom ? R = "start" : I.top ? R = "end" : R = "start";
2396
- break;
2397
- }
2398
- case k.RIGHT_UP:
2399
- case k.LEFT_UP: {
2400
- I.top ? R = "end" : I.bottom ? R = "start" : R = "end";
2401
- break;
2402
- }
2403
- }
2404
- c(R), p(!0);
2405
- };
2406
- return requestAnimationFrame(m), s.current && typeof ResizeObserver < "u" && (f = new ResizeObserver(m), f.observe(s.current)), () => {
2407
- g = !1, f == null || f.disconnect();
2408
- };
2409
- }, [
2410
- e,
2411
- n,
2412
- i,
2413
- s,
2414
- r
2415
- ]), { align: o, offset: u, isPositioned: d };
2416
- }
2417
- export {
2418
- gs as C,
2419
- Mt as F,
2420
- Ji as a,
2421
- hs as b,
2422
- bt as c,
2423
- tn as e,
2424
- vs as u
2425
- };