@squeletteapp/widget 1.0.1 → 1.1.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.
package/dist/index.js CHANGED
@@ -1 +1,4057 @@
1
- export * from "./changelog-entry";
1
+ // ../widget-builder/dist/widget-builder.es.js
2
+ function ii(t, e) {
3
+ t.indexOf(e) === -1 && t.push(e);
4
+ }
5
+ function On(t, e) {
6
+ const n = t.indexOf(e);
7
+ n > -1 && t.splice(n, 1);
8
+ }
9
+ var Q = (t, e, n) => n > e ? e : n < t ? t : n;
10
+ function et(t, e) {
11
+ return e ? `${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}` : t;
12
+ }
13
+ var Se = () => {
14
+ };
15
+ var K = () => {
16
+ };
17
+ Se = (t, e, n) => {
18
+ !t && typeof console < "u" && console.warn(et(e, n));
19
+ }, K = (t, e, n) => {
20
+ if (!t)
21
+ throw new Error(et(e, n));
22
+ };
23
+ var U = {};
24
+ var Rn = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);
25
+ function ri(t) {
26
+ return typeof t == "object" && t !== null;
27
+ }
28
+ var Nn = (t) => /^0[^.\s]+$/u.test(t);
29
+ // @__NO_SIDE_EFFECTS__
30
+ function wt(t) {
31
+ let e;
32
+ return () => (e === void 0 && (e = t()), e);
33
+ }
34
+ var oe = /* @__NO_SIDE_EFFECTS__ */ (t) => t;
35
+ var oi = (t, e) => (n) => e(t(n));
36
+ var Tt = (...t) => t.reduce(oi);
37
+ var St = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
38
+ const s = e - t;
39
+ return s === 0 ? 1 : (n - t) / s;
40
+ };
41
+ var In = class {
42
+ constructor() {
43
+ this.subscriptions = [];
44
+ }
45
+ add(e) {
46
+ return ii(this.subscriptions, e), () => On(this.subscriptions, e);
47
+ }
48
+ notify(e, n, s) {
49
+ const i = this.subscriptions.length;
50
+ if (i)
51
+ if (i === 1)
52
+ this.subscriptions[0](e, n, s);
53
+ else
54
+ for (let r = 0; r < i; r++) {
55
+ const o = this.subscriptions[r];
56
+ o && o(e, n, s);
57
+ }
58
+ }
59
+ getSize() {
60
+ return this.subscriptions.length;
61
+ }
62
+ clear() {
63
+ this.subscriptions.length = 0;
64
+ }
65
+ };
66
+ var B = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3;
67
+ var W = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
68
+ function Wn(t, e) {
69
+ return e ? t * (1e3 / e) : 0;
70
+ }
71
+ var Gt = /* @__PURE__ */ new Set();
72
+ function Bn(t, e, n) {
73
+ t || Gt.has(e) || (console.warn(et(e, n)), Gt.add(e));
74
+ }
75
+ var ai = (t, e, n) => {
76
+ const s = e - t;
77
+ return ((n - t) % s + s) % s + t;
78
+ };
79
+ var Ln = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t;
80
+ var li = 1e-7;
81
+ var ui = 12;
82
+ function ci(t, e, n, s, i) {
83
+ let r, o, a = 0;
84
+ do
85
+ o = e + (n - e) / 2, r = Ln(o, s, i) - t, r > 0 ? n = o : e = o;
86
+ while (Math.abs(r) > li && ++a < ui);
87
+ return o;
88
+ }
89
+ function xe(t, e, n, s) {
90
+ if (t === e && n === s)
91
+ return oe;
92
+ const i = (r) => ci(r, 0, 1, t, n);
93
+ return (r) => r === 0 || r === 1 ? r : Ln(i(r), e, s);
94
+ }
95
+ var Kn = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2;
96
+ var Hn = (t) => (e) => 1 - t(1 - e);
97
+ var Un = /* @__PURE__ */ xe(0.33, 1.53, 0.69, 0.99);
98
+ var xt = /* @__PURE__ */ Hn(Un);
99
+ var jn = /* @__PURE__ */ Kn(xt);
100
+ var Xn = (t) => (t *= 2) < 1 ? 0.5 * xt(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1)));
101
+ var Mt = (t) => 1 - Math.sin(Math.acos(t));
102
+ var fi = Hn(Mt);
103
+ var Yn = Kn(Mt);
104
+ var hi = /* @__PURE__ */ xe(0.42, 0, 1, 1);
105
+ var di = /* @__PURE__ */ xe(0, 0, 0.58, 1);
106
+ var zn = /* @__PURE__ */ xe(0.42, 0, 0.58, 1);
107
+ var Gn = (t) => Array.isArray(t) && typeof t[0] != "number";
108
+ function qn(t, e) {
109
+ return Gn(t) ? t[ai(0, t.length, e)] : t;
110
+ }
111
+ var Zn = (t) => Array.isArray(t) && typeof t[0] == "number";
112
+ var qt = {
113
+ linear: oe,
114
+ easeIn: hi,
115
+ easeInOut: zn,
116
+ easeOut: di,
117
+ circIn: Mt,
118
+ circInOut: Yn,
119
+ circOut: fi,
120
+ backIn: xt,
121
+ backInOut: jn,
122
+ backOut: Un,
123
+ anticipate: Xn
124
+ };
125
+ var pi = (t) => typeof t == "string";
126
+ var Zt = (t) => {
127
+ if (Zn(t)) {
128
+ K(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
129
+ const [e, n, s, i] = t;
130
+ return xe(e, n, s, i);
131
+ } else if (pi(t))
132
+ return K(qt[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), qt[t];
133
+ return t;
134
+ };
135
+ var De = [
136
+ "setup",
137
+ // Compute
138
+ "read",
139
+ // Read
140
+ "resolveKeyframes",
141
+ // Write/Read/Write/Read
142
+ "preUpdate",
143
+ // Compute
144
+ "update",
145
+ // Compute
146
+ "preRender",
147
+ // Compute
148
+ "render",
149
+ // Write
150
+ "postRender"
151
+ // Compute
152
+ ];
153
+ function mi(t, e) {
154
+ let n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = false, r = false;
155
+ const o = /* @__PURE__ */ new WeakSet();
156
+ let a = {
157
+ delta: 0,
158
+ timestamp: 0,
159
+ isProcessing: false
160
+ };
161
+ function c(f) {
162
+ o.has(f) && (u.schedule(f), t()), f(a);
163
+ }
164
+ const u = {
165
+ /**
166
+ * Schedule a process to run on the next frame.
167
+ */
168
+ schedule: (f, l = false, h = false) => {
169
+ const m = h && i ? n : s;
170
+ return l && o.add(f), m.has(f) || m.add(f), f;
171
+ },
172
+ /**
173
+ * Cancel the provided callback from running on the next frame.
174
+ */
175
+ cancel: (f) => {
176
+ s.delete(f), o.delete(f);
177
+ },
178
+ /**
179
+ * Execute all schedule callbacks.
180
+ */
181
+ process: (f) => {
182
+ if (a = f, i) {
183
+ r = true;
184
+ return;
185
+ }
186
+ i = true, [n, s] = [s, n], n.forEach(c), n.clear(), i = false, r && (r = false, u.process(f));
187
+ }
188
+ };
189
+ return u;
190
+ }
191
+ var gi = 40;
192
+ function Qn(t, e) {
193
+ let n = false, s = true;
194
+ const i = {
195
+ delta: 0,
196
+ timestamp: 0,
197
+ isProcessing: false
198
+ }, r = () => n = true, o = De.reduce((S, w) => (S[w] = mi(r), S), {}), { setup: a, read: c, resolveKeyframes: u, preUpdate: f, update: l, preRender: h, render: d, postRender: m } = o, _ = () => {
199
+ const S = U.useManualTiming ? i.timestamp : performance.now();
200
+ n = false, U.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(S - i.timestamp, gi), 1)), i.timestamp = S, i.isProcessing = true, a.process(i), c.process(i), u.process(i), f.process(i), l.process(i), h.process(i), d.process(i), m.process(i), i.isProcessing = false, n && e && (s = false, t(_));
201
+ }, p = () => {
202
+ n = true, s = true, i.isProcessing || t(_);
203
+ };
204
+ return { schedule: De.reduce((S, w) => {
205
+ const v = o[w];
206
+ return S[w] = (x, V = false, b = false) => (n || p(), v.schedule(x, V, b)), S;
207
+ }, {}), cancel: (S) => {
208
+ for (let w = 0; w < De.length; w++)
209
+ o[De[w]].cancel(S);
210
+ }, state: i, steps: o };
211
+ }
212
+ var { schedule: j, cancel: tt, state: We } = /* @__PURE__ */ Qn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : oe, true);
213
+ var Oe;
214
+ function _i() {
215
+ Oe = void 0;
216
+ }
217
+ var N = {
218
+ now: () => (Oe === void 0 && N.set(We.isProcessing || U.useManualTiming ? We.timestamp : performance.now()), Oe),
219
+ set: (t) => {
220
+ Oe = t, queueMicrotask(_i);
221
+ }
222
+ };
223
+ var Jn = (t) => (e) => typeof e == "string" && e.startsWith(t);
224
+ var es = /* @__PURE__ */ Jn("--");
225
+ var yi = /* @__PURE__ */ Jn("var(--");
226
+ var Vt = (t) => yi(t) ? vi.test(t.split("/*")[0].trim()) : false;
227
+ var vi = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
228
+ var ae = {
229
+ test: (t) => typeof t == "number",
230
+ parse: parseFloat,
231
+ transform: (t) => t
232
+ };
233
+ var ge = {
234
+ ...ae,
235
+ transform: (t) => Q(0, 1, t)
236
+ };
237
+ var Fe = {
238
+ ...ae,
239
+ default: 1
240
+ };
241
+ var me = (t) => Math.round(t * 1e5) / 1e5;
242
+ var At = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
243
+ function bi(t) {
244
+ return t == null;
245
+ }
246
+ var wi = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
247
+ var Ct = (t, e) => (n) => !!(typeof n == "string" && wi.test(n) && n.startsWith(t) || e && !bi(n) && Object.prototype.hasOwnProperty.call(n, e));
248
+ var ts = (t, e, n) => (s) => {
249
+ if (typeof s != "string")
250
+ return s;
251
+ const [i, r, o, a] = s.match(At);
252
+ return {
253
+ [t]: parseFloat(i),
254
+ [e]: parseFloat(r),
255
+ [n]: parseFloat(o),
256
+ alpha: a !== void 0 ? parseFloat(a) : 1
257
+ };
258
+ };
259
+ var Ti = (t) => Q(0, 255, t);
260
+ var Ye = {
261
+ ...ae,
262
+ transform: (t) => Math.round(Ti(t))
263
+ };
264
+ var z = {
265
+ test: /* @__PURE__ */ Ct("rgb", "red"),
266
+ parse: /* @__PURE__ */ ts("red", "green", "blue"),
267
+ transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + Ye.transform(t) + ", " + Ye.transform(e) + ", " + Ye.transform(n) + ", " + me(ge.transform(s)) + ")"
268
+ };
269
+ function Si(t) {
270
+ let e = "", n = "", s = "", i = "";
271
+ return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), s = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), s = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, s += s, i += i), {
272
+ red: parseInt(e, 16),
273
+ green: parseInt(n, 16),
274
+ blue: parseInt(s, 16),
275
+ alpha: i ? parseInt(i, 16) / 255 : 1
276
+ };
277
+ }
278
+ var nt = {
279
+ test: /* @__PURE__ */ Ct("#"),
280
+ parse: Si,
281
+ transform: z.transform
282
+ };
283
+ var Me = /* @__NO_SIDE_EFFECTS__ */ (t) => ({
284
+ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
285
+ parse: parseFloat,
286
+ transform: (e) => `${e}${t}`
287
+ });
288
+ var X = /* @__PURE__ */ Me("deg");
289
+ var se = /* @__PURE__ */ Me("%");
290
+ var T = /* @__PURE__ */ Me("px");
291
+ var xi = /* @__PURE__ */ Me("vh");
292
+ var Mi = /* @__PURE__ */ Me("vw");
293
+ var Qt = {
294
+ ...se,
295
+ parse: (t) => se.parse(t) / 100,
296
+ transform: (t) => se.transform(t * 100)
297
+ };
298
+ var te = {
299
+ test: /* @__PURE__ */ Ct("hsl", "hue"),
300
+ parse: /* @__PURE__ */ ts("hue", "saturation", "lightness"),
301
+ transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + se.transform(me(e)) + ", " + se.transform(me(n)) + ", " + me(ge.transform(s)) + ")"
302
+ };
303
+ var P = {
304
+ test: (t) => z.test(t) || nt.test(t) || te.test(t),
305
+ parse: (t) => z.test(t) ? z.parse(t) : te.test(t) ? te.parse(t) : nt.parse(t),
306
+ transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? z.transform(t) : te.transform(t),
307
+ getAnimatableNone: (t) => {
308
+ const e = P.parse(t);
309
+ return e.alpha = 0, P.transform(e);
310
+ }
311
+ };
312
+ var Vi = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
313
+ function Ai(t) {
314
+ return isNaN(t) && typeof t == "string" && (t.match(At)?.length || 0) + (t.match(Vi)?.length || 0) > 0;
315
+ }
316
+ var ns = "number";
317
+ var ss = "color";
318
+ var Ci = "var";
319
+ var Ei = "var(";
320
+ var Jt = "${}";
321
+ var ki = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
322
+ function _e(t) {
323
+ const e = t.toString(), n = [], s = {
324
+ color: [],
325
+ number: [],
326
+ var: []
327
+ }, i = [];
328
+ let r = 0;
329
+ const a = e.replace(ki, (c) => (P.test(c) ? (s.color.push(r), i.push(ss), n.push(P.parse(c))) : c.startsWith(Ei) ? (s.var.push(r), i.push(Ci), n.push(c)) : (s.number.push(r), i.push(ns), n.push(parseFloat(c))), ++r, Jt)).split(Jt);
330
+ return { values: n, split: a, indexes: s, types: i };
331
+ }
332
+ function is(t) {
333
+ return _e(t).values;
334
+ }
335
+ function rs(t) {
336
+ const { split: e, types: n } = _e(t), s = e.length;
337
+ return (i) => {
338
+ let r = "";
339
+ for (let o = 0; o < s; o++)
340
+ if (r += e[o], i[o] !== void 0) {
341
+ const a = n[o];
342
+ a === ns ? r += me(i[o]) : a === ss ? r += P.transform(i[o]) : r += i[o];
343
+ }
344
+ return r;
345
+ };
346
+ }
347
+ var Di = (t) => typeof t == "number" ? 0 : P.test(t) ? P.getAnimatableNone(t) : t;
348
+ function Fi(t) {
349
+ const e = is(t);
350
+ return rs(t)(e.map(Di));
351
+ }
352
+ var le = {
353
+ test: Ai,
354
+ parse: is,
355
+ createTransformer: rs,
356
+ getAnimatableNone: Fi
357
+ };
358
+ function ze(t, e, n) {
359
+ return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
360
+ }
361
+ function Pi({ hue: t, saturation: e, lightness: n, alpha: s }) {
362
+ t /= 360, e /= 100, n /= 100;
363
+ let i = 0, r = 0, o = 0;
364
+ if (!e)
365
+ i = r = o = n;
366
+ else {
367
+ const a = n < 0.5 ? n * (1 + e) : n + e - n * e, c = 2 * n - a;
368
+ i = ze(c, a, t + 1 / 3), r = ze(c, a, t), o = ze(c, a, t - 1 / 3);
369
+ }
370
+ return {
371
+ red: Math.round(i * 255),
372
+ green: Math.round(r * 255),
373
+ blue: Math.round(o * 255),
374
+ alpha: s
375
+ };
376
+ }
377
+ function Be(t, e) {
378
+ return (n) => n > 0 ? e : t;
379
+ }
380
+ var Ve = (t, e, n) => t + (e - t) * n;
381
+ var Ge = (t, e, n) => {
382
+ const s = t * t, i = n * (e * e - s) + s;
383
+ return i < 0 ? 0 : Math.sqrt(i);
384
+ };
385
+ var $i = [nt, z, te];
386
+ var Oi = (t) => $i.find((e) => e.test(t));
387
+ function en(t) {
388
+ const e = Oi(t);
389
+ if (Se(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
390
+ return false;
391
+ let n = e.parse(t);
392
+ return e === te && (n = Pi(n)), n;
393
+ }
394
+ var tn = (t, e) => {
395
+ const n = en(t), s = en(e);
396
+ if (!n || !s)
397
+ return Be(t, e);
398
+ const i = { ...n };
399
+ return (r) => (i.red = Ge(n.red, s.red, r), i.green = Ge(n.green, s.green, r), i.blue = Ge(n.blue, s.blue, r), i.alpha = Ve(n.alpha, s.alpha, r), z.transform(i));
400
+ };
401
+ var st = /* @__PURE__ */ new Set(["none", "hidden"]);
402
+ function Ri(t, e) {
403
+ return st.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
404
+ }
405
+ function Ni(t, e) {
406
+ return (n) => Ve(t, e, n);
407
+ }
408
+ function Et(t) {
409
+ return typeof t == "number" ? Ni : typeof t == "string" ? Vt(t) ? Be : P.test(t) ? tn : Bi : Array.isArray(t) ? os : typeof t == "object" ? P.test(t) ? tn : Ii : Be;
410
+ }
411
+ function os(t, e) {
412
+ const n = [...t], s = n.length, i = t.map((r, o) => Et(r)(r, e[o]));
413
+ return (r) => {
414
+ for (let o = 0; o < s; o++)
415
+ n[o] = i[o](r);
416
+ return n;
417
+ };
418
+ }
419
+ function Ii(t, e) {
420
+ const n = { ...t, ...e }, s = {};
421
+ for (const i in n)
422
+ t[i] !== void 0 && e[i] !== void 0 && (s[i] = Et(t[i])(t[i], e[i]));
423
+ return (i) => {
424
+ for (const r in s)
425
+ n[r] = s[r](i);
426
+ return n;
427
+ };
428
+ }
429
+ function Wi(t, e) {
430
+ const n = [], s = { color: 0, var: 0, number: 0 };
431
+ for (let i = 0; i < e.values.length; i++) {
432
+ const r = e.types[i], o = t.indexes[r][s[r]], a = t.values[o] ?? 0;
433
+ n[i] = a, s[r]++;
434
+ }
435
+ return n;
436
+ }
437
+ var Bi = (t, e) => {
438
+ const n = le.createTransformer(e), s = _e(t), i = _e(e);
439
+ return s.indexes.var.length === i.indexes.var.length && s.indexes.color.length === i.indexes.color.length && s.indexes.number.length >= i.indexes.number.length ? st.has(t) && !i.values.length || st.has(e) && !s.values.length ? Ri(t, e) : Tt(os(Wi(s, i), i.values), n) : (Se(true, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), Be(t, e));
440
+ };
441
+ function as(t, e, n) {
442
+ return typeof t == "number" && typeof e == "number" && typeof n == "number" ? Ve(t, e, n) : Et(t)(t, e);
443
+ }
444
+ var Li = (t) => {
445
+ const e = ({ timestamp: n }) => t(n);
446
+ return {
447
+ start: (n = true) => j.update(e, n),
448
+ stop: () => tt(e),
449
+ /**
450
+ * If we're processing this frame we can use the
451
+ * framelocked timestamp to keep things in sync.
452
+ */
453
+ now: () => We.isProcessing ? We.timestamp : N.now()
454
+ };
455
+ };
456
+ var ls = (t, e, n = 10) => {
457
+ let s = "";
458
+ const i = Math.max(Math.round(e / n), 2);
459
+ for (let r = 0; r < i; r++)
460
+ s += Math.round(t(r / (i - 1)) * 1e4) / 1e4 + ", ";
461
+ return `linear(${s.substring(0, s.length - 2)})`;
462
+ };
463
+ var Le = 2e4;
464
+ function kt(t) {
465
+ let e = 0;
466
+ const n = 50;
467
+ let s = t.next(e);
468
+ for (; !s.done && e < Le; )
469
+ e += n, s = t.next(e);
470
+ return e >= Le ? 1 / 0 : e;
471
+ }
472
+ function us(t, e = 100, n) {
473
+ const s = n({ ...t, keyframes: [0, e] }), i = Math.min(kt(s), Le);
474
+ return {
475
+ type: "keyframes",
476
+ ease: (r) => s.next(i * r).value / e,
477
+ duration: /* @__PURE__ */ W(i)
478
+ };
479
+ }
480
+ var Ki = 5;
481
+ function cs(t, e, n) {
482
+ const s = Math.max(e - Ki, 0);
483
+ return Wn(n - t(s), e - s);
484
+ }
485
+ var k = {
486
+ // Default spring physics
487
+ stiffness: 100,
488
+ damping: 10,
489
+ mass: 1,
490
+ velocity: 0,
491
+ // Default duration/bounce-based options
492
+ duration: 800,
493
+ // in ms
494
+ bounce: 0.3,
495
+ visualDuration: 0.3,
496
+ // in seconds
497
+ // Rest thresholds
498
+ restSpeed: {
499
+ granular: 0.01,
500
+ default: 2
501
+ },
502
+ restDelta: {
503
+ granular: 5e-3,
504
+ default: 0.5
505
+ },
506
+ // Limits
507
+ minDuration: 0.01,
508
+ // in seconds
509
+ maxDuration: 10,
510
+ // in seconds
511
+ minDamping: 0.05,
512
+ maxDamping: 1
513
+ };
514
+ var qe = 1e-3;
515
+ function Hi({ duration: t = k.duration, bounce: e = k.bounce, velocity: n = k.velocity, mass: s = k.mass }) {
516
+ let i, r;
517
+ Se(t <= /* @__PURE__ */ B(k.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
518
+ let o = 1 - e;
519
+ o = Q(k.minDamping, k.maxDamping, o), t = Q(k.minDuration, k.maxDuration, /* @__PURE__ */ W(t)), o < 1 ? (i = (u) => {
520
+ const f = u * o, l = f * t, h = f - n, d = it(u, o), m = Math.exp(-l);
521
+ return qe - h / d * m;
522
+ }, r = (u) => {
523
+ const l = u * o * t, h = l * n + n, d = Math.pow(o, 2) * Math.pow(u, 2) * t, m = Math.exp(-l), _ = it(Math.pow(u, 2), o);
524
+ return (-i(u) + qe > 0 ? -1 : 1) * ((h - d) * m) / _;
525
+ }) : (i = (u) => {
526
+ const f = Math.exp(-u * t), l = (u - n) * t + 1;
527
+ return -qe + f * l;
528
+ }, r = (u) => {
529
+ const f = Math.exp(-u * t), l = (n - u) * (t * t);
530
+ return f * l;
531
+ });
532
+ const a = 5 / t, c = ji(i, r, a);
533
+ if (t = /* @__PURE__ */ B(t), isNaN(c))
534
+ return {
535
+ stiffness: k.stiffness,
536
+ damping: k.damping,
537
+ duration: t
538
+ };
539
+ {
540
+ const u = Math.pow(c, 2) * s;
541
+ return {
542
+ stiffness: u,
543
+ damping: o * 2 * Math.sqrt(s * u),
544
+ duration: t
545
+ };
546
+ }
547
+ }
548
+ var Ui = 12;
549
+ function ji(t, e, n) {
550
+ let s = n;
551
+ for (let i = 1; i < Ui; i++)
552
+ s = s - t(s) / e(s);
553
+ return s;
554
+ }
555
+ function it(t, e) {
556
+ return t * Math.sqrt(1 - e * e);
557
+ }
558
+ var Xi = ["duration", "bounce"];
559
+ var Yi = ["stiffness", "damping", "mass"];
560
+ function nn(t, e) {
561
+ return e.some((n) => t[n] !== void 0);
562
+ }
563
+ function zi(t) {
564
+ let e = {
565
+ velocity: k.velocity,
566
+ stiffness: k.stiffness,
567
+ damping: k.damping,
568
+ mass: k.mass,
569
+ isResolvedFromDuration: false,
570
+ ...t
571
+ };
572
+ if (!nn(t, Yi) && nn(t, Xi))
573
+ if (t.visualDuration) {
574
+ const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * Q(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(i);
575
+ e = {
576
+ ...e,
577
+ mass: k.mass,
578
+ stiffness: i,
579
+ damping: r
580
+ };
581
+ } else {
582
+ const n = Hi(t);
583
+ e = {
584
+ ...e,
585
+ ...n,
586
+ mass: k.mass
587
+ }, e.isResolvedFromDuration = true;
588
+ }
589
+ return e;
590
+ }
591
+ function ye(t = k.visualDuration, e = k.bounce) {
592
+ const n = typeof t != "object" ? {
593
+ visualDuration: t,
594
+ keyframes: [0, 1],
595
+ bounce: e
596
+ } : t;
597
+ let { restSpeed: s, restDelta: i } = n;
598
+ const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: false, value: r }, { stiffness: c, damping: u, mass: f, duration: l, velocity: h, isResolvedFromDuration: d } = zi({
599
+ ...n,
600
+ velocity: -/* @__PURE__ */ W(n.velocity || 0)
601
+ }), m = h || 0, _ = u / (2 * Math.sqrt(c * f)), p = o - r, g = /* @__PURE__ */ W(Math.sqrt(c / f)), y = Math.abs(p) < 5;
602
+ s || (s = y ? k.restSpeed.granular : k.restSpeed.default), i || (i = y ? k.restDelta.granular : k.restDelta.default);
603
+ let S;
604
+ if (_ < 1) {
605
+ const v = it(g, _);
606
+ S = (x) => {
607
+ const V = Math.exp(-_ * g * x);
608
+ return o - V * ((m + _ * g * p) / v * Math.sin(v * x) + p * Math.cos(v * x));
609
+ };
610
+ } else if (_ === 1)
611
+ S = (v) => o - Math.exp(-g * v) * (p + (m + g * p) * v);
612
+ else {
613
+ const v = g * Math.sqrt(_ * _ - 1);
614
+ S = (x) => {
615
+ const V = Math.exp(-_ * g * x), b = Math.min(v * x, 300);
616
+ return o - V * ((m + _ * g * p) * Math.sinh(b) + v * p * Math.cosh(b)) / v;
617
+ };
618
+ }
619
+ const w = {
620
+ calculatedDuration: d && l || null,
621
+ next: (v) => {
622
+ const x = S(v);
623
+ if (d)
624
+ a.done = v >= l;
625
+ else {
626
+ let V = v === 0 ? m : 0;
627
+ _ < 1 && (V = v === 0 ? /* @__PURE__ */ B(m) : cs(S, v, x));
628
+ const b = Math.abs(V) <= s, M = Math.abs(o - x) <= i;
629
+ a.done = b && M;
630
+ }
631
+ return a.value = a.done ? o : x, a;
632
+ },
633
+ toString: () => {
634
+ const v = Math.min(kt(w), Le), x = ls((V) => w.next(v * V).value, v, 30);
635
+ return v + "ms " + x;
636
+ },
637
+ toTransition: () => {
638
+ }
639
+ };
640
+ return w;
641
+ }
642
+ ye.applyToOptions = (t) => {
643
+ const e = us(t, 100, ye);
644
+ return t.ease = e.ease, t.duration = /* @__PURE__ */ B(e.duration), t.type = "keyframes", t;
645
+ };
646
+ function rt({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: c, restDelta: u = 0.5, restSpeed: f }) {
647
+ const l = t[0], h = {
648
+ done: false,
649
+ value: l
650
+ }, d = (b) => a !== void 0 && b < a || c !== void 0 && b > c, m = (b) => a === void 0 ? c : c === void 0 || Math.abs(a - b) < Math.abs(c - b) ? a : c;
651
+ let _ = n * e;
652
+ const p = l + _, g = o === void 0 ? p : o(p);
653
+ g !== p && (_ = g - l);
654
+ const y = (b) => -_ * Math.exp(-b / s), S = (b) => g + y(b), w = (b) => {
655
+ const M = y(b), F = S(b);
656
+ h.done = Math.abs(M) <= u, h.value = h.done ? g : F;
657
+ };
658
+ let v, x;
659
+ const V = (b) => {
660
+ d(h.value) && (v = b, x = ye({
661
+ keyframes: [h.value, m(h.value)],
662
+ velocity: cs(S, b, h.value),
663
+ // TODO: This should be passing * 1000
664
+ damping: i,
665
+ stiffness: r,
666
+ restDelta: u,
667
+ restSpeed: f
668
+ }));
669
+ };
670
+ return V(0), {
671
+ calculatedDuration: null,
672
+ next: (b) => {
673
+ let M = false;
674
+ return !x && v === void 0 && (M = true, w(b), V(b)), v !== void 0 && b >= v ? x.next(b - v) : (!M && w(b), h);
675
+ }
676
+ };
677
+ }
678
+ function Gi(t, e, n) {
679
+ const s = [], i = n || U.mix || as, r = t.length - 1;
680
+ for (let o = 0; o < r; o++) {
681
+ let a = i(t[o], t[o + 1]);
682
+ if (e) {
683
+ const c = Array.isArray(e) ? e[o] || oe : e;
684
+ a = Tt(c, a);
685
+ }
686
+ s.push(a);
687
+ }
688
+ return s;
689
+ }
690
+ function qi(t, e, { clamp: n = true, ease: s, mixer: i } = {}) {
691
+ const r = t.length;
692
+ if (K(r === e.length, "Both input and output ranges must be the same length", "range-length"), r === 1)
693
+ return () => e[0];
694
+ if (r === 2 && e[0] === e[1])
695
+ return () => e[1];
696
+ const o = t[0] === t[1];
697
+ t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
698
+ const a = Gi(e, s, i), c = a.length, u = (f) => {
699
+ if (o && f < t[0])
700
+ return e[0];
701
+ let l = 0;
702
+ if (c > 1)
703
+ for (; l < t.length - 2 && !(f < t[l + 1]); l++)
704
+ ;
705
+ const h = /* @__PURE__ */ St(t[l], t[l + 1], f);
706
+ return a[l](h);
707
+ };
708
+ return n ? (f) => u(Q(t[0], t[r - 1], f)) : u;
709
+ }
710
+ function fs(t, e) {
711
+ const n = t[t.length - 1];
712
+ for (let s = 1; s <= e; s++) {
713
+ const i = /* @__PURE__ */ St(0, e, s);
714
+ t.push(Ve(n, 1, i));
715
+ }
716
+ }
717
+ function hs(t) {
718
+ const e = [0];
719
+ return fs(e, t.length - 1), e;
720
+ }
721
+ function Zi(t, e) {
722
+ return t.map((n) => n * e);
723
+ }
724
+ function Qi(t, e) {
725
+ return t.map(() => e || zn).splice(0, t.length - 1);
726
+ }
727
+ function ne({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
728
+ const i = Gn(s) ? s.map(Zt) : Zt(s), r = {
729
+ done: false,
730
+ value: e[0]
731
+ }, o = Zi(
732
+ // Only use the provided offsets if they're the correct length
733
+ // TODO Maybe we should warn here if there's a length mismatch
734
+ n && n.length === e.length ? n : hs(e),
735
+ t
736
+ ), a = qi(o, e, {
737
+ ease: Array.isArray(i) ? i : Qi(e, i)
738
+ });
739
+ return {
740
+ calculatedDuration: t,
741
+ next: (c) => (r.value = a(c), r.done = c >= t, r)
742
+ };
743
+ }
744
+ var Ji = (t) => t !== null;
745
+ function Dt(t, { repeat: e, repeatType: n = "loop" }, s, i = 1) {
746
+ const r = t.filter(Ji), a = i < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
747
+ return !a || s === void 0 ? r[a] : s;
748
+ }
749
+ var er = {
750
+ decay: rt,
751
+ inertia: rt,
752
+ tween: ne,
753
+ keyframes: ne,
754
+ spring: ye
755
+ };
756
+ function ds(t) {
757
+ typeof t.type == "string" && (t.type = er[t.type]);
758
+ }
759
+ var Ft = class {
760
+ constructor() {
761
+ this.updateFinished();
762
+ }
763
+ get finished() {
764
+ return this._finished;
765
+ }
766
+ updateFinished() {
767
+ this._finished = new Promise((e) => {
768
+ this.resolve = e;
769
+ });
770
+ }
771
+ notifyFinished() {
772
+ this.resolve();
773
+ }
774
+ /**
775
+ * Allows the animation to be awaited.
776
+ *
777
+ * @deprecated Use `finished` instead.
778
+ */
779
+ then(e, n) {
780
+ return this.finished.then(e, n);
781
+ }
782
+ };
783
+ var tr = (t) => t / 100;
784
+ var Pt = class extends Ft {
785
+ constructor(e) {
786
+ super(), this.state = "idle", this.startTime = null, this.isStopped = false, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
787
+ const { motionValue: n } = this.options;
788
+ n && n.updatedAt !== N.now() && this.tick(N.now()), this.isStopped = true, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
789
+ }, this.options = e, this.initAnimation(), this.play(), e.autoplay === false && this.pause();
790
+ }
791
+ initAnimation() {
792
+ const { options: e } = this;
793
+ ds(e);
794
+ const { type: n = ne, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = e;
795
+ let { keyframes: a } = e;
796
+ const c = n || ne;
797
+ c !== ne && K(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), c !== ne && typeof a[0] != "number" && (this.mixKeyframes = Tt(tr, as(a[0], a[1])), a = [0, 100]);
798
+ const u = c({ ...e, keyframes: a });
799
+ r === "mirror" && (this.mirroredGenerator = c({
800
+ ...e,
801
+ keyframes: [...a].reverse(),
802
+ velocity: -o
803
+ })), u.calculatedDuration === null && (u.calculatedDuration = kt(u));
804
+ const { calculatedDuration: f } = u;
805
+ this.calculatedDuration = f, this.resolvedDuration = f + i, this.totalDuration = this.resolvedDuration * (s + 1) - i, this.generator = u;
806
+ }
807
+ updateTime(e) {
808
+ const n = Math.round(e - this.startTime) * this.playbackSpeed;
809
+ this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
810
+ }
811
+ tick(e, n = false) {
812
+ const { generator: s, totalDuration: i, mixKeyframes: r, mirroredGenerator: o, resolvedDuration: a, calculatedDuration: c } = this;
813
+ if (this.startTime === null)
814
+ return s.next(0);
815
+ const { delay: u = 0, keyframes: f, repeat: l, repeatType: h, repeatDelay: d, type: m, onUpdate: _, finalKeyframe: p } = this.options;
816
+ this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - i / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e);
817
+ const g = this.currentTime - u * (this.playbackSpeed >= 0 ? 1 : -1), y = this.playbackSpeed >= 0 ? g < 0 : g > i;
818
+ this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i);
819
+ let S = this.currentTime, w = s;
820
+ if (l) {
821
+ const b = Math.min(this.currentTime, i) / a;
822
+ let M = Math.floor(b), F = b % 1;
823
+ !F && b >= 1 && (F = 1), F === 1 && M--, M = Math.min(M, l + 1), !!(M % 2) && (h === "reverse" ? (F = 1 - F, d && (F -= d / a)) : h === "mirror" && (w = o)), S = Q(0, 1, F) * a;
824
+ }
825
+ const v = y ? { done: false, value: f[0] } : w.next(S);
826
+ r && (v.value = r(v.value));
827
+ let { done: x } = v;
828
+ !y && c !== null && (x = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
829
+ const V = this.holdTime === null && (this.state === "finished" || this.state === "running" && x);
830
+ return V && m !== rt && (v.value = Dt(f, this.options, p, this.speed)), _ && _(v.value), V && this.finish(), v;
831
+ }
832
+ /**
833
+ * Allows the returned animation to be awaited or promise-chained. Currently
834
+ * resolves when the animation finishes at all but in a future update could/should
835
+ * reject if its cancels.
836
+ */
837
+ then(e, n) {
838
+ return this.finished.then(e, n);
839
+ }
840
+ get duration() {
841
+ return /* @__PURE__ */ W(this.calculatedDuration);
842
+ }
843
+ get iterationDuration() {
844
+ const { delay: e = 0 } = this.options || {};
845
+ return this.duration + /* @__PURE__ */ W(e);
846
+ }
847
+ get time() {
848
+ return /* @__PURE__ */ W(this.currentTime);
849
+ }
850
+ set time(e) {
851
+ e = /* @__PURE__ */ B(e), this.currentTime = e, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.playbackSpeed), this.driver?.start(false);
852
+ }
853
+ get speed() {
854
+ return this.playbackSpeed;
855
+ }
856
+ set speed(e) {
857
+ this.updateTime(N.now());
858
+ const n = this.playbackSpeed !== e;
859
+ this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ W(this.currentTime));
860
+ }
861
+ play() {
862
+ if (this.isStopped)
863
+ return;
864
+ const { driver: e = Li, startTime: n } = this.options;
865
+ this.driver || (this.driver = e((i) => this.tick(i))), this.options.onPlay?.();
866
+ const s = this.driver.now();
867
+ this.state === "finished" ? (this.updateFinished(), this.startTime = s) : this.holdTime !== null ? this.startTime = s - this.holdTime : this.startTime || (this.startTime = n ?? s), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
868
+ }
869
+ pause() {
870
+ this.state = "paused", this.updateTime(N.now()), this.holdTime = this.currentTime;
871
+ }
872
+ complete() {
873
+ this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
874
+ }
875
+ finish() {
876
+ this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
877
+ }
878
+ cancel() {
879
+ this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
880
+ }
881
+ teardown() {
882
+ this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
883
+ }
884
+ stopDriver() {
885
+ this.driver && (this.driver.stop(), this.driver = void 0);
886
+ }
887
+ sample(e) {
888
+ return this.startTime = 0, this.tick(e, true);
889
+ }
890
+ attachTimeline(e) {
891
+ return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
892
+ }
893
+ };
894
+ function nr(t) {
895
+ for (let e = 1; e < t.length; e++)
896
+ t[e] ?? (t[e] = t[e - 1]);
897
+ }
898
+ var G = (t) => t * 180 / Math.PI;
899
+ var ot = (t) => {
900
+ const e = G(Math.atan2(t[1], t[0]));
901
+ return at(e);
902
+ };
903
+ var sr = {
904
+ x: 4,
905
+ y: 5,
906
+ translateX: 4,
907
+ translateY: 5,
908
+ scaleX: 0,
909
+ scaleY: 3,
910
+ scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
911
+ rotate: ot,
912
+ rotateZ: ot,
913
+ skewX: (t) => G(Math.atan(t[1])),
914
+ skewY: (t) => G(Math.atan(t[2])),
915
+ skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
916
+ };
917
+ var at = (t) => (t = t % 360, t < 0 && (t += 360), t);
918
+ var sn = ot;
919
+ var rn = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]);
920
+ var on = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]);
921
+ var ir = {
922
+ x: 12,
923
+ y: 13,
924
+ z: 14,
925
+ translateX: 12,
926
+ translateY: 13,
927
+ translateZ: 14,
928
+ scaleX: rn,
929
+ scaleY: on,
930
+ scale: (t) => (rn(t) + on(t)) / 2,
931
+ rotateX: (t) => at(G(Math.atan2(t[6], t[5]))),
932
+ rotateY: (t) => at(G(Math.atan2(-t[2], t[0]))),
933
+ rotateZ: sn,
934
+ rotate: sn,
935
+ skewX: (t) => G(Math.atan(t[4])),
936
+ skewY: (t) => G(Math.atan(t[1])),
937
+ skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
938
+ };
939
+ function lt(t) {
940
+ return t.includes("scale") ? 1 : 0;
941
+ }
942
+ function ut(t, e) {
943
+ if (!t || t === "none")
944
+ return lt(e);
945
+ const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
946
+ let s, i;
947
+ if (n)
948
+ s = ir, i = n;
949
+ else {
950
+ const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
951
+ s = sr, i = a;
952
+ }
953
+ if (!i)
954
+ return lt(e);
955
+ const r = s[e], o = i[1].split(",").map(or);
956
+ return typeof r == "function" ? r(o) : o[r];
957
+ }
958
+ var rr = (t, e) => {
959
+ const { transform: n = "none" } = getComputedStyle(t);
960
+ return ut(n, e);
961
+ };
962
+ function or(t) {
963
+ return parseFloat(t.trim());
964
+ }
965
+ var ue = [
966
+ "transformPerspective",
967
+ "x",
968
+ "y",
969
+ "z",
970
+ "translateX",
971
+ "translateY",
972
+ "translateZ",
973
+ "scale",
974
+ "scaleX",
975
+ "scaleY",
976
+ "rotate",
977
+ "rotateX",
978
+ "rotateY",
979
+ "rotateZ",
980
+ "skew",
981
+ "skewX",
982
+ "skewY"
983
+ ];
984
+ var ce = new Set(ue);
985
+ var an = (t) => t === ae || t === T;
986
+ var ar = /* @__PURE__ */ new Set(["x", "y", "z"]);
987
+ var lr = ue.filter((t) => !ar.has(t));
988
+ function ur(t) {
989
+ const e = [];
990
+ return lr.forEach((n) => {
991
+ const s = t.getValue(n);
992
+ s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
993
+ }), e;
994
+ }
995
+ var q = {
996
+ // Dimensions
997
+ width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
998
+ height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
999
+ top: (t, { top: e }) => parseFloat(e),
1000
+ left: (t, { left: e }) => parseFloat(e),
1001
+ bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
1002
+ right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
1003
+ // Transform
1004
+ x: (t, { transform: e }) => ut(e, "x"),
1005
+ y: (t, { transform: e }) => ut(e, "y")
1006
+ };
1007
+ q.translateX = q.x;
1008
+ q.translateY = q.y;
1009
+ var Z = /* @__PURE__ */ new Set();
1010
+ var ct = false;
1011
+ var ft = false;
1012
+ var ht = false;
1013
+ function ps() {
1014
+ if (ft) {
1015
+ const t = Array.from(Z).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
1016
+ e.forEach((s) => {
1017
+ const i = ur(s);
1018
+ i.length && (n.set(s, i), s.render());
1019
+ }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
1020
+ s.render();
1021
+ const i = n.get(s);
1022
+ i && i.forEach(([r, o]) => {
1023
+ s.getValue(r)?.set(o);
1024
+ });
1025
+ }), t.forEach((s) => s.measureEndState()), t.forEach((s) => {
1026
+ s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
1027
+ });
1028
+ }
1029
+ ft = false, ct = false, Z.forEach((t) => t.complete(ht)), Z.clear();
1030
+ }
1031
+ function ms() {
1032
+ Z.forEach((t) => {
1033
+ t.readKeyframes(), t.needsMeasurement && (ft = true);
1034
+ });
1035
+ }
1036
+ function cr() {
1037
+ ht = true, ms(), ps(), ht = false;
1038
+ }
1039
+ var $t = class {
1040
+ constructor(e, n, s, i, r, o = false) {
1041
+ this.state = "pending", this.isAsync = false, this.needsMeasurement = false, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = o;
1042
+ }
1043
+ scheduleResolve() {
1044
+ this.state = "scheduled", this.isAsync ? (Z.add(this), ct || (ct = true, j.read(ms), j.resolveKeyframes(ps))) : (this.readKeyframes(), this.complete());
1045
+ }
1046
+ readKeyframes() {
1047
+ const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
1048
+ if (e[0] === null) {
1049
+ const r = i?.get(), o = e[e.length - 1];
1050
+ if (r !== void 0)
1051
+ e[0] = r;
1052
+ else if (s && n) {
1053
+ const a = s.readValue(n, o);
1054
+ a != null && (e[0] = a);
1055
+ }
1056
+ e[0] === void 0 && (e[0] = o), i && r === void 0 && i.set(e[0]);
1057
+ }
1058
+ nr(e);
1059
+ }
1060
+ setFinalKeyframe() {
1061
+ }
1062
+ measureInitialState() {
1063
+ }
1064
+ renderEndStyles() {
1065
+ }
1066
+ measureEndState() {
1067
+ }
1068
+ complete(e = false) {
1069
+ this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), Z.delete(this);
1070
+ }
1071
+ cancel() {
1072
+ this.state === "scheduled" && (Z.delete(this), this.state = "pending");
1073
+ }
1074
+ resume() {
1075
+ this.state === "pending" && this.scheduleResolve();
1076
+ }
1077
+ };
1078
+ var fr = (t) => t.startsWith("--");
1079
+ function hr(t, e, n) {
1080
+ fr(e) ? t.style.setProperty(e, n) : t.style[e] = n;
1081
+ }
1082
+ var dr = /* @__PURE__ */ wt(() => window.ScrollTimeline !== void 0);
1083
+ var pr = {};
1084
+ function mr(t, e) {
1085
+ const n = /* @__PURE__ */ wt(t);
1086
+ return () => pr[e] ?? n();
1087
+ }
1088
+ var gs = /* @__PURE__ */ mr(() => {
1089
+ try {
1090
+ document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1091
+ } catch {
1092
+ return false;
1093
+ }
1094
+ return true;
1095
+ }, "linearEasing");
1096
+ var pe = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`;
1097
+ var ln = {
1098
+ linear: "linear",
1099
+ ease: "ease",
1100
+ easeIn: "ease-in",
1101
+ easeOut: "ease-out",
1102
+ easeInOut: "ease-in-out",
1103
+ circIn: /* @__PURE__ */ pe([0, 0.65, 0.55, 1]),
1104
+ circOut: /* @__PURE__ */ pe([0.55, 0, 1, 0.45]),
1105
+ backIn: /* @__PURE__ */ pe([0.31, 0.01, 0.66, -0.59]),
1106
+ backOut: /* @__PURE__ */ pe([0.33, 1.53, 0.69, 0.99])
1107
+ };
1108
+ function _s(t, e) {
1109
+ if (t)
1110
+ return typeof t == "function" ? gs() ? ls(t, e) : "ease-out" : Zn(t) ? pe(t) : Array.isArray(t) ? t.map((n) => _s(n, e) || ln.easeOut) : ln[t];
1111
+ }
1112
+ function gr(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeOut", times: c } = {}, u = void 0) {
1113
+ const f = {
1114
+ [e]: n
1115
+ };
1116
+ c && (f.offset = c);
1117
+ const l = _s(a, i);
1118
+ Array.isArray(l) && (f.easing = l);
1119
+ const h = {
1120
+ delay: s,
1121
+ duration: i,
1122
+ easing: Array.isArray(l) ? "linear" : l,
1123
+ fill: "both",
1124
+ iterations: r + 1,
1125
+ direction: o === "reverse" ? "alternate" : "normal"
1126
+ };
1127
+ return u && (h.pseudoElement = u), t.animate(f, h);
1128
+ }
1129
+ function Ot(t) {
1130
+ return typeof t == "function" && "applyToOptions" in t;
1131
+ }
1132
+ function _r({ type: t, ...e }) {
1133
+ return Ot(t) && gs() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
1134
+ }
1135
+ var yr = class extends Ft {
1136
+ constructor(e) {
1137
+ if (super(), this.finishedTime = null, this.isStopped = false, !e)
1138
+ return;
1139
+ const { element: n, name: s, keyframes: i, pseudoElement: r, allowFlatten: o = false, finalKeyframe: a, onComplete: c } = e;
1140
+ this.isPseudoElement = !!r, this.allowFlatten = o, this.options = e, K(typeof e.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
1141
+ const u = _r(e);
1142
+ this.animation = gr(n, s, i, u, r), u.autoplay === false && this.animation.pause(), this.animation.onfinish = () => {
1143
+ if (this.finishedTime = this.time, !r) {
1144
+ const f = Dt(i, this.options, a, this.speed);
1145
+ this.updateMotionValue ? this.updateMotionValue(f) : hr(n, s, f), this.animation.cancel();
1146
+ }
1147
+ c?.(), this.notifyFinished();
1148
+ };
1149
+ }
1150
+ play() {
1151
+ this.isStopped || (this.animation.play(), this.state === "finished" && this.updateFinished());
1152
+ }
1153
+ pause() {
1154
+ this.animation.pause();
1155
+ }
1156
+ complete() {
1157
+ this.animation.finish?.();
1158
+ }
1159
+ cancel() {
1160
+ try {
1161
+ this.animation.cancel();
1162
+ } catch {
1163
+ }
1164
+ }
1165
+ stop() {
1166
+ if (this.isStopped)
1167
+ return;
1168
+ this.isStopped = true;
1169
+ const { state: e } = this;
1170
+ e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
1171
+ }
1172
+ /**
1173
+ * WAAPI doesn't natively have any interruption capabilities.
1174
+ *
1175
+ * In this method, we commit styles back to the DOM before cancelling
1176
+ * the animation.
1177
+ *
1178
+ * This is designed to be overridden by NativeAnimationExtended, which
1179
+ * will create a renderless JS animation and sample it twice to calculate
1180
+ * its current value, "previous" value, and therefore allow
1181
+ * Motion to also correctly calculate velocity for any subsequent animation
1182
+ * while deferring the commit until the next animation frame.
1183
+ */
1184
+ commitStyles() {
1185
+ this.isPseudoElement || this.animation.commitStyles?.();
1186
+ }
1187
+ get duration() {
1188
+ const e = this.animation.effect?.getComputedTiming?.().duration || 0;
1189
+ return /* @__PURE__ */ W(Number(e));
1190
+ }
1191
+ get iterationDuration() {
1192
+ const { delay: e = 0 } = this.options || {};
1193
+ return this.duration + /* @__PURE__ */ W(e);
1194
+ }
1195
+ get time() {
1196
+ return /* @__PURE__ */ W(Number(this.animation.currentTime) || 0);
1197
+ }
1198
+ set time(e) {
1199
+ this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ B(e);
1200
+ }
1201
+ /**
1202
+ * The playback speed of the animation.
1203
+ * 1 = normal speed, 2 = double speed, 0.5 = half speed.
1204
+ */
1205
+ get speed() {
1206
+ return this.animation.playbackRate;
1207
+ }
1208
+ set speed(e) {
1209
+ e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
1210
+ }
1211
+ get state() {
1212
+ return this.finishedTime !== null ? "finished" : this.animation.playState;
1213
+ }
1214
+ get startTime() {
1215
+ return Number(this.animation.startTime);
1216
+ }
1217
+ set startTime(e) {
1218
+ this.animation.startTime = e;
1219
+ }
1220
+ /**
1221
+ * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
1222
+ */
1223
+ attachTimeline({ timeline: e, observe: n }) {
1224
+ return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && dr() ? (this.animation.timeline = e, oe) : n(this);
1225
+ }
1226
+ };
1227
+ var ys = {
1228
+ anticipate: Xn,
1229
+ backInOut: jn,
1230
+ circInOut: Yn
1231
+ };
1232
+ function vr(t) {
1233
+ return t in ys;
1234
+ }
1235
+ function br(t) {
1236
+ typeof t.ease == "string" && vr(t.ease) && (t.ease = ys[t.ease]);
1237
+ }
1238
+ var un = 10;
1239
+ var wr = class extends yr {
1240
+ constructor(e) {
1241
+ br(e), ds(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e;
1242
+ }
1243
+ /**
1244
+ * WAAPI doesn't natively have any interruption capabilities.
1245
+ *
1246
+ * Rather than read commited styles back out of the DOM, we can
1247
+ * create a renderless JS animation and sample it twice to calculate
1248
+ * its current value, "previous" value, and therefore allow
1249
+ * Motion to calculate velocity for any subsequent animation.
1250
+ */
1251
+ updateMotionValue(e) {
1252
+ const { motionValue: n, onUpdate: s, onComplete: i, element: r, ...o } = this.options;
1253
+ if (!n)
1254
+ return;
1255
+ if (e !== void 0) {
1256
+ n.set(e);
1257
+ return;
1258
+ }
1259
+ const a = new Pt({
1260
+ ...o,
1261
+ autoplay: false
1262
+ }), c = /* @__PURE__ */ B(this.finishedTime ?? this.time);
1263
+ n.setWithVelocity(a.sample(c - un).value, a.sample(c).value, un), a.stop();
1264
+ }
1265
+ };
1266
+ var cn = (t, e) => e === "zIndex" ? false : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
1267
+ (le.test(t) || t === "0") && // And it contains numbers and/or colors
1268
+ !t.startsWith("url("));
1269
+ function Tr(t) {
1270
+ const e = t[0];
1271
+ if (t.length === 1)
1272
+ return true;
1273
+ for (let n = 0; n < t.length; n++)
1274
+ if (t[n] !== e)
1275
+ return true;
1276
+ }
1277
+ function Sr(t, e, n, s) {
1278
+ const i = t[0];
1279
+ if (i === null)
1280
+ return false;
1281
+ if (e === "display" || e === "visibility")
1282
+ return true;
1283
+ const r = t[t.length - 1], o = cn(i, e), a = cn(r, e);
1284
+ return Se(o === a, `You are trying to animate ${e} from "${i}" to "${r}". "${o ? r : i}" is not an animatable value.`, "value-not-animatable"), !o || !a ? false : Tr(t) || (n === "spring" || Ot(n)) && s;
1285
+ }
1286
+ function dt(t) {
1287
+ t.duration = 0, t.type = "keyframes";
1288
+ }
1289
+ var xr = /* @__PURE__ */ new Set([
1290
+ "opacity",
1291
+ "clipPath",
1292
+ "filter",
1293
+ "transform"
1294
+ // TODO: Could be re-enabled now we have support for linear() easing
1295
+ // "background-color"
1296
+ ]);
1297
+ var Mr = /* @__PURE__ */ wt(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1298
+ function Vr(t) {
1299
+ const { motionValue: e, name: n, repeatDelay: s, repeatType: i, damping: r, type: o } = t;
1300
+ if (!(e?.owner?.current instanceof HTMLElement))
1301
+ return false;
1302
+ const { onUpdate: c, transformTemplate: u } = e.owner.getProps();
1303
+ return Mr() && n && xr.has(n) && (n !== "transform" || !u) && /**
1304
+ * If we're outputting values to onUpdate then we can't use WAAPI as there's
1305
+ * no way to read the value from WAAPI every frame.
1306
+ */
1307
+ !c && !s && i !== "mirror" && r !== 0 && o !== "inertia";
1308
+ }
1309
+ var Ar = 40;
1310
+ var Cr = class extends Ft {
1311
+ constructor({ autoplay: e = true, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", keyframes: a, name: c, motionValue: u, element: f, ...l }) {
1312
+ super(), this.stop = () => {
1313
+ this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
1314
+ }, this.createdAt = N.now();
1315
+ const h = {
1316
+ autoplay: e,
1317
+ delay: n,
1318
+ type: s,
1319
+ repeat: i,
1320
+ repeatDelay: r,
1321
+ repeatType: o,
1322
+ name: c,
1323
+ motionValue: u,
1324
+ element: f,
1325
+ ...l
1326
+ }, d = f?.KeyframeResolver || $t;
1327
+ this.keyframeResolver = new d(a, (m, _, p) => this.onKeyframesResolved(m, _, h, !p), c, u, f), this.keyframeResolver?.scheduleResolve();
1328
+ }
1329
+ onKeyframesResolved(e, n, s, i) {
1330
+ this.keyframeResolver = void 0;
1331
+ const { name: r, type: o, velocity: a, delay: c, isHandoff: u, onUpdate: f } = s;
1332
+ this.resolvedAt = N.now(), Sr(e, r, o, a) || ((U.instantAnimations || !c) && f?.(Dt(e, s, n)), e[0] = e[e.length - 1], dt(s), s.repeat = 0);
1333
+ const h = {
1334
+ startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > Ar ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1335
+ finalKeyframe: n,
1336
+ ...s,
1337
+ keyframes: e
1338
+ }, d = !u && Vr(h) ? new wr({
1339
+ ...h,
1340
+ element: h.motionValue.owner.current
1341
+ }) : new Pt(h);
1342
+ d.finished.then(() => this.notifyFinished()).catch(oe), this.pendingTimeline && (this.stopTimeline = d.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = d;
1343
+ }
1344
+ get finished() {
1345
+ return this._animation ? this.animation.finished : this._finished;
1346
+ }
1347
+ then(e, n) {
1348
+ return this.finished.finally(e).then(() => {
1349
+ });
1350
+ }
1351
+ get animation() {
1352
+ return this._animation || (this.keyframeResolver?.resume(), cr()), this._animation;
1353
+ }
1354
+ get duration() {
1355
+ return this.animation.duration;
1356
+ }
1357
+ get iterationDuration() {
1358
+ return this.animation.iterationDuration;
1359
+ }
1360
+ get time() {
1361
+ return this.animation.time;
1362
+ }
1363
+ set time(e) {
1364
+ this.animation.time = e;
1365
+ }
1366
+ get speed() {
1367
+ return this.animation.speed;
1368
+ }
1369
+ get state() {
1370
+ return this.animation.state;
1371
+ }
1372
+ set speed(e) {
1373
+ this.animation.speed = e;
1374
+ }
1375
+ get startTime() {
1376
+ return this.animation.startTime;
1377
+ }
1378
+ attachTimeline(e) {
1379
+ return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
1380
+ }
1381
+ play() {
1382
+ this.animation.play();
1383
+ }
1384
+ pause() {
1385
+ this.animation.pause();
1386
+ }
1387
+ complete() {
1388
+ this.animation.complete();
1389
+ }
1390
+ cancel() {
1391
+ this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
1392
+ }
1393
+ };
1394
+ var Er = class {
1395
+ constructor(e) {
1396
+ this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
1397
+ }
1398
+ get finished() {
1399
+ return Promise.all(this.animations.map((e) => e.finished));
1400
+ }
1401
+ /**
1402
+ * TODO: Filter out cancelled or stopped animations before returning
1403
+ */
1404
+ getAll(e) {
1405
+ return this.animations[0][e];
1406
+ }
1407
+ setAll(e, n) {
1408
+ for (let s = 0; s < this.animations.length; s++)
1409
+ this.animations[s][e] = n;
1410
+ }
1411
+ attachTimeline(e) {
1412
+ const n = this.animations.map((s) => s.attachTimeline(e));
1413
+ return () => {
1414
+ n.forEach((s, i) => {
1415
+ s && s(), this.animations[i].stop();
1416
+ });
1417
+ };
1418
+ }
1419
+ get time() {
1420
+ return this.getAll("time");
1421
+ }
1422
+ set time(e) {
1423
+ this.setAll("time", e);
1424
+ }
1425
+ get speed() {
1426
+ return this.getAll("speed");
1427
+ }
1428
+ set speed(e) {
1429
+ this.setAll("speed", e);
1430
+ }
1431
+ get state() {
1432
+ return this.getAll("state");
1433
+ }
1434
+ get startTime() {
1435
+ return this.getAll("startTime");
1436
+ }
1437
+ get duration() {
1438
+ return fn(this.animations, "duration");
1439
+ }
1440
+ get iterationDuration() {
1441
+ return fn(this.animations, "iterationDuration");
1442
+ }
1443
+ runAll(e) {
1444
+ this.animations.forEach((n) => n[e]());
1445
+ }
1446
+ play() {
1447
+ this.runAll("play");
1448
+ }
1449
+ pause() {
1450
+ this.runAll("pause");
1451
+ }
1452
+ cancel() {
1453
+ this.runAll("cancel");
1454
+ }
1455
+ complete() {
1456
+ this.runAll("complete");
1457
+ }
1458
+ };
1459
+ function fn(t, e) {
1460
+ let n = 0;
1461
+ for (let s = 0; s < t.length; s++) {
1462
+ const i = t[s][e];
1463
+ i !== null && i > n && (n = i);
1464
+ }
1465
+ return n;
1466
+ }
1467
+ var kr = class extends Er {
1468
+ then(e, n) {
1469
+ return this.finished.finally(e).then(() => {
1470
+ });
1471
+ }
1472
+ };
1473
+ var Dr = (
1474
+ // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
1475
+ /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
1476
+ );
1477
+ function Fr(t) {
1478
+ const e = Dr.exec(t);
1479
+ if (!e)
1480
+ return [,];
1481
+ const [, n, s, i] = e;
1482
+ return [`--${n ?? s}`, i];
1483
+ }
1484
+ var Pr = 4;
1485
+ function vs(t, e, n = 1) {
1486
+ K(n <= Pr, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
1487
+ const [s, i] = Fr(t);
1488
+ if (!s)
1489
+ return;
1490
+ const r = window.getComputedStyle(e).getPropertyValue(s);
1491
+ if (r) {
1492
+ const o = r.trim();
1493
+ return Rn(o) ? parseFloat(o) : o;
1494
+ }
1495
+ return Vt(i) ? vs(i, e, n + 1) : i;
1496
+ }
1497
+ function bs(t, e) {
1498
+ return t?.[e] ?? t?.default ?? t;
1499
+ }
1500
+ var ws = /* @__PURE__ */ new Set([
1501
+ "width",
1502
+ "height",
1503
+ "top",
1504
+ "left",
1505
+ "right",
1506
+ "bottom",
1507
+ ...ue
1508
+ ]);
1509
+ var $r = {
1510
+ test: (t) => t === "auto",
1511
+ parse: (t) => t
1512
+ };
1513
+ var Ts = (t) => (e) => e.test(t);
1514
+ var Ss = [ae, T, se, X, Mi, xi, $r];
1515
+ var hn = (t) => Ss.find(Ts(t));
1516
+ function Or(t) {
1517
+ return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Nn(t) : true;
1518
+ }
1519
+ var Rr = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1520
+ function Nr(t) {
1521
+ const [e, n] = t.slice(0, -1).split("(");
1522
+ if (e === "drop-shadow")
1523
+ return t;
1524
+ const [s] = n.match(At) || [];
1525
+ if (!s)
1526
+ return t;
1527
+ const i = n.replace(s, "");
1528
+ let r = Rr.has(e) ? 1 : 0;
1529
+ return s !== n && (r *= 100), e + "(" + r + i + ")";
1530
+ }
1531
+ var Ir = /\b([a-z-]*)\(.*?\)/gu;
1532
+ var pt = {
1533
+ ...le,
1534
+ getAnimatableNone: (t) => {
1535
+ const e = t.match(Ir);
1536
+ return e ? e.map(Nr).join(" ") : t;
1537
+ }
1538
+ };
1539
+ var dn = {
1540
+ ...ae,
1541
+ transform: Math.round
1542
+ };
1543
+ var Wr = {
1544
+ rotate: X,
1545
+ rotateX: X,
1546
+ rotateY: X,
1547
+ rotateZ: X,
1548
+ scale: Fe,
1549
+ scaleX: Fe,
1550
+ scaleY: Fe,
1551
+ scaleZ: Fe,
1552
+ skew: X,
1553
+ skewX: X,
1554
+ skewY: X,
1555
+ distance: T,
1556
+ translateX: T,
1557
+ translateY: T,
1558
+ translateZ: T,
1559
+ x: T,
1560
+ y: T,
1561
+ z: T,
1562
+ perspective: T,
1563
+ transformPerspective: T,
1564
+ opacity: ge,
1565
+ originX: Qt,
1566
+ originY: Qt,
1567
+ originZ: T
1568
+ };
1569
+ var Rt = {
1570
+ // Border props
1571
+ borderWidth: T,
1572
+ borderTopWidth: T,
1573
+ borderRightWidth: T,
1574
+ borderBottomWidth: T,
1575
+ borderLeftWidth: T,
1576
+ borderRadius: T,
1577
+ radius: T,
1578
+ borderTopLeftRadius: T,
1579
+ borderTopRightRadius: T,
1580
+ borderBottomRightRadius: T,
1581
+ borderBottomLeftRadius: T,
1582
+ // Positioning props
1583
+ width: T,
1584
+ maxWidth: T,
1585
+ height: T,
1586
+ maxHeight: T,
1587
+ top: T,
1588
+ right: T,
1589
+ bottom: T,
1590
+ left: T,
1591
+ // Spacing props
1592
+ padding: T,
1593
+ paddingTop: T,
1594
+ paddingRight: T,
1595
+ paddingBottom: T,
1596
+ paddingLeft: T,
1597
+ margin: T,
1598
+ marginTop: T,
1599
+ marginRight: T,
1600
+ marginBottom: T,
1601
+ marginLeft: T,
1602
+ // Misc
1603
+ backgroundPositionX: T,
1604
+ backgroundPositionY: T,
1605
+ ...Wr,
1606
+ zIndex: dn,
1607
+ // SVG
1608
+ fillOpacity: ge,
1609
+ strokeOpacity: ge,
1610
+ numOctaves: dn
1611
+ };
1612
+ var Br = {
1613
+ ...Rt,
1614
+ // Color props
1615
+ color: P,
1616
+ backgroundColor: P,
1617
+ outlineColor: P,
1618
+ fill: P,
1619
+ stroke: P,
1620
+ // Border props
1621
+ borderColor: P,
1622
+ borderTopColor: P,
1623
+ borderRightColor: P,
1624
+ borderBottomColor: P,
1625
+ borderLeftColor: P,
1626
+ filter: pt,
1627
+ WebkitFilter: pt
1628
+ };
1629
+ var xs = (t) => Br[t];
1630
+ function Ms(t, e) {
1631
+ let n = xs(t);
1632
+ return n !== pt && (n = le), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
1633
+ }
1634
+ var Lr = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1635
+ function Kr(t, e, n) {
1636
+ let s = 0, i;
1637
+ for (; s < t.length && !i; ) {
1638
+ const r = t[s];
1639
+ typeof r == "string" && !Lr.has(r) && _e(r).values.length && (i = t[s]), s++;
1640
+ }
1641
+ if (i && n)
1642
+ for (const r of e)
1643
+ t[r] = Ms(n, i);
1644
+ }
1645
+ var Hr = class extends $t {
1646
+ constructor(e, n, s, i, r) {
1647
+ super(e, n, s, i, r, true);
1648
+ }
1649
+ readKeyframes() {
1650
+ const { unresolvedKeyframes: e, element: n, name: s } = this;
1651
+ if (!n || !n.current)
1652
+ return;
1653
+ super.readKeyframes();
1654
+ for (let c = 0; c < e.length; c++) {
1655
+ let u = e[c];
1656
+ if (typeof u == "string" && (u = u.trim(), Vt(u))) {
1657
+ const f = vs(u, n.current);
1658
+ f !== void 0 && (e[c] = f), c === e.length - 1 && (this.finalKeyframe = u);
1659
+ }
1660
+ }
1661
+ if (this.resolveNoneKeyframes(), !ws.has(s) || e.length !== 2)
1662
+ return;
1663
+ const [i, r] = e, o = hn(i), a = hn(r);
1664
+ if (o !== a)
1665
+ if (an(o) && an(a))
1666
+ for (let c = 0; c < e.length; c++) {
1667
+ const u = e[c];
1668
+ typeof u == "string" && (e[c] = parseFloat(u));
1669
+ }
1670
+ else q[s] && (this.needsMeasurement = true);
1671
+ }
1672
+ resolveNoneKeyframes() {
1673
+ const { unresolvedKeyframes: e, name: n } = this, s = [];
1674
+ for (let i = 0; i < e.length; i++)
1675
+ (e[i] === null || Or(e[i])) && s.push(i);
1676
+ s.length && Kr(e, s, n);
1677
+ }
1678
+ measureInitialState() {
1679
+ const { element: e, unresolvedKeyframes: n, name: s } = this;
1680
+ if (!e || !e.current)
1681
+ return;
1682
+ s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = q[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
1683
+ const i = n[n.length - 1];
1684
+ i !== void 0 && e.getValue(s, i).jump(i, false);
1685
+ }
1686
+ measureEndState() {
1687
+ const { element: e, name: n, unresolvedKeyframes: s } = this;
1688
+ if (!e || !e.current)
1689
+ return;
1690
+ const i = e.getValue(n);
1691
+ i && i.jump(this.measuredOrigin, false);
1692
+ const r = s.length - 1, o = s[r];
1693
+ s[r] = q[n](e.measureViewportBox(), window.getComputedStyle(e.current)), o !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = o), this.removedTransforms?.length && this.removedTransforms.forEach(([a, c]) => {
1694
+ e.getValue(a).set(c);
1695
+ }), this.resolveNoneKeyframes();
1696
+ }
1697
+ };
1698
+ function Ur(t, e, n) {
1699
+ if (t instanceof EventTarget)
1700
+ return [t];
1701
+ if (typeof t == "string") {
1702
+ let s = document;
1703
+ const i = n?.[t] ?? s.querySelectorAll(t);
1704
+ return i ? Array.from(i) : [];
1705
+ }
1706
+ return Array.from(t);
1707
+ }
1708
+ var Vs = (t, e) => e && typeof t == "number" ? e.transform(t) : t;
1709
+ var pn = 30;
1710
+ var jr = (t) => !isNaN(parseFloat(t));
1711
+ var Xr = class {
1712
+ /**
1713
+ * @param init - The initiating value
1714
+ * @param config - Optional configuration options
1715
+ *
1716
+ * - `transformer`: A function to transform incoming values with.
1717
+ */
1718
+ constructor(e, n = {}) {
1719
+ this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s) => {
1720
+ const i = N.now();
1721
+ if (this.updatedAt !== i && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && (this.events.change?.notify(this.current), this.dependents))
1722
+ for (const r of this.dependents)
1723
+ r.dirty();
1724
+ }, this.hasAnimated = false, this.setCurrent(e), this.owner = n.owner;
1725
+ }
1726
+ setCurrent(e) {
1727
+ this.current = e, this.updatedAt = N.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = jr(this.current));
1728
+ }
1729
+ setPrevFrameValue(e = this.current) {
1730
+ this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
1731
+ }
1732
+ /**
1733
+ * Adds a function that will be notified when the `MotionValue` is updated.
1734
+ *
1735
+ * It returns a function that, when called, will cancel the subscription.
1736
+ *
1737
+ * When calling `onChange` inside a React component, it should be wrapped with the
1738
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
1739
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
1740
+ *
1741
+ * ```jsx
1742
+ * export const MyComponent = () => {
1743
+ * const x = useMotionValue(0)
1744
+ * const y = useMotionValue(0)
1745
+ * const opacity = useMotionValue(1)
1746
+ *
1747
+ * useEffect(() => {
1748
+ * function updateOpacity() {
1749
+ * const maxXY = Math.max(x.get(), y.get())
1750
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
1751
+ * opacity.set(newOpacity)
1752
+ * }
1753
+ *
1754
+ * const unsubscribeX = x.on("change", updateOpacity)
1755
+ * const unsubscribeY = y.on("change", updateOpacity)
1756
+ *
1757
+ * return () => {
1758
+ * unsubscribeX()
1759
+ * unsubscribeY()
1760
+ * }
1761
+ * }, [])
1762
+ *
1763
+ * return <motion.div style={{ x }} />
1764
+ * }
1765
+ * ```
1766
+ *
1767
+ * @param subscriber - A function that receives the latest value.
1768
+ * @returns A function that, when called, will cancel this subscription.
1769
+ *
1770
+ * @deprecated
1771
+ */
1772
+ onChange(e) {
1773
+ return Bn(false, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
1774
+ }
1775
+ on(e, n) {
1776
+ this.events[e] || (this.events[e] = new In());
1777
+ const s = this.events[e].add(n);
1778
+ return e === "change" ? () => {
1779
+ s(), j.read(() => {
1780
+ this.events.change.getSize() || this.stop();
1781
+ });
1782
+ } : s;
1783
+ }
1784
+ clearListeners() {
1785
+ for (const e in this.events)
1786
+ this.events[e].clear();
1787
+ }
1788
+ /**
1789
+ * Attaches a passive effect to the `MotionValue`.
1790
+ */
1791
+ attach(e, n) {
1792
+ this.passiveEffect = e, this.stopPassiveEffect = n;
1793
+ }
1794
+ /**
1795
+ * Sets the state of the `MotionValue`.
1796
+ *
1797
+ * @remarks
1798
+ *
1799
+ * ```jsx
1800
+ * const x = useMotionValue(0)
1801
+ * x.set(10)
1802
+ * ```
1803
+ *
1804
+ * @param latest - Latest value to set.
1805
+ * @param render - Whether to notify render subscribers. Defaults to `true`
1806
+ *
1807
+ * @public
1808
+ */
1809
+ set(e) {
1810
+ this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
1811
+ }
1812
+ setWithVelocity(e, n, s) {
1813
+ this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
1814
+ }
1815
+ /**
1816
+ * Set the state of the `MotionValue`, stopping any active animations,
1817
+ * effects, and resets velocity to `0`.
1818
+ */
1819
+ jump(e, n = true) {
1820
+ this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1821
+ }
1822
+ dirty() {
1823
+ this.events.change?.notify(this.current);
1824
+ }
1825
+ addDependent(e) {
1826
+ this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(e);
1827
+ }
1828
+ removeDependent(e) {
1829
+ this.dependents && this.dependents.delete(e);
1830
+ }
1831
+ /**
1832
+ * Returns the latest state of `MotionValue`
1833
+ *
1834
+ * @returns - The latest state of `MotionValue`
1835
+ *
1836
+ * @public
1837
+ */
1838
+ get() {
1839
+ return this.current;
1840
+ }
1841
+ /**
1842
+ * @public
1843
+ */
1844
+ getPrevious() {
1845
+ return this.prev;
1846
+ }
1847
+ /**
1848
+ * Returns the latest velocity of `MotionValue`
1849
+ *
1850
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
1851
+ *
1852
+ * @public
1853
+ */
1854
+ getVelocity() {
1855
+ const e = N.now();
1856
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > pn)
1857
+ return 0;
1858
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, pn);
1859
+ return Wn(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1860
+ }
1861
+ /**
1862
+ * Registers a new animation to control this `MotionValue`. Only one
1863
+ * animation can drive a `MotionValue` at one time.
1864
+ *
1865
+ * ```jsx
1866
+ * value.start()
1867
+ * ```
1868
+ *
1869
+ * @param animation - A function that starts the provided animation
1870
+ */
1871
+ start(e) {
1872
+ return this.stop(), new Promise((n) => {
1873
+ this.hasAnimated = true, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
1874
+ }).then(() => {
1875
+ this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1876
+ });
1877
+ }
1878
+ /**
1879
+ * Stop the currently active animation.
1880
+ *
1881
+ * @public
1882
+ */
1883
+ stop() {
1884
+ this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1885
+ }
1886
+ /**
1887
+ * Returns `true` if this value is currently animating.
1888
+ *
1889
+ * @public
1890
+ */
1891
+ isAnimating() {
1892
+ return !!this.animation;
1893
+ }
1894
+ clearAnimation() {
1895
+ delete this.animation;
1896
+ }
1897
+ /**
1898
+ * Destroy and clean up subscribers to this `MotionValue`.
1899
+ *
1900
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
1901
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
1902
+ * created a `MotionValue` via the `motionValue` function.
1903
+ *
1904
+ * @public
1905
+ */
1906
+ destroy() {
1907
+ this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1908
+ }
1909
+ };
1910
+ function ve(t, e) {
1911
+ return new Xr(t, e);
1912
+ }
1913
+ var { schedule: Yr } = /* @__PURE__ */ Qn(queueMicrotask, false);
1914
+ function As(t) {
1915
+ return ri(t) && "ownerSVGElement" in t;
1916
+ }
1917
+ function zr(t) {
1918
+ return As(t) && t.tagName === "svg";
1919
+ }
1920
+ var O = (t) => !!(t && t.getVelocity);
1921
+ var Gr = [...Ss, P, le];
1922
+ var qr = (t) => Gr.find(Ts(t));
1923
+ function Nt(t) {
1924
+ return typeof t == "object" && !Array.isArray(t);
1925
+ }
1926
+ function Cs(t, e, n, s) {
1927
+ return typeof t == "string" && Nt(e) ? Ur(t, n, s) : t instanceof NodeList ? Array.from(t) : Array.isArray(t) ? t : [t];
1928
+ }
1929
+ function Zr(t, e, n) {
1930
+ return t * (e + 1);
1931
+ }
1932
+ function mn(t, e, n, s) {
1933
+ return typeof e == "number" ? e : e.startsWith("-") || e.startsWith("+") ? Math.max(0, t + parseFloat(e)) : e === "<" ? n : e.startsWith("<") ? Math.max(0, n + parseFloat(e.slice(1))) : s.get(e) ?? t;
1934
+ }
1935
+ function Qr(t, e, n) {
1936
+ for (let s = 0; s < t.length; s++) {
1937
+ const i = t[s];
1938
+ i.at > e && i.at < n && (On(t, i), s--);
1939
+ }
1940
+ }
1941
+ function Jr(t, e, n, s, i, r) {
1942
+ Qr(t, i, r);
1943
+ for (let o = 0; o < e.length; o++)
1944
+ t.push({
1945
+ value: e[o],
1946
+ at: Ve(i, r, s[o]),
1947
+ easing: qn(n, o)
1948
+ });
1949
+ }
1950
+ function eo(t, e) {
1951
+ for (let n = 0; n < t.length; n++)
1952
+ t[n] = t[n] / (e + 1);
1953
+ }
1954
+ function to(t, e) {
1955
+ return t.at === e.at ? t.value === null ? 1 : e.value === null ? -1 : 0 : t.at - e.at;
1956
+ }
1957
+ var no = "easeInOut";
1958
+ var so = 20;
1959
+ function io(t, { defaultTransition: e = {}, ...n } = {}, s, i) {
1960
+ const r = e.duration || 0.3, o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = {}, u = /* @__PURE__ */ new Map();
1961
+ let f = 0, l = 0, h = 0;
1962
+ for (let d = 0; d < t.length; d++) {
1963
+ const m = t[d];
1964
+ if (typeof m == "string") {
1965
+ u.set(m, l);
1966
+ continue;
1967
+ } else if (!Array.isArray(m)) {
1968
+ u.set(m.name, mn(l, m.at, f, u));
1969
+ continue;
1970
+ }
1971
+ let [_, p, g = {}] = m;
1972
+ g.at !== void 0 && (l = mn(l, g.at, f, u));
1973
+ let y = 0;
1974
+ const S = (w, v, x, V = 0, b = 0) => {
1975
+ const M = ro(w), { delay: F = 0, times: E = hs(M), type: R = "keyframes", repeat: I, repeatType: ni, repeatDelay: si = 0, ...Xe } = v;
1976
+ let { ease: L = e.ease || "easeOut", duration: A } = v;
1977
+ const J = typeof F == "function" ? F(V, b) : F, Ce = M.length, jt = Ot(R) ? R : i?.[R || "keyframes"];
1978
+ if (Ce <= 2 && jt) {
1979
+ let fe = 100;
1980
+ if (Ce === 2 && lo(M)) {
1981
+ const he = M[1] - M[0];
1982
+ fe = Math.abs(he);
1983
+ }
1984
+ const Ee = { ...Xe };
1985
+ A !== void 0 && (Ee.duration = /* @__PURE__ */ B(A));
1986
+ const ke = us(Ee, fe, jt);
1987
+ L = ke.ease, A = ke.duration;
1988
+ }
1989
+ A ?? (A = r);
1990
+ const Xt = l + J;
1991
+ E.length === 1 && E[0] === 0 && (E[1] = 1);
1992
+ const Yt = E.length - M.length;
1993
+ if (Yt > 0 && fs(E, Yt), M.length === 1 && M.unshift(null), I) {
1994
+ K(I < so, "Repeat count too high, must be less than 20", "repeat-count-high"), A = Zr(A, I);
1995
+ const fe = [...M], Ee = [...E];
1996
+ L = Array.isArray(L) ? [...L] : [L];
1997
+ const ke = [...L];
1998
+ for (let he = 0; he < I; he++) {
1999
+ M.push(...fe);
2000
+ for (let de = 0; de < fe.length; de++)
2001
+ E.push(Ee[de] + (he + 1)), L.push(de === 0 ? "linear" : qn(ke, de - 1));
2002
+ }
2003
+ eo(E, I);
2004
+ }
2005
+ const zt = Xt + A;
2006
+ Jr(x, M, L, E, Xt, zt), y = Math.max(J + A, y), h = Math.max(zt, h);
2007
+ };
2008
+ if (O(_)) {
2009
+ const w = gn(_, a);
2010
+ S(p, g, _n("default", w));
2011
+ } else {
2012
+ const w = Cs(_, p, s, c), v = w.length;
2013
+ for (let x = 0; x < v; x++) {
2014
+ p = p, g = g;
2015
+ const V = w[x], b = gn(V, a);
2016
+ for (const M in p)
2017
+ S(p[M], oo(g, M), _n(M, b), x, v);
2018
+ }
2019
+ }
2020
+ f = l, l += y;
2021
+ }
2022
+ return a.forEach((d, m) => {
2023
+ for (const _ in d) {
2024
+ const p = d[_];
2025
+ p.sort(to);
2026
+ const g = [], y = [], S = [];
2027
+ for (let v = 0; v < p.length; v++) {
2028
+ const { at: x, value: V, easing: b } = p[v];
2029
+ g.push(V), y.push(/* @__PURE__ */ St(0, h, x)), S.push(b || "easeOut");
2030
+ }
2031
+ y[0] !== 0 && (y.unshift(0), g.unshift(g[0]), S.unshift(no)), y[y.length - 1] !== 1 && (y.push(1), g.push(null)), o.has(m) || o.set(m, {
2032
+ keyframes: {},
2033
+ transition: {}
2034
+ });
2035
+ const w = o.get(m);
2036
+ w.keyframes[_] = g, w.transition[_] = {
2037
+ ...e,
2038
+ duration: h,
2039
+ ease: S,
2040
+ times: y,
2041
+ ...n
2042
+ };
2043
+ }
2044
+ }), o;
2045
+ }
2046
+ function gn(t, e) {
2047
+ return !e.has(t) && e.set(t, {}), e.get(t);
2048
+ }
2049
+ function _n(t, e) {
2050
+ return e[t] || (e[t] = []), e[t];
2051
+ }
2052
+ function ro(t) {
2053
+ return Array.isArray(t) ? t : [t];
2054
+ }
2055
+ function oo(t, e) {
2056
+ return t && t[e] ? {
2057
+ ...t,
2058
+ ...t[e]
2059
+ } : { ...t };
2060
+ }
2061
+ var ao = (t) => typeof t == "number";
2062
+ var lo = (t) => t.every(ao);
2063
+ var be = /* @__PURE__ */ new WeakMap();
2064
+ var uo = (t) => Array.isArray(t);
2065
+ function yn(t) {
2066
+ const e = [{}, {}];
2067
+ return t?.values.forEach((n, s) => {
2068
+ e[0][s] = n.get(), e[1][s] = n.getVelocity();
2069
+ }), e;
2070
+ }
2071
+ function Es(t, e, n, s) {
2072
+ if (typeof e == "function") {
2073
+ const [i, r] = yn(s);
2074
+ e = e(n !== void 0 ? n : t.custom, i, r);
2075
+ }
2076
+ if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
2077
+ const [i, r] = yn(s);
2078
+ e = e(n !== void 0 ? n : t.custom, i, r);
2079
+ }
2080
+ return e;
2081
+ }
2082
+ function co(t, e, n) {
2083
+ const s = t.getProps();
2084
+ return Es(s, e, s.custom, t);
2085
+ }
2086
+ function fo(t, e, n) {
2087
+ t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, ve(n));
2088
+ }
2089
+ function ho(t) {
2090
+ return uo(t) ? t[t.length - 1] || 0 : t;
2091
+ }
2092
+ function po(t, e) {
2093
+ const n = co(t, e);
2094
+ let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
2095
+ r = { ...r, ...s };
2096
+ for (const o in r) {
2097
+ const a = ho(r[o]);
2098
+ fo(t, o, a);
2099
+ }
2100
+ }
2101
+ function mo(t) {
2102
+ return !!(O(t) && t.add);
2103
+ }
2104
+ function go(t, e) {
2105
+ const n = t.getValue("willChange");
2106
+ if (mo(n))
2107
+ return n.add(e);
2108
+ if (!n && U.WillChange) {
2109
+ const s = new U.WillChange("auto");
2110
+ t.addValue("willChange", s), s.add(e);
2111
+ }
2112
+ }
2113
+ var It = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
2114
+ var _o = "framerAppearId";
2115
+ var yo = "data-" + It(_o);
2116
+ function vo(t) {
2117
+ return t.props[yo];
2118
+ }
2119
+ var bo = (t) => t !== null;
2120
+ function wo(t, { repeat: e, repeatType: n = "loop" }, s) {
2121
+ const i = t.filter(bo), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
2122
+ return i[r];
2123
+ }
2124
+ var To = {
2125
+ type: "spring",
2126
+ stiffness: 500,
2127
+ damping: 25,
2128
+ restSpeed: 10
2129
+ };
2130
+ var So = (t) => ({
2131
+ type: "spring",
2132
+ stiffness: 550,
2133
+ damping: t === 0 ? 2 * Math.sqrt(550) : 30,
2134
+ restSpeed: 10
2135
+ });
2136
+ var xo = {
2137
+ type: "keyframes",
2138
+ duration: 0.8
2139
+ };
2140
+ var Mo = {
2141
+ type: "keyframes",
2142
+ ease: [0.25, 0.1, 0.35, 1],
2143
+ duration: 0.3
2144
+ };
2145
+ var Vo = (t, { keyframes: e }) => e.length > 2 ? xo : ce.has(t) ? t.startsWith("scale") ? So(e[1]) : To : Mo;
2146
+ function Ao({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: c, elapsed: u, ...f }) {
2147
+ return !!Object.keys(f).length;
2148
+ }
2149
+ var ks = (t, e, n, s = {}, i, r) => (o) => {
2150
+ const a = bs(s, t) || {}, c = a.delay || s.delay || 0;
2151
+ let { elapsed: u = 0 } = s;
2152
+ u = u - /* @__PURE__ */ B(c);
2153
+ const f = {
2154
+ keyframes: Array.isArray(n) ? n : [null, n],
2155
+ ease: "easeOut",
2156
+ velocity: e.getVelocity(),
2157
+ ...a,
2158
+ delay: -u,
2159
+ onUpdate: (h) => {
2160
+ e.set(h), a.onUpdate && a.onUpdate(h);
2161
+ },
2162
+ onComplete: () => {
2163
+ o(), a.onComplete && a.onComplete();
2164
+ },
2165
+ name: t,
2166
+ motionValue: e,
2167
+ element: r ? void 0 : i
2168
+ };
2169
+ Ao(a) || Object.assign(f, Vo(t, f)), f.duration && (f.duration = /* @__PURE__ */ B(f.duration)), f.repeatDelay && (f.repeatDelay = /* @__PURE__ */ B(f.repeatDelay)), f.from !== void 0 && (f.keyframes[0] = f.from);
2170
+ let l = false;
2171
+ if ((f.type === false || f.duration === 0 && !f.repeatDelay) && (dt(f), f.delay === 0 && (l = true)), (U.instantAnimations || U.skipAnimations) && (l = true, dt(f), f.delay = 0), f.allowFlatten = !a.type && !a.ease, l && !r && e.get() !== void 0) {
2172
+ const h = wo(f.keyframes, a);
2173
+ if (h !== void 0) {
2174
+ j.update(() => {
2175
+ f.onUpdate(h), f.onComplete();
2176
+ });
2177
+ return;
2178
+ }
2179
+ }
2180
+ return a.isSync ? new Pt(f) : new Cr(f);
2181
+ };
2182
+ function Co({ protectedKeys: t, needsAnimating: e }, n) {
2183
+ const s = t.hasOwnProperty(n) && e[n] !== true;
2184
+ return e[n] = false, s;
2185
+ }
2186
+ function Eo(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
2187
+ let { transition: r = t.getDefaultTransition(), transitionEnd: o, ...a } = e;
2188
+ s && (r = s);
2189
+ const c = [], u = i && t.animationState && t.animationState.getState()[i];
2190
+ for (const f in a) {
2191
+ const l = t.getValue(f, t.latestValues[f] ?? null), h = a[f];
2192
+ if (h === void 0 || u && Co(u, f))
2193
+ continue;
2194
+ const d = {
2195
+ delay: n,
2196
+ ...bs(r || {}, f)
2197
+ }, m = l.get();
2198
+ if (m !== void 0 && !l.isAnimating && !Array.isArray(h) && h === m && !d.velocity)
2199
+ continue;
2200
+ let _ = false;
2201
+ if (window.MotionHandoffAnimation) {
2202
+ const g = vo(t);
2203
+ if (g) {
2204
+ const y = window.MotionHandoffAnimation(g, f, j);
2205
+ y !== null && (d.startTime = y, _ = true);
2206
+ }
2207
+ }
2208
+ go(t, f), l.start(ks(f, l, h, t.shouldReduceMotion && ws.has(f) ? { type: false } : d, t, _));
2209
+ const p = l.animation;
2210
+ p && c.push(p);
2211
+ }
2212
+ return o && Promise.all(c).then(() => {
2213
+ j.update(() => {
2214
+ o && po(t, o);
2215
+ });
2216
+ }), c;
2217
+ }
2218
+ function ko({ top: t, left: e, right: n, bottom: s }) {
2219
+ return {
2220
+ x: { min: e, max: n },
2221
+ y: { min: t, max: s }
2222
+ };
2223
+ }
2224
+ function Do(t, e) {
2225
+ if (!e)
2226
+ return t;
2227
+ const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
2228
+ return {
2229
+ top: n.y,
2230
+ left: n.x,
2231
+ bottom: s.y,
2232
+ right: s.x
2233
+ };
2234
+ }
2235
+ function Fo(t, e) {
2236
+ return ko(Do(t.getBoundingClientRect(), e));
2237
+ }
2238
+ var vn = {
2239
+ animation: [
2240
+ "animate",
2241
+ "variants",
2242
+ "whileHover",
2243
+ "whileTap",
2244
+ "exit",
2245
+ "whileInView",
2246
+ "whileFocus",
2247
+ "whileDrag"
2248
+ ],
2249
+ exit: ["exit"],
2250
+ drag: ["drag", "dragControls"],
2251
+ focus: ["whileFocus"],
2252
+ hover: ["whileHover", "onHoverStart", "onHoverEnd"],
2253
+ tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
2254
+ pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
2255
+ inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
2256
+ layout: ["layout", "layoutId"]
2257
+ };
2258
+ var mt = {};
2259
+ for (const t in vn)
2260
+ mt[t] = {
2261
+ isEnabled: (e) => vn[t].some((n) => !!e[n])
2262
+ };
2263
+ var bn = () => ({ min: 0, max: 0 });
2264
+ var Wt = () => ({
2265
+ x: bn(),
2266
+ y: bn()
2267
+ });
2268
+ var Po = typeof window < "u";
2269
+ var gt = { current: null };
2270
+ var Ds = { current: false };
2271
+ function $o() {
2272
+ if (Ds.current = true, !!Po)
2273
+ if (window.matchMedia) {
2274
+ const t = window.matchMedia("(prefers-reduced-motion)"), e = () => gt.current = t.matches;
2275
+ t.addEventListener("change", e), e();
2276
+ } else
2277
+ gt.current = false;
2278
+ }
2279
+ function Oo(t) {
2280
+ return t !== null && typeof t == "object" && typeof t.start == "function";
2281
+ }
2282
+ function Ro(t) {
2283
+ return typeof t == "string" || Array.isArray(t);
2284
+ }
2285
+ var No = [
2286
+ "animate",
2287
+ "whileInView",
2288
+ "whileFocus",
2289
+ "whileHover",
2290
+ "whileTap",
2291
+ "whileDrag",
2292
+ "exit"
2293
+ ];
2294
+ var Io = ["initial", ...No];
2295
+ function Fs(t) {
2296
+ return Oo(t.animate) || Io.some((e) => Ro(t[e]));
2297
+ }
2298
+ function Wo(t) {
2299
+ return !!(Fs(t) || t.variants);
2300
+ }
2301
+ function Bo(t, e, n) {
2302
+ for (const s in e) {
2303
+ const i = e[s], r = n[s];
2304
+ if (O(i))
2305
+ t.addValue(s, i);
2306
+ else if (O(r))
2307
+ t.addValue(s, ve(i, { owner: t }));
2308
+ else if (r !== i)
2309
+ if (t.hasValue(s)) {
2310
+ const o = t.getValue(s);
2311
+ o.liveStyle === true ? o.jump(i) : o.hasAnimated || o.set(i);
2312
+ } else {
2313
+ const o = t.getStaticValue(s);
2314
+ t.addValue(s, ve(o !== void 0 ? o : i, { owner: t }));
2315
+ }
2316
+ }
2317
+ for (const s in n)
2318
+ e[s] === void 0 && t.removeValue(s);
2319
+ return e;
2320
+ }
2321
+ var wn = [
2322
+ "AnimationStart",
2323
+ "AnimationComplete",
2324
+ "Update",
2325
+ "BeforeLayoutMeasure",
2326
+ "LayoutMeasure",
2327
+ "LayoutAnimationStart",
2328
+ "LayoutAnimationComplete"
2329
+ ];
2330
+ var Ps = class {
2331
+ /**
2332
+ * This method takes React props and returns found MotionValues. For example, HTML
2333
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2334
+ *
2335
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2336
+ * intended to be one.
2337
+ */
2338
+ scrapeMotionValuesFromProps(e, n, s) {
2339
+ return {};
2340
+ }
2341
+ constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
2342
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = false, this.isControllingVariants = false, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = $t, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2343
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2344
+ }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2345
+ const h = N.now();
2346
+ this.renderScheduledAt < h && (this.renderScheduledAt = h, j.render(this.render, false, true));
2347
+ };
2348
+ const { latestValues: c, renderState: u } = o;
2349
+ this.latestValues = c, this.baseTarget = { ...c }, this.initialValues = n.initial ? { ...c } : {}, this.renderState = u, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Fs(n), this.isVariantNode = Wo(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
2350
+ const { willChange: f, ...l } = this.scrapeMotionValuesFromProps(n, {}, this);
2351
+ for (const h in l) {
2352
+ const d = l[h];
2353
+ c[h] !== void 0 && O(d) && d.set(c[h]);
2354
+ }
2355
+ }
2356
+ mount(e) {
2357
+ this.current = e, be.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), Ds.current || $o(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? false : this.reducedMotionConfig === "always" ? true : gt.current, Bn(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), this.parent?.addChild(this), this.update(this.props, this.presenceContext);
2358
+ }
2359
+ unmount() {
2360
+ this.projection && this.projection.unmount(), tt(this.notifyUpdate), tt(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this);
2361
+ for (const e in this.events)
2362
+ this.events[e].clear();
2363
+ for (const e in this.features) {
2364
+ const n = this.features[e];
2365
+ n && (n.unmount(), n.isMounted = false);
2366
+ }
2367
+ this.current = null;
2368
+ }
2369
+ addChild(e) {
2370
+ this.children.add(e), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(e);
2371
+ }
2372
+ removeChild(e) {
2373
+ this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
2374
+ }
2375
+ bindToMotionValue(e, n) {
2376
+ this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
2377
+ const s = ce.has(e);
2378
+ s && this.onBindTransform && this.onBindTransform();
2379
+ const i = n.on("change", (o) => {
2380
+ this.latestValues[e] = o, this.props.onUpdate && j.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = true), this.scheduleRender();
2381
+ });
2382
+ let r;
2383
+ window.MotionCheckAppearSync && (r = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
2384
+ i(), r && r(), n.owner && n.stop();
2385
+ });
2386
+ }
2387
+ sortNodePosition(e) {
2388
+ return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
2389
+ }
2390
+ updateFeatures() {
2391
+ let e = "animation";
2392
+ for (e in mt) {
2393
+ const n = mt[e];
2394
+ if (!n)
2395
+ continue;
2396
+ const { isEnabled: s, Feature: i } = n;
2397
+ if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
2398
+ const r = this.features[e];
2399
+ r.isMounted ? r.update() : (r.mount(), r.isMounted = true);
2400
+ }
2401
+ }
2402
+ }
2403
+ triggerBuild() {
2404
+ this.build(this.renderState, this.latestValues, this.props);
2405
+ }
2406
+ /**
2407
+ * Measure the current viewport box with or without transforms.
2408
+ * Only measures axis-aligned boxes, rotate and skew must be manually
2409
+ * removed with a re-render to work.
2410
+ */
2411
+ measureViewportBox() {
2412
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : Wt();
2413
+ }
2414
+ getStaticValue(e) {
2415
+ return this.latestValues[e];
2416
+ }
2417
+ setStaticValue(e, n) {
2418
+ this.latestValues[e] = n;
2419
+ }
2420
+ /**
2421
+ * Update the provided props. Ensure any newly-added motion values are
2422
+ * added to our map, old ones removed, and listeners updated.
2423
+ */
2424
+ update(e, n) {
2425
+ (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
2426
+ for (let s = 0; s < wn.length; s++) {
2427
+ const i = wn[s];
2428
+ this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
2429
+ const r = "on" + i, o = e[r];
2430
+ o && (this.propEventSubscriptions[i] = this.on(i, o));
2431
+ }
2432
+ this.prevMotionValues = Bo(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
2433
+ }
2434
+ getProps() {
2435
+ return this.props;
2436
+ }
2437
+ /**
2438
+ * Returns the variant definition with a given name.
2439
+ */
2440
+ getVariant(e) {
2441
+ return this.props.variants ? this.props.variants[e] : void 0;
2442
+ }
2443
+ /**
2444
+ * Returns the defined default transition on this component.
2445
+ */
2446
+ getDefaultTransition() {
2447
+ return this.props.transition;
2448
+ }
2449
+ getTransformPagePoint() {
2450
+ return this.props.transformPagePoint;
2451
+ }
2452
+ getClosestVariantNode() {
2453
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
2454
+ }
2455
+ /**
2456
+ * Add a child visual element to our set of children.
2457
+ */
2458
+ addVariantChild(e) {
2459
+ const n = this.getClosestVariantNode();
2460
+ if (n)
2461
+ return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
2462
+ }
2463
+ /**
2464
+ * Add a motion value and bind it to this visual element.
2465
+ */
2466
+ addValue(e, n) {
2467
+ const s = this.values.get(e);
2468
+ n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
2469
+ }
2470
+ /**
2471
+ * Remove a motion value and unbind any active subscriptions.
2472
+ */
2473
+ removeValue(e) {
2474
+ this.values.delete(e);
2475
+ const n = this.valueSubscriptions.get(e);
2476
+ n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
2477
+ }
2478
+ /**
2479
+ * Check whether we have a motion value for this key
2480
+ */
2481
+ hasValue(e) {
2482
+ return this.values.has(e);
2483
+ }
2484
+ getValue(e, n) {
2485
+ if (this.props.values && this.props.values[e])
2486
+ return this.props.values[e];
2487
+ let s = this.values.get(e);
2488
+ return s === void 0 && n !== void 0 && (s = ve(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
2489
+ }
2490
+ /**
2491
+ * If we're trying to animate to a previously unencountered value,
2492
+ * we need to check for it in our state and as a last resort read it
2493
+ * directly from the instance (which might have performance implications).
2494
+ */
2495
+ readValue(e, n) {
2496
+ let s = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
2497
+ return s != null && (typeof s == "string" && (Rn(s) || Nn(s)) ? s = parseFloat(s) : !qr(s) && le.test(n) && (s = Ms(e, n)), this.setBaseTarget(e, O(s) ? s.get() : s)), O(s) ? s.get() : s;
2498
+ }
2499
+ /**
2500
+ * Set the base target to later animate back to. This is currently
2501
+ * only hydrated on creation and when we first read a value.
2502
+ */
2503
+ setBaseTarget(e, n) {
2504
+ this.baseTarget[e] = n;
2505
+ }
2506
+ /**
2507
+ * Find the base target for a value thats been removed from all animation
2508
+ * props.
2509
+ */
2510
+ getBaseTarget(e) {
2511
+ const { initial: n } = this.props;
2512
+ let s;
2513
+ if (typeof n == "string" || typeof n == "object") {
2514
+ const r = Es(this.props, n, this.presenceContext?.custom);
2515
+ r && (s = r[e]);
2516
+ }
2517
+ if (n && s !== void 0)
2518
+ return s;
2519
+ const i = this.getBaseTargetFromProps(this.props, e);
2520
+ return i !== void 0 && !O(i) ? i : this.initialValues[e] !== void 0 && s === void 0 ? void 0 : this.baseTarget[e];
2521
+ }
2522
+ on(e, n) {
2523
+ return this.events[e] || (this.events[e] = new In()), this.events[e].add(n);
2524
+ }
2525
+ notify(e, ...n) {
2526
+ this.events[e] && this.events[e].notify(...n);
2527
+ }
2528
+ scheduleRenderMicrotask() {
2529
+ Yr.render(this.render);
2530
+ }
2531
+ };
2532
+ var $s = class extends Ps {
2533
+ constructor() {
2534
+ super(...arguments), this.KeyframeResolver = Hr;
2535
+ }
2536
+ sortInstanceNodePosition(e, n) {
2537
+ return e.compareDocumentPosition(n) & 2 ? 1 : -1;
2538
+ }
2539
+ getBaseTargetFromProps(e, n) {
2540
+ return e.style ? e.style[n] : void 0;
2541
+ }
2542
+ removeValueFromRenderState(e, { vars: n, style: s }) {
2543
+ delete n[e], delete s[e];
2544
+ }
2545
+ handleChildMotionValue() {
2546
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
2547
+ const { children: e } = this.props;
2548
+ O(e) && (this.childSubscription = e.on("change", (n) => {
2549
+ this.current && (this.current.textContent = `${n}`);
2550
+ }));
2551
+ }
2552
+ };
2553
+ var Lo = {
2554
+ x: "translateX",
2555
+ y: "translateY",
2556
+ z: "translateZ",
2557
+ transformPerspective: "perspective"
2558
+ };
2559
+ var Ko = ue.length;
2560
+ function Ho(t, e, n) {
2561
+ let s = "", i = true;
2562
+ for (let r = 0; r < Ko; r++) {
2563
+ const o = ue[r], a = t[o];
2564
+ if (a === void 0)
2565
+ continue;
2566
+ let c = true;
2567
+ if (typeof a == "number" ? c = a === (o.startsWith("scale") ? 1 : 0) : c = parseFloat(a) === 0, !c || n) {
2568
+ const u = Vs(a, Rt[o]);
2569
+ if (!c) {
2570
+ i = false;
2571
+ const f = Lo[o] || o;
2572
+ s += `${f}(${u}) `;
2573
+ }
2574
+ n && (e[o] = u);
2575
+ }
2576
+ }
2577
+ return s = s.trim(), n ? s = n(e, i ? "" : s) : i && (s = "none"), s;
2578
+ }
2579
+ function Os(t, e, n) {
2580
+ const { style: s, vars: i, transformOrigin: r } = t;
2581
+ let o = false, a = false;
2582
+ for (const c in e) {
2583
+ const u = e[c];
2584
+ if (ce.has(c)) {
2585
+ o = true;
2586
+ continue;
2587
+ } else if (es(c)) {
2588
+ i[c] = u;
2589
+ continue;
2590
+ } else {
2591
+ const f = Vs(u, Rt[c]);
2592
+ c.startsWith("origin") ? (a = true, r[c] = f) : s[c] = f;
2593
+ }
2594
+ }
2595
+ if (e.transform || (o || n ? s.transform = Ho(e, t.transform, n) : s.transform && (s.transform = "none")), a) {
2596
+ const { originX: c = "50%", originY: u = "50%", originZ: f = 0 } = r;
2597
+ s.transformOrigin = `${c} ${u} ${f}`;
2598
+ }
2599
+ }
2600
+ function Rs(t, { style: e, vars: n }, s, i) {
2601
+ const r = t.style;
2602
+ let o;
2603
+ for (o in e)
2604
+ r[o] = e[o];
2605
+ i?.applyProjectionStyles(r, s);
2606
+ for (o in n)
2607
+ r.setProperty(o, n[o]);
2608
+ }
2609
+ var Uo = {};
2610
+ function jo(t, { layout: e, layoutId: n }) {
2611
+ return ce.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!Uo[t] || t === "opacity");
2612
+ }
2613
+ function Ns(t, e, n) {
2614
+ const { style: s } = t, i = {};
2615
+ for (const r in s)
2616
+ (O(s[r]) || e.style && O(e.style[r]) || jo(r, t) || n?.getValue(r)?.liveStyle !== void 0) && (i[r] = s[r]);
2617
+ return i;
2618
+ }
2619
+ function Xo(t) {
2620
+ return window.getComputedStyle(t);
2621
+ }
2622
+ var Yo = class extends $s {
2623
+ constructor() {
2624
+ super(...arguments), this.type = "html", this.renderInstance = Rs;
2625
+ }
2626
+ readValueFromInstance(e, n) {
2627
+ if (ce.has(n))
2628
+ return this.projection?.isProjecting ? lt(n) : rr(e, n);
2629
+ {
2630
+ const s = Xo(e), i = (es(n) ? s.getPropertyValue(n) : s[n]) || 0;
2631
+ return typeof i == "string" ? i.trim() : i;
2632
+ }
2633
+ }
2634
+ measureInstanceViewportBox(e, { transformPagePoint: n }) {
2635
+ return Fo(e, n);
2636
+ }
2637
+ build(e, n, s) {
2638
+ Os(e, n, s.transformTemplate);
2639
+ }
2640
+ scrapeMotionValuesFromProps(e, n, s) {
2641
+ return Ns(e, n, s);
2642
+ }
2643
+ };
2644
+ function zo(t, e) {
2645
+ return t in e;
2646
+ }
2647
+ var Go = class extends Ps {
2648
+ constructor() {
2649
+ super(...arguments), this.type = "object";
2650
+ }
2651
+ readValueFromInstance(e, n) {
2652
+ if (zo(n, e)) {
2653
+ const s = e[n];
2654
+ if (typeof s == "string" || typeof s == "number")
2655
+ return s;
2656
+ }
2657
+ }
2658
+ getBaseTargetFromProps() {
2659
+ }
2660
+ removeValueFromRenderState(e, n) {
2661
+ delete n.output[e];
2662
+ }
2663
+ measureInstanceViewportBox() {
2664
+ return Wt();
2665
+ }
2666
+ build(e, n) {
2667
+ Object.assign(e.output, n);
2668
+ }
2669
+ renderInstance(e, { output: n }) {
2670
+ Object.assign(e, n);
2671
+ }
2672
+ sortInstanceNodePosition() {
2673
+ return 0;
2674
+ }
2675
+ };
2676
+ var qo = {
2677
+ offset: "stroke-dashoffset",
2678
+ array: "stroke-dasharray"
2679
+ };
2680
+ var Zo = {
2681
+ offset: "strokeDashoffset",
2682
+ array: "strokeDasharray"
2683
+ };
2684
+ function Qo(t, e, n = 1, s = 0, i = true) {
2685
+ t.pathLength = 1;
2686
+ const r = i ? qo : Zo;
2687
+ t[r.offset] = T.transform(-s);
2688
+ const o = T.transform(e), a = T.transform(n);
2689
+ t[r.array] = `${o} ${a}`;
2690
+ }
2691
+ function Jo(t, {
2692
+ attrX: e,
2693
+ attrY: n,
2694
+ attrScale: s,
2695
+ pathLength: i,
2696
+ pathSpacing: r = 1,
2697
+ pathOffset: o = 0,
2698
+ // This is object creation, which we try to avoid per-frame.
2699
+ ...a
2700
+ }, c, u, f) {
2701
+ if (Os(t, a, u), c) {
2702
+ t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
2703
+ return;
2704
+ }
2705
+ t.attrs = t.style, t.style = {};
2706
+ const { attrs: l, style: h } = t;
2707
+ l.transform && (h.transform = l.transform, delete l.transform), (h.transform || l.transformOrigin) && (h.transformOrigin = l.transformOrigin ?? "50% 50%", delete l.transformOrigin), h.transform && (h.transformBox = f?.transformBox ?? "fill-box", delete l.transformBox), e !== void 0 && (l.x = e), n !== void 0 && (l.y = n), s !== void 0 && (l.scale = s), i !== void 0 && Qo(l, i, r, o, false);
2708
+ }
2709
+ var Is = /* @__PURE__ */ new Set([
2710
+ "baseFrequency",
2711
+ "diffuseConstant",
2712
+ "kernelMatrix",
2713
+ "kernelUnitLength",
2714
+ "keySplines",
2715
+ "keyTimes",
2716
+ "limitingConeAngle",
2717
+ "markerHeight",
2718
+ "markerWidth",
2719
+ "numOctaves",
2720
+ "targetX",
2721
+ "targetY",
2722
+ "surfaceScale",
2723
+ "specularConstant",
2724
+ "specularExponent",
2725
+ "stdDeviation",
2726
+ "tableValues",
2727
+ "viewBox",
2728
+ "gradientTransform",
2729
+ "pathLength",
2730
+ "startOffset",
2731
+ "textLength",
2732
+ "lengthAdjust"
2733
+ ]);
2734
+ var ea = (t) => typeof t == "string" && t.toLowerCase() === "svg";
2735
+ function ta(t, e, n, s) {
2736
+ Rs(t, e, void 0, s);
2737
+ for (const i in e.attrs)
2738
+ t.setAttribute(Is.has(i) ? i : It(i), e.attrs[i]);
2739
+ }
2740
+ function na(t, e, n) {
2741
+ const s = Ns(t, e, n);
2742
+ for (const i in t)
2743
+ if (O(t[i]) || O(e[i])) {
2744
+ const r = ue.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
2745
+ s[r] = t[i];
2746
+ }
2747
+ return s;
2748
+ }
2749
+ var sa = class extends $s {
2750
+ constructor() {
2751
+ super(...arguments), this.type = "svg", this.isSVGTag = false, this.measureInstanceViewportBox = Wt;
2752
+ }
2753
+ getBaseTargetFromProps(e, n) {
2754
+ return e[n];
2755
+ }
2756
+ readValueFromInstance(e, n) {
2757
+ if (ce.has(n)) {
2758
+ const s = xs(n);
2759
+ return s && s.default || 0;
2760
+ }
2761
+ return n = Is.has(n) ? n : It(n), e.getAttribute(n);
2762
+ }
2763
+ scrapeMotionValuesFromProps(e, n, s) {
2764
+ return na(e, n, s);
2765
+ }
2766
+ build(e, n, s) {
2767
+ Jo(e, n, this.isSVGTag, s.transformTemplate, s.style);
2768
+ }
2769
+ renderInstance(e, n, s, i) {
2770
+ ta(e, n, s, i);
2771
+ }
2772
+ mount(e) {
2773
+ this.isSVGTag = ea(e.tagName), super.mount(e);
2774
+ }
2775
+ };
2776
+ function ia(t) {
2777
+ const e = {
2778
+ presenceContext: null,
2779
+ props: {},
2780
+ visualState: {
2781
+ renderState: {
2782
+ transform: {},
2783
+ transformOrigin: {},
2784
+ style: {},
2785
+ vars: {},
2786
+ attrs: {}
2787
+ },
2788
+ latestValues: {}
2789
+ }
2790
+ }, n = As(t) && !zr(t) ? new sa(e) : new Yo(e);
2791
+ n.mount(t), be.set(t, n);
2792
+ }
2793
+ function ra(t) {
2794
+ const e = {
2795
+ presenceContext: null,
2796
+ props: {},
2797
+ visualState: {
2798
+ renderState: {
2799
+ output: {}
2800
+ },
2801
+ latestValues: {}
2802
+ }
2803
+ }, n = new Go(e);
2804
+ n.mount(t), be.set(t, n);
2805
+ }
2806
+ function oa(t, e, n) {
2807
+ const s = O(t) ? t : ve(t);
2808
+ return s.start(ks("", s, e, n)), s.animation;
2809
+ }
2810
+ function aa(t, e) {
2811
+ return O(t) || typeof t == "number" || typeof t == "string" && !Nt(e);
2812
+ }
2813
+ function Ws(t, e, n, s) {
2814
+ const i = [];
2815
+ if (aa(t, e))
2816
+ i.push(oa(t, Nt(e) && e.default || e, n && (n.default || n)));
2817
+ else {
2818
+ const r = Cs(t, e, s), o = r.length;
2819
+ K(!!o, "No valid elements provided.", "no-valid-elements");
2820
+ for (let a = 0; a < o; a++) {
2821
+ const c = r[a];
2822
+ K(c !== null, "You're trying to perform an animation on null. Ensure that selectors are correctly finding elements and refs are correctly hydrated.", "animate-null");
2823
+ const u = c instanceof Element ? ia : ra;
2824
+ be.has(c) || u(c);
2825
+ const f = be.get(c), l = { ...n };
2826
+ "delay" in l && typeof l.delay == "function" && (l.delay = l.delay(a, o)), i.push(...Eo(f, { ...e, transition: l }, {}));
2827
+ }
2828
+ }
2829
+ return i;
2830
+ }
2831
+ function la(t, e, n) {
2832
+ const s = [];
2833
+ return io(t, e, n, { spring: ye }).forEach(({ keyframes: r, transition: o }, a) => {
2834
+ s.push(...Ws(a, r, o));
2835
+ }), s;
2836
+ }
2837
+ function ua(t) {
2838
+ return Array.isArray(t) && t.some(Array.isArray);
2839
+ }
2840
+ function ca(t) {
2841
+ function e(n, s, i) {
2842
+ let r = [], o;
2843
+ if (ua(n))
2844
+ r = la(n, s, t);
2845
+ else {
2846
+ const { onComplete: c, ...u } = i || {};
2847
+ typeof c == "function" && (o = c), r = Ws(n, s, u, t);
2848
+ }
2849
+ const a = new kr(r);
2850
+ return o && a.finished.then(o), a;
2851
+ }
2852
+ return e;
2853
+ }
2854
+ var Ze = ca();
2855
+ var Ue;
2856
+ var C;
2857
+ var Bs;
2858
+ var Y;
2859
+ var Tn;
2860
+ var Ls;
2861
+ var Ks;
2862
+ var Hs;
2863
+ var Bt;
2864
+ var _t;
2865
+ var yt;
2866
+ var we = {};
2867
+ var Us = [];
2868
+ var fa = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
2869
+ var je = Array.isArray;
2870
+ function H(t, e) {
2871
+ for (var n in e) t[n] = e[n];
2872
+ return t;
2873
+ }
2874
+ function Lt(t) {
2875
+ t && t.parentNode && t.parentNode.removeChild(t);
2876
+ }
2877
+ function js(t, e, n) {
2878
+ var s, i, r, o = {};
2879
+ for (r in e) r == "key" ? s = e[r] : r == "ref" ? i = e[r] : o[r] = e[r];
2880
+ if (arguments.length > 2 && (o.children = arguments.length > 3 ? Ue.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (r in t.defaultProps) o[r] === void 0 && (o[r] = t.defaultProps[r]);
2881
+ return Re(t, o, s, i, null);
2882
+ }
2883
+ function Re(t, e, n, s, i) {
2884
+ var r = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Bs, __i: -1, __u: 0 };
2885
+ return i == null && C.vnode != null && C.vnode(r), r;
2886
+ }
2887
+ function Ae(t) {
2888
+ return t.children;
2889
+ }
2890
+ function Ne(t, e) {
2891
+ this.props = t, this.context = e;
2892
+ }
2893
+ function re(t, e) {
2894
+ if (e == null) return t.__ ? re(t.__, t.__i + 1) : null;
2895
+ for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
2896
+ return typeof t.type == "function" ? re(t) : null;
2897
+ }
2898
+ function Xs(t) {
2899
+ var e, n;
2900
+ if ((t = t.__) != null && t.__c != null) {
2901
+ for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
2902
+ t.__e = t.__c.base = n.__e;
2903
+ break;
2904
+ }
2905
+ return Xs(t);
2906
+ }
2907
+ }
2908
+ function Sn(t) {
2909
+ (!t.__d && (t.__d = true) && Y.push(t) && !Ke.__r++ || Tn != C.debounceRendering) && ((Tn = C.debounceRendering) || Ls)(Ke);
2910
+ }
2911
+ function Ke() {
2912
+ for (var t, e, n, s, i, r, o, a = 1; Y.length; ) Y.length > a && Y.sort(Ks), t = Y.shift(), a = Y.length, t.__d && (n = void 0, s = void 0, i = (s = (e = t).__v).__e, r = [], o = [], e.__P && ((n = H({}, s)).__v = s.__v + 1, C.vnode && C.vnode(n), Kt(e.__P, n, s, e.__n, e.__P.namespaceURI, 32 & s.__u ? [i] : null, r, i ?? re(s), !!(32 & s.__u), o), n.__v = s.__v, n.__.__k[n.__i] = n, Gs(r, n, o), s.__e = s.__ = null, n.__e != i && Xs(n)));
2913
+ Ke.__r = 0;
2914
+ }
2915
+ function Ys(t, e, n, s, i, r, o, a, c, u, f) {
2916
+ var l, h, d, m, _, p, g, y = s && s.__k || Us, S = e.length;
2917
+ for (c = ha(n, e, y, c, S), l = 0; l < S; l++) (d = n.__k[l]) != null && (h = d.__i == -1 ? we : y[d.__i] || we, d.__i = l, p = Kt(t, d, h, i, r, o, a, c, u, f), m = d.__e, d.ref && h.ref != d.ref && (h.ref && Ht(h.ref, null, d), f.push(d.ref, d.__c || m, d)), _ == null && m != null && (_ = m), (g = !!(4 & d.__u)) || h.__k === d.__k ? c = zs(d, c, t, g) : typeof d.type == "function" && p !== void 0 ? c = p : m && (c = m.nextSibling), d.__u &= -7);
2918
+ return n.__e = _, c;
2919
+ }
2920
+ function ha(t, e, n, s, i) {
2921
+ var r, o, a, c, u, f = n.length, l = f, h = 0;
2922
+ for (t.__k = new Array(i), r = 0; r < i; r++) (o = e[r]) != null && typeof o != "boolean" && typeof o != "function" ? (c = r + h, (o = t.__k[r] = typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? Re(null, o, null, null, null) : je(o) ? Re(Ae, { children: o }, null, null, null) : o.constructor == null && o.__b > 0 ? Re(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o).__ = t, o.__b = t.__b + 1, a = null, (u = o.__i = da(o, n, c, l)) != -1 && (l--, (a = n[u]) && (a.__u |= 2)), a == null || a.__v == null ? (u == -1 && (i > f ? h-- : i < f && h++), typeof o.type != "function" && (o.__u |= 4)) : u != c && (u == c - 1 ? h-- : u == c + 1 ? h++ : (u > c ? h-- : h++, o.__u |= 4))) : t.__k[r] = null;
2923
+ if (l) for (r = 0; r < f; r++) (a = n[r]) != null && !(2 & a.__u) && (a.__e == s && (s = re(a)), Zs(a, a));
2924
+ return s;
2925
+ }
2926
+ function zs(t, e, n, s) {
2927
+ var i, r;
2928
+ if (typeof t.type == "function") {
2929
+ for (i = t.__k, r = 0; i && r < i.length; r++) i[r] && (i[r].__ = t, e = zs(i[r], e, n, s));
2930
+ return e;
2931
+ }
2932
+ t.__e != e && (s && (e && t.type && !e.parentNode && (e = re(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
2933
+ do
2934
+ e = e && e.nextSibling;
2935
+ while (e != null && e.nodeType == 8);
2936
+ return e;
2937
+ }
2938
+ function da(t, e, n, s) {
2939
+ var i, r, o, a = t.key, c = t.type, u = e[n], f = u != null && (2 & u.__u) == 0;
2940
+ if (u === null && t.key == null || f && a == u.key && c == u.type) return n;
2941
+ if (s > (f ? 1 : 0)) {
2942
+ for (i = n - 1, r = n + 1; i >= 0 || r < e.length; ) if ((u = e[o = i >= 0 ? i-- : r++]) != null && !(2 & u.__u) && a == u.key && c == u.type) return o;
2943
+ }
2944
+ return -1;
2945
+ }
2946
+ function xn(t, e, n) {
2947
+ e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || fa.test(e) ? n : n + "px";
2948
+ }
2949
+ function Pe(t, e, n, s, i) {
2950
+ var r, o;
2951
+ e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
2952
+ else {
2953
+ if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n || xn(t.style, e, "");
2954
+ if (n) for (e in n) s && n[e] == s[e] || xn(t.style, e, n[e]);
2955
+ }
2956
+ else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(Hs, "$1")), o = e.toLowerCase(), e = o in t || e == "onFocusOut" || e == "onFocusIn" ? o.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + r] = n, n ? s ? n.u = s.u : (n.u = Bt, t.addEventListener(e, r ? yt : _t, r)) : t.removeEventListener(e, r ? yt : _t, r);
2957
+ else {
2958
+ if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
2959
+ else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
2960
+ t[e] = n ?? "";
2961
+ break e;
2962
+ } catch {
2963
+ }
2964
+ typeof n == "function" || (n == null || n === false && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
2965
+ }
2966
+ }
2967
+ function Mn(t) {
2968
+ return function(e) {
2969
+ if (this.l) {
2970
+ var n = this.l[e.type + t];
2971
+ if (e.t == null) e.t = Bt++;
2972
+ else if (e.t < n.u) return;
2973
+ return n(C.event ? C.event(e) : e);
2974
+ }
2975
+ };
2976
+ }
2977
+ function Kt(t, e, n, s, i, r, o, a, c, u) {
2978
+ var f, l, h, d, m, _, p, g, y, S, w, v, x, V, b, M, F, E = e.type;
2979
+ if (e.constructor != null) return null;
2980
+ 128 & n.__u && (c = !!(32 & n.__u), r = [a = e.__e = n.__e]), (f = C.__b) && f(e);
2981
+ e: if (typeof E == "function") try {
2982
+ if (g = e.props, y = "prototype" in E && E.prototype.render, S = (f = E.contextType) && s[f.__c], w = f ? S ? S.props.value : f.__ : s, n.__c ? p = (l = e.__c = n.__c).__ = l.__E : (y ? e.__c = l = new E(g, w) : (e.__c = l = new Ne(g, w), l.constructor = E, l.render = ma), S && S.sub(l), l.props = g, l.state || (l.state = {}), l.context = w, l.__n = s, h = l.__d = true, l.__h = [], l._sb = []), y && l.__s == null && (l.__s = l.state), y && E.getDerivedStateFromProps != null && (l.__s == l.state && (l.__s = H({}, l.__s)), H(l.__s, E.getDerivedStateFromProps(g, l.__s))), d = l.props, m = l.state, l.__v = e, h) y && E.getDerivedStateFromProps == null && l.componentWillMount != null && l.componentWillMount(), y && l.componentDidMount != null && l.__h.push(l.componentDidMount);
2983
+ else {
2984
+ if (y && E.getDerivedStateFromProps == null && g !== d && l.componentWillReceiveProps != null && l.componentWillReceiveProps(g, w), !l.__e && l.shouldComponentUpdate != null && l.shouldComponentUpdate(g, l.__s, w) === false || e.__v == n.__v) {
2985
+ for (e.__v != n.__v && (l.props = g, l.state = l.__s, l.__d = false), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(R) {
2986
+ R && (R.__ = e);
2987
+ }), v = 0; v < l._sb.length; v++) l.__h.push(l._sb[v]);
2988
+ l._sb = [], l.__h.length && o.push(l);
2989
+ break e;
2990
+ }
2991
+ l.componentWillUpdate != null && l.componentWillUpdate(g, l.__s, w), y && l.componentDidUpdate != null && l.__h.push(function() {
2992
+ l.componentDidUpdate(d, m, _);
2993
+ });
2994
+ }
2995
+ if (l.context = w, l.props = g, l.__P = t, l.__e = false, x = C.__r, V = 0, y) {
2996
+ for (l.state = l.__s, l.__d = false, x && x(e), f = l.render(l.props, l.state, l.context), b = 0; b < l._sb.length; b++) l.__h.push(l._sb[b]);
2997
+ l._sb = [];
2998
+ } else do
2999
+ l.__d = false, x && x(e), f = l.render(l.props, l.state, l.context), l.state = l.__s;
3000
+ while (l.__d && ++V < 25);
3001
+ l.state = l.__s, l.getChildContext != null && (s = H(H({}, s), l.getChildContext())), y && !h && l.getSnapshotBeforeUpdate != null && (_ = l.getSnapshotBeforeUpdate(d, m)), M = f, f != null && f.type === Ae && f.key == null && (M = qs(f.props.children)), a = Ys(t, je(M) ? M : [M], e, n, s, i, r, o, a, c, u), l.base = e.__e, e.__u &= -161, l.__h.length && o.push(l), p && (l.__E = l.__ = null);
3002
+ } catch (R) {
3003
+ if (e.__v = null, c || r != null) if (R.then) {
3004
+ for (e.__u |= c ? 160 : 128; a && a.nodeType == 8 && a.nextSibling; ) a = a.nextSibling;
3005
+ r[r.indexOf(a)] = null, e.__e = a;
3006
+ } else {
3007
+ for (F = r.length; F--; ) Lt(r[F]);
3008
+ vt(e);
3009
+ }
3010
+ else e.__e = n.__e, e.__k = n.__k, R.then || vt(e);
3011
+ C.__e(R, e, n);
3012
+ }
3013
+ else r == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : a = e.__e = pa(n.__e, e, n, s, i, r, o, c, u);
3014
+ return (f = C.diffed) && f(e), 128 & e.__u ? void 0 : a;
3015
+ }
3016
+ function vt(t) {
3017
+ t && t.__c && (t.__c.__e = true), t && t.__k && t.__k.forEach(vt);
3018
+ }
3019
+ function Gs(t, e, n) {
3020
+ for (var s = 0; s < n.length; s++) Ht(n[s], n[++s], n[++s]);
3021
+ C.__c && C.__c(e, t), t.some(function(i) {
3022
+ try {
3023
+ t = i.__h, i.__h = [], t.some(function(r) {
3024
+ r.call(i);
3025
+ });
3026
+ } catch (r) {
3027
+ C.__e(r, i.__v);
3028
+ }
3029
+ });
3030
+ }
3031
+ function qs(t) {
3032
+ return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : je(t) ? t.map(qs) : H({}, t);
3033
+ }
3034
+ function pa(t, e, n, s, i, r, o, a, c) {
3035
+ var u, f, l, h, d, m, _, p = n.props, g = e.props, y = e.type;
3036
+ if (y == "svg" ? i = "http://www.w3.org/2000/svg" : y == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), r != null) {
3037
+ for (u = 0; u < r.length; u++) if ((d = r[u]) && "setAttribute" in d == !!y && (y ? d.localName == y : d.nodeType == 3)) {
3038
+ t = d, r[u] = null;
3039
+ break;
3040
+ }
3041
+ }
3042
+ if (t == null) {
3043
+ if (y == null) return document.createTextNode(g);
3044
+ t = document.createElementNS(i, y, g.is && g), a && (C.__m && C.__m(e, r), a = false), r = null;
3045
+ }
3046
+ if (y == null) p === g || a && t.data == g || (t.data = g);
3047
+ else {
3048
+ if (r = r && Ue.call(t.childNodes), p = n.props || we, !a && r != null) for (p = {}, u = 0; u < t.attributes.length; u++) p[(d = t.attributes[u]).name] = d.value;
3049
+ for (u in p) if (d = p[u], u != "children") {
3050
+ if (u == "dangerouslySetInnerHTML") l = d;
3051
+ else if (!(u in g)) {
3052
+ if (u == "value" && "defaultValue" in g || u == "checked" && "defaultChecked" in g) continue;
3053
+ Pe(t, u, null, d, i);
3054
+ }
3055
+ }
3056
+ for (u in g) d = g[u], u == "children" ? h = d : u == "dangerouslySetInnerHTML" ? f = d : u == "value" ? m = d : u == "checked" ? _ = d : a && typeof d != "function" || p[u] === d || Pe(t, u, d, p[u], i);
3057
+ if (f) a || l && (f.__html == l.__html || f.__html == t.innerHTML) || (t.innerHTML = f.__html), e.__k = [];
3058
+ else if (l && (t.innerHTML = ""), Ys(e.type == "template" ? t.content : t, je(h) ? h : [h], e, n, s, y == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, o, r ? r[0] : n.__k && re(n, 0), a, c), r != null) for (u = r.length; u--; ) Lt(r[u]);
3059
+ a || (u = "value", y == "progress" && m == null ? t.removeAttribute("value") : m != null && (m !== t[u] || y == "progress" && !m || y == "option" && m != p[u]) && Pe(t, u, m, p[u], i), u = "checked", _ != null && _ != t[u] && Pe(t, u, _, p[u], i));
3060
+ }
3061
+ return t;
3062
+ }
3063
+ function Ht(t, e, n) {
3064
+ try {
3065
+ if (typeof t == "function") {
3066
+ var s = typeof t.__u == "function";
3067
+ s && t.__u(), s && e == null || (t.__u = t(e));
3068
+ } else t.current = e;
3069
+ } catch (i) {
3070
+ C.__e(i, n);
3071
+ }
3072
+ }
3073
+ function Zs(t, e, n) {
3074
+ var s, i;
3075
+ if (C.unmount && C.unmount(t), (s = t.ref) && (s.current && s.current != t.__e || Ht(s, null, e)), (s = t.__c) != null) {
3076
+ if (s.componentWillUnmount) try {
3077
+ s.componentWillUnmount();
3078
+ } catch (r) {
3079
+ C.__e(r, e);
3080
+ }
3081
+ s.base = s.__P = null;
3082
+ }
3083
+ if (s = t.__k) for (i = 0; i < s.length; i++) s[i] && Zs(s[i], e, n || typeof t.type != "function");
3084
+ n || Lt(t.__e), t.__c = t.__ = t.__e = void 0;
3085
+ }
3086
+ function ma(t, e, n) {
3087
+ return this.constructor(t, n);
3088
+ }
3089
+ function ga(t, e, n) {
3090
+ var s, i, r, o;
3091
+ e == document && (e = document.documentElement), C.__ && C.__(t, e), i = (s = false) ? null : e.__k, r = [], o = [], Kt(e, t = e.__k = js(Ae, null, [t]), i || we, we, e.namespaceURI, i ? null : e.firstChild ? Ue.call(e.childNodes) : null, r, i ? i.__e : e.firstChild, s, o), Gs(r, t, o);
3092
+ }
3093
+ Ue = Us.slice, C = { __e: function(t, e, n, s) {
3094
+ for (var i, r, o; e = e.__; ) if ((i = e.__c) && !i.__) try {
3095
+ if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(t)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, s || {}), o = i.__d), o) return i.__E = i;
3096
+ } catch (a) {
3097
+ t = a;
3098
+ }
3099
+ throw t;
3100
+ } }, Bs = 0, Ne.prototype.setState = function(t, e) {
3101
+ var n;
3102
+ n = this.__s != null && this.__s != this.state ? this.__s : this.__s = H({}, this.state), typeof t == "function" && (t = t(H({}, n), this.props)), t && H(n, t), t != null && this.__v && (e && this._sb.push(e), Sn(this));
3103
+ }, Ne.prototype.forceUpdate = function(t) {
3104
+ this.__v && (this.__e = true, t && this.__h.push(t), Sn(this));
3105
+ }, Ne.prototype.render = Ae, Y = [], Ls = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ks = function(t, e) {
3106
+ return t.__v.__b - e.__v.__b;
3107
+ }, Ke.__r = 0, Hs = /(PointerCapture)$|Capture$/i, Bt = 0, _t = Mn(false), yt = Mn(true);
3108
+ var _a = 0;
3109
+ function ie(t, e, n, s, i, r) {
3110
+ e || (e = {});
3111
+ var o, a, c = e;
3112
+ if ("ref" in c) for (a in c = {}, e) a == "ref" ? o = e[a] : c[a] = e[a];
3113
+ var u = { type: t, props: c, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --_a, __i: -1, __u: 0, __source: i, __self: r };
3114
+ if (typeof t == "function" && (o = t.defaultProps)) for (a in o) c[a] === void 0 && (c[a] = o[a]);
3115
+ return C.vnode && C.vnode(u), u;
3116
+ }
3117
+ var Te;
3118
+ var D;
3119
+ var Qe;
3120
+ var Vn;
3121
+ var He = 0;
3122
+ var Qs = [];
3123
+ var $ = C;
3124
+ var An = $.__b;
3125
+ var Cn = $.__r;
3126
+ var En = $.diffed;
3127
+ var kn = $.__c;
3128
+ var Dn = $.unmount;
3129
+ var Fn = $.__;
3130
+ function Ut(t, e) {
3131
+ $.__h && $.__h(D, t, He || e), He = 0;
3132
+ var n = D.__H || (D.__H = { __: [], __h: [] });
3133
+ return t >= n.__.length && n.__.push({}), n.__[t];
3134
+ }
3135
+ function Je(t) {
3136
+ return He = 1, ya(ei, t);
3137
+ }
3138
+ function ya(t, e, n) {
3139
+ var s = Ut(Te++, 2);
3140
+ if (s.t = t, !s.__c && (s.__ = [ei(void 0, e), function(a) {
3141
+ var c = s.__N ? s.__N[0] : s.__[0], u = s.t(c, a);
3142
+ c !== u && (s.__N = [u, s.__[1]], s.__c.setState({}));
3143
+ }], s.__c = D, !D.__f)) {
3144
+ var i = function(a, c, u) {
3145
+ if (!s.__c.__H) return true;
3146
+ var f = s.__c.__H.__.filter(function(h) {
3147
+ return !!h.__c;
3148
+ });
3149
+ if (f.every(function(h) {
3150
+ return !h.__N;
3151
+ })) return !r || r.call(this, a, c, u);
3152
+ var l = s.__c.props !== a;
3153
+ return f.forEach(function(h) {
3154
+ if (h.__N) {
3155
+ var d = h.__[0];
3156
+ h.__ = h.__N, h.__N = void 0, d !== h.__[0] && (l = true);
3157
+ }
3158
+ }), r && r.call(this, a, c, u) || l;
3159
+ };
3160
+ D.__f = true;
3161
+ var r = D.shouldComponentUpdate, o = D.componentWillUpdate;
3162
+ D.componentWillUpdate = function(a, c, u) {
3163
+ if (this.__e) {
3164
+ var f = r;
3165
+ r = void 0, i(a, c, u), r = f;
3166
+ }
3167
+ o && o.call(this, a, c, u);
3168
+ }, D.shouldComponentUpdate = i;
3169
+ }
3170
+ return s.__N || s.__;
3171
+ }
3172
+ function ee(t, e) {
3173
+ var n = Ut(Te++, 3);
3174
+ !$.__s && Js(n.__H, e) && (n.__ = t, n.u = e, D.__H.__h.push(n));
3175
+ }
3176
+ function Pn(t) {
3177
+ return He = 5, va(function() {
3178
+ return { current: t };
3179
+ }, []);
3180
+ }
3181
+ function va(t, e) {
3182
+ var n = Ut(Te++, 7);
3183
+ return Js(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
3184
+ }
3185
+ function ba() {
3186
+ for (var t; t = Qs.shift(); ) if (t.__P && t.__H) try {
3187
+ t.__H.__h.forEach(Ie), t.__H.__h.forEach(bt), t.__H.__h = [];
3188
+ } catch (e) {
3189
+ t.__H.__h = [], $.__e(e, t.__v);
3190
+ }
3191
+ }
3192
+ $.__b = function(t) {
3193
+ D = null, An && An(t);
3194
+ }, $.__ = function(t, e) {
3195
+ t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Fn && Fn(t, e);
3196
+ }, $.__r = function(t) {
3197
+ Cn && Cn(t), Te = 0;
3198
+ var e = (D = t.__c).__H;
3199
+ e && (Qe === D ? (e.__h = [], D.__h = [], e.__.forEach(function(n) {
3200
+ n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
3201
+ })) : (e.__h.forEach(Ie), e.__h.forEach(bt), e.__h = [], Te = 0)), Qe = D;
3202
+ }, $.diffed = function(t) {
3203
+ En && En(t);
3204
+ var e = t.__c;
3205
+ e && e.__H && (e.__H.__h.length && (Qs.push(e) !== 1 && Vn === $.requestAnimationFrame || ((Vn = $.requestAnimationFrame) || wa)(ba)), e.__H.__.forEach(function(n) {
3206
+ n.u && (n.__H = n.u), n.u = void 0;
3207
+ })), Qe = D = null;
3208
+ }, $.__c = function(t, e) {
3209
+ e.some(function(n) {
3210
+ try {
3211
+ n.__h.forEach(Ie), n.__h = n.__h.filter(function(s) {
3212
+ return !s.__ || bt(s);
3213
+ });
3214
+ } catch (s) {
3215
+ e.some(function(i) {
3216
+ i.__h && (i.__h = []);
3217
+ }), e = [], $.__e(s, n.__v);
3218
+ }
3219
+ }), kn && kn(t, e);
3220
+ }, $.unmount = function(t) {
3221
+ Dn && Dn(t);
3222
+ var e, n = t.__c;
3223
+ n && n.__H && (n.__H.__.forEach(function(s) {
3224
+ try {
3225
+ Ie(s);
3226
+ } catch (i) {
3227
+ e = i;
3228
+ }
3229
+ }), n.__H = void 0, e && $.__e(e, n.__v));
3230
+ };
3231
+ var $n = typeof requestAnimationFrame == "function";
3232
+ function wa(t) {
3233
+ var e, n = function() {
3234
+ clearTimeout(s), $n && cancelAnimationFrame(e), setTimeout(t);
3235
+ }, s = setTimeout(n, 35);
3236
+ $n && (e = requestAnimationFrame(n));
3237
+ }
3238
+ function Ie(t) {
3239
+ var e = D, n = t.__c;
3240
+ typeof n == "function" && (t.__c = void 0, n()), D = e;
3241
+ }
3242
+ function bt(t) {
3243
+ var e = D;
3244
+ t.__c = t.__(), D = e;
3245
+ }
3246
+ function Js(t, e) {
3247
+ return !t || t.length !== e.length || e.some(function(n, s) {
3248
+ return n !== t[s];
3249
+ });
3250
+ }
3251
+ function ei(t, e) {
3252
+ return typeof e == "function" ? e(t) : e;
3253
+ }
3254
+ function Ta(t = "center") {
3255
+ const e = {
3256
+ center: {
3257
+ top: "50%",
3258
+ left: "50%",
3259
+ transform: "translate(-50%, -50%)"
3260
+ },
3261
+ n: {
3262
+ top: "20px",
3263
+ left: "50%",
3264
+ transform: "translateX(-50%)"
3265
+ },
3266
+ s: {
3267
+ bottom: "20px",
3268
+ left: "50%",
3269
+ transform: "translateX(-50%)"
3270
+ },
3271
+ e: {
3272
+ right: "20px",
3273
+ top: "50%",
3274
+ transform: "translateY(-50%)"
3275
+ },
3276
+ w: {
3277
+ left: "20px",
3278
+ top: "50%",
3279
+ transform: "translateY(-50%)"
3280
+ },
3281
+ ne: {
3282
+ top: "20px",
3283
+ right: "20px"
3284
+ },
3285
+ nw: {
3286
+ top: "20px",
3287
+ left: "20px"
3288
+ },
3289
+ se: {
3290
+ bottom: "20px",
3291
+ right: "20px"
3292
+ },
3293
+ sw: {
3294
+ bottom: "20px",
3295
+ left: "20px"
3296
+ }
3297
+ };
3298
+ return e[t] || e.center;
3299
+ }
3300
+ function Sa(t, e) {
3301
+ const n = "20px", i = {
3302
+ // Right side - slide from right
3303
+ e: { hidden: `translateY(-50%) translateX(${n})`, visible: "translateY(-50%)" },
3304
+ ne: { hidden: `translateX(${n})`, visible: "" },
3305
+ se: { hidden: `translateX(${n})`, visible: "" },
3306
+ // Left side - slide from left
3307
+ w: { hidden: `translateY(-50%) translateX(-${n})`, visible: "translateY(-50%)" },
3308
+ nw: { hidden: `translateX(-${n})`, visible: "" },
3309
+ sw: { hidden: `translateX(-${n})`, visible: "" },
3310
+ // Top - slide from top
3311
+ n: { hidden: `translateX(-50%) translateY(-${n})`, visible: "translateX(-50%)" },
3312
+ // Bottom/center - slide from bottom
3313
+ s: { hidden: `translateX(-50%) translateY(${n})`, visible: "translateX(-50%)" },
3314
+ center: { hidden: `translate(-50%, calc(-50% + ${n}))`, visible: "translate(-50%, -50%)" }
3315
+ }[t];
3316
+ return e ? i.visible : i.hidden;
3317
+ }
3318
+ function xa(t, e) {
3319
+ const n = e ? 1 : 0.95, i = {
3320
+ e: "translateY(-50%)",
3321
+ w: "translateY(-50%)",
3322
+ n: "translateX(-50%)",
3323
+ s: "translateX(-50%)",
3324
+ ne: "",
3325
+ nw: "",
3326
+ se: "",
3327
+ sw: "",
3328
+ center: "translate(-50%, -50%)"
3329
+ }[t];
3330
+ return i ? `${i} scale(${n})` : `scale(${n})`;
3331
+ }
3332
+ function Ma() {
3333
+ return "opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)";
3334
+ }
3335
+ function Va() {
3336
+ return "opacity 0.3s ease-out, transform 0.3s ease-out";
3337
+ }
3338
+ function Aa(t, e, n, s) {
3339
+ let i, r;
3340
+ return t === "slide-spring" || t === "slide-linear" ? i = Sa(e, n && s) : i = xa(e, n && s), t === "slide-spring" || t === "scale-spring" ? r = Ma() : r = Va(), { transform: i, transition: r };
3341
+ }
3342
+ function ti(t, e, n = "s", s = 8) {
3343
+ const i = t.getBoundingClientRect(), r = window.scrollX, o = window.scrollY, a = i.top + o, c = i.left + r, u = i.width, f = i.height, l = c + u / 2, h = a + f / 2, d = e.width, m = e.height;
3344
+ let _, p;
3345
+ switch (n) {
3346
+ case "s":
3347
+ _ = a + f + s, p = l - d / 2;
3348
+ break;
3349
+ case "sw":
3350
+ _ = a + f + s, p = c;
3351
+ break;
3352
+ case "se":
3353
+ _ = a + f + s, p = c + u - d;
3354
+ break;
3355
+ case "n":
3356
+ _ = a - m - s, p = l - d / 2;
3357
+ break;
3358
+ case "nw":
3359
+ _ = a - m - s, p = c;
3360
+ break;
3361
+ case "ne":
3362
+ _ = a - m - s, p = c + u - d;
3363
+ break;
3364
+ case "e":
3365
+ _ = h - m / 2, p = c + u + s;
3366
+ break;
3367
+ case "w":
3368
+ _ = h - m / 2, p = c - d - s;
3369
+ break;
3370
+ default:
3371
+ _ = a + f + s, p = l - d / 2;
3372
+ }
3373
+ return { top: _, left: p };
3374
+ }
3375
+ function Ca(t, e) {
3376
+ const n = "10px";
3377
+ if (e)
3378
+ return "translate(0, 0)";
3379
+ switch (t) {
3380
+ case "s":
3381
+ case "sw":
3382
+ case "se":
3383
+ return `translate(0, -${n})`;
3384
+ case "n":
3385
+ case "nw":
3386
+ case "ne":
3387
+ return `translate(0, ${n})`;
3388
+ case "e":
3389
+ return `translate(-${n}, 0)`;
3390
+ case "w":
3391
+ return `translate(${n}, 0)`;
3392
+ default:
3393
+ return `translate(0, -${n})`;
3394
+ }
3395
+ }
3396
+ function Ea(t) {
3397
+ return t ? "scale(1)" : "scale(0.95)";
3398
+ }
3399
+ function ka(t) {
3400
+ return typeof t == "object" && t !== null && t.type === "CHANGE_DIMENSIONS" && typeof t.payload?.width == "number" && typeof t.payload?.height == "number";
3401
+ }
3402
+ function Da(t, e) {
3403
+ const n = (s) => {
3404
+ if (ka(s.data)) {
3405
+ if (e && s.data.source !== e)
3406
+ return;
3407
+ t(s.data.payload);
3408
+ }
3409
+ };
3410
+ return window.addEventListener("message", n), () => window.removeEventListener("message", n);
3411
+ }
3412
+ function Fa(t, e, n, s) {
3413
+ const i = n && s;
3414
+ let r;
3415
+ return t === "slide-spring" || t === "slide-linear" ? r = Ca(e, i) : r = Ea(i), { transform: r, transition: t === "slide-spring" || t === "scale-spring" ? "opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)" : "opacity 0.15s ease-out, transform 0.15s ease-out" };
3416
+ }
3417
+ var Pa = ({
3418
+ visible: t,
3419
+ shouldRender: e,
3420
+ source: n,
3421
+ position: s,
3422
+ anchorElement: i,
3423
+ offset: r,
3424
+ style: o,
3425
+ zIndex: a,
3426
+ animation: c,
3427
+ fitToContent: u,
3428
+ onIframeLoad: f,
3429
+ onWidgetReady: l
3430
+ }) => {
3431
+ const h = Pn(null), d = Pn(null), [m, _] = Je(false), [p, g] = Je({ top: 0, left: 0 }), [y, S] = Je(null), w = !!i, v = o?.width || (w ? 320 : 480), x = o?.height || (w ? 400 : 600), V = u && y ? y.width : v, b = u && y ? y.height : x, M = typeof V == "number" ? V : parseInt(V, 10) || 320, F = typeof b == "number" ? b : parseInt(b, 10) || 400;
3432
+ ee(() => {
3433
+ if (!(!u || !e))
3434
+ return Da((A) => {
3435
+ S(A);
3436
+ }, n);
3437
+ }, [u, e, n]);
3438
+ const E = () => {
3439
+ if (!i) return;
3440
+ const A = ti(
3441
+ i,
3442
+ { width: M, height: F },
3443
+ s,
3444
+ r
3445
+ );
3446
+ g(A);
3447
+ };
3448
+ if (ee(() => {
3449
+ if (!e || !w) return;
3450
+ E();
3451
+ const A = () => E();
3452
+ return window.addEventListener("scroll", A, true), window.addEventListener("resize", A), () => {
3453
+ window.removeEventListener("scroll", A, true), window.removeEventListener("resize", A);
3454
+ };
3455
+ }, [e, i, s, r, M, F]), ee(() => {
3456
+ const A = h.current;
3457
+ if (!A) return;
3458
+ const J = () => f?.(A);
3459
+ return A.addEventListener("load", J), () => A.removeEventListener("load", J);
3460
+ }, [f]), ee(() => {
3461
+ const A = d.current;
3462
+ A && l?.(A);
3463
+ }, [l]), ee(() => {
3464
+ t && !m && requestAnimationFrame(() => _(true));
3465
+ }, [t, m]), !e) return null;
3466
+ let R, I;
3467
+ if (w)
3468
+ R = {
3469
+ position: "absolute",
3470
+ top: `${p.top}px`,
3471
+ left: `${p.left}px`
3472
+ }, I = Fa(c, s, t, m);
3473
+ else {
3474
+ const A = Ta(s), { transform: J, ...Ce } = A;
3475
+ R = {
3476
+ position: "fixed",
3477
+ ...Ce
3478
+ }, I = Aa(c, s, t, m);
3479
+ }
3480
+ const { width: ni, height: si, ...Xe } = o || {}, L = u ? Xe : o;
3481
+ return /* @__PURE__ */ ie(
3482
+ "div",
3483
+ {
3484
+ ref: d,
3485
+ style: {
3486
+ ...R,
3487
+ zIndex: a,
3488
+ width: V,
3489
+ height: b,
3490
+ maxWidth: w ? void 0 : "95vw",
3491
+ maxHeight: w ? void 0 : "95vh",
3492
+ borderRadius: 8,
3493
+ boxShadow: w ? "0 4px 16px rgba(0, 0, 0, 0.12)" : "0 2px 8px rgba(0, 0, 0, 0.1)",
3494
+ transform: I.transform,
3495
+ transition: u ? `${I.transition}, width 0.2s ease-out, height 0.2s ease-out` : I.transition,
3496
+ ...L,
3497
+ // These must come after finalStyle to prevent overrides
3498
+ pointerEvents: t ? "auto" : "none",
3499
+ opacity: m && t ? 1 : 0
3500
+ },
3501
+ children: /* @__PURE__ */ ie(
3502
+ "iframe",
3503
+ {
3504
+ ref: h,
3505
+ src: n,
3506
+ style: {
3507
+ border: "none",
3508
+ width: "100%",
3509
+ height: "100%",
3510
+ borderRadius: "inherit"
3511
+ },
3512
+ title: "Widget"
3513
+ }
3514
+ )
3515
+ }
3516
+ );
3517
+ };
3518
+ var $a = ({ visible: t, onClick: e, zIndex: n }) => t ? /* @__PURE__ */ ie(
3519
+ "div",
3520
+ {
3521
+ onClick: e,
3522
+ style: {
3523
+ position: "fixed",
3524
+ inset: "0",
3525
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
3526
+ zIndex: n - 1,
3527
+ animation: "fadeIn 0.2s ease-out"
3528
+ }
3529
+ }
3530
+ ) : null;
3531
+ var Oa = ({
3532
+ source: t,
3533
+ position: e,
3534
+ anchorElement: n,
3535
+ offset: s,
3536
+ style: i,
3537
+ overlay: r,
3538
+ zIndex: o,
3539
+ animation: a,
3540
+ closeOnClickOutside: c,
3541
+ fitToContent: u,
3542
+ onIframeLoad: f,
3543
+ onWidgetReady: l,
3544
+ onOpenChange: h,
3545
+ isOpen: d = false,
3546
+ isPreloaded: m = false
3547
+ }) => {
3548
+ const _ = d || m, p = !!n, g = () => {
3549
+ r && !p && h?.(false);
3550
+ };
3551
+ return ee(() => {
3552
+ if (!d || !p || !c) return;
3553
+ const y = (w) => {
3554
+ const v = w.target;
3555
+ n?.contains(v) || h?.(false);
3556
+ }, S = setTimeout(() => {
3557
+ document.addEventListener("click", y, true);
3558
+ }, 0);
3559
+ return () => {
3560
+ clearTimeout(S), document.removeEventListener("click", y, true);
3561
+ };
3562
+ }, [d, p, c, n, h]), /* @__PURE__ */ ie(Ae, { children: [
3563
+ !p && r && /* @__PURE__ */ ie($a, { visible: d, onClick: g, zIndex: o }),
3564
+ /* @__PURE__ */ ie(
3565
+ Pa,
3566
+ {
3567
+ visible: d,
3568
+ shouldRender: _,
3569
+ source: t,
3570
+ position: e,
3571
+ anchorElement: n,
3572
+ offset: s,
3573
+ style: i,
3574
+ zIndex: o,
3575
+ animation: a,
3576
+ fitToContent: u,
3577
+ onIframeLoad: f,
3578
+ onWidgetReady: l
3579
+ }
3580
+ )
3581
+ ] });
3582
+ };
3583
+ function $e(t, e) {
3584
+ if (!t?.contentWindow) {
3585
+ console.warn("[Widget] Cannot send message: iframe not ready");
3586
+ return;
3587
+ }
3588
+ const n = {
3589
+ type: "widget-message",
3590
+ payload: e
3591
+ }, s = Ra(t);
3592
+ t.contentWindow.postMessage(n, s);
3593
+ }
3594
+ function Ra(t) {
3595
+ try {
3596
+ return new URL(t.src).origin;
3597
+ } catch {
3598
+ return "*";
3599
+ }
3600
+ }
3601
+ function Na(t, e) {
3602
+ const n = (s) => {
3603
+ const i = t();
3604
+ if (!(!i?.contentWindow || s.source !== i.contentWindow) && s.data && typeof s.data == "object" && "type" in s.data) {
3605
+ const r = s.data;
3606
+ r.type === "widget-message" && e(r.payload);
3607
+ }
3608
+ };
3609
+ return window.addEventListener("message", n), () => {
3610
+ window.removeEventListener("message", n);
3611
+ };
3612
+ }
3613
+ var Ia = class extends HTMLElement {
3614
+ constructor(e) {
3615
+ super(), this.iframeElement = null, this.iframeReady = false, this.messageQueue = [], this.widgetContainerElement = null, this.openChangeCallbacks = [], this.isOpen = false, this.isPreloaded = false, this.messageListenerCleanup = null, this.config = e;
3616
+ }
3617
+ get isDropdownMode() {
3618
+ return !!this.config.anchorElement;
3619
+ }
3620
+ /**
3621
+ * Called when element is added to DOM
3622
+ */
3623
+ connectedCallback() {
3624
+ const e = this.attachShadow({ mode: "open" }), n = document.createElement("div");
3625
+ e.appendChild(n), this.setupMessageListener(), this.renderComponent(n);
3626
+ }
3627
+ /**
3628
+ * Render the Preact component
3629
+ */
3630
+ renderComponent(e) {
3631
+ ga(
3632
+ js(Oa, {
3633
+ source: this.config.source,
3634
+ position: this.config.position || (this.isDropdownMode ? "s" : "center"),
3635
+ anchorElement: this.config.anchorElement,
3636
+ offset: this.config.offset ?? 8,
3637
+ style: this.config.style,
3638
+ overlay: this.config.overlay ?? !this.isDropdownMode,
3639
+ zIndex: this.config.zIndex || 999999,
3640
+ animation: this.config.animation || "slide-spring",
3641
+ closeOnClickOutside: this.config.closeOnClickOutside ?? this.isDropdownMode,
3642
+ fitToContent: this.config.fitToContent ?? false,
3643
+ isOpen: this.isOpen,
3644
+ isPreloaded: this.isPreloaded,
3645
+ onIframeLoad: (n) => {
3646
+ this.iframeElement = n, this.iframeReady = true, this.sendInitialState(n), this.flushMessageQueue();
3647
+ },
3648
+ onWidgetReady: (n) => {
3649
+ this.widgetContainerElement = n;
3650
+ },
3651
+ onOpenChange: (n) => {
3652
+ this.isOpen = n, this.updateComponent();
3653
+ for (const s of this.openChangeCallbacks)
3654
+ s(n);
3655
+ }
3656
+ }),
3657
+ e
3658
+ );
3659
+ }
3660
+ open() {
3661
+ this.isOpen = true, this.updateComponent();
3662
+ for (const e of this.openChangeCallbacks)
3663
+ e(true);
3664
+ }
3665
+ close() {
3666
+ console.log("[Widget] close() called"), this.isOpen = false, this.updateComponent();
3667
+ for (const e of this.openChangeCallbacks)
3668
+ e(false);
3669
+ }
3670
+ preload() {
3671
+ this.isPreloaded = true, this.updateComponent();
3672
+ }
3673
+ updateComponent() {
3674
+ const e = this.shadowRoot?.querySelector("div");
3675
+ e && this.renderComponent(e);
3676
+ }
3677
+ sendInitialState(e) {
3678
+ this.config.initialState && setTimeout(() => {
3679
+ $e(e, {
3680
+ type: "INIT_STATE",
3681
+ payload: this.config.initialState
3682
+ });
3683
+ }, 100);
3684
+ }
3685
+ flushMessageQueue() {
3686
+ if (!(!this.iframeReady || !this.iframeElement)) {
3687
+ for (const e of this.messageQueue)
3688
+ $e(this.iframeElement, e);
3689
+ this.messageQueue = [];
3690
+ }
3691
+ }
3692
+ setupMessageListener() {
3693
+ this.messageListenerCleanup && this.messageListenerCleanup(), this.messageListenerCleanup = Na(
3694
+ () => this.iframeElement,
3695
+ (e) => {
3696
+ if (typeof e == "object" && e !== null) {
3697
+ const n = e;
3698
+ if (n.type === "CLOSE_WIDGET") {
3699
+ this.close();
3700
+ return;
3701
+ }
3702
+ if (this.config.onMessage && n.type) {
3703
+ const s = { close: () => this.close() };
3704
+ this.config.onMessage(n.type, n, s);
3705
+ }
3706
+ }
3707
+ }
3708
+ );
3709
+ }
3710
+ disconnectedCallback() {
3711
+ this.messageListenerCleanup && this.messageListenerCleanup();
3712
+ }
3713
+ setSource(e) {
3714
+ this.config.source = e, this.iframeElement && (this.iframeElement.src = e);
3715
+ }
3716
+ /**
3717
+ * Send a message to the iframe
3718
+ * Messages are queued if iframe is not ready yet
3719
+ */
3720
+ sendMessage(e) {
3721
+ this.iframeReady && this.iframeElement ? $e(this.iframeElement, e) : this.messageQueue.push(e);
3722
+ }
3723
+ async setStyle(e, n) {
3724
+ if (!this.widgetContainerElement) {
3725
+ console.warn("[Widget] Widget element not ready yet");
3726
+ return;
3727
+ }
3728
+ await Ze(this.widgetContainerElement, e, {
3729
+ duration: n?.duration ?? 0.3,
3730
+ ease: n?.easing ?? "ease-out"
3731
+ }).finished;
3732
+ }
3733
+ async setPosition(e, n) {
3734
+ if (!this.widgetContainerElement) {
3735
+ console.warn("[Widget] Widget element not ready yet");
3736
+ return;
3737
+ }
3738
+ this.config.position = e;
3739
+ const s = this.widgetContainerElement.getBoundingClientRect(), o = (this.config.animation || "slide-spring").includes("spring") ? {
3740
+ type: "spring",
3741
+ stiffness: n?.duration ? 1 / n.duration * 100 : 250,
3742
+ damping: 25,
3743
+ mass: 0.8
3744
+ } : {
3745
+ duration: n?.duration ?? 0.25,
3746
+ easing: n?.easing ?? "ease-out"
3747
+ };
3748
+ if (this.isDropdownMode && this.config.anchorElement) {
3749
+ const a = ti(
3750
+ this.config.anchorElement,
3751
+ { width: s.width, height: s.height },
3752
+ e,
3753
+ this.config.offset ?? 8
3754
+ );
3755
+ await Ze(
3756
+ this.widgetContainerElement,
3757
+ { top: `${a.top}px`, left: `${a.left}px` },
3758
+ o
3759
+ ).finished;
3760
+ } else {
3761
+ const a = s.left, c = s.top, u = s.width, f = s.height, l = 20;
3762
+ let h = 0, d = 0;
3763
+ switch (e) {
3764
+ case "center":
3765
+ h = (window.innerWidth - u) / 2, d = (window.innerHeight - f) / 2;
3766
+ break;
3767
+ case "n":
3768
+ h = (window.innerWidth - u) / 2, d = l;
3769
+ break;
3770
+ case "s":
3771
+ h = (window.innerWidth - u) / 2, d = window.innerHeight - f - l;
3772
+ break;
3773
+ case "e":
3774
+ h = window.innerWidth - u - l, d = (window.innerHeight - f) / 2;
3775
+ break;
3776
+ case "w":
3777
+ h = l, d = (window.innerHeight - f) / 2;
3778
+ break;
3779
+ case "ne":
3780
+ h = window.innerWidth - u - l, d = l;
3781
+ break;
3782
+ case "nw":
3783
+ h = l, d = l;
3784
+ break;
3785
+ case "se":
3786
+ h = window.innerWidth - u - l, d = window.innerHeight - f - l;
3787
+ break;
3788
+ case "sw":
3789
+ h = l, d = window.innerHeight - f - l;
3790
+ break;
3791
+ }
3792
+ const m = this.widgetContainerElement.style.transition;
3793
+ this.widgetContainerElement.style.transition = "none", this.widgetContainerElement.style.left = `${a}px`, this.widgetContainerElement.style.top = `${c}px`, this.widgetContainerElement.style.right = "auto", this.widgetContainerElement.style.bottom = "auto", this.widgetContainerElement.style.transform = "none", this.widgetContainerElement.offsetHeight, this.widgetContainerElement.style.transition = m, await Ze(
3794
+ this.widgetContainerElement,
3795
+ { left: `${h}px`, top: `${d}px` },
3796
+ o
3797
+ ).finished;
3798
+ }
3799
+ }
3800
+ updateInitialState(e) {
3801
+ this.config.initialState = { ...this.config.initialState, ...e }, this.iframeElement && $e(this.iframeElement, {
3802
+ type: "UPDATE_STATE",
3803
+ payload: e
3804
+ });
3805
+ }
3806
+ getIframe() {
3807
+ return this.iframeElement;
3808
+ }
3809
+ onOpenChange(e) {
3810
+ this.openChangeCallbacks.push(e);
3811
+ }
3812
+ };
3813
+ function Wa(t) {
3814
+ if (t) {
3815
+ if (typeof t == "string") {
3816
+ const e = document.querySelector(t);
3817
+ if (!e)
3818
+ throw new Error(`[createWidget] Anchor element not found: ${t}`);
3819
+ return e;
3820
+ }
3821
+ return t;
3822
+ }
3823
+ }
3824
+ function Ba(t) {
3825
+ const { elementName: e, anchor: n, ...s } = t, i = Wa(n);
3826
+ customElements.get(e) || customElements.define(
3827
+ e,
3828
+ class extends Ia {
3829
+ constructor() {
3830
+ super({
3831
+ ...s,
3832
+ anchorElement: i
3833
+ });
3834
+ }
3835
+ }
3836
+ );
3837
+ const r = document.createElement(e);
3838
+ return document.body.appendChild(r), {
3839
+ open() {
3840
+ r.open();
3841
+ },
3842
+ close() {
3843
+ r.close();
3844
+ },
3845
+ preload() {
3846
+ r.preload();
3847
+ },
3848
+ setSource(o) {
3849
+ r.setSource(o);
3850
+ },
3851
+ async setStyle(o, a) {
3852
+ return r.setStyle(o, a);
3853
+ },
3854
+ async setPosition(o, a) {
3855
+ return r.setPosition(o, a);
3856
+ },
3857
+ updateInitialState(o) {
3858
+ r.updateInitialState(o);
3859
+ },
3860
+ sendMessage(o) {
3861
+ r.sendMessage(o);
3862
+ },
3863
+ onOpenChange(o) {
3864
+ r.onOpenChange(o);
3865
+ },
3866
+ destroy() {
3867
+ r.remove();
3868
+ }
3869
+ };
3870
+ }
3871
+
3872
+ // src/changelog-entry.ts
3873
+ var CACHE_DURATION_MS = 5 * 60 * 1e3;
3874
+ var STORAGE_KEY = "squelette_banner_last_ticket";
3875
+ var DEFAULT_BASE = "https://www.squelette.app";
3876
+ function getEnableCache(debug) {
3877
+ if (debug === true) return false;
3878
+ try {
3879
+ const userPreference = localStorage.getItem("squelette-enable-cache");
3880
+ if (userPreference === "false") return false;
3881
+ return true;
3882
+ } catch {
3883
+ return true;
3884
+ }
3885
+ }
3886
+ async function fetchLastChangelogTicket(base, slug, debug) {
3887
+ try {
3888
+ const enableCache = getEnableCache(debug);
3889
+ if (enableCache) {
3890
+ const cacheKey = `squelette_banner_cache_${slug}`;
3891
+ const cached = localStorage.getItem(cacheKey);
3892
+ if (cached) {
3893
+ const { ticket: ticket2, timestamp } = JSON.parse(cached);
3894
+ const isExpired = Date.now() - timestamp > CACHE_DURATION_MS;
3895
+ if (!isExpired) {
3896
+ return ticket2;
3897
+ }
3898
+ }
3899
+ }
3900
+ const url = `${base}/api/public/w/${slug}/changelog/last`;
3901
+ const response = await fetch(url);
3902
+ const json = await response.json();
3903
+ const ticket = json?.ticket ?? null;
3904
+ if (enableCache && ticket) {
3905
+ const cacheKey = `squelette_banner_cache_${slug}`;
3906
+ const cachedData = {
3907
+ ticket,
3908
+ timestamp: Date.now()
3909
+ };
3910
+ localStorage.setItem(cacheKey, JSON.stringify(cachedData));
3911
+ }
3912
+ return ticket;
3913
+ } catch (e) {
3914
+ console.error("[SqueletteBanner] Error fetching changelog ticket:", e);
3915
+ return null;
3916
+ }
3917
+ }
3918
+ function shouldShowBanner(ticket, debug) {
3919
+ const lastSeenCreatedAt = localStorage.getItem(STORAGE_KEY);
3920
+ return !getEnableCache(debug) || !lastSeenCreatedAt || new Date(ticket.created_at) > new Date(lastSeenCreatedAt);
3921
+ }
3922
+ function markTicketAsSeen(ticket) {
3923
+ localStorage.setItem(STORAGE_KEY, ticket.created_at);
3924
+ }
3925
+ function withTheme(widget) {
3926
+ return {
3927
+ ...widget,
3928
+ setTheme(theme) {
3929
+ const message = {
3930
+ type: "THEME_UPDATE",
3931
+ payload: { theme }
3932
+ };
3933
+ widget.sendMessage(message);
3934
+ }
3935
+ };
3936
+ }
3937
+ function createChangelogStore() {
3938
+ const widgets = {};
3939
+ return {
3940
+ getState: () => widgets,
3941
+ mount: async (source, widget) => {
3942
+ widgets[source] = widget;
3943
+ widget.preload();
3944
+ },
3945
+ open: async (source) => {
3946
+ const widget = widgets[source];
3947
+ if (widget) {
3948
+ widget.open();
3949
+ }
3950
+ },
3951
+ unmount: (source) => {
3952
+ const widget = widgets[source];
3953
+ if (widget) {
3954
+ widget.destroy();
3955
+ delete widgets[source];
3956
+ }
3957
+ },
3958
+ setTheme: (theme) => {
3959
+ for (const widget of Object.values(widgets)) {
3960
+ widget.setTheme(theme);
3961
+ }
3962
+ }
3963
+ };
3964
+ }
3965
+ function createChangelogEntryWidget(ticketId, options = {}) {
3966
+ const { base = DEFAULT_BASE, contentTheme = "light", slug = "squelette" } = options;
3967
+ const widget = Ba({
3968
+ elementName: "sq-changelog-entry-widget",
3969
+ source: `${base}/widget/${contentTheme}/${slug}/changelog/${ticketId}`,
3970
+ position: "center",
3971
+ overlay: true
3972
+ });
3973
+ return withTheme(widget);
3974
+ }
3975
+ async function createChangelogBannerWidget(store, options) {
3976
+ const { base = DEFAULT_BASE, contentTheme = "light", slug, debug = false } = options;
3977
+ const ticket = await fetchLastChangelogTicket(base, slug, debug);
3978
+ if (!ticket) {
3979
+ return null;
3980
+ }
3981
+ const shouldRender = shouldShowBanner(ticket, debug);
3982
+ if (!shouldRender) {
3983
+ return null;
3984
+ }
3985
+ const ticketId = String(ticket.id);
3986
+ store.mount(ticketId, createChangelogEntryWidget(ticketId, { base, contentTheme, slug }));
3987
+ const widget = Ba({
3988
+ elementName: "sq-changelog-banner-widget",
3989
+ source: `${base}/widget/${contentTheme}/${slug}/changelog/${ticketId}/banner`,
3990
+ position: "s",
3991
+ overlay: false,
3992
+ fitToContent: true,
3993
+ style: {
3994
+ borderRadius: 32,
3995
+ height: 32
3996
+ },
3997
+ onMessage: (type, message, actions) => {
3998
+ if (type === "OPEN_WIDGET") {
3999
+ widget.open();
4000
+ }
4001
+ if (type === "OPEN_CHANGELOG_ENTRY") {
4002
+ const id = message.payload.ticketId;
4003
+ actions.close();
4004
+ store.open(id);
4005
+ }
4006
+ }
4007
+ });
4008
+ widget.onOpenChange((isOpen) => {
4009
+ if (!isOpen) {
4010
+ markTicketAsSeen(ticket);
4011
+ }
4012
+ });
4013
+ widget.preload();
4014
+ return withTheme(widget);
4015
+ }
4016
+ function createChangelogEntriesListDropdownWidget(anchor, store, options = {}) {
4017
+ const { base = DEFAULT_BASE, contentTheme = "light", slug = "squelette", position = "nw" } = options;
4018
+ const widget = Ba({
4019
+ elementName: "sq-changelog-entries-list-dropdown-widget",
4020
+ source: `${base}/widget/${contentTheme}/${slug}/changelog/list`,
4021
+ position,
4022
+ anchor,
4023
+ fitToContent: true,
4024
+ onMessage: (type, message, actions) => {
4025
+ if (type === "PRELOAD_CHANGELOG_ENTRIES") {
4026
+ const ids = message.payload.ids;
4027
+ for (const id of ids) {
4028
+ store.mount(
4029
+ id,
4030
+ createChangelogEntryWidget(id, { base, contentTheme, slug })
4031
+ );
4032
+ }
4033
+ }
4034
+ if (type === "OPEN_CHANGELOG_ENTRY") {
4035
+ const ticketId = message.payload.ticketId;
4036
+ actions.close();
4037
+ store.open(ticketId);
4038
+ }
4039
+ }
4040
+ });
4041
+ return withTheme(widget);
4042
+ }
4043
+ function clearBannerCache(slug) {
4044
+ try {
4045
+ localStorage.removeItem(`squelette_banner_cache_${slug}`);
4046
+ localStorage.removeItem(STORAGE_KEY);
4047
+ } catch {
4048
+ }
4049
+ }
4050
+ export {
4051
+ clearBannerCache,
4052
+ createChangelogBannerWidget,
4053
+ createChangelogEntriesListDropdownWidget,
4054
+ createChangelogEntryWidget,
4055
+ createChangelogStore
4056
+ };
4057
+ //# sourceMappingURL=index.js.map