@telegraph/modal 0.1.0 → 0.1.2

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,51 +1,51 @@
1
- import { jsx as M, jsxs as Ve } from "react/jsx-runtime";
2
- import * as J from "@radix-ui/react-dialog";
1
+ import { jsx as M, jsxs as Ce } from "react/jsx-runtime";
2
+ import * as ee from "@radix-ui/react-dialog";
3
3
  import * as v from "react";
4
- import ne, { createContext as se, useRef as fe, useLayoutEffect as Us, useEffect as dt, useState as Gs, useContext as I, useMemo as Fe, useCallback as zs, useInsertionEffect as Hs, forwardRef as Ys, Fragment as Tn, createElement as Xs } from "react";
5
- import * as qs from "react-dom";
6
- import { FocusScope as Zs } from "@radix-ui/react-focus-scope";
7
- import * as Js from "@radix-ui/react-portal";
8
- import * as Qs from "@radix-ui/react-visually-hidden";
9
- import { Button as ei } from "@telegraph/button";
10
- import { RefToTgphRef as ti } from "@telegraph/helpers";
11
- import { Stack as ee, Box as ni } from "@telegraph/layout";
12
- import { X as si } from "lucide-react";
4
+ import re, { createContext as oe, useRef as pe, useLayoutEffect as Ys, useEffect as pt, useState as Xs, useContext as k, useMemo as Re, Fragment as xn, createElement as qs, useCallback as Zs, useInsertionEffect as Js, forwardRef as Qs } from "react";
5
+ import * as ei from "react-dom";
6
+ import { FocusScope as ti } from "@radix-ui/react-focus-scope";
7
+ import * as ni from "@radix-ui/react-portal";
8
+ import * as si from "@radix-ui/react-visually-hidden";
9
+ import { Button as ii } from "@telegraph/button";
10
+ import { RefToTgphRef as ri } from "@telegraph/helpers";
11
+ import { Stack as se, Box as oi } from "@telegraph/layout";
12
+ import { X as ai } from "lucide-react";
13
13
  function Ke(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
14
14
  return function(i) {
15
15
  if (e == null || e(i), n === !1 || !i.defaultPrevented)
16
16
  return t == null ? void 0 : t(i);
17
17
  };
18
18
  }
