@verba-ai/chat-sdk 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,2891 @@
1
- const l = "verba-chat-sdk-styles", a = "verba-widget-container", n = "verba-widget-iframe", s = "verba-widget-bubble", b = "verba-widget-bubble--open";
2
- function d() {
3
- if (document.getElementById(l)) return;
4
- const i = `
1
+ function as(e, t) {
2
+ e.indexOf(t) === -1 && e.push(t);
3
+ }
4
+ function Qt(e, t) {
5
+ const n = e.indexOf(t);
6
+ n > -1 && e.splice(n, 1);
7
+ }
8
+ const Y = (e, t, n) => n > t ? t : n < e ? e : n;
9
+ let te = () => {
10
+ };
11
+ const _ = {}, Je = (e) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);
12
+ function os(e) {
13
+ return typeof e == "object" && e !== null;
14
+ }
15
+ const Qe = (e) => /^0[^.\s]+$/u.test(e);
16
+ // @__NO_SIDE_EFFECTS__
17
+ function tn(e) {
18
+ let t;
19
+ return () => (t === void 0 && (t = e()), t);
20
+ }
21
+ const it = /* @__NO_SIDE_EFFECTS__ */ (e) => e, ls = (e, t) => (n) => t(e(n)), ee = (...e) => e.reduce(ls), ne = /* @__NO_SIDE_EFFECTS__ */ (e, t, n) => {
22
+ const s = t - e;
23
+ return s === 0 ? 1 : (n - e) / s;
24
+ };
25
+ class en {
26
+ constructor() {
27
+ this.subscriptions = [];
28
+ }
29
+ add(t) {
30
+ return as(this.subscriptions, t), () => Qt(this.subscriptions, t);
31
+ }
32
+ notify(t, n, s) {
33
+ const i = this.subscriptions.length;
34
+ if (i)
35
+ if (i === 1)
36
+ this.subscriptions[0](t, n, s);
37
+ else
38
+ for (let r = 0; r < i; r++) {
39
+ const a = this.subscriptions[r];
40
+ a && a(t, n, s);
41
+ }
42
+ }
43
+ getSize() {
44
+ return this.subscriptions.length;
45
+ }
46
+ clear() {
47
+ this.subscriptions.length = 0;
48
+ }
49
+ }
50
+ const P = /* @__NO_SIDE_EFFECTS__ */ (e) => e * 1e3, B = /* @__NO_SIDE_EFFECTS__ */ (e) => e / 1e3;
51
+ function nn(e, t) {
52
+ return t ? e * (1e3 / t) : 0;
53
+ }
54
+ const us = (e, t, n) => {
55
+ const s = t - e;
56
+ return ((n - e) % s + s) % s + e;
57
+ }, sn = (e, t, n) => (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e, cs = 1e-7, hs = 12;
58
+ function fs(e, t, n, s, i) {
59
+ let r, a, o = 0;
60
+ do
61
+ a = t + (n - t) / 2, r = sn(a, s, i) - e, r > 0 ? n = a : t = a;
62
+ while (Math.abs(r) > cs && ++o < hs);
63
+ return a;
64
+ }
65
+ function Tt(e, t, n, s) {
66
+ if (e === t && n === s)
67
+ return it;
68
+ const i = (r) => fs(r, 0, 1, e, n);
69
+ return (r) => r === 0 || r === 1 ? r : sn(i(r), t, s);
70
+ }
71
+ const rn = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, an = (e) => (t) => 1 - e(1 - t), on = /* @__PURE__ */ Tt(0.33, 1.53, 0.69, 0.99), se = /* @__PURE__ */ an(on), ln = /* @__PURE__ */ rn(se), un = (e) => (e *= 2) < 1 ? 0.5 * se(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), ie = (e) => 1 - Math.sin(Math.acos(e)), ds = an(ie), cn = rn(ie), ps = /* @__PURE__ */ Tt(0.42, 0, 1, 1), ms = /* @__PURE__ */ Tt(0, 0, 0.58, 1), hn = /* @__PURE__ */ Tt(0.42, 0, 0.58, 1), fn = (e) => Array.isArray(e) && typeof e[0] != "number";
72
+ function dn(e, t) {
73
+ return fn(e) ? e[us(0, e.length, t)] : e;
74
+ }
75
+ const pn = (e) => Array.isArray(e) && typeof e[0] == "number", gs = {
76
+ linear: it,
77
+ easeIn: ps,
78
+ easeInOut: hn,
79
+ easeOut: ms,
80
+ circIn: ie,
81
+ circInOut: cn,
82
+ circOut: ds,
83
+ backIn: se,
84
+ backInOut: ln,
85
+ backOut: on,
86
+ anticipate: un
87
+ }, ys = (e) => typeof e == "string", Ae = (e) => {
88
+ if (pn(e)) {
89
+ te(e.length === 4);
90
+ const [t, n, s, i] = e;
91
+ return Tt(t, n, s, i);
92
+ } else if (ys(e))
93
+ return gs[e];
94
+ return e;
95
+ }, wt = [
96
+ "setup",
97
+ // Compute
98
+ "read",
99
+ // Read
100
+ "resolveKeyframes",
101
+ // Write/Read/Write/Read
102
+ "preUpdate",
103
+ // Compute
104
+ "update",
105
+ // Compute
106
+ "preRender",
107
+ // Compute
108
+ "render",
109
+ // Write
110
+ "postRender"
111
+ // Compute
112
+ ];
113
+ function bs(e, t) {
114
+ let n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = !1, r = !1;
115
+ const a = /* @__PURE__ */ new WeakSet();
116
+ let o = {
117
+ delta: 0,
118
+ timestamp: 0,
119
+ isProcessing: !1
120
+ };
121
+ function u(l) {
122
+ a.has(l) && (c.schedule(l), e()), l(o);
123
+ }
124
+ const c = {
125
+ /**
126
+ * Schedule a process to run on the next frame.
127
+ */
128
+ schedule: (l, h = !1, f = !1) => {
129
+ const b = f && i ? n : s;
130
+ return h && a.add(l), b.has(l) || b.add(l), l;
131
+ },
132
+ /**
133
+ * Cancel the provided callback from running on the next frame.
134
+ */
135
+ cancel: (l) => {
136
+ s.delete(l), a.delete(l);
137
+ },
138
+ /**
139
+ * Execute all schedule callbacks.
140
+ */
141
+ process: (l) => {
142
+ if (o = l, i) {
143
+ r = !0;
144
+ return;
145
+ }
146
+ i = !0, [n, s] = [s, n], n.forEach(u), n.clear(), i = !1, r && (r = !1, c.process(l));
147
+ }
148
+ };
149
+ return c;
150
+ }
151
+ const vs = 40;
152
+ function mn(e, t) {
153
+ let n = !1, s = !0;
154
+ const i = {
155
+ delta: 0,
156
+ timestamp: 0,
157
+ isProcessing: !1
158
+ }, r = () => n = !0, a = wt.reduce((V, S) => (V[S] = bs(r), V), {}), { setup: o, read: u, resolveKeyframes: c, preUpdate: l, update: h, preRender: f, render: g, postRender: b } = a, p = () => {
159
+ const V = _.useManualTiming ? i.timestamp : performance.now();
160
+ n = !1, _.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(V - i.timestamp, vs), 1)), i.timestamp = V, i.isProcessing = !0, o.process(i), u.process(i), c.process(i), l.process(i), h.process(i), f.process(i), g.process(i), b.process(i), i.isProcessing = !1, n && t && (s = !1, e(p));
161
+ }, v = () => {
162
+ n = !0, s = !0, i.isProcessing || e(p);
163
+ };
164
+ return { schedule: wt.reduce((V, S) => {
165
+ const x = a[S];
166
+ return V[S] = (C, E = !1, T = !1) => (n || v(), x.schedule(C, E, T)), V;
167
+ }, {}), cancel: (V) => {
168
+ for (let S = 0; S < wt.length; S++)
169
+ a[wt[S]].cancel(V);
170
+ }, state: i, steps: a };
171
+ }
172
+ const { schedule: j, cancel: Nt, state: Ct } = /* @__PURE__ */ mn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : it, !0);
173
+ let Mt;
174
+ function Ts() {
175
+ Mt = void 0;
176
+ }
177
+ const I = {
178
+ now: () => (Mt === void 0 && I.set(Ct.isProcessing || _.useManualTiming ? Ct.timestamp : performance.now()), Mt),
179
+ set: (e) => {
180
+ Mt = e, queueMicrotask(Ts);
181
+ }
182
+ }, gn = (e) => (t) => typeof t == "string" && t.startsWith(e), yn = /* @__PURE__ */ gn("--"), xs = /* @__PURE__ */ gn("var(--"), re = (e) => xs(e) ? Ss.test(e.split("/*")[0].trim()) : !1, Ss = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
183
+ function Me(e) {
184
+ return typeof e != "string" ? !1 : e.split("/*")[0].includes("var(--");
185
+ }
186
+ const rt = {
187
+ test: (e) => typeof e == "number",
188
+ parse: parseFloat,
189
+ transform: (e) => e
190
+ }, yt = {
191
+ ...rt,
192
+ transform: (e) => Y(0, 1, e)
193
+ }, At = {
194
+ ...rt,
195
+ default: 1
196
+ }, mt = (e) => Math.round(e * 1e5) / 1e5, ae = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
197
+ function Vs(e) {
198
+ return e == null;
199
+ }
200
+ const ws = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, oe = (e, t) => (n) => !!(typeof n == "string" && ws.test(n) && n.startsWith(e) || t && !Vs(n) && Object.prototype.hasOwnProperty.call(n, t)), bn = (e, t, n) => (s) => {
201
+ if (typeof s != "string")
202
+ return s;
203
+ const [i, r, a, o] = s.match(ae);
204
+ return {
205
+ [e]: parseFloat(i),
206
+ [t]: parseFloat(r),
207
+ [n]: parseFloat(a),
208
+ alpha: o !== void 0 ? parseFloat(o) : 1
209
+ };
210
+ }, As = (e) => Y(0, 255, e), Et = {
211
+ ...rt,
212
+ transform: (e) => Math.round(As(e))
213
+ }, H = {
214
+ test: /* @__PURE__ */ oe("rgb", "red"),
215
+ parse: /* @__PURE__ */ bn("red", "green", "blue"),
216
+ transform: ({ red: e, green: t, blue: n, alpha: s = 1 }) => "rgba(" + Et.transform(e) + ", " + Et.transform(t) + ", " + Et.transform(n) + ", " + mt(yt.transform(s)) + ")"
217
+ };
218
+ function Ms(e) {
219
+ let t = "", n = "", s = "", i = "";
220
+ return e.length > 5 ? (t = e.substring(1, 3), n = e.substring(3, 5), s = e.substring(5, 7), i = e.substring(7, 9)) : (t = e.substring(1, 2), n = e.substring(2, 3), s = e.substring(3, 4), i = e.substring(4, 5), t += t, n += n, s += s, i += i), {
221
+ red: parseInt(t, 16),
222
+ green: parseInt(n, 16),
223
+ blue: parseInt(s, 16),
224
+ alpha: i ? parseInt(i, 16) / 255 : 1
225
+ };
226
+ }
227
+ const Ot = {
228
+ test: /* @__PURE__ */ oe("#"),
229
+ parse: Ms,
230
+ transform: H.transform
231
+ }, xt = /* @__NO_SIDE_EFFECTS__ */ (e) => ({
232
+ test: (t) => typeof t == "string" && t.endsWith(e) && t.split(" ").length === 1,
233
+ parse: parseFloat,
234
+ transform: (t) => `${t}${e}`
235
+ }), G = /* @__PURE__ */ xt("deg"), et = /* @__PURE__ */ xt("%"), d = /* @__PURE__ */ xt("px"), Cs = /* @__PURE__ */ xt("vh"), Fs = /* @__PURE__ */ xt("vw"), Ce = {
236
+ ...et,
237
+ parse: (e) => et.parse(e) / 100,
238
+ transform: (e) => et.transform(e * 100)
239
+ }, tt = {
240
+ test: /* @__PURE__ */ oe("hsl", "hue"),
241
+ parse: /* @__PURE__ */ bn("hue", "saturation", "lightness"),
242
+ transform: ({ hue: e, saturation: t, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(e) + ", " + et.transform(mt(t)) + ", " + et.transform(mt(n)) + ", " + mt(yt.transform(s)) + ")"
243
+ }, D = {
244
+ test: (e) => H.test(e) || Ot.test(e) || tt.test(e),
245
+ parse: (e) => H.test(e) ? H.parse(e) : tt.test(e) ? tt.parse(e) : Ot.parse(e),
246
+ transform: (e) => typeof e == "string" ? e : e.hasOwnProperty("red") ? H.transform(e) : tt.transform(e),
247
+ getAnimatableNone: (e) => {
248
+ const t = D.parse(e);
249
+ return t.alpha = 0, D.transform(t);
250
+ }
251
+ }, Ds = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
252
+ function Es(e) {
253
+ return isNaN(e) && typeof e == "string" && (e.match(ae)?.length || 0) + (e.match(Ds)?.length || 0) > 0;
254
+ }
255
+ const vn = "number", Tn = "color", ks = "var", Is = "var(", Fe = "${}", Rs = /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;
256
+ function nt(e) {
257
+ const t = e.toString(), n = [], s = {
258
+ color: [],
259
+ number: [],
260
+ var: []
261
+ }, i = [];
262
+ let r = 0;
263
+ const o = t.replace(Rs, (u) => (D.test(u) ? (s.color.push(r), i.push(Tn), n.push(D.parse(u))) : u.startsWith(Is) ? (s.var.push(r), i.push(ks), n.push(u)) : (s.number.push(r), i.push(vn), n.push(parseFloat(u))), ++r, Fe)).split(Fe);
264
+ return { values: n, split: o, indexes: s, types: i };
265
+ }
266
+ function Ps(e) {
267
+ return nt(e).values;
268
+ }
269
+ function xn({ split: e, types: t }) {
270
+ const n = e.length;
271
+ return (s) => {
272
+ let i = "";
273
+ for (let r = 0; r < n; r++)
274
+ if (i += e[r], s[r] !== void 0) {
275
+ const a = t[r];
276
+ a === vn ? i += mt(s[r]) : a === Tn ? i += D.transform(s[r]) : i += s[r];
277
+ }
278
+ return i;
279
+ };
280
+ }
281
+ function Bs(e) {
282
+ return xn(nt(e));
283
+ }
284
+ const Ns = (e) => typeof e == "number" ? 0 : D.test(e) ? D.getAnimatableNone(e) : e, Os = (e, t) => typeof e == "number" ? t?.trim().endsWith("/") ? e : 0 : Ns(e);
285
+ function Ks(e) {
286
+ const t = nt(e);
287
+ return xn(t)(t.values.map((s, i) => Os(s, t.split[i])));
288
+ }
289
+ const N = {
290
+ test: Es,
291
+ parse: Ps,
292
+ createTransformer: Bs,
293
+ getAnimatableNone: Ks
294
+ };
295
+ function kt(e, t, n) {
296
+ return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
297
+ }
298
+ function $s({ hue: e, saturation: t, lightness: n, alpha: s }) {
299
+ e /= 360, t /= 100, n /= 100;
300
+ let i = 0, r = 0, a = 0;
301
+ if (!t)
302
+ i = r = a = n;
303
+ else {
304
+ const o = n < 0.5 ? n * (1 + t) : n + t - n * t, u = 2 * n - o;
305
+ i = kt(u, o, e + 1 / 3), r = kt(u, o, e), a = kt(u, o, e - 1 / 3);
306
+ }
307
+ return {
308
+ red: Math.round(i * 255),
309
+ green: Math.round(r * 255),
310
+ blue: Math.round(a * 255),
311
+ alpha: s
312
+ };
313
+ }
314
+ function Ft(e, t) {
315
+ return (n) => n > 0 ? t : e;
316
+ }
317
+ const at = (e, t, n) => e + (t - e) * n, It = (e, t, n) => {
318
+ const s = e * e, i = n * (t * t - s) + s;
319
+ return i < 0 ? 0 : Math.sqrt(i);
320
+ }, Ls = [Ot, H, tt], Ws = (e) => Ls.find((t) => t.test(e));
321
+ function De(e) {
322
+ const t = Ws(e);
323
+ if (!t)
324
+ return !1;
325
+ let n = t.parse(e);
326
+ return t === tt && (n = $s(n)), n;
327
+ }
328
+ const Ee = (e, t) => {
329
+ const n = De(e), s = De(t);
330
+ if (!n || !s)
331
+ return Ft(e, t);
332
+ const i = { ...n };
333
+ return (r) => (i.red = It(n.red, s.red, r), i.green = It(n.green, s.green, r), i.blue = It(n.blue, s.blue, r), i.alpha = at(n.alpha, s.alpha, r), H.transform(i));
334
+ }, Kt = /* @__PURE__ */ new Set(["none", "hidden"]);
335
+ function _s(e, t) {
336
+ return Kt.has(e) ? (n) => n <= 0 ? e : t : (n) => n >= 1 ? t : e;
337
+ }
338
+ function js(e, t) {
339
+ return (n) => at(e, t, n);
340
+ }
341
+ function le(e) {
342
+ return typeof e == "number" ? js : typeof e == "string" ? re(e) ? Ft : D.test(e) ? Ee : zs : Array.isArray(e) ? Sn : typeof e == "object" ? D.test(e) ? Ee : Us : Ft;
343
+ }
344
+ function Sn(e, t) {
345
+ const n = [...e], s = n.length, i = e.map((r, a) => le(r)(r, t[a]));
346
+ return (r) => {
347
+ for (let a = 0; a < s; a++)
348
+ n[a] = i[a](r);
349
+ return n;
350
+ };
351
+ }
352
+ function Us(e, t) {
353
+ const n = { ...e, ...t }, s = {};
354
+ for (const i in n)
355
+ e[i] !== void 0 && t[i] !== void 0 && (s[i] = le(e[i])(e[i], t[i]));
356
+ return (i) => {
357
+ for (const r in s)
358
+ n[r] = s[r](i);
359
+ return n;
360
+ };
361
+ }
362
+ function Gs(e, t) {
363
+ const n = [], s = { color: 0, var: 0, number: 0 };
364
+ for (let i = 0; i < t.values.length; i++) {
365
+ const r = t.types[i], a = e.indexes[r][s[r]], o = e.values[a] ?? 0;
366
+ n[i] = o, s[r]++;
367
+ }
368
+ return n;
369
+ }
370
+ const zs = (e, t) => {
371
+ const n = N.createTransformer(t), s = nt(e), i = nt(t);
372
+ 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 ? Kt.has(e) && !i.values.length || Kt.has(t) && !s.values.length ? _s(e, t) : ee(Sn(Gs(s, i), i.values), n) : Ft(e, t);
373
+ };
374
+ function Vn(e, t, n) {
375
+ return typeof e == "number" && typeof t == "number" && typeof n == "number" ? at(e, t, n) : le(e)(e, t);
376
+ }
377
+ const Ys = (e) => {
378
+ const t = ({ timestamp: n }) => e(n);
379
+ return {
380
+ start: (n = !0) => j.update(t, n),
381
+ stop: () => Nt(t),
382
+ /**
383
+ * If we're processing this frame we can use the
384
+ * framelocked timestamp to keep things in sync.
385
+ */
386
+ now: () => Ct.isProcessing ? Ct.timestamp : I.now()
387
+ };
388
+ }, wn = (e, t, n = 10) => {
389
+ let s = "";
390
+ const i = Math.max(Math.round(t / n), 2);
391
+ for (let r = 0; r < i; r++)
392
+ s += Math.round(e(r / (i - 1)) * 1e4) / 1e4 + ", ";
393
+ return `linear(${s.substring(0, s.length - 2)})`;
394
+ }, Dt = 2e4;
395
+ function ue(e) {
396
+ let t = 0;
397
+ const n = 50;
398
+ let s = e.next(t);
399
+ for (; !s.done && t < Dt; )
400
+ t += n, s = e.next(t);
401
+ return t >= Dt ? 1 / 0 : t;
402
+ }
403
+ function An(e, t = 100, n) {
404
+ const s = n({ ...e, keyframes: [0, t] }), i = Math.min(ue(s), Dt);
405
+ return {
406
+ type: "keyframes",
407
+ ease: (r) => s.next(i * r).value / t,
408
+ duration: /* @__PURE__ */ B(i)
409
+ };
410
+ }
411
+ const F = {
412
+ // Default spring physics
413
+ stiffness: 100,
414
+ damping: 10,
415
+ mass: 1,
416
+ velocity: 0,
417
+ // Default duration/bounce-based options
418
+ duration: 800,
419
+ // in ms
420
+ bounce: 0.3,
421
+ visualDuration: 0.3,
422
+ // in seconds
423
+ // Rest thresholds
424
+ restSpeed: {
425
+ granular: 0.01,
426
+ default: 2
427
+ },
428
+ restDelta: {
429
+ granular: 5e-3,
430
+ default: 0.5
431
+ },
432
+ // Limits
433
+ minDuration: 0.01,
434
+ // in seconds
435
+ maxDuration: 10,
436
+ // in seconds
437
+ minDamping: 0.05,
438
+ maxDamping: 1
439
+ };
440
+ function $t(e, t) {
441
+ return e * Math.sqrt(1 - t * t);
442
+ }
443
+ const qs = 12;
444
+ function Xs(e, t, n) {
445
+ let s = n;
446
+ for (let i = 1; i < qs; i++)
447
+ s = s - e(s) / t(s);
448
+ return s;
449
+ }
450
+ const Rt = 1e-3;
451
+ function Hs({ duration: e = F.duration, bounce: t = F.bounce, velocity: n = F.velocity, mass: s = F.mass }) {
452
+ let i, r, a = 1 - t;
453
+ a = Y(F.minDamping, F.maxDamping, a), e = Y(F.minDuration, F.maxDuration, /* @__PURE__ */ B(e)), a < 1 ? (i = (c) => {
454
+ const l = c * a, h = l * e, f = l - n, g = $t(c, a), b = Math.exp(-h);
455
+ return Rt - f / g * b;
456
+ }, r = (c) => {
457
+ const h = c * a * e, f = h * n + n, g = Math.pow(a, 2) * Math.pow(c, 2) * e, b = Math.exp(-h), p = $t(Math.pow(c, 2), a);
458
+ return (-i(c) + Rt > 0 ? -1 : 1) * ((f - g) * b) / p;
459
+ }) : (i = (c) => {
460
+ const l = Math.exp(-c * e), h = (c - n) * e + 1;
461
+ return -Rt + l * h;
462
+ }, r = (c) => {
463
+ const l = Math.exp(-c * e), h = (n - c) * (e * e);
464
+ return l * h;
465
+ });
466
+ const o = 5 / e, u = Xs(i, r, o);
467
+ if (e = /* @__PURE__ */ P(e), isNaN(u))
468
+ return {
469
+ stiffness: F.stiffness,
470
+ damping: F.damping,
471
+ duration: e
472
+ };
473
+ {
474
+ const c = Math.pow(u, 2) * s;
475
+ return {
476
+ stiffness: c,
477
+ damping: a * 2 * Math.sqrt(s * c),
478
+ duration: e
479
+ };
480
+ }
481
+ }
482
+ const Zs = ["duration", "bounce"], Js = ["stiffness", "damping", "mass"];
483
+ function ke(e, t) {
484
+ return t.some((n) => e[n] !== void 0);
485
+ }
486
+ function Qs(e) {
487
+ let t = {
488
+ velocity: F.velocity,
489
+ stiffness: F.stiffness,
490
+ damping: F.damping,
491
+ mass: F.mass,
492
+ isResolvedFromDuration: !1,
493
+ ...e
494
+ };
495
+ if (!ke(e, Js) && ke(e, Zs))
496
+ if (t.velocity = 0, e.visualDuration) {
497
+ const n = e.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * Y(0.05, 1, 1 - (e.bounce || 0)) * Math.sqrt(i);
498
+ t = {
499
+ ...t,
500
+ mass: F.mass,
501
+ stiffness: i,
502
+ damping: r
503
+ };
504
+ } else {
505
+ const n = Hs({ ...e, velocity: 0 });
506
+ t = {
507
+ ...t,
508
+ ...n,
509
+ mass: F.mass
510
+ }, t.isResolvedFromDuration = !0;
511
+ }
512
+ return t;
513
+ }
514
+ function bt(e = F.visualDuration, t = F.bounce) {
515
+ const n = typeof e != "object" ? {
516
+ visualDuration: e,
517
+ keyframes: [0, 1],
518
+ bounce: t
519
+ } : e;
520
+ let { restSpeed: s, restDelta: i } = n;
521
+ const r = n.keyframes[0], a = n.keyframes[n.keyframes.length - 1], o = { done: !1, value: r }, { stiffness: u, damping: c, mass: l, duration: h, velocity: f, isResolvedFromDuration: g } = Qs({
522
+ ...n,
523
+ velocity: -/* @__PURE__ */ B(n.velocity || 0)
524
+ }), b = f || 0, p = c / (2 * Math.sqrt(u * l)), v = a - r, y = /* @__PURE__ */ B(Math.sqrt(u / l)), M = Math.abs(v) < 5;
525
+ s || (s = M ? F.restSpeed.granular : F.restSpeed.default), i || (i = M ? F.restDelta.granular : F.restDelta.default);
526
+ let V, S, x, C, E, T;
527
+ if (p < 1)
528
+ x = $t(y, p), C = (b + p * y * v) / x, V = (m) => {
529
+ const A = Math.exp(-p * y * m);
530
+ return a - A * (C * Math.sin(x * m) + v * Math.cos(x * m));
531
+ }, E = p * y * C + v * x, T = p * y * v - C * x, S = (m) => Math.exp(-p * y * m) * (E * Math.sin(x * m) + T * Math.cos(x * m));
532
+ else if (p === 1) {
533
+ V = (A) => a - Math.exp(-y * A) * (v + (b + y * v) * A);
534
+ const m = b + y * v;
535
+ S = (A) => Math.exp(-y * A) * (y * m * A - b);
536
+ } else {
537
+ const m = y * Math.sqrt(p * p - 1);
538
+ V = (K) => {
539
+ const q = Math.exp(-p * y * K), $ = Math.min(m * K, 300);
540
+ return a - q * ((b + p * y * v) * Math.sinh($) + m * v * Math.cosh($)) / m;
541
+ };
542
+ const A = (b + p * y * v) / m, R = p * y * A - v * m, O = p * y * v - A * m;
543
+ S = (K) => {
544
+ const q = Math.exp(-p * y * K), $ = Math.min(m * K, 300);
545
+ return q * (R * Math.sinh($) + O * Math.cosh($));
546
+ };
547
+ }
548
+ const w = {
549
+ calculatedDuration: g && h || null,
550
+ velocity: (m) => /* @__PURE__ */ P(S(m)),
551
+ next: (m) => {
552
+ if (!g && p < 1) {
553
+ const R = Math.exp(-p * y * m), O = Math.sin(x * m), K = Math.cos(x * m), q = a - R * (C * O + v * K), $ = /* @__PURE__ */ P(R * (E * O + T * K));
554
+ return o.done = Math.abs($) <= s && Math.abs(a - q) <= i, o.value = o.done ? a : q, o;
555
+ }
556
+ const A = V(m);
557
+ if (g)
558
+ o.done = m >= h;
559
+ else {
560
+ const R = /* @__PURE__ */ P(S(m));
561
+ o.done = Math.abs(R) <= s && Math.abs(a - A) <= i;
562
+ }
563
+ return o.value = o.done ? a : A, o;
564
+ },
565
+ toString: () => {
566
+ const m = Math.min(ue(w), Dt), A = wn((R) => w.next(m * R).value, m, 30);
567
+ return m + "ms " + A;
568
+ },
569
+ toTransition: () => {
570
+ }
571
+ };
572
+ return w;
573
+ }
574
+ bt.applyToOptions = (e) => {
575
+ const t = An(e, 100, bt);
576
+ return e.ease = t.ease, e.duration = /* @__PURE__ */ P(t.duration), e.type = "keyframes", e;
577
+ };
578
+ const ti = 5;
579
+ function Mn(e, t, n) {
580
+ const s = Math.max(t - ti, 0);
581
+ return nn(n - e(s), t - s);
582
+ }
583
+ function Lt({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: a, min: o, max: u, restDelta: c = 0.5, restSpeed: l }) {
584
+ const h = e[0], f = {
585
+ done: !1,
586
+ value: h
587
+ }, g = (T) => o !== void 0 && T < o || u !== void 0 && T > u, b = (T) => o === void 0 ? u : u === void 0 || Math.abs(o - T) < Math.abs(u - T) ? o : u;
588
+ let p = n * t;
589
+ const v = h + p, y = a === void 0 ? v : a(v);
590
+ y !== v && (p = y - h);
591
+ const M = (T) => -p * Math.exp(-T / s), V = (T) => y + M(T), S = (T) => {
592
+ const w = M(T), m = V(T);
593
+ f.done = Math.abs(w) <= c, f.value = f.done ? y : m;
594
+ };
595
+ let x, C;
596
+ const E = (T) => {
597
+ g(f.value) && (x = T, C = bt({
598
+ keyframes: [f.value, b(f.value)],
599
+ velocity: Mn(V, T, f.value),
600
+ // TODO: This should be passing * 1000
601
+ damping: i,
602
+ stiffness: r,
603
+ restDelta: c,
604
+ restSpeed: l
605
+ }));
606
+ };
607
+ return E(0), {
608
+ calculatedDuration: null,
609
+ next: (T) => {
610
+ let w = !1;
611
+ return !C && x === void 0 && (w = !0, S(T), E(T)), x !== void 0 && T >= x ? C.next(T - x) : (!w && S(T), f);
612
+ }
613
+ };
614
+ }
615
+ function ei(e, t, n) {
616
+ const s = [], i = n || _.mix || Vn, r = e.length - 1;
617
+ for (let a = 0; a < r; a++) {
618
+ let o = i(e[a], e[a + 1]);
619
+ if (t) {
620
+ const u = Array.isArray(t) ? t[a] || it : t;
621
+ o = ee(u, o);
622
+ }
623
+ s.push(o);
624
+ }
625
+ return s;
626
+ }
627
+ function ni(e, t, { clamp: n = !0, ease: s, mixer: i } = {}) {
628
+ const r = e.length;
629
+ if (te(r === t.length), r === 1)
630
+ return () => t[0];
631
+ if (r === 2 && t[0] === t[1])
632
+ return () => t[1];
633
+ const a = e[0] === e[1];
634
+ e[0] > e[r - 1] && (e = [...e].reverse(), t = [...t].reverse());
635
+ const o = ei(t, s, i), u = o.length, c = (l) => {
636
+ if (a && l < e[0])
637
+ return t[0];
638
+ let h = 0;
639
+ if (u > 1)
640
+ for (; h < e.length - 2 && !(l < e[h + 1]); h++)
641
+ ;
642
+ const f = /* @__PURE__ */ ne(e[h], e[h + 1], l);
643
+ return o[h](f);
644
+ };
645
+ return n ? (l) => c(Y(e[0], e[r - 1], l)) : c;
646
+ }
647
+ function Cn(e, t) {
648
+ const n = e[e.length - 1];
649
+ for (let s = 1; s <= t; s++) {
650
+ const i = /* @__PURE__ */ ne(0, t, s);
651
+ e.push(at(n, 1, i));
652
+ }
653
+ }
654
+ function Fn(e) {
655
+ const t = [0];
656
+ return Cn(t, e.length - 1), t;
657
+ }
658
+ function si(e, t) {
659
+ return e.map((n) => n * t);
660
+ }
661
+ function ii(e, t) {
662
+ return e.map(() => t || hn).splice(0, e.length - 1);
663
+ }
664
+ function gt({ duration: e = 300, keyframes: t, times: n, ease: s = "easeInOut" }) {
665
+ const i = fn(s) ? s.map(Ae) : Ae(s), r = {
666
+ done: !1,
667
+ value: t[0]
668
+ }, a = si(
669
+ // Only use the provided offsets if they're the correct length
670
+ // TODO Maybe we should warn here if there's a length mismatch
671
+ n && n.length === t.length ? n : Fn(t),
672
+ e
673
+ ), o = ni(a, t, {
674
+ ease: Array.isArray(i) ? i : ii(t, i)
675
+ });
676
+ return {
677
+ calculatedDuration: e,
678
+ next: (u) => (r.value = o(u), r.done = u >= e, r)
679
+ };
680
+ }
681
+ const ri = (e) => e !== null;
682
+ function ce(e, { repeat: t, repeatType: n = "loop" }, s, i = 1) {
683
+ const r = e.filter(ri), o = i < 0 || t && n !== "loop" && t % 2 === 1 ? 0 : r.length - 1;
684
+ return !o || s === void 0 ? r[o] : s;
685
+ }
686
+ const ai = {
687
+ decay: Lt,
688
+ inertia: Lt,
689
+ tween: gt,
690
+ keyframes: gt,
691
+ spring: bt
692
+ };
693
+ function Dn(e) {
694
+ typeof e.type == "string" && (e.type = ai[e.type]);
695
+ }
696
+ class he {
697
+ constructor() {
698
+ this.updateFinished();
699
+ }
700
+ get finished() {
701
+ return this._finished;
702
+ }
703
+ updateFinished() {
704
+ this._finished = new Promise((t) => {
705
+ this.resolve = t;
706
+ });
707
+ }
708
+ notifyFinished() {
709
+ this.resolve();
710
+ }
711
+ /**
712
+ * Allows the animation to be awaited.
713
+ *
714
+ * @deprecated Use `finished` instead.
715
+ */
716
+ then(t, n) {
717
+ return this.finished.then(t, n);
718
+ }
719
+ }
720
+ const oi = (e) => e / 100;
721
+ class fe extends he {
722
+ constructor(t) {
723
+ super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
724
+ const { motionValue: n } = this.options;
725
+ n && n.updatedAt !== I.now() && this.tick(I.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
726
+ }, this.options = t, this.initAnimation(), this.play(), t.autoplay === !1 && this.pause();
727
+ }
728
+ initAnimation() {
729
+ const { options: t } = this;
730
+ Dn(t);
731
+ const { type: n = gt, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: a = 0 } = t;
732
+ let { keyframes: o } = t;
733
+ const u = n || gt;
734
+ u !== gt && typeof o[0] != "number" && (this.mixKeyframes = ee(oi, Vn(o[0], o[1])), o = [0, 100]);
735
+ const c = u({ ...t, keyframes: o });
736
+ r === "mirror" && (this.mirroredGenerator = u({
737
+ ...t,
738
+ keyframes: [...o].reverse(),
739
+ velocity: -a
740
+ })), c.calculatedDuration === null && (c.calculatedDuration = ue(c));
741
+ const { calculatedDuration: l } = c;
742
+ this.calculatedDuration = l, this.resolvedDuration = l + i, this.totalDuration = this.resolvedDuration * (s + 1) - i, this.generator = c;
743
+ }
744
+ updateTime(t) {
745
+ const n = Math.round(t - this.startTime) * this.playbackSpeed;
746
+ this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
747
+ }
748
+ tick(t, n = !1) {
749
+ const { generator: s, totalDuration: i, mixKeyframes: r, mirroredGenerator: a, resolvedDuration: o, calculatedDuration: u } = this;
750
+ if (this.startTime === null)
751
+ return s.next(0);
752
+ const { delay: c = 0, keyframes: l, repeat: h, repeatType: f, repeatDelay: g, type: b, onUpdate: p, finalKeyframe: v } = this.options;
753
+ this.speed > 0 ? this.startTime = Math.min(this.startTime, t) : this.speed < 0 && (this.startTime = Math.min(t - i / this.speed, this.startTime)), n ? this.currentTime = t : this.updateTime(t);
754
+ const y = this.currentTime - c * (this.playbackSpeed >= 0 ? 1 : -1), M = this.playbackSpeed >= 0 ? y < 0 : y > i;
755
+ this.currentTime = Math.max(y, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i);
756
+ let V = this.currentTime, S = s;
757
+ if (h) {
758
+ const T = Math.min(this.currentTime, i) / o;
759
+ let w = Math.floor(T), m = T % 1;
760
+ !m && T >= 1 && (m = 1), m === 1 && w--, w = Math.min(w, h + 1), w % 2 && (f === "reverse" ? (m = 1 - m, g && (m -= g / o)) : f === "mirror" && (S = a)), V = Y(0, 1, m) * o;
761
+ }
762
+ const x = M ? { done: !1, value: l[0] } : S.next(V);
763
+ r && !M && (x.value = r(x.value));
764
+ let { done: C } = x;
765
+ !M && u !== null && (C = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
766
+ const E = this.holdTime === null && (this.state === "finished" || this.state === "running" && C);
767
+ return E && b !== Lt && (x.value = ce(l, this.options, v, this.speed)), p && p(x.value), E && this.finish(), x;
768
+ }
769
+ /**
770
+ * Allows the returned animation to be awaited or promise-chained. Currently
771
+ * resolves when the animation finishes at all but in a future update could/should
772
+ * reject if its cancels.
773
+ */
774
+ then(t, n) {
775
+ return this.finished.then(t, n);
776
+ }
777
+ get duration() {
778
+ return /* @__PURE__ */ B(this.calculatedDuration);
779
+ }
780
+ get iterationDuration() {
781
+ const { delay: t = 0 } = this.options || {};
782
+ return this.duration + /* @__PURE__ */ B(t);
783
+ }
784
+ get time() {
785
+ return /* @__PURE__ */ B(this.currentTime);
786
+ }
787
+ set time(t) {
788
+ t = /* @__PURE__ */ P(t), this.currentTime = t, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = t : this.driver && (this.startTime = this.driver.now() - t / this.playbackSpeed), this.driver ? this.driver.start(!1) : (this.startTime = 0, this.state = "paused", this.holdTime = t, this.tick(t));
789
+ }
790
+ /**
791
+ * Returns the generator's velocity at the current time in units/second.
792
+ * Uses the analytical derivative when available (springs), avoiding
793
+ * the MotionValue's frame-dependent velocity estimation.
794
+ */
795
+ getGeneratorVelocity() {
796
+ const t = this.currentTime;
797
+ if (t <= 0)
798
+ return this.options.velocity || 0;
799
+ if (this.generator.velocity)
800
+ return this.generator.velocity(t);
801
+ const n = this.generator.next(t).value;
802
+ return Mn((s) => this.generator.next(s).value, t, n);
803
+ }
804
+ get speed() {
805
+ return this.playbackSpeed;
806
+ }
807
+ set speed(t) {
808
+ const n = this.playbackSpeed !== t;
809
+ n && this.driver && this.updateTime(I.now()), this.playbackSpeed = t, n && this.driver && (this.time = /* @__PURE__ */ B(this.currentTime));
810
+ }
811
+ play() {
812
+ if (this.isStopped)
813
+ return;
814
+ const { driver: t = Ys, startTime: n } = this.options;
815
+ this.driver || (this.driver = t((i) => this.tick(i))), this.options.onPlay?.();
816
+ const s = this.driver.now();
817
+ 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();
818
+ }
819
+ pause() {
820
+ this.state = "paused", this.updateTime(I.now()), this.holdTime = this.currentTime;
821
+ }
822
+ complete() {
823
+ this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
824
+ }
825
+ finish() {
826
+ this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
827
+ }
828
+ cancel() {
829
+ this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
830
+ }
831
+ teardown() {
832
+ this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
833
+ }
834
+ stopDriver() {
835
+ this.driver && (this.driver.stop(), this.driver = void 0);
836
+ }
837
+ sample(t) {
838
+ return this.startTime = 0, this.tick(t, !0);
839
+ }
840
+ attachTimeline(t) {
841
+ return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), t.observe(this);
842
+ }
843
+ }
844
+ function li(e) {
845
+ for (let t = 1; t < e.length; t++)
846
+ e[t] ?? (e[t] = e[t - 1]);
847
+ }
848
+ const Z = (e) => e * 180 / Math.PI, Wt = (e) => {
849
+ const t = Z(Math.atan2(e[1], e[0]));
850
+ return _t(t);
851
+ }, ui = {
852
+ x: 4,
853
+ y: 5,
854
+ translateX: 4,
855
+ translateY: 5,
856
+ scaleX: 0,
857
+ scaleY: 3,
858
+ scale: (e) => (Math.abs(e[0]) + Math.abs(e[3])) / 2,
859
+ rotate: Wt,
860
+ rotateZ: Wt,
861
+ skewX: (e) => Z(Math.atan(e[1])),
862
+ skewY: (e) => Z(Math.atan(e[2])),
863
+ skew: (e) => (Math.abs(e[1]) + Math.abs(e[2])) / 2
864
+ }, _t = (e) => (e = e % 360, e < 0 && (e += 360), e), Ie = Wt, Re = (e) => Math.sqrt(e[0] * e[0] + e[1] * e[1]), Pe = (e) => Math.sqrt(e[4] * e[4] + e[5] * e[5]), ci = {
865
+ x: 12,
866
+ y: 13,
867
+ z: 14,
868
+ translateX: 12,
869
+ translateY: 13,
870
+ translateZ: 14,
871
+ scaleX: Re,
872
+ scaleY: Pe,
873
+ scale: (e) => (Re(e) + Pe(e)) / 2,
874
+ rotateX: (e) => _t(Z(Math.atan2(e[6], e[5]))),
875
+ rotateY: (e) => _t(Z(Math.atan2(-e[2], e[0]))),
876
+ rotateZ: Ie,
877
+ rotate: Ie,
878
+ skewX: (e) => Z(Math.atan(e[4])),
879
+ skewY: (e) => Z(Math.atan(e[1])),
880
+ skew: (e) => (Math.abs(e[1]) + Math.abs(e[4])) / 2
881
+ };
882
+ function jt(e) {
883
+ return e.includes("scale") ? 1 : 0;
884
+ }
885
+ function Ut(e, t) {
886
+ if (!e || e === "none")
887
+ return jt(t);
888
+ const n = e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
889
+ let s, i;
890
+ if (n)
891
+ s = ci, i = n;
892
+ else {
893
+ const o = e.match(/^matrix\(([-\d.e\s,]+)\)$/u);
894
+ s = ui, i = o;
895
+ }
896
+ if (!i)
897
+ return jt(t);
898
+ const r = s[t], a = i[1].split(",").map(fi);
899
+ return typeof r == "function" ? r(a) : a[r];
900
+ }
901
+ const hi = (e, t) => {
902
+ const { transform: n = "none" } = getComputedStyle(e);
903
+ return Ut(n, t);
904
+ };
905
+ function fi(e) {
906
+ return parseFloat(e.trim());
907
+ }
908
+ const ot = [
909
+ "transformPerspective",
910
+ "x",
911
+ "y",
912
+ "z",
913
+ "translateX",
914
+ "translateY",
915
+ "translateZ",
916
+ "scale",
917
+ "scaleX",
918
+ "scaleY",
919
+ "rotate",
920
+ "rotateX",
921
+ "rotateY",
922
+ "rotateZ",
923
+ "skew",
924
+ "skewX",
925
+ "skewY"
926
+ ], lt = new Set(ot), Be = (e) => e === rt || e === d, di = /* @__PURE__ */ new Set(["x", "y", "z"]), pi = ot.filter((e) => !di.has(e));
927
+ function mi(e) {
928
+ const t = [];
929
+ return pi.forEach((n) => {
930
+ const s = e.getValue(n);
931
+ s !== void 0 && (t.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
932
+ }), t;
933
+ }
934
+ const z = {
935
+ // Dimensions
936
+ width: ({ x: e }, { paddingLeft: t = "0", paddingRight: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
937
+ height: ({ y: e }, { paddingTop: t = "0", paddingBottom: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
938
+ top: (e, { top: t }) => parseFloat(t),
939
+ left: (e, { left: t }) => parseFloat(t),
940
+ bottom: ({ y: e }, { top: t }) => parseFloat(t) + (e.max - e.min),
941
+ right: ({ x: e }, { left: t }) => parseFloat(t) + (e.max - e.min),
942
+ // Transform
943
+ x: (e, { transform: t }) => Ut(t, "x"),
944
+ y: (e, { transform: t }) => Ut(t, "y")
945
+ };
946
+ z.translateX = z.x;
947
+ z.translateY = z.y;
948
+ const Q = /* @__PURE__ */ new Set();
949
+ let Gt = !1, zt = !1, Yt = !1;
950
+ function En() {
951
+ if (zt) {
952
+ const e = Array.from(Q).filter((s) => s.needsMeasurement), t = new Set(e.map((s) => s.element)), n = /* @__PURE__ */ new Map();
953
+ t.forEach((s) => {
954
+ const i = mi(s);
955
+ i.length && (n.set(s, i), s.render());
956
+ }), e.forEach((s) => s.measureInitialState()), t.forEach((s) => {
957
+ s.render();
958
+ const i = n.get(s);
959
+ i && i.forEach(([r, a]) => {
960
+ s.getValue(r)?.set(a);
961
+ });
962
+ }), e.forEach((s) => s.measureEndState()), e.forEach((s) => {
963
+ s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
964
+ });
965
+ }
966
+ zt = !1, Gt = !1, Q.forEach((e) => e.complete(Yt)), Q.clear();
967
+ }
968
+ function kn() {
969
+ Q.forEach((e) => {
970
+ e.readKeyframes(), e.needsMeasurement && (zt = !0);
971
+ });
972
+ }
973
+ function gi() {
974
+ Yt = !0, kn(), En(), Yt = !1;
975
+ }
976
+ class de {
977
+ constructor(t, n, s, i, r, a = !1) {
978
+ this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...t], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = a;
979
+ }
980
+ scheduleResolve() {
981
+ this.state = "scheduled", this.isAsync ? (Q.add(this), Gt || (Gt = !0, j.read(kn), j.resolveKeyframes(En))) : (this.readKeyframes(), this.complete());
982
+ }
983
+ readKeyframes() {
984
+ const { unresolvedKeyframes: t, name: n, element: s, motionValue: i } = this;
985
+ if (t[0] === null) {
986
+ const r = i?.get(), a = t[t.length - 1];
987
+ if (r !== void 0)
988
+ t[0] = r;
989
+ else if (s && n) {
990
+ const o = s.readValue(n, a);
991
+ o != null && (t[0] = o);
992
+ }
993
+ t[0] === void 0 && (t[0] = a), i && r === void 0 && i.set(t[0]);
994
+ }
995
+ li(t);
996
+ }
997
+ setFinalKeyframe() {
998
+ }
999
+ measureInitialState() {
1000
+ }
1001
+ renderEndStyles() {
1002
+ }
1003
+ measureEndState() {
1004
+ }
1005
+ complete(t = !1) {
1006
+ this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, t), Q.delete(this);
1007
+ }
1008
+ cancel() {
1009
+ this.state === "scheduled" && (Q.delete(this), this.state = "pending");
1010
+ }
1011
+ resume() {
1012
+ this.state === "pending" && this.scheduleResolve();
1013
+ }
1014
+ }
1015
+ const yi = (e) => e.startsWith("--");
1016
+ function In(e, t, n) {
1017
+ yi(t) ? e.style.setProperty(t, n) : e.style[t] = n;
1018
+ }
1019
+ const bi = {};
1020
+ function Rn(e, t) {
1021
+ const n = /* @__PURE__ */ tn(e);
1022
+ return () => bi[t] ?? n();
1023
+ }
1024
+ const vi = /* @__PURE__ */ Rn(() => window.ScrollTimeline !== void 0, "scrollTimeline"), Pn = /* @__PURE__ */ Rn(() => {
1025
+ try {
1026
+ document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1027
+ } catch {
1028
+ return !1;
1029
+ }
1030
+ return !0;
1031
+ }, "linearEasing"), dt = ([e, t, n, s]) => `cubic-bezier(${e}, ${t}, ${n}, ${s})`, Ne = {
1032
+ linear: "linear",
1033
+ ease: "ease",
1034
+ easeIn: "ease-in",
1035
+ easeOut: "ease-out",
1036
+ easeInOut: "ease-in-out",
1037
+ circIn: /* @__PURE__ */ dt([0, 0.65, 0.55, 1]),
1038
+ circOut: /* @__PURE__ */ dt([0.55, 0, 1, 0.45]),
1039
+ backIn: /* @__PURE__ */ dt([0.31, 0.01, 0.66, -0.59]),
1040
+ backOut: /* @__PURE__ */ dt([0.33, 1.53, 0.69, 0.99])
1041
+ };
1042
+ function Bn(e, t) {
1043
+ if (e)
1044
+ return typeof e == "function" ? Pn() ? wn(e, t) : "ease-out" : pn(e) ? dt(e) : Array.isArray(e) ? e.map((n) => Bn(n, t) || Ne.easeOut) : Ne[e];
1045
+ }
1046
+ function Ti(e, t, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: a = "loop", ease: o = "easeOut", times: u } = {}, c = void 0) {
1047
+ const l = {
1048
+ [t]: n
1049
+ };
1050
+ u && (l.offset = u);
1051
+ const h = Bn(o, i);
1052
+ Array.isArray(h) && (l.easing = h);
1053
+ const f = {
1054
+ delay: s,
1055
+ duration: i,
1056
+ easing: Array.isArray(h) ? "linear" : h,
1057
+ fill: "both",
1058
+ iterations: r + 1,
1059
+ direction: a === "reverse" ? "alternate" : "normal"
1060
+ };
1061
+ return c && (f.pseudoElement = c), e.animate(l, f);
1062
+ }
1063
+ function pe(e) {
1064
+ return typeof e == "function" && "applyToOptions" in e;
1065
+ }
1066
+ function xi({ type: e, ...t }) {
1067
+ return pe(e) && Pn() ? e.applyToOptions(t) : (t.duration ?? (t.duration = 300), t.ease ?? (t.ease = "easeOut"), t);
1068
+ }
1069
+ class Nn extends he {
1070
+ constructor(t) {
1071
+ if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !t)
1072
+ return;
1073
+ const { element: n, name: s, keyframes: i, pseudoElement: r, allowFlatten: a = !1, finalKeyframe: o, onComplete: u } = t;
1074
+ this.isPseudoElement = !!r, this.allowFlatten = a, this.options = t, te(typeof t.type != "string");
1075
+ const c = xi(t);
1076
+ this.animation = Ti(n, s, i, c, r), c.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
1077
+ if (this.finishedTime = this.time, !r) {
1078
+ const l = ce(i, this.options, o, this.speed);
1079
+ this.updateMotionValue && this.updateMotionValue(l), In(n, s, l), this.animation.cancel();
1080
+ }
1081
+ u?.(), this.notifyFinished();
1082
+ };
1083
+ }
1084
+ play() {
1085
+ this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished());
1086
+ }
1087
+ pause() {
1088
+ this.animation.pause();
1089
+ }
1090
+ complete() {
1091
+ this.animation.finish?.();
1092
+ }
1093
+ cancel() {
1094
+ try {
1095
+ this.animation.cancel();
1096
+ } catch {
1097
+ }
1098
+ }
1099
+ stop() {
1100
+ if (this.isStopped)
1101
+ return;
1102
+ this.isStopped = !0;
1103
+ const { state: t } = this;
1104
+ t === "idle" || t === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
1105
+ }
1106
+ /**
1107
+ * WAAPI doesn't natively have any interruption capabilities.
1108
+ *
1109
+ * In this method, we commit styles back to the DOM before cancelling
1110
+ * the animation.
1111
+ *
1112
+ * This is designed to be overridden by NativeAnimationExtended, which
1113
+ * will create a renderless JS animation and sample it twice to calculate
1114
+ * its current value, "previous" value, and therefore allow
1115
+ * Motion to also correctly calculate velocity for any subsequent animation
1116
+ * while deferring the commit until the next animation frame.
1117
+ */
1118
+ commitStyles() {
1119
+ const t = this.options?.element;
1120
+ !this.isPseudoElement && t?.isConnected && this.animation.commitStyles?.();
1121
+ }
1122
+ get duration() {
1123
+ const t = this.animation.effect?.getComputedTiming?.().duration || 0;
1124
+ return /* @__PURE__ */ B(Number(t));
1125
+ }
1126
+ get iterationDuration() {
1127
+ const { delay: t = 0 } = this.options || {};
1128
+ return this.duration + /* @__PURE__ */ B(t);
1129
+ }
1130
+ get time() {
1131
+ return /* @__PURE__ */ B(Number(this.animation.currentTime) || 0);
1132
+ }
1133
+ set time(t) {
1134
+ const n = this.finishedTime !== null;
1135
+ this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ P(t), n && this.animation.pause();
1136
+ }
1137
+ /**
1138
+ * The playback speed of the animation.
1139
+ * 1 = normal speed, 2 = double speed, 0.5 = half speed.
1140
+ */
1141
+ get speed() {
1142
+ return this.animation.playbackRate;
1143
+ }
1144
+ set speed(t) {
1145
+ t < 0 && (this.finishedTime = null), this.animation.playbackRate = t;
1146
+ }
1147
+ get state() {
1148
+ return this.finishedTime !== null ? "finished" : this.animation.playState;
1149
+ }
1150
+ get startTime() {
1151
+ return this.manualStartTime ?? Number(this.animation.startTime);
1152
+ }
1153
+ set startTime(t) {
1154
+ this.manualStartTime = this.animation.startTime = t;
1155
+ }
1156
+ /**
1157
+ * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
1158
+ */
1159
+ attachTimeline({ timeline: t, rangeStart: n, rangeEnd: s, observe: i }) {
1160
+ return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, t && vi() ? (this.animation.timeline = t, n && (this.animation.rangeStart = n), s && (this.animation.rangeEnd = s), it) : i(this);
1161
+ }
1162
+ }
1163
+ const On = {
1164
+ anticipate: un,
1165
+ backInOut: ln,
1166
+ circInOut: cn
1167
+ };
1168
+ function Si(e) {
1169
+ return e in On;
1170
+ }
1171
+ function Vi(e) {
1172
+ typeof e.ease == "string" && Si(e.ease) && (e.ease = On[e.ease]);
1173
+ }
1174
+ const Pt = 10;
1175
+ class wi extends Nn {
1176
+ constructor(t) {
1177
+ Vi(t), Dn(t), super(t), t.startTime !== void 0 && t.autoplay !== !1 && (this.startTime = t.startTime), this.options = t;
1178
+ }
1179
+ /**
1180
+ * WAAPI doesn't natively have any interruption capabilities.
1181
+ *
1182
+ * Rather than read committed styles back out of the DOM, we can
1183
+ * create a renderless JS animation and sample it twice to calculate
1184
+ * its current value, "previous" value, and therefore allow
1185
+ * Motion to calculate velocity for any subsequent animation.
1186
+ */
1187
+ updateMotionValue(t) {
1188
+ const { motionValue: n, onUpdate: s, onComplete: i, element: r, ...a } = this.options;
1189
+ if (!n)
1190
+ return;
1191
+ if (t !== void 0) {
1192
+ n.set(t);
1193
+ return;
1194
+ }
1195
+ const o = new fe({
1196
+ ...a,
1197
+ autoplay: !1
1198
+ }), u = Math.max(Pt, I.now() - this.startTime), c = Y(0, Pt, u - Pt), l = o.sample(u).value, { name: h } = this.options;
1199
+ r && h && In(r, h, l), n.setWithVelocity(o.sample(Math.max(0, u - c)).value, l, c), o.stop();
1200
+ }
1201
+ }
1202
+ const Oe = (e, t) => t === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && // It's animatable if we have a string
1203
+ (N.test(e) || e === "0") && // And it contains numbers and/or colors
1204
+ !e.startsWith("url("));
1205
+ function Ai(e) {
1206
+ const t = e[0];
1207
+ if (e.length === 1)
1208
+ return !0;
1209
+ for (let n = 0; n < e.length; n++)
1210
+ if (e[n] !== t)
1211
+ return !0;
1212
+ }
1213
+ function Mi(e, t, n, s) {
1214
+ const i = e[0];
1215
+ if (i === null)
1216
+ return !1;
1217
+ if (t === "display" || t === "visibility")
1218
+ return !0;
1219
+ const r = e[e.length - 1], a = Oe(i, t), o = Oe(r, t);
1220
+ return !a || !o ? !1 : Ai(e) || (n === "spring" || pe(n)) && s;
1221
+ }
1222
+ function qt(e) {
1223
+ e.duration = 0, e.type = "keyframes";
1224
+ }
1225
+ const Ci = /* @__PURE__ */ new Set([
1226
+ "opacity",
1227
+ "clipPath",
1228
+ "filter",
1229
+ "transform"
1230
+ // TODO: Could be re-enabled now we have support for linear() easing
1231
+ // "background-color"
1232
+ ]), Fi = /* @__PURE__ */ tn(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1233
+ function Di(e) {
1234
+ const { motionValue: t, name: n, repeatDelay: s, repeatType: i, damping: r, type: a } = e;
1235
+ if (!(t?.owner?.current instanceof HTMLElement))
1236
+ return !1;
1237
+ const { onUpdate: u, transformTemplate: c } = t.owner.getProps();
1238
+ return Fi() && n && Ci.has(n) && (n !== "transform" || !c) && /**
1239
+ * If we're outputting values to onUpdate then we can't use WAAPI as there's
1240
+ * no way to read the value from WAAPI every frame.
1241
+ */
1242
+ !u && !s && i !== "mirror" && r !== 0 && a !== "inertia";
1243
+ }
1244
+ const Ei = 40;
1245
+ class ki extends he {
1246
+ constructor({ autoplay: t = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: a = "loop", keyframes: o, name: u, motionValue: c, element: l, ...h }) {
1247
+ super(), this.stop = () => {
1248
+ this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
1249
+ }, this.createdAt = I.now();
1250
+ const f = {
1251
+ autoplay: t,
1252
+ delay: n,
1253
+ type: s,
1254
+ repeat: i,
1255
+ repeatDelay: r,
1256
+ repeatType: a,
1257
+ name: u,
1258
+ motionValue: c,
1259
+ element: l,
1260
+ ...h
1261
+ }, g = l?.KeyframeResolver || de;
1262
+ this.keyframeResolver = new g(o, (b, p, v) => this.onKeyframesResolved(b, p, f, !v), u, c, l), this.keyframeResolver?.scheduleResolve();
1263
+ }
1264
+ onKeyframesResolved(t, n, s, i) {
1265
+ this.keyframeResolver = void 0;
1266
+ const { name: r, type: a, velocity: o, delay: u, isHandoff: c, onUpdate: l } = s;
1267
+ this.resolvedAt = I.now(), Mi(t, r, a, o) || ((_.instantAnimations || !u) && l?.(ce(t, s, n)), t[0] = t[t.length - 1], qt(s), s.repeat = 0);
1268
+ const f = {
1269
+ startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > Ei ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1270
+ finalKeyframe: n,
1271
+ ...s,
1272
+ keyframes: t
1273
+ }, g = !c && Di(f), b = f.motionValue?.owner?.current, p = g ? new wi({
1274
+ ...f,
1275
+ element: b
1276
+ }) : new fe(f);
1277
+ p.finished.then(() => {
1278
+ this.notifyFinished();
1279
+ }).catch(it), this.pendingTimeline && (this.stopTimeline = p.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = p;
1280
+ }
1281
+ get finished() {
1282
+ return this._animation ? this.animation.finished : this._finished;
1283
+ }
1284
+ then(t, n) {
1285
+ return this.finished.finally(t).then(() => {
1286
+ });
1287
+ }
1288
+ get animation() {
1289
+ return this._animation || (this.keyframeResolver?.resume(), gi()), this._animation;
1290
+ }
1291
+ get duration() {
1292
+ return this.animation.duration;
1293
+ }
1294
+ get iterationDuration() {
1295
+ return this.animation.iterationDuration;
1296
+ }
1297
+ get time() {
1298
+ return this.animation.time;
1299
+ }
1300
+ set time(t) {
1301
+ this.animation.time = t;
1302
+ }
1303
+ get speed() {
1304
+ return this.animation.speed;
1305
+ }
1306
+ get state() {
1307
+ return this.animation.state;
1308
+ }
1309
+ set speed(t) {
1310
+ this.animation.speed = t;
1311
+ }
1312
+ get startTime() {
1313
+ return this.animation.startTime;
1314
+ }
1315
+ attachTimeline(t) {
1316
+ return this._animation ? this.stopTimeline = this.animation.attachTimeline(t) : this.pendingTimeline = t, () => this.stop();
1317
+ }
1318
+ play() {
1319
+ this.animation.play();
1320
+ }
1321
+ pause() {
1322
+ this.animation.pause();
1323
+ }
1324
+ complete() {
1325
+ this.animation.complete();
1326
+ }
1327
+ cancel() {
1328
+ this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
1329
+ }
1330
+ }
1331
+ class Ii {
1332
+ constructor(t) {
1333
+ this.stop = () => this.runAll("stop"), this.animations = t.filter(Boolean);
1334
+ }
1335
+ get finished() {
1336
+ return Promise.all(this.animations.map((t) => t.finished));
1337
+ }
1338
+ /**
1339
+ * TODO: Filter out cancelled or stopped animations before returning
1340
+ */
1341
+ getAll(t) {
1342
+ return this.animations[0][t];
1343
+ }
1344
+ setAll(t, n) {
1345
+ for (let s = 0; s < this.animations.length; s++)
1346
+ this.animations[s][t] = n;
1347
+ }
1348
+ attachTimeline(t) {
1349
+ const n = this.animations.map((s) => s.attachTimeline(t));
1350
+ return () => {
1351
+ n.forEach((s, i) => {
1352
+ s && s(), this.animations[i].stop();
1353
+ });
1354
+ };
1355
+ }
1356
+ get time() {
1357
+ return this.getAll("time");
1358
+ }
1359
+ set time(t) {
1360
+ this.setAll("time", t);
1361
+ }
1362
+ get speed() {
1363
+ return this.getAll("speed");
1364
+ }
1365
+ set speed(t) {
1366
+ this.setAll("speed", t);
1367
+ }
1368
+ get state() {
1369
+ return this.getAll("state");
1370
+ }
1371
+ get startTime() {
1372
+ return this.getAll("startTime");
1373
+ }
1374
+ get duration() {
1375
+ return Ke(this.animations, "duration");
1376
+ }
1377
+ get iterationDuration() {
1378
+ return Ke(this.animations, "iterationDuration");
1379
+ }
1380
+ runAll(t) {
1381
+ this.animations.forEach((n) => n[t]());
1382
+ }
1383
+ play() {
1384
+ this.runAll("play");
1385
+ }
1386
+ pause() {
1387
+ this.runAll("pause");
1388
+ }
1389
+ cancel() {
1390
+ this.runAll("cancel");
1391
+ }
1392
+ complete() {
1393
+ this.runAll("complete");
1394
+ }
1395
+ }
1396
+ function Ke(e, t) {
1397
+ let n = 0;
1398
+ for (let s = 0; s < e.length; s++) {
1399
+ const i = e[s][t];
1400
+ i !== null && i > n && (n = i);
1401
+ }
1402
+ return n;
1403
+ }
1404
+ class Ri extends Ii {
1405
+ then(t, n) {
1406
+ return this.finished.finally(t).then(() => {
1407
+ });
1408
+ }
1409
+ }
1410
+ const Pi = (
1411
+ // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
1412
+ /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
1413
+ );
1414
+ function Bi(e) {
1415
+ const t = Pi.exec(e);
1416
+ if (!t)
1417
+ return [,];
1418
+ const [, n, s, i] = t;
1419
+ return [`--${n ?? s}`, i];
1420
+ }
1421
+ function Kn(e, t, n = 1) {
1422
+ const [s, i] = Bi(e);
1423
+ if (!s)
1424
+ return;
1425
+ const r = window.getComputedStyle(t).getPropertyValue(s);
1426
+ if (r) {
1427
+ const a = r.trim();
1428
+ return Je(a) ? parseFloat(a) : a;
1429
+ }
1430
+ return re(i) ? Kn(i, t, n + 1) : i;
1431
+ }
1432
+ const Ni = {
1433
+ type: "spring",
1434
+ stiffness: 500,
1435
+ damping: 25,
1436
+ restSpeed: 10
1437
+ }, Oi = (e) => ({
1438
+ type: "spring",
1439
+ stiffness: 550,
1440
+ damping: e === 0 ? 2 * Math.sqrt(550) : 30,
1441
+ restSpeed: 10
1442
+ }), Ki = {
1443
+ type: "keyframes",
1444
+ duration: 0.8
1445
+ }, $i = {
1446
+ type: "keyframes",
1447
+ ease: [0.25, 0.1, 0.35, 1],
1448
+ duration: 0.3
1449
+ }, Li = (e, { keyframes: t }) => t.length > 2 ? Ki : lt.has(e) ? e.startsWith("scale") ? Oi(t[1]) : Ni : $i, Wi = (e) => e !== null;
1450
+ function _i(e, { repeat: t, repeatType: n = "loop" }, s) {
1451
+ const i = e.filter(Wi), r = t && n !== "loop" && t % 2 === 1 ? 0 : i.length - 1;
1452
+ return i[r];
1453
+ }
1454
+ function $n(e, t) {
1455
+ if (e?.inherit && t) {
1456
+ const { inherit: n, ...s } = e;
1457
+ return { ...t, ...s };
1458
+ }
1459
+ return e;
1460
+ }
1461
+ function Ln(e, t) {
1462
+ const n = e?.[t] ?? e?.default ?? e;
1463
+ return n !== e ? $n(n, e) : n;
1464
+ }
1465
+ function ji({ when: e, delay: t, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: a, repeatDelay: o, from: u, elapsed: c, ...l }) {
1466
+ return !!Object.keys(l).length;
1467
+ }
1468
+ const Wn = (e, t, n, s = {}, i, r) => (a) => {
1469
+ const o = Ln(s, e) || {}, u = o.delay || s.delay || 0;
1470
+ let { elapsed: c = 0 } = s;
1471
+ c = c - /* @__PURE__ */ P(u);
1472
+ const l = {
1473
+ keyframes: Array.isArray(n) ? n : [null, n],
1474
+ ease: "easeOut",
1475
+ velocity: t.getVelocity(),
1476
+ ...o,
1477
+ delay: -c,
1478
+ onUpdate: (f) => {
1479
+ t.set(f), o.onUpdate && o.onUpdate(f);
1480
+ },
1481
+ onComplete: () => {
1482
+ a(), o.onComplete && o.onComplete();
1483
+ },
1484
+ name: e,
1485
+ motionValue: t,
1486
+ element: r ? void 0 : i
1487
+ };
1488
+ ji(o) || Object.assign(l, Li(e, l)), l.duration && (l.duration = /* @__PURE__ */ P(l.duration)), l.repeatDelay && (l.repeatDelay = /* @__PURE__ */ P(l.repeatDelay)), l.from !== void 0 && (l.keyframes[0] = l.from);
1489
+ let h = !1;
1490
+ if ((l.type === !1 || l.duration === 0 && !l.repeatDelay) && (qt(l), l.delay === 0 && (h = !0)), (_.instantAnimations || _.skipAnimations || i?.shouldSkipAnimations) && (h = !0, qt(l), l.delay = 0), l.allowFlatten = !o.type && !o.ease, h && !r && t.get() !== void 0) {
1491
+ const f = _i(l.keyframes, o);
1492
+ if (f !== void 0) {
1493
+ j.update(() => {
1494
+ l.onUpdate(f), l.onComplete();
1495
+ });
1496
+ return;
1497
+ }
1498
+ }
1499
+ return o.isSync ? new fe(l) : new ki(l);
1500
+ };
1501
+ function $e(e) {
1502
+ const t = [{}, {}];
1503
+ return e?.values.forEach((n, s) => {
1504
+ t[0][s] = n.get(), t[1][s] = n.getVelocity();
1505
+ }), t;
1506
+ }
1507
+ function _n(e, t, n, s) {
1508
+ if (typeof t == "function") {
1509
+ const [i, r] = $e(s);
1510
+ t = t(n !== void 0 ? n : e.custom, i, r);
1511
+ }
1512
+ if (typeof t == "string" && (t = e.variants && e.variants[t]), typeof t == "function") {
1513
+ const [i, r] = $e(s);
1514
+ t = t(n !== void 0 ? n : e.custom, i, r);
1515
+ }
1516
+ return t;
1517
+ }
1518
+ function Ui(e, t, n) {
1519
+ const s = e.getProps();
1520
+ return _n(s, t, s.custom, e);
1521
+ }
1522
+ const jn = /* @__PURE__ */ new Set([
1523
+ "width",
1524
+ "height",
1525
+ "top",
1526
+ "left",
1527
+ "right",
1528
+ "bottom",
1529
+ ...ot
1530
+ ]), Le = 30, Gi = (e) => !isNaN(parseFloat(e));
1531
+ class zi {
1532
+ /**
1533
+ * @param init - The initiating value
1534
+ * @param config - Optional configuration options
1535
+ *
1536
+ * - `transformer`: A function to transform incoming values with.
1537
+ */
1538
+ constructor(t, n = {}) {
1539
+ this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s) => {
1540
+ const i = I.now();
1541
+ 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))
1542
+ for (const r of this.dependents)
1543
+ r.dirty();
1544
+ }, this.hasAnimated = !1, this.setCurrent(t), this.owner = n.owner;
1545
+ }
1546
+ setCurrent(t) {
1547
+ this.current = t, this.updatedAt = I.now(), this.canTrackVelocity === null && t !== void 0 && (this.canTrackVelocity = Gi(this.current));
1548
+ }
1549
+ setPrevFrameValue(t = this.current) {
1550
+ this.prevFrameValue = t, this.prevUpdatedAt = this.updatedAt;
1551
+ }
1552
+ /**
1553
+ * Adds a function that will be notified when the `MotionValue` is updated.
1554
+ *
1555
+ * It returns a function that, when called, will cancel the subscription.
1556
+ *
1557
+ * When calling `onChange` inside a React component, it should be wrapped with the
1558
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
1559
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
1560
+ *
1561
+ * ```jsx
1562
+ * export const MyComponent = () => {
1563
+ * const x = useMotionValue(0)
1564
+ * const y = useMotionValue(0)
1565
+ * const opacity = useMotionValue(1)
1566
+ *
1567
+ * useEffect(() => {
1568
+ * function updateOpacity() {
1569
+ * const maxXY = Math.max(x.get(), y.get())
1570
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
1571
+ * opacity.set(newOpacity)
1572
+ * }
1573
+ *
1574
+ * const unsubscribeX = x.on("change", updateOpacity)
1575
+ * const unsubscribeY = y.on("change", updateOpacity)
1576
+ *
1577
+ * return () => {
1578
+ * unsubscribeX()
1579
+ * unsubscribeY()
1580
+ * }
1581
+ * }, [])
1582
+ *
1583
+ * return <motion.div style={{ x }} />
1584
+ * }
1585
+ * ```
1586
+ *
1587
+ * @param subscriber - A function that receives the latest value.
1588
+ * @returns A function that, when called, will cancel this subscription.
1589
+ *
1590
+ * @deprecated
1591
+ */
1592
+ onChange(t) {
1593
+ return this.on("change", t);
1594
+ }
1595
+ on(t, n) {
1596
+ this.events[t] || (this.events[t] = new en());
1597
+ const s = this.events[t].add(n);
1598
+ return t === "change" ? () => {
1599
+ s(), j.read(() => {
1600
+ this.events.change.getSize() || this.stop();
1601
+ });
1602
+ } : s;
1603
+ }
1604
+ clearListeners() {
1605
+ for (const t in this.events)
1606
+ this.events[t].clear();
1607
+ }
1608
+ /**
1609
+ * Attaches a passive effect to the `MotionValue`.
1610
+ */
1611
+ attach(t, n) {
1612
+ this.passiveEffect = t, this.stopPassiveEffect = n;
1613
+ }
1614
+ /**
1615
+ * Sets the state of the `MotionValue`.
1616
+ *
1617
+ * @remarks
1618
+ *
1619
+ * ```jsx
1620
+ * const x = useMotionValue(0)
1621
+ * x.set(10)
1622
+ * ```
1623
+ *
1624
+ * @param latest - Latest value to set.
1625
+ * @param render - Whether to notify render subscribers. Defaults to `true`
1626
+ *
1627
+ * @public
1628
+ */
1629
+ set(t) {
1630
+ this.passiveEffect ? this.passiveEffect(t, this.updateAndNotify) : this.updateAndNotify(t);
1631
+ }
1632
+ setWithVelocity(t, n, s) {
1633
+ this.set(n), this.prev = void 0, this.prevFrameValue = t, this.prevUpdatedAt = this.updatedAt - s;
1634
+ }
1635
+ /**
1636
+ * Set the state of the `MotionValue`, stopping any active animations,
1637
+ * effects, and resets velocity to `0`.
1638
+ */
1639
+ jump(t, n = !0) {
1640
+ this.updateAndNotify(t), this.prev = t, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1641
+ }
1642
+ dirty() {
1643
+ this.events.change?.notify(this.current);
1644
+ }
1645
+ addDependent(t) {
1646
+ this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(t);
1647
+ }
1648
+ removeDependent(t) {
1649
+ this.dependents && this.dependents.delete(t);
1650
+ }
1651
+ /**
1652
+ * Returns the latest state of `MotionValue`
1653
+ *
1654
+ * @returns - The latest state of `MotionValue`
1655
+ *
1656
+ * @public
1657
+ */
1658
+ get() {
1659
+ return this.current;
1660
+ }
1661
+ /**
1662
+ * @public
1663
+ */
1664
+ getPrevious() {
1665
+ return this.prev;
1666
+ }
1667
+ /**
1668
+ * Returns the latest velocity of `MotionValue`
1669
+ *
1670
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
1671
+ *
1672
+ * @public
1673
+ */
1674
+ getVelocity() {
1675
+ const t = I.now();
1676
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || t - this.updatedAt > Le)
1677
+ return 0;
1678
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, Le);
1679
+ return nn(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1680
+ }
1681
+ /**
1682
+ * Registers a new animation to control this `MotionValue`. Only one
1683
+ * animation can drive a `MotionValue` at one time.
1684
+ *
1685
+ * ```jsx
1686
+ * value.start()
1687
+ * ```
1688
+ *
1689
+ * @param animation - A function that starts the provided animation
1690
+ */
1691
+ start(t) {
1692
+ return this.stop(), new Promise((n) => {
1693
+ this.hasAnimated = !0, this.animation = t(n), this.events.animationStart && this.events.animationStart.notify();
1694
+ }).then(() => {
1695
+ this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1696
+ });
1697
+ }
1698
+ /**
1699
+ * Stop the currently active animation.
1700
+ *
1701
+ * @public
1702
+ */
1703
+ stop() {
1704
+ this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1705
+ }
1706
+ /**
1707
+ * Returns `true` if this value is currently animating.
1708
+ *
1709
+ * @public
1710
+ */
1711
+ isAnimating() {
1712
+ return !!this.animation;
1713
+ }
1714
+ clearAnimation() {
1715
+ delete this.animation;
1716
+ }
1717
+ /**
1718
+ * Destroy and clean up subscribers to this `MotionValue`.
1719
+ *
1720
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
1721
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
1722
+ * created a `MotionValue` via the `motionValue` function.
1723
+ *
1724
+ * @public
1725
+ */
1726
+ destroy() {
1727
+ this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1728
+ }
1729
+ }
1730
+ function st(e, t) {
1731
+ return new zi(e, t);
1732
+ }
1733
+ const Yi = (e) => Array.isArray(e);
1734
+ function qi(e, t, n) {
1735
+ e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, st(n));
1736
+ }
1737
+ function Xi(e) {
1738
+ return Yi(e) ? e[e.length - 1] || 0 : e;
1739
+ }
1740
+ function Hi(e, t) {
1741
+ const n = Ui(e, t);
1742
+ let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
1743
+ r = { ...r, ...s };
1744
+ for (const a in r) {
1745
+ const o = Xi(r[a]);
1746
+ qi(e, a, o);
1747
+ }
1748
+ }
1749
+ const k = (e) => !!(e && e.getVelocity);
1750
+ function Zi(e) {
1751
+ return !!(k(e) && e.add);
1752
+ }
1753
+ function Ji(e, t) {
1754
+ const n = e.getValue("willChange");
1755
+ if (Zi(n))
1756
+ return n.add(t);
1757
+ if (!n && _.WillChange) {
1758
+ const s = new _.WillChange("auto");
1759
+ e.addValue("willChange", s), s.add(t);
1760
+ }
1761
+ }
1762
+ function me(e) {
1763
+ return e.replace(/([A-Z])/g, (t) => `-${t.toLowerCase()}`);
1764
+ }
1765
+ const Qi = "framerAppearId", tr = "data-" + me(Qi);
1766
+ function er(e) {
1767
+ return e.props[tr];
1768
+ }
1769
+ function nr({ protectedKeys: e, needsAnimating: t }, n) {
1770
+ const s = e.hasOwnProperty(n) && t[n] !== !0;
1771
+ return t[n] = !1, s;
1772
+ }
1773
+ function sr(e, t, { delay: n = 0, transitionOverride: s, type: i } = {}) {
1774
+ let { transition: r, transitionEnd: a, ...o } = t;
1775
+ const u = e.getDefaultTransition();
1776
+ r = r ? $n(r, u) : u;
1777
+ const c = r?.reduceMotion;
1778
+ s && (r = s);
1779
+ const l = [], h = i && e.animationState && e.animationState.getState()[i];
1780
+ for (const f in o) {
1781
+ const g = e.getValue(f, e.latestValues[f] ?? null), b = o[f];
1782
+ if (b === void 0 || h && nr(h, f))
1783
+ continue;
1784
+ const p = {
1785
+ delay: n,
1786
+ ...Ln(r || {}, f)
1787
+ }, v = g.get();
1788
+ if (v !== void 0 && !g.isAnimating && !Array.isArray(b) && b === v && !p.velocity)
1789
+ continue;
1790
+ let y = !1;
1791
+ if (window.MotionHandoffAnimation) {
1792
+ const S = er(e);
1793
+ if (S) {
1794
+ const x = window.MotionHandoffAnimation(S, f, j);
1795
+ x !== null && (p.startTime = x, y = !0);
1796
+ }
1797
+ }
1798
+ Ji(e, f);
1799
+ const M = c ?? e.shouldReduceMotion;
1800
+ g.start(Wn(f, g, b, M && jn.has(f) ? { type: !1 } : p, e, y));
1801
+ const V = g.animation;
1802
+ V && l.push(V);
1803
+ }
1804
+ if (a) {
1805
+ const f = () => j.update(() => {
1806
+ a && Hi(e, a);
1807
+ });
1808
+ l.length ? Promise.all(l).then(f) : f();
1809
+ }
1810
+ return l;
1811
+ }
1812
+ const ir = {
1813
+ test: (e) => e === "auto",
1814
+ parse: (e) => e
1815
+ }, Un = (e) => (t) => t.test(e), Gn = [rt, d, et, G, Fs, Cs, ir], We = (e) => Gn.find(Un(e));
1816
+ function rr(e) {
1817
+ return typeof e == "number" ? e === 0 : e !== null ? e === "none" || e === "0" || Qe(e) : !0;
1818
+ }
1819
+ const ar = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1820
+ function or(e) {
1821
+ const [t, n] = e.slice(0, -1).split("(");
1822
+ if (t === "drop-shadow")
1823
+ return e;
1824
+ const [s] = n.match(ae) || [];
1825
+ if (!s)
1826
+ return e;
1827
+ const i = n.replace(s, "");
1828
+ let r = ar.has(t) ? 1 : 0;
1829
+ return s !== n && (r *= 100), t + "(" + r + i + ")";
1830
+ }
1831
+ const lr = /\b([a-z-]*)\(.*?\)/gu, Xt = {
1832
+ ...N,
1833
+ getAnimatableNone: (e) => {
1834
+ const t = e.match(lr);
1835
+ return t ? t.map(or).join(" ") : e;
1836
+ }
1837
+ }, Ht = {
1838
+ ...N,
1839
+ getAnimatableNone: (e) => {
1840
+ const t = N.parse(e);
1841
+ return N.createTransformer(e)(t.map((s) => typeof s == "number" ? 0 : typeof s == "object" ? { ...s, alpha: 1 } : s));
1842
+ }
1843
+ }, _e = {
1844
+ ...rt,
1845
+ transform: Math.round
1846
+ }, ur = {
1847
+ rotate: G,
1848
+ rotateX: G,
1849
+ rotateY: G,
1850
+ rotateZ: G,
1851
+ scale: At,
1852
+ scaleX: At,
1853
+ scaleY: At,
1854
+ scaleZ: At,
1855
+ skew: G,
1856
+ skewX: G,
1857
+ skewY: G,
1858
+ distance: d,
1859
+ translateX: d,
1860
+ translateY: d,
1861
+ translateZ: d,
1862
+ x: d,
1863
+ y: d,
1864
+ z: d,
1865
+ perspective: d,
1866
+ transformPerspective: d,
1867
+ opacity: yt,
1868
+ originX: Ce,
1869
+ originY: Ce,
1870
+ originZ: d
1871
+ }, ge = {
1872
+ // Border props
1873
+ borderWidth: d,
1874
+ borderTopWidth: d,
1875
+ borderRightWidth: d,
1876
+ borderBottomWidth: d,
1877
+ borderLeftWidth: d,
1878
+ borderRadius: d,
1879
+ borderTopLeftRadius: d,
1880
+ borderTopRightRadius: d,
1881
+ borderBottomRightRadius: d,
1882
+ borderBottomLeftRadius: d,
1883
+ // Positioning props
1884
+ width: d,
1885
+ maxWidth: d,
1886
+ height: d,
1887
+ maxHeight: d,
1888
+ top: d,
1889
+ right: d,
1890
+ bottom: d,
1891
+ left: d,
1892
+ inset: d,
1893
+ insetBlock: d,
1894
+ insetBlockStart: d,
1895
+ insetBlockEnd: d,
1896
+ insetInline: d,
1897
+ insetInlineStart: d,
1898
+ insetInlineEnd: d,
1899
+ // Spacing props
1900
+ padding: d,
1901
+ paddingTop: d,
1902
+ paddingRight: d,
1903
+ paddingBottom: d,
1904
+ paddingLeft: d,
1905
+ paddingBlock: d,
1906
+ paddingBlockStart: d,
1907
+ paddingBlockEnd: d,
1908
+ paddingInline: d,
1909
+ paddingInlineStart: d,
1910
+ paddingInlineEnd: d,
1911
+ margin: d,
1912
+ marginTop: d,
1913
+ marginRight: d,
1914
+ marginBottom: d,
1915
+ marginLeft: d,
1916
+ marginBlock: d,
1917
+ marginBlockStart: d,
1918
+ marginBlockEnd: d,
1919
+ marginInline: d,
1920
+ marginInlineStart: d,
1921
+ marginInlineEnd: d,
1922
+ // Typography
1923
+ fontSize: d,
1924
+ // Misc
1925
+ backgroundPositionX: d,
1926
+ backgroundPositionY: d,
1927
+ ...ur,
1928
+ zIndex: _e,
1929
+ // SVG
1930
+ fillOpacity: yt,
1931
+ strokeOpacity: yt,
1932
+ numOctaves: _e
1933
+ }, cr = {
1934
+ ...ge,
1935
+ // Color props
1936
+ color: D,
1937
+ backgroundColor: D,
1938
+ outlineColor: D,
1939
+ fill: D,
1940
+ stroke: D,
1941
+ // Border props
1942
+ borderColor: D,
1943
+ borderTopColor: D,
1944
+ borderRightColor: D,
1945
+ borderBottomColor: D,
1946
+ borderLeftColor: D,
1947
+ filter: Xt,
1948
+ WebkitFilter: Xt,
1949
+ mask: Ht,
1950
+ WebkitMask: Ht
1951
+ }, zn = (e) => cr[e], hr = /* @__PURE__ */ new Set([Xt, Ht]);
1952
+ function Yn(e, t) {
1953
+ let n = zn(e);
1954
+ return hr.has(n) || (n = N), n.getAnimatableNone ? n.getAnimatableNone(t) : void 0;
1955
+ }
1956
+ const fr = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1957
+ function dr(e, t, n) {
1958
+ let s = 0, i;
1959
+ for (; s < e.length && !i; ) {
1960
+ const r = e[s];
1961
+ typeof r == "string" && !fr.has(r) && nt(r).values.length && (i = e[s]), s++;
1962
+ }
1963
+ if (i && n)
1964
+ for (const r of t)
1965
+ e[r] = Yn(n, i);
1966
+ }
1967
+ class pr extends de {
1968
+ constructor(t, n, s, i, r) {
1969
+ super(t, n, s, i, r, !0);
1970
+ }
1971
+ readKeyframes() {
1972
+ const { unresolvedKeyframes: t, element: n, name: s } = this;
1973
+ if (!n || !n.current)
1974
+ return;
1975
+ super.readKeyframes();
1976
+ for (let l = 0; l < t.length; l++) {
1977
+ let h = t[l];
1978
+ if (typeof h == "string" && (h = h.trim(), re(h))) {
1979
+ const f = Kn(h, n.current);
1980
+ f !== void 0 && (t[l] = f), l === t.length - 1 && (this.finalKeyframe = h);
1981
+ }
1982
+ }
1983
+ if (this.resolveNoneKeyframes(), !jn.has(s) || t.length !== 2)
1984
+ return;
1985
+ const [i, r] = t, a = We(i), o = We(r), u = Me(i), c = Me(r);
1986
+ if (u !== c && z[s]) {
1987
+ this.needsMeasurement = !0;
1988
+ return;
1989
+ }
1990
+ if (a !== o)
1991
+ if (Be(a) && Be(o))
1992
+ for (let l = 0; l < t.length; l++) {
1993
+ const h = t[l];
1994
+ typeof h == "string" && (t[l] = parseFloat(h));
1995
+ }
1996
+ else z[s] && (this.needsMeasurement = !0);
1997
+ }
1998
+ resolveNoneKeyframes() {
1999
+ const { unresolvedKeyframes: t, name: n } = this, s = [];
2000
+ for (let i = 0; i < t.length; i++)
2001
+ (t[i] === null || rr(t[i])) && s.push(i);
2002
+ s.length && dr(t, s, n);
2003
+ }
2004
+ measureInitialState() {
2005
+ const { element: t, unresolvedKeyframes: n, name: s } = this;
2006
+ if (!t || !t.current)
2007
+ return;
2008
+ s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = z[s](t.measureViewportBox(), window.getComputedStyle(t.current)), n[0] = this.measuredOrigin;
2009
+ const i = n[n.length - 1];
2010
+ i !== void 0 && t.getValue(s, i).jump(i, !1);
2011
+ }
2012
+ measureEndState() {
2013
+ const { element: t, name: n, unresolvedKeyframes: s } = this;
2014
+ if (!t || !t.current)
2015
+ return;
2016
+ const i = t.getValue(n);
2017
+ i && i.jump(this.measuredOrigin, !1);
2018
+ const r = s.length - 1, a = s[r];
2019
+ s[r] = z[n](t.measureViewportBox(), window.getComputedStyle(t.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), this.removedTransforms?.length && this.removedTransforms.forEach(([o, u]) => {
2020
+ t.getValue(o).set(u);
2021
+ }), this.resolveNoneKeyframes();
2022
+ }
2023
+ }
2024
+ const mr = /* @__PURE__ */ new Set([
2025
+ "opacity",
2026
+ "clipPath",
2027
+ "filter",
2028
+ "transform"
2029
+ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
2030
+ // or until we implement support for linear() easing.
2031
+ // "background-color"
2032
+ ]);
2033
+ function gr(e, t, n) {
2034
+ if (e == null)
2035
+ return [];
2036
+ if (e instanceof EventTarget)
2037
+ return [e];
2038
+ if (typeof e == "string") {
2039
+ let s = document;
2040
+ t && (s = t.current);
2041
+ const i = n?.[e] ?? s.querySelectorAll(e);
2042
+ return i ? Array.from(i) : [];
2043
+ }
2044
+ return Array.from(e).filter((s) => s != null);
2045
+ }
2046
+ const qn = (e, t) => t && typeof e == "number" ? t.transform(e) : e, { schedule: yr } = /* @__PURE__ */ mn(queueMicrotask, !1);
2047
+ function Xn(e) {
2048
+ return os(e) && "ownerSVGElement" in e;
2049
+ }
2050
+ function br(e) {
2051
+ return Xn(e) && e.tagName === "svg";
2052
+ }
2053
+ const vr = [...Gn, D, N], Tr = (e) => vr.find(Un(e)), je = () => ({ min: 0, max: 0 }), ye = () => ({
2054
+ x: je(),
2055
+ y: je()
2056
+ }), vt = /* @__PURE__ */ new WeakMap();
2057
+ function xr(e) {
2058
+ return e !== null && typeof e == "object" && typeof e.start == "function";
2059
+ }
2060
+ function Sr(e) {
2061
+ return typeof e == "string" || Array.isArray(e);
2062
+ }
2063
+ const Vr = [
2064
+ "animate",
2065
+ "whileInView",
2066
+ "whileFocus",
2067
+ "whileHover",
2068
+ "whileTap",
2069
+ "whileDrag",
2070
+ "exit"
2071
+ ], wr = ["initial", ...Vr];
2072
+ function Hn(e) {
2073
+ return xr(e.animate) || wr.some((t) => Sr(e[t]));
2074
+ }
2075
+ function Ar(e) {
2076
+ return !!(Hn(e) || e.variants);
2077
+ }
2078
+ function Mr(e, t, n) {
2079
+ for (const s in t) {
2080
+ const i = t[s], r = n[s];
2081
+ if (k(i))
2082
+ e.addValue(s, i);
2083
+ else if (k(r))
2084
+ e.addValue(s, st(i, { owner: e }));
2085
+ else if (r !== i)
2086
+ if (e.hasValue(s)) {
2087
+ const a = e.getValue(s);
2088
+ a.liveStyle === !0 ? a.jump(i) : a.hasAnimated || a.set(i);
2089
+ } else {
2090
+ const a = e.getStaticValue(s);
2091
+ e.addValue(s, st(a !== void 0 ? a : i, { owner: e }));
2092
+ }
2093
+ }
2094
+ for (const s in n)
2095
+ t[s] === void 0 && e.removeValue(s);
2096
+ return t;
2097
+ }
2098
+ const Zt = { current: null }, Zn = { current: !1 }, Cr = typeof window < "u";
2099
+ function Fr() {
2100
+ if (Zn.current = !0, !!Cr)
2101
+ if (window.matchMedia) {
2102
+ const e = window.matchMedia("(prefers-reduced-motion)"), t = () => Zt.current = e.matches;
2103
+ e.addEventListener("change", t), t();
2104
+ } else
2105
+ Zt.current = !1;
2106
+ }
2107
+ const Ue = [
2108
+ "AnimationStart",
2109
+ "AnimationComplete",
2110
+ "Update",
2111
+ "BeforeLayoutMeasure",
2112
+ "LayoutMeasure",
2113
+ "LayoutAnimationStart",
2114
+ "LayoutAnimationComplete"
2115
+ ];
2116
+ let Ge = {};
2117
+ class Jn {
2118
+ /**
2119
+ * This method takes React props and returns found MotionValues. For example, HTML
2120
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2121
+ *
2122
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2123
+ * intended to be one.
2124
+ */
2125
+ scrapeMotionValuesFromProps(t, n, s) {
2126
+ return {};
2127
+ }
2128
+ constructor({ parent: t, props: n, presenceContext: s, reducedMotionConfig: i, skipAnimations: r, blockInitialAnimation: a, visualState: o }, u = {}) {
2129
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.shouldSkipAnimations = !1, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = de, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.hasBeenMounted = !1, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2130
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2131
+ }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2132
+ const g = I.now();
2133
+ this.renderScheduledAt < g && (this.renderScheduledAt = g, j.render(this.render, !1, !0));
2134
+ };
2135
+ const { latestValues: c, renderState: l } = o;
2136
+ this.latestValues = c, this.baseTarget = { ...c }, this.initialValues = n.initial ? { ...c } : {}, this.renderState = l, this.parent = t, this.props = n, this.presenceContext = s, this.depth = t ? t.depth + 1 : 0, this.reducedMotionConfig = i, this.skipAnimationsConfig = r, this.options = u, this.blockInitialAnimation = !!a, this.isControllingVariants = Hn(n), this.isVariantNode = Ar(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(t && t.current);
2137
+ const { willChange: h, ...f } = this.scrapeMotionValuesFromProps(n, {}, this);
2138
+ for (const g in f) {
2139
+ const b = f[g];
2140
+ c[g] !== void 0 && k(b) && b.set(c[g]);
2141
+ }
2142
+ }
2143
+ mount(t) {
2144
+ if (this.hasBeenMounted)
2145
+ for (const n in this.initialValues)
2146
+ this.values.get(n)?.jump(this.initialValues[n]), this.latestValues[n] = this.initialValues[n];
2147
+ this.current = t, vt.set(t, this), this.projection && !this.projection.instance && this.projection.mount(t), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), this.reducedMotionConfig === "never" ? this.shouldReduceMotion = !1 : this.reducedMotionConfig === "always" ? this.shouldReduceMotion = !0 : (Zn.current || Fr(), this.shouldReduceMotion = Zt.current), this.shouldSkipAnimations = this.skipAnimationsConfig ?? !1, this.parent?.addChild(this), this.update(this.props, this.presenceContext), this.hasBeenMounted = !0;
2148
+ }
2149
+ unmount() {
2150
+ this.projection && this.projection.unmount(), Nt(this.notifyUpdate), Nt(this.render), this.valueSubscriptions.forEach((t) => t()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this);
2151
+ for (const t in this.events)
2152
+ this.events[t].clear();
2153
+ for (const t in this.features) {
2154
+ const n = this.features[t];
2155
+ n && (n.unmount(), n.isMounted = !1);
2156
+ }
2157
+ this.current = null;
2158
+ }
2159
+ addChild(t) {
2160
+ this.children.add(t), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(t);
2161
+ }
2162
+ removeChild(t) {
2163
+ this.children.delete(t), this.enteringChildren && this.enteringChildren.delete(t);
2164
+ }
2165
+ bindToMotionValue(t, n) {
2166
+ if (this.valueSubscriptions.has(t) && this.valueSubscriptions.get(t)(), n.accelerate && mr.has(t) && this.current instanceof HTMLElement) {
2167
+ const { factory: a, keyframes: o, times: u, ease: c, duration: l } = n.accelerate, h = new Nn({
2168
+ element: this.current,
2169
+ name: t,
2170
+ keyframes: o,
2171
+ times: u,
2172
+ ease: c,
2173
+ duration: /* @__PURE__ */ P(l)
2174
+ }), f = a(h);
2175
+ this.valueSubscriptions.set(t, () => {
2176
+ f(), h.cancel();
2177
+ });
2178
+ return;
2179
+ }
2180
+ const s = lt.has(t);
2181
+ s && this.onBindTransform && this.onBindTransform();
2182
+ const i = n.on("change", (a) => {
2183
+ this.latestValues[t] = a, this.props.onUpdate && j.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
2184
+ });
2185
+ let r;
2186
+ typeof window < "u" && window.MotionCheckAppearSync && (r = window.MotionCheckAppearSync(this, t, n)), this.valueSubscriptions.set(t, () => {
2187
+ i(), r && r(), n.owner && n.stop();
2188
+ });
2189
+ }
2190
+ sortNodePosition(t) {
2191
+ return !this.current || !this.sortInstanceNodePosition || this.type !== t.type ? 0 : this.sortInstanceNodePosition(this.current, t.current);
2192
+ }
2193
+ updateFeatures() {
2194
+ let t = "animation";
2195
+ for (t in Ge) {
2196
+ const n = Ge[t];
2197
+ if (!n)
2198
+ continue;
2199
+ const { isEnabled: s, Feature: i } = n;
2200
+ if (!this.features[t] && i && s(this.props) && (this.features[t] = new i(this)), this.features[t]) {
2201
+ const r = this.features[t];
2202
+ r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
2203
+ }
2204
+ }
2205
+ }
2206
+ triggerBuild() {
2207
+ this.build(this.renderState, this.latestValues, this.props);
2208
+ }
2209
+ /**
2210
+ * Measure the current viewport box with or without transforms.
2211
+ * Only measures axis-aligned boxes, rotate and skew must be manually
2212
+ * removed with a re-render to work.
2213
+ */
2214
+ measureViewportBox() {
2215
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : ye();
2216
+ }
2217
+ getStaticValue(t) {
2218
+ return this.latestValues[t];
2219
+ }
2220
+ setStaticValue(t, n) {
2221
+ this.latestValues[t] = n;
2222
+ }
2223
+ /**
2224
+ * Update the provided props. Ensure any newly-added motion values are
2225
+ * added to our map, old ones removed, and listeners updated.
2226
+ */
2227
+ update(t, n) {
2228
+ (t.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = t, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
2229
+ for (let s = 0; s < Ue.length; s++) {
2230
+ const i = Ue[s];
2231
+ this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
2232
+ const r = "on" + i, a = t[r];
2233
+ a && (this.propEventSubscriptions[i] = this.on(i, a));
2234
+ }
2235
+ this.prevMotionValues = Mr(this, this.scrapeMotionValuesFromProps(t, this.prevProps || {}, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
2236
+ }
2237
+ getProps() {
2238
+ return this.props;
2239
+ }
2240
+ /**
2241
+ * Returns the variant definition with a given name.
2242
+ */
2243
+ getVariant(t) {
2244
+ return this.props.variants ? this.props.variants[t] : void 0;
2245
+ }
2246
+ /**
2247
+ * Returns the defined default transition on this component.
2248
+ */
2249
+ getDefaultTransition() {
2250
+ return this.props.transition;
2251
+ }
2252
+ getTransformPagePoint() {
2253
+ return this.props.transformPagePoint;
2254
+ }
2255
+ getClosestVariantNode() {
2256
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
2257
+ }
2258
+ /**
2259
+ * Add a child visual element to our set of children.
2260
+ */
2261
+ addVariantChild(t) {
2262
+ const n = this.getClosestVariantNode();
2263
+ if (n)
2264
+ return n.variantChildren && n.variantChildren.add(t), () => n.variantChildren.delete(t);
2265
+ }
2266
+ /**
2267
+ * Add a motion value and bind it to this visual element.
2268
+ */
2269
+ addValue(t, n) {
2270
+ const s = this.values.get(t);
2271
+ n !== s && (s && this.removeValue(t), this.bindToMotionValue(t, n), this.values.set(t, n), this.latestValues[t] = n.get());
2272
+ }
2273
+ /**
2274
+ * Remove a motion value and unbind any active subscriptions.
2275
+ */
2276
+ removeValue(t) {
2277
+ this.values.delete(t);
2278
+ const n = this.valueSubscriptions.get(t);
2279
+ n && (n(), this.valueSubscriptions.delete(t)), delete this.latestValues[t], this.removeValueFromRenderState(t, this.renderState);
2280
+ }
2281
+ /**
2282
+ * Check whether we have a motion value for this key
2283
+ */
2284
+ hasValue(t) {
2285
+ return this.values.has(t);
2286
+ }
2287
+ getValue(t, n) {
2288
+ if (this.props.values && this.props.values[t])
2289
+ return this.props.values[t];
2290
+ let s = this.values.get(t);
2291
+ return s === void 0 && n !== void 0 && (s = st(n === null ? void 0 : n, { owner: this }), this.addValue(t, s)), s;
2292
+ }
2293
+ /**
2294
+ * If we're trying to animate to a previously unencountered value,
2295
+ * we need to check for it in our state and as a last resort read it
2296
+ * directly from the instance (which might have performance implications).
2297
+ */
2298
+ readValue(t, n) {
2299
+ let s = this.latestValues[t] !== void 0 || !this.current ? this.latestValues[t] : this.getBaseTargetFromProps(this.props, t) ?? this.readValueFromInstance(this.current, t, this.options);
2300
+ return s != null && (typeof s == "string" && (Je(s) || Qe(s)) ? s = parseFloat(s) : !Tr(s) && N.test(n) && (s = Yn(t, n)), this.setBaseTarget(t, k(s) ? s.get() : s)), k(s) ? s.get() : s;
2301
+ }
2302
+ /**
2303
+ * Set the base target to later animate back to. This is currently
2304
+ * only hydrated on creation and when we first read a value.
2305
+ */
2306
+ setBaseTarget(t, n) {
2307
+ this.baseTarget[t] = n;
2308
+ }
2309
+ /**
2310
+ * Find the base target for a value thats been removed from all animation
2311
+ * props.
2312
+ */
2313
+ getBaseTarget(t) {
2314
+ const { initial: n } = this.props;
2315
+ let s;
2316
+ if (typeof n == "string" || typeof n == "object") {
2317
+ const r = _n(this.props, n, this.presenceContext?.custom);
2318
+ r && (s = r[t]);
2319
+ }
2320
+ if (n && s !== void 0)
2321
+ return s;
2322
+ const i = this.getBaseTargetFromProps(this.props, t);
2323
+ return i !== void 0 && !k(i) ? i : this.initialValues[t] !== void 0 && s === void 0 ? void 0 : this.baseTarget[t];
2324
+ }
2325
+ on(t, n) {
2326
+ return this.events[t] || (this.events[t] = new en()), this.events[t].add(n);
2327
+ }
2328
+ notify(t, ...n) {
2329
+ this.events[t] && this.events[t].notify(...n);
2330
+ }
2331
+ scheduleRenderMicrotask() {
2332
+ yr.render(this.render);
2333
+ }
2334
+ }
2335
+ class Qn extends Jn {
2336
+ constructor() {
2337
+ super(...arguments), this.KeyframeResolver = pr;
2338
+ }
2339
+ sortInstanceNodePosition(t, n) {
2340
+ return t.compareDocumentPosition(n) & 2 ? 1 : -1;
2341
+ }
2342
+ getBaseTargetFromProps(t, n) {
2343
+ const s = t.style;
2344
+ return s ? s[n] : void 0;
2345
+ }
2346
+ removeValueFromRenderState(t, { vars: n, style: s }) {
2347
+ delete n[t], delete s[t];
2348
+ }
2349
+ handleChildMotionValue() {
2350
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
2351
+ const { children: t } = this.props;
2352
+ k(t) && (this.childSubscription = t.on("change", (n) => {
2353
+ this.current && (this.current.textContent = `${n}`);
2354
+ }));
2355
+ }
2356
+ }
2357
+ function Dr({ top: e, left: t, right: n, bottom: s }) {
2358
+ return {
2359
+ x: { min: t, max: n },
2360
+ y: { min: e, max: s }
2361
+ };
2362
+ }
2363
+ function Er(e, t) {
2364
+ if (!t)
2365
+ return e;
2366
+ const n = t({ x: e.left, y: e.top }), s = t({ x: e.right, y: e.bottom });
2367
+ return {
2368
+ top: n.y,
2369
+ left: n.x,
2370
+ bottom: s.y,
2371
+ right: s.x
2372
+ };
2373
+ }
2374
+ function kr(e, t) {
2375
+ return Dr(Er(e.getBoundingClientRect(), t));
2376
+ }
2377
+ const Ir = {
2378
+ x: "translateX",
2379
+ y: "translateY",
2380
+ z: "translateZ",
2381
+ transformPerspective: "perspective"
2382
+ }, Rr = ot.length;
2383
+ function Pr(e, t, n) {
2384
+ let s = "", i = !0;
2385
+ for (let r = 0; r < Rr; r++) {
2386
+ const a = ot[r], o = e[a];
2387
+ if (o === void 0)
2388
+ continue;
2389
+ let u = !0;
2390
+ if (typeof o == "number")
2391
+ u = o === (a.startsWith("scale") ? 1 : 0);
2392
+ else {
2393
+ const c = parseFloat(o);
2394
+ u = a.startsWith("scale") ? c === 1 : c === 0;
2395
+ }
2396
+ if (!u || n) {
2397
+ const c = qn(o, ge[a]);
2398
+ if (!u) {
2399
+ i = !1;
2400
+ const l = Ir[a] || a;
2401
+ s += `${l}(${c}) `;
2402
+ }
2403
+ n && (t[a] = c);
2404
+ }
2405
+ }
2406
+ return s = s.trim(), n ? s = n(t, i ? "" : s) : i && (s = "none"), s;
2407
+ }
2408
+ function ts(e, t, n) {
2409
+ const { style: s, vars: i, transformOrigin: r } = e;
2410
+ let a = !1, o = !1;
2411
+ for (const u in t) {
2412
+ const c = t[u];
2413
+ if (lt.has(u)) {
2414
+ a = !0;
2415
+ continue;
2416
+ } else if (yn(u)) {
2417
+ i[u] = c;
2418
+ continue;
2419
+ } else {
2420
+ const l = qn(c, ge[u]);
2421
+ u.startsWith("origin") ? (o = !0, r[u] = l) : s[u] = l;
2422
+ }
2423
+ }
2424
+ if (t.transform || (a || n ? s.transform = Pr(t, e.transform, n) : s.transform && (s.transform = "none")), o) {
2425
+ const { originX: u = "50%", originY: c = "50%", originZ: l = 0 } = r;
2426
+ s.transformOrigin = `${u} ${c} ${l}`;
2427
+ }
2428
+ }
2429
+ function es(e, { style: t, vars: n }, s, i) {
2430
+ const r = e.style;
2431
+ let a;
2432
+ for (a in t)
2433
+ r[a] = t[a];
2434
+ i?.applyProjectionStyles(r, s);
2435
+ for (a in n)
2436
+ r.setProperty(a, n[a]);
2437
+ }
2438
+ function ze(e, t) {
2439
+ return t.max === t.min ? 0 : e / (t.max - t.min) * 100;
2440
+ }
2441
+ const ft = {
2442
+ correct: (e, t) => {
2443
+ if (!t.target)
2444
+ return e;
2445
+ if (typeof e == "string")
2446
+ if (d.test(e))
2447
+ e = parseFloat(e);
2448
+ else
2449
+ return e;
2450
+ const n = ze(e, t.target.x), s = ze(e, t.target.y);
2451
+ return `${n}% ${s}%`;
2452
+ }
2453
+ }, Br = {
2454
+ correct: (e, { treeScale: t, projectionDelta: n }) => {
2455
+ const s = e, i = N.parse(e);
2456
+ if (i.length > 5)
2457
+ return s;
2458
+ const r = N.createTransformer(e), a = typeof i[0] != "number" ? 1 : 0, o = n.x.scale * t.x, u = n.y.scale * t.y;
2459
+ i[0 + a] /= o, i[1 + a] /= u;
2460
+ const c = at(o, u, 0.5);
2461
+ return typeof i[2 + a] == "number" && (i[2 + a] /= c), typeof i[3 + a] == "number" && (i[3 + a] /= c), r(i);
2462
+ }
2463
+ }, Nr = {
2464
+ borderRadius: {
2465
+ ...ft,
2466
+ applyTo: [
2467
+ "borderTopLeftRadius",
2468
+ "borderTopRightRadius",
2469
+ "borderBottomLeftRadius",
2470
+ "borderBottomRightRadius"
2471
+ ]
2472
+ },
2473
+ borderTopLeftRadius: ft,
2474
+ borderTopRightRadius: ft,
2475
+ borderBottomLeftRadius: ft,
2476
+ borderBottomRightRadius: ft,
2477
+ boxShadow: Br
2478
+ };
2479
+ function Or(e, { layout: t, layoutId: n }) {
2480
+ return lt.has(e) || e.startsWith("origin") || (t || n !== void 0) && (!!Nr[e] || e === "opacity");
2481
+ }
2482
+ function ns(e, t, n) {
2483
+ const s = e.style, i = t?.style, r = {};
2484
+ if (!s)
2485
+ return r;
2486
+ for (const a in s)
2487
+ (k(s[a]) || i && k(i[a]) || Or(a, e) || n?.getValue(a)?.liveStyle !== void 0) && (r[a] = s[a]);
2488
+ return r;
2489
+ }
2490
+ function Kr(e) {
2491
+ return window.getComputedStyle(e);
2492
+ }
2493
+ class $r extends Qn {
2494
+ constructor() {
2495
+ super(...arguments), this.type = "html", this.renderInstance = es;
2496
+ }
2497
+ readValueFromInstance(t, n) {
2498
+ if (lt.has(n))
2499
+ return this.projection?.isProjecting ? jt(n) : hi(t, n);
2500
+ {
2501
+ const s = Kr(t), i = (yn(n) ? s.getPropertyValue(n) : s[n]) || 0;
2502
+ return typeof i == "string" ? i.trim() : i;
2503
+ }
2504
+ }
2505
+ measureInstanceViewportBox(t, { transformPagePoint: n }) {
2506
+ return kr(t, n);
2507
+ }
2508
+ build(t, n, s) {
2509
+ ts(t, n, s.transformTemplate);
2510
+ }
2511
+ scrapeMotionValuesFromProps(t, n, s) {
2512
+ return ns(t, n, s);
2513
+ }
2514
+ }
2515
+ function Lr(e, t) {
2516
+ return e in t;
2517
+ }
2518
+ class Wr extends Jn {
2519
+ constructor() {
2520
+ super(...arguments), this.type = "object";
2521
+ }
2522
+ readValueFromInstance(t, n) {
2523
+ if (Lr(n, t)) {
2524
+ const s = t[n];
2525
+ if (typeof s == "string" || typeof s == "number")
2526
+ return s;
2527
+ }
2528
+ }
2529
+ getBaseTargetFromProps() {
2530
+ }
2531
+ removeValueFromRenderState(t, n) {
2532
+ delete n.output[t];
2533
+ }
2534
+ measureInstanceViewportBox() {
2535
+ return ye();
2536
+ }
2537
+ build(t, n) {
2538
+ Object.assign(t.output, n);
2539
+ }
2540
+ renderInstance(t, { output: n }) {
2541
+ Object.assign(t, n);
2542
+ }
2543
+ sortInstanceNodePosition() {
2544
+ return 0;
2545
+ }
2546
+ }
2547
+ const _r = {
2548
+ offset: "stroke-dashoffset",
2549
+ array: "stroke-dasharray"
2550
+ }, jr = {
2551
+ offset: "strokeDashoffset",
2552
+ array: "strokeDasharray"
2553
+ };
2554
+ function Ur(e, t, n = 1, s = 0, i = !0) {
2555
+ e.pathLength = 1;
2556
+ const r = i ? _r : jr;
2557
+ e[r.offset] = `${-s}`, e[r.array] = `${t} ${n}`;
2558
+ }
2559
+ const Gr = [
2560
+ "offsetDistance",
2561
+ "offsetPath",
2562
+ "offsetRotate",
2563
+ "offsetAnchor"
2564
+ ];
2565
+ function zr(e, {
2566
+ attrX: t,
2567
+ attrY: n,
2568
+ attrScale: s,
2569
+ pathLength: i,
2570
+ pathSpacing: r = 1,
2571
+ pathOffset: a = 0,
2572
+ // This is object creation, which we try to avoid per-frame.
2573
+ ...o
2574
+ }, u, c, l) {
2575
+ if (ts(e, o, c), u) {
2576
+ e.style.viewBox && (e.attrs.viewBox = e.style.viewBox);
2577
+ return;
2578
+ }
2579
+ e.attrs = e.style, e.style = {};
2580
+ const { attrs: h, style: f } = e;
2581
+ h.transform && (f.transform = h.transform, delete h.transform), (f.transform || h.transformOrigin) && (f.transformOrigin = h.transformOrigin ?? "50% 50%", delete h.transformOrigin), f.transform && (f.transformBox = l?.transformBox ?? "fill-box", delete h.transformBox);
2582
+ for (const g of Gr)
2583
+ h[g] !== void 0 && (f[g] = h[g], delete h[g]);
2584
+ t !== void 0 && (h.x = t), n !== void 0 && (h.y = n), s !== void 0 && (h.scale = s), i !== void 0 && Ur(h, i, r, a, !1);
2585
+ }
2586
+ const ss = /* @__PURE__ */ new Set([
2587
+ "baseFrequency",
2588
+ "diffuseConstant",
2589
+ "kernelMatrix",
2590
+ "kernelUnitLength",
2591
+ "keySplines",
2592
+ "keyTimes",
2593
+ "limitingConeAngle",
2594
+ "markerHeight",
2595
+ "markerWidth",
2596
+ "numOctaves",
2597
+ "targetX",
2598
+ "targetY",
2599
+ "surfaceScale",
2600
+ "specularConstant",
2601
+ "specularExponent",
2602
+ "stdDeviation",
2603
+ "tableValues",
2604
+ "viewBox",
2605
+ "gradientTransform",
2606
+ "pathLength",
2607
+ "startOffset",
2608
+ "textLength",
2609
+ "lengthAdjust"
2610
+ ]), Yr = (e) => typeof e == "string" && e.toLowerCase() === "svg";
2611
+ function qr(e, t, n, s) {
2612
+ es(e, t, void 0, s);
2613
+ for (const i in t.attrs)
2614
+ e.setAttribute(ss.has(i) ? i : me(i), t.attrs[i]);
2615
+ }
2616
+ function Xr(e, t, n) {
2617
+ const s = ns(e, t, n);
2618
+ for (const i in e)
2619
+ if (k(e[i]) || k(t[i])) {
2620
+ const r = ot.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
2621
+ s[r] = e[i];
2622
+ }
2623
+ return s;
2624
+ }
2625
+ class Hr extends Qn {
2626
+ constructor() {
2627
+ super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ye;
2628
+ }
2629
+ getBaseTargetFromProps(t, n) {
2630
+ return t[n];
2631
+ }
2632
+ readValueFromInstance(t, n) {
2633
+ if (lt.has(n)) {
2634
+ const s = zn(n);
2635
+ return s && s.default || 0;
2636
+ }
2637
+ return n = ss.has(n) ? n : me(n), t.getAttribute(n);
2638
+ }
2639
+ scrapeMotionValuesFromProps(t, n, s) {
2640
+ return Xr(t, n, s);
2641
+ }
2642
+ build(t, n, s) {
2643
+ zr(t, n, this.isSVGTag, s.transformTemplate, s.style);
2644
+ }
2645
+ renderInstance(t, n, s, i) {
2646
+ qr(t, n, s, i);
2647
+ }
2648
+ mount(t) {
2649
+ this.isSVGTag = Yr(t.tagName), super.mount(t);
2650
+ }
2651
+ }
2652
+ function Zr(e, t, n) {
2653
+ const s = k(e) ? e : st(e);
2654
+ return s.start(Wn("", s, t, n)), s.animation;
2655
+ }
2656
+ function be(e) {
2657
+ return typeof e == "object" && !Array.isArray(e);
2658
+ }
2659
+ function is(e, t, n, s) {
2660
+ return e == null ? [] : typeof e == "string" && be(t) ? gr(e, n, s) : e instanceof NodeList ? Array.from(e) : Array.isArray(e) ? e.filter((i) => i != null) : [e];
2661
+ }
2662
+ function Jr(e, t, n) {
2663
+ return e * (t + 1);
2664
+ }
2665
+ function Ye(e, t, n, s) {
2666
+ return typeof t == "number" ? t : t.startsWith("-") || t.startsWith("+") ? Math.max(0, e + parseFloat(t)) : t === "<" ? n : t.startsWith("<") ? Math.max(0, n + parseFloat(t.slice(1))) : s.get(t) ?? e;
2667
+ }
2668
+ function Qr(e, t, n) {
2669
+ for (let s = 0; s < e.length; s++) {
2670
+ const i = e[s];
2671
+ i.at > t && i.at < n && (Qt(e, i), s--);
2672
+ }
2673
+ }
2674
+ function ta(e, t, n, s, i, r) {
2675
+ Qr(e, i, r);
2676
+ for (let a = 0; a < t.length; a++)
2677
+ e.push({
2678
+ value: t[a],
2679
+ at: at(i, r, s[a]),
2680
+ easing: dn(n, a)
2681
+ });
2682
+ }
2683
+ function ea(e, t) {
2684
+ for (let n = 0; n < e.length; n++)
2685
+ e[n] = e[n] / (t + 1);
2686
+ }
2687
+ function na(e, t) {
2688
+ return e.at === t.at ? e.value === null ? 1 : t.value === null ? -1 : 0 : e.at - t.at;
2689
+ }
2690
+ const sa = "easeInOut";
2691
+ function ia(e, { defaultTransition: t = {}, ...n } = {}, s, i) {
2692
+ const r = t.duration || 0.3, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), u = {}, c = /* @__PURE__ */ new Map();
2693
+ let l = 0, h = 0, f = 0;
2694
+ for (let g = 0; g < e.length; g++) {
2695
+ const b = e[g];
2696
+ if (typeof b == "string") {
2697
+ c.set(b, h);
2698
+ continue;
2699
+ } else if (!Array.isArray(b)) {
2700
+ c.set(b.name, Ye(h, b.at, l, c));
2701
+ continue;
2702
+ }
2703
+ let [p, v, y = {}] = b;
2704
+ y.at !== void 0 && (h = Ye(h, y.at, l, c));
2705
+ let M = 0;
2706
+ const V = (S, x, C, E = 0, T = 0) => {
2707
+ const w = ra(S), { delay: m = 0, times: A = Fn(w), type: R = t.type || "keyframes", repeat: O, repeatType: K, repeatDelay: q = 0, ...$ } = x;
2708
+ let { ease: U = t.ease || "easeOut", duration: L } = x;
2709
+ const ve = typeof m == "function" ? m(E, T) : m, Te = w.length, xe = pe(R) ? R : i?.[R || "keyframes"];
2710
+ if (Te <= 2 && xe) {
2711
+ let ut = 100;
2712
+ if (Te === 2 && la(w)) {
2713
+ const ct = w[1] - w[0];
2714
+ ut = Math.abs(ct);
2715
+ }
2716
+ const St = {
2717
+ ...t,
2718
+ ...$
2719
+ };
2720
+ L !== void 0 && (St.duration = /* @__PURE__ */ P(L));
2721
+ const Vt = An(St, ut, xe);
2722
+ U = Vt.ease, L = Vt.duration;
2723
+ }
2724
+ L ?? (L = r);
2725
+ const Se = h + ve;
2726
+ A.length === 1 && A[0] === 0 && (A[1] = 1);
2727
+ const Ve = A.length - w.length;
2728
+ if (Ve > 0 && Cn(A, Ve), w.length === 1 && w.unshift(null), O) {
2729
+ L = Jr(L, O);
2730
+ const ut = [...w], St = [...A];
2731
+ U = Array.isArray(U) ? [...U] : [U];
2732
+ const Vt = [...U];
2733
+ for (let ct = 0; ct < O; ct++) {
2734
+ w.push(...ut);
2735
+ for (let ht = 0; ht < ut.length; ht++)
2736
+ A.push(St[ht] + (ct + 1)), U.push(ht === 0 ? "linear" : dn(Vt, ht - 1));
2737
+ }
2738
+ ea(A, O);
2739
+ }
2740
+ const we = Se + L;
2741
+ ta(C, w, U, A, Se, we), M = Math.max(ve + L, M), f = Math.max(we, f);
2742
+ };
2743
+ if (k(p)) {
2744
+ const S = qe(p, o);
2745
+ V(v, y, Xe("default", S));
2746
+ } else {
2747
+ const S = is(p, v, s, u), x = S.length;
2748
+ for (let C = 0; C < x; C++) {
2749
+ v = v, y = y;
2750
+ const E = S[C], T = qe(E, o);
2751
+ for (const w in v)
2752
+ V(v[w], aa(y, w), Xe(w, T), C, x);
2753
+ }
2754
+ }
2755
+ l = h, h += M;
2756
+ }
2757
+ return o.forEach((g, b) => {
2758
+ for (const p in g) {
2759
+ const v = g[p];
2760
+ v.sort(na);
2761
+ const y = [], M = [], V = [];
2762
+ for (let E = 0; E < v.length; E++) {
2763
+ const { at: T, value: w, easing: m } = v[E];
2764
+ y.push(w), M.push(/* @__PURE__ */ ne(0, f, T)), V.push(m || "easeOut");
2765
+ }
2766
+ M[0] !== 0 && (M.unshift(0), y.unshift(y[0]), V.unshift(sa)), M[M.length - 1] !== 1 && (M.push(1), y.push(null)), a.has(b) || a.set(b, {
2767
+ keyframes: {},
2768
+ transition: {}
2769
+ });
2770
+ const S = a.get(b);
2771
+ S.keyframes[p] = y;
2772
+ const { type: x, ...C } = t;
2773
+ S.transition[p] = {
2774
+ ...C,
2775
+ duration: f,
2776
+ ease: V,
2777
+ times: M,
2778
+ ...n
2779
+ };
2780
+ }
2781
+ }), a;
2782
+ }
2783
+ function qe(e, t) {
2784
+ return !t.has(e) && t.set(e, {}), t.get(e);
2785
+ }
2786
+ function Xe(e, t) {
2787
+ return t[e] || (t[e] = []), t[e];
2788
+ }
2789
+ function ra(e) {
2790
+ return Array.isArray(e) ? e : [e];
2791
+ }
2792
+ function aa(e, t) {
2793
+ return e && e[t] ? {
2794
+ ...e,
2795
+ ...e[t]
2796
+ } : { ...e };
2797
+ }
2798
+ const oa = (e) => typeof e == "number", la = (e) => e.every(oa);
2799
+ function ua(e) {
2800
+ const t = {
2801
+ presenceContext: null,
2802
+ props: {},
2803
+ visualState: {
2804
+ renderState: {
2805
+ transform: {},
2806
+ transformOrigin: {},
2807
+ style: {},
2808
+ vars: {},
2809
+ attrs: {}
2810
+ },
2811
+ latestValues: {}
2812
+ }
2813
+ }, n = Xn(e) && !br(e) ? new Hr(t) : new $r(t);
2814
+ n.mount(e), vt.set(e, n);
2815
+ }
2816
+ function ca(e) {
2817
+ const t = {
2818
+ presenceContext: null,
2819
+ props: {},
2820
+ visualState: {
2821
+ renderState: {
2822
+ output: {}
2823
+ },
2824
+ latestValues: {}
2825
+ }
2826
+ }, n = new Wr(t);
2827
+ n.mount(e), vt.set(e, n);
2828
+ }
2829
+ function ha(e, t) {
2830
+ return k(e) || typeof e == "number" || typeof e == "string" && !be(t);
2831
+ }
2832
+ function rs(e, t, n, s) {
2833
+ const i = [];
2834
+ if (ha(e, t))
2835
+ i.push(Zr(e, be(t) && t.default || t, n && (n.default || n)));
2836
+ else {
2837
+ if (e == null)
2838
+ return i;
2839
+ const r = is(e, t, s), a = r.length;
2840
+ for (let o = 0; o < a; o++) {
2841
+ const u = r[o], c = u instanceof Element ? ua : ca;
2842
+ vt.has(u) || c(u);
2843
+ const l = vt.get(u), h = { ...n };
2844
+ "delay" in h && typeof h.delay == "function" && (h.delay = h.delay(o, a)), i.push(...sr(l, { ...t, transition: h }, {}));
2845
+ }
2846
+ }
2847
+ return i;
2848
+ }
2849
+ function fa(e, t, n) {
2850
+ const s = [], i = e.map((a) => {
2851
+ if (Array.isArray(a) && typeof a[0] == "function") {
2852
+ const o = a[0], u = st(0);
2853
+ return u.on("change", o), a.length === 1 ? [u, [0, 1]] : a.length === 2 ? [u, [0, 1], a[1]] : [u, a[1], a[2]];
2854
+ }
2855
+ return a;
2856
+ });
2857
+ return ia(i, t, n, { spring: bt }).forEach(({ keyframes: a, transition: o }, u) => {
2858
+ s.push(...rs(u, a, o));
2859
+ }), s;
2860
+ }
2861
+ function da(e) {
2862
+ return Array.isArray(e) && e.some(Array.isArray);
2863
+ }
2864
+ function pa(e = {}) {
2865
+ const { scope: t, reduceMotion: n } = e;
2866
+ function s(i, r, a) {
2867
+ let o = [], u;
2868
+ if (da(i)) {
2869
+ const { onComplete: l, ...h } = r || {};
2870
+ typeof l == "function" && (u = l), o = fa(i, n !== void 0 ? { reduceMotion: n, ...h } : h, t);
2871
+ } else {
2872
+ const { onComplete: l, ...h } = a || {};
2873
+ typeof l == "function" && (u = l), o = rs(i, r, n !== void 0 ? { reduceMotion: n, ...h } : h, t);
2874
+ }
2875
+ const c = new Ri(o);
2876
+ return u && c.finished.then(u), t && (t.animations.push(c), c.finished.then(() => {
2877
+ Qt(t.animations, c);
2878
+ })), c;
2879
+ }
2880
+ return s;
2881
+ }
2882
+ const J = pa(), Jt = "verba-chat-sdk-styles", W = "verba-widget-container", pt = "verba-widget-iframe", X = "verba-widget-bubble", ma = "verba-widget-bubble--open";
2883
+ function ga() {
2884
+ if (document.getElementById(Jt)) return;
2885
+ const e = `
5
2886
  /* ── Verba Chat SDK ── */
6
2887
 
7
- .${a} {
2888
+ .${W} {
8
2889
  position: fixed;
9
2890
  bottom: 24px;
10
2891
  right: 24px;
@@ -16,13 +2897,13 @@ function d() {
16
2897
  font-family: system-ui, -apple-system, sans-serif;
17
2898
  }
18
2899
 
19
- .${a}[data-position="bottom-left"] {
2900
+ .${W}[data-position="bottom-left"] {
20
2901
  right: unset;
21
2902
  left: 24px;
22
2903
  align-items: flex-start;
23
2904
  }
24
2905
 
25
- .${a}.verba-widget--inline {
2906
+ .${W}.verba-widget--inline {
26
2907
  position: static;
27
2908
  bottom: unset;
28
2909
  right: unset;
@@ -33,7 +2914,7 @@ function d() {
33
2914
  align-items: stretch;
34
2915
  }
35
2916
 
36
- .${n} {
2917
+ .${pt} {
37
2918
  border: none;
38
2919
  border-radius: 16px;
39
2920
  width: 380px;
@@ -42,41 +2923,30 @@ function d() {
42
2923
  opacity: 0;
43
2924
  transform: translateY(12px) scale(0.97);
44
2925
  transform-origin: bottom right;
45
- transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
46
- transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
47
2926
  pointer-events: none;
48
2927
  background: transparent;
49
2928
  }
50
2929
 
51
- .${a}[data-position="bottom-left"] .${n} {
2930
+ .${W}[data-position="bottom-left"] .${pt} {
52
2931
  transform-origin: bottom left;
53
2932
  }
54
2933
 
55
- .${n}.verba-iframe--visible {
56
- opacity: 1;
57
- transform: translateY(0) scale(1);
58
- pointer-events: all;
59
- }
60
-
61
- .${a}.verba-widget--inline .${n} {
2934
+ .${W}.verba-widget--inline .${pt} {
62
2935
  width: 100%;
63
2936
  height: 100%;
64
2937
  border-radius: 0;
65
2938
  box-shadow: none;
66
- opacity: 1;
67
- transform: none;
68
- pointer-events: all;
2939
+ opacity: 1 !important;
2940
+ transform: none !important;
2941
+ pointer-events: all !important;
69
2942
  }
70
2943
 
71
2944
  /* ── Bubble Button ── */
72
2945
 
73
- .${s} {
74
- width: 56px;
75
- height: 56px;
2946
+ .${X} {
76
2947
  border-radius: 50%;
77
2948
  border: none;
78
2949
  cursor: pointer;
79
- background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
80
2950
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45), 0 2px 6px rgba(0,0,0,0.15);
81
2951
  display: flex;
82
2952
  align-items: center;
@@ -88,110 +2958,112 @@ function d() {
88
2958
  overflow: hidden;
89
2959
  }
90
2960
 
91
- .${s}:hover {
2961
+ .${X}:hover {
92
2962
  transform: scale(1.1);
93
2963
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.55), 0 2px 10px rgba(0,0,0,0.18);
94
2964
  }
95
2965
 
96
- .${s}:active {
2966
+ .${X}:active {
97
2967
  transform: scale(0.95);
98
2968
  }
99
2969
 
100
- .${s} .verba-bubble-icon {
2970
+ .${X} .verba-bubble-icon {
101
2971
  position: absolute;
102
- transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
103
- }
104
-
105
- .${s} .verba-bubble-icon--chat { opacity: 1; transform: scale(1) rotate(0deg); }
106
- .${s} .verba-bubble-icon--close { opacity: 0; transform: scale(0.5) rotate(-90deg); }
107
-
108
- .${s}.${b} .verba-bubble-icon--chat {
109
- opacity: 0;
110
- transform: scale(0.5) rotate(90deg);
111
- }
112
- .${s}.${b} .verba-bubble-icon--close {
113
- opacity: 1;
114
- transform: scale(1) rotate(0deg);
115
- }
116
-
117
- /* ── Ripple pulse on load ── */
118
- @keyframes verba-pulse {
119
- 0% { box-shadow: 0 4px 20px rgba(99,102,241,0.45), 0 0 0 0 rgba(99,102,241,0.4); }
120
- 70% { box-shadow: 0 4px 20px rgba(99,102,241,0.45), 0 0 0 14px rgba(99,102,241,0); }
121
- 100% { box-shadow: 0 4px 20px rgba(99,102,241,0.45), 0 0 0 0 rgba(99,102,241,0); }
122
2972
  }
123
2973
 
124
- .${s}.verba-bubble--pulse {
125
- animation: verba-pulse 1.8s ease-out 0.4s 2;
126
- }
2974
+ .${X} .verba-bubble-icon--chat { opacity: 1; transform: scale(1) rotate(0deg); }
2975
+ .${X} .verba-bubble-icon--close { opacity: 0; transform: scale(0.5) rotate(-90deg); }
127
2976
 
128
2977
  /* ── Mobile ── */
129
2978
  @media (max-width: 480px) {
130
- .${n} {
2979
+ .${pt} {
131
2980
  width: calc(100vw - 24px);
132
2981
  height: 75vh;
133
2982
  max-height: 600px;
134
2983
  }
135
2984
 
136
- .${a} {
2985
+ .${W} {
137
2986
  right: 12px;
138
2987
  bottom: 12px;
139
2988
  }
140
2989
 
141
- .${a}[data-position="bottom-left"] {
2990
+ .${W}[data-position="bottom-left"] {
142
2991
  left: 12px;
143
2992
  right: unset;
144
2993
  }
145
2994
  }
146
2995
  `, t = document.createElement("style");
147
- t.id = l, t.textContent = i, document.head.appendChild(t);
2996
+ t.id = Jt, t.textContent = e, document.head.appendChild(t);
148
2997
  }
149
- function m() {
150
- document.getElementById(l)?.remove();
2998
+ function ya() {
2999
+ document.getElementById(Jt)?.remove();
151
3000
  }
152
- function p(i) {
3001
+ function ba(e) {
153
3002
  const t = document.createElement("div");
154
- return t.className = a, t.dataset.position = i, t;
3003
+ return t.className = W, t.dataset.position = e, t;
155
3004
  }
156
- function f() {
157
- const i = document.createElement("div");
158
- return i.className = `${a} verba-widget--inline`, i.style.width = "100%", i.style.height = "100%", i;
3005
+ function va() {
3006
+ const e = document.createElement("div");
3007
+ return e.className = `${W} verba-widget--inline`, e.style.width = "100%", e.style.height = "100%", e;
159
3008
  }
160
- function h(i) {
3009
+ function He(e) {
161
3010
  const t = document.createElement("iframe");
162
- return t.className = n, t.src = i, t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms allow-popups"), t.setAttribute("allow", "microphone; camera"), t.setAttribute("loading", "lazy"), t.setAttribute("title", "Verba AI Chat Widget"), t.setAttribute("aria-label", "Chat support widget"), t;
163
- }
164
- function g() {
165
- const i = document.createElement("button");
166
- i.className = `${s} verba-bubble--pulse`, i.setAttribute("aria-label", "Open chat"), i.setAttribute("aria-expanded", "false"), i.setAttribute("type", "button");
167
- const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
168
- t.setAttribute("class", "verba-bubble-icon verba-bubble-icon--chat"), t.setAttribute("width", "26"), t.setAttribute("height", "26"), t.setAttribute("viewBox", "0 0 24 24"), t.setAttribute("fill", "none"), t.setAttribute("stroke", "#ffffff"), t.setAttribute("stroke-width", "2"), t.setAttribute("stroke-linecap", "round"), t.setAttribute("stroke-linejoin", "round"), t.innerHTML = `
169
- <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
170
- `;
171
- const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
172
- return e.setAttribute("class", "verba-bubble-icon verba-bubble-icon--close"), e.setAttribute("width", "22"), e.setAttribute("height", "22"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("fill", "none"), e.setAttribute("stroke", "#ffffff"), e.setAttribute("stroke-width", "2.5"), e.setAttribute("stroke-linecap", "round"), e.innerHTML = `
3011
+ return t.className = pt, t.src = e, t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups allow-forms"), t.setAttribute("loading", "eager"), t.setAttribute("title", "Verba AI Chat Widget"), t.setAttribute("aria-label", "Chat support widget"), t;
3012
+ }
3013
+ function Ta(e) {
3014
+ const t = document.createElement("button");
3015
+ t.className = `${X} verba-bubble--pulse`, t.setAttribute("aria-label", "Open chat"), t.setAttribute("aria-expanded", "false"), t.setAttribute("type", "button");
3016
+ const n = e?.size ?? 56;
3017
+ t.style.width = `${n}px`, t.style.height = `${n}px`, t.style.background = e?.color ?? "#1A203C";
3018
+ const s = document.createElement("span");
3019
+ s.className = "verba-bubble-icon verba-bubble-icon--chat", s.style.display = "flex", s.style.alignItems = "center", s.style.justifyContent = "center", e?.icon ? s.innerHTML = `<img width="26" height="26" src="${e.icon}" alt="Chat icon" />` : s.innerHTML = `
3020
+ <svg width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
3021
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
3022
+ </svg>
3023
+ `;
3024
+ const i = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3025
+ return i.setAttribute("class", "verba-bubble-icon verba-bubble-icon--close"), i.setAttribute("width", "22"), i.setAttribute("height", "22"), i.setAttribute("viewBox", "0 0 24 24"), i.setAttribute("fill", "none"), i.setAttribute("stroke", e?.closeIconColor ?? "#ffffff"), i.setAttribute("stroke-width", "2.5"), i.setAttribute("stroke-linecap", "round"), i.innerHTML = `
173
3026
  <line x1="18" y1="6" x2="6" y2="18"/>
174
3027
  <line x1="6" y1="6" x2="18" y2="18"/>
175
- `, i.appendChild(t), i.appendChild(e), i;
3028
+ `, t.appendChild(s), t.appendChild(i), J(t, {
3029
+ boxShadow: [
3030
+ "0 4px 20px rgba(99,102,241,0.45), 0 0 0 0 rgba(99,102,241,0.4)",
3031
+ "0 4px 20px rgba(99,102,241,0.45), 0 0 0 14px rgba(99,102,241,0)",
3032
+ "0 4px 20px rgba(99,102,241,0.45), 0 0 0 0 rgba(99,102,241,0)"
3033
+ ]
3034
+ }, {
3035
+ duration: 1.8,
3036
+ ease: "easeOut",
3037
+ delay: 0.4,
3038
+ repeat: 1
3039
+ }), t;
176
3040
  }
177
- function x(i) {
178
- requestAnimationFrame(() => {
179
- i.classList.add("verba-iframe--visible");
180
- });
3041
+ function xa(e) {
3042
+ e.style.pointerEvents = "all", J(
3043
+ e,
3044
+ { opacity: 1, display: "block", y: 0, scale: 1 },
3045
+ { duration: 0.25, ease: [0.4, 0, 0.2, 1] }
3046
+ );
181
3047
  }
182
- function w(i) {
183
- i.classList.remove("verba-iframe--visible");
3048
+ function Sa(e) {
3049
+ e.style.pointerEvents = "none", J(
3050
+ e,
3051
+ { opacity: 0, display: "none", y: 12, scale: 0.97 },
3052
+ { duration: 0.25, ease: [0.4, 0, 0.2, 1] }
3053
+ );
184
3054
  }
185
- function u(i, t) {
186
- i.classList.toggle(b, t), i.setAttribute("aria-label", t ? "Close chat" : "Open chat"), i.setAttribute("aria-expanded", String(t));
3055
+ function Ze(e, t) {
3056
+ e.classList.toggle(ma, t), e.setAttribute("aria-label", t ? "Close chat" : "Open chat"), e.setAttribute("aria-expanded", String(t));
3057
+ const n = e.querySelector(".verba-bubble-icon--chat"), s = e.querySelector(".verba-bubble-icon--close");
3058
+ t ? (J(n, { opacity: 0, scale: 0.5, rotate: 90 }, { duration: 0.22, ease: [0.34, 1.56, 0.64, 1] }), J(s, { opacity: 1, scale: 1, rotate: 0 }, { duration: 0.22, ease: [0.34, 1.56, 0.64, 1] })) : (J(n, { opacity: 1, scale: 1, rotate: 0 }, { duration: 0.22, ease: [0.34, 1.56, 0.64, 1] }), J(s, { opacity: 0, scale: 0.5, rotate: -90 }, { duration: 0.22, ease: [0.34, 1.56, 0.64, 1] }));
187
3059
  }
188
- const v = "https://embed.verba.chat", y = `${v}/embeddable.html`;
189
- class o extends Error {
3060
+ const Va = "https://embed.verba.chat", wa = `${Va}/embeddable.html`;
3061
+ class Bt extends Error {
190
3062
  constructor(t) {
191
3063
  super(`[VerbaChatSDK] ${t}`), this.name = "ChatSDKError";
192
3064
  }
193
3065
  }
194
- class C {
3066
+ class Aa {
195
3067
  // ── Config ─────────────────────────────────────────────────────────────────
196
3068
  config;
197
3069
  // ── State ──────────────────────────────────────────────────────────────────
@@ -213,15 +3085,14 @@ class C {
213
3085
  * @throws {ChatSDKError} if `tenant` is empty.
214
3086
  */
215
3087
  constructor(t) {
216
- const e = t.tenant;
217
- if (!e?.trim())
218
- throw new o("`tenant` is required and must not be empty.");
3088
+ const n = t.tenant;
3089
+ if (!n?.trim())
3090
+ throw new Bt("`tenant` is required and must not be empty.");
219
3091
  this.config = {
220
- tenant: e.trim(),
3092
+ tenant: n.trim(),
221
3093
  theme: t.theme ?? "light",
222
- position: t.position ?? "bottom-right",
223
- container: t.container,
224
- userMetadata: t.userMetadata
3094
+ bubble: t.bubble,
3095
+ container: t.container
225
3096
  };
226
3097
  }
227
3098
  // ─── Public API ───────────────────────────────────────────────────────────
@@ -234,7 +3105,7 @@ class C {
234
3105
  * @throws {ChatSDKError} if called more than once or after `destroy()`.
235
3106
  */
236
3107
  init() {
237
- return this.assertState("uninitialized", "init"), d(), this.state = "ready", this.isInline = !!this.config.container, this.isInline ? this.mountInline() : this.mountFloating(), this;
3108
+ return this.assertState("uninitialized", "init"), ga(), this.state = "ready", this.isInline = !!this.config.container, this.isInline ? this.mountInline() : this.mountFloating(), this;
238
3109
  }
239
3110
  /**
240
3111
  * Make the widget visible.
@@ -243,7 +3114,7 @@ class C {
243
3114
  * @throws {ChatSDKError} if `init()` has not been called.
244
3115
  */
245
3116
  show() {
246
- return this.assertNotState("uninitialized", "show"), this.assertNotState("destroyed", "show"), this.isVisible || !this.iframe ? this : (this.isVisible = !0, this.isInline || (x(this.iframe), this.bubble && u(this.bubble, !0)), this);
3117
+ return this.assertNotState("uninitialized", "show"), this.assertNotState("destroyed", "show"), this.isVisible || !this.iframe ? this : (this.isVisible = !0, this.isInline || (xa(this.iframe), this.bubble && Ze(this.bubble, !0)), this);
247
3118
  }
248
3119
  /**
249
3120
  * Hide the widget (does not destroy it — all state is preserved).
@@ -251,7 +3122,7 @@ class C {
251
3122
  * @throws {ChatSDKError} if `init()` has not been called.
252
3123
  */
253
3124
  hide() {
254
- return this.assertNotState("uninitialized", "hide"), this.assertNotState("destroyed", "hide"), !this.isVisible || !this.iframe ? this : (this.isVisible = !1, this.isInline || (w(this.iframe), this.bubble && u(this.bubble, !1)), this);
3125
+ return this.assertNotState("uninitialized", "hide"), this.assertNotState("destroyed", "hide"), !this.isVisible || !this.iframe ? this : (this.isVisible = !1, this.isInline || (Sa(this.iframe), this.bubble && Ze(this.bubble, !1)), this);
255
3126
  }
256
3127
  /**
257
3128
  * Completely tear down the SDK:
@@ -265,7 +3136,7 @@ class C {
265
3136
  if (this.state !== "destroyed") {
266
3137
  this.container?.remove(), this.container = null, this.iframe = null, this.bubble = null;
267
3138
  for (const t of this.cleanupCallbacks) t();
268
- this.cleanupCallbacks.length = 0, m(), this.state = "destroyed", this.isVisible = !1;
3139
+ this.cleanupCallbacks.length = 0, ya(), this.state = "destroyed", this.isVisible = !1;
269
3140
  }
270
3141
  }
271
3142
  /** Current lifecycle state of this SDK instance. */
@@ -279,28 +3150,34 @@ class C {
279
3150
  console.error("[VerbaChatSDK] Container element not found. Falling back to floating mode."), this.isInline = !1, this.mountFloating();
280
3151
  return;
281
3152
  }
282
- const e = f(), r = h(this.buildWidgetUrl());
283
- e.appendChild(r), t.appendChild(e), this.container = e, this.iframe = r, this.isVisible = !0;
3153
+ const n = va(), s = He(this.buildWidgetUrl());
3154
+ n.appendChild(s), t.appendChild(n), this.container = n, this.iframe = s, this.isVisible = !0;
284
3155
  }
285
3156
  mountFloating() {
286
- const t = p(this.config.position ?? "bottom-right"), e = h(this.buildWidgetUrl()), r = g(), c = () => {
3157
+ const t = this.config.bubble?.position ?? "bottom-right", n = ba(t), s = He(this.buildWidgetUrl()), i = Ta(this.config.bubble), r = () => {
287
3158
  this.isVisible ? this.hide() : this.show();
288
3159
  };
289
- r.addEventListener("click", c), this.cleanupCallbacks.push(
290
- () => r.removeEventListener("click", c)
291
- ), t.appendChild(e), t.appendChild(r), document.body.appendChild(t), this.container = t, this.iframe = e, this.bubble = r, this.isVisible = !1;
3160
+ i.addEventListener("click", r), this.cleanupCallbacks.push(
3161
+ () => i.removeEventListener("click", r)
3162
+ );
3163
+ const a = (o) => {
3164
+ this.isVisible && this.container && o.target instanceof Node && !this.container.contains(o.target) && this.hide();
3165
+ };
3166
+ document.addEventListener("click", a, !0), this.cleanupCallbacks.push(
3167
+ () => document.removeEventListener("click", a, !0)
3168
+ ), n.appendChild(s), n.appendChild(i), document.body.appendChild(n), this.container = n, this.iframe = s, this.bubble = i, this.isVisible = !1;
292
3169
  }
293
3170
  // ─── Private: State Guards ───────────────────────────────────────────────
294
- assertState(t, e) {
3171
+ assertState(t, n) {
295
3172
  if (this.state !== t)
296
- throw new o(
297
- `Cannot call \`${e}()\` in state "${this.state}". Expected "${t}".`
3173
+ throw new Bt(
3174
+ `Cannot call \`${n}()\` in state "${this.state}". Expected "${t}".`
298
3175
  );
299
3176
  }
300
- assertNotState(t, e) {
3177
+ assertNotState(t, n) {
301
3178
  if (this.state === t)
302
- throw new o(
303
- `Cannot call \`${e}()\` in state "${t}".`
3179
+ throw new Bt(
3180
+ `Cannot call \`${n}()\` in state "${t}".`
304
3181
  );
305
3182
  }
306
3183
  // ─── Private: Helpers ────────────────────────────────────────────────────
@@ -309,16 +3186,17 @@ class C {
309
3186
  return t ? typeof t == "string" ? document.querySelector(t) : t : null;
310
3187
  }
311
3188
  buildWidgetUrl() {
312
- const t = new URL(y);
3189
+ const t = new URL(wa);
313
3190
  if (t.searchParams.set("tnt", this.config.tenant), typeof this.config.theme == "object") {
314
- const e = this.config.theme;
315
- e.primaryColor && t.searchParams.set("color", e.primaryColor), e.textColor && t.searchParams.set("textColor", e.textColor), e.backgroundColor && t.searchParams.set("backgroundColor", e.backgroundColor), e.fontFamily && t.searchParams.set("fontFamily", e.fontFamily), e.borderRadius !== void 0 && t.searchParams.set("borderRadius", String(e.borderRadius));
316
- }
3191
+ const n = this.config.theme;
3192
+ n.primaryColor && t.searchParams.set("color", n.primaryColor), n.textColor && t.searchParams.set("textColor", n.textColor), n.backgroundColor && t.searchParams.set("backgroundColor", n.backgroundColor), n.fontFamily && t.searchParams.set("fontFamily", n.fontFamily);
3193
+ } else
3194
+ t.searchParams.set("theme", this.config.theme);
317
3195
  return t.toString();
318
3196
  }
319
3197
  }
320
3198
  export {
321
- C as ChatSDK,
322
- o as ChatSDKError
3199
+ Aa as ChatSDK,
3200
+ Bt as ChatSDKError
323
3201
  };
324
3202
  //# sourceMappingURL=chat-sdk.es.js.map