19
- function Kt(e, t) {
19
+ function jt(e, t) {
20
20
  if (typeof e == "function")
21
21
  return e(t);
22
22
  e != null && (e.current = t);
23
23
  }
24
- function wn(...e) {
24
+ function Vn(...e) {
25
25
  return (t) => {
26
26
  let n = !1;
27
27
  const s = e.map((i) => {
28
- const r = Kt(i, t);
28
+ const r = jt(i, t);
29
29
  return !n && typeof r == "function" && (n = !0), r;
30
30
  });
31
31
  if (n)
32
32
  return () => {
33
33
  for (let i = 0; i < s.length; i++) {
34
34
  const r = s[i];
35
- typeof r == "function" ? r() : Kt(e[i], null);
35
+ typeof r == "function" ? r() : jt(e[i], null);
36
36
  }
37
37
  };
38
38
  };
39
39
  }
40
- function Sn(...e) {
41
- return v.useCallback(wn(...e), e);
40
+ function An(...e) {
41
+ return v.useCallback(Vn(...e), e);
42
42
  }
43
43
  // @__NO_SIDE_EFFECTS__
44
- function ii(e) {
45
- const t = /* @__PURE__ */ ri(e), n = v.forwardRef((s, i) => {
46
- const { children: r, ...o } = s, a = v.Children.toArray(r), l = a.find(ai);
44
+ function ci(e) {
45
+ const t = /* @__PURE__ */ ui(e), n = v.forwardRef((s, i) => {
46
+ const { children: r, ...o } = s, a = v.Children.toArray(r), l = a.find(fi);
47
47
  if (l) {
48
- const u = l.props.children, c = a.map((d) => d === l ? v.Children.count(u) > 1 ? v.Children.only(null) : v.isValidElement(u) ? u.props.children : null : d);
48
+ const u = l.props.children, c = a.map((f) => f === l ? v.Children.count(u) > 1 ? v.Children.only(null) : v.isValidElement(u) ? u.props.children : null : f);
49
49
  return /* @__PURE__ */ M(t, { ...o, ref: i, children: v.isValidElement(u) ? v.cloneElement(u, void 0, c) : null });
50
50
  }
51
51
  return /* @__PURE__ */ M(t, { ...o, ref: i, children: r });
@@ -53,22 +53,22 @@ function ii(e) {
53
53
  return n.displayName = `${e}.Slot`, n;
54
54
  }
55
55
  // @__NO_SIDE_EFFECTS__
56
- function ri(e) {
56
+ function ui(e) {
57
57
  const t = v.forwardRef((n, s) => {
58
58
  const { children: i, ...r } = n;
59
59
  if (v.isValidElement(i)) {
60
- const o = ui(i), a = ci(r, i.props);
61
- return i.type !== v.Fragment && (a.ref = s ? wn(s, o) : o), v.cloneElement(i, a);
60
+ const o = hi(i), a = di(r, i.props);
61
+ return i.type !== v.Fragment && (a.ref = s ? Vn(s, o) : o), v.cloneElement(i, a);
62
62
  }
63
63
  return v.Children.count(i) > 1 ? v.Children.only(null) : null;
64
64
  });
65
65
  return t.displayName = `${e}.SlotClone`, t;
66
66
  }
67
- var oi = Symbol("radix.slottable");
68
- function ai(e) {
69
- return v.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === oi;
67
+ var li = Symbol("radix.slottable");
68
+ function fi(e) {
69
+ return v.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === li;
70
70
  }
71
- function ci(e, t) {
71
+ function di(e, t) {
72
72
  const n = { ...t };
73
73
  for (const s in t) {
74
74
  const i = e[s], r = t[s];
@@ -79,12 +79,12 @@ function ci(e, t) {
79
79
  }
80
80
  return { ...e, ...n };
81
81
  }
82
- function ui(e) {
82
+ function hi(e) {
83
83
  var s, i;
84
84
  let t = (s = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : s.get, n = t && "isReactWarning" in t && t.isReactWarning;
85
85
  return n ? e.ref : (t = (i = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : i.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
86
86
  }
87
- var li = [
87
+ var pi = [
88
88
  "a",
89
89
  "button",
90
90
  "div",
@@ -102,17 +102,17 @@ var li = [
102
102
  "span",
103
103
  "svg",
104
104
  "ul"
105
- ], xn = li.reduce((e, t) => {
106
- const n = /* @__PURE__ */ ii(`Primitive.${t}`), s = v.forwardRef((i, r) => {
105
+ ], Cn = pi.reduce((e, t) => {
106
+ const n = /* @__PURE__ */ ci(`Primitive.${t}`), s = v.forwardRef((i, r) => {
107
107
  const { asChild: o, ...a } = i, l = o ? n : t;
108
108
  return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ M(l, { ...a, ref: r });
109
109
  });
110
110
  return s.displayName = `Primitive.${t}`, { ...e, [t]: s };
111
111
  }, {});
112
- function fi(e, t) {
113
- e && qs.flushSync(() => e.dispatchEvent(t));
112
+ function mi(e, t) {
113
+ e && ei.flushSync(() => e.dispatchEvent(t));
114
114
  }
115
- function ht(e) {
115
+ function mt(e) {
116
116
  const t = v.useRef(e);
117
117
  return v.useEffect(() => {
118
118
  t.current = e;
@@ -121,8 +121,8 @@ function ht(e) {
121
121
  return (s = t.current) == null ? void 0 : s.call(t, ...n);
122
122
  }, []);
123
123
  }
124
- function di(e, t = globalThis == null ? void 0 : globalThis.document) {
125
- const n = ht(e);
124
+ function gi(e, t = globalThis == null ? void 0 : globalThis.document) {
125
+ const n = mt(e);
126
126
  v.useEffect(() => {
127
127
  const s = (i) => {
128
128
  i.key === "Escape" && n(i);
@@ -130,11 +130,11 @@ function di(e, t = globalThis == null ? void 0 : globalThis.document) {
130
130
  return t.addEventListener("keydown", s, { capture: !0 }), () => t.removeEventListener("keydown", s, { capture: !0 });
131
131
  }, [n, t]);
132
132
  }
133
- var hi = "DismissableLayer", He = "dismissableLayer.update", pi = "dismissableLayer.pointerDownOutside", mi = "dismissableLayer.focusOutside", Wt, Vn = v.createContext({
133
+ var yi = "DismissableLayer", ze = "dismissableLayer.update", bi = "dismissableLayer.pointerDownOutside", vi = "dismissableLayer.focusOutside", _t, Mn = v.createContext({
134
134
  layers: /* @__PURE__ */ new Set(),
135
135
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
136
136
  branches: /* @__PURE__ */ new Set()
137
- }), An = v.forwardRef(
137
+ }), Pn = v.forwardRef(
138
138
  (e, t) => {
139
139
  const {
140
140
  disableOutsidePointerEvents: n = !1,
@@ -144,27 +144,27 @@ var hi = "DismissableLayer", He = "dismissableLayer.update", pi = "dismissableLa
144
144
  onInteractOutside: o,
145
145
  onDismiss: a,
146
146
  ...l
147
- } = e, u = v.useContext(Vn), [c, d] = v.useState(null), f = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = v.useState({}), g = Sn(t, (x) => d(x)), y = Array.from(u.layers), [T] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), p = y.indexOf(T), V = c ? y.indexOf(c) : -1, m = u.layersWithOutsidePointerEventsDisabled.size > 0, C = V >= p, w = bi((x) => {
148
- const S = x.target, D = [...u.branches].some((F) => F.contains(S));
147
+ } = e, u = v.useContext(Mn), [c, f] = v.useState(null), d = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = v.useState({}), g = An(t, (x) => f(x)), y = Array.from(u.layers), [T] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), p = y.indexOf(T), V = c ? y.indexOf(c) : -1, m = u.layersWithOutsidePointerEventsDisabled.size > 0, C = V >= p, w = Si((x) => {
148
+ const S = x.target, D = [...u.branches].some((O) => O.contains(S));
149
149
  !C || D || (i == null || i(x), o == null || o(x), x.defaultPrevented || a == null || a());
150
- }, f), A = vi((x) => {
150
+ }, d), A = xi((x) => {
151
151
  const S = x.target;
152
- [...u.branches].some((F) => F.contains(S)) || (r == null || r(x), o == null || o(x), x.defaultPrevented || a == null || a());
153
- }, f);
154
- return di((x) => {
152
+ [...u.branches].some((O) => O.contains(S)) || (r == null || r(x), o == null || o(x), x.defaultPrevented || a == null || a());
153
+ }, d);
154
+ return gi((x) => {
155
155
  V === u.layers.size - 1 && (s == null || s(x), !x.defaultPrevented && a && (x.preventDefault(), a()));
156
- }, f), v.useEffect(() => {
156
+ }, d), v.useEffect(() => {
157
157
  if (c)
158
- return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (Wt = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(c)), u.layers.add(c), $t(), () => {
159
- n && u.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = Wt);
158
+ return n && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (_t = d.body.style.pointerEvents, d.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(c)), u.layers.add(c), Ut(), () => {
159
+ n && u.layersWithOutsidePointerEventsDisabled.size === 1 && (d.body.style.pointerEvents = _t);
160
160
  };
161
- }, [c, f, n, u]), v.useEffect(() => () => {
162
- c && (u.layers.delete(c), u.layersWithOutsidePointerEventsDisabled.delete(c), $t());
161
+ }, [c, d, n, u]), v.useEffect(() => () => {
162
+ c && (u.layers.delete(c), u.layersWithOutsidePointerEventsDisabled.delete(c), Ut());
163
163
  }, [c, u]), v.useEffect(() => {
164
164
  const x = () => h({});
165
- return document.addEventListener(He, x), () => document.removeEventListener(He, x);
165
+ return document.addEventListener(ze, x), () => document.removeEventListener(ze, x);
166
166
  }, []), /* @__PURE__ */ M(
167
- xn.div,
167
+ Cn.div,
168
168
  {
169
169
  ...l,
170
170
  ref: g,
@@ -182,27 +182,27 @@ var hi = "DismissableLayer", He = "dismissableLayer.update", pi = "dismissableLa
182
182
  );
183
183
  }
184
184
  );
185
- An.displayName = hi;
186
- var gi = "DismissableLayerBranch", yi = v.forwardRef((e, t) => {
187
- const n = v.useContext(Vn), s = v.useRef(null), i = Sn(t, s);
185
+ Pn.displayName = yi;
186
+ var Ti = "DismissableLayerBranch", wi = v.forwardRef((e, t) => {
187
+ const n = v.useContext(Mn), s = v.useRef(null), i = An(t, s);
188
188
  return v.useEffect(() => {
189
189
  const r = s.current;
190
190
  if (r)
191
191
  return n.branches.add(r), () => {
192
192
  n.branches.delete(r);
193
193
  };
194
- }, [n.branches]), /* @__PURE__ */ M(xn.div, { ...e, ref: i });
194
+ }, [n.branches]), /* @__PURE__ */ M(Cn.div, { ...e, ref: i });
195
195
  });
196
- yi.displayName = gi;
197
- function bi(e, t = globalThis == null ? void 0 : globalThis.document) {
198
- const n = ht(e), s = v.useRef(!1), i = v.useRef(() => {
196
+ wi.displayName = Ti;
197
+ function Si(e, t = globalThis == null ? void 0 : globalThis.document) {
198
+ const n = mt(e), s = v.useRef(!1), i = v.useRef(() => {
199
199
  });
200
200
  return v.useEffect(() => {
201
201
  const r = (a) => {
202
202
  if (a.target && !s.current) {
203
203
  let l = function() {
204
- Cn(
205
- pi,
204
+ En(
205
+ bi,
206
206
  n,
207
207
  u,
208
208
  { discrete: !0 }
@@ -224,11 +224,11 @@ function bi(e, t = globalThis == null ? void 0 : globalThis.document) {
224
224
  onPointerDownCapture: () => s.current = !0
225
225
  };
226
226
  }
227
- function vi(e, t = globalThis == null ? void 0 : globalThis.document) {
228
- const n = ht(e), s = v.useRef(!1);
227
+ function xi(e, t = globalThis == null ? void 0 : globalThis.document) {
228
+ const n = mt(e), s = v.useRef(!1);
229
229
  return v.useEffect(() => {
230
230
  const i = (r) => {
231
- r.target && !s.current && Cn(mi, n, { originalEvent: r }, {
231
+ r.target && !s.current && En(vi, n, { originalEvent: r }, {
232
232
  discrete: !1
233
233
  });
234
234
  };
@@ -238,42 +238,42 @@ function vi(e, t = globalThis == null ? void 0 : globalThis.document) {
238
238
  onBlurCapture: () => s.current = !1
239
239
  };
240
240
  }
241
- function $t() {
242
- const e = new CustomEvent(He);
241
+ function Ut() {
242
+ const e = new CustomEvent(ze);
243
243
  document.dispatchEvent(e);
244
244
  }
245
- function Cn(e, t, n, { discrete: s }) {
245
+ function En(e, t, n, { discrete: s }) {
246
246
  const i = n.originalEvent.target, r = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
247
- t && i.addEventListener(e, t, { once: !0 }), s ? fi(i, r) : i.dispatchEvent(r);
247
+ t && i.addEventListener(e, t, { once: !0 }), s ? mi(i, r) : i.dispatchEvent(r);
248
248
  }
249
- var Ti = globalThis != null && globalThis.document ? v.useLayoutEffect : () => {
250
- }, wi = v[" useInsertionEffect ".trim().toString()] || Ti;
251
- function Si({
249
+ var Vi = globalThis != null && globalThis.document ? v.useLayoutEffect : () => {
250
+ }, Ai = v[" useInsertionEffect ".trim().toString()] || Vi;
251
+ function Ci({
252
252
  prop: e,
253
253
  defaultProp: t,
254
254
  onChange: n = () => {
255
255
  },
256
256
  caller: s
257
257
  }) {
258
- const [i, r, o] = xi({
258
+ const [i, r, o] = Mi({
259
259
  defaultProp: t,
260
260
  onChange: n
261
261
  }), a = e !== void 0, l = a ? e : i;
262
262
  {
263
263
  const c = v.useRef(e !== void 0);
264
264
  v.useEffect(() => {
265
- const d = c.current;
266
- d !== a && console.warn(
267
- `${s} is changing from ${d ? "controlled" : "uncontrolled"} to ${a ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
265
+ const f = c.current;
266
+ f !== a && console.warn(
267
+ `${s} is changing from ${f ? "controlled" : "uncontrolled"} to ${a ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
268
268
  ), c.current = a;
269
269
  }, [a, s]);
270
270
  }
271
271
  const u = v.useCallback(
272
272
  (c) => {
273
- var d;
273
+ var f;
274
274
  if (a) {
275
- const f = Vi(c) ? c(e) : c;
276
- f !== e && ((d = o.current) == null || d.call(o, f));
275
+ const d = Pi(c) ? c(e) : c;
276
+ d !== e && ((f = o.current) == null || f.call(o, d));
277
277
  } else
278
278
  r(c);
279
279
  },
@@ -281,64 +281,67 @@ function Si({
281
281
  );
282
282
  return [l, u];
283
283
  }
284
- function xi({
284
+ function Mi({
285
285
  defaultProp: e,
286
286
  onChange: t
287
287
  }) {
288
288
  const [n, s] = v.useState(e), i = v.useRef(n), r = v.useRef(t);
289
- return wi(() => {
289
+ return Ai(() => {
290
290
  r.current = t;
291
291
  }, [t]), v.useEffect(() => {
292
292
  var o;
293
293
  i.current !== n && ((o = r.current) == null || o.call(r, n), i.current = n);
294
294
  }, [n, i]), [n, s, r];
295
295
  }
296
- function Vi(e) {
296
+ function Pi(e) {
297
297
  return typeof e == "function";
298
298
  }
299
- const Ai = se({});
300
- function Ci(e) {
301
- const t = fe(null);
299
+ const Ei = oe({});
300
+ function Di(e) {
301
+ const t = pe(null);
302
302
  return t.current === null && (t.current = e()), t.current;
303
303
  }
304
- const pt = typeof window < "u", Mi = pt ? Us : dt, Mn = /* @__PURE__ */ se(null);
305
- function Pi(e, t) {
304
+ const gt = typeof window < "u", Fi = gt ? Ys : pt, Dn = /* @__PURE__ */ oe(null);
305
+ function Oi(e, t) {
306
306
  e.indexOf(t) === -1 && e.push(t);
307
307
  }
308
- function Ei(e, t) {
308
+ function Ri(e, t) {
309
309
  const n = e.indexOf(t);
310
310
  n > -1 && e.splice(n, 1);
311
311
  }
312
- const H = (e, t, n) => n > t ? t : n < e ? e : n;
313
- let ye = () => {
314
- }, Y = () => {
312
+ const Y = (e, t, n) => n > t ? t : n < e ? e : n;
313
+ function Ye(e, t) {
314
+ return t ? `${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}` : e;
315
+ }
316
+ let ve = () => {
317
+ }, X = () => {
315
318
  };
316
- process.env.NODE_ENV !== "production" && (ye = (e, t) => {
317
- !e && typeof console < "u" && console.warn(t);
318
- }, Y = (e, t) => {
319
+ process.env.NODE_ENV !== "production" && (ve = (e, t, n) => {
320
+ !e && typeof console < "u" && console.warn(Ye(t, n));
321
+ }, X = (e, t, n) => {
319
322
  if (!e)
320
- throw new Error(t);
323
+ throw new Error(Ye(t, n));
321
324
  });
322
- const W = {}, Pn = (e) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);
323
- function Di(e) {
325
+ const W = {}, Fn = (e) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);
326
+ function Li(e) {
324
327
  return typeof e == "object" && e !== null;
325
328
  }
326
- const En = (e) => /^0[^.\s]+$/u.test(e);
329
+ const On = (e) => /^0[^.\s]+$/u.test(e);
327
330
  // @__NO_SIDE_EFFECTS__
328
- function mt(e) {
331
+ function yt(e) {
329
332
  let t;
330
333
  return () => (t === void 0 && (t = e()), t);
331
334
  }
332
- const ie = /* @__NO_SIDE_EFFECTS__ */ (e) => e, Fi = (e, t) => (n) => t(e(n)), Re = (...e) => e.reduce(Fi), Dn = /* @__NO_SIDE_EFFECTS__ */ (e, t, n) => {
335
+ const ae = /* @__NO_SIDE_EFFECTS__ */ (e) => e, Ii = (e, t) => (n) => t(e(n)), Le = (...e) => e.reduce(Ii), Rn = /* @__NO_SIDE_EFFECTS__ */ (e, t, n) => {
333
336
  const s = t - e;
334
337
  return s === 0 ? 1 : (n - e) / s;
335
338
  };
336
- class Fn {
339
+ class Ln {
337
340
  constructor() {
338
341
  this.subscriptions = [];
339
342
  }
340
343
  add(t) {
341
- return Pi(this.subscriptions, t), () => Ei(this.subscriptions, t);
344
+ return Oi(this.subscriptions, t), () => Ri(this.subscriptions, t);
342
345
  }
343
346
  notify(t, n, s) {
344
347
  const i = this.subscriptions.length;
@@ -358,49 +361,49 @@ class Fn {
358
361
  this.subscriptions.length = 0;
359
362
  }
360
363
  }
361
- const N = /* @__NO_SIDE_EFFECTS__ */ (e) => e * 1e3, K = /* @__NO_SIDE_EFFECTS__ */ (e) => e / 1e3;
362
- function Rn(e, t) {
364
+ const B = /* @__NO_SIDE_EFFECTS__ */ (e) => e * 1e3, K = /* @__NO_SIDE_EFFECTS__ */ (e) => e / 1e3;
365
+ function In(e, t) {
363
366
  return t ? e * (1e3 / t) : 0;
364
367
  }
365
- const _t = /* @__PURE__ */ new Set();
366
- function On(e, t, n) {
367
- e || _t.has(t) || (console.warn(t), _t.add(t));
368
+ const Gt = /* @__PURE__ */ new Set();
369
+ function kn(e, t, n) {
370
+ e || Gt.has(t) || (console.warn(Ye(t, n)), Gt.add(t));
368
371
  }
369
- const Ln = (e, t, n) => (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e, Ri = 1e-7, Oi = 12;
370
- function Li(e, t, n, s, i) {
372
+ const Nn = (e, t, n) => (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e, ki = 1e-7, Ni = 12;
373
+ function Bi(e, t, n, s, i) {
371
374
  let r, o, a = 0;
372
375
  do
373
- o = t + (n - t) / 2, r = Ln(o, s, i) - e, r > 0 ? n = o : t = o;
374
- while (Math.abs(r) > Ri && ++a < Oi);
376
+ o = t + (n - t) / 2, r = Nn(o, s, i) - e, r > 0 ? n = o : t = o;
377
+ while (Math.abs(r) > ki && ++a < Ni);
375
378
  return o;
376
379
  }
377
- function be(e, t, n, s) {
380
+ function Te(e, t, n, s) {
378
381
  if (e === t && n === s)
379
- return ie;
380
- const i = (r) => Li(r, 0, 1, e, n);
381
- return (r) => r === 0 || r === 1 ? r : Ln(i(r), t, s);
382
- }
383
- const In = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, kn = (e) => (t) => 1 - e(1 - t), Nn = /* @__PURE__ */ be(0.33, 1.53, 0.69, 0.99), gt = /* @__PURE__ */ kn(Nn), Bn = /* @__PURE__ */ In(gt), Kn = (e) => (e *= 2) < 1 ? 0.5 * gt(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), yt = (e) => 1 - Math.sin(Math.acos(e)), Ii = kn(yt), Wn = In(yt), ki = /* @__PURE__ */ be(0.42, 0, 1, 1), Ni = /* @__PURE__ */ be(0, 0, 0.58, 1), $n = /* @__PURE__ */ be(0.42, 0, 0.58, 1), Bi = (e) => Array.isArray(e) && typeof e[0] != "number", _n = (e) => Array.isArray(e) && typeof e[0] == "number", jt = {
384
- linear: ie,
385
- easeIn: ki,
386
- easeInOut: $n,
387
- easeOut: Ni,
388
- circIn: yt,
389
- circInOut: Wn,
390
- circOut: Ii,
391
- backIn: gt,
392
- backInOut: Bn,
393
- backOut: Nn,
394
- anticipate: Kn
395
- }, Ki = (e) => typeof e == "string", Ut = (e) => {
396
- if (_n(e)) {
397
- Y(e.length === 4, "Cubic bezier arrays must contain four numerical values.");
382
+ return ae;
383
+ const i = (r) => Bi(r, 0, 1, e, n);
384
+ return (r) => r === 0 || r === 1 ? r : Nn(i(r), t, s);
385
+ }
386
+ const Bn = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, Kn = (e) => (t) => 1 - e(1 - t), Wn = /* @__PURE__ */ Te(0.33, 1.53, 0.69, 0.99), bt = /* @__PURE__ */ Kn(Wn), $n = /* @__PURE__ */ Bn(bt), jn = (e) => (e *= 2) < 1 ? 0.5 * bt(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), vt = (e) => 1 - Math.sin(Math.acos(e)), Ki = Kn(vt), _n = Bn(vt), Wi = /* @__PURE__ */ Te(0.42, 0, 1, 1), $i = /* @__PURE__ */ Te(0, 0, 0.58, 1), Un = /* @__PURE__ */ Te(0.42, 0, 0.58, 1), ji = (e) => Array.isArray(e) && typeof e[0] != "number", Gn = (e) => Array.isArray(e) && typeof e[0] == "number", Ht = {
387
+ linear: ae,
388
+ easeIn: Wi,
389
+ easeInOut: Un,
390
+ easeOut: $i,
391
+ circIn: vt,
392
+ circInOut: _n,
393
+ circOut: Ki,
394
+ backIn: bt,
395
+ backInOut: $n,
396
+ backOut: Wn,
397
+ anticipate: jn
398
+ }, _i = (e) => typeof e == "string", zt = (e) => {
399
+ if (Gn(e)) {
400
+ X(e.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
398
401
  const [t, n, s, i] = e;
399
- return be(t, n, s, i);
400
- } else if (Ki(e))
401
- return Y(jt[e] !== void 0, `Invalid easing type '${e}'`), jt[e];
402
+ return Te(t, n, s, i);
403
+ } else if (_i(e))
404
+ return X(Ht[e] !== void 0, `Invalid easing type '${e}'`, "invalid-easing-type"), Ht[e];
402
405
  return e;
403
- }, Te = [
406
+ }, Se = [
404
407
  "setup",
405
408
  // Compute
406
409
  "read",
@@ -418,7 +421,7 @@ const In = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, kn
418
421
  "postRender"
419
422
  // Compute
420
423
  ];
421
- function Wi(e, t) {
424
+ function Ui(e, t) {
422
425
  let n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = !1, r = !1;
423
426
  const o = /* @__PURE__ */ new WeakSet();
424
427
  let a = {
@@ -433,9 +436,9 @@ function Wi(e, t) {
433
436
  /**
434
437
  * Schedule a process to run on the next frame.
435
438
  */
436
- schedule: (c, d = !1, f = !1) => {
437
- const g = f && i ? n : s;
438
- return d && o.add(c), g.has(c) || g.add(c), c;
439
+ schedule: (c, f = !1, d = !1) => {
440
+ const g = d && i ? n : s;
441
+ return f && o.add(c), g.has(c) || g.add(c), c;
439
442
  },
440
443
  /**
441
444
  * Cancel the provided callback from running on the next frame.
@@ -456,70 +459,70 @@ function Wi(e, t) {
456
459
  };
457
460
  return u;
458
461
  }
459
- const $i = 40;
460
- function jn(e, t) {
462
+ const Gi = 40;
463
+ function Hn(e, t) {
461
464
  let n = !1, s = !0;
462
465
  const i = {
463
466
  delta: 0,
464
467
  timestamp: 0,
465
468
  isProcessing: !1
466
- }, r = () => n = !0, o = Te.reduce((m, C) => (m[C] = Wi(r), m), {}), { setup: a, read: l, resolveKeyframes: u, preUpdate: c, update: d, preRender: f, render: h, postRender: g } = o, y = () => {
469
+ }, r = () => n = !0, o = Se.reduce((m, C) => (m[C] = Ui(r), m), {}), { setup: a, read: l, resolveKeyframes: u, preUpdate: c, update: f, preRender: d, render: h, postRender: g } = o, y = () => {
467
470
  const m = W.useManualTiming ? i.timestamp : performance.now();
468
- n = !1, W.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(m - i.timestamp, $i), 1)), i.timestamp = m, i.isProcessing = !0, a.process(i), l.process(i), u.process(i), c.process(i), d.process(i), f.process(i), h.process(i), g.process(i), i.isProcessing = !1, n && t && (s = !1, e(y));
471
+ n = !1, W.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(m - i.timestamp, Gi), 1)), i.timestamp = m, i.isProcessing = !0, a.process(i), l.process(i), u.process(i), c.process(i), f.process(i), d.process(i), h.process(i), g.process(i), i.isProcessing = !1, n && t && (s = !1, e(y));
469
472
  }, T = () => {
470
473
  n = !0, s = !0, i.isProcessing || e(y);
471
474
  };
472
- return { schedule: Te.reduce((m, C) => {
475
+ return { schedule: Se.reduce((m, C) => {
473
476
  const w = o[C];
474
477
  return m[C] = (A, x = !1, S = !1) => (n || T(), w.schedule(A, x, S)), m;
475
478
  }, {}), cancel: (m) => {
476
- for (let C = 0; C < Te.length; C++)
477
- o[Te[C]].cancel(m);
479
+ for (let C = 0; C < Se.length; C++)
480
+ o[Se[C]].cancel(m);
478
481
  }, state: i, steps: o };
479
482
  }
480
- const { schedule: k, cancel: Ye, state: Ae } = /* @__PURE__ */ jn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : ie, !0);
481
- let Se;
482
- function _i() {
483
- Se = void 0;
483
+ const { schedule: N, cancel: Xe, state: Me } = /* @__PURE__ */ Hn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : ae, !0);
484
+ let Ve;
485
+ function Hi() {
486
+ Ve = void 0;
484
487
  }
485
- const L = {
486
- now: () => (Se === void 0 && L.set(Ae.isProcessing || W.useManualTiming ? Ae.timestamp : performance.now()), Se),
488
+ const I = {
489
+ now: () => (Ve === void 0 && I.set(Me.isProcessing || W.useManualTiming ? Me.timestamp : performance.now()), Ve),
487
490
  set: (e) => {
488
- Se = e, queueMicrotask(_i);
491
+ Ve = e, queueMicrotask(Hi);
489
492
  }
490
- }, Un = (e) => (t) => typeof t == "string" && t.startsWith(e), Gn = /* @__PURE__ */ Un("--"), ji = /* @__PURE__ */ Un("var(--"), bt = (e) => ji(e) ? Ui.test(e.split("/*")[0].trim()) : !1, Ui = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, re = {
493
+ }, zn = (e) => (t) => typeof t == "string" && t.startsWith(e), Yn = /* @__PURE__ */ zn("--"), zi = /* @__PURE__ */ zn("var(--"), Tt = (e) => zi(e) ? Yi.test(e.split("/*")[0].trim()) : !1, Yi = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, ce = {
491
494
  test: (e) => typeof e == "number",
492
495
  parse: parseFloat,
493
496
  transform: (e) => e
494
- }, he = {
495
- ...re,
496
- transform: (e) => H(0, 1, e)
497
- }, we = {
498
- ...re,
497
+ }, ge = {
498
+ ...ce,
499
+ transform: (e) => Y(0, 1, e)
500
+ }, xe = {
501
+ ...ce,
499
502
  default: 1
500
- }, de = (e) => Math.round(e * 1e5) / 1e5, vt = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
501
- function Gi(e) {
503
+ }, me = (e) => Math.round(e * 1e5) / 1e5, wt = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
504
+ function Xi(e) {
502
505
  return e == null;
503
506
  }
504
- const zi = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Tt = (e, t) => (n) => !!(typeof n == "string" && zi.test(n) && n.startsWith(e) || t && !Gi(n) && Object.prototype.hasOwnProperty.call(n, t)), zn = (e, t, n) => (s) => {
507
+ const qi = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, St = (e, t) => (n) => !!(typeof n == "string" && qi.test(n) && n.startsWith(e) || t && !Xi(n) && Object.prototype.hasOwnProperty.call(n, t)), Xn = (e, t, n) => (s) => {
505
508
  if (typeof s != "string")
506
509
  return s;
507
- const [i, r, o, a] = s.match(vt);
510
+ const [i, r, o, a] = s.match(wt);
508
511
  return {
509
512
  [e]: parseFloat(i),
510
513
  [t]: parseFloat(r),
511
514
  [n]: parseFloat(o),
512
515
  alpha: a !== void 0 ? parseFloat(a) : 1
513
516
  };
514
- }, Hi = (e) => H(0, 255, e), We = {
515
- ...re,
516
- transform: (e) => Math.round(Hi(e))
517
- }, j = {
518
- test: /* @__PURE__ */ Tt("rgb", "red"),
519
- parse: /* @__PURE__ */ zn("red", "green", "blue"),
520
- transform: ({ red: e, green: t, blue: n, alpha: s = 1 }) => "rgba(" + We.transform(e) + ", " + We.transform(t) + ", " + We.transform(n) + ", " + de(he.transform(s)) + ")"
517
+ }, Zi = (e) => Y(0, 255, e), We = {
518
+ ...ce,
519
+ transform: (e) => Math.round(Zi(e))
520
+ }, U = {
521
+ test: /* @__PURE__ */ St("rgb", "red"),
522
+ parse: /* @__PURE__ */ Xn("red", "green", "blue"),
523
+ transform: ({ red: e, green: t, blue: n, alpha: s = 1 }) => "rgba(" + We.transform(e) + ", " + We.transform(t) + ", " + We.transform(n) + ", " + me(ge.transform(s)) + ")"
521
524
  };
522
- function Yi(e) {
525
+ function Ji(e) {
523
526
  let t = "", n = "", s = "", i = "";
524
527
  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), {
525
528
  red: parseInt(t, 16),
@@ -528,76 +531,76 @@ function Yi(e) {
528
531
  alpha: i ? parseInt(i, 16) / 255 : 1
529
532
  };
530
533
  }
531
- const Xe = {
532
- test: /* @__PURE__ */ Tt("#"),
533
- parse: Yi,
534
- transform: j.transform
535
- }, ve = /* @__NO_SIDE_EFFECTS__ */ (e) => ({
534
+ const qe = {
535
+ test: /* @__PURE__ */ St("#"),
536
+ parse: Ji,
537
+ transform: U.transform
538
+ }, we = /* @__NO_SIDE_EFFECTS__ */ (e) => ({
536
539
  test: (t) => typeof t == "string" && t.endsWith(e) && t.split(" ").length === 1,
537
540
  parse: parseFloat,
538
541
  transform: (t) => `${t}${e}`
539
- }), $ = /* @__PURE__ */ ve("deg"), Q = /* @__PURE__ */ ve("%"), b = /* @__PURE__ */ ve("px"), Xi = /* @__PURE__ */ ve("vh"), qi = /* @__PURE__ */ ve("vw"), Gt = {
540
- ...Q,
541
- parse: (e) => Q.parse(e) / 100,
542
- transform: (e) => Q.transform(e * 100)
543
- }, q = {
544
- test: /* @__PURE__ */ Tt("hsl", "hue"),
545
- parse: /* @__PURE__ */ zn("hue", "saturation", "lightness"),
546
- transform: ({ hue: e, saturation: t, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(e) + ", " + Q.transform(de(t)) + ", " + Q.transform(de(n)) + ", " + de(he.transform(s)) + ")"
542
+ }), $ = /* @__PURE__ */ we("deg"), te = /* @__PURE__ */ we("%"), b = /* @__PURE__ */ we("px"), Qi = /* @__PURE__ */ we("vh"), er = /* @__PURE__ */ we("vw"), Yt = {
543
+ ...te,
544
+ parse: (e) => te.parse(e) / 100,
545
+ transform: (e) => te.transform(e * 100)
546
+ }, J = {
547
+ test: /* @__PURE__ */ St("hsl", "hue"),
548
+ parse: /* @__PURE__ */ Xn("hue", "saturation", "lightness"),
549
+ transform: ({ hue: e, saturation: t, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(e) + ", " + te.transform(me(t)) + ", " + te.transform(me(n)) + ", " + me(ge.transform(s)) + ")"
547
550
  }, E = {
548
- test: (e) => j.test(e) || Xe.test(e) || q.test(e),
549
- parse: (e) => j.test(e) ? j.parse(e) : q.test(e) ? q.parse(e) : Xe.parse(e),
550
- transform: (e) => typeof e == "string" ? e : e.hasOwnProperty("red") ? j.transform(e) : q.transform(e),
551
+ test: (e) => U.test(e) || qe.test(e) || J.test(e),
552
+ parse: (e) => U.test(e) ? U.parse(e) : J.test(e) ? J.parse(e) : qe.parse(e),
553
+ transform: (e) => typeof e == "string" ? e : e.hasOwnProperty("red") ? U.transform(e) : J.transform(e),
551
554
  getAnimatableNone: (e) => {
552
555
  const t = E.parse(e);
553
556
  return t.alpha = 0, E.transform(t);
554
557
  }
555
- }, Zi = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
556
- function Ji(e) {
558
+ }, tr = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
559
+ function nr(e) {
557
560
  var t, n;
558
- return isNaN(e) && typeof e == "string" && (((t = e.match(vt)) == null ? void 0 : t.length) || 0) + (((n = e.match(Zi)) == null ? void 0 : n.length) || 0) > 0;
561
+ return isNaN(e) && typeof e == "string" && (((t = e.match(wt)) == null ? void 0 : t.length) || 0) + (((n = e.match(tr)) == null ? void 0 : n.length) || 0) > 0;
559
562
  }
560
- const Hn = "number", Yn = "color", Qi = "var", er = "var(", zt = "${}", tr = /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;
561
- function pe(e) {
563
+ const qn = "number", Zn = "color", sr = "var", ir = "var(", Xt = "${}", rr = /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;
564
+ function ye(e) {
562
565
  const t = e.toString(), n = [], s = {
563
566
  color: [],
564
567
  number: [],
565
568
  var: []
566
569
  }, i = [];
567
570
  let r = 0;
568
- const a = t.replace(tr, (l) => (E.test(l) ? (s.color.push(r), i.push(Yn), n.push(E.parse(l))) : l.startsWith(er) ? (s.var.push(r), i.push(Qi), n.push(l)) : (s.number.push(r), i.push(Hn), n.push(parseFloat(l))), ++r, zt)).split(zt);
571
+ const a = t.replace(rr, (l) => (E.test(l) ? (s.color.push(r), i.push(Zn), n.push(E.parse(l))) : l.startsWith(ir) ? (s.var.push(r), i.push(sr), n.push(l)) : (s.number.push(r), i.push(qn), n.push(parseFloat(l))), ++r, Xt)).split(Xt);
569
572
  return { values: n, split: a, indexes: s, types: i };
570
573
  }
571
- function Xn(e) {
572
- return pe(e).values;
574
+ function Jn(e) {
575
+ return ye(e).values;
573
576
  }
574
- function qn(e) {
575
- const { split: t, types: n } = pe(e), s = t.length;
577
+ function Qn(e) {
578
+ const { split: t, types: n } = ye(e), s = t.length;
576
579
  return (i) => {
577
580
  let r = "";
578
581
  for (let o = 0; o < s; o++)
579
582
  if (r += t[o], i[o] !== void 0) {
580
583
  const a = n[o];
581
- a === Hn ? r += de(i[o]) : a === Yn ? r += E.transform(i[o]) : r += i[o];
584
+ a === qn ? r += me(i[o]) : a === Zn ? r += E.transform(i[o]) : r += i[o];
582
585
  }
583
586
  return r;
584
587
  };
585
588
  }
586
- const nr = (e) => typeof e == "number" ? 0 : E.test(e) ? E.getAnimatableNone(e) : e;
587
- function sr(e) {
588
- const t = Xn(e);
589
- return qn(e)(t.map(nr));
589
+ const or = (e) => typeof e == "number" ? 0 : E.test(e) ? E.getAnimatableNone(e) : e;
590
+ function ar(e) {
591
+ const t = Jn(e);
592
+ return Qn(e)(t.map(or));
590
593
  }
591
- const oe = {
592
- test: Ji,
593
- parse: Xn,
594
- createTransformer: qn,
595
- getAnimatableNone: sr
594
+ const ue = {
595
+ test: nr,
596
+ parse: Jn,
597
+ createTransformer: Qn,
598
+ getAnimatableNone: ar
596
599
  };
597
600
  function $e(e, t, n) {
598
601
  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;
599
602
  }
600
- function ir({ hue: e, saturation: t, lightness: n, alpha: s }) {
603
+ function cr({ hue: e, saturation: t, lightness: n, alpha: s }) {
601
604
  e /= 360, t /= 100, n /= 100;
602
605
  let i = 0, r = 0, o = 0;
603
606
  if (!t)
@@ -613,55 +616,55 @@ function ir({ hue: e, saturation: t, lightness: n, alpha: s }) {
613
616
  alpha: s
614
617
  };
615
618
  }
616
- function Ce(e, t) {
619
+ function Pe(e, t) {
617
620
  return (n) => n > 0 ? t : e;
618
621
  }
619
- const Oe = (e, t, n) => e + (t - e) * n, _e = (e, t, n) => {
622
+ const Ie = (e, t, n) => e + (t - e) * n, je = (e, t, n) => {
620
623
  const s = e * e, i = n * (t * t - s) + s;
621
624
  return i < 0 ? 0 : Math.sqrt(i);
622
- }, rr = [Xe, j, q], or = (e) => rr.find((t) => t.test(e));
623
- function Ht(e) {
624
- const t = or(e);
625
- if (ye(!!t, `'${e}' is not an animatable color. Use the equivalent color code instead.`), !t)
625
+ }, ur = [qe, U, J], lr = (e) => ur.find((t) => t.test(e));
626
+ function qt(e) {
627
+ const t = lr(e);
628
+ if (ve(!!t, `'${e}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !t)
626
629
  return !1;
627
630
  let n = t.parse(e);
628
- return t === q && (n = ir(n)), n;
631
+ return t === J && (n = cr(n)), n;
629
632
  }
630
- const Yt = (e, t) => {
631
- const n = Ht(e), s = Ht(t);
633
+ const Zt = (e, t) => {
634
+ const n = qt(e), s = qt(t);
632
635
  if (!n || !s)
633
- return Ce(e, t);
636
+ return Pe(e, t);
634
637
  const i = { ...n };
635
- return (r) => (i.red = _e(n.red, s.red, r), i.green = _e(n.green, s.green, r), i.blue = _e(n.blue, s.blue, r), i.alpha = Oe(n.alpha, s.alpha, r), j.transform(i));
636
- }, qe = /* @__PURE__ */ new Set(["none", "hidden"]);
637
- function ar(e, t) {
638
- return qe.has(e) ? (n) => n <= 0 ? e : t : (n) => n >= 1 ? t : e;
638
+ return (r) => (i.red = je(n.red, s.red, r), i.green = je(n.green, s.green, r), i.blue = je(n.blue, s.blue, r), i.alpha = Ie(n.alpha, s.alpha, r), U.transform(i));
639
+ }, Ze = /* @__PURE__ */ new Set(["none", "hidden"]);
640
+ function fr(e, t) {
641
+ return Ze.has(e) ? (n) => n <= 0 ? e : t : (n) => n >= 1 ? t : e;
639
642
  }
640
- function cr(e, t) {
641
- return (n) => Oe(e, t, n);
643
+ function dr(e, t) {
644
+ return (n) => Ie(e, t, n);
642
645
  }
643
- function wt(e) {
644
- return typeof e == "number" ? cr : typeof e == "string" ? bt(e) ? Ce : E.test(e) ? Yt : fr : Array.isArray(e) ? Zn : typeof e == "object" ? E.test(e) ? Yt : ur : Ce;
646
+ function xt(e) {
647
+ return typeof e == "number" ? dr : typeof e == "string" ? Tt(e) ? Pe : E.test(e) ? Zt : mr : Array.isArray(e) ? es : typeof e == "object" ? E.test(e) ? Zt : hr : Pe;
645
648
  }
646
- function Zn(e, t) {
647
- const n = [...e], s = n.length, i = e.map((r, o) => wt(r)(r, t[o]));
649
+ function es(e, t) {
650
+ const n = [...e], s = n.length, i = e.map((r, o) => xt(r)(r, t[o]));
648
651
  return (r) => {
649
652
  for (let o = 0; o < s; o++)
650
653
  n[o] = i[o](r);
651
654
  return n;
652
655
  };
653
656
  }
654
- function ur(e, t) {
657
+ function hr(e, t) {
655
658
  const n = { ...e, ...t }, s = {};
656
659
  for (const i in n)
657
- e[i] !== void 0 && t[i] !== void 0 && (s[i] = wt(e[i])(e[i], t[i]));
660
+ e[i] !== void 0 && t[i] !== void 0 && (s[i] = xt(e[i])(e[i], t[i]));
658
661
  return (i) => {
659
662
  for (const r in s)
660
663
  n[r] = s[r](i);
661
664
  return n;
662
665
  };
663
666
  }
664
- function lr(e, t) {
667
+ function pr(e, t) {
665
668
  const n = [], s = { color: 0, var: 0, number: 0 };
666
669
  for (let i = 0; i < t.values.length; i++) {
667
670
  const r = t.types[i], o = e.indexes[r][s[r]], a = e.values[o] ?? 0;
@@ -669,51 +672,51 @@ function lr(e, t) {
669
672
  }
670
673
  return n;
671
674
  }
672
- const fr = (e, t) => {
673
- const n = oe.createTransformer(t), s = pe(e), i = pe(t);
674
- 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 ? qe.has(e) && !i.values.length || qe.has(t) && !s.values.length ? ar(e, t) : Re(Zn(lr(s, i), i.values), n) : (ye(!0, `Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), Ce(e, t));
675
+ const mr = (e, t) => {
676
+ const n = ue.createTransformer(t), s = ye(e), i = ye(t);
677
+ 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 ? Ze.has(e) && !i.values.length || Ze.has(t) && !s.values.length ? fr(e, t) : Le(es(pr(s, i), i.values), n) : (ve(!0, `Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), Pe(e, t));
675
678
  };
676
- function Jn(e, t, n) {
677
- return typeof e == "number" && typeof t == "number" && typeof n == "number" ? Oe(e, t, n) : wt(e)(e, t);
679
+ function ts(e, t, n) {
680
+ return typeof e == "number" && typeof t == "number" && typeof n == "number" ? Ie(e, t, n) : xt(e)(e, t);
678
681
  }
679
- const dr = (e) => {
682
+ const gr = (e) => {
680
683
  const t = ({ timestamp: n }) => e(n);
681
684
  return {
682
- start: (n = !0) => k.update(t, n),
683
- stop: () => Ye(t),
685
+ start: (n = !0) => N.update(t, n),
686
+ stop: () => Xe(t),
684
687
  /**
685
688
  * If we're processing this frame we can use the
686
689
  * framelocked timestamp to keep things in sync.
687
690
  */
688
- now: () => Ae.isProcessing ? Ae.timestamp : L.now()
691
+ now: () => Me.isProcessing ? Me.timestamp : I.now()
689
692
  };
690
- }, Qn = (e, t, n = 10) => {
693
+ }, ns = (e, t, n = 10) => {
691
694
  let s = "";
692
695
  const i = Math.max(Math.round(t / n), 2);
693
696
  for (let r = 0; r < i; r++)
694
697
  s += Math.round(e(r / (i - 1)) * 1e4) / 1e4 + ", ";
695
698
  return `linear(${s.substring(0, s.length - 2)})`;
696
- }, Me = 2e4;
697
- function St(e) {
699
+ }, Ee = 2e4;
700
+ function Vt(e) {
698
701
  let t = 0;
699
702
  const n = 50;
700
703
  let s = e.next(t);
701
- for (; !s.done && t < Me; )
704
+ for (; !s.done && t < Ee; )
702
705
  t += n, s = e.next(t);
703
- return t >= Me ? 1 / 0 : t;
706
+ return t >= Ee ? 1 / 0 : t;
704
707
  }
705
- function hr(e, t = 100, n) {
706
- const s = n({ ...e, keyframes: [0, t] }), i = Math.min(St(s), Me);
708
+ function yr(e, t = 100, n) {
709
+ const s = n({ ...e, keyframes: [0, t] }), i = Math.min(Vt(s), Ee);
707
710
  return {
708
711
  type: "keyframes",
709
712
  ease: (r) => s.next(i * r).value / t,
710
713
  duration: /* @__PURE__ */ K(i)
711
714
  };
712
715
  }
713
- const pr = 5;
714
- function es(e, t, n) {
715
- const s = Math.max(t - pr, 0);
716
- return Rn(n - e(s), t - s);
716
+ const br = 5;
717
+ function ss(e, t, n) {
718
+ const s = Math.max(t - br, 0);
719
+ return In(n - e(s), t - s);
717
720
  }
718
721
  const P = {
719
722
  // Default spring physics
@@ -743,26 +746,26 @@ const P = {
743
746
  // in seconds
744
747
  minDamping: 0.05,
745
748
  maxDamping: 1
746
- }, je = 1e-3;
747
- function mr({ duration: e = P.duration, bounce: t = P.bounce, velocity: n = P.velocity, mass: s = P.mass }) {
749
+ }, _e = 1e-3;
750
+ function vr({ duration: e = P.duration, bounce: t = P.bounce, velocity: n = P.velocity, mass: s = P.mass }) {
748
751
  let i, r;
749
- ye(e <= /* @__PURE__ */ N(P.maxDuration), "Spring duration must be 10 seconds or less");
752
+ ve(e <= /* @__PURE__ */ B(P.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
750
753
  let o = 1 - t;
751
- o = H(P.minDamping, P.maxDamping, o), e = H(P.minDuration, P.maxDuration, /* @__PURE__ */ K(e)), o < 1 ? (i = (u) => {
752
- const c = u * o, d = c * e, f = c - n, h = Ze(u, o), g = Math.exp(-d);
753
- return je - f / h * g;
754
+ o = Y(P.minDamping, P.maxDamping, o), e = Y(P.minDuration, P.maxDuration, /* @__PURE__ */ K(e)), o < 1 ? (i = (u) => {
755
+ const c = u * o, f = c * e, d = c - n, h = Je(u, o), g = Math.exp(-f);
756
+ return _e - d / h * g;
754
757
  }, r = (u) => {
755
- const d = u * o * e, f = d * n + n, h = Math.pow(o, 2) * Math.pow(u, 2) * e, g = Math.exp(-d), y = Ze(Math.pow(u, 2), o);
756
- return (-i(u) + je > 0 ? -1 : 1) * ((f - h) * g) / y;
758
+ const f = u * o * e, d = f * n + n, h = Math.pow(o, 2) * Math.pow(u, 2) * e, g = Math.exp(-f), y = Je(Math.pow(u, 2), o);
759
+ return (-i(u) + _e > 0 ? -1 : 1) * ((d - h) * g) / y;
757
760
  }) : (i = (u) => {
758
- const c = Math.exp(-u * e), d = (u - n) * e + 1;
759
- return -je + c * d;
761
+ const c = Math.exp(-u * e), f = (u - n) * e + 1;
762
+ return -_e + c * f;
760
763
  }, r = (u) => {
761
- const c = Math.exp(-u * e), d = (n - u) * (e * e);
762
- return c * d;
764
+ const c = Math.exp(-u * e), f = (n - u) * (e * e);
765
+ return c * f;
763
766
  });
764
- const a = 5 / e, l = yr(i, r, a);
765
- if (e = /* @__PURE__ */ N(e), isNaN(l))
767
+ const a = 5 / e, l = wr(i, r, a);
768
+ if (e = /* @__PURE__ */ B(e), isNaN(l))
766
769
  return {
767
770
  stiffness: P.stiffness,
768
771
  damping: P.damping,
@@ -777,21 +780,21 @@ function mr({ duration: e = P.duration, bounce: t = P.bounce, velocity: n = P.ve
777
780
  };
778
781
  }
779
782
  }
780
- const gr = 12;
781
- function yr(e, t, n) {
783
+ const Tr = 12;
784
+ function wr(e, t, n) {
782
785
  let s = n;
783
- for (let i = 1; i < gr; i++)
786
+ for (let i = 1; i < Tr; i++)
784
787
  s = s - e(s) / t(s);
785
788
  return s;
786
789
  }
787
- function Ze(e, t) {
790
+ function Je(e, t) {
788
791
  return e * Math.sqrt(1 - t * t);
789
792
  }
790
- const br = ["duration", "bounce"], vr = ["stiffness", "damping", "mass"];
791
- function Xt(e, t) {
793
+ const Sr = ["duration", "bounce"], xr = ["stiffness", "damping", "mass"];
794
+ function Jt(e, t) {
792
795
  return t.some((n) => e[n] !== void 0);
793
796
  }
794
- function Tr(e) {
797
+ function Vr(e) {
795
798
  let t = {
796
799
  velocity: P.velocity,
797
800
  stiffness: P.stiffness,
@@ -800,9 +803,9 @@ function Tr(e) {
800
803
  isResolvedFromDuration: !1,
801
804
  ...e
802
805
  };
803
- if (!Xt(e, vr) && Xt(e, br))
806
+ if (!Jt(e, xr) && Jt(e, Sr))
804
807
  if (e.visualDuration) {
805
- const n = e.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * H(0.05, 1, 1 - (e.bounce || 0)) * Math.sqrt(i);
808
+ 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);
806
809
  t = {
807
810
  ...t,
808
811
  mass: P.mass,
@@ -810,7 +813,7 @@ function Tr(e) {
810
813
  damping: r
811
814
  };
812
815
  } else {
813
- const n = mr(e);
816
+ const n = vr(e);
814
817
  t = {
815
818
  ...t,
816
819
  ...n,
@@ -819,21 +822,21 @@ function Tr(e) {
819
822
  }
820
823
  return t;
821
824
  }
822
- function Pe(e = P.visualDuration, t = P.bounce) {
825
+ function De(e = P.visualDuration, t = P.bounce) {
823
826
  const n = typeof e != "object" ? {
824
827
  visualDuration: e,
825
828
  keyframes: [0, 1],
826
829
  bounce: t
827
830
  } : e;
828
831
  let { restSpeed: s, restDelta: i } = n;
829
- const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: r }, { stiffness: l, damping: u, mass: c, duration: d, velocity: f, isResolvedFromDuration: h } = Tr({
832
+ const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: r }, { stiffness: l, damping: u, mass: c, duration: f, velocity: d, isResolvedFromDuration: h } = Vr({
830
833
  ...n,
831
834
  velocity: -/* @__PURE__ */ K(n.velocity || 0)
832
- }), g = f || 0, y = u / (2 * Math.sqrt(l * c)), T = o - r, p = /* @__PURE__ */ K(Math.sqrt(l / c)), V = Math.abs(T) < 5;
835
+ }), g = d || 0, y = u / (2 * Math.sqrt(l * c)), T = o - r, p = /* @__PURE__ */ K(Math.sqrt(l / c)), V = Math.abs(T) < 5;
833
836
  s || (s = V ? P.restSpeed.granular : P.restSpeed.default), i || (i = V ? P.restDelta.granular : P.restDelta.default);
834
837
  let m;
835
838
  if (y < 1) {
836
- const w = Ze(p, y);
839
+ const w = Je(p, y);
837
840
  m = (A) => {
838
841
  const x = Math.exp(-y * p * A);
839
842
  return o - x * ((g + y * p * T) / w * Math.sin(w * A) + T * Math.cos(w * A));
@@ -848,21 +851,21 @@ function Pe(e = P.visualDuration, t = P.bounce) {
848
851
  };
849
852
  }
850
853
  const C = {
851
- calculatedDuration: h && d || null,
854
+ calculatedDuration: h && f || null,
852
855
  next: (w) => {
853
856
  const A = m(w);
854
857
  if (h)
855
- a.done = w >= d;
858
+ a.done = w >= f;
856
859
  else {
857
860
  let x = w === 0 ? g : 0;
858
- y < 1 && (x = w === 0 ? /* @__PURE__ */ N(g) : es(m, w, A));
861
+ y < 1 && (x = w === 0 ? /* @__PURE__ */ B(g) : ss(m, w, A));
859
862
  const S = Math.abs(x) <= s, D = Math.abs(o - A) <= i;
860
863
  a.done = S && D;
861
864
  }
862
865
  return a.value = a.done ? o : A, a;
863
866
  },
864
867
  toString: () => {
865
- const w = Math.min(St(C), Me), A = Qn((x) => C.next(w * x).value, w, 30);
868
+ const w = Math.min(Vt(C), Ee), A = ns((x) => C.next(w * x).value, w, 30);
866
869
  return w + "ms " + A;
867
870
  },
868
871
  toTransition: () => {
@@ -870,27 +873,27 @@ function Pe(e = P.visualDuration, t = P.bounce) {
870
873
  };
871
874
  return C;
872
875
  }
873
- Pe.applyToOptions = (e) => {
874
- const t = hr(e, 100, Pe);
875
- return e.ease = t.ease, e.duration = /* @__PURE__ */ N(t.duration), e.type = "keyframes", e;
876
+ De.applyToOptions = (e) => {
877
+ const t = yr(e, 100, De);
878
+ return e.ease = t.ease, e.duration = /* @__PURE__ */ B(t.duration), e.type = "keyframes", e;
876
879
  };
877
- function Je({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: l, restDelta: u = 0.5, restSpeed: c }) {
878
- const d = e[0], f = {
880
+ function Qe({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: l, restDelta: u = 0.5, restSpeed: c }) {
881
+ const f = e[0], d = {
879
882
  done: !1,
880
- value: d
883
+ value: f
881
884
  }, h = (S) => a !== void 0 && S < a || l !== void 0 && S > l, g = (S) => a === void 0 ? l : l === void 0 || Math.abs(a - S) < Math.abs(l - S) ? a : l;
882
885
  let y = n * t;
883
- const T = d + y, p = o === void 0 ? T : o(T);
884
- p !== T && (y = p - d);
886
+ const T = f + y, p = o === void 0 ? T : o(T);
887
+ p !== T && (y = p - f);
885
888
  const V = (S) => -y * Math.exp(-S / s), m = (S) => p + V(S), C = (S) => {
886
- const D = V(S), F = m(S);
887
- f.done = Math.abs(D) <= u, f.value = f.done ? p : F;
889
+ const D = V(S), O = m(S);
890
+ d.done = Math.abs(D) <= u, d.value = d.done ? p : O;
888
891
  };
889
892
  let w, A;
890
893
  const x = (S) => {
891
- h(f.value) && (w = S, A = Pe({
892
- keyframes: [f.value, g(f.value)],
893
- velocity: es(m, S, f.value),
894
+ h(d.value) && (w = S, A = De({
895
+ keyframes: [d.value, g(d.value)],
896
+ velocity: ss(m, S, d.value),
894
897
  // TODO: This should be passing * 1000
895
898
  damping: i,
896
899
  stiffness: r,
@@ -902,92 +905,92 @@ function Je({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 3
902
905
  calculatedDuration: null,
903
906
  next: (S) => {
904
907
  let D = !1;
905
- return !A && w === void 0 && (D = !0, C(S), x(S)), w !== void 0 && S >= w ? A.next(S - w) : (!D && C(S), f);
908
+ return !A && w === void 0 && (D = !0, C(S), x(S)), w !== void 0 && S >= w ? A.next(S - w) : (!D && C(S), d);
906
909
  }
907
910
  };
908
911
  }
909
- function wr(e, t, n) {
910
- const s = [], i = n || W.mix || Jn, r = e.length - 1;
912
+ function Ar(e, t, n) {
913
+ const s = [], i = n || W.mix || ts, r = e.length - 1;
911
914
  for (let o = 0; o < r; o++) {
912
915
  let a = i(e[o], e[o + 1]);
913
916
  if (t) {
914
- const l = Array.isArray(t) ? t[o] || ie : t;
915
- a = Re(l, a);
917
+ const l = Array.isArray(t) ? t[o] || ae : t;
918
+ a = Le(l, a);
916
919
  }
917
920
  s.push(a);
918
921
  }
919
922
  return s;
920
923
  }
921
- function Sr(e, t, { clamp: n = !0, ease: s, mixer: i } = {}) {
924
+ function Cr(e, t, { clamp: n = !0, ease: s, mixer: i } = {}) {
922
925
  const r = e.length;
923
- if (Y(r === t.length, "Both input and output ranges must be the same length"), r === 1)
926
+ if (X(r === t.length, "Both input and output ranges must be the same length", "range-length"), r === 1)
924
927
  return () => t[0];
925
928
  if (r === 2 && t[0] === t[1])
926
929
  return () => t[1];
927
930
  const o = e[0] === e[1];
928
931
  e[0] > e[r - 1] && (e = [...e].reverse(), t = [...t].reverse());
929
- const a = wr(t, s, i), l = a.length, u = (c) => {
932
+ const a = Ar(t, s, i), l = a.length, u = (c) => {
930
933
  if (o && c < e[0])
931
934
  return t[0];
932
- let d = 0;
935
+ let f = 0;
933
936
  if (l > 1)
934
- for (; d < e.length - 2 && !(c < e[d + 1]); d++)
937
+ for (; f < e.length - 2 && !(c < e[f + 1]); f++)
935
938
  ;
936
- const f = /* @__PURE__ */ Dn(e[d], e[d + 1], c);
937
- return a[d](f);
939
+ const d = /* @__PURE__ */ Rn(e[f], e[f + 1], c);
940
+ return a[f](d);
938
941
  };
939
- return n ? (c) => u(H(e[0], e[r - 1], c)) : u;
942
+ return n ? (c) => u(Y(e[0], e[r - 1], c)) : u;
940
943
  }
941
- function xr(e, t) {
944
+ function Mr(e, t) {
942
945
  const n = e[e.length - 1];
943
946
  for (let s = 1; s <= t; s++) {
944
- const i = /* @__PURE__ */ Dn(0, t, s);
945
- e.push(Oe(n, 1, i));
947
+ const i = /* @__PURE__ */ Rn(0, t, s);
948
+ e.push(Ie(n, 1, i));
946
949
  }
947
950
  }
948
- function Vr(e) {
951
+ function Pr(e) {
949
952
  const t = [0];
950
- return xr(t, e.length - 1), t;
953
+ return Mr(t, e.length - 1), t;
951
954
  }
952
- function Ar(e, t) {
955
+ function Er(e, t) {
953
956
  return e.map((n) => n * t);
954
957
  }
955
- function Cr(e, t) {
956
- return e.map(() => t || $n).splice(0, e.length - 1);
958
+ function Dr(e, t) {
959
+ return e.map(() => t || Un).splice(0, e.length - 1);
957
960
  }
958
- function Z({ duration: e = 300, keyframes: t, times: n, ease: s = "easeInOut" }) {
959
- const i = Bi(s) ? s.map(Ut) : Ut(s), r = {
961
+ function Q({ duration: e = 300, keyframes: t, times: n, ease: s = "easeInOut" }) {
962
+ const i = ji(s) ? s.map(zt) : zt(s), r = {
960
963
  done: !1,
961
964
  value: t[0]
962
- }, o = Ar(
965
+ }, o = Er(
963
966
  // Only use the provided offsets if they're the correct length
964
967
  // TODO Maybe we should warn here if there's a length mismatch
965
- n && n.length === t.length ? n : Vr(t),
968
+ n && n.length === t.length ? n : Pr(t),
966
969
  e
967
- ), a = Sr(o, t, {
968
- ease: Array.isArray(i) ? i : Cr(t, i)
970
+ ), a = Cr(o, t, {
971
+ ease: Array.isArray(i) ? i : Dr(t, i)
969
972
  });
970
973
  return {
971
974
  calculatedDuration: e,
972
975
  next: (l) => (r.value = a(l), r.done = l >= e, r)
973
976
  };
974
977
  }
975
- const Mr = (e) => e !== null;
976
- function xt(e, { repeat: t, repeatType: n = "loop" }, s, i = 1) {
977
- const r = e.filter(Mr), a = i < 0 || t && n !== "loop" && t % 2 === 1 ? 0 : r.length - 1;
978
+ const Fr = (e) => e !== null;
979
+ function At(e, { repeat: t, repeatType: n = "loop" }, s, i = 1) {
980
+ const r = e.filter(Fr), a = i < 0 || t && n !== "loop" && t % 2 === 1 ? 0 : r.length - 1;
978
981
  return !a || s === void 0 ? r[a] : s;
979
982
  }
980
- const Pr = {
981
- decay: Je,
982
- inertia: Je,
983
- tween: Z,
984
- keyframes: Z,
985
- spring: Pe
983
+ const Or = {
984
+ decay: Qe,
985
+ inertia: Qe,
986
+ tween: Q,
987
+ keyframes: Q,
988
+ spring: De
986
989
  };
987
- function ts(e) {
988
- typeof e.type == "string" && (e.type = Pr[e.type]);
990
+ function is(e) {
991
+ typeof e.type == "string" && (e.type = Or[e.type]);
989
992
  }
990
- class Vt {
993
+ class Ct {
991
994
  constructor() {
992
995
  this.updateFinished();
993
996
  }
@@ -1011,28 +1014,28 @@ class Vt {
1011
1014
  return this.finished.then(t, n);
1012
1015
  }
1013
1016
  }
1014
- const Er = (e) => e / 100;
1015
- class At extends Vt {
1017
+ const Rr = (e) => e / 100;
1018
+ class Mt extends Ct {
1016
1019
  constructor(t) {
1017
1020
  super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
1018
1021
  var s, i;
1019
1022
  const { motionValue: n } = this.options;
1020
- n && n.updatedAt !== L.now() && this.tick(L.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), (i = (s = this.options).onStop) == null || i.call(s));
1023
+ n && n.updatedAt !== I.now() && this.tick(I.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), (i = (s = this.options).onStop) == null || i.call(s));
1021
1024
  }, this.options = t, this.initAnimation(), this.play(), t.autoplay === !1 && this.pause();
1022
1025
  }
1023
1026
  initAnimation() {
1024
1027
  const { options: t } = this;
1025
- ts(t);
1026
- const { type: n = Z, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = t;
1028
+ is(t);
1029
+ const { type: n = Q, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = t;
1027
1030
  let { keyframes: a } = t;
1028
- const l = n || Z;
1029
- process.env.NODE_ENV !== "production" && l !== Z && Y(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`), l !== Z && typeof a[0] != "number" && (this.mixKeyframes = Re(Er, Jn(a[0], a[1])), a = [0, 100]);
1031
+ const l = n || Q;
1032
+ process.env.NODE_ENV !== "production" && l !== Q && X(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), l !== Q && typeof a[0] != "number" && (this.mixKeyframes = Le(Rr, ts(a[0], a[1])), a = [0, 100]);
1030
1033
  const u = l({ ...t, keyframes: a });
1031
1034
  r === "mirror" && (this.mirroredGenerator = l({
1032
1035
  ...t,
1033
1036
  keyframes: [...a].reverse(),
1034
1037
  velocity: -o
1035
- })), u.calculatedDuration === null && (u.calculatedDuration = St(u));
1038
+ })), u.calculatedDuration === null && (u.calculatedDuration = Vt(u));
1036
1039
  const { calculatedDuration: c } = u;
1037
1040
  this.calculatedDuration = c, this.resolvedDuration = c + i, this.totalDuration = this.resolvedDuration * (s + 1) - i, this.generator = u;
1038
1041
  }
@@ -1044,22 +1047,22 @@ class At extends Vt {
1044
1047
  const { generator: s, totalDuration: i, mixKeyframes: r, mirroredGenerator: o, resolvedDuration: a, calculatedDuration: l } = this;
1045
1048
  if (this.startTime === null)
1046
1049
  return s.next(0);
1047
- const { delay: u = 0, keyframes: c, repeat: d, repeatType: f, repeatDelay: h, type: g, onUpdate: y, finalKeyframe: T } = this.options;
1050
+ const { delay: u = 0, keyframes: c, repeat: f, repeatType: d, repeatDelay: h, type: g, onUpdate: y, finalKeyframe: T } = this.options;
1048
1051
  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);
1049
1052
  const p = this.currentTime - u * (this.playbackSpeed >= 0 ? 1 : -1), V = this.playbackSpeed >= 0 ? p < 0 : p > i;
1050
1053
  this.currentTime = Math.max(p, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i);
1051
1054
  let m = this.currentTime, C = s;
1052
- if (d) {
1055
+ if (f) {
1053
1056
  const S = Math.min(this.currentTime, i) / a;
1054
- let D = Math.floor(S), F = S % 1;
1055
- !F && S >= 1 && (F = 1), F === 1 && D--, D = Math.min(D, d + 1), !!(D % 2) && (f === "reverse" ? (F = 1 - F, h && (F -= h / a)) : f === "mirror" && (C = o)), m = H(0, 1, F) * a;
1057
+ let D = Math.floor(S), O = S % 1;
1058
+ !O && S >= 1 && (O = 1), O === 1 && D--, D = Math.min(D, f + 1), !!(D % 2) && (d === "reverse" ? (O = 1 - O, h && (O -= h / a)) : d === "mirror" && (C = o)), m = Y(0, 1, O) * a;
1056
1059
  }
1057
1060
  const w = V ? { done: !1, value: c[0] } : C.next(m);
1058
1061
  r && (w.value = r(w.value));
1059
1062
  let { done: A } = w;
1060
1063
  !V && l !== null && (A = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
1061
1064
  const x = this.holdTime === null && (this.state === "finished" || this.state === "running" && A);
1062
- return x && g !== Je && (w.value = xt(c, this.options, T, this.speed)), y && y(w.value), x && this.finish(), w;
1065
+ return x && g !== Qe && (w.value = At(c, this.options, T, this.speed)), y && y(w.value), x && this.finish(), w;
1063
1066
  }
1064
1067
  /**
1065
1068
  * Allows the returned animation to be awaited or promise-chained. Currently
@@ -1077,13 +1080,13 @@ class At extends Vt {
1077
1080
  }
1078
1081
  set time(t) {
1079
1082
  var n;
1080
- t = /* @__PURE__ */ N(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), (n = this.driver) == null || n.start(!1);
1083
+ t = /* @__PURE__ */ B(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), (n = this.driver) == null || n.start(!1);
1081
1084
  }
1082
1085
  get speed() {
1083
1086
  return this.playbackSpeed;
1084
1087
  }
1085
1088
  set speed(t) {
1086
- this.updateTime(L.now());
1089
+ this.updateTime(I.now());
1087
1090
  const n = this.playbackSpeed !== t;
1088
1091
  this.playbackSpeed = t, n && (this.time = /* @__PURE__ */ K(this.currentTime));
1089
1092
  }
@@ -1091,13 +1094,13 @@ class At extends Vt {
1091
1094
  var i, r;
1092
1095
  if (this.isStopped)
1093
1096
  return;
1094
- const { driver: t = dr, startTime: n } = this.options;
1097
+ const { driver: t = gr, startTime: n } = this.options;
1095
1098
  this.driver || (this.driver = t((o) => this.tick(o))), (r = (i = this.options).onPlay) == null || r.call(i);
1096
1099
  const s = this.driver.now();
1097
1100
  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();
1098
1101
  }
1099
1102
  pause() {
1100
- this.state = "paused", this.updateTime(L.now()), this.holdTime = this.currentTime;
1103
+ this.state = "paused", this.updateTime(I.now()), this.holdTime = this.currentTime;
1101
1104
  }
1102
1105
  complete() {
1103
1106
  this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
@@ -1124,14 +1127,14 @@ class At extends Vt {
1124
1127
  return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), (n = this.driver) == null || n.stop(), t.observe(this);
1125
1128
  }
1126
1129
  }
1127
- function Dr(e) {
1130
+ function Lr(e) {
1128
1131
  for (let t = 1; t < e.length; t++)
1129
1132
  e[t] ?? (e[t] = e[t - 1]);
1130
1133
  }
1131
- const U = (e) => e * 180 / Math.PI, Qe = (e) => {
1132
- const t = U(Math.atan2(e[1], e[0]));
1133
- return et(t);
1134
- }, Fr = {
1134
+ const G = (e) => e * 180 / Math.PI, et = (e) => {
1135
+ const t = G(Math.atan2(e[1], e[0]));
1136
+ return tt(t);
1137
+ }, Ir = {
1135
1138
  x: 4,
1136
1139
  y: 5,
1137
1140
  translateX: 4,
@@ -1139,56 +1142,56 @@ const U = (e) => e * 180 / Math.PI, Qe = (e) => {
1139
1142
  scaleX: 0,
1140
1143
  scaleY: 3,
1141
1144
  scale: (e) => (Math.abs(e[0]) + Math.abs(e[3])) / 2,
1142
- rotate: Qe,
1143
- rotateZ: Qe,
1144
- skewX: (e) => U(Math.atan(e[1])),
1145
- skewY: (e) => U(Math.atan(e[2])),
1145
+ rotate: et,
1146
+ rotateZ: et,
1147
+ skewX: (e) => G(Math.atan(e[1])),
1148
+ skewY: (e) => G(Math.atan(e[2])),
1146
1149
  skew: (e) => (Math.abs(e[1]) + Math.abs(e[2])) / 2
1147
- }, et = (e) => (e = e % 360, e < 0 && (e += 360), e), qt = Qe, Zt = (e) => Math.sqrt(e[0] * e[0] + e[1] * e[1]), Jt = (e) => Math.sqrt(e[4] * e[4] + e[5] * e[5]), Rr = {
1150
+ }, tt = (e) => (e = e % 360, e < 0 && (e += 360), e), Qt = et, en = (e) => Math.sqrt(e[0] * e[0] + e[1] * e[1]), tn = (e) => Math.sqrt(e[4] * e[4] + e[5] * e[5]), kr = {
1148
1151
  x: 12,
1149
1152
  y: 13,
1150
1153
  z: 14,
1151
1154
  translateX: 12,
1152
1155
  translateY: 13,
1153
1156
  translateZ: 14,
1154
- scaleX: Zt,
1155
- scaleY: Jt,
1156
- scale: (e) => (Zt(e) + Jt(e)) / 2,
1157
- rotateX: (e) => et(U(Math.atan2(e[6], e[5]))),
1158
- rotateY: (e) => et(U(Math.atan2(-e[2], e[0]))),
1159
- rotateZ: qt,
1160
- rotate: qt,
1161
- skewX: (e) => U(Math.atan(e[4])),
1162
- skewY: (e) => U(Math.atan(e[1])),
1157
+ scaleX: en,
1158
+ scaleY: tn,
1159
+ scale: (e) => (en(e) + tn(e)) / 2,
1160
+ rotateX: (e) => tt(G(Math.atan2(e[6], e[5]))),
1161
+ rotateY: (e) => tt(G(Math.atan2(-e[2], e[0]))),
1162
+ rotateZ: Qt,
1163
+ rotate: Qt,
1164
+ skewX: (e) => G(Math.atan(e[4])),
1165
+ skewY: (e) => G(Math.atan(e[1])),
1163
1166
  skew: (e) => (Math.abs(e[1]) + Math.abs(e[4])) / 2
1164
1167
  };
1165
- function tt(e) {
1168
+ function nt(e) {
1166
1169
  return e.includes("scale") ? 1 : 0;
1167
1170
  }
1168
- function nt(e, t) {
1171
+ function st(e, t) {
1169
1172
  if (!e || e === "none")
1170
- return tt(t);
1173
+ return nt(t);
1171
1174
  const n = e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
1172
1175
  let s, i;
1173
1176
  if (n)
1174
- s = Rr, i = n;
1177
+ s = kr, i = n;
1175
1178
  else {
1176
1179
  const a = e.match(/^matrix\(([-\d.e\s,]+)\)$/u);
1177
- s = Fr, i = a;
1180
+ s = Ir, i = a;
1178
1181
  }
1179
1182
  if (!i)
1180
- return tt(t);
1181
- const r = s[t], o = i[1].split(",").map(Lr);
1183
+ return nt(t);
1184
+ const r = s[t], o = i[1].split(",").map(Br);
1182
1185
  return typeof r == "function" ? r(o) : o[r];
1183
1186
  }
1184
- const Or = (e, t) => {
1187
+ const Nr = (e, t) => {
1185
1188
  const { transform: n = "none" } = getComputedStyle(e);
1186
- return nt(n, t);
1189
+ return st(n, t);
1187
1190
  };
1188
- function Lr(e) {
1191
+ function Br(e) {
1189
1192
  return parseFloat(e.trim());
1190
1193
  }
1191
- const ae = [
1194
+ const le = [
1192
1195
  "transformPerspective",
1193
1196
  "x",
1194
1197
  "y",
@@ -1206,15 +1209,15 @@ const ae = [
1206
1209
  "skew",
1207
1210
  "skewX",
1208
1211
  "skewY"
1209
- ], ce = new Set(ae), Qt = (e) => e === re || e === b, Ir = /* @__PURE__ */ new Set(["x", "y", "z"]), kr = ae.filter((e) => !Ir.has(e));
1210
- function Nr(e) {
1212
+ ], fe = new Set(le), nn = (e) => e === ce || e === b, Kr = /* @__PURE__ */ new Set(["x", "y", "z"]), Wr = le.filter((e) => !Kr.has(e));
1213
+ function $r(e) {
1211
1214
  const t = [];
1212
- return kr.forEach((n) => {
1215
+ return Wr.forEach((n) => {
1213
1216
  const s = e.getValue(n);
1214
1217
  s !== void 0 && (t.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
1215
1218
  }), t;
1216
1219
  }
1217
- const G = {
1220
+ const H = {
1218
1221
  // Dimensions
1219
1222
  width: ({ x: e }, { paddingLeft: t = "0", paddingRight: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
1220
1223
  height: ({ y: e }, { paddingTop: t = "0", paddingBottom: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
@@ -1223,18 +1226,18 @@ const G = {
1223
1226
  bottom: ({ y: e }, { top: t }) => parseFloat(t) + (e.max - e.min),
1224
1227
  right: ({ x: e }, { left: t }) => parseFloat(t) + (e.max - e.min),
1225
1228
  // Transform
1226
- x: (e, { transform: t }) => nt(t, "x"),
1227
- y: (e, { transform: t }) => nt(t, "y")
1229
+ x: (e, { transform: t }) => st(t, "x"),
1230
+ y: (e, { transform: t }) => st(t, "y")
1228
1231
  };
1229
- G.translateX = G.x;
1230
- G.translateY = G.y;
1232
+ H.translateX = H.x;
1233
+ H.translateY = H.y;
1231
1234
  const z = /* @__PURE__ */ new Set();
1232
- let st = !1, it = !1, rt = !1;
1233
- function ns() {
1234
- if (it) {
1235
+ let it = !1, rt = !1, ot = !1;
1236
+ function rs() {
1237
+ if (rt) {
1235
1238
  const e = Array.from(z).filter((s) => s.needsMeasurement), t = new Set(e.map((s) => s.element)), n = /* @__PURE__ */ new Map();
1236
1239
  t.forEach((s) => {
1237
- const i = Nr(s);
1240
+ const i = $r(s);
1238
1241
  i.length && (n.set(s, i), s.render());
1239
1242
  }), e.forEach((s) => s.measureInitialState()), t.forEach((s) => {
1240
1243
  s.render();
@@ -1247,22 +1250,22 @@ function ns() {
1247
1250
  s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
1248
1251
  });
1249
1252
  }
1250
- it = !1, st = !1, z.forEach((e) => e.complete(rt)), z.clear();
1253
+ rt = !1, it = !1, z.forEach((e) => e.complete(ot)), z.clear();
1251
1254
  }
1252
- function ss() {
1255
+ function os() {
1253
1256
  z.forEach((e) => {
1254
- e.readKeyframes(), e.needsMeasurement && (it = !0);
1257
+ e.readKeyframes(), e.needsMeasurement && (rt = !0);
1255
1258
  });
1256
1259
  }
1257
- function Br() {
1258
- rt = !0, ss(), ns(), rt = !1;
1260
+ function jr() {
1261
+ ot = !0, os(), rs(), ot = !1;
1259
1262
  }
1260
- class Ct {
1263
+ class Pt {
1261
1264
  constructor(t, n, s, i, r, o = !1) {
1262
1265
  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 = o;
1263
1266
  }
1264
1267
  scheduleResolve() {
1265
- this.state = "scheduled", this.isAsync ? (z.add(this), st || (st = !0, k.read(ss), k.resolveKeyframes(ns))) : (this.readKeyframes(), this.complete());
1268
+ this.state = "scheduled", this.isAsync ? (z.add(this), it || (it = !0, N.read(os), N.resolveKeyframes(rs))) : (this.readKeyframes(), this.complete());
1266
1269
  }
1267
1270
  readKeyframes() {
1268
1271
  const { unresolvedKeyframes: t, name: n, element: s, motionValue: i } = this;
@@ -1276,7 +1279,7 @@ class Ct {
1276
1279
  }
1277
1280
  t[0] === void 0 && (t[0] = o), i && r === void 0 && i.set(t[0]);
1278
1281
  }
1279
- Dr(t);
1282
+ Lr(t);
1280
1283
  }
1281
1284
  setFinalKeyframe() {
1282
1285
  }
@@ -1296,71 +1299,71 @@ class Ct {
1296
1299
  this.state === "pending" && this.scheduleResolve();
1297
1300
  }
1298
1301
  }
1299
- const Kr = (e) => e.startsWith("--");
1300
- function Wr(e, t, n) {
1301
- Kr(t) ? e.style.setProperty(t, n) : e.style[t] = n;
1302
+ const _r = (e) => e.startsWith("--");
1303
+ function Ur(e, t, n) {
1304
+ _r(t) ? e.style.setProperty(t, n) : e.style[t] = n;
1302
1305
  }
1303
- const $r = /* @__PURE__ */ mt(() => window.ScrollTimeline !== void 0), _r = {};
1304
- function jr(e, t) {
1305
- const n = /* @__PURE__ */ mt(e);
1306
- return () => _r[t] ?? n();
1306
+ const Gr = /* @__PURE__ */ yt(() => window.ScrollTimeline !== void 0), Hr = {};
1307
+ function zr(e, t) {
1308
+ const n = /* @__PURE__ */ yt(e);
1309
+ return () => Hr[t] ?? n();
1307
1310
  }
1308
- const is = /* @__PURE__ */ jr(() => {
1311
+ const as = /* @__PURE__ */ zr(() => {
1309
1312
  try {
1310
1313
  document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1311
1314
  } catch {
1312
1315
  return !1;
1313
1316
  }
1314
1317
  return !0;
1315
- }, "linearEasing"), le = ([e, t, n, s]) => `cubic-bezier(${e}, ${t}, ${n}, ${s})`, en = {
1318
+ }, "linearEasing"), he = ([e, t, n, s]) => `cubic-bezier(${e}, ${t}, ${n}, ${s})`, sn = {
1316
1319
  linear: "linear",
1317
1320
  ease: "ease",
1318
1321
  easeIn: "ease-in",
1319
1322
  easeOut: "ease-out",
1320
1323
  easeInOut: "ease-in-out",
1321
- circIn: /* @__PURE__ */ le([0, 0.65, 0.55, 1]),
1322
- circOut: /* @__PURE__ */ le([0.55, 0, 1, 0.45]),
1323
- backIn: /* @__PURE__ */ le([0.31, 0.01, 0.66, -0.59]),
1324
- backOut: /* @__PURE__ */ le([0.33, 1.53, 0.69, 0.99])
1324
+ circIn: /* @__PURE__ */ he([0, 0.65, 0.55, 1]),
1325
+ circOut: /* @__PURE__ */ he([0.55, 0, 1, 0.45]),
1326
+ backIn: /* @__PURE__ */ he([0.31, 0.01, 0.66, -0.59]),
1327
+ backOut: /* @__PURE__ */ he([0.33, 1.53, 0.69, 0.99])
1325
1328
  };
1326
- function rs(e, t) {
1329
+ function cs(e, t) {
1327
1330
  if (e)
1328
- return typeof e == "function" ? is() ? Qn(e, t) : "ease-out" : _n(e) ? le(e) : Array.isArray(e) ? e.map((n) => rs(n, t) || en.easeOut) : en[e];
1331
+ return typeof e == "function" ? as() ? ns(e, t) : "ease-out" : Gn(e) ? he(e) : Array.isArray(e) ? e.map((n) => cs(n, t) || sn.easeOut) : sn[e];
1329
1332
  }
1330
- function Ur(e, t, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeOut", times: l } = {}, u = void 0) {
1333
+ function Yr(e, t, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeOut", times: l } = {}, u = void 0) {
1331
1334
  const c = {
1332
1335
  [t]: n
1333
1336
  };
1334
1337
  l && (c.offset = l);
1335
- const d = rs(a, i);
1336
- Array.isArray(d) && (c.easing = d);
1337
- const f = {
1338
+ const f = cs(a, i);
1339
+ Array.isArray(f) && (c.easing = f);
1340
+ const d = {
1338
1341
  delay: s,
1339
1342
  duration: i,
1340
- easing: Array.isArray(d) ? "linear" : d,
1343
+ easing: Array.isArray(f) ? "linear" : f,
1341
1344
  fill: "both",
1342
1345
  iterations: r + 1,
1343
1346
  direction: o === "reverse" ? "alternate" : "normal"
1344
1347
  };
1345
- return u && (f.pseudoElement = u), e.animate(c, f);
1348
+ return u && (d.pseudoElement = u), e.animate(c, d);
1346
1349
  }
1347
- function os(e) {
1350
+ function us(e) {
1348
1351
  return typeof e == "function" && "applyToOptions" in e;
1349
1352
  }
1350
- function Gr({ type: e, ...t }) {
1351
- return os(e) && is() ? e.applyToOptions(t) : (t.duration ?? (t.duration = 300), t.ease ?? (t.ease = "easeOut"), t);
1353
+ function Xr({ type: e, ...t }) {
1354
+ return us(e) && as() ? e.applyToOptions(t) : (t.duration ?? (t.duration = 300), t.ease ?? (t.ease = "easeOut"), t);
1352
1355
  }
1353
- class zr extends Vt {
1356
+ class qr extends Ct {
1354
1357
  constructor(t) {
1355
1358
  if (super(), this.finishedTime = null, this.isStopped = !1, !t)
1356
1359
  return;
1357
1360
  const { element: n, name: s, keyframes: i, pseudoElement: r, allowFlatten: o = !1, finalKeyframe: a, onComplete: l } = t;
1358
- this.isPseudoElement = !!r, this.allowFlatten = o, this.options = t, Y(typeof t.type != "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "motion"?`);
1359
- const u = Gr(t);
1360
- this.animation = Ur(n, s, i, u, r), u.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
1361
+ this.isPseudoElement = !!r, this.allowFlatten = o, this.options = t, X(typeof t.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
1362
+ const u = Xr(t);
1363
+ this.animation = Yr(n, s, i, u, r), u.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
1361
1364
  if (this.finishedTime = this.time, !r) {
1362
- const c = xt(i, this.options, a, this.speed);
1363
- this.updateMotionValue ? this.updateMotionValue(c) : Wr(n, s, c), this.animation.cancel();
1365
+ const c = At(i, this.options, a, this.speed);
1366
+ this.updateMotionValue ? this.updateMotionValue(c) : Ur(n, s, c), this.animation.cancel();
1364
1367
  }
1365
1368
  l == null || l(), this.notifyFinished();
1366
1369
  };
@@ -1413,7 +1416,7 @@ class zr extends Vt {
1413
1416
  return /* @__PURE__ */ K(Number(this.animation.currentTime) || 0);
1414
1417
  }
1415
1418
  set time(t) {
1416
- this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ N(t);
1419
+ this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ B(t);
1417
1420
  }
1418
1421
  /**
1419
1422
  * The playback speed of the animation.
@@ -1439,24 +1442,24 @@ class zr extends Vt {
1439
1442
  */
1440
1443
  attachTimeline({ timeline: t, observe: n }) {
1441
1444
  var s;
1442
- return this.allowFlatten && ((s = this.animation.effect) == null || s.updateTiming({ easing: "linear" })), this.animation.onfinish = null, t && $r() ? (this.animation.timeline = t, ie) : n(this);
1445
+ return this.allowFlatten && ((s = this.animation.effect) == null || s.updateTiming({ easing: "linear" })), this.animation.onfinish = null, t && Gr() ? (this.animation.timeline = t, ae) : n(this);
1443
1446
  }
1444
1447
  }
1445
- const as = {
1446
- anticipate: Kn,
1447
- backInOut: Bn,
1448
- circInOut: Wn
1448
+ const ls = {
1449
+ anticipate: jn,
1450
+ backInOut: $n,
1451
+ circInOut: _n
1449
1452
  };
1450
- function Hr(e) {
1451
- return e in as;
1453
+ function Zr(e) {
1454
+ return e in ls;
1452
1455
  }
1453
- function Yr(e) {
1454
- typeof e.ease == "string" && Hr(e.ease) && (e.ease = as[e.ease]);
1456
+ function Jr(e) {
1457
+ typeof e.ease == "string" && Zr(e.ease) && (e.ease = ls[e.ease]);
1455
1458
  }
1456
- const tn = 10;
1457
- class Xr extends zr {
1459
+ const rn = 10;
1460
+ class Qr extends qr {
1458
1461
  constructor(t) {
1459
- Yr(t), ts(t), super(t), t.startTime && (this.startTime = t.startTime), this.options = t;
1462
+ Jr(t), is(t), super(t), t.startTime && (this.startTime = t.startTime), this.options = t;
1460
1463
  }
1461
1464
  /**
1462
1465
  * WAAPI doesn't natively have any interruption capabilities.
@@ -1474,17 +1477,17 @@ class Xr extends zr {
1474
1477
  n.set(t);
1475
1478
  return;
1476
1479
  }
1477
- const a = new At({
1480
+ const a = new Mt({
1478
1481
  ...o,
1479
1482
  autoplay: !1
1480
- }), l = /* @__PURE__ */ N(this.finishedTime ?? this.time);
1481
- n.setWithVelocity(a.sample(l - tn).value, a.sample(l).value, tn), a.stop();
1483
+ }), l = /* @__PURE__ */ B(this.finishedTime ?? this.time);
1484
+ n.setWithVelocity(a.sample(l - rn).value, a.sample(l).value, rn), a.stop();
1482
1485
  }
1483
1486
  }
1484
- const nn = (e, t) => t === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && // It's animatable if we have a string
1485
- (oe.test(e) || e === "0") && // And it contains numbers and/or colors
1487
+ const on = (e, t) => t === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && // It's animatable if we have a string
1488
+ (ue.test(e) || e === "0") && // And it contains numbers and/or colors
1486
1489
  !e.startsWith("url("));
1487
- function qr(e) {
1490
+ function eo(e) {
1488
1491
  const t = e[0];
1489
1492
  if (e.length === 1)
1490
1493
  return !0;
@@ -1492,47 +1495,47 @@ function qr(e) {
1492
1495
  if (e[n] !== t)
1493
1496
  return !0;
1494
1497
  }
1495
- function Zr(e, t, n, s) {
1498
+ function to(e, t, n, s) {
1496
1499
  const i = e[0];
1497
1500
  if (i === null)
1498
1501
  return !1;
1499
1502
  if (t === "display" || t === "visibility")
1500
1503
  return !0;
1501
- const r = e[e.length - 1], o = nn(i, t), a = nn(r, t);
1502
- return ye(o === a, `You are trying to animate ${t} from "${i}" to "${r}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${r} via the \`style\` property.`), !o || !a ? !1 : qr(e) || (n === "spring" || os(n)) && s;
1504
+ const r = e[e.length - 1], o = on(i, t), a = on(r, t);
1505
+ return ve(o === a, `You are trying to animate ${t} from "${i}" to "${r}". "${o ? r : i}" is not an animatable value.`, "value-not-animatable"), !o || !a ? !1 : eo(e) || (n === "spring" || us(n)) && s;
1503
1506
  }
1504
- function cs(e) {
1505
- return Di(e) && "offsetHeight" in e;
1507
+ function at(e) {
1508
+ e.duration = 0, e.type;
1506
1509
  }
1507
- const Jr = /* @__PURE__ */ new Set([
1510
+ const no = /* @__PURE__ */ new Set([
1508
1511
  "opacity",
1509
1512
  "clipPath",
1510
1513
  "filter",
1511
1514
  "transform"
1512
1515
  // TODO: Could be re-enabled now we have support for linear() easing
1513
1516
  // "background-color"
1514
- ]), Qr = /* @__PURE__ */ mt(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1515
- function eo(e) {
1516
- var u;
1517
+ ]), so = /* @__PURE__ */ yt(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1518
+ function io(e) {
1519
+ var c;
1517
1520
  const { motionValue: t, name: n, repeatDelay: s, repeatType: i, damping: r, type: o } = e;
1518
- if (!cs((u = t == null ? void 0 : t.owner) == null ? void 0 : u.current))
1521
+ if (!(((c = t == null ? void 0 : t.owner) == null ? void 0 : c.current) instanceof HTMLElement))
1519
1522
  return !1;
1520
- const { onUpdate: a, transformTemplate: l } = t.owner.getProps();
1521
- return Qr() && n && Jr.has(n) && (n !== "transform" || !l) && /**
1523
+ const { onUpdate: l, transformTemplate: u } = t.owner.getProps();
1524
+ return so() && n && no.has(n) && (n !== "transform" || !u) && /**
1522
1525
  * If we're outputting values to onUpdate then we can't use WAAPI as there's
1523
1526
  * no way to read the value from WAAPI every frame.
1524
1527
  */
1525
- !a && !s && i !== "mirror" && r !== 0 && o !== "inertia";
1528
+ !l && !s && i !== "mirror" && r !== 0 && o !== "inertia";
1526
1529
  }
1527
- const to = 40;
1528
- class no extends Vt {
1529
- constructor({ autoplay: t = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", keyframes: a, name: l, motionValue: u, element: c, ...d }) {
1530
+ const ro = 40;
1531
+ class oo extends Ct {
1532
+ constructor({ autoplay: t = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", keyframes: a, name: l, motionValue: u, element: c, ...f }) {
1530
1533
  var g;
1531
1534
  super(), this.stop = () => {
1532
1535
  var y, T;
1533
1536
  this._animation && (this._animation.stop(), (y = this.stopTimeline) == null || y.call(this)), (T = this.keyframeResolver) == null || T.cancel();
1534
- }, this.createdAt = L.now();
1535
- const f = {
1537
+ }, this.createdAt = I.now();
1538
+ const d = {
1536
1539
  autoplay: t,
1537
1540
  delay: n,
1538
1541
  type: s,
@@ -1542,24 +1545,24 @@ class no extends Vt {
1542
1545
  name: l,
1543
1546
  motionValue: u,
1544
1547
  element: c,
1545
- ...d
1546
- }, h = (c == null ? void 0 : c.KeyframeResolver) || Ct;
1547
- this.keyframeResolver = new h(a, (y, T, p) => this.onKeyframesResolved(y, T, f, !p), l, u, c), (g = this.keyframeResolver) == null || g.scheduleResolve();
1548
+ ...f
1549
+ }, h = (c == null ? void 0 : c.KeyframeResolver) || Pt;
1550
+ this.keyframeResolver = new h(a, (y, T, p) => this.onKeyframesResolved(y, T, d, !p), l, u, c), (g = this.keyframeResolver) == null || g.scheduleResolve();
1548
1551
  }
1549
1552
  onKeyframesResolved(t, n, s, i) {
1550
1553
  this.keyframeResolver = void 0;
1551
1554
  const { name: r, type: o, velocity: a, delay: l, isHandoff: u, onUpdate: c } = s;
1552
- this.resolvedAt = L.now(), Zr(t, r, o, a) || ((W.instantAnimations || !l) && (c == null || c(xt(t, s, n))), t[0] = t[t.length - 1], s.duration = 0, s.repeat = 0);
1553
- const f = {
1554
- startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > to ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1555
+ this.resolvedAt = I.now(), to(t, r, o, a) || ((W.instantAnimations || !l) && (c == null || c(At(t, s, n))), t[0] = t[t.length - 1], at(s), s.repeat = 0);
1556
+ const d = {
1557
+ startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > ro ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1555
1558
  finalKeyframe: n,
1556
1559
  ...s,
1557
1560
  keyframes: t
1558
- }, h = !u && eo(f) ? new Xr({
1559
- ...f,
1560
- element: f.motionValue.owner.current
1561
- }) : new At(f);
1562
- h.finished.then(() => this.notifyFinished()).catch(ie), this.pendingTimeline && (this.stopTimeline = h.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = h;
1561
+ }, h = !u && io(d) ? new Qr({
1562
+ ...d,
1563
+ element: d.motionValue.owner.current
1564
+ }) : new Mt(d);
1565
+ h.finished.then(() => this.notifyFinished()).catch(ae), this.pendingTimeline && (this.stopTimeline = h.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = h;
1563
1566
  }
1564
1567
  get finished() {
1565
1568
  return this._animation ? this.animation.finished : this._finished;
@@ -1570,7 +1573,7 @@ class no extends Vt {
1570
1573
  }
1571
1574
  get animation() {
1572
1575
  var t;
1573
- return this._animation || ((t = this.keyframeResolver) == null || t.resume(), Br()), this._animation;
1576
+ return this._animation || ((t = this.keyframeResolver) == null || t.resume(), jr()), this._animation;
1574
1577
  }
1575
1578
  get duration() {
1576
1579
  return this.animation.duration;
@@ -1610,78 +1613,78 @@ class no extends Vt {
1610
1613
  this._animation && this.animation.cancel(), (t = this.keyframeResolver) == null || t.cancel();
1611
1614
  }
1612
1615
  }
1613
- const so = (
1616
+ const ao = (
1614
1617
  // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
1615
1618
  /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
1616
1619
  );
1617
- function io(e) {
1618
- const t = so.exec(e);
1620
+ function co(e) {
1621
+ const t = ao.exec(e);
1619
1622
  if (!t)
1620
1623
  return [,];
1621
1624
  const [, n, s, i] = t;
1622
1625
  return [`--${n ?? s}`, i];
1623
1626
  }
1624
- const ro = 4;
1625
- function us(e, t, n = 1) {
1626
- Y(n <= ro, `Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);
1627
- const [s, i] = io(e);
1627
+ const uo = 4;
1628
+ function fs(e, t, n = 1) {
1629
+ X(n <= uo, `Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
1630
+ const [s, i] = co(e);
1628
1631
  if (!s)
1629
1632
  return;
1630
1633
  const r = window.getComputedStyle(t).getPropertyValue(s);
1631
1634
  if (r) {
1632
1635
  const o = r.trim();
1633
- return Pn(o) ? parseFloat(o) : o;
1636
+ return Fn(o) ? parseFloat(o) : o;
1634
1637
  }
1635
- return bt(i) ? us(i, t, n + 1) : i;
1638
+ return Tt(i) ? fs(i, t, n + 1) : i;
1636
1639
  }
1637
- function ls(e, t) {
1640
+ function ds(e, t) {
1638
1641
  return (e == null ? void 0 : e[t]) ?? (e == null ? void 0 : e.default) ?? e;
1639
1642
  }
1640
- const fs = /* @__PURE__ */ new Set([
1643
+ const hs = /* @__PURE__ */ new Set([
1641
1644
  "width",
1642
1645
  "height",
1643
1646
  "top",
1644
1647
  "left",
1645
1648
  "right",
1646
1649
  "bottom",
1647
- ...ae
1648
- ]), oo = {
1650
+ ...le
1651
+ ]), lo = {
1649
1652
  test: (e) => e === "auto",
1650
1653
  parse: (e) => e
1651
- }, ds = (e) => (t) => t.test(e), hs = [re, b, Q, $, qi, Xi, oo], sn = (e) => hs.find(ds(e));
1652
- function ao(e) {
1653
- return typeof e == "number" ? e === 0 : e !== null ? e === "none" || e === "0" || En(e) : !0;
1654
+ }, ps = (e) => (t) => t.test(e), ms = [ce, b, te, $, er, Qi, lo], an = (e) => ms.find(ps(e));
1655
+ function fo(e) {
1656
+ return typeof e == "number" ? e === 0 : e !== null ? e === "none" || e === "0" || On(e) : !0;
1654
1657
  }
1655
- const co = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1656
- function uo(e) {
1658
+ const ho = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1659
+ function po(e) {
1657
1660
  const [t, n] = e.slice(0, -1).split("(");
1658
1661
  if (t === "drop-shadow")
1659
1662
  return e;
1660
- const [s] = n.match(vt) || [];
1663
+ const [s] = n.match(wt) || [];
1661
1664
  if (!s)
1662
1665
  return e;
1663
1666
  const i = n.replace(s, "");
1664
- let r = co.has(t) ? 1 : 0;
1667
+ let r = ho.has(t) ? 1 : 0;
1665
1668
  return s !== n && (r *= 100), t + "(" + r + i + ")";
1666
1669
  }
1667
- const lo = /\b([a-z-]*)\(.*?\)/gu, ot = {
1668
- ...oe,
1670
+ const mo = /\b([a-z-]*)\(.*?\)/gu, ct = {
1671
+ ...ue,
1669
1672
  getAnimatableNone: (e) => {
1670
- const t = e.match(lo);
1671
- return t ? t.map(uo).join(" ") : e;
1673
+ const t = e.match(mo);
1674
+ return t ? t.map(po).join(" ") : e;
1672
1675
  }
1673
- }, rn = {
1674
- ...re,
1676
+ }, cn = {
1677
+ ...ce,
1675
1678
  transform: Math.round
1676
- }, fo = {
1679
+ }, go = {
1677
1680
  rotate: $,
1678
1681
  rotateX: $,
1679
1682
  rotateY: $,
1680
1683
  rotateZ: $,
1681
- scale: we,
1682
- scaleX: we,
1683
- scaleY: we,
1684
- scaleZ: we,
1684
+ scale: xe,
1685
+ scaleX: xe,
1686
+ scaleY: xe,
1687
+ scaleZ: xe,
1685
1688
  skew: $,
1686
1689
  skewX: $,
1687
1690
  skewY: $,
@@ -1694,11 +1697,11 @@ const lo = /\b([a-z-]*)\(.*?\)/gu, ot = {
1694
1697
  z: b,
1695
1698
  perspective: b,
1696
1699
  transformPerspective: b,
1697
- opacity: he,
1698
- originX: Gt,
1699
- originY: Gt,
1700
+ opacity: ge,
1701
+ originX: Yt,
1702
+ originY: Yt,
1700
1703
  originZ: b
1701
- }, Mt = {
1704
+ }, Et = {
1702
1705
  // Border props
1703
1706
  borderWidth: b,
1704
1707
  borderTopWidth: b,
@@ -1734,14 +1737,14 @@ const lo = /\b([a-z-]*)\(.*?\)/gu, ot = {
1734
1737
  // Misc
1735
1738
  backgroundPositionX: b,
1736
1739
  backgroundPositionY: b,
1737
- ...fo,
1738
- zIndex: rn,
1740
+ ...go,
1741
+ zIndex: cn,
1739
1742
  // SVG
1740
- fillOpacity: he,
1741
- strokeOpacity: he,
1742
- numOctaves: rn
1743
- }, ho = {
1744
- ...Mt,
1743
+ fillOpacity: ge,
1744
+ strokeOpacity: ge,
1745
+ numOctaves: cn
1746
+ }, yo = {
1747
+ ...Et,
1745
1748
  // Color props
1746
1749
  color: E,
1747
1750
  backgroundColor: E,
@@ -1754,25 +1757,25 @@ const lo = /\b([a-z-]*)\(.*?\)/gu, ot = {
1754
1757
  borderRightColor: E,
1755
1758
  borderBottomColor: E,
1756
1759
  borderLeftColor: E,
1757
- filter: ot,
1758
- WebkitFilter: ot
1759
- }, ps = (e) => ho[e];
1760
- function ms(e, t) {
1761
- let n = ps(e);
1762
- return n !== ot && (n = oe), n.getAnimatableNone ? n.getAnimatableNone(t) : void 0;
1763
- }
1764
- const po = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1765
- function mo(e, t, n) {
1760
+ filter: ct,
1761
+ WebkitFilter: ct
1762
+ }, gs = (e) => yo[e];
1763
+ function ys(e, t) {
1764
+ let n = gs(e);
1765
+ return n !== ct && (n = ue), n.getAnimatableNone ? n.getAnimatableNone(t) : void 0;
1766
+ }
1767
+ const bo = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1768
+ function vo(e, t, n) {
1766
1769
  let s = 0, i;
1767
1770
  for (; s < e.length && !i; ) {
1768
1771
  const r = e[s];
1769
- typeof r == "string" && !po.has(r) && pe(r).values.length && (i = e[s]), s++;
1772
+ typeof r == "string" && !bo.has(r) && ye(r).values.length && (i = e[s]), s++;
1770
1773
  }
1771
1774
  if (i && n)
1772
1775
  for (const r of t)
1773
- e[r] = ms(n, i);
1776
+ e[r] = ys(n, i);
1774
1777
  }
1775
- class go extends Ct {
1778
+ class To extends Pt {
1776
1779
  constructor(t, n, s, i, r) {
1777
1780
  super(t, n, s, i, r, !0);
1778
1781
  }
@@ -1783,33 +1786,33 @@ class go extends Ct {
1783
1786
  super.readKeyframes();
1784
1787
  for (let l = 0; l < t.length; l++) {
1785
1788
  let u = t[l];
1786
- if (typeof u == "string" && (u = u.trim(), bt(u))) {
1787
- const c = us(u, n.current);
1789
+ if (typeof u == "string" && (u = u.trim(), Tt(u))) {
1790
+ const c = fs(u, n.current);
1788
1791
  c !== void 0 && (t[l] = c), l === t.length - 1 && (this.finalKeyframe = u);
1789
1792
  }
1790
1793
  }
1791
- if (this.resolveNoneKeyframes(), !fs.has(s) || t.length !== 2)
1794
+ if (this.resolveNoneKeyframes(), !hs.has(s) || t.length !== 2)
1792
1795
  return;
1793
- const [i, r] = t, o = sn(i), a = sn(r);
1796
+ const [i, r] = t, o = an(i), a = an(r);
1794
1797
  if (o !== a)
1795
- if (Qt(o) && Qt(a))
1798
+ if (nn(o) && nn(a))
1796
1799
  for (let l = 0; l < t.length; l++) {
1797
1800
  const u = t[l];
1798
1801
  typeof u == "string" && (t[l] = parseFloat(u));
1799
1802
  }
1800
- else G[s] && (this.needsMeasurement = !0);
1803
+ else H[s] && (this.needsMeasurement = !0);
1801
1804
  }
1802
1805
  resolveNoneKeyframes() {
1803
1806
  const { unresolvedKeyframes: t, name: n } = this, s = [];
1804
1807
  for (let i = 0; i < t.length; i++)
1805
- (t[i] === null || ao(t[i])) && s.push(i);
1806
- s.length && mo(t, s, n);
1808
+ (t[i] === null || fo(t[i])) && s.push(i);
1809
+ s.length && vo(t, s, n);
1807
1810
  }
1808
1811
  measureInitialState() {
1809
1812
  const { element: t, unresolvedKeyframes: n, name: s } = this;
1810
1813
  if (!t || !t.current)
1811
1814
  return;
1812
- s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = G[s](t.measureViewportBox(), window.getComputedStyle(t.current)), n[0] = this.measuredOrigin;
1815
+ s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = H[s](t.measureViewportBox(), window.getComputedStyle(t.current)), n[0] = this.measuredOrigin;
1813
1816
  const i = n[n.length - 1];
1814
1817
  i !== void 0 && t.getValue(s, i).jump(i, !1);
1815
1818
  }
@@ -1821,12 +1824,12 @@ class go extends Ct {
1821
1824
  const i = t.getValue(n);
1822
1825
  i && i.jump(this.measuredOrigin, !1);
1823
1826
  const r = s.length - 1, o = s[r];
1824
- s[r] = G[n](t.measureViewportBox(), window.getComputedStyle(t.current)), o !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = o), (a = this.removedTransforms) != null && a.length && this.removedTransforms.forEach(([l, u]) => {
1827
+ s[r] = H[n](t.measureViewportBox(), window.getComputedStyle(t.current)), o !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = o), (a = this.removedTransforms) != null && a.length && this.removedTransforms.forEach(([l, u]) => {
1825
1828
  t.getValue(l).set(u);
1826
1829
  }), this.resolveNoneKeyframes();
1827
1830
  }
1828
1831
  }
1829
- function yo(e, t, n) {
1832
+ function wo(e, t, n) {
1830
1833
  if (e instanceof EventTarget)
1831
1834
  return [e];
1832
1835
  if (typeof e == "string") {
@@ -1836,8 +1839,12 @@ function yo(e, t, n) {
1836
1839
  }
1837
1840
  return Array.from(e);
1838
1841
  }
1839
- const gs = (e, t) => t && typeof e == "number" ? t.transform(e) : e, on = 30, bo = (e) => !isNaN(parseFloat(e));
1840
- class vo {
1842
+ const bs = (e, t) => t && typeof e == "number" ? t.transform(e) : e;
1843
+ function So(e) {
1844
+ return Li(e) && "offsetHeight" in e;
1845
+ }
1846
+ const un = 30, xo = (e) => !isNaN(parseFloat(e));
1847
+ class Vo {
1841
1848
  /**
1842
1849
  * @param init - The initiating value
1843
1850
  * @param config - Optional configuration options
@@ -1845,17 +1852,16 @@ class vo {
1845
1852
  * - `transformer`: A function to transform incoming values with.
1846
1853
  */
1847
1854
  constructor(t, n = {}) {
1848
- this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
1849
- var o, a;
1850
- const r = L.now();
1851
- if (this.updatedAt !== r && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && ((o = this.events.change) == null || o.notify(this.current), this.dependents))
1852
- for (const l of this.dependents)
1853
- l.dirty();
1854
- i && ((a = this.events.renderRequest) == null || a.notify(this.current));
1855
+ this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s) => {
1856
+ var r;
1857
+ const i = I.now();
1858
+ if (this.updatedAt !== i && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && ((r = this.events.change) == null || r.notify(this.current), this.dependents))
1859
+ for (const o of this.dependents)
1860
+ o.dirty();
1855
1861
  }, this.hasAnimated = !1, this.setCurrent(t), this.owner = n.owner;
1856
1862
  }
1857
1863
  setCurrent(t) {
1858
- this.current = t, this.updatedAt = L.now(), this.canTrackVelocity === null && t !== void 0 && (this.canTrackVelocity = bo(this.current));
1864
+ this.current = t, this.updatedAt = I.now(), this.canTrackVelocity === null && t !== void 0 && (this.canTrackVelocity = xo(this.current));
1859
1865
  }
1860
1866
  setPrevFrameValue(t = this.current) {
1861
1867
  this.prevFrameValue = t, this.prevUpdatedAt = this.updatedAt;
@@ -1901,13 +1907,13 @@ class vo {
1901
1907
  * @deprecated
1902
1908
  */
1903
1909
  onChange(t) {
1904
- return process.env.NODE_ENV !== "production" && On(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", t);
1910
+ return process.env.NODE_ENV !== "production" && kn(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", t);
1905
1911
  }
1906
1912
  on(t, n) {
1907
- this.events[t] || (this.events[t] = new Fn());
1913
+ this.events[t] || (this.events[t] = new Ln());
1908
1914
  const s = this.events[t].add(n);
1909
1915
  return t === "change" ? () => {
1910
- s(), k.read(() => {
1916
+ s(), N.read(() => {
1911
1917
  this.events.change.getSize() || this.stop();
1912
1918
  });
1913
1919
  } : s;
@@ -1937,8 +1943,8 @@ class vo {
1937
1943
  *
1938
1944
  * @public
1939
1945
  */
1940
- set(t, n = !0) {
1941
- !n || !this.passiveEffect ? this.updateAndNotify(t, n) : this.passiveEffect(t, this.updateAndNotify);
1946
+ set(t) {
1947
+ this.passiveEffect ? this.passiveEffect(t, this.updateAndNotify) : this.updateAndNotify(t);
1942
1948
  }
1943
1949
  setWithVelocity(t, n, s) {
1944
1950
  this.set(n), this.prev = void 0, this.prevFrameValue = t, this.prevUpdatedAt = this.updatedAt - s;
@@ -1984,11 +1990,11 @@ class vo {
1984
1990
  * @public
1985
1991
  */
1986
1992
  getVelocity() {
1987
- const t = L.now();
1988
- if (!this.canTrackVelocity || this.prevFrameValue === void 0 || t - this.updatedAt > on)
1993
+ const t = I.now();
1994
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || t - this.updatedAt > un)
1989
1995
  return 0;
1990
- const n = Math.min(this.updatedAt - this.prevUpdatedAt, on);
1991
- return Rn(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1996
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, un);
1997
+ return In(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1992
1998
  }
1993
1999
  /**
1994
2000
  * Registers a new animation to control this `MotionValue`. Only one
@@ -2040,35 +2046,35 @@ class vo {
2040
2046
  (t = this.dependents) == null || t.clear(), (n = this.events.destroy) == null || n.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
2041
2047
  }
2042
2048
  }
2043
- function Ee(e, t) {
2044
- return new vo(e, t);
2049
+ function Fe(e, t) {
2050
+ return new Vo(e, t);
2045
2051
  }
2046
- const { schedule: To } = /* @__PURE__ */ jn(queueMicrotask, !1), wo = {
2052
+ const { schedule: Ao } = /* @__PURE__ */ Hn(queueMicrotask, !1), Co = {
2047
2053
  y: !1
2048
2054
  };
2049
- function So() {
2050
- return wo.y;
2055
+ function Mo() {
2056
+ return Co.y;
2051
2057
  }
2052
- function ys(e, t) {
2053
- const n = yo(e), s = new AbortController(), i = {
2058
+ function vs(e, t) {
2059
+ const n = wo(e), s = new AbortController(), i = {
2054
2060
  passive: !0,
2055
2061
  ...t,
2056
2062
  signal: s.signal
2057
2063
  };
2058
2064
  return [n, i, () => s.abort()];
2059
2065
  }
2060
- function an(e) {
2061
- return !(e.pointerType === "touch" || So());
2066
+ function ln(e) {
2067
+ return !(e.pointerType === "touch" || Mo());
2062
2068
  }
2063
- function xo(e, t, n = {}) {
2064
- const [s, i, r] = ys(e, n), o = (a) => {
2065
- if (!an(a))
2069
+ function Po(e, t, n = {}) {
2070
+ const [s, i, r] = vs(e, n), o = (a) => {
2071
+ if (!ln(a))
2066
2072
  return;
2067
2073
  const { target: l } = a, u = t(l, a);
2068
2074
  if (typeof u != "function" || !l)
2069
2075
  return;
2070
- const c = (d) => {
2071
- an(d) && (u(d), l.removeEventListener("pointerleave", c));
2076
+ const c = (f) => {
2077
+ ln(f) && (u(f), l.removeEventListener("pointerleave", c));
2072
2078
  };
2073
2079
  l.addEventListener("pointerleave", c, i);
2074
2080
  };
@@ -2076,18 +2082,18 @@ function xo(e, t, n = {}) {
2076
2082
  a.addEventListener("pointerenter", o, i);
2077
2083
  }), r;
2078
2084
  }
2079
- const bs = (e, t) => t ? e === t ? !0 : bs(e, t.parentElement) : !1, Vo = (e) => e.pointerType === "mouse" ? typeof e.button != "number" || e.button <= 0 : e.isPrimary !== !1, Ao = /* @__PURE__ */ new Set([
2085
+ const Ts = (e, t) => t ? e === t ? !0 : Ts(e, t.parentElement) : !1, Eo = (e) => e.pointerType === "mouse" ? typeof e.button != "number" || e.button <= 0 : e.isPrimary !== !1, Do = /* @__PURE__ */ new Set([
2080
2086
  "BUTTON",
2081
2087
  "INPUT",
2082
2088
  "SELECT",
2083
2089
  "TEXTAREA",
2084
2090
  "A"
2085
2091
  ]);
2086
- function Co(e) {
2087
- return Ao.has(e.tagName) || e.tabIndex !== -1;
2092
+ function Fo(e) {
2093
+ return Do.has(e.tagName) || e.tabIndex !== -1;
2088
2094
  }
2089
- const xe = /* @__PURE__ */ new WeakSet();
2090
- function cn(e) {
2095
+ const Ae = /* @__PURE__ */ new WeakSet();
2096
+ function fn(e) {
2091
2097
  return (t) => {
2092
2098
  t.key === "Enter" && e(t);
2093
2099
  };
@@ -2095,48 +2101,48 @@ function cn(e) {
2095
2101
  function Ue(e, t) {
2096
2102
  e.dispatchEvent(new PointerEvent("pointer" + t, { isPrimary: !0, bubbles: !0 }));
2097
2103
  }
2098
- const Mo = (e, t) => {
2104
+ const Oo = (e, t) => {
2099
2105
  const n = e.currentTarget;
2100
2106
  if (!n)
2101
2107
  return;
2102
- const s = cn(() => {
2103
- if (xe.has(n))
2108
+ const s = fn(() => {
2109
+ if (Ae.has(n))
2104
2110
  return;
2105
2111
  Ue(n, "down");
2106
- const i = cn(() => {
2112
+ const i = fn(() => {
2107
2113
  Ue(n, "up");
2108
2114
  }), r = () => Ue(n, "cancel");
2109
2115
  n.addEventListener("keyup", i, t), n.addEventListener("blur", r, t);
2110
2116
  });
2111
2117
  n.addEventListener("keydown", s, t), n.addEventListener("blur", () => n.removeEventListener("keydown", s), t);
2112
2118
  };
2113
- function un(e) {
2114
- return Vo(e) && !0;
2119
+ function dn(e) {
2120
+ return Eo(e) && !0;
2115
2121
  }
2116
- function Po(e, t, n = {}) {
2117
- const [s, i, r] = ys(e, n), o = (a) => {
2122
+ function Ro(e, t, n = {}) {
2123
+ const [s, i, r] = vs(e, n), o = (a) => {
2118
2124
  const l = a.currentTarget;
2119
- if (!un(a))
2125
+ if (!dn(a))
2120
2126
  return;
2121
- xe.add(l);
2127
+ Ae.add(l);
2122
2128
  const u = t(l, a), c = (h, g) => {
2123
- window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", f), xe.has(l) && xe.delete(l), un(h) && typeof u == "function" && u(h, { success: g });
2124
- }, d = (h) => {
2125
- c(h, l === window || l === document || n.useGlobalTarget || bs(l, h.target));
2129
+ window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", d), Ae.has(l) && Ae.delete(l), dn(h) && typeof u == "function" && u(h, { success: g });
2126
2130
  }, f = (h) => {
2131
+ c(h, l === window || l === document || n.useGlobalTarget || Ts(l, h.target));
2132
+ }, d = (h) => {
2127
2133
  c(h, !1);
2128
2134
  };
2129
- window.addEventListener("pointerup", d, i), window.addEventListener("pointercancel", f, i);
2135
+ window.addEventListener("pointerup", f, i), window.addEventListener("pointercancel", d, i);
2130
2136
  };
2131
2137
  return s.forEach((a) => {
2132
- (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), cs(a) && (a.addEventListener("focus", (u) => Mo(u, i)), !Co(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
2138
+ (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), So(a) && (a.addEventListener("focus", (u) => Oo(u, i)), !Fo(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
2133
2139
  }), r;
2134
2140
  }
2135
- const O = (e) => !!(e && e.getVelocity), Eo = [...hs, E, oe], Do = (e) => Eo.find(ds(e)), vs = se({
2141
+ const R = (e) => !!(e && e.getVelocity), Lo = [...ms, E, ue], Io = (e) => Lo.find(ps(e)), ws = oe({
2136
2142
  transformPagePoint: (e) => e,
2137
2143
  isStatic: !1,
2138
2144
  reducedMotion: "never"
2139
- }), Pt = se({ strict: !1 }), ln = {
2145
+ }), Dt = oe({ strict: !1 }), hn = {
2140
2146
  animation: [
2141
2147
  "animate",
2142
2148
  "variants",
@@ -2155,34 +2161,34 @@ const O = (e) => !!(e && e.getVelocity), Eo = [...hs, E, oe], Do = (e) => Eo.fin
2155
2161
  pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
2156
2162
  inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
2157
2163
  layout: ["layout", "layoutId"]
2158
- }, te = {};
2159
- for (const e in ln)
2160
- te[e] = {
2161
- isEnabled: (t) => ln[e].some((n) => !!t[n])
2164
+ }, ie = {};
2165
+ for (const e in hn)
2166
+ ie[e] = {
2167
+ isEnabled: (t) => hn[e].some((n) => !!t[n])
2162
2168
  };
2163
- function fn(e) {
2169
+ function pn(e) {
2164
2170
  for (const t in e)
2165
- te[t] = {
2166
- ...te[t],
2171
+ ie[t] = {
2172
+ ...ie[t],
2167
2173
  ...e[t]
2168
2174
  };
2169
2175
  }
2170
- function Fo({ children: e, features: t, strict: n = !1 }) {
2171
- const [, s] = Gs(!Ge(t)), i = fe(void 0);
2176
+ function ko({ children: e, features: t, strict: n = !1 }) {
2177
+ const [, s] = Xs(!Ge(t)), i = pe(void 0);
2172
2178
  if (!Ge(t)) {
2173
2179
  const { renderer: r, ...o } = t;
2174
- i.current = r, fn(o);
2180
+ i.current = r, pn(o);
2175
2181
  }
2176
- return dt(() => {
2182
+ return pt(() => {
2177
2183
  Ge(t) && t().then(({ renderer: r, ...o }) => {
2178
- fn(o), i.current = r, s(!0);
2184
+ pn(o), i.current = r, s(!0);
2179
2185
  });
2180
- }, []), M(Pt.Provider, { value: { renderer: i.current, strict: n }, children: e });
2186
+ }, []), M(Dt.Provider, { value: { renderer: i.current, strict: n }, children: e });
2181
2187
  }
2182
2188
  function Ge(e) {
2183
2189
  return typeof e == "function";
2184
2190
  }
2185
- const Ro = /* @__PURE__ */ new Set([
2191
+ const No = /* @__PURE__ */ new Set([
2186
2192
  "animate",
2187
2193
  "exit",
2188
2194
  "variants",
@@ -2214,32 +2220,32 @@ const Ro = /* @__PURE__ */ new Set([
2214
2220
  "ignoreStrict",
2215
2221
  "viewport"
2216
2222
  ]);
2217
- function De(e) {
2218
- return e.startsWith("while") || e.startsWith("drag") && e !== "draggable" || e.startsWith("layout") || e.startsWith("onTap") || e.startsWith("onPan") || e.startsWith("onLayout") || Ro.has(e);
2223
+ function Oe(e) {
2224
+ return e.startsWith("while") || e.startsWith("drag") && e !== "draggable" || e.startsWith("layout") || e.startsWith("onTap") || e.startsWith("onPan") || e.startsWith("onLayout") || No.has(e);
2219
2225
  }
2220
- let Ts = (e) => !De(e);
2221
- function Oo(e) {
2222
- typeof e == "function" && (Ts = (t) => t.startsWith("on") ? !De(t) : e(t));
2226
+ let Ss = (e) => !Oe(e);
2227
+ function Bo(e) {
2228
+ typeof e == "function" && (Ss = (t) => t.startsWith("on") ? !Oe(t) : e(t));
2223
2229
  }
2224
2230
  try {
2225
- Oo(require("@emotion/is-prop-valid").default);
2231
+ Bo(require("@emotion/is-prop-valid").default);
2226
2232
  } catch {
2227
2233
  }
2228
- function Lo(e, t, n) {
2234
+ function Ko(e, t, n) {
2229
2235
  const s = {};
2230
2236
  for (const i in e)
2231
- i === "values" && typeof e.values == "object" || (Ts(i) || n === !0 && De(i) || !t && !De(i) || // If trying to use native HTML drag events, forward drag listeners
2237
+ i === "values" && typeof e.values == "object" || (Ss(i) || n === !0 && Oe(i) || !t && !Oe(i) || // If trying to use native HTML drag events, forward drag listeners
2232
2238
  e.draggable && i.startsWith("onDrag")) && (s[i] = e[i]);
2233
2239
  return s;
2234
2240
  }
2235
- const Le = /* @__PURE__ */ se({});
2236
- function Ie(e) {
2241
+ const ke = /* @__PURE__ */ oe({});
2242
+ function Ne(e) {
2237
2243
  return e !== null && typeof e == "object" && typeof e.start == "function";
2238
2244
  }
2239
- function me(e) {
2245
+ function be(e) {
2240
2246
  return typeof e == "string" || Array.isArray(e);
2241
2247
  }
2242
- const Et = [
2248
+ const Ft = [
2243
2249
  "animate",
2244
2250
  "whileInView",
2245
2251
  "whileFocus",
@@ -2247,158 +2253,52 @@ const Et = [
2247
2253
  "whileTap",
2248
2254
  "whileDrag",
2249
2255
  "exit"
2250
- ], Dt = ["initial", ...Et];
2251
- function ke(e) {
2252
- return Ie(e.animate) || Dt.some((t) => me(e[t]));
2256
+ ], Ot = ["initial", ...Ft];
2257
+ function Be(e) {
2258
+ return Ne(e.animate) || Ot.some((t) => be(e[t]));
2253
2259
  }
2254
- function ws(e) {
2255
- return !!(ke(e) || e.variants);
2260
+ function xs(e) {
2261
+ return !!(Be(e) || e.variants);
2256
2262
  }
2257
- function Io(e, t) {
2258
- if (ke(e)) {
2263
+ function Wo(e, t) {
2264
+ if (Be(e)) {
2259
2265
  const { initial: n, animate: s } = e;
2260
2266
  return {
2261
- initial: n === !1 || me(n) ? n : void 0,
2262
- animate: me(s) ? s : void 0
2267
+ initial: n === !1 || be(n) ? n : void 0,
2268
+ animate: be(s) ? s : void 0
2263
2269
  };
2264
2270
  }
2265
2271
  return e.inherit !== !1 ? t : {};
2266
2272
  }
2267
- function ko(e) {
2268
- const { initial: t, animate: n } = Io(e, I(Le));
2269
- return Fe(() => ({ initial: t, animate: n }), [dn(t), dn(n)]);
2273
+ function $o(e) {
2274
+ const { initial: t, animate: n } = Wo(e, k(ke));
2275
+ return Re(() => ({ initial: t, animate: n }), [mn(t), mn(n)]);
2270
2276
  }
2271
- function dn(e) {
2277
+ function mn(e) {
2272
2278
  return Array.isArray(e) ? e.join(" ") : e;
2273
2279
  }
2274
- const No = Symbol.for("motionComponentSymbol");
2275
- function Ss(e) {
2276
- return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "current");
2277
- }
2278
- function Bo(e, t, n) {
2279
- return zs(
2280
- (s) => {
2281
- s && e.onMount && e.onMount(s), t && (s ? t.mount(s) : t.unmount()), n && (typeof n == "function" ? n(s) : Ss(n) && (n.current = s));
2282
- },
2283
- /**
2284
- * Only pass a new ref callback to React if we've received a visual element
2285
- * factory. Otherwise we'll be mounting/remounting every time externalRef
2286
- * or other dependencies change.
2287
- */
2288
- [t]
2289
- );
2290
- }
2291
- const Ft = (e) => e.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Ko = "framerAppearId", xs = "data-" + Ft(Ko), Wo = se({});
2292
- function $o(e, t, n, s, i) {
2293
- var y, T;
2294
- const { visualElement: r } = I(Le), o = I(Pt), a = I(Mn), l = I(vs).reducedMotion, u = fe(null);
2295
- s = s || o.renderer, !u.current && s && (u.current = s(e, {
2296
- visualState: t,
2297
- parent: r,
2298
- props: n,
2299
- presenceContext: a,
2300
- blockInitialAnimation: a ? a.initial === !1 : !1,
2301
- reducedMotionConfig: l
2302
- }));
2303
- const c = u.current, d = I(Wo);
2304
- c && !c.projection && i && (c.type === "html" || c.type === "svg") && _o(u.current, n, i, d);
2305
- const f = fe(!1);
2306
- Hs(() => {
2307
- c && f.current && c.update(n, a);
2308
- });
2309
- const h = n[xs], g = fe(!!h && !((y = window.MotionHandoffIsComplete) != null && y.call(window, h)) && ((T = window.MotionHasOptimisedAnimation) == null ? void 0 : T.call(window, h)));
2310
- return Mi(() => {
2311
- c && (f.current = !0, window.MotionIsMounted = !0, c.updateFeatures(), To.render(c.render), g.current && c.animationState && c.animationState.animateChanges());
2312
- }), dt(() => {
2313
- c && (!g.current && c.animationState && c.animationState.animateChanges(), g.current && (queueMicrotask(() => {
2314
- var p;
2315
- (p = window.MotionHandoffMarkAsComplete) == null || p.call(window, h);
2316
- }), g.current = !1));
2317
- }), c;
2318
- }
2319
- function _o(e, t, n, s) {
2320
- const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: l, layoutRoot: u, layoutCrossfade: c } = t;
2321
- e.projection = new n(e.latestValues, t["data-framer-portal-id"] ? void 0 : Vs(e.parent)), e.projection.setOptions({
2322
- layoutId: i,
2323
- layout: r,
2324
- alwaysMeasureLayout: !!o || a && Ss(a),
2325
- visualElement: e,
2326
- /**
2327
- * TODO: Update options in an effect. This could be tricky as it'll be too late
2328
- * to update by the time layout animations run.
2329
- * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
2330
- * ensuring it gets called if there's no potential layout animations.
2331
- *
2332
- */
2333
- animationType: typeof r == "string" ? r : "both",
2334
- initialPromotionConfig: s,
2335
- crossfade: c,
2336
- layoutScroll: l,
2337
- layoutRoot: u
2338
- });
2339
- }
2340
- function Vs(e) {
2341
- if (e)
2342
- return e.options.allowProjection !== !1 ? e.projection : Vs(e.parent);
2343
- }
2344
- function jo({ preloadedFeatures: e, createVisualElement: t, useRender: n, useVisualState: s, Component: i }) {
2345
- function r(a, l) {
2346
- let u;
2347
- const c = {
2348
- ...I(vs),
2349
- ...a,
2350
- layoutId: Uo(a)
2351
- }, { isStatic: d } = c, f = ko(a), h = s(a, d);
2352
- if (!d && pt) {
2353
- Go(c, e);
2354
- const g = zo(c);
2355
- u = g.MeasureLayout, f.visualElement = $o(i, h, c, t, g.ProjectionNode);
2356
- }
2357
- return Ve(Le.Provider, { value: f, children: [u && f.visualElement ? M(u, { visualElement: f.visualElement, ...c }) : null, n(i, a, Bo(h, f.visualElement, l), h, d, f.visualElement)] });
2358
- }
2359
- r.displayName = `motion.${typeof i == "string" ? i : `create(${i.displayName ?? i.name ?? ""})`}`;
2360
- const o = Ys(r);
2361
- return o[No] = i, o;
2362
- }
2363
- function Uo({ layoutId: e }) {
2364
- const t = I(Ai).id;
2365
- return t && e !== void 0 ? t + "-" + e : e;
2366
- }
2367
- function Go(e, t) {
2368
- I(Pt).strict, process.env.NODE_ENV;
2369
- }
2370
- function zo(e) {
2371
- const { drag: t, layout: n } = te;
2372
- if (!t && !n)
2373
- return {};
2374
- const s = { ...t, ...n };
2375
- return {
2376
- MeasureLayout: t != null && t.isEnabled(e) || n != null && n.isEnabled(e) ? s.MeasureLayout : void 0,
2377
- ProjectionNode: s.ProjectionNode
2378
- };
2379
- }
2380
- const Ho = {};
2381
- function As(e, { layout: t, layoutId: n }) {
2382
- return ce.has(e) || e.startsWith("origin") || (t || n !== void 0) && (!!Ho[e] || e === "opacity");
2280
+ const jo = {};
2281
+ function Vs(e, { layout: t, layoutId: n }) {
2282
+ return fe.has(e) || e.startsWith("origin") || (t || n !== void 0) && (!!jo[e] || e === "opacity");
2383
2283
  }
2384
- const Yo = {
2284
+ const _o = {
2385
2285
  x: "translateX",
2386
2286
  y: "translateY",
2387
2287
  z: "translateZ",
2388
2288
  transformPerspective: "perspective"
2389
- }, Xo = ae.length;
2390
- function qo(e, t, n) {
2289
+ }, Uo = le.length;
2290
+ function Go(e, t, n) {
2391
2291
  let s = "", i = !0;
2392
- for (let r = 0; r < Xo; r++) {
2393
- const o = ae[r], a = e[o];
2292
+ for (let r = 0; r < Uo; r++) {
2293
+ const o = le[r], a = e[o];
2394
2294
  if (a === void 0)
2395
2295
  continue;
2396
2296
  let l = !0;
2397
2297
  if (typeof a == "number" ? l = a === (o.startsWith("scale") ? 1 : 0) : l = parseFloat(a) === 0, !l || n) {
2398
- const u = gs(a, Mt[o]);
2298
+ const u = bs(a, Et[o]);
2399
2299
  if (!l) {
2400
2300
  i = !1;
2401
- const c = Yo[o] || o;
2301
+ const c = _o[o] || o;
2402
2302
  s += `${c}(${u}) `;
2403
2303
  }
2404
2304
  n && (t[o] = u);
@@ -2411,61 +2311,61 @@ function Rt(e, t, n) {
2411
2311
  let o = !1, a = !1;
2412
2312
  for (const l in t) {
2413
2313
  const u = t[l];
2414
- if (ce.has(l)) {
2314
+ if (fe.has(l)) {
2415
2315
  o = !0;
2416
2316
  continue;
2417
- } else if (Gn(l)) {
2317
+ } else if (Yn(l)) {
2418
2318
  i[l] = u;
2419
2319
  continue;
2420
2320
  } else {
2421
- const c = gs(u, Mt[l]);
2321
+ const c = bs(u, Et[l]);
2422
2322
  l.startsWith("origin") ? (a = !0, r[l] = c) : s[l] = c;
2423
2323
  }
2424
2324
  }
2425
- if (t.transform || (o || n ? s.transform = qo(t, e.transform, n) : s.transform && (s.transform = "none")), a) {
2325
+ if (t.transform || (o || n ? s.transform = Go(t, e.transform, n) : s.transform && (s.transform = "none")), a) {
2426
2326
  const { originX: l = "50%", originY: u = "50%", originZ: c = 0 } = r;
2427
2327
  s.transformOrigin = `${l} ${u} ${c}`;
2428
2328
  }
2429
2329
  }
2430
- const Ot = () => ({
2330
+ const Lt = () => ({
2431
2331
  style: {},
2432
2332
  transform: {},
2433
2333
  transformOrigin: {},
2434
2334
  vars: {}
2435
2335
  });
2436
- function Cs(e, t, n) {
2336
+ function As(e, t, n) {
2437
2337
  for (const s in t)
2438
- !O(t[s]) && !As(s, n) && (e[s] = t[s]);
2338
+ !R(t[s]) && !Vs(s, n) && (e[s] = t[s]);
2439
2339
  }
2440
- function Zo({ transformTemplate: e }, t) {
2441
- return Fe(() => {
2442
- const n = Ot();
2340
+ function Ho({ transformTemplate: e }, t) {
2341
+ return Re(() => {
2342
+ const n = Lt();
2443
2343
  return Rt(n, t, e), Object.assign({}, n.vars, n.style);
2444
2344
  }, [t]);
2445
2345
  }
2446
- function Jo(e, t) {
2346
+ function zo(e, t) {
2447
2347
  const n = e.style || {}, s = {};
2448
- return Cs(s, n, e), Object.assign(s, Zo(e, t)), s;
2348
+ return As(s, n, e), Object.assign(s, Ho(e, t)), s;
2449
2349
  }
2450
- function Qo(e, t) {
2451
- const n = {}, s = Jo(e, t);
2350
+ function Yo(e, t) {
2351
+ const n = {}, s = zo(e, t);
2452
2352
  return e.drag && e.dragListener !== !1 && (n.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = e.drag === !0 ? "none" : `pan-${e.drag === "x" ? "y" : "x"}`), e.tabIndex === void 0 && (e.onTap || e.onTapStart || e.whileTap) && (n.tabIndex = 0), n.style = s, n;
2453
2353
  }
2454
- const ea = {
2354
+ const Xo = {
2455
2355
  offset: "stroke-dashoffset",
2456
2356
  array: "stroke-dasharray"
2457
- }, ta = {
2357
+ }, qo = {
2458
2358
  offset: "strokeDashoffset",
2459
2359
  array: "strokeDasharray"
2460
2360
  };
2461
- function na(e, t, n = 1, s = 0, i = !0) {
2361
+ function Zo(e, t, n = 1, s = 0, i = !0) {
2462
2362
  e.pathLength = 1;
2463
- const r = i ? ea : ta;
2363
+ const r = i ? Xo : qo;
2464
2364
  e[r.offset] = b.transform(-s);
2465
2365
  const o = b.transform(t), a = b.transform(n);
2466
2366
  e[r.array] = `${o} ${a}`;
2467
2367
  }
2468
- function Ms(e, {
2368
+ function Cs(e, {
2469
2369
  attrX: t,
2470
2370
  attrY: n,
2471
2371
  attrScale: s,
@@ -2480,28 +2380,28 @@ function Ms(e, {
2480
2380
  return;
2481
2381
  }
2482
2382
  e.attrs = e.style, e.style = {};
2483
- const { attrs: d, style: f } = e;
2484
- d.transform && (f.transform = d.transform, delete d.transform), (f.transform || d.transformOrigin) && (f.transformOrigin = d.transformOrigin ?? "50% 50%", delete d.transformOrigin), f.transform && (f.transformBox = (c == null ? void 0 : c.transformBox) ?? "fill-box", delete d.transformBox), t !== void 0 && (d.x = t), n !== void 0 && (d.y = n), s !== void 0 && (d.scale = s), i !== void 0 && na(d, i, r, o, !1);
2383
+ const { attrs: f, style: d } = e;
2384
+ f.transform && (d.transform = f.transform, delete f.transform), (d.transform || f.transformOrigin) && (d.transformOrigin = f.transformOrigin ?? "50% 50%", delete f.transformOrigin), d.transform && (d.transformBox = (c == null ? void 0 : c.transformBox) ?? "fill-box", delete f.transformBox), t !== void 0 && (f.x = t), n !== void 0 && (f.y = n), s !== void 0 && (f.scale = s), i !== void 0 && Zo(f, i, r, o, !1);
2485
2385
  }
2486
- const Ps = () => ({
2487
- ...Ot(),
2386
+ const Ms = () => ({
2387
+ ...Lt(),
2488
2388
  attrs: {}
2489
- }), Es = (e) => typeof e == "string" && e.toLowerCase() === "svg";
2490
- function sa(e, t, n, s) {
2491
- const i = Fe(() => {
2492
- const r = Ps();
2493
- return Ms(r, t, Es(s), e.transformTemplate, e.style), {
2389
+ }), Ps = (e) => typeof e == "string" && e.toLowerCase() === "svg";
2390
+ function Jo(e, t, n, s) {
2391
+ const i = Re(() => {
2392
+ const r = Ms();
2393
+ return Cs(r, t, Ps(s), e.transformTemplate, e.style), {
2494
2394
  ...r.attrs,
2495
2395
  style: { ...r.style }
2496
2396
  };
2497
2397
  }, [t]);
2498
2398
  if (e.style) {
2499
2399
  const r = {};
2500
- Cs(r, e.style, e), i.style = { ...r, ...i.style };
2400
+ As(r, e.style, e), i.style = { ...r, ...i.style };
2501
2401
  }
2502
2402
  return i;
2503
2403
  }
2504
- const ia = [
2404
+ const Qo = [
2505
2405
  "animate",
2506
2406
  "circle",
2507
2407
  "defs",
@@ -2528,7 +2428,7 @@ const ia = [
2528
2428
  "use",
2529
2429
  "view"
2530
2430
  ];
2531
- function Lt(e) {
2431
+ function It(e) {
2532
2432
  return (
2533
2433
  /**
2534
2434
  * If it's not a string, it's a custom React component. Currently we only support
@@ -2541,66 +2441,60 @@ function Lt(e) {
2541
2441
  /**
2542
2442
  * If it's in our list of lowercase SVG tags, it's an SVG component
2543
2443
  */
2544
- !!(ia.indexOf(e) > -1 || /**
2444
+ !!(Qo.indexOf(e) > -1 || /**
2545
2445
  * If it contains a capital letter, it's an SVG component
2546
2446
  */
2547
2447
  /[A-Z]/u.test(e))
2548
2448
  )
2549
2449
  );
2550
2450
  }
2551
- function ra(e = !1) {
2552
- return (n, s, i, { latestValues: r }, o) => {
2553
- const l = (Lt(n) ? sa : Qo)(s, r, o, n), u = Lo(s, typeof n == "string", e), c = n !== Tn ? { ...u, ...l, ref: i } : {}, { children: d } = s, f = Fe(() => O(d) ? d.get() : d, [d]);
2554
- return Xs(n, {
2555
- ...c,
2556
- children: f
2557
- });
2558
- };
2451
+ function ea(e, t, n, { latestValues: s }, i, r = !1) {
2452
+ const a = (It(e) ? Jo : Yo)(t, s, i, e), l = Ko(t, typeof e == "string", r), u = e !== xn ? { ...l, ...a, ref: n } : {}, { children: c } = t, f = Re(() => R(c) ? c.get() : c, [c]);
2453
+ return qs(e, {
2454
+ ...u,
2455
+ children: f
2456
+ });
2559
2457
  }
2560
- function hn(e) {
2458
+ function gn(e) {
2561
2459
  const t = [{}, {}];
2562
2460
  return e == null || e.values.forEach((n, s) => {
2563
2461
  t[0][s] = n.get(), t[1][s] = n.getVelocity();
2564
2462
  }), t;
2565
2463
  }
2566
- function It(e, t, n, s) {
2464
+ function kt(e, t, n, s) {
2567
2465
  if (typeof t == "function") {
2568
- const [i, r] = hn(s);
2466
+ const [i, r] = gn(s);
2569
2467
  t = t(n !== void 0 ? n : e.custom, i, r);
2570
2468
  }
2571
2469
  if (typeof t == "string" && (t = e.variants && e.variants[t]), typeof t == "function") {
2572
- const [i, r] = hn(s);
2470
+ const [i, r] = gn(s);
2573
2471
  t = t(n !== void 0 ? n : e.custom, i, r);
2574
2472
  }
2575
2473
  return t;
2576
2474
  }
2577
- function oa(e) {
2578
- return O(e) ? e.get() : e;
2475
+ function ta(e) {
2476
+ return R(e) ? e.get() : e;
2579
2477
  }
2580
- function aa({ scrapeMotionValuesFromProps: e, createRenderState: t }, n, s, i) {
2478
+ function na({ scrapeMotionValuesFromProps: e, createRenderState: t }, n, s, i) {
2581
2479
  return {
2582
- latestValues: ca(n, s, i, e),
2480
+ latestValues: sa(n, s, i, e),
2583
2481
  renderState: t()
2584
2482
  };
2585
2483
  }
2586
- const Ds = (e) => (t, n) => {
2587
- const s = I(Le), i = I(Mn), r = () => aa(e, t, s, i);
2588
- return n ? r() : Ci(r);
2589
- };
2590
- function ca(e, t, n, s) {
2484
+ function sa(e, t, n, s) {
2591
2485
  const i = {}, r = s(e, {});
2592
- for (const f in r)
2593
- i[f] = oa(r[f]);
2486
+ for (const d in r)
2487
+ i[d] = ta(r[d]);
2594
2488
  let { initial: o, animate: a } = e;
2595
- const l = ke(e), u = ws(e);
2489
+ const l = Be(e), u = xs(e);
2596
2490
  t && u && !l && e.inherit !== !1 && (o === void 0 && (o = t.initial), a === void 0 && (a = t.animate));
2597
2491
  let c = n ? n.initial === !1 : !1;
2598
2492
  c = c || o === !1;
2599
- const d = c ? a : o;
2600
- if (d && typeof d != "boolean" && !Ie(d)) {
2601
- const f = Array.isArray(d) ? d : [d];
2602
- for (let h = 0; h < f.length; h++) {
2603
- const g = It(e, f[h]);
2493
+ const f = c ? a : o;
2494
+ if (f && typeof f != "boolean" && !Ne(f)) {
2495
+ const d = Array.isArray(f) ? f : [f];
2496
+ for (let h = 0; h < d.length; h++) {
2497
+ const g = kt(e, d[h]);
2604
2498
  if (g) {
2605
2499
  const { transitionEnd: y, transition: T, ...p } = g;
2606
2500
  for (const V in p) {
@@ -2618,941 +2512,1059 @@ function ca(e, t, n, s) {
2618
2512
  }
2619
2513
  return i;
2620
2514
  }
2621
- function kt(e, t, n) {
2515
+ const Es = (e) => (t, n) => {
2516
+ const s = k(ke), i = k(Dn), r = () => na(e, t, s, i);
2517
+ return n ? r() : Di(r);
2518
+ };
2519
+ function Nt(e, t, n) {
2622
2520
  var r;
2623
2521
  const { style: s } = e, i = {};
2624
2522
  for (const o in s)
2625
- (O(s[o]) || t.style && O(t.style[o]) || As(o, e) || ((r = n == null ? void 0 : n.getValue(o)) == null ? void 0 : r.liveStyle) !== void 0) && (i[o] = s[o]);
2523
+ (R(s[o]) || t.style && R(t.style[o]) || Vs(o, e) || ((r = n == null ? void 0 : n.getValue(o)) == null ? void 0 : r.liveStyle) !== void 0) && (i[o] = s[o]);
2626
2524
  return i;
2627
2525
  }
2628
- const ua = {
2629
- useVisualState: Ds({
2630
- scrapeMotionValuesFromProps: kt,
2631
- createRenderState: Ot
2632
- })
2633
- };
2634
- function Fs(e, t, n) {
2635
- const s = kt(e, t, n);
2526
+ const ia = /* @__PURE__ */ Es({
2527
+ scrapeMotionValuesFromProps: Nt,
2528
+ createRenderState: Lt
2529
+ });
2530
+ function Ds(e, t, n) {
2531
+ const s = Nt(e, t, n);
2636
2532
  for (const i in e)
2637
- if (O(e[i]) || O(t[i])) {
2638
- const r = ae.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
2533
+ if (R(e[i]) || R(t[i])) {
2534
+ const r = le.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
2639
2535
  s[r] = e[i];
2640
2536
  }
2641
2537
  return s;
2642
2538
  }
2643
- const la = {
2644
- useVisualState: Ds({
2645
- scrapeMotionValuesFromProps: Fs,
2646
- createRenderState: Ps
2647
- })
2648
- };
2649
- function fa(e, t) {
2650
- return function(s, { forwardMotionProps: i } = { forwardMotionProps: !1 }) {
2651
- const o = {
2652
- ...Lt(s) ? la : ua,
2653
- preloadedFeatures: e,
2654
- useRender: ra(i),
2655
- createVisualElement: t,
2656
- Component: s
2657
- };
2658
- return jo(o);
2659
- };
2660
- }
2661
- const da = /* @__PURE__ */ fa();
2662
- function ge(e, t, n) {
2663
- const s = e.getProps();
2664
- return It(s, t, n !== void 0 ? n : s.custom, e);
2539
+ const ra = /* @__PURE__ */ Es({
2540
+ scrapeMotionValuesFromProps: Ds,
2541
+ createRenderState: Ms
2542
+ }), oa = Symbol.for("motionComponentSymbol");
2543
+ function Fs(e) {
2544
+ return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "current");
2665
2545
  }
2666
- const at = (e) => Array.isArray(e);
2667
- function ha(e, t, n) {
2668
- e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, Ee(n));
2546
+ function aa(e, t, n) {
2547
+ return Zs(
2548
+ (s) => {
2549
+ s && e.onMount && e.onMount(s), t && (s ? t.mount(s) : t.unmount()), n && (typeof n == "function" ? n(s) : Fs(n) && (n.current = s));
2550
+ },
2551
+ /**
2552
+ * Only pass a new ref callback to React if we've received a visual element
2553
+ * factory. Otherwise we'll be mounting/remounting every time externalRef
2554
+ * or other dependencies change.
2555
+ */
2556
+ [t]
2557
+ );
2669
2558
  }
2670
- function pa(e) {
2671
- return at(e) ? e[e.length - 1] || 0 : e;
2559
+ const Bt = (e) => e.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), ca = "framerAppearId", Os = "data-" + Bt(ca), ua = oe({});
2560
+ function la(e, t, n, s, i) {
2561
+ var y, T;
2562
+ const { visualElement: r } = k(ke), o = k(Dt), a = k(Dn), l = k(ws).reducedMotion, u = pe(null);
2563
+ s = s || o.renderer, !u.current && s && (u.current = s(e, {
2564
+ visualState: t,
2565
+ parent: r,
2566
+ props: n,
2567
+ presenceContext: a,
2568
+ blockInitialAnimation: a ? a.initial === !1 : !1,
2569
+ reducedMotionConfig: l
2570
+ }));
2571
+ const c = u.current, f = k(ua);
2572
+ c && !c.projection && i && (c.type === "html" || c.type === "svg") && fa(u.current, n, i, f);
2573
+ const d = pe(!1);
2574
+ Js(() => {
2575
+ c && d.current && c.update(n, a);
2576
+ });
2577
+ const h = n[Os], g = pe(!!h && !((y = window.MotionHandoffIsComplete) != null && y.call(window, h)) && ((T = window.MotionHasOptimisedAnimation) == null ? void 0 : T.call(window, h)));
2578
+ return Fi(() => {
2579
+ c && (d.current = !0, window.MotionIsMounted = !0, c.updateFeatures(), c.scheduleRenderMicrotask(), g.current && c.animationState && c.animationState.animateChanges());
2580
+ }), pt(() => {
2581
+ c && (!g.current && c.animationState && c.animationState.animateChanges(), g.current && (queueMicrotask(() => {
2582
+ var p;
2583
+ (p = window.MotionHandoffMarkAsComplete) == null || p.call(window, h);
2584
+ }), g.current = !1), c.enteringChildren = void 0);
2585
+ }), c;
2672
2586
  }
2673
- function ma(e, t) {
2674
- const n = ge(e, t);
2675
- let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
2676
- r = { ...r, ...s };
2677
- for (const o in r) {
2678
- const a = pa(r[o]);
2679
- ha(e, o, a);
2680
- }
2587
+ function fa(e, t, n, s) {
2588
+ const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: l, layoutRoot: u, layoutCrossfade: c } = t;
2589
+ e.projection = new n(e.latestValues, t["data-framer-portal-id"] ? void 0 : Rs(e.parent)), e.projection.setOptions({
2590
+ layoutId: i,
2591
+ layout: r,
2592
+ alwaysMeasureLayout: !!o || a && Fs(a),
2593
+ visualElement: e,
2594
+ /**
2595
+ * TODO: Update options in an effect. This could be tricky as it'll be too late
2596
+ * to update by the time layout animations run.
2597
+ * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
2598
+ * ensuring it gets called if there's no potential layout animations.
2599
+ *
2600
+ */
2601
+ animationType: typeof r == "string" ? r : "both",
2602
+ initialPromotionConfig: s,
2603
+ crossfade: c,
2604
+ layoutScroll: l,
2605
+ layoutRoot: u
2606
+ });
2681
2607
  }
2682
- function ga(e) {
2683
- return !!(O(e) && e.add);
2608
+ function Rs(e) {
2609
+ if (e)
2610
+ return e.options.allowProjection !== !1 ? e.projection : Rs(e.parent);
2684
2611
  }
2685
- function ya(e, t) {
2686
- const n = e.getValue("willChange");
2687
- if (ga(n))
2688
- return n.add(t);
2689
- if (!n && W.WillChange) {
2690
- const s = new W.WillChange("auto");
2691
- e.addValue("willChange", s), s.add(t);
2612
+ function da(e, { forwardMotionProps: t = !1 } = {}, n, s) {
2613
+ const i = It(e) ? ra : ia;
2614
+ function r(a, l) {
2615
+ let u;
2616
+ const c = {
2617
+ ...k(ws),
2618
+ ...a,
2619
+ layoutId: ha(a)
2620
+ }, { isStatic: f } = c, d = $o(a), h = i(a, f);
2621
+ if (!f && gt) {
2622
+ pa(c, n);
2623
+ const g = ma(c);
2624
+ u = g.MeasureLayout, d.visualElement = la(e, h, c, s, g.ProjectionNode);
2625
+ }
2626
+ return Ce(ke.Provider, { value: d, children: [u && d.visualElement ? M(u, { visualElement: d.visualElement, ...c }) : null, ea(e, a, aa(h, d.visualElement, l), h, f, t)] });
2692
2627
  }
2628
+ r.displayName = `motion.${typeof e == "string" ? e : `create(${e.displayName ?? e.name ?? ""})`}`;
2629
+ const o = Qs(r);
2630
+ return o[oa] = e, o;
2693
2631
  }
2694
- function ba(e) {
2695
- return e.props[xs];
2632
+ function ha({ layoutId: e }) {
2633
+ const t = k(Ei).id;
2634
+ return t && e !== void 0 ? t + "-" + e : e;
2696
2635
  }
2697
- const va = (e) => e !== null;
2698
- function Ta(e, { repeat: t, repeatType: n = "loop" }, s) {
2699
- const i = e.filter(va), r = t && n !== "loop" && t % 2 === 1 ? 0 : i.length - 1;
2700
- return i[r];
2636
+ function pa(e, t) {
2637
+ k(Dt).strict, process.env.NODE_ENV;
2701
2638
  }
2702
- const wa = {
2703
- type: "spring",
2704
- stiffness: 500,
2705
- damping: 25,
2706
- restSpeed: 10
2707
- }, Sa = (e) => ({
2708
- type: "spring",
2709
- stiffness: 550,
2710
- damping: e === 0 ? 2 * Math.sqrt(550) : 30,
2711
- restSpeed: 10
2712
- }), xa = {
2713
- type: "keyframes",
2714
- duration: 0.8
2715
- }, Va = {
2716
- type: "keyframes",
2717
- ease: [0.25, 0.1, 0.35, 1],
2718
- duration: 0.3
2719
- }, Aa = (e, { keyframes: t }) => t.length > 2 ? xa : ce.has(e) ? e.startsWith("scale") ? Sa(t[1]) : wa : Va;
2720
- function Ca({ when: e, delay: t, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: l, elapsed: u, ...c }) {
2721
- return !!Object.keys(c).length;
2639
+ function ma(e) {
2640
+ const { drag: t, layout: n } = ie;
2641
+ if (!t && !n)
2642
+ return {};
2643
+ const s = { ...t, ...n };
2644
+ return {
2645
+ MeasureLayout: t != null && t.isEnabled(e) || n != null && n.isEnabled(e) ? s.MeasureLayout : void 0,
2646
+ ProjectionNode: s.ProjectionNode
2647
+ };
2722
2648
  }
2723
- const Ma = (e, t, n, s = {}, i, r) => (o) => {
2724
- const a = ls(s, e) || {}, l = a.delay || s.delay || 0;
2725
- let { elapsed: u = 0 } = s;
2726
- u = u - /* @__PURE__ */ N(l);
2727
- const c = {
2728
- keyframes: Array.isArray(n) ? n : [null, n],
2729
- ease: "easeOut",
2730
- velocity: t.getVelocity(),
2731
- ...a,
2732
- delay: -u,
2733
- onUpdate: (f) => {
2734
- t.set(f), a.onUpdate && a.onUpdate(f);
2735
- },
2736
- onComplete: () => {
2737
- o(), a.onComplete && a.onComplete();
2738
- },
2739
- name: e,
2740
- motionValue: t,
2741
- element: r ? void 0 : i
2649
+ function ga({ top: e, left: t, right: n, bottom: s }) {
2650
+ return {
2651
+ x: { min: t, max: n },
2652
+ y: { min: e, max: s }
2742
2653
  };
2743
- Ca(a) || Object.assign(c, Aa(e, c)), c.duration && (c.duration = /* @__PURE__ */ N(c.duration)), c.repeatDelay && (c.repeatDelay = /* @__PURE__ */ N(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
2744
- let d = !1;
2745
- if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (c.duration = 0, c.delay === 0 && (d = !0)), (W.instantAnimations || W.skipAnimations) && (d = !0, c.duration = 0, c.delay = 0), c.allowFlatten = !a.type && !a.ease, d && !r && t.get() !== void 0) {
2746
- const f = Ta(c.keyframes, a);
2747
- if (f !== void 0) {
2748
- k.update(() => {
2749
- c.onUpdate(f), c.onComplete();
2750
- });
2751
- return;
2752
- }
2753
- }
2754
- return a.isSync ? new At(c) : new no(c);
2755
- };
2756
- function Pa({ protectedKeys: e, needsAnimating: t }, n) {
2757
- const s = e.hasOwnProperty(n) && t[n] !== !0;
2758
- return t[n] = !1, s;
2759
2654
  }
2760
- function Rs(e, t, { delay: n = 0, transitionOverride: s, type: i } = {}) {
2761
- let { transition: r = e.getDefaultTransition(), transitionEnd: o, ...a } = t;
2762
- s && (r = s);
2763
- const l = [], u = i && e.animationState && e.animationState.getState()[i];
2764
- for (const c in a) {
2765
- const d = e.getValue(c, e.latestValues[c] ?? null), f = a[c];
2766
- if (f === void 0 || u && Pa(u, c))
2767
- continue;
2768
- const h = {
2769
- delay: n,
2770
- ...ls(r || {}, c)
2771
- }, g = d.get();
2772
- if (g !== void 0 && !d.isAnimating && !Array.isArray(f) && f === g && !h.velocity)
2773
- continue;
2774
- let y = !1;
2775
- if (window.MotionHandoffAnimation) {
2776
- const p = ba(e);
2777
- if (p) {
2778
- const V = window.MotionHandoffAnimation(p, c, k);
2779
- V !== null && (h.startTime = V, y = !0);
2780
- }
2781
- }
2782
- ya(e, c), d.start(Ma(c, d, f, e.shouldReduceMotion && fs.has(c) ? { type: !1 } : h, e, y));
2783
- const T = d.animation;
2784
- T && l.push(T);
2785
- }
2786
- return o && Promise.all(l).then(() => {
2787
- k.update(() => {
2788
- o && ma(e, o);
2789
- });
2790
- }), l;
2655
+ function ya(e, t) {
2656
+ if (!t)
2657
+ return e;
2658
+ const n = t({ x: e.left, y: e.top }), s = t({ x: e.right, y: e.bottom });
2659
+ return {
2660
+ top: n.y,
2661
+ left: n.x,
2662
+ bottom: s.y,
2663
+ right: s.x
2664
+ };
2791
2665
  }
2792
- function ct(e, t, n = {}) {
2793
- var l;
2794
- const s = ge(e, t, n.type === "exit" ? (l = e.presenceContext) == null ? void 0 : l.custom : void 0);
2795
- let { transition: i = e.getDefaultTransition() || {} } = s || {};
2796
- n.transitionOverride && (i = n.transitionOverride);
2797
- const r = s ? () => Promise.all(Rs(e, s, n)) : () => Promise.resolve(), o = e.variantChildren && e.variantChildren.size ? (u = 0) => {
2798
- const { delayChildren: c = 0, staggerChildren: d, staggerDirection: f } = i;
2799
- return Ea(e, t, u, c, d, f, n);
2800
- } : () => Promise.resolve(), { when: a } = i;
2801
- if (a) {
2802
- const [u, c] = a === "beforeChildren" ? [r, o] : [o, r];
2803
- return u().then(() => c());
2804
- } else
2805
- return Promise.all([r(), o(n.delay)]);
2666
+ function ba(e, t) {
2667
+ return ga(ya(e.getBoundingClientRect(), t));
2806
2668
  }
2807
- function Ea(e, t, n = 0, s = 0, i = 0, r = 1, o) {
2808
- const a = [], l = e.variantChildren.size, u = (l - 1) * i, c = typeof s == "function", d = c ? (f) => s(f, l) : (
2809
- // Support deprecated staggerChildren
2810
- r === 1 ? (f = 0) => f * i : (f = 0) => u - f * i
2811
- );
2812
- return Array.from(e.variantChildren).sort(Da).forEach((f, h) => {
2813
- f.notify("AnimationStart", t), a.push(ct(f, t, {
2814
- ...o,
2815
- delay: n + (c ? 0 : s) + d(h)
2816
- }).then(() => f.notify("AnimationComplete", t)));
2817
- }), Promise.all(a);
2818
- }
2819
- function Da(e, t) {
2820
- return e.sortNodePosition(t);
2669
+ const yn = () => ({ min: 0, max: 0 }), Ls = () => ({
2670
+ x: yn(),
2671
+ y: yn()
2672
+ }), ut = { current: null }, Is = { current: !1 };
2673
+ function va() {
2674
+ if (Is.current = !0, !!gt)
2675
+ if (window.matchMedia) {
2676
+ const e = window.matchMedia("(prefers-reduced-motion)"), t = () => ut.current = e.matches;
2677
+ e.addEventListener("change", t), t();
2678
+ } else
2679
+ ut.current = !1;
2821
2680
  }
2822
- function Fa(e, t, n = {}) {
2823
- e.notify("AnimationStart", t);
2824
- let s;
2825
- if (Array.isArray(t)) {
2826
- const i = t.map((r) => ct(e, r, n));
2827
- s = Promise.all(i);
2828
- } else if (typeof t == "string")
2829
- s = ct(e, t, n);
2830
- else {
2831
- const i = typeof t == "function" ? ge(e, t, n.custom) : t;
2832
- s = Promise.all(Rs(e, i, n));
2681
+ const Ta = /* @__PURE__ */ new WeakMap();
2682
+ function wa(e, t, n) {
2683
+ for (const s in t) {
2684
+ const i = t[s], r = n[s];
2685
+ if (R(i))
2686
+ e.addValue(s, i);
2687
+ else if (R(r))
2688
+ e.addValue(s, Fe(i, { owner: e }));
2689
+ else if (r !== i)
2690
+ if (e.hasValue(s)) {
2691
+ const o = e.getValue(s);
2692
+ o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
2693
+ } else {
2694
+ const o = e.getStaticValue(s);
2695
+ e.addValue(s, Fe(o !== void 0 ? o : i, { owner: e }));
2696
+ }
2833
2697
  }
2834
- return s.then(() => {
2835
- e.notify("AnimationComplete", t);
2836
- });
2837
- }
2838
- function Os(e, t) {
2839
- if (!Array.isArray(t))
2840
- return !1;
2841
- const n = t.length;
2842
- if (n !== e.length)
2843
- return !1;
2844
- for (let s = 0; s < n; s++)
2845
- if (t[s] !== e[s])
2846
- return !1;
2847
- return !0;
2698
+ for (const s in n)
2699
+ t[s] === void 0 && e.removeValue(s);
2700
+ return t;
2848
2701
  }
2849
- const Ra = Dt.length;
2850
- function Ls(e) {
2851
- if (!e)
2852
- return;
2853
- if (!e.isControllingVariants) {
2854
- const n = e.parent ? Ls(e.parent) || {} : {};
2855
- return e.props.initial !== void 0 && (n.initial = e.props.initial), n;
2702
+ const bn = [
2703
+ "AnimationStart",
2704
+ "AnimationComplete",
2705
+ "Update",
2706
+ "BeforeLayoutMeasure",
2707
+ "LayoutMeasure",
2708
+ "LayoutAnimationStart",
2709
+ "LayoutAnimationComplete"
2710
+ ];
2711
+ class Sa {
2712
+ /**
2713
+ * This method takes React props and returns found MotionValues. For example, HTML
2714
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2715
+ *
2716
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2717
+ * intended to be one.
2718
+ */
2719
+ scrapeMotionValuesFromProps(t, n, s) {
2720
+ return {};
2856
2721
  }
2857
- const t = {};
2858
- for (let n = 0; n < Ra; n++) {
2859
- const s = Dt[n], i = e.props[s];
2860
- (me(i) || i === !1) && (t[s] = i);
2722
+ constructor({ parent: t, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
2723
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Pt, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2724
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2725
+ }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2726
+ const d = I.now();
2727
+ this.renderScheduledAt < d && (this.renderScheduledAt = d, N.render(this.render, !1, !0));
2728
+ };
2729
+ const { latestValues: l, renderState: u } = o;
2730
+ this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = u, this.parent = t, this.props = n, this.presenceContext = s, this.depth = t ? t.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Be(n), this.isVariantNode = xs(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(t && t.current);
2731
+ const { willChange: c, ...f } = this.scrapeMotionValuesFromProps(n, {}, this);
2732
+ for (const d in f) {
2733
+ const h = f[d];
2734
+ l[d] !== void 0 && R(h) && h.set(l[d]);
2735
+ }
2861
2736
  }
2862
- return t;
2863
- }
2864
- const Oa = [...Et].reverse(), La = Et.length;
2865
- function Ia(e) {
2866
- return (t) => Promise.all(t.map(({ animation: n, options: s }) => Fa(e, n, s)));
2867
- }
2868
- function ka(e) {
2869
- let t = Ia(e), n = pn(), s = !0;
2870
- const i = (l) => (u, c) => {
2871
- var f;
2872
- const d = ge(e, c, l === "exit" ? (f = e.presenceContext) == null ? void 0 : f.custom : void 0);
2873
- if (d) {
2874
- const { transition: h, transitionEnd: g, ...y } = d;
2875
- u = { ...u, ...y, ...g };
2737
+ mount(t) {
2738
+ var n;
2739
+ this.current = t, Ta.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((s, i) => this.bindToMotionValue(i, s)), Is.current || va(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : ut.current, process.env.NODE_ENV !== "production" && kn(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), (n = this.parent) == null || n.addChild(this), this.update(this.props, this.presenceContext);
2740
+ }
2741
+ unmount() {
2742
+ var t;
2743
+ this.projection && this.projection.unmount(), Xe(this.notifyUpdate), Xe(this.render), this.valueSubscriptions.forEach((n) => n()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), (t = this.parent) == null || t.removeChild(this);
2744
+ for (const n in this.events)
2745
+ this.events[n].clear();
2746
+ for (const n in this.features) {
2747
+ const s = this.features[n];
2748
+ s && (s.unmount(), s.isMounted = !1);
2876
2749
  }
2877
- return u;
2878
- };
2879
- function r(l) {
2880
- t = l(e);
2750
+ this.current = null;
2881
2751
  }
2882
- function o(l) {
2883
- const { props: u } = e, c = Ls(e.parent) || {}, d = [], f = /* @__PURE__ */ new Set();
2884
- let h = {}, g = 1 / 0;
2885
- for (let T = 0; T < La; T++) {
2886
- const p = Oa[T], V = n[p], m = u[p] !== void 0 ? u[p] : c[p], C = me(m), w = p === l ? V.isActive : null;
2887
- w === !1 && (g = T);
2888
- let A = m === c[p] && m !== u[p] && C;
2889
- if (A && s && e.manuallyAnimateOnMount && (A = !1), V.protectedKeys = { ...h }, // If it isn't active and hasn't *just* been set as inactive
2890
- !V.isActive && w === null || // If we didn't and don't have any defined prop for this animation type
2891
- !m && !V.prevProp || // Or if the prop doesn't define an animation
2892
- Ie(m) || typeof m == "boolean")
2752
+ addChild(t) {
2753
+ this.children.add(t), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(t);
2754
+ }
2755
+ removeChild(t) {
2756
+ this.children.delete(t), this.enteringChildren && this.enteringChildren.delete(t);
2757
+ }
2758
+ bindToMotionValue(t, n) {
2759
+ this.valueSubscriptions.has(t) && this.valueSubscriptions.get(t)();
2760
+ const s = fe.has(t);
2761
+ s && this.onBindTransform && this.onBindTransform();
2762
+ const i = n.on("change", (o) => {
2763
+ this.latestValues[t] = o, this.props.onUpdate && N.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
2764
+ });
2765
+ let r;
2766
+ window.MotionCheckAppearSync && (r = window.MotionCheckAppearSync(this, t, n)), this.valueSubscriptions.set(t, () => {
2767
+ i(), r && r(), n.owner && n.stop();
2768
+ });
2769
+ }
2770
+ sortNodePosition(t) {
2771
+ return !this.current || !this.sortInstanceNodePosition || this.type !== t.type ? 0 : this.sortInstanceNodePosition(this.current, t.current);
2772
+ }
2773
+ updateFeatures() {
2774
+ let t = "animation";
2775
+ for (t in ie) {
2776
+ const n = ie[t];
2777
+ if (!n)
2893
2778
  continue;
2894
- const x = Na(V.prevProp, m);
2895
- let S = x || // If we're making this variant active, we want to always make it active
2896
- p === l && V.isActive && !A && C || // If we removed a higher-priority variant (i is in reverse order)
2897
- T > g && C, D = !1;
2898
- const F = Array.isArray(m) ? m : [m];
2899
- let X = F.reduce(i(p), {});
2900
- w === !1 && (X = {});
2901
- const { prevResolvedValues: Nt = {} } = V, js = {
2902
- ...Nt,
2903
- ...X
2904
- }, Bt = (R) => {
2905
- S = !0, f.has(R) && (D = !0, f.delete(R)), V.needsAnimating[R] = !0;
2906
- const B = e.getValue(R);
2907
- B && (B.liveStyle = !1);
2908
- };
2909
- for (const R in js) {
2910
- const B = X[R], Ne = Nt[R];
2911
- if (h.hasOwnProperty(R))
2912
- continue;
2913
- let Be = !1;
2914
- at(B) && at(Ne) ? Be = !Os(B, Ne) : Be = B !== Ne, Be ? B != null ? Bt(R) : f.add(R) : B !== void 0 && f.has(R) ? Bt(R) : V.protectedKeys[R] = !0;
2915
- }
2916
- V.prevProp = m, V.prevResolvedValues = X, V.isActive && (h = { ...h, ...X }), s && e.blockInitialAnimation && (S = !1), S && (!(A && x) || D) && d.push(...F.map((R) => ({
2917
- animation: R,
2918
- options: { type: p }
2919
- })));
2920
- }
2921
- if (f.size) {
2922
- const T = {};
2923
- if (typeof u.initial != "boolean") {
2924
- const p = ge(e, Array.isArray(u.initial) ? u.initial[0] : u.initial);
2925
- p && p.transition && (T.transition = p.transition);
2779
+ const { isEnabled: s, Feature: i } = n;
2780
+ if (!this.features[t] && i && s(this.props) && (this.features[t] = new i(this)), this.features[t]) {
2781
+ const r = this.features[t];
2782
+ r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
2926
2783
  }
2927
- f.forEach((p) => {
2928
- const V = e.getBaseTarget(p), m = e.getValue(p);
2929
- m && (m.liveStyle = !0), T[p] = V ?? null;
2930
- }), d.push({ animation: T });
2931
2784
  }
2932
- let y = !!d.length;
2933
- return s && (u.initial === !1 || u.initial === u.animate) && !e.manuallyAnimateOnMount && (y = !1), s = !1, y ? t(d) : Promise.resolve();
2934
2785
  }
2935
- function a(l, u) {
2936
- var d;
2937
- if (n[l].isActive === u)
2938
- return Promise.resolve();
2939
- (d = e.variantChildren) == null || d.forEach((f) => {
2940
- var h;
2941
- return (h = f.animationState) == null ? void 0 : h.setActive(l, u);
2942
- }), n[l].isActive = u;
2943
- const c = o(l);
2944
- for (const f in n)
2945
- n[f].protectedKeys = {};
2946
- return c;
2786
+ triggerBuild() {
2787
+ this.build(this.renderState, this.latestValues, this.props);
2947
2788
  }
2948
- return {
2949
- animateChanges: o,
2950
- setActive: a,
2951
- setAnimateFunction: r,
2952
- getState: () => n,
2953
- reset: () => {
2954
- n = pn(), s = !0;
2955
- }
2956
- };
2957
- }
2958
- function Na(e, t) {
2959
- return typeof t == "string" ? t !== e : Array.isArray(t) ? !Os(t, e) : !1;
2960
- }
2961
- function _(e = !1) {
2962
- return {
2963
- isActive: e,
2964
- protectedKeys: {},
2965
- needsAnimating: {},
2966
- prevResolvedValues: {}
2967
- };
2968
- }
2969
- function pn() {
2970
- return {
2971
- animate: _(!0),
2972
- whileInView: _(),
2973
- whileHover: _(),
2974
- whileTap: _(),
2975
- whileDrag: _(),
2976
- whileFocus: _(),
2977
- exit: _()
2978
- };
2979
- }
2980
- class ue {
2981
- constructor(t) {
2982
- this.isMounted = !1, this.node = t;
2789
+ /**
2790
+ * Measure the current viewport box with or without transforms.
2791
+ * Only measures axis-aligned boxes, rotate and skew must be manually
2792
+ * removed with a re-render to work.
2793
+ */
2794
+ measureViewportBox() {
2795
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : Ls();
2983
2796
  }
2984
- update() {
2797
+ getStaticValue(t) {
2798
+ return this.latestValues[t];
2799
+ }
2800
+ setStaticValue(t, n) {
2801
+ this.latestValues[t] = n;
2985
2802
  }
2986
- }
2987
- class Ba extends ue {
2988
2803
  /**
2989
- * We dynamically generate the AnimationState manager as it contains a reference
2990
- * to the underlying animation library. We only want to load that if we load this,
2991
- * so people can optionally code split it out using the `m` component.
2804
+ * Update the provided props. Ensure any newly-added motion values are
2805
+ * added to our map, old ones removed, and listeners updated.
2992
2806
  */
2993
- constructor(t) {
2994
- super(t), t.animationState || (t.animationState = ka(t));
2807
+ update(t, n) {
2808
+ (t.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = t, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
2809
+ for (let s = 0; s < bn.length; s++) {
2810
+ const i = bn[s];
2811
+ this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
2812
+ const r = "on" + i, o = t[r];
2813
+ o && (this.propEventSubscriptions[i] = this.on(i, o));
2814
+ }
2815
+ this.prevMotionValues = wa(this, this.scrapeMotionValuesFromProps(t, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
2995
2816
  }
2996
- updateAnimationControlsSubscription() {
2997
- const { animate: t } = this.node.getProps();
2998
- Ie(t) && (this.unmountControls = t.subscribe(this.node));
2817
+ getProps() {
2818
+ return this.props;
2999
2819
  }
3000
2820
  /**
3001
- * Subscribe any provided AnimationControls to the component's VisualElement
2821
+ * Returns the variant definition with a given name.
3002
2822
  */
3003
- mount() {
3004
- this.updateAnimationControlsSubscription();
2823
+ getVariant(t) {
2824
+ return this.props.variants ? this.props.variants[t] : void 0;
3005
2825
  }
3006
- update() {
3007
- const { animate: t } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
3008
- t !== n && this.updateAnimationControlsSubscription();
2826
+ /**
2827
+ * Returns the defined default transition on this component.
2828
+ */
2829
+ getDefaultTransition() {
2830
+ return this.props.transition;
3009
2831
  }
3010
- unmount() {
3011
- var t;
3012
- this.node.animationState.reset(), (t = this.unmountControls) == null || t.call(this);
2832
+ getTransformPagePoint() {
2833
+ return this.props.transformPagePoint;
3013
2834
  }
3014
- }
3015
- let Ka = 0;
3016
- class Wa extends ue {
3017
- constructor() {
3018
- super(...arguments), this.id = Ka++;
2835
+ getClosestVariantNode() {
2836
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
3019
2837
  }
3020
- update() {
3021
- if (!this.node.presenceContext)
3022
- return;
3023
- const { isPresent: t, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
3024
- if (!this.node.animationState || t === s)
3025
- return;
3026
- const i = this.node.animationState.setActive("exit", !t);
3027
- n && !t && i.then(() => {
3028
- n(this.id);
3029
- });
2838
+ /**
2839
+ * Add a child visual element to our set of children.
2840
+ */
2841
+ addVariantChild(t) {
2842
+ const n = this.getClosestVariantNode();
2843
+ if (n)
2844
+ return n.variantChildren && n.variantChildren.add(t), () => n.variantChildren.delete(t);
3030
2845
  }
3031
- mount() {
3032
- const { register: t, onExitComplete: n } = this.node.presenceContext || {};
3033
- n && n(this.id), t && (this.unmount = t(this.id));
2846
+ /**
2847
+ * Add a motion value and bind it to this visual element.
2848
+ */
2849
+ addValue(t, n) {
2850
+ const s = this.values.get(t);
2851
+ n !== s && (s && this.removeValue(t), this.bindToMotionValue(t, n), this.values.set(t, n), this.latestValues[t] = n.get());
3034
2852
  }
3035
- unmount() {
2853
+ /**
2854
+ * Remove a motion value and unbind any active subscriptions.
2855
+ */
2856
+ removeValue(t) {
2857
+ this.values.delete(t);
2858
+ const n = this.valueSubscriptions.get(t);
2859
+ n && (n(), this.valueSubscriptions.delete(t)), delete this.latestValues[t], this.removeValueFromRenderState(t, this.renderState);
3036
2860
  }
3037
- }
3038
- const $a = {
3039
- animation: {
3040
- Feature: Ba
3041
- },
3042
- exit: {
3043
- Feature: Wa
2861
+ /**
2862
+ * Check whether we have a motion value for this key
2863
+ */
2864
+ hasValue(t) {
2865
+ return this.values.has(t);
3044
2866
  }
3045
- };
3046
- function mn(e, t, n, s = { passive: !0 }) {
3047
- return e.addEventListener(t, n, s), () => e.removeEventListener(t, n);
3048
- }
3049
- function Is(e) {
3050
- return {
3051
- point: {
3052
- x: e.pageX,
3053
- y: e.pageY
3054
- }
3055
- };
3056
- }
3057
- function _a({ top: e, left: t, right: n, bottom: s }) {
3058
- return {
3059
- x: { min: t, max: n },
3060
- y: { min: e, max: s }
3061
- };
3062
- }
3063
- function ja(e, t) {
3064
- if (!t)
3065
- return e;
3066
- const n = t({ x: e.left, y: e.top }), s = t({ x: e.right, y: e.bottom });
3067
- return {
3068
- top: n.y,
3069
- left: n.x,
3070
- bottom: s.y,
3071
- right: s.x
3072
- };
3073
- }
3074
- const gn = () => ({ min: 0, max: 0 }), ks = () => ({
3075
- x: gn(),
3076
- y: gn()
3077
- });
3078
- function Ua(e, t) {
3079
- return _a(ja(e.getBoundingClientRect(), t));
3080
- }
3081
- function yn(e, t, n) {
3082
- const { props: s } = e;
3083
- e.animationState && s.whileHover && e.animationState.setActive("whileHover", n === "Start");
3084
- const i = "onHover" + n, r = s[i];
3085
- r && k.postRender(() => r(t, Is(t)));
3086
- }
3087
- class Ga extends ue {
3088
- mount() {
3089
- const { current: t } = this.node;
3090
- t && (this.unmount = xo(t, (n, s) => (yn(this.node, s, "Start"), (i) => yn(this.node, i, "End"))));
2867
+ getValue(t, n) {
2868
+ if (this.props.values && this.props.values[t])
2869
+ return this.props.values[t];
2870
+ let s = this.values.get(t);
2871
+ return s === void 0 && n !== void 0 && (s = Fe(n === null ? void 0 : n, { owner: this }), this.addValue(t, s)), s;
3091
2872
  }
3092
- unmount() {
2873
+ /**
2874
+ * If we're trying to animate to a previously unencountered value,
2875
+ * we need to check for it in our state and as a last resort read it
2876
+ * directly from the instance (which might have performance implications).
2877
+ */
2878
+ readValue(t, n) {
2879
+ let s = this.latestValues[t] !== void 0 || !this.current ? this.latestValues[t] : this.getBaseTargetFromProps(this.props, t) ?? this.readValueFromInstance(this.current, t, this.options);
2880
+ return s != null && (typeof s == "string" && (Fn(s) || On(s)) ? s = parseFloat(s) : !Io(s) && ue.test(n) && (s = ys(t, n)), this.setBaseTarget(t, R(s) ? s.get() : s)), R(s) ? s.get() : s;
3093
2881
  }
3094
- }
3095
- class za extends ue {
3096
- constructor() {
3097
- super(...arguments), this.isActive = !1;
2882
+ /**
2883
+ * Set the base target to later animate back to. This is currently
2884
+ * only hydrated on creation and when we first read a value.
2885
+ */
2886
+ setBaseTarget(t, n) {
2887
+ this.baseTarget[t] = n;
3098
2888
  }
3099
- onFocus() {
3100
- let t = !1;
3101
- try {
3102
- t = this.node.current.matches(":focus-visible");
3103
- } catch {
3104
- t = !0;
2889
+ /**
2890
+ * Find the base target for a value thats been removed from all animation
2891
+ * props.
2892
+ */
2893
+ getBaseTarget(t) {
2894
+ var r;
2895
+ const { initial: n } = this.props;
2896
+ let s;
2897
+ if (typeof n == "string" || typeof n == "object") {
2898
+ const o = kt(this.props, n, (r = this.presenceContext) == null ? void 0 : r.custom);
2899
+ o && (s = o[t]);
3105
2900
  }
3106
- !t || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
3107
- }
3108
- onBlur() {
3109
- !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
3110
- }
3111
- mount() {
3112
- this.unmount = Re(mn(this.node.current, "focus", () => this.onFocus()), mn(this.node.current, "blur", () => this.onBlur()));
2901
+ if (n && s !== void 0)
2902
+ return s;
2903
+ const i = this.getBaseTargetFromProps(this.props, t);
2904
+ return i !== void 0 && !R(i) ? i : this.initialValues[t] !== void 0 && s === void 0 ? void 0 : this.baseTarget[t];
3113
2905
  }
3114
- unmount() {
2906
+ on(t, n) {
2907
+ return this.events[t] || (this.events[t] = new Ln()), this.events[t].add(n);
3115
2908
  }
3116
- }
3117
- function bn(e, t, n) {
3118
- const { props: s } = e;
3119
- if (e.current instanceof HTMLButtonElement && e.current.disabled)
3120
- return;
3121
- e.animationState && s.whileTap && e.animationState.setActive("whileTap", n === "Start");
3122
- const i = "onTap" + (n === "End" ? "" : n), r = s[i];
3123
- r && k.postRender(() => r(t, Is(t)));
3124
- }
3125
- class Ha extends ue {
3126
- mount() {
3127
- const { current: t } = this.node;
3128
- t && (this.unmount = Po(t, (n, s) => (bn(this.node, s, "Start"), (i, { success: r }) => bn(this.node, i, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
2909
+ notify(t, ...n) {
2910
+ this.events[t] && this.events[t].notify(...n);
3129
2911
  }
3130
- unmount() {
2912
+ scheduleRenderMicrotask() {
2913
+ Ao.render(this.render);
3131
2914
  }
3132
2915
  }
3133
- const ut = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), Ya = (e) => {
3134
- const t = ut.get(e.target);
3135
- t && t(e);
3136
- }, Xa = (e) => {
3137
- e.forEach(Ya);
3138
- };
3139
- function qa({ root: e, ...t }) {
3140
- const n = e || document;
3141
- ze.has(n) || ze.set(n, {});
3142
- const s = ze.get(n), i = JSON.stringify(t);
3143
- return s[i] || (s[i] = new IntersectionObserver(Xa, { root: e, ...t })), s[i];
3144
- }
3145
- function Za(e, t, n) {
3146
- const s = qa(t);
3147
- return ut.set(e, n), s.observe(e), () => {
3148
- ut.delete(e), s.unobserve(e);
3149
- };
3150
- }
3151
- const Ja = {
3152
- some: 0,
3153
- all: 1
3154
- };
3155
- class Qa extends ue {
2916
+ class ks extends Sa {
3156
2917
  constructor() {
3157
- super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
2918
+ super(...arguments), this.KeyframeResolver = To;
3158
2919
  }
3159
- startObserver() {
3160
- this.unmount();
3161
- const { viewport: t = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = t, o = {
3162
- root: n ? n.current : void 0,
3163
- rootMargin: s,
3164
- threshold: typeof i == "number" ? i : Ja[i]
3165
- }, a = (l) => {
3166
- const { isIntersecting: u } = l;
3167
- if (this.isInView === u || (this.isInView = u, r && !u && this.hasEnteredView))
3168
- return;
3169
- u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
3170
- const { onViewportEnter: c, onViewportLeave: d } = this.node.getProps(), f = u ? c : d;
3171
- f && f(l);
3172
- };
3173
- return Za(this.node.current, o, a);
2920
+ sortInstanceNodePosition(t, n) {
2921
+ return t.compareDocumentPosition(n) & 2 ? 1 : -1;
3174
2922
  }
3175
- mount() {
3176
- this.startObserver();
2923
+ getBaseTargetFromProps(t, n) {
2924
+ return t.style ? t.style[n] : void 0;
3177
2925
  }
3178
- update() {
3179
- if (typeof IntersectionObserver > "u")
3180
- return;
3181
- const { props: t, prevProps: n } = this.node;
3182
- ["amount", "margin", "root"].some(ec(t, n)) && this.startObserver();
2926
+ removeValueFromRenderState(t, { vars: n, style: s }) {
2927
+ delete n[t], delete s[t];
3183
2928
  }
3184
- unmount() {
2929
+ handleChildMotionValue() {
2930
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
2931
+ const { children: t } = this.props;
2932
+ R(t) && (this.childSubscription = t.on("change", (n) => {
2933
+ this.current && (this.current.textContent = `${n}`);
2934
+ }));
3185
2935
  }
3186
2936
  }
3187
- function ec({ viewport: e = {} }, { viewport: t = {} } = {}) {
3188
- return (n) => e[n] !== t[n];
3189
- }
3190
- const tc = {
3191
- inView: {
3192
- Feature: Qa
3193
- },
3194
- tap: {
3195
- Feature: Ha
3196
- },
3197
- focus: {
3198
- Feature: za
3199
- },
3200
- hover: {
3201
- Feature: Ga
3202
- }
3203
- }, lt = { current: null }, Ns = { current: !1 };
3204
- function nc() {
3205
- if (Ns.current = !0, !!pt)
3206
- if (window.matchMedia) {
3207
- const e = window.matchMedia("(prefers-reduced-motion)"), t = () => lt.current = e.matches;
3208
- e.addEventListener("change", t), t();
3209
- } else
3210
- lt.current = !1;
2937
+ function Ns(e, { style: t, vars: n }, s, i) {
2938
+ const r = e.style;
2939
+ let o;
2940
+ for (o in t)
2941
+ r[o] = t[o];
2942
+ i == null || i.applyProjectionStyles(r, s);
2943
+ for (o in n)
2944
+ r.setProperty(o, n[o]);
3211
2945
  }
3212
- const sc = /* @__PURE__ */ new WeakMap();
3213
- function ic(e, t, n) {
3214
- for (const s in t) {
3215
- const i = t[s], r = n[s];
3216
- if (O(i))
3217
- e.addValue(s, i);
3218
- else if (O(r))
3219
- e.addValue(s, Ee(i, { owner: e }));
3220
- else if (r !== i)
3221
- if (e.hasValue(s)) {
3222
- const o = e.getValue(s);
3223
- o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
3224
- } else {
3225
- const o = e.getStaticValue(s);
3226
- e.addValue(s, Ee(o !== void 0 ? o : i, { owner: e }));
3227
- }
3228
- }
3229
- for (const s in n)
3230
- t[s] === void 0 && e.removeValue(s);
3231
- return t;
2946
+ function xa(e) {
2947
+ return window.getComputedStyle(e);
3232
2948
  }
3233
- const vn = [
3234
- "AnimationStart",
3235
- "AnimationComplete",
3236
- "Update",
3237
- "BeforeLayoutMeasure",
3238
- "LayoutMeasure",
3239
- "LayoutAnimationStart",
3240
- "LayoutAnimationComplete"
3241
- ];
3242
- class rc {
3243
- /**
3244
- * This method takes React props and returns found MotionValues. For example, HTML
3245
- * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
3246
- *
3247
- * This isn't an abstract method as it needs calling in the constructor, but it is
3248
- * intended to be one.
3249
- */
3250
- scrapeMotionValuesFromProps(t, n, s) {
3251
- return {};
2949
+ class Va extends ks {
2950
+ constructor() {
2951
+ super(...arguments), this.type = "html", this.renderInstance = Ns;
3252
2952
  }
3253
- constructor({ parent: t, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
3254
- this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Ct, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
3255
- this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
3256
- }, this.renderScheduledAt = 0, this.scheduleRender = () => {
3257
- const f = L.now();
3258
- this.renderScheduledAt < f && (this.renderScheduledAt = f, k.render(this.render, !1, !0));
3259
- };
3260
- const { latestValues: l, renderState: u } = o;
3261
- this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = u, this.parent = t, this.props = n, this.presenceContext = s, this.depth = t ? t.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = ke(n), this.isVariantNode = ws(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(t && t.current);
3262
- const { willChange: c, ...d } = this.scrapeMotionValuesFromProps(n, {}, this);
3263
- for (const f in d) {
3264
- const h = d[f];
3265
- l[f] !== void 0 && O(h) && h.set(l[f], !1);
2953
+ readValueFromInstance(t, n) {
2954
+ var s;
2955
+ if (fe.has(n))
2956
+ return (s = this.projection) != null && s.isProjecting ? nt(n) : Nr(t, n);
2957
+ {
2958
+ const i = xa(t), r = (Yn(n) ? i.getPropertyValue(n) : i[n]) || 0;
2959
+ return typeof r == "string" ? r.trim() : r;
3266
2960
  }
3267
2961
  }
3268
- mount(t) {
3269
- this.current = t, sc.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)), Ns.current || nc(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : lt.current, process.env.NODE_ENV !== "production" && On(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext);
2962
+ measureInstanceViewportBox(t, { transformPagePoint: n }) {
2963
+ return ba(t, n);
3270
2964
  }
3271
- unmount() {
3272
- this.projection && this.projection.unmount(), Ye(this.notifyUpdate), Ye(this.render), this.valueSubscriptions.forEach((t) => t()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
3273
- for (const t in this.events)
3274
- this.events[t].clear();
3275
- for (const t in this.features) {
3276
- const n = this.features[t];
3277
- n && (n.unmount(), n.isMounted = !1);
3278
- }
3279
- this.current = null;
2965
+ build(t, n, s) {
2966
+ Rt(t, n, s.transformTemplate);
3280
2967
  }
3281
- bindToMotionValue(t, n) {
3282
- this.valueSubscriptions.has(t) && this.valueSubscriptions.get(t)();
3283
- const s = ce.has(t);
3284
- s && this.onBindTransform && this.onBindTransform();
3285
- const i = n.on("change", (a) => {
3286
- this.latestValues[t] = a, this.props.onUpdate && k.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
3287
- }), r = n.on("renderRequest", this.scheduleRender);
3288
- let o;
3289
- window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, t, n)), this.valueSubscriptions.set(t, () => {
3290
- i(), r(), o && o(), n.owner && n.stop();
3291
- });
2968
+ scrapeMotionValuesFromProps(t, n, s) {
2969
+ return Nt(t, n, s);
3292
2970
  }
3293
- sortNodePosition(t) {
3294
- return !this.current || !this.sortInstanceNodePosition || this.type !== t.type ? 0 : this.sortInstanceNodePosition(this.current, t.current);
2971
+ }
2972
+ const Bs = /* @__PURE__ */ new Set([
2973
+ "baseFrequency",
2974
+ "diffuseConstant",
2975
+ "kernelMatrix",
2976
+ "kernelUnitLength",
2977
+ "keySplines",
2978
+ "keyTimes",
2979
+ "limitingConeAngle",
2980
+ "markerHeight",
2981
+ "markerWidth",
2982
+ "numOctaves",
2983
+ "targetX",
2984
+ "targetY",
2985
+ "surfaceScale",
2986
+ "specularConstant",
2987
+ "specularExponent",
2988
+ "stdDeviation",
2989
+ "tableValues",
2990
+ "viewBox",
2991
+ "gradientTransform",
2992
+ "pathLength",
2993
+ "startOffset",
2994
+ "textLength",
2995
+ "lengthAdjust"
2996
+ ]);
2997
+ function Aa(e, t, n, s) {
2998
+ Ns(e, t, void 0, s);
2999
+ for (const i in t.attrs)
3000
+ e.setAttribute(Bs.has(i) ? i : Bt(i), t.attrs[i]);
3001
+ }
3002
+ class Ca extends ks {
3003
+ constructor() {
3004
+ super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = Ls;
3295
3005
  }
3296
- updateFeatures() {
3297
- let t = "animation";
3298
- for (t in te) {
3299
- const n = te[t];
3300
- if (!n)
3301
- continue;
3302
- const { isEnabled: s, Feature: i } = n;
3303
- if (!this.features[t] && i && s(this.props) && (this.features[t] = new i(this)), this.features[t]) {
3304
- const r = this.features[t];
3305
- r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
3306
- }
3006
+ getBaseTargetFromProps(t, n) {
3007
+ return t[n];
3008
+ }
3009
+ readValueFromInstance(t, n) {
3010
+ if (fe.has(n)) {
3011
+ const s = gs(n);
3012
+ return s && s.default || 0;
3307
3013
  }
3014
+ return n = Bs.has(n) ? n : Bt(n), t.getAttribute(n);
3308
3015
  }
3309
- triggerBuild() {
3310
- this.build(this.renderState, this.latestValues, this.props);
3016
+ scrapeMotionValuesFromProps(t, n, s) {
3017
+ return Ds(t, n, s);
3311
3018
  }
3312
- /**
3313
- * Measure the current viewport box with or without transforms.
3314
- * Only measures axis-aligned boxes, rotate and skew must be manually
3315
- * removed with a re-render to work.
3316
- */
3317
- measureViewportBox() {
3318
- return this.current ? this.measureInstanceViewportBox(this.current, this.props) : ks();
3019
+ build(t, n, s) {
3020
+ Cs(t, n, this.isSVGTag, s.transformTemplate, s.style);
3319
3021
  }
3320
- getStaticValue(t) {
3321
- return this.latestValues[t];
3022
+ renderInstance(t, n, s, i) {
3023
+ Aa(t, n, s, i);
3322
3024
  }
3323
- setStaticValue(t, n) {
3324
- this.latestValues[t] = n;
3025
+ mount(t) {
3026
+ this.isSVGTag = Ps(t.tagName), super.mount(t);
3325
3027
  }
3326
- /**
3327
- * Update the provided props. Ensure any newly-added motion values are
3328
- * added to our map, old ones removed, and listeners updated.
3329
- */
3330
- update(t, n) {
3331
- (t.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = t, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
3332
- for (let s = 0; s < vn.length; s++) {
3333
- const i = vn[s];
3334
- this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
3335
- const r = "on" + i, o = t[r];
3336
- o && (this.propEventSubscriptions[i] = this.on(i, o));
3337
- }
3338
- this.prevMotionValues = ic(this, this.scrapeMotionValuesFromProps(t, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
3028
+ }
3029
+ const Ma = (e, t) => It(e) ? new Ca(t) : new Va(t, {
3030
+ allowProjection: e !== xn
3031
+ });
3032
+ function ne(e, t, n) {
3033
+ const s = e.getProps();
3034
+ return kt(s, t, n !== void 0 ? n : s.custom, e);
3035
+ }
3036
+ const lt = (e) => Array.isArray(e);
3037
+ function Pa(e, t, n) {
3038
+ e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, Fe(n));
3039
+ }
3040
+ function Ea(e) {
3041
+ return lt(e) ? e[e.length - 1] || 0 : e;
3042
+ }
3043
+ function Da(e, t) {
3044
+ const n = ne(e, t);
3045
+ let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
3046
+ r = { ...r, ...s };
3047
+ for (const o in r) {
3048
+ const a = Ea(r[o]);
3049
+ Pa(e, o, a);
3339
3050
  }
3340
- getProps() {
3341
- return this.props;
3051
+ }
3052
+ function Fa(e) {
3053
+ return !!(R(e) && e.add);
3054
+ }
3055
+ function Oa(e, t) {
3056
+ const n = e.getValue("willChange");
3057
+ if (Fa(n))
3058
+ return n.add(t);
3059
+ if (!n && W.WillChange) {
3060
+ const s = new W.WillChange("auto");
3061
+ e.addValue("willChange", s), s.add(t);
3342
3062
  }
3343
- /**
3344
- * Returns the variant definition with a given name.
3345
- */
3346
- getVariant(t) {
3347
- return this.props.variants ? this.props.variants[t] : void 0;
3063
+ }
3064
+ function Ra(e) {
3065
+ return e.props[Os];
3066
+ }
3067
+ const La = (e) => e !== null;
3068
+ function Ia(e, { repeat: t, repeatType: n = "loop" }, s) {
3069
+ const i = e.filter(La), r = t && n !== "loop" && t % 2 === 1 ? 0 : i.length - 1;
3070
+ return i[r];
3071
+ }
3072
+ const ka = {
3073
+ type: "spring",
3074
+ stiffness: 500,
3075
+ damping: 25,
3076
+ restSpeed: 10
3077
+ }, Na = (e) => ({
3078
+ type: "spring",
3079
+ stiffness: 550,
3080
+ damping: e === 0 ? 2 * Math.sqrt(550) : 30,
3081
+ restSpeed: 10
3082
+ }), Ba = {
3083
+ type: "keyframes",
3084
+ duration: 0.8
3085
+ }, Ka = {
3086
+ type: "keyframes",
3087
+ ease: [0.25, 0.1, 0.35, 1],
3088
+ duration: 0.3
3089
+ }, Wa = (e, { keyframes: t }) => t.length > 2 ? Ba : fe.has(e) ? e.startsWith("scale") ? Na(t[1]) : ka : Ka;
3090
+ function $a({ when: e, delay: t, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: l, elapsed: u, ...c }) {
3091
+ return !!Object.keys(c).length;
3092
+ }
3093
+ const ja = (e, t, n, s = {}, i, r) => (o) => {
3094
+ const a = ds(s, e) || {}, l = a.delay || s.delay || 0;
3095
+ let { elapsed: u = 0 } = s;
3096
+ u = u - /* @__PURE__ */ B(l);
3097
+ const c = {
3098
+ keyframes: Array.isArray(n) ? n : [null, n],
3099
+ ease: "easeOut",
3100
+ velocity: t.getVelocity(),
3101
+ ...a,
3102
+ delay: -u,
3103
+ onUpdate: (d) => {
3104
+ t.set(d), a.onUpdate && a.onUpdate(d);
3105
+ },
3106
+ onComplete: () => {
3107
+ o(), a.onComplete && a.onComplete();
3108
+ },
3109
+ name: e,
3110
+ motionValue: t,
3111
+ element: r ? void 0 : i
3112
+ };
3113
+ $a(a) || Object.assign(c, Wa(e, c)), c.duration && (c.duration = /* @__PURE__ */ B(c.duration)), c.repeatDelay && (c.repeatDelay = /* @__PURE__ */ B(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
3114
+ let f = !1;
3115
+ if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (at(c), c.delay === 0 && (f = !0)), (W.instantAnimations || W.skipAnimations) && (f = !0, at(c), c.delay = 0), c.allowFlatten = !a.type && !a.ease, f && !r && t.get() !== void 0) {
3116
+ const d = Ia(c.keyframes, a);
3117
+ if (d !== void 0) {
3118
+ N.update(() => {
3119
+ c.onUpdate(d), c.onComplete();
3120
+ });
3121
+ return;
3122
+ }
3348
3123
  }
3349
- /**
3350
- * Returns the defined default transition on this component.
3351
- */
3352
- getDefaultTransition() {
3353
- return this.props.transition;
3124
+ return a.isSync ? new Mt(c) : new oo(c);
3125
+ };
3126
+ function _a({ protectedKeys: e, needsAnimating: t }, n) {
3127
+ const s = e.hasOwnProperty(n) && t[n] !== !0;
3128
+ return t[n] = !1, s;
3129
+ }
3130
+ function Ks(e, t, { delay: n = 0, transitionOverride: s, type: i } = {}) {
3131
+ let { transition: r = e.getDefaultTransition(), transitionEnd: o, ...a } = t;
3132
+ s && (r = s);
3133
+ const l = [], u = i && e.animationState && e.animationState.getState()[i];
3134
+ for (const c in a) {
3135
+ const f = e.getValue(c, e.latestValues[c] ?? null), d = a[c];
3136
+ if (d === void 0 || u && _a(u, c))
3137
+ continue;
3138
+ const h = {
3139
+ delay: n,
3140
+ ...ds(r || {}, c)
3141
+ }, g = f.get();
3142
+ if (g !== void 0 && !f.isAnimating && !Array.isArray(d) && d === g && !h.velocity)
3143
+ continue;
3144
+ let y = !1;
3145
+ if (window.MotionHandoffAnimation) {
3146
+ const p = Ra(e);
3147
+ if (p) {
3148
+ const V = window.MotionHandoffAnimation(p, c, N);
3149
+ V !== null && (h.startTime = V, y = !0);
3150
+ }
3151
+ }
3152
+ Oa(e, c), f.start(ja(c, f, d, e.shouldReduceMotion && hs.has(c) ? { type: !1 } : h, e, y));
3153
+ const T = f.animation;
3154
+ T && l.push(T);
3354
3155
  }
3355
- getTransformPagePoint() {
3356
- return this.props.transformPagePoint;
3156
+ return o && Promise.all(l).then(() => {
3157
+ N.update(() => {
3158
+ o && Da(e, o);
3159
+ });
3160
+ }), l;
3161
+ }
3162
+ function Ws(e, t, n, s = 0, i = 1) {
3163
+ const r = Array.from(e).sort((u, c) => u.sortNodePosition(c)).indexOf(t), o = e.size, a = (o - 1) * s;
3164
+ return typeof n == "function" ? n(r, o) : i === 1 ? r * s : a - r * s;
3165
+ }
3166
+ function ft(e, t, n = {}) {
3167
+ var l;
3168
+ const s = ne(e, t, n.type === "exit" ? (l = e.presenceContext) == null ? void 0 : l.custom : void 0);
3169
+ let { transition: i = e.getDefaultTransition() || {} } = s || {};
3170
+ n.transitionOverride && (i = n.transitionOverride);
3171
+ const r = s ? () => Promise.all(Ks(e, s, n)) : () => Promise.resolve(), o = e.variantChildren && e.variantChildren.size ? (u = 0) => {
3172
+ const { delayChildren: c = 0, staggerChildren: f, staggerDirection: d } = i;
3173
+ return Ua(e, t, u, c, f, d, n);
3174
+ } : () => Promise.resolve(), { when: a } = i;
3175
+ if (a) {
3176
+ const [u, c] = a === "beforeChildren" ? [r, o] : [o, r];
3177
+ return u().then(() => c());
3178
+ } else
3179
+ return Promise.all([r(), o(n.delay)]);
3180
+ }
3181
+ function Ua(e, t, n = 0, s = 0, i = 0, r = 1, o) {
3182
+ const a = [];
3183
+ for (const l of e.variantChildren)
3184
+ l.notify("AnimationStart", t), a.push(ft(l, t, {
3185
+ ...o,
3186
+ delay: n + (typeof s == "function" ? 0 : s) + Ws(e.variantChildren, l, s, i, r)
3187
+ }).then(() => l.notify("AnimationComplete", t)));
3188
+ return Promise.all(a);
3189
+ }
3190
+ function Ga(e, t, n = {}) {
3191
+ e.notify("AnimationStart", t);
3192
+ let s;
3193
+ if (Array.isArray(t)) {
3194
+ const i = t.map((r) => ft(e, r, n));
3195
+ s = Promise.all(i);
3196
+ } else if (typeof t == "string")
3197
+ s = ft(e, t, n);
3198
+ else {
3199
+ const i = typeof t == "function" ? ne(e, t, n.custom) : t;
3200
+ s = Promise.all(Ks(e, i, n));
3357
3201
  }
3358
- getClosestVariantNode() {
3359
- return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
3202
+ return s.then(() => {
3203
+ e.notify("AnimationComplete", t);
3204
+ });
3205
+ }
3206
+ function $s(e, t) {
3207
+ if (!Array.isArray(t))
3208
+ return !1;
3209
+ const n = t.length;
3210
+ if (n !== e.length)
3211
+ return !1;
3212
+ for (let s = 0; s < n; s++)
3213
+ if (t[s] !== e[s])
3214
+ return !1;
3215
+ return !0;
3216
+ }
3217
+ const Ha = Ot.length;
3218
+ function js(e) {
3219
+ if (!e)
3220
+ return;
3221
+ if (!e.isControllingVariants) {
3222
+ const n = e.parent ? js(e.parent) || {} : {};
3223
+ return e.props.initial !== void 0 && (n.initial = e.props.initial), n;
3360
3224
  }
3361
- /**
3362
- * Add a child visual element to our set of children.
3363
- */
3364
- addVariantChild(t) {
3365
- const n = this.getClosestVariantNode();
3366
- if (n)
3367
- return n.variantChildren && n.variantChildren.add(t), () => n.variantChildren.delete(t);
3225
+ const t = {};
3226
+ for (let n = 0; n < Ha; n++) {
3227
+ const s = Ot[n], i = e.props[s];
3228
+ (be(i) || i === !1) && (t[s] = i);
3368
3229
  }
3369
- /**
3370
- * Add a motion value and bind it to this visual element.
3371
- */
3372
- addValue(t, n) {
3373
- const s = this.values.get(t);
3374
- n !== s && (s && this.removeValue(t), this.bindToMotionValue(t, n), this.values.set(t, n), this.latestValues[t] = n.get());
3230
+ return t;
3231
+ }
3232
+ const za = [...Ft].reverse(), Ya = Ft.length;
3233
+ function Xa(e) {
3234
+ return (t) => Promise.all(t.map(({ animation: n, options: s }) => Ga(e, n, s)));
3235
+ }
3236
+ function qa(e) {
3237
+ let t = Xa(e), n = vn(), s = !0;
3238
+ const i = (l) => (u, c) => {
3239
+ var d;
3240
+ const f = ne(e, c, l === "exit" ? (d = e.presenceContext) == null ? void 0 : d.custom : void 0);
3241
+ if (f) {
3242
+ const { transition: h, transitionEnd: g, ...y } = f;
3243
+ u = { ...u, ...y, ...g };
3244
+ }
3245
+ return u;
3246
+ };
3247
+ function r(l) {
3248
+ t = l(e);
3375
3249
  }
3376
- /**
3377
- * Remove a motion value and unbind any active subscriptions.
3378
- */
3379
- removeValue(t) {
3380
- this.values.delete(t);
3381
- const n = this.valueSubscriptions.get(t);
3382
- n && (n(), this.valueSubscriptions.delete(t)), delete this.latestValues[t], this.removeValueFromRenderState(t, this.renderState);
3250
+ function o(l) {
3251
+ const { props: u } = e, c = js(e.parent) || {}, f = [], d = /* @__PURE__ */ new Set();
3252
+ let h = {}, g = 1 / 0;
3253
+ for (let T = 0; T < Ya; T++) {
3254
+ const p = za[T], V = n[p], m = u[p] !== void 0 ? u[p] : c[p], C = be(m), w = p === l ? V.isActive : null;
3255
+ w === !1 && (g = T);
3256
+ let A = m === c[p] && m !== u[p] && C;
3257
+ if (A && s && e.manuallyAnimateOnMount && (A = !1), V.protectedKeys = { ...h }, // If it isn't active and hasn't *just* been set as inactive
3258
+ !V.isActive && w === null || // If we didn't and don't have any defined prop for this animation type
3259
+ !m && !V.prevProp || // Or if the prop doesn't define an animation
3260
+ Ne(m) || typeof m == "boolean")
3261
+ continue;
3262
+ const x = Za(V.prevProp, m);
3263
+ let S = x || // If we're making this variant active, we want to always make it active
3264
+ p === l && V.isActive && !A && C || // If we removed a higher-priority variant (i is in reverse order)
3265
+ T > g && C, D = !1;
3266
+ const O = Array.isArray(m) ? m : [m];
3267
+ let q = O.reduce(i(p), {});
3268
+ w === !1 && (q = {});
3269
+ const { prevResolvedValues: Kt = {} } = V, Hs = {
3270
+ ...Kt,
3271
+ ...q
3272
+ }, Wt = (F) => {
3273
+ S = !0, d.has(F) && (D = !0, d.delete(F)), V.needsAnimating[F] = !0;
3274
+ const L = e.getValue(F);
3275
+ L && (L.liveStyle = !1);
3276
+ };
3277
+ for (const F in Hs) {
3278
+ const L = q[F], j = Kt[F];
3279
+ if (h.hasOwnProperty(F))
3280
+ continue;
3281
+ let Z = !1;
3282
+ lt(L) && lt(j) ? Z = !$s(L, j) : Z = L !== j, Z ? L != null ? Wt(F) : d.add(F) : L !== void 0 && d.has(F) ? Wt(F) : V.protectedKeys[F] = !0;
3283
+ }
3284
+ V.prevProp = m, V.prevResolvedValues = q, V.isActive && (h = { ...h, ...q }), s && e.blockInitialAnimation && (S = !1);
3285
+ const $t = A && x;
3286
+ S && (!$t || D) && f.push(...O.map((F) => {
3287
+ const L = { type: p };
3288
+ if (typeof F == "string" && s && !$t && e.manuallyAnimateOnMount && e.parent) {
3289
+ const { parent: j } = e, Z = ne(j, F);
3290
+ if (j.enteringChildren && Z) {
3291
+ const { delayChildren: zs } = Z.transition || {};
3292
+ L.delay = Ws(j.enteringChildren, e, zs);
3293
+ }
3294
+ }
3295
+ return {
3296
+ animation: F,
3297
+ options: L
3298
+ };
3299
+ }));
3300
+ }
3301
+ if (d.size) {
3302
+ const T = {};
3303
+ if (typeof u.initial != "boolean") {
3304
+ const p = ne(e, Array.isArray(u.initial) ? u.initial[0] : u.initial);
3305
+ p && p.transition && (T.transition = p.transition);
3306
+ }
3307
+ d.forEach((p) => {
3308
+ const V = e.getBaseTarget(p), m = e.getValue(p);
3309
+ m && (m.liveStyle = !0), T[p] = V ?? null;
3310
+ }), f.push({ animation: T });
3311
+ }
3312
+ let y = !!f.length;
3313
+ return s && (u.initial === !1 || u.initial === u.animate) && !e.manuallyAnimateOnMount && (y = !1), s = !1, y ? t(f) : Promise.resolve();
3383
3314
  }
3384
- /**
3385
- * Check whether we have a motion value for this key
3386
- */
3387
- hasValue(t) {
3388
- return this.values.has(t);
3315
+ function a(l, u) {
3316
+ var f;
3317
+ if (n[l].isActive === u)
3318
+ return Promise.resolve();
3319
+ (f = e.variantChildren) == null || f.forEach((d) => {
3320
+ var h;
3321
+ return (h = d.animationState) == null ? void 0 : h.setActive(l, u);
3322
+ }), n[l].isActive = u;
3323
+ const c = o(l);
3324
+ for (const d in n)
3325
+ n[d].protectedKeys = {};
3326
+ return c;
3389
3327
  }
3390
- getValue(t, n) {
3391
- if (this.props.values && this.props.values[t])
3392
- return this.props.values[t];
3393
- let s = this.values.get(t);
3394
- return s === void 0 && n !== void 0 && (s = Ee(n === null ? void 0 : n, { owner: this }), this.addValue(t, s)), s;
3328
+ return {
3329
+ animateChanges: o,
3330
+ setActive: a,
3331
+ setAnimateFunction: r,
3332
+ getState: () => n,
3333
+ reset: () => {
3334
+ n = vn(), s = !0;
3335
+ }
3336
+ };
3337
+ }
3338
+ function Za(e, t) {
3339
+ return typeof t == "string" ? t !== e : Array.isArray(t) ? !$s(t, e) : !1;
3340
+ }
3341
+ function _(e = !1) {
3342
+ return {
3343
+ isActive: e,
3344
+ protectedKeys: {},
3345
+ needsAnimating: {},
3346
+ prevResolvedValues: {}
3347
+ };
3348
+ }
3349
+ function vn() {
3350
+ return {
3351
+ animate: _(!0),
3352
+ whileInView: _(),
3353
+ whileHover: _(),
3354
+ whileTap: _(),
3355
+ whileDrag: _(),
3356
+ whileFocus: _(),
3357
+ exit: _()
3358
+ };
3359
+ }
3360
+ class de {
3361
+ constructor(t) {
3362
+ this.isMounted = !1, this.node = t;
3395
3363
  }
3396
- /**
3397
- * If we're trying to animate to a previously unencountered value,
3398
- * we need to check for it in our state and as a last resort read it
3399
- * directly from the instance (which might have performance implications).
3400
- */
3401
- readValue(t, n) {
3402
- let s = this.latestValues[t] !== void 0 || !this.current ? this.latestValues[t] : this.getBaseTargetFromProps(this.props, t) ?? this.readValueFromInstance(this.current, t, this.options);
3403
- return s != null && (typeof s == "string" && (Pn(s) || En(s)) ? s = parseFloat(s) : !Do(s) && oe.test(n) && (s = ms(t, n)), this.setBaseTarget(t, O(s) ? s.get() : s)), O(s) ? s.get() : s;
3364
+ update() {
3404
3365
  }
3366
+ }
3367
+ class Ja extends de {
3405
3368
  /**
3406
- * Set the base target to later animate back to. This is currently
3407
- * only hydrated on creation and when we first read a value.
3369
+ * We dynamically generate the AnimationState manager as it contains a reference
3370
+ * to the underlying animation library. We only want to load that if we load this,
3371
+ * so people can optionally code split it out using the `m` component.
3408
3372
  */
3409
- setBaseTarget(t, n) {
3410
- this.baseTarget[t] = n;
3373
+ constructor(t) {
3374
+ super(t), t.animationState || (t.animationState = qa(t));
3375
+ }
3376
+ updateAnimationControlsSubscription() {
3377
+ const { animate: t } = this.node.getProps();
3378
+ Ne(t) && (this.unmountControls = t.subscribe(this.node));
3411
3379
  }
3412
3380
  /**
3413
- * Find the base target for a value thats been removed from all animation
3414
- * props.
3381
+ * Subscribe any provided AnimationControls to the component's VisualElement
3415
3382
  */
3416
- getBaseTarget(t) {
3417
- var r;
3418
- const { initial: n } = this.props;
3419
- let s;
3420
- if (typeof n == "string" || typeof n == "object") {
3421
- const o = It(this.props, n, (r = this.presenceContext) == null ? void 0 : r.custom);
3422
- o && (s = o[t]);
3423
- }
3424
- if (n && s !== void 0)
3425
- return s;
3426
- const i = this.getBaseTargetFromProps(this.props, t);
3427
- return i !== void 0 && !O(i) ? i : this.initialValues[t] !== void 0 && s === void 0 ? void 0 : this.baseTarget[t];
3383
+ mount() {
3384
+ this.updateAnimationControlsSubscription();
3428
3385
  }
3429
- on(t, n) {
3430
- return this.events[t] || (this.events[t] = new Fn()), this.events[t].add(n);
3386
+ update() {
3387
+ const { animate: t } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
3388
+ t !== n && this.updateAnimationControlsSubscription();
3431
3389
  }
3432
- notify(t, ...n) {
3433
- this.events[t] && this.events[t].notify(...n);
3390
+ unmount() {
3391
+ var t;
3392
+ this.node.animationState.reset(), (t = this.unmountControls) == null || t.call(this);
3434
3393
  }
3435
3394
  }
3436
- class Bs extends rc {
3395
+ let Qa = 0;
3396
+ class ec extends de {
3437
3397
  constructor() {
3438
- super(...arguments), this.KeyframeResolver = go;
3398
+ super(...arguments), this.id = Qa++;
3439
3399
  }
3440
- sortInstanceNodePosition(t, n) {
3441
- return t.compareDocumentPosition(n) & 2 ? 1 : -1;
3400
+ update() {
3401
+ if (!this.node.presenceContext)
3402
+ return;
3403
+ const { isPresent: t, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
3404
+ if (!this.node.animationState || t === s)
3405
+ return;
3406
+ const i = this.node.animationState.setActive("exit", !t);
3407
+ n && !t && i.then(() => {
3408
+ n(this.id);
3409
+ });
3442
3410
  }
3443
- getBaseTargetFromProps(t, n) {
3444
- return t.style ? t.style[n] : void 0;
3411
+ mount() {
3412
+ const { register: t, onExitComplete: n } = this.node.presenceContext || {};
3413
+ n && n(this.id), t && (this.unmount = t(this.id));
3445
3414
  }
3446
- removeValueFromRenderState(t, { vars: n, style: s }) {
3447
- delete n[t], delete s[t];
3415
+ unmount() {
3448
3416
  }
3449
- handleChildMotionValue() {
3450
- this.childSubscription && (this.childSubscription(), delete this.childSubscription);
3451
- const { children: t } = this.props;
3452
- O(t) && (this.childSubscription = t.on("change", (n) => {
3453
- this.current && (this.current.textContent = `${n}`);
3454
- }));
3417
+ }
3418
+ const tc = {
3419
+ animation: {
3420
+ Feature: Ja
3421
+ },
3422
+ exit: {
3423
+ Feature: ec
3455
3424
  }
3425
+ };
3426
+ function Tn(e, t, n, s = { passive: !0 }) {
3427
+ return e.addEventListener(t, n, s), () => e.removeEventListener(t, n);
3456
3428
  }
3457
- function Ks(e, { style: t, vars: n }, s, i) {
3458
- const r = e.style;
3459
- let o;
3460
- for (o in t)
3461
- r[o] = t[o];
3462
- i == null || i.applyProjectionStyles(r, s);
3463
- for (o in n)
3464
- r.setProperty(o, n[o]);
3429
+ function _s(e) {
3430
+ return {
3431
+ point: {
3432
+ x: e.pageX,
3433
+ y: e.pageY
3434
+ }
3435
+ };
3465
3436
  }
3466
- function oc(e) {
3467
- return window.getComputedStyle(e);
3437
+ function wn(e, t, n) {
3438
+ const { props: s } = e;
3439
+ e.animationState && s.whileHover && e.animationState.setActive("whileHover", n === "Start");
3440
+ const i = "onHover" + n, r = s[i];
3441
+ r && N.postRender(() => r(t, _s(t)));
3468
3442
  }
3469
- class ac extends Bs {
3443
+ class nc extends de {
3444
+ mount() {
3445
+ const { current: t } = this.node;
3446
+ t && (this.unmount = Po(t, (n, s) => (wn(this.node, s, "Start"), (i) => wn(this.node, i, "End"))));
3447
+ }
3448
+ unmount() {
3449
+ }
3450
+ }
3451
+ class sc extends de {
3470
3452
  constructor() {
3471
- super(...arguments), this.type = "html", this.renderInstance = Ks;
3453
+ super(...arguments), this.isActive = !1;
3472
3454
  }
3473
- readValueFromInstance(t, n) {
3474
- var s;
3475
- if (ce.has(n))
3476
- return (s = this.projection) != null && s.isProjecting ? tt(n) : Or(t, n);
3477
- {
3478
- const i = oc(t), r = (Gn(n) ? i.getPropertyValue(n) : i[n]) || 0;
3479
- return typeof r == "string" ? r.trim() : r;
3455
+ onFocus() {
3456
+ let t = !1;
3457
+ try {
3458
+ t = this.node.current.matches(":focus-visible");
3459
+ } catch {
3460
+ t = !0;
3480
3461
  }
3462
+ !t || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
3481
3463
  }
3482
- measureInstanceViewportBox(t, { transformPagePoint: n }) {
3483
- return Ua(t, n);
3464
+ onBlur() {
3465
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
3484
3466
  }
3485
- build(t, n, s) {
3486
- Rt(t, n, s.transformTemplate);
3467
+ mount() {
3468
+ this.unmount = Le(Tn(this.node.current, "focus", () => this.onFocus()), Tn(this.node.current, "blur", () => this.onBlur()));
3487
3469
  }
3488
- scrapeMotionValuesFromProps(t, n, s) {
3489
- return kt(t, n, s);
3470
+ unmount() {
3490
3471
  }
3491
3472
  }
3492
- const Ws = /* @__PURE__ */ new Set([
3493
- "baseFrequency",
3494
- "diffuseConstant",
3495
- "kernelMatrix",
3496
- "kernelUnitLength",
3497
- "keySplines",
3498
- "keyTimes",
3499
- "limitingConeAngle",
3500
- "markerHeight",
3501
- "markerWidth",
3502
- "numOctaves",
3503
- "targetX",
3504
- "targetY",
3505
- "surfaceScale",
3506
- "specularConstant",
3507
- "specularExponent",
3508
- "stdDeviation",
3509
- "tableValues",
3510
- "viewBox",
3511
- "gradientTransform",
3512
- "pathLength",
3513
- "startOffset",
3514
- "textLength",
3515
- "lengthAdjust"
3516
- ]);
3517
- function cc(e, t, n, s) {
3518
- Ks(e, t, void 0, s);
3519
- for (const i in t.attrs)
3520
- e.setAttribute(Ws.has(i) ? i : Ft(i), t.attrs[i]);
3473
+ function Sn(e, t, n) {
3474
+ const { props: s } = e;
3475
+ if (e.current instanceof HTMLButtonElement && e.current.disabled)
3476
+ return;
3477
+ e.animationState && s.whileTap && e.animationState.setActive("whileTap", n === "Start");
3478
+ const i = "onTap" + (n === "End" ? "" : n), r = s[i];
3479
+ r && N.postRender(() => r(t, _s(t)));
3521
3480
  }
3522
- class uc extends Bs {
3523
- constructor() {
3524
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ks;
3481
+ class ic extends de {
3482
+ mount() {
3483
+ const { current: t } = this.node;
3484
+ t && (this.unmount = Ro(t, (n, s) => (Sn(this.node, s, "Start"), (i, { success: r }) => Sn(this.node, i, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
3525
3485
  }
3526
- getBaseTargetFromProps(t, n) {
3527
- return t[n];
3486
+ unmount() {
3528
3487
  }
3529
- readValueFromInstance(t, n) {
3530
- if (ce.has(n)) {
3531
- const s = ps(n);
3532
- return s && s.default || 0;
3533
- }
3534
- return n = Ws.has(n) ? n : Ft(n), t.getAttribute(n);
3488
+ }
3489
+ const dt = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), rc = (e) => {
3490
+ const t = dt.get(e.target);
3491
+ t && t(e);
3492
+ }, oc = (e) => {
3493
+ e.forEach(rc);
3494
+ };
3495
+ function ac({ root: e, ...t }) {
3496
+ const n = e || document;
3497
+ He.has(n) || He.set(n, {});
3498
+ const s = He.get(n), i = JSON.stringify(t);
3499
+ return s[i] || (s[i] = new IntersectionObserver(oc, { root: e, ...t })), s[i];
3500
+ }
3501
+ function cc(e, t, n) {
3502
+ const s = ac(t);
3503
+ return dt.set(e, n), s.observe(e), () => {
3504
+ dt.delete(e), s.unobserve(e);
3505
+ };
3506
+ }
3507
+ const uc = {
3508
+ some: 0,
3509
+ all: 1
3510
+ };
3511
+ class lc extends de {
3512
+ constructor() {
3513
+ super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
3535
3514
  }
3536
- scrapeMotionValuesFromProps(t, n, s) {
3537
- return Fs(t, n, s);
3515
+ startObserver() {
3516
+ this.unmount();
3517
+ const { viewport: t = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = t, o = {
3518
+ root: n ? n.current : void 0,
3519
+ rootMargin: s,
3520
+ threshold: typeof i == "number" ? i : uc[i]
3521
+ }, a = (l) => {
3522
+ const { isIntersecting: u } = l;
3523
+ if (this.isInView === u || (this.isInView = u, r && !u && this.hasEnteredView))
3524
+ return;
3525
+ u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
3526
+ const { onViewportEnter: c, onViewportLeave: f } = this.node.getProps(), d = u ? c : f;
3527
+ d && d(l);
3528
+ };
3529
+ return cc(this.node.current, o, a);
3538
3530
  }
3539
- build(t, n, s) {
3540
- Ms(t, n, this.isSVGTag, s.transformTemplate, s.style);
3531
+ mount() {
3532
+ this.startObserver();
3541
3533
  }
3542
- renderInstance(t, n, s, i) {
3543
- cc(t, n, s, i);
3534
+ update() {
3535
+ if (typeof IntersectionObserver > "u")
3536
+ return;
3537
+ const { props: t, prevProps: n } = this.node;
3538
+ ["amount", "margin", "root"].some(fc(t, n)) && this.startObserver();
3544
3539
  }
3545
- mount(t) {
3546
- this.isSVGTag = Es(t.tagName), super.mount(t);
3540
+ unmount() {
3541
+ }
3542
+ }
3543
+ function fc({ viewport: e = {} }, { viewport: t = {} } = {}) {
3544
+ return (n) => e[n] !== t[n];
3545
+ }
3546
+ const dc = {
3547
+ inView: {
3548
+ Feature: lc
3549
+ },
3550
+ tap: {
3551
+ Feature: ic
3552
+ },
3553
+ focus: {
3554
+ Feature: sc
3555
+ },
3556
+ hover: {
3557
+ Feature: nc
3547
3558
  }
3559
+ }, hc = {
3560
+ renderer: Ma,
3561
+ ...tc,
3562
+ ...dc
3563
+ };
3564
+ function pc(e, t) {
3565
+ return da(e, t);
3548
3566
  }
3549
- const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3550
- allowProjection: e !== Tn
3551
- }), fc = {
3552
- renderer: lc,
3553
- ...$a,
3554
- ...tc
3555
- }, ft = /* @__PURE__ */ da("div"), $s = ne.createContext({
3567
+ const ht = /* @__PURE__ */ pc("div"), Us = re.createContext({
3556
3568
  layers: [],
3557
3569
  setLayers: () => {
3558
3570
  },
@@ -3562,8 +3574,8 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3562
3574
  },
3563
3575
  removeTopLayer: () => {
3564
3576
  }
3565
- }), Dc = ({ children: e }) => {
3566
- const [t, n] = ne.useState([]), s = (o) => {
3577
+ }), Oc = ({ children: e }) => {
3578
+ const [t, n] = re.useState([]), s = (o) => {
3567
3579
  n((a) => [...a, o]);
3568
3580
  }, i = (o) => {
3569
3581
  n(t.filter((a) => a !== o));
@@ -3572,28 +3584,28 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3572
3584
  o && i(o);
3573
3585
  };
3574
3586
  return /* @__PURE__ */ M(
3575
- $s.Provider,
3587
+ Us.Provider,
3576
3588
  {
3577
3589
  value: { layers: t, setLayers: n, addLayer: s, removeLayer: i, removeTopLayer: r },
3578
3590
  children: e
3579
3591
  }
3580
3592
  );
3581
- }, _s = () => ne.useContext($s), dc = ({
3593
+ }, Gs = () => re.useContext(Us), mc = ({
3582
3594
  defaultOpen: e,
3583
3595
  open: t,
3584
3596
  onOpenChange: n,
3585
3597
  ...s
3586
3598
  }) => {
3587
- const [i, r] = Si({
3599
+ const [i, r] = Ci({
3588
3600
  prop: t,
3589
3601
  onChange: n,
3590
3602
  defaultProp: e ?? !1
3591
- }), o = _s(), a = s.a11yTitle;
3592
- if (ne.useEffect(() => {
3603
+ }), o = Gs(), a = s.a11yTitle;
3604
+ if (re.useEffect(() => {
3593
3605
  !i && o.layers.includes(a) && o.removeLayer(a);
3594
3606
  }, [a, o, i]), !!i)
3595
- return /* @__PURE__ */ M(hc, { open: i, onOpenChange: r, ...s });
3596
- }, hc = ({
3607
+ return /* @__PURE__ */ M(gc, { open: i, onOpenChange: r, ...s });
3608
+ }, gc = ({
3597
3609
  open: e,
3598
3610
  onOpenChange: t,
3599
3611
  a11yTitle: n,
@@ -3606,13 +3618,13 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3606
3618
  ...l
3607
3619
  }) => {
3608
3620
  var y, T;
3609
- const u = n, c = _s();
3610
- ne.useEffect(() => {
3621
+ const u = n, c = Gs();
3622
+ re.useEffect(() => {
3611
3623
  !c || !e || c.layers.includes(u) || c.addLayer(u);
3612
3624
  }, [u, c, e]);
3613
- const d = ((y = c.layers) == null ? void 0 : y.indexOf(u)) || 0, f = ((T = c.layers) == null ? void 0 : T.length) || 0, h = d !== 0, g = u === c.layers[c.layers.length - 1];
3614
- return /* @__PURE__ */ M(Fo, { features: fc, children: /* @__PURE__ */ M(
3615
- An,
3625
+ const f = ((y = c.layers) == null ? void 0 : y.indexOf(u)) || 0, d = ((T = c.layers) == null ? void 0 : T.length) || 0, h = f !== 0, g = u === c.layers[c.layers.length - 1];
3626
+ return /* @__PURE__ */ M(ko, { features: hc, children: /* @__PURE__ */ M(
3627
+ Pn,
3616
3628
  {
3617
3629
  onEscapeKeyDown: (p) => {
3618
3630
  g && (p.preventDefault(), c.removeTopLayer(), t(!1));
@@ -3620,8 +3632,8 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3620
3632
  onPointerDownOutside: (p) => {
3621
3633
  g && (p.preventDefault(), c.removeTopLayer(), t(!1));
3622
3634
  },
3623
- children: /* @__PURE__ */ Ve(
3624
- J.Root,
3635
+ children: /* @__PURE__ */ Ce(
3636
+ ee.Root,
3625
3637
  {
3626
3638
  open: e,
3627
3639
  onOpenChange: (p) => {
@@ -3631,28 +3643,28 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3631
3643
  t(p);
3632
3644
  },
3633
3645
  children: [
3634
- /* @__PURE__ */ Ve(Qs.Root, { children: [
3635
- /* @__PURE__ */ M(J.Title, { children: n }),
3636
- s && /* @__PURE__ */ M(J.Description, { children: s })
3646
+ /* @__PURE__ */ Ce(si.Root, { children: [
3647
+ /* @__PURE__ */ M(ee.Title, { children: n }),
3648
+ s && /* @__PURE__ */ M(ee.Description, { children: s })
3637
3649
  ] }),
3638
3650
  e && // We add the className "tgph" here so that styles within
3639
3651
  // the portal get scoped properly to telegraph
3640
- /* @__PURE__ */ M(Js.Root, { className: "tgph", children: /* @__PURE__ */ M(pc, { layer: d, children: /* @__PURE__ */ M(
3641
- Zs,
3652
+ /* @__PURE__ */ M(ni.Root, { className: "tgph", children: /* @__PURE__ */ M(yc, { layer: f, children: /* @__PURE__ */ M(
3653
+ ti,
3642
3654
  {
3643
3655
  trapped: typeof r == "boolean" ? r : g,
3644
3656
  onMountAutoFocus: o,
3645
3657
  onUnmountAutoFocus: a,
3646
3658
  asChild: !0,
3647
- children: /* @__PURE__ */ M(ti, { children: /* @__PURE__ */ M(
3648
- ee,
3659
+ children: /* @__PURE__ */ M(ri, { children: /* @__PURE__ */ M(
3660
+ se,
3649
3661
  {
3650
- as: ft,
3662
+ as: ht,
3651
3663
  initial: {
3652
- top: `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${f - 1})`
3664
+ top: `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${d - 1})`
3653
3665
  },
3654
3666
  animate: {
3655
- top: h ? `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${d} )` : "var(--tgph-spacing-16)"
3667
+ top: h ? `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${f} )` : "var(--tgph-spacing-16)"
3656
3668
  },
3657
3669
  exit: { top: 0 },
3658
3670
  transition: { type: "spring", duration: 0.3, bounce: 0 },
@@ -3663,15 +3675,15 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3663
3675
  left: 0,
3664
3676
  maxHeight: "calc(100vh - var(--tgph-spacing-32))",
3665
3677
  maxWidth: "calc(100vw - var(--tgph-spacing-8))",
3666
- zIndex: `calc(var(--tgph-zIndex-modal) + ${d})`
3678
+ zIndex: `calc(var(--tgph-zIndex-modal) + ${f})`
3667
3679
  },
3668
3680
  children: /* @__PURE__ */ M(
3669
- ee,
3681
+ se,
3670
3682
  {
3671
3683
  direction: "column",
3672
- as: ft,
3684
+ as: ht,
3673
3685
  animate: {
3674
- scale: 1.02 - Math.abs(f - d) * 0.02,
3686
+ scale: 1.02 - Math.abs(d - f) * 0.02,
3675
3687
  transformOrigin: "center center"
3676
3688
  },
3677
3689
  transition: {
@@ -3702,11 +3714,11 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3702
3714
  )
3703
3715
  }
3704
3716
  ) });
3705
- }, pc = ({ layer: e, children: t }) => e > 0 ? t : /* @__PURE__ */ Ve(J.Overlay, { children: [
3717
+ }, yc = ({ layer: e, children: t }) => e > 0 ? t : /* @__PURE__ */ Ce(ee.Overlay, { children: [
3706
3718
  /* @__PURE__ */ M(
3707
- ni,
3719
+ oi,
3708
3720
  {
3709
- as: ft,
3721
+ as: ht,
3710
3722
  initial: { opacity: 0 },
3711
3723
  animate: { opacity: 1 },
3712
3724
  exit: { opacity: 0 },
@@ -3723,26 +3735,26 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3723
3735
  }
3724
3736
  ),
3725
3737
  t
3726
- ] }), mc = ne.forwardRef(
3727
- ({ children: e, ...t }, n) => /* @__PURE__ */ M(J.Content, { ref: n, asChild: !0, ...t, children: /* @__PURE__ */ M(ee, { direction: "column", h: "full", ...t, children: e }) })
3728
- ), gc = ({
3738
+ ] }), bc = re.forwardRef(
3739
+ ({ children: e, ...t }, n) => /* @__PURE__ */ M(ee.Content, { ref: n, asChild: !0, ...t, children: /* @__PURE__ */ M(se, { direction: "column", h: "full", ...t, children: e }) })
3740
+ ), vc = ({
3729
3741
  size: e = "1",
3730
3742
  variant: t = "ghost",
3731
3743
  ...n
3732
- }) => /* @__PURE__ */ M(J.Close, { asChild: !0, children: /* @__PURE__ */ M(
3733
- ei,
3744
+ }) => /* @__PURE__ */ M(ee.Close, { asChild: !0, children: /* @__PURE__ */ M(
3745
+ ii,
3734
3746
  {
3735
- icon: { icon: si, alt: "Close Modal" },
3747
+ icon: { icon: ai, alt: "Close Modal" },
3736
3748
  variant: t,
3737
3749
  size: e,
3738
3750
  ...n
3739
3751
  }
3740
- ) }), yc = ({
3752
+ ) }), Tc = ({
3741
3753
  style: e,
3742
3754
  children: t,
3743
3755
  ...n
3744
3756
  }) => /* @__PURE__ */ M(
3745
- ee,
3757
+ se,
3746
3758
  {
3747
3759
  direction: "column",
3748
3760
  px: "6",
@@ -3754,11 +3766,11 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3754
3766
  ...n,
3755
3767
  children: t
3756
3768
  }
3757
- ), bc = ({
3769
+ ), wc = ({
3758
3770
  children: e,
3759
3771
  ...t
3760
3772
  }) => /* @__PURE__ */ M(
3761
- ee,
3773
+ se,
3762
3774
  {
3763
3775
  direction: "row",
3764
3776
  justify: "space-between",
@@ -3769,11 +3781,11 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3769
3781
  ...t,
3770
3782
  children: e
3771
3783
  }
3772
- ), vc = ({
3784
+ ), Sc = ({
3773
3785
  children: e,
3774
3786
  ...t
3775
3787
  }) => /* @__PURE__ */ M(
3776
- ee,
3788
+ se,
3777
3789
  {
3778
3790
  direction: "row",
3779
3791
  align: "center",
@@ -3785,17 +3797,17 @@ const lc = (e, t) => Lt(e) ? new uc(t) : new ac(t, {
3785
3797
  ...t,
3786
3798
  children: e
3787
3799
  }
3788
- ), Tc = {};
3789
- Object.assign(Tc, {
3790
- Root: dc,
3791
- Content: mc,
3792
- Close: gc,
3793
- Body: yc,
3794
- Header: bc,
3795
- Footer: vc
3800
+ ), xc = {};
3801
+ Object.assign(xc, {
3802
+ Root: mc,
3803
+ Content: bc,
3804
+ Close: vc,
3805
+ Body: Tc,
3806
+ Header: wc,
3807
+ Footer: Sc
3796
3808
  });
3797
3809
  export {
3798
- Tc as Modal,
3799
- Dc as ModalStackingProvider
3810
+ xc as Modal,
3811
+ Oc as ModalStackingProvider
3800
3812
  };
3801
3813
  //# sourceMappingURL=index.mjs.map