@fluidattacks/design 3.1.12 → 3.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/dist/components/@core/index.js +2 -2
  2. package/dist/components/accordion/accordion-content/index.js +18 -5
  3. package/dist/components/accordion/index.js +71 -14
  4. package/dist/components/alert/index.js +108 -57
  5. package/dist/components/button/index.js +64 -13
  6. package/dist/components/card/card-header/index.js +78 -9
  7. package/dist/components/card/card-with-image/index.js +88 -13
  8. package/dist/components/card/card-with-input/index.js +72 -23
  9. package/dist/components/card/card-with-selector/index.js +63 -8
  10. package/dist/components/card/card-with-switch/index.js +46 -8
  11. package/dist/components/carousel/index.js +54 -28
  12. package/dist/components/checkbox/index.js +66 -32
  13. package/dist/components/cloud-image/index.js +2 -2
  14. package/dist/components/code-snippet/index.js +64 -19
  15. package/dist/components/code-snippet/location-code/index.js +146 -100
  16. package/dist/components/colors/index.js +220 -5
  17. package/dist/components/confirm-dialog/index.js +41 -18
  18. package/dist/components/container/index.js +39 -15
  19. package/dist/components/content-card/category-tag/index.js +37 -8
  20. package/dist/components/content-card/event-date/index.js +53 -10
  21. package/dist/components/content-card/index.js +118 -13
  22. package/dist/components/content-card-carousel/index.js +87 -7
  23. package/dist/components/content-card-carousel/scroll-buttons/index.js +1 -1
  24. package/dist/components/divider/index.js +22 -7
  25. package/dist/components/empty-state/empty-button/index.js +4 -4
  26. package/dist/components/empty-state/index.js +52 -15
  27. package/dist/components/file-preview/index.js +28 -12
  28. package/dist/components/form/index.js +46 -9
  29. package/dist/components/grid-container/index.js +31 -11
  30. package/dist/components/group-selector/index.js +126 -17
  31. package/dist/components/group-selector/option-container/index.js +1 -1
  32. package/dist/components/icon/index.js +78 -18
  33. package/dist/components/icon-button/index.js +63 -14
  34. package/dist/components/indicator-card/index.js +70 -11
  35. package/dist/components/info-sidebar/index.js +107 -7
  36. package/dist/components/inputs/fields/combobox/index.js +141 -21
  37. package/dist/components/inputs/fields/combobox/option/index.js +1 -1
  38. package/dist/components/inputs/fields/date/calendar/cell/index.js +22 -11
  39. package/dist/components/inputs/fields/date/calendar/grid/index.js +21 -10
  40. package/dist/components/inputs/fields/date/calendar/header/index.js +35 -13
  41. package/dist/components/inputs/fields/date/calendar/index.js +26 -11
  42. package/dist/components/inputs/fields/date/index.js +65 -15
  43. package/dist/components/inputs/fields/date-range/calendar/index.js +29 -10
  44. package/dist/components/inputs/fields/date-range/index.js +98 -18
  45. package/dist/components/inputs/fields/date-time/calendar/index.js +44 -15
  46. package/dist/components/inputs/fields/date-time/index.js +65 -14
  47. package/dist/components/inputs/fields/editable/index.js +22 -10
  48. package/dist/components/inputs/fields/input/index.js +74 -10
  49. package/dist/components/inputs/fields/input-file/index.js +114 -21
  50. package/dist/components/inputs/fields/input-tags/index.js +60 -11
  51. package/dist/components/inputs/fields/number/index.js +54 -7
  52. package/dist/components/inputs/fields/number-range/index.js +46 -8
  53. package/dist/components/inputs/fields/phone/index.js +446 -286
  54. package/dist/components/inputs/fields/text-area/index.js +78 -10
  55. package/dist/components/inputs/label/index.js +34 -8
  56. package/dist/components/inputs/outline-container/index.js +98 -12
  57. package/dist/components/inputs/utils/action-button/index.js +28 -7
  58. package/dist/components/inputs/utils/calendar-button/index.js +34 -10
  59. package/dist/components/inputs/utils/date-selector/index.js +60 -6
  60. package/dist/components/inputs/utils/date-time-field/index.js +129 -28
  61. package/dist/components/inputs/utils/dialog/index.js +10 -7
  62. package/dist/components/inputs/utils/number-field/index.js +81 -8
  63. package/dist/components/inputs/utils/popover/index.js +41 -10
  64. package/dist/components/interactive-card/icon/index.js +1 -1
  65. package/dist/components/interactive-card/index.js +110 -7
  66. package/dist/components/language-selector/index.js +34 -10
  67. package/dist/components/language-selector/item-list/index.js +1 -1
  68. package/dist/components/link/index.js +71 -17
  69. package/dist/components/list-item/index.js +64 -13
  70. package/dist/components/little-flag/index.js +26 -9
  71. package/dist/components/loading/index.js +48 -21
  72. package/dist/components/logo/index.js +10 -4
  73. package/dist/components/logo-carousel/index.js +40 -5
  74. package/dist/components/lottie/index.js +12 -7
  75. package/dist/components/menu/index.js +53 -9
  76. package/dist/components/message-banner/index.js +79 -13
  77. package/dist/components/modal/index.js +59 -13
  78. package/dist/components/modal/modal-confirm/index.js +48 -7
  79. package/dist/components/modal/modal-footer/index.js +22 -13
  80. package/dist/components/modal/modal-header/index.js +45 -19
  81. package/dist/components/notification/index.js +65 -20
  82. package/dist/components/notification-sign/index.js +27 -10
  83. package/dist/components/number-input/index.js +58 -21
  84. package/dist/components/oauth-selector/index.js +97 -23
  85. package/dist/components/oauth-selector/option-container/index.js +68 -7
  86. package/dist/components/plan-card/index.js +99 -28
  87. package/dist/components/plan-card/recommended-tag/index.js +23 -2
  88. package/dist/components/pop-up/description/index.js +47 -9
  89. package/dist/components/pop-up/index.js +146 -17
  90. package/dist/components/premium-feature/index.js +56 -16
  91. package/dist/components/priority-score/index.js +24 -9
  92. package/dist/components/progress/index.js +30 -17
  93. package/dist/components/progress-bar/index.js +99 -41
  94. package/dist/components/radio-button/index.js +64 -27
  95. package/dist/components/scroll-button/index.js +33 -15
  96. package/dist/components/search/index.js +77 -35
  97. package/dist/components/search-bar/index.js +211 -24
  98. package/dist/components/search-bar/item-searching/index.js +1 -1
  99. package/dist/components/severity-badge/index.js +66 -6
  100. package/dist/components/severity-overview/badge/index.js +62 -11
  101. package/dist/components/severity-overview/index.js +15 -5
  102. package/dist/components/show-on-hover/index.js +16 -10
  103. package/dist/components/slide-out-menu/index.js +2611 -1164
  104. package/dist/components/slide-out-menu/menu-item/index.js +58 -6
  105. package/dist/components/slider/index.js +79 -48
  106. package/dist/components/slider/thumb/index.js +13 -6
  107. package/dist/components/step-lapse/index.js +81 -23
  108. package/dist/components/table-button/index.js +65 -24
  109. package/dist/components/tabs/fixed-tabs/index.js +24 -4
  110. package/dist/components/tabs/index.js +54 -11
  111. package/dist/components/tabs/tab/index.js +37 -6
  112. package/dist/components/tag/index.js +95 -27
  113. package/dist/components/timeline/card/index.js +1 -1
  114. package/dist/components/timeline/index.js +15 -5
  115. package/dist/components/toggle/index.js +65 -25
  116. package/dist/components/toggle-buttons/index.js +51 -22
  117. package/dist/components/tooltip/index.js +1 -1
  118. package/dist/components/tour/index.js +3897 -1829
  119. package/dist/components/typography/heading/index.js +43 -5
  120. package/dist/components/typography/span/index.js +38 -6
  121. package/dist/components/typography/text/index.js +44 -6
  122. package/dist/components/web-form/index.js +28 -19
  123. package/dist/hooks/index.js +5 -5
  124. package/dist/index-BMHVi812.mjs +234 -0
  125. package/dist/index-BzAniA2J.mjs +135 -0
  126. package/dist/index-C6LbClYh.mjs +146 -0
  127. package/dist/index-CAIe8hBv.mjs +130 -0
  128. package/dist/index-CUQBAqt_.mjs +75 -0
  129. package/dist/index-CWlrSlUk.mjs +68 -0
  130. package/dist/index-Ckmu1TfV.mjs +86 -0
  131. package/dist/index-DwznImvK.mjs +1678 -0
  132. package/dist/index-maWH3JYC.mjs +3561 -0
  133. package/dist/index.js +11 -11
  134. package/dist/styles-B2N0JLw1.mjs +114 -0
  135. package/dist/styles-B64DVBIF.mjs +115 -0
  136. package/dist/{styles-lSVV9kjn.mjs → styles-BXFVwnWT.mjs} +28 -28
  137. package/dist/styles-BZQOqe8p.mjs +141 -0
  138. package/dist/styles-Bdque9TT.mjs +65 -0
  139. package/dist/{styles-CI-I6joH.mjs → styles-BlHspTrz.mjs} +18 -18
  140. package/dist/{styles-Cx93EcVo.mjs → styles-CROOwXEH.mjs} +5 -5
  141. package/dist/styles-CplEd2kw.mjs +228 -0
  142. package/dist/styles-D1eTIklB.mjs +110 -0
  143. package/dist/styles-ePGii_9g.mjs +74 -0
  144. package/dist/use-carousel-CgAF78h3.mjs +23 -0
  145. package/dist/use-click-outside-BUll8Ag-.mjs +18 -0
  146. package/dist/use-cloudinary-image-BCxwj15o.mjs +1176 -0
  147. package/dist/use-modal-CtgexKnf.mjs +14 -0
  148. package/dist/use-search-Dj47QDw9.mjs +15 -0
  149. package/dist/utils-V0EumEPM.mjs +6 -0
  150. package/package.json +1 -3
  151. package/dist/index-38JqtnAI.mjs +0 -122
  152. package/dist/index-B5yoGFs6.mjs +0 -54
  153. package/dist/index-BLbKylyw.mjs +0 -209
  154. package/dist/index-Bu448Tz2.mjs +0 -106
  155. package/dist/index-BwFnfaRh.mjs +0 -2310
  156. package/dist/index-Co_k0WFk.mjs +0 -75
  157. package/dist/index-Cu7uUMlx.mjs +0 -82
  158. package/dist/index-D-lcuEHY.mjs +0 -1018
  159. package/dist/index-DrfjITyT.mjs +0 -61
  160. package/dist/styles-7_q7nHce.mjs +0 -110
  161. package/dist/styles-BA0WIQL-.mjs +0 -74
  162. package/dist/styles-C3cZmKVJ.mjs +0 -131
  163. package/dist/styles-D85YYIjM.mjs +0 -131
  164. package/dist/styles-EIbGRPlk.mjs +0 -106
  165. package/dist/styles-Q1VXuWI7.mjs +0 -65
  166. package/dist/styles-fH2c4cfc.mjs +0 -77
  167. package/dist/use-carousel-CvRxi2FI.mjs +0 -17
  168. package/dist/use-click-outside-BtZLIoU1.mjs +0 -18
  169. package/dist/use-cloudinary-image-fG7ODNgr.mjs +0 -611
  170. package/dist/use-modal-CkrZ-_-M.mjs +0 -14
  171. package/dist/use-search-DpLNvt7Q.mjs +0 -12
  172. package/dist/utils-CQvBF-wY.mjs +0 -4
@@ -1,157 +1,319 @@
1
- import { jsxs as H, jsx as I } from "react/jsx-runtime";
2
- import { createContext as ee, useLayoutEffect as Ts, useEffect as st, useContext as O, useRef as Z, useInsertionEffect as xs, useCallback as fn, useMemo as Ve, forwardRef as As, Fragment as vn, createElement as Vs, useState as Cs } from "react";
3
- import { styled as Ms, useTheme as Ps } from "styled-components";
4
- import { MenuItem as ks } from "./menu-item/index.js";
5
- import { Button as Pt } from "../button/index.js";
6
- import { Container as z } from "../container/index.js";
7
- import { IconButton as Es } from "../icon-button/index.js";
1
+ import { jsxs as Y, jsx as E } from "react/jsx-runtime";
2
+ import { createContext as te, useLayoutEffect as xs, useEffect as nt, useContext as O, useRef as Z, useInsertionEffect as As, useCallback as fn, useMemo as Ae, forwardRef as Ms, Fragment as hn, createElement as Cs, useState as Ps } from "react";
3
+ import { styled as Fs, useTheme as Ds } from "styled-components";
4
+ import { MenuItem as Rs } from "./menu-item/index.js";
5
+ import { Button as Rt } from "../button/index.js";
6
+ import { Container as q } from "../container/index.js";
7
+ import { IconButton as Is } from "../icon-button/index.js";
8
8
  import "../typography/heading/index.js";
9
9
  import "../typography/span/index.js";
10
- import { Text as Fs } from "../typography/text/index.js";
11
- import { u as Os } from "../../use-click-outside-BtZLIoU1.mjs";
10
+ import { Text as Os } from "../typography/text/index.js";
11
+ import { u as Es } from "../../use-click-outside-BUll8Ag-.mjs";
12
12
  import "lodash";
13
- const kt = /* @__PURE__ */ new Set();
14
- function we(t, e, n) {
15
- t || kt.has(e) || (console.warn(e), kt.add(e));
16
- }
17
- function Is(t) {
18
- if (typeof Proxy > "u") return t;
19
- const e = /* @__PURE__ */ new Map();
20
- return new Proxy((...n) => (process.env.NODE_ENV !== "production" && we(!1, "motion() is deprecated. Use motion.create() instead."), t(...n)), { get: (n, s) => s === "create" ? t : (e.has(s) || e.set(s, t(s)), e.get(s)) });
13
+ const It = /* @__PURE__ */ new Set();
14
+ function Me(t, e, n) {
15
+ t || It.has(e) || (console.warn(e), It.add(e));
16
+ }
17
+ function ks(t) {
18
+ if (typeof Proxy > "u")
19
+ return t;
20
+ const e = /* @__PURE__ */ new Map(), n = (...s) => (process.env.NODE_ENV !== "production" && Me(!1, "motion() is deprecated. Use motion.create() instead."), t(...s));
21
+ return new Proxy(n, {
22
+ /**
23
+ * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
24
+ * The prop name is passed through as `key` and we can use that to generate a `motion`
25
+ * DOM component with that name.
26
+ */
27
+ get: (s, i) => i === "create" ? t : (e.has(i) || e.set(i, t(i)), e.get(i))
28
+ });
21
29
  }
22
30
  function Ce(t) {
23
31
  return t !== null && typeof t == "object" && typeof t.start == "function";
24
32
  }
25
- const Ue = (t) => Array.isArray(t);
26
- function gn(t, e) {
27
- if (!Array.isArray(e)) return !1;
33
+ const je = (t) => Array.isArray(t);
34
+ function pn(t, e) {
35
+ if (!Array.isArray(e))
36
+ return !1;
28
37
  const n = e.length;
29
- if (n !== t.length) return !1;
30
- for (let s = 0; s < n; s++) if (e[s] !== t[s]) return !1;
38
+ if (n !== t.length)
39
+ return !1;
40
+ for (let s = 0; s < n; s++)
41
+ if (e[s] !== t[s])
42
+ return !1;
31
43
  return !0;
32
44
  }
33
- function le(t) {
45
+ function ue(t) {
34
46
  return typeof t == "string" || Array.isArray(t);
35
47
  }
36
- function Et(t) {
48
+ function Ot(t) {
37
49
  const e = [{}, {}];
38
50
  return t == null || t.values.forEach((n, s) => {
39
51
  e[0][s] = n.get(), e[1][s] = n.getVelocity();
40
52
  }), e;
41
53
  }
42
- function it(t, e, n, s) {
54
+ function st(t, e, n, s) {
43
55
  if (typeof e == "function") {
44
- const [i, r] = Et(s);
56
+ const [i, r] = Ot(s);
45
57
  e = e(n !== void 0 ? n : t.custom, i, r);
46
58
  }
47
59
  if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
48
- const [i, r] = Et(s);
60
+ const [i, r] = Ot(s);
49
61
  e = e(n !== void 0 ? n : t.custom, i, r);
50
62
  }
51
63
  return e;
52
64
  }
53
- function Me(t, e, n) {
65
+ function Pe(t, e, n) {
54
66
  const s = t.getProps();
55
- return it(s, e, n !== void 0 ? n : s.custom, t);
56
- }
57
- const rt = ["animate", "whileInView", "whileFocus", "whileHover", "whileTap", "whileDrag", "exit"], ot = ["initial", ...rt], he = ["transformPerspective", "x", "y", "z", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY"], q = new Set(he), R = (t) => 1e3 * t, N = (t) => t / 1e3, Rs = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 }, Ds = { type: "keyframes", duration: 0.8 }, Bs = { type: "keyframes", ease: [0.25, 0.1, 0.35, 1], duration: 0.3 }, Ns = (t, { keyframes: e }) => e.length > 2 ? Ds : q.has(t) ? t.startsWith("scale") ? { type: "spring", stiffness: 550, damping: e[1] === 0 ? 2 * Math.sqrt(550) : 30, restSpeed: 10 } : Rs : Bs;
58
- function yn(t, e) {
67
+ return st(s, e, n !== void 0 ? n : s.custom, t);
68
+ }
69
+ const it = [
70
+ "animate",
71
+ "whileInView",
72
+ "whileFocus",
73
+ "whileHover",
74
+ "whileTap",
75
+ "whileDrag",
76
+ "exit"
77
+ ], rt = ["initial", ...it], fe = [
78
+ "transformPerspective",
79
+ "x",
80
+ "y",
81
+ "z",
82
+ "translateX",
83
+ "translateY",
84
+ "translateZ",
85
+ "scale",
86
+ "scaleX",
87
+ "scaleY",
88
+ "rotate",
89
+ "rotateX",
90
+ "rotateY",
91
+ "rotateZ",
92
+ "skew",
93
+ "skewX",
94
+ "skewY"
95
+ ], z = new Set(fe), L = (t) => t * 1e3, B = (t) => t / 1e3, Ls = {
96
+ type: "spring",
97
+ stiffness: 500,
98
+ damping: 25,
99
+ restSpeed: 10
100
+ }, Ns = (t) => ({
101
+ type: "spring",
102
+ stiffness: 550,
103
+ damping: t === 0 ? 2 * Math.sqrt(550) : 30,
104
+ restSpeed: 10
105
+ }), Bs = {
106
+ type: "keyframes",
107
+ duration: 0.8
108
+ }, Ks = {
109
+ type: "keyframes",
110
+ ease: [0.25, 0.1, 0.35, 1],
111
+ duration: 0.3
112
+ }, _s = (t, { keyframes: e }) => e.length > 2 ? Bs : z.has(t) ? t.startsWith("scale") ? Ns(e[1]) : Ls : Ks;
113
+ function mn(t, e) {
59
114
  return t ? t[e] || t.default || t : void 0;
60
115
  }
61
- const Ls = !1, $s = (t) => t !== null;
62
- function Pe(t, { repeat: e, repeatType: n = "loop" }, s) {
63
- const i = t.filter($s), r = e && n !== "loop" && e % 2 == 1 ? 0 : i.length - 1;
64
- return r && s !== void 0 ? s : i[r];
65
- }
66
- const $ = (t) => t;
67
- let te = $, U = $;
68
- process.env.NODE_ENV !== "production" && (te = (t, e) => {
69
- t || typeof console > "u" || console.warn(e);
70
- }, U = (t, e) => {
71
- if (!t) throw new Error(e);
116
+ const $s = {
117
+ skipAnimations: !1,
118
+ useManualTiming: !1
119
+ }, js = (t) => t !== null;
120
+ function Fe(t, { repeat: e, repeatType: n = "loop" }, s) {
121
+ const i = t.filter(js), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
122
+ return !r || s === void 0 ? i[r] : s;
123
+ }
124
+ const _ = (t) => t;
125
+ let ne = _, G = _;
126
+ process.env.NODE_ENV !== "production" && (ne = (t, e) => {
127
+ !t && typeof console < "u" && console.warn(e);
128
+ }, G = (t, e) => {
129
+ if (!t)
130
+ throw new Error(e);
72
131
  });
73
- const me = ["read", "resolveKeyframes", "update", "preRender", "render", "postRender"];
74
- function wn(t, e) {
75
- let n = !1, s = !0;
76
- const i = { delta: 0, timestamp: 0, isProcessing: !1 }, r = () => n = !0, o = me.reduce((v, p) => (v[p] = /* @__PURE__ */ function(g) {
77
- let m = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set(), x = !1, C = !1;
78
- const y = /* @__PURE__ */ new WeakSet();
79
- let w = { delta: 0, timestamp: 0, isProcessing: !1 };
80
- function T(V) {
81
- y.has(V) && (A.schedule(V), g()), V(w);
132
+ function Ws(t) {
133
+ let e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = !1, i = !1;
134
+ const r = /* @__PURE__ */ new WeakSet();
135
+ let o = {
136
+ delta: 0,
137
+ timestamp: 0,
138
+ isProcessing: !1
139
+ };
140
+ function a(u) {
141
+ r.has(u) && (l.schedule(u), t()), u(o);
142
+ }
143
+ const l = {
144
+ /**
145
+ * Schedule a process to run on the next frame.
146
+ */
147
+ schedule: (u, c = !1, f = !1) => {
148
+ const h = f && s ? e : n;
149
+ return c && r.add(u), h.has(u) || h.add(u), u;
150
+ },
151
+ /**
152
+ * Cancel the provided callback from running on the next frame.
153
+ */
154
+ cancel: (u) => {
155
+ n.delete(u), r.delete(u);
156
+ },
157
+ /**
158
+ * Execute all schedule callbacks.
159
+ */
160
+ process: (u) => {
161
+ if (o = u, s) {
162
+ i = !0;
163
+ return;
164
+ }
165
+ s = !0, [e, n] = [n, e], e.forEach(a), e.clear(), s = !1, i && (i = !1, l.process(u));
82
166
  }
83
- const A = { schedule: (V, M = !1, Ie = !1) => {
84
- const ie = Ie && x ? m : S;
85
- return M && y.add(V), ie.has(V) || ie.add(V), V;
86
- }, cancel: (V) => {
87
- S.delete(V), y.delete(V);
88
- }, process: (V) => {
89
- w = V, x ? C = !0 : (x = !0, [m, S] = [S, m], m.forEach(T), m.clear(), x = !1, C && (C = !1, A.process(V)));
90
- } };
91
- return A;
92
- }(r), v), {}), { read: a, resolveKeyframes: l, update: c, preRender: u, render: h, postRender: d } = o, f = () => {
93
- const v = performance.now();
94
- n = !1, i.delta = s ? 1e3 / 60 : Math.max(Math.min(v - i.timestamp, 40), 1), i.timestamp = v, i.isProcessing = !0, a.process(i), l.process(i), c.process(i), u.process(i), h.process(i), d.process(i), i.isProcessing = !1, n && e && (s = !1, t(f));
95
167
  };
96
- return { schedule: me.reduce((v, p) => {
97
- const g = o[p];
98
- return v[p] = (m, S = !1, x = !1) => (n || (n = !0, s = !0, i.isProcessing || t(f)), g.schedule(m, S, x)), v;
99
- }, {}), cancel: (v) => {
100
- for (let p = 0; p < me.length; p++) o[me[p]].cancel(v);
168
+ return l;
169
+ }
170
+ const me = [
171
+ "read",
172
+ // Read
173
+ "resolveKeyframes",
174
+ // Write/Read/Write/Read
175
+ "update",
176
+ // Compute
177
+ "preRender",
178
+ // Compute
179
+ "render",
180
+ // Write
181
+ "postRender"
182
+ // Compute
183
+ ], Gs = 40;
184
+ function gn(t, e) {
185
+ let n = !1, s = !0;
186
+ const i = {
187
+ delta: 0,
188
+ timestamp: 0,
189
+ isProcessing: !1
190
+ }, r = () => n = !0, o = me.reduce((p, g) => (p[g] = Ws(r), p), {}), { read: a, resolveKeyframes: l, update: u, preRender: c, render: f, postRender: d } = o, h = () => {
191
+ const p = performance.now();
192
+ n = !1, i.delta = s ? 1e3 / 60 : Math.max(Math.min(p - i.timestamp, Gs), 1), i.timestamp = p, i.isProcessing = !0, a.process(i), l.process(i), u.process(i), c.process(i), f.process(i), d.process(i), i.isProcessing = !1, n && e && (s = !1, t(h));
193
+ }, y = () => {
194
+ n = !0, s = !0, i.isProcessing || t(h);
195
+ };
196
+ return { schedule: me.reduce((p, g) => {
197
+ const V = o[g];
198
+ return p[g] = (A, w = !1, S = !1) => (n || y(), V.schedule(A, w, S)), p;
199
+ }, {}), cancel: (p) => {
200
+ for (let g = 0; g < me.length; g++)
201
+ o[me[g]].cancel(p);
101
202
  }, state: i, steps: o };
102
203
  }
103
- const { schedule: F, cancel: Ye, state: be, steps: Qr } = wn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : $, !0), Ft = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t;
104
- function de(t, e, n, s) {
105
- if (t === e && n === s) return $;
106
- const i = (r) => function(o, a, l, c, u) {
107
- let h, d, f = 0;
108
- do
109
- d = a + (l - a) / 2, h = Ft(d, c, u) - o, h > 0 ? l = d : a = d;
110
- while (Math.abs(h) > 1e-7 && ++f < 12);
111
- return d;
112
- }(r, 0, 1, t, n);
113
- return (r) => r === 0 || r === 1 ? r : Ft(i(r), e, s);
114
- }
115
- const bn = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, Sn = (t) => (e) => 1 - t(1 - e), Tn = de(0.33, 1.53, 0.69, 0.99), at = Sn(Tn), xn = bn(at), An = (t) => (t *= 2) < 1 ? 0.5 * at(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), lt = (t) => 1 - Math.sin(Math.acos(t)), js = Sn(lt), Vn = bn(lt), Cn = (t) => /^0[^.\s]+$/u.test(t), Mn = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), Pn = (t) => (e) => typeof e == "string" && e.startsWith(t), kn = Pn("--"), Ks = Pn("var(--"), ut = (t) => !!Ks(t) && Ws.test(t.split("/*")[0].trim()), Ws = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, Us = /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
116
- function En(t, e, n = 1) {
117
- U(n <= 4, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);
118
- const [s, i] = function(o) {
119
- const a = Us.exec(o);
120
- if (!a) return [,];
121
- const [, l, c, u] = a;
122
- return [`--${l ?? c}`, u];
123
- }(t);
124
- if (!s) return;
204
+ const { schedule: R, cancel: We, state: ve, steps: Ca } = gn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : _, !0), yn = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Us = 1e-7, zs = 12;
205
+ function Hs(t, e, n, s, i) {
206
+ let r, o, a = 0;
207
+ do
208
+ o = e + (n - e) / 2, r = yn(o, s, i) - t, r > 0 ? n = o : e = o;
209
+ while (Math.abs(r) > Us && ++a < zs);
210
+ return o;
211
+ }
212
+ function he(t, e, n, s) {
213
+ if (t === e && n === s)
214
+ return _;
215
+ const i = (r) => Hs(r, 0, 1, t, n);
216
+ return (r) => r === 0 || r === 1 ? r : yn(i(r), e, s);
217
+ }
218
+ const vn = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, bn = (t) => (e) => 1 - t(1 - e), wn = /* @__PURE__ */ he(0.33, 1.53, 0.69, 0.99), ot = /* @__PURE__ */ bn(wn), Tn = /* @__PURE__ */ vn(ot), Vn = (t) => (t *= 2) < 1 ? 0.5 * ot(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), at = (t) => 1 - Math.sin(Math.acos(t)), qs = bn(at), Sn = vn(at), xn = (t) => /^0[^.\s]+$/u.test(t);
219
+ function Ys(t) {
220
+ return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || xn(t) : !0;
221
+ }
222
+ const An = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), Mn = (t) => (e) => typeof e == "string" && e.startsWith(t), Cn = /* @__PURE__ */ Mn("--"), Xs = /* @__PURE__ */ Mn("var(--"), lt = (t) => Xs(t) ? Zs.test(t.split("/*")[0].trim()) : !1, Zs = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, Js = (
223
+ // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
224
+ /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
225
+ );
226
+ function Qs(t) {
227
+ const e = Js.exec(t);
228
+ if (!e)
229
+ return [,];
230
+ const [, n, s, i] = e;
231
+ return [`--${n ?? s}`, i];
232
+ }
233
+ const ei = 4;
234
+ function Pn(t, e, n = 1) {
235
+ G(n <= ei, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);
236
+ const [s, i] = Qs(t);
237
+ if (!s)
238
+ return;
125
239
  const r = window.getComputedStyle(e).getPropertyValue(s);
126
240
  if (r) {
127
241
  const o = r.trim();
128
- return Mn(o) ? parseFloat(o) : o;
129
- }
130
- return ut(i) ? En(i, e, n + 1) : i;
131
- }
132
- const Y = (t, e, n) => n > e ? e : n < t ? t : n, ne = { test: (t) => typeof t == "number", parse: parseFloat, transform: (t) => t }, ue = { ...ne, transform: (t) => Y(0, 1, t) }, fe = { ...ne, default: 1 }, pe = (t) => ({ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` }), B = pe("deg"), J = pe("%"), b = pe("px"), Ys = pe("vh"), qs = pe("vw"), Ot = { ...J, parse: (t) => J.parse(t) / 100, transform: (t) => J.transform(100 * t) }, zs = /* @__PURE__ */ new Set(["width", "height", "top", "left", "right", "bottom", "x", "y", "translateX", "translateY"]), It = (t) => t === ne || t === b, Rt = (t, e) => parseFloat(t.split(", ")[e]), Dt = (t, e) => (n, { transform: s }) => {
133
- if (s === "none" || !s) return 0;
242
+ return An(o) ? parseFloat(o) : o;
243
+ }
244
+ return lt(i) ? Pn(i, e, n + 1) : i;
245
+ }
246
+ const U = (t, e, n) => n > e ? e : n < t ? t : n, se = {
247
+ test: (t) => typeof t == "number",
248
+ parse: parseFloat,
249
+ transform: (t) => t
250
+ }, ce = {
251
+ ...se,
252
+ transform: (t) => U(0, 1, t)
253
+ }, ge = {
254
+ ...se,
255
+ default: 1
256
+ }, pe = (t) => ({
257
+ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
258
+ parse: parseFloat,
259
+ transform: (e) => `${e}${t}`
260
+ }), N = /* @__PURE__ */ pe("deg"), J = /* @__PURE__ */ pe("%"), m = /* @__PURE__ */ pe("px"), ti = /* @__PURE__ */ pe("vh"), ni = /* @__PURE__ */ pe("vw"), Et = {
261
+ ...J,
262
+ parse: (t) => J.parse(t) / 100,
263
+ transform: (t) => J.transform(t * 100)
264
+ }, si = /* @__PURE__ */ new Set([
265
+ "width",
266
+ "height",
267
+ "top",
268
+ "left",
269
+ "right",
270
+ "bottom",
271
+ "x",
272
+ "y",
273
+ "translateX",
274
+ "translateY"
275
+ ]), kt = (t) => t === se || t === m, Lt = (t, e) => parseFloat(t.split(", ")[e]), Nt = (t, e) => (n, { transform: s }) => {
276
+ if (s === "none" || !s)
277
+ return 0;
134
278
  const i = s.match(/^matrix3d\((.+)\)$/u);
135
- if (i) return Rt(i[1], e);
279
+ if (i)
280
+ return Lt(i[1], e);
136
281
  {
137
282
  const r = s.match(/^matrix\((.+)\)$/u);
138
- return r ? Rt(r[1], t) : 0;
139
- }
140
- }, Hs = /* @__PURE__ */ new Set(["x", "y", "z"]), Xs = he.filter((t) => !Hs.has(t)), X = { width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n), height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n), top: (t, { top: e }) => parseFloat(e), left: (t, { left: e }) => parseFloat(e), bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), x: Dt(4, 13), y: Dt(5, 14) };
141
- X.translateX = X.x, X.translateY = X.y;
142
- const Fn = (t) => (e) => e.test(t), On = [ne, b, J, B, qs, Ys, { test: (t) => t === "auto", parse: (t) => t }], Bt = (t) => On.find(Fn(t)), W = /* @__PURE__ */ new Set();
143
- let qe = !1, ze = !1;
144
- function In() {
145
- if (ze) {
283
+ return r ? Lt(r[1], t) : 0;
284
+ }
285
+ }, ii = /* @__PURE__ */ new Set(["x", "y", "z"]), ri = fe.filter((t) => !ii.has(t));
286
+ function oi(t) {
287
+ const e = [];
288
+ return ri.forEach((n) => {
289
+ const s = t.getValue(n);
290
+ s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
291
+ }), e;
292
+ }
293
+ const Q = {
294
+ // Dimensions
295
+ width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
296
+ height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
297
+ top: (t, { top: e }) => parseFloat(e),
298
+ left: (t, { left: e }) => parseFloat(e),
299
+ bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
300
+ right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
301
+ // Transform
302
+ x: Nt(4, 13),
303
+ y: Nt(5, 14)
304
+ };
305
+ Q.translateX = Q.x;
306
+ Q.translateY = Q.y;
307
+ const Fn = (t) => (e) => e.test(t), ai = {
308
+ test: (t) => t === "auto",
309
+ parse: (t) => t
310
+ }, Dn = [se, m, J, N, ni, ti, ai], Bt = (t) => Dn.find(Fn(t)), W = /* @__PURE__ */ new Set();
311
+ let Ge = !1, Ue = !1;
312
+ function Rn() {
313
+ if (Ue) {
146
314
  const t = Array.from(W).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
147
315
  e.forEach((s) => {
148
- const i = function(r) {
149
- const o = [];
150
- return Xs.forEach((a) => {
151
- const l = r.getValue(a);
152
- l !== void 0 && (o.push([a, l.get()]), l.set(a.startsWith("scale") ? 1 : 0));
153
- }), o;
154
- }(s);
316
+ const i = oi(s);
155
317
  i.length && (n.set(s, i), s.render());
156
318
  }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
157
319
  s.render();
@@ -164,31 +326,38 @@ function In() {
164
326
  s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
165
327
  });
166
328
  }
167
- ze = !1, qe = !1, W.forEach((t) => t.complete()), W.clear();
329
+ Ue = !1, Ge = !1, W.forEach((t) => t.complete()), W.clear();
168
330
  }
169
- function Rn() {
331
+ function In() {
170
332
  W.forEach((t) => {
171
- t.readKeyframes(), t.needsMeasurement && (ze = !0);
333
+ t.readKeyframes(), t.needsMeasurement && (Ue = !0);
172
334
  });
173
335
  }
174
- class ct {
336
+ function li() {
337
+ In(), Rn();
338
+ }
339
+ class ut {
175
340
  constructor(e, n, s, i, r, o = !1) {
176
341
  this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = o;
177
342
  }
178
343
  scheduleResolve() {
179
- this.isScheduled = !0, this.isAsync ? (W.add(this), qe || (qe = !0, F.read(Rn), F.resolveKeyframes(In))) : (this.readKeyframes(), this.complete());
344
+ this.isScheduled = !0, this.isAsync ? (W.add(this), Ge || (Ge = !0, R.read(In), R.resolveKeyframes(Rn))) : (this.readKeyframes(), this.complete());
180
345
  }
181
346
  readKeyframes() {
182
347
  const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
183
- for (let r = 0; r < e.length; r++) if (e[r] === null) if (r === 0) {
184
- const o = i == null ? void 0 : i.get(), a = e[e.length - 1];
185
- if (o !== void 0) e[0] = o;
186
- else if (s && n) {
187
- const l = s.readValue(n, a);
188
- l != null && (e[0] = l);
189
- }
190
- e[0] === void 0 && (e[0] = a), i && o === void 0 && i.set(e[0]);
191
- } else e[r] = e[r - 1];
348
+ for (let r = 0; r < e.length; r++)
349
+ if (e[r] === null)
350
+ if (r === 0) {
351
+ const o = i == null ? void 0 : i.get(), a = e[e.length - 1];
352
+ if (o !== void 0)
353
+ e[0] = o;
354
+ else if (s && n) {
355
+ const l = s.readValue(n, a);
356
+ l != null && (e[0] = l);
357
+ }
358
+ e[0] === void 0 && (e[0] = a), i && o === void 0 && i.set(e[0]);
359
+ } else
360
+ e[r] = e[r - 1];
192
361
  }
193
362
  setFinalKeyframe() {
194
363
  }
@@ -208,159 +377,363 @@ class ct {
208
377
  this.isComplete || this.scheduleResolve();
209
378
  }
210
379
  }
211
- const ae = (t) => Math.round(1e5 * t) / 1e5, ht = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu, _s = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, dt = (t, e) => (n) => !!(typeof n == "string" && _s.test(n) && n.startsWith(t) || e && !function(s) {
212
- return s == null;
213
- }(n) && Object.prototype.hasOwnProperty.call(n, e)), Dn = (t, e, n) => (s) => {
214
- if (typeof s != "string") return s;
215
- const [i, r, o, a] = s.match(ht);
216
- return { [t]: parseFloat(i), [e]: parseFloat(r), [n]: parseFloat(o), alpha: a !== void 0 ? parseFloat(a) : 1 };
217
- }, De = { ...ne, transform: (t) => Math.round(((e) => Y(0, 255, e))(t)) }, K = { test: dt("rgb", "red"), parse: Dn("red", "green", "blue"), transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + De.transform(t) + ", " + De.transform(e) + ", " + De.transform(n) + ", " + ae(ue.transform(s)) + ")" }, He = { test: dt("#"), parse: function(t) {
380
+ const le = (t) => Math.round(t * 1e5) / 1e5, ct = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
381
+ function ui(t) {
382
+ return t == null;
383
+ }
384
+ const ci = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, dt = (t, e) => (n) => !!(typeof n == "string" && ci.test(n) && n.startsWith(t) || e && !ui(n) && Object.prototype.hasOwnProperty.call(n, e)), On = (t, e, n) => (s) => {
385
+ if (typeof s != "string")
386
+ return s;
387
+ const [i, r, o, a] = s.match(ct);
388
+ return {
389
+ [t]: parseFloat(i),
390
+ [e]: parseFloat(r),
391
+ [n]: parseFloat(o),
392
+ alpha: a !== void 0 ? parseFloat(a) : 1
393
+ };
394
+ }, di = (t) => U(0, 255, t), Le = {
395
+ ...se,
396
+ transform: (t) => Math.round(di(t))
397
+ }, j = {
398
+ test: /* @__PURE__ */ dt("rgb", "red"),
399
+ parse: /* @__PURE__ */ On("red", "green", "blue"),
400
+ transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + Le.transform(t) + ", " + Le.transform(e) + ", " + Le.transform(n) + ", " + le(ce.transform(s)) + ")"
401
+ };
402
+ function fi(t) {
218
403
  let e = "", n = "", s = "", i = "";
219
- return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), s = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), s = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, s += s, i += i), { red: parseInt(e, 16), green: parseInt(n, 16), blue: parseInt(s, 16), alpha: i ? parseInt(i, 16) / 255 : 1 };
220
- }, transform: K.transform }, _ = { test: dt("hsl", "hue"), parse: Dn("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + J.transform(ae(e)) + ", " + J.transform(ae(n)) + ", " + ae(ue.transform(s)) + ")" }, P = { test: (t) => K.test(t) || He.test(t) || _.test(t), parse: (t) => K.test(t) ? K.parse(t) : _.test(t) ? _.parse(t) : He.parse(t), transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? K.transform(t) : _.transform(t) }, Gs = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu, Bn = "number", Nn = "color", Zs = /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;
221
- function ce(t) {
222
- const e = t.toString(), n = [], s = { color: [], number: [], var: [] }, i = [];
404
+ return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), s = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), s = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, s += s, i += i), {
405
+ red: parseInt(e, 16),
406
+ green: parseInt(n, 16),
407
+ blue: parseInt(s, 16),
408
+ alpha: i ? parseInt(i, 16) / 255 : 1
409
+ };
410
+ }
411
+ const ze = {
412
+ test: /* @__PURE__ */ dt("#"),
413
+ parse: fi,
414
+ transform: j.transform
415
+ }, X = {
416
+ test: /* @__PURE__ */ dt("hsl", "hue"),
417
+ parse: /* @__PURE__ */ On("hue", "saturation", "lightness"),
418
+ transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + J.transform(le(e)) + ", " + J.transform(le(n)) + ", " + le(ce.transform(s)) + ")"
419
+ }, C = {
420
+ test: (t) => j.test(t) || ze.test(t) || X.test(t),
421
+ parse: (t) => j.test(t) ? j.parse(t) : X.test(t) ? X.parse(t) : ze.parse(t),
422
+ transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? j.transform(t) : X.transform(t)
423
+ }, hi = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
424
+ function pi(t) {
425
+ var e, n;
426
+ return isNaN(t) && typeof t == "string" && (((e = t.match(ct)) === null || e === void 0 ? void 0 : e.length) || 0) + (((n = t.match(hi)) === null || n === void 0 ? void 0 : n.length) || 0) > 0;
427
+ }
428
+ const En = "number", kn = "color", mi = "var", gi = "var(", Kt = "${}", yi = /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;
429
+ function de(t) {
430
+ const e = t.toString(), n = [], s = {
431
+ color: [],
432
+ number: [],
433
+ var: []
434
+ }, i = [];
223
435
  let r = 0;
224
- const o = e.replace(Zs, (a) => (P.test(a) ? (s.color.push(r), i.push(Nn), n.push(P.parse(a))) : a.startsWith("var(") ? (s.var.push(r), i.push("var"), n.push(a)) : (s.number.push(r), i.push(Bn), n.push(parseFloat(a))), ++r, "${}")).split("${}");
225
- return { values: n, split: o, indexes: s, types: i };
436
+ const a = e.replace(yi, (l) => (C.test(l) ? (s.color.push(r), i.push(kn), n.push(C.parse(l))) : l.startsWith(gi) ? (s.var.push(r), i.push(mi), n.push(l)) : (s.number.push(r), i.push(En), n.push(parseFloat(l))), ++r, Kt)).split(Kt);
437
+ return { values: n, split: a, indexes: s, types: i };
226
438
  }
227
- function Nt(t) {
228
- return ce(t).values;
439
+ function Ln(t) {
440
+ return de(t).values;
229
441
  }
230
- function Lt(t) {
231
- const { split: e, types: n } = ce(t), s = e.length;
442
+ function Nn(t) {
443
+ const { split: e, types: n } = de(t), s = e.length;
232
444
  return (i) => {
233
445
  let r = "";
234
- for (let o = 0; o < s; o++) if (r += e[o], i[o] !== void 0) {
235
- const a = n[o];
236
- r += a === Bn ? ae(i[o]) : a === Nn ? P.transform(i[o]) : i[o];
237
- }
446
+ for (let o = 0; o < s; o++)
447
+ if (r += e[o], i[o] !== void 0) {
448
+ const a = n[o];
449
+ a === En ? r += le(i[o]) : a === kn ? r += C.transform(i[o]) : r += i[o];
450
+ }
238
451
  return r;
239
452
  };
240
453
  }
241
- const Js = (t) => typeof t == "number" ? 0 : t, se = { test: function(t) {
242
- var e, n;
243
- return isNaN(t) && typeof t == "string" && (((e = t.match(ht)) === null || e === void 0 ? void 0 : e.length) || 0) + (((n = t.match(Gs)) === null || n === void 0 ? void 0 : n.length) || 0) > 0;
244
- }, parse: Nt, createTransformer: Lt, getAnimatableNone: function(t) {
245
- const e = Nt(t);
246
- return Lt(t)(e.map(Js));
247
- } }, Qs = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
248
- function ei(t) {
454
+ const vi = (t) => typeof t == "number" ? 0 : t;
455
+ function bi(t) {
456
+ const e = Ln(t);
457
+ return Nn(t)(e.map(vi));
458
+ }
459
+ const ie = {
460
+ test: pi,
461
+ parse: Ln,
462
+ createTransformer: Nn,
463
+ getAnimatableNone: bi
464
+ }, wi = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
465
+ function Ti(t) {
249
466
  const [e, n] = t.slice(0, -1).split("(");
250
- if (e === "drop-shadow") return t;
251
- const [s] = n.match(ht) || [];
252
- if (!s) return t;
467
+ if (e === "drop-shadow")
468
+ return t;
469
+ const [s] = n.match(ct) || [];
470
+ if (!s)
471
+ return t;
253
472
  const i = n.replace(s, "");
254
- let r = Qs.has(e) ? 1 : 0;
473
+ let r = wi.has(e) ? 1 : 0;
255
474
  return s !== n && (r *= 100), e + "(" + r + i + ")";
256
475
  }
257
- const ti = /\b([a-z-]*)\(.*?\)/gu, Xe = { ...se, getAnimatableNone: (t) => {
258
- const e = t.match(ti);
259
- return e ? e.map(ei).join(" ") : t;
260
- } }, ni = { borderWidth: b, borderTopWidth: b, borderRightWidth: b, borderBottomWidth: b, borderLeftWidth: b, borderRadius: b, radius: b, borderTopLeftRadius: b, borderTopRightRadius: b, borderBottomRightRadius: b, borderBottomLeftRadius: b, width: b, maxWidth: b, height: b, maxHeight: b, top: b, right: b, bottom: b, left: b, padding: b, paddingTop: b, paddingRight: b, paddingBottom: b, paddingLeft: b, margin: b, marginTop: b, marginRight: b, marginBottom: b, marginLeft: b, backgroundPositionX: b, backgroundPositionY: b }, si = { rotate: B, rotateX: B, rotateY: B, rotateZ: B, scale: fe, scaleX: fe, scaleY: fe, scaleZ: fe, skew: B, skewX: B, skewY: B, distance: b, translateX: b, translateY: b, translateZ: b, x: b, y: b, z: b, perspective: b, transformPerspective: b, opacity: ue, originX: Ot, originY: Ot, originZ: b }, $t = { ...ne, transform: Math.round }, _e = { ...ni, ...si, zIndex: $t, size: b, fillOpacity: ue, strokeOpacity: ue, numOctaves: $t }, ii = { ..._e, color: P, backgroundColor: P, outlineColor: P, fill: P, stroke: P, borderColor: P, borderTopColor: P, borderRightColor: P, borderBottomColor: P, borderLeftColor: P, filter: Xe, WebkitFilter: Xe }, pt = (t) => ii[t];
261
- function Ln(t, e) {
262
- let n = pt(t);
263
- return n !== Xe && (n = se), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
264
- }
265
- const ri = /* @__PURE__ */ new Set(["auto", "none", "0"]);
266
- class $n extends ct {
476
+ const Vi = /\b([a-z-]*)\(.*?\)/gu, He = {
477
+ ...ie,
478
+ getAnimatableNone: (t) => {
479
+ const e = t.match(Vi);
480
+ return e ? e.map(Ti).join(" ") : t;
481
+ }
482
+ }, Si = {
483
+ // Border props
484
+ borderWidth: m,
485
+ borderTopWidth: m,
486
+ borderRightWidth: m,
487
+ borderBottomWidth: m,
488
+ borderLeftWidth: m,
489
+ borderRadius: m,
490
+ radius: m,
491
+ borderTopLeftRadius: m,
492
+ borderTopRightRadius: m,
493
+ borderBottomRightRadius: m,
494
+ borderBottomLeftRadius: m,
495
+ // Positioning props
496
+ width: m,
497
+ maxWidth: m,
498
+ height: m,
499
+ maxHeight: m,
500
+ top: m,
501
+ right: m,
502
+ bottom: m,
503
+ left: m,
504
+ // Spacing props
505
+ padding: m,
506
+ paddingTop: m,
507
+ paddingRight: m,
508
+ paddingBottom: m,
509
+ paddingLeft: m,
510
+ margin: m,
511
+ marginTop: m,
512
+ marginRight: m,
513
+ marginBottom: m,
514
+ marginLeft: m,
515
+ // Misc
516
+ backgroundPositionX: m,
517
+ backgroundPositionY: m
518
+ }, xi = {
519
+ rotate: N,
520
+ rotateX: N,
521
+ rotateY: N,
522
+ rotateZ: N,
523
+ scale: ge,
524
+ scaleX: ge,
525
+ scaleY: ge,
526
+ scaleZ: ge,
527
+ skew: N,
528
+ skewX: N,
529
+ skewY: N,
530
+ distance: m,
531
+ translateX: m,
532
+ translateY: m,
533
+ translateZ: m,
534
+ x: m,
535
+ y: m,
536
+ z: m,
537
+ perspective: m,
538
+ transformPerspective: m,
539
+ opacity: ce,
540
+ originX: Et,
541
+ originY: Et,
542
+ originZ: m
543
+ }, _t = {
544
+ ...se,
545
+ transform: Math.round
546
+ }, ft = {
547
+ ...Si,
548
+ ...xi,
549
+ zIndex: _t,
550
+ size: m,
551
+ // SVG
552
+ fillOpacity: ce,
553
+ strokeOpacity: ce,
554
+ numOctaves: _t
555
+ }, Ai = {
556
+ ...ft,
557
+ // Color props
558
+ color: C,
559
+ backgroundColor: C,
560
+ outlineColor: C,
561
+ fill: C,
562
+ stroke: C,
563
+ // Border props
564
+ borderColor: C,
565
+ borderTopColor: C,
566
+ borderRightColor: C,
567
+ borderBottomColor: C,
568
+ borderLeftColor: C,
569
+ filter: He,
570
+ WebkitFilter: He
571
+ }, ht = (t) => Ai[t];
572
+ function Bn(t, e) {
573
+ let n = ht(t);
574
+ return n !== He && (n = ie), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
575
+ }
576
+ const Mi = /* @__PURE__ */ new Set(["auto", "none", "0"]);
577
+ function Ci(t, e, n) {
578
+ let s = 0, i;
579
+ for (; s < t.length && !i; ) {
580
+ const r = t[s];
581
+ typeof r == "string" && !Mi.has(r) && de(r).values.length && (i = t[s]), s++;
582
+ }
583
+ if (i && n)
584
+ for (const r of e)
585
+ t[r] = Bn(n, i);
586
+ }
587
+ class Kn extends ut {
267
588
  constructor(e, n, s, i, r) {
268
589
  super(e, n, s, i, r, !0);
269
590
  }
270
591
  readKeyframes() {
271
592
  const { unresolvedKeyframes: e, element: n, name: s } = this;
272
- if (!n || !n.current) return;
593
+ if (!n || !n.current)
594
+ return;
273
595
  super.readKeyframes();
274
596
  for (let l = 0; l < e.length; l++) {
275
- let c = e[l];
276
- if (typeof c == "string" && (c = c.trim(), ut(c))) {
277
- const u = En(c, n.current);
278
- u !== void 0 && (e[l] = u), l === e.length - 1 && (this.finalKeyframe = c);
597
+ let u = e[l];
598
+ if (typeof u == "string" && (u = u.trim(), lt(u))) {
599
+ const c = Pn(u, n.current);
600
+ c !== void 0 && (e[l] = c), l === e.length - 1 && (this.finalKeyframe = u);
279
601
  }
280
602
  }
281
- if (this.resolveNoneKeyframes(), !zs.has(s) || e.length !== 2) return;
603
+ if (this.resolveNoneKeyframes(), !si.has(s) || e.length !== 2)
604
+ return;
282
605
  const [i, r] = e, o = Bt(i), a = Bt(r);
283
- if (o !== a) if (It(o) && It(a)) for (let l = 0; l < e.length; l++) {
284
- const c = e[l];
285
- typeof c == "string" && (e[l] = parseFloat(c));
286
- }
287
- else this.needsMeasurement = !0;
606
+ if (o !== a)
607
+ if (kt(o) && kt(a))
608
+ for (let l = 0; l < e.length; l++) {
609
+ const u = e[l];
610
+ typeof u == "string" && (e[l] = parseFloat(u));
611
+ }
612
+ else
613
+ this.needsMeasurement = !0;
288
614
  }
289
615
  resolveNoneKeyframes() {
290
616
  const { unresolvedKeyframes: e, name: n } = this, s = [];
291
- for (let r = 0; r < e.length; r++) (typeof (i = e[r]) == "number" ? i === 0 : i === null || i === "none" || i === "0" || Cn(i)) && s.push(r);
292
- var i;
293
- s.length && function(r, o, a) {
294
- let l, c = 0;
295
- for (; c < r.length && !l; ) {
296
- const u = r[c];
297
- typeof u == "string" && !ri.has(u) && ce(u).values.length && (l = r[c]), c++;
298
- }
299
- if (l && a) for (const u of o) r[u] = Ln(a, l);
300
- }(e, s, n);
617
+ for (let i = 0; i < e.length; i++)
618
+ Ys(e[i]) && s.push(i);
619
+ s.length && Ci(e, s, n);
301
620
  }
302
621
  measureInitialState() {
303
622
  const { element: e, unresolvedKeyframes: n, name: s } = this;
304
- if (!e || !e.current) return;
305
- s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = X[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
623
+ if (!e || !e.current)
624
+ return;
625
+ s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = Q[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
306
626
  const i = n[n.length - 1];
307
627
  i !== void 0 && e.getValue(s, i).jump(i, !1);
308
628
  }
309
629
  measureEndState() {
310
630
  var e;
311
631
  const { element: n, name: s, unresolvedKeyframes: i } = this;
312
- if (!n || !n.current) return;
632
+ if (!n || !n.current)
633
+ return;
313
634
  const r = n.getValue(s);
314
635
  r && r.jump(this.measuredOrigin, !1);
315
636
  const o = i.length - 1, a = i[o];
316
- i[o] = X[s](n.measureViewportBox(), window.getComputedStyle(n.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([l, c]) => {
317
- n.getValue(l).set(c);
637
+ i[o] = Q[s](n.measureViewportBox(), window.getComputedStyle(n.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([l, u]) => {
638
+ n.getValue(l).set(u);
318
639
  }), this.resolveNoneKeyframes();
319
640
  }
320
641
  }
321
- function mt(t) {
642
+ function pt(t) {
322
643
  return typeof t == "function";
323
644
  }
324
- let ve;
325
- function oi() {
326
- ve = void 0;
327
- }
328
- const L = { now: () => (ve === void 0 && L.set(be.isProcessing || Ls ? be.timestamp : performance.now()), ve), set: (t) => {
329
- ve = t, queueMicrotask(oi);
330
- } }, jt = (t, e) => e !== "zIndex" && (!(typeof t != "number" && !Array.isArray(t)) || !(typeof t != "string" || !se.test(t) && t !== "0" || t.startsWith("url(")));
331
- function ai(t, e, n, s) {
645
+ let ye;
646
+ function Pi() {
647
+ ye = void 0;
648
+ }
649
+ const K = {
650
+ now: () => (ye === void 0 && K.set(ve.isProcessing || $s.useManualTiming ? ve.timestamp : performance.now()), ye),
651
+ set: (t) => {
652
+ ye = t, queueMicrotask(Pi);
653
+ }
654
+ }, $t = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
655
+ (ie.test(t) || t === "0") && // And it contains numbers and/or colors
656
+ !t.startsWith("url("));
657
+ function Fi(t) {
658
+ const e = t[0];
659
+ if (t.length === 1)
660
+ return !0;
661
+ for (let n = 0; n < t.length; n++)
662
+ if (t[n] !== e)
663
+ return !0;
664
+ }
665
+ function Di(t, e, n, s) {
332
666
  const i = t[0];
333
- if (i === null) return !1;
334
- if (e === "display" || e === "visibility") return !0;
335
- const r = t[t.length - 1], o = jt(i, e), a = jt(r, e);
336
- return te(o === a, `You are trying to animate ${e} 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) && (function(l) {
337
- const c = l[0];
338
- if (l.length === 1) return !0;
339
- for (let u = 0; u < l.length; u++) if (l[u] !== c) return !0;
340
- }(t) || (n === "spring" || mt(n)) && s);
341
- }
342
- class jn {
667
+ if (i === null)
668
+ return !1;
669
+ if (e === "display" || e === "visibility")
670
+ return !0;
671
+ const r = t[t.length - 1], o = $t(i, e), a = $t(r, e);
672
+ return ne(o === a, `You are trying to animate ${e} 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 : Fi(t) || (n === "spring" || pt(n)) && s;
673
+ }
674
+ const Ri = 40;
675
+ class _n {
343
676
  constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", ...a }) {
344
- this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = L.now(), this.options = { autoplay: e, delay: n, type: s, repeat: i, repeatDelay: r, repeatType: o, ...a }, this.updateFinishedPromise();
345
- }
677
+ this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = K.now(), this.options = {
678
+ autoplay: e,
679
+ delay: n,
680
+ type: s,
681
+ repeat: i,
682
+ repeatDelay: r,
683
+ repeatType: o,
684
+ ...a
685
+ }, this.updateFinishedPromise();
686
+ }
687
+ /**
688
+ * This method uses the createdAt and resolvedAt to calculate the
689
+ * animation startTime. *Ideally*, we would use the createdAt time as t=0
690
+ * as the following frame would then be the first frame of the animation in
691
+ * progress, which would feel snappier.
692
+ *
693
+ * However, if there's a delay (main thread work) between the creation of
694
+ * the animation and the first commited frame, we prefer to use resolvedAt
695
+ * to avoid a sudden jump into the animation.
696
+ */
346
697
  calcStartTime() {
347
- return this.resolvedAt && this.resolvedAt - this.createdAt > 40 ? this.resolvedAt : this.createdAt;
698
+ return this.resolvedAt ? this.resolvedAt - this.createdAt > Ri ? this.resolvedAt : this.createdAt : this.createdAt;
348
699
  }
700
+ /**
701
+ * A getter for resolved data. If keyframes are not yet resolved, accessing
702
+ * this.resolved will synchronously flush all pending keyframe resolvers.
703
+ * This is a deoptimisation, but at its worst still batches read/writes.
704
+ */
349
705
  get resolved() {
350
- return this._resolved || this.hasAttemptedResolve || (Rn(), In()), this._resolved;
706
+ return !this._resolved && !this.hasAttemptedResolve && li(), this._resolved;
351
707
  }
708
+ /**
709
+ * A method to be called when the keyframes resolver completes. This method
710
+ * will check if its possible to run the animation and, if not, skip it.
711
+ * Otherwise, it will call initPlayback on the implementing class.
712
+ */
352
713
  onKeyframesResolved(e, n) {
353
- this.resolvedAt = L.now(), this.hasAttemptedResolve = !0;
354
- const { name: s, type: i, velocity: r, delay: o, onComplete: a, onUpdate: l, isGenerator: c } = this.options;
355
- if (!c && !ai(e, s, i, r)) {
356
- if (!o) return l == null || l(Pe(e, this.options, n)), a == null || a(), void this.resolveFinishedPromise();
357
- this.options.duration = 0;
358
- }
359
- const u = this.initPlayback(e, n);
360
- u !== !1 && (this._resolved = { keyframes: e, finalKeyframe: n, ...u }, this.onPostResolved());
714
+ this.resolvedAt = K.now(), this.hasAttemptedResolve = !0;
715
+ const { name: s, type: i, velocity: r, delay: o, onComplete: a, onUpdate: l, isGenerator: u } = this.options;
716
+ if (!u && !Di(e, s, i, r))
717
+ if (o)
718
+ this.options.duration = 0;
719
+ else {
720
+ l == null || l(Fe(e, this.options, n)), a == null || a(), this.resolveFinishedPromise();
721
+ return;
722
+ }
723
+ const c = this.initPlayback(e, n);
724
+ c !== !1 && (this._resolved = {
725
+ keyframes: e,
726
+ finalKeyframe: n,
727
+ ...c
728
+ }, this.onPostResolved());
361
729
  }
362
730
  onPostResolved() {
363
731
  }
732
+ /**
733
+ * Allows the returned animation to be awaited or promise-chained. Currently
734
+ * resolves when the animation finishes at all but in a future update could/should
735
+ * reject if its cancels.
736
+ */
364
737
  then(e, n) {
365
738
  return this.currentFinishedPromise.then(e, n);
366
739
  }
@@ -373,325 +746,504 @@ class jn {
373
746
  });
374
747
  }
375
748
  }
376
- const ft = (t, e, n) => {
749
+ const mt = (t, e, n) => {
377
750
  const s = e - t;
378
751
  return s === 0 ? 1 : (n - t) / s;
379
- }, Kn = (t, e, n = 10) => {
752
+ }, $n = (t, e, n = 10) => {
380
753
  let s = "";
381
754
  const i = Math.max(Math.round(e / n), 2);
382
- for (let r = 0; r < i; r++) s += t(ft(0, i - 1, r)) + ", ";
755
+ for (let r = 0; r < i; r++)
756
+ s += t(mt(0, i - 1, r)) + ", ";
383
757
  return `linear(${s.substring(0, s.length - 2)})`;
384
758
  };
385
- function Wn(t, e) {
759
+ function jn(t, e) {
386
760
  return e ? t * (1e3 / e) : 0;
387
761
  }
388
- function Un(t, e, n) {
389
- const s = Math.max(e - 5, 0);
390
- return Wn(n - t(s), e - s);
391
- }
392
- const Yn = 100, qn = 10, ge = 1, zn = 0, li = 800, Hn = 0.3, ui = 0.3, Kt = { granular: 0.01, default: 2 }, Wt = { granular: 5e-3, default: 0.5 }, ci = 0.01, Ut = 10, hi = 0.05, di = 1;
393
- function pi({ duration: t = li, bounce: e = Hn, velocity: n = zn, mass: s = ge }) {
762
+ const Ii = 5;
763
+ function Wn(t, e, n) {
764
+ const s = Math.max(e - Ii, 0);
765
+ return jn(n - t(s), e - s);
766
+ }
767
+ const x = {
768
+ // Default spring physics
769
+ stiffness: 100,
770
+ damping: 10,
771
+ mass: 1,
772
+ velocity: 0,
773
+ // Default duration/bounce-based options
774
+ duration: 800,
775
+ // in ms
776
+ bounce: 0.3,
777
+ visualDuration: 0.3,
778
+ // in seconds
779
+ // Rest thresholds
780
+ restSpeed: {
781
+ granular: 0.01,
782
+ default: 2
783
+ },
784
+ restDelta: {
785
+ granular: 5e-3,
786
+ default: 0.5
787
+ },
788
+ // Limits
789
+ minDuration: 0.01,
790
+ // in seconds
791
+ maxDuration: 10,
792
+ // in seconds
793
+ minDamping: 0.05,
794
+ maxDamping: 1
795
+ }, jt = 1e-3;
796
+ function Oi({ duration: t = x.duration, bounce: e = x.bounce, velocity: n = x.velocity, mass: s = x.mass }) {
394
797
  let i, r;
395
- te(t <= R(Ut), "Spring duration must be 10 seconds or less");
798
+ ne(t <= L(x.maxDuration), "Spring duration must be 10 seconds or less");
396
799
  let o = 1 - e;
397
- o = Y(hi, di, o), t = Y(ci, Ut, N(t)), o < 1 ? (i = (l) => {
398
- const c = l * o, u = c * t;
399
- return 1e-3 - (c - n) / Ge(l, o) * Math.exp(-u);
400
- }, r = (l) => {
401
- const c = l * o * t, u = c * n + n, h = Math.pow(o, 2) * Math.pow(l, 2) * t, d = Math.exp(-c), f = Ge(Math.pow(l, 2), o);
402
- return (1e-3 - i(l) > 0 ? -1 : 1) * ((u - h) * d) / f;
403
- }) : (i = (l) => Math.exp(-l * t) * ((l - n) * t + 1) - 1e-3, r = (l) => Math.exp(-l * t) * (t * t * (n - l)));
404
- const a = function(l, c, u) {
405
- let h = u;
406
- for (let d = 1; d < mi; d++) h -= l(h) / c(h);
407
- return h;
408
- }(i, r, 5 / t);
409
- if (t = R(t), isNaN(a)) return { stiffness: Yn, damping: qn, duration: t };
800
+ o = U(x.minDamping, x.maxDamping, o), t = U(x.minDuration, x.maxDuration, B(t)), o < 1 ? (i = (u) => {
801
+ const c = u * o, f = c * t, d = c - n, h = qe(u, o), y = Math.exp(-f);
802
+ return jt - d / h * y;
803
+ }, r = (u) => {
804
+ const f = u * o * t, d = f * n + n, h = Math.pow(o, 2) * Math.pow(u, 2) * t, y = Math.exp(-f), v = qe(Math.pow(u, 2), o);
805
+ return (-i(u) + jt > 0 ? -1 : 1) * ((d - h) * y) / v;
806
+ }) : (i = (u) => {
807
+ const c = Math.exp(-u * t), f = (u - n) * t + 1;
808
+ return -1e-3 + c * f;
809
+ }, r = (u) => {
810
+ const c = Math.exp(-u * t), f = (n - u) * (t * t);
811
+ return c * f;
812
+ });
813
+ const a = 5 / t, l = ki(i, r, a);
814
+ if (t = L(t), isNaN(l))
815
+ return {
816
+ stiffness: x.stiffness,
817
+ damping: x.damping,
818
+ duration: t
819
+ };
410
820
  {
411
- const l = Math.pow(a, 2) * s;
412
- return { stiffness: l, damping: 2 * o * Math.sqrt(s * l), duration: t };
821
+ const u = Math.pow(l, 2) * s;
822
+ return {
823
+ stiffness: u,
824
+ damping: o * 2 * Math.sqrt(s * u),
825
+ duration: t
826
+ };
413
827
  }
414
828
  }
415
- const mi = 12;
416
- function Ge(t, e) {
417
- return t * Math.sqrt(1 - e * e);
829
+ const Ei = 12;
830
+ function ki(t, e, n) {
831
+ let s = n;
832
+ for (let i = 1; i < Ei; i++)
833
+ s = s - t(s) / e(s);
834
+ return s;
418
835
  }
419
- const Ze = 2e4;
420
- function Xn(t) {
421
- let e = 0, n = t.next(e);
422
- for (; !n.done && e < Ze; ) e += 50, n = t.next(e);
423
- return e >= Ze ? 1 / 0 : e;
836
+ function qe(t, e) {
837
+ return t * Math.sqrt(1 - e * e);
424
838
  }
425
- const fi = ["duration", "bounce"], vi = ["stiffness", "damping", "mass"];
426
- function Yt(t, e) {
839
+ const Ye = 2e4;
840
+ function Gn(t) {
841
+ let e = 0;
842
+ const n = 50;
843
+ let s = t.next(e);
844
+ for (; !s.done && e < Ye; )
845
+ e += n, s = t.next(e);
846
+ return e >= Ye ? 1 / 0 : e;
847
+ }
848
+ const Li = ["duration", "bounce"], Ni = ["stiffness", "damping", "mass"];
849
+ function Wt(t, e) {
427
850
  return e.some((n) => t[n] !== void 0);
428
851
  }
429
- function _n(t = ui, e = Hn) {
430
- const n = typeof t != "object" ? { visualDuration: t, keyframes: [0, 1], bounce: e } : t;
431
- let { restSpeed: s, restDelta: i } = n;
432
- const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: r }, { stiffness: l, damping: c, mass: u, duration: h, velocity: d, isResolvedFromDuration: f } = function(y) {
433
- let w = { velocity: zn, stiffness: Yn, damping: qn, mass: ge, isResolvedFromDuration: !1, ...y };
434
- if (!Yt(y, vi) && Yt(y, fi)) if (y.visualDuration) {
435
- const T = y.visualDuration, A = 2 * Math.PI / (1.2 * T), V = A * A, M = 2 * Y(0.05, 1, 1 - y.bounce) * Math.sqrt(V);
436
- w = { ...w, mass: ge, stiffness: V, damping: M };
852
+ function Bi(t) {
853
+ let e = {
854
+ velocity: x.velocity,
855
+ stiffness: x.stiffness,
856
+ damping: x.damping,
857
+ mass: x.mass,
858
+ isResolvedFromDuration: !1,
859
+ ...t
860
+ };
861
+ if (!Wt(t, Ni) && Wt(t, Li))
862
+ if (t.visualDuration) {
863
+ const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * U(0.05, 1, 1 - t.bounce) * Math.sqrt(i);
864
+ e = {
865
+ ...e,
866
+ mass: x.mass,
867
+ stiffness: i,
868
+ damping: r
869
+ };
437
870
  } else {
438
- const T = pi(y);
439
- w = { ...w, ...T, mass: ge }, w.isResolvedFromDuration = !0;
871
+ const n = Oi(t);
872
+ e = {
873
+ ...e,
874
+ ...n,
875
+ mass: x.mass
876
+ }, e.isResolvedFromDuration = !0;
440
877
  }
441
- return w;
442
- }({ ...n, velocity: -N(n.velocity || 0) }), v = d || 0, p = c / (2 * Math.sqrt(l * u)), g = o - r, m = N(Math.sqrt(l / u)), S = Math.abs(g) < 5;
443
- let x;
444
- if (s || (s = S ? Kt.granular : Kt.default), i || (i = S ? Wt.granular : Wt.default), p < 1) {
445
- const y = Ge(m, p);
446
- x = (w) => {
447
- const T = Math.exp(-p * m * w);
448
- return o - T * ((v + p * m * g) / y * Math.sin(y * w) + g * Math.cos(y * w));
878
+ return e;
879
+ }
880
+ function Un(t = x.visualDuration, e = x.bounce) {
881
+ const n = typeof t != "object" ? {
882
+ visualDuration: t,
883
+ keyframes: [0, 1],
884
+ bounce: e
885
+ } : t;
886
+ let { restSpeed: s, restDelta: i } = n;
887
+ 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 } = Bi({
888
+ ...n,
889
+ velocity: -B(n.velocity || 0)
890
+ }), y = d || 0, v = u / (2 * Math.sqrt(l * c)), b = o - r, p = B(Math.sqrt(l / c)), g = Math.abs(b) < 5;
891
+ s || (s = g ? x.restSpeed.granular : x.restSpeed.default), i || (i = g ? x.restDelta.granular : x.restDelta.default);
892
+ let V;
893
+ if (v < 1) {
894
+ const w = qe(p, v);
895
+ V = (S) => {
896
+ const M = Math.exp(-v * p * S);
897
+ return o - M * ((y + v * p * b) / w * Math.sin(w * S) + b * Math.cos(w * S));
449
898
  };
450
- } else if (p === 1) x = (y) => o - Math.exp(-m * y) * (g + (v + m * g) * y);
899
+ } else if (v === 1)
900
+ V = (w) => o - Math.exp(-p * w) * (b + (y + p * b) * w);
451
901
  else {
452
- const y = m * Math.sqrt(p * p - 1);
453
- x = (w) => {
454
- const T = Math.exp(-p * m * w), A = Math.min(y * w, 300);
455
- return o - T * ((v + p * m * g) * Math.sinh(A) + y * g * Math.cosh(A)) / y;
902
+ const w = p * Math.sqrt(v * v - 1);
903
+ V = (S) => {
904
+ const M = Math.exp(-v * p * S), T = Math.min(w * S, 300);
905
+ return o - M * ((y + v * p * b) * Math.sinh(T) + w * b * Math.cosh(T)) / w;
456
906
  };
457
907
  }
458
- const C = { calculatedDuration: f && h || null, next: (y) => {
459
- const w = x(y);
460
- if (f) a.done = y >= h;
461
- else {
462
- let T = 0;
463
- p < 1 && (T = y === 0 ? R(v) : Un(x, y, w));
464
- const A = Math.abs(T) <= s, V = Math.abs(o - w) <= i;
465
- a.done = A && V;
908
+ const A = {
909
+ calculatedDuration: h && f || null,
910
+ next: (w) => {
911
+ const S = V(w);
912
+ if (h)
913
+ a.done = w >= f;
914
+ else {
915
+ let M = 0;
916
+ v < 1 && (M = w === 0 ? L(y) : Wn(V, w, S));
917
+ const T = Math.abs(M) <= s, D = Math.abs(o - S) <= i;
918
+ a.done = T && D;
919
+ }
920
+ return a.value = a.done ? o : S, a;
921
+ },
922
+ toString: () => {
923
+ const w = Math.min(Gn(A), Ye), S = $n((M) => A.next(w * M).value, w, 30);
924
+ return w + "ms " + S;
466
925
  }
467
- return a.value = a.done ? o : w, a;
468
- }, toString: () => {
469
- const y = Math.min(Xn(C), Ze), w = Kn((T) => C.next(y * T).value, y, 30);
470
- return y + "ms " + w;
471
- } };
472
- return C;
473
- }
474
- function qt({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: l, restDelta: c = 0.5, restSpeed: u }) {
475
- const h = t[0], d = { done: !1, value: h }, f = (T) => a === void 0 ? l : l === void 0 || Math.abs(a - T) < Math.abs(l - T) ? a : l;
926
+ };
927
+ return A;
928
+ }
929
+ function Gt({ keyframes: t, velocity: e = 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 }) {
930
+ const f = t[0], d = {
931
+ done: !1,
932
+ value: f
933
+ }, h = (T) => a !== void 0 && T < a || l !== void 0 && T > l, y = (T) => a === void 0 ? l : l === void 0 || Math.abs(a - T) < Math.abs(l - T) ? a : l;
476
934
  let v = n * e;
477
- const p = h + v, g = o === void 0 ? p : o(p);
478
- g !== p && (v = g - h);
479
- const m = (T) => -v * Math.exp(-T / s), S = (T) => g + m(T), x = (T) => {
480
- const A = m(T), V = S(T);
481
- d.done = Math.abs(A) <= c, d.value = d.done ? g : V;
935
+ const b = f + v, p = o === void 0 ? b : o(b);
936
+ p !== b && (v = p - f);
937
+ const g = (T) => -v * Math.exp(-T / s), V = (T) => p + g(T), A = (T) => {
938
+ const D = g(T), I = V(T);
939
+ d.done = Math.abs(D) <= u, d.value = d.done ? p : I;
482
940
  };
483
- let C, y;
484
- const w = (T) => {
485
- var A;
486
- A = d.value, (a !== void 0 && A < a || l !== void 0 && A > l) && (C = T, y = _n({ keyframes: [d.value, f(d.value)], velocity: Un(S, T, d.value), damping: i, stiffness: r, restDelta: c, restSpeed: u }));
941
+ let w, S;
942
+ const M = (T) => {
943
+ h(d.value) && (w = T, S = Un({
944
+ keyframes: [d.value, y(d.value)],
945
+ velocity: Wn(V, T, d.value),
946
+ // TODO: This should be passing * 1000
947
+ damping: i,
948
+ stiffness: r,
949
+ restDelta: u,
950
+ restSpeed: c
951
+ }));
952
+ };
953
+ return M(0), {
954
+ calculatedDuration: null,
955
+ next: (T) => {
956
+ let D = !1;
957
+ return !S && w === void 0 && (D = !0, A(T), M(T)), w !== void 0 && T >= w ? S.next(T - w) : (!D && A(T), d);
958
+ }
487
959
  };
488
- return w(0), { calculatedDuration: null, next: (T) => {
489
- let A = !1;
490
- return y || C !== void 0 || (A = !0, x(T), w(T)), C !== void 0 && T >= C ? y.next(T - C) : (!A && x(T), d);
491
- } };
492
- }
493
- const gi = de(0.42, 0, 1, 1), yi = de(0, 0, 0.58, 1), Gn = de(0.42, 0, 0.58, 1), vt = (t) => Array.isArray(t) && typeof t[0] == "number", zt = { linear: $, easeIn: gi, easeInOut: Gn, easeOut: yi, circIn: lt, circInOut: Vn, circOut: js, backIn: at, backInOut: xn, backOut: Tn, anticipate: An }, Ht = (t) => {
494
- if (vt(t)) {
495
- U(t.length === 4, "Cubic bezier arrays must contain four numerical values.");
960
+ }
961
+ const Ki = /* @__PURE__ */ he(0.42, 0, 1, 1), _i = /* @__PURE__ */ he(0, 0, 0.58, 1), zn = /* @__PURE__ */ he(0.42, 0, 0.58, 1), $i = (t) => Array.isArray(t) && typeof t[0] != "number", gt = (t) => Array.isArray(t) && typeof t[0] == "number", Ut = {
962
+ linear: _,
963
+ easeIn: Ki,
964
+ easeInOut: zn,
965
+ easeOut: _i,
966
+ circIn: at,
967
+ circInOut: Sn,
968
+ circOut: qs,
969
+ backIn: ot,
970
+ backInOut: Tn,
971
+ backOut: wn,
972
+ anticipate: Vn
973
+ }, zt = (t) => {
974
+ if (gt(t)) {
975
+ G(t.length === 4, "Cubic bezier arrays must contain four numerical values.");
496
976
  const [e, n, s, i] = t;
497
- return de(e, n, s, i);
498
- }
499
- return typeof t == "string" ? (U(zt[t] !== void 0, `Invalid easing type '${t}'`), zt[t]) : t;
500
- }, wi = (t, e) => (n) => e(t(n)), ke = (...t) => t.reduce(wi), Ee = (t, e, n) => t + (e - t) * n;
501
- function Be(t, e, n) {
502
- return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + 6 * (e - t) * n : n < 0.5 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
977
+ return he(e, n, s, i);
978
+ } else if (typeof t == "string")
979
+ return G(Ut[t] !== void 0, `Invalid easing type '${t}'`), Ut[t];
980
+ return t;
981
+ }, ji = (t, e) => (n) => e(t(n)), De = (...t) => t.reduce(ji), Re = (t, e, n) => t + (e - t) * n;
982
+ function Ne(t, e, n) {
983
+ return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
984
+ }
985
+ function Wi({ hue: t, saturation: e, lightness: n, alpha: s }) {
986
+ t /= 360, e /= 100, n /= 100;
987
+ let i = 0, r = 0, o = 0;
988
+ if (!e)
989
+ i = r = o = n;
990
+ else {
991
+ const a = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - a;
992
+ i = Ne(l, a, t + 1 / 3), r = Ne(l, a, t), o = Ne(l, a, t - 1 / 3);
993
+ }
994
+ return {
995
+ red: Math.round(i * 255),
996
+ green: Math.round(r * 255),
997
+ blue: Math.round(o * 255),
998
+ alpha: s
999
+ };
503
1000
  }
504
- function Se(t, e) {
1001
+ function be(t, e) {
505
1002
  return (n) => n > 0 ? e : t;
506
1003
  }
507
- const Ne = (t, e, n) => {
1004
+ const Be = (t, e, n) => {
508
1005
  const s = t * t, i = n * (e * e - s) + s;
509
1006
  return i < 0 ? 0 : Math.sqrt(i);
510
- }, bi = [He, K, _];
511
- function Xt(t) {
512
- const e = (n = t, bi.find((i) => i.test(n)));
513
- var n;
514
- if (te(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1;
515
- let s = e.parse(t);
516
- return e === _ && (s = function({ hue: i, saturation: r, lightness: o, alpha: a }) {
517
- i /= 360, o /= 100;
518
- let l = 0, c = 0, u = 0;
519
- if (r /= 100) {
520
- const h = o < 0.5 ? o * (1 + r) : o + r - o * r, d = 2 * o - h;
521
- l = Be(d, h, i + 1 / 3), c = Be(d, h, i), u = Be(d, h, i - 1 / 3);
522
- } else l = c = u = o;
523
- return { red: Math.round(255 * l), green: Math.round(255 * c), blue: Math.round(255 * u), alpha: a };
524
- }(s)), s;
525
- }
526
- const _t = (t, e) => {
527
- const n = Xt(t), s = Xt(e);
528
- if (!n || !s) return Se(t, e);
1007
+ }, Gi = [ze, j, X], Ui = (t) => Gi.find((e) => e.test(t));
1008
+ function Ht(t) {
1009
+ const e = Ui(t);
1010
+ if (ne(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e)
1011
+ return !1;
1012
+ let n = e.parse(t);
1013
+ return e === X && (n = Wi(n)), n;
1014
+ }
1015
+ const qt = (t, e) => {
1016
+ const n = Ht(t), s = Ht(e);
1017
+ if (!n || !s)
1018
+ return be(t, e);
529
1019
  const i = { ...n };
530
- return (r) => (i.red = Ne(n.red, s.red, r), i.green = Ne(n.green, s.green, r), i.blue = Ne(n.blue, s.blue, r), i.alpha = Ee(n.alpha, s.alpha, r), K.transform(i));
531
- }, Le = /* @__PURE__ */ new Set(["none", "hidden"]);
532
- function Si(t, e) {
533
- return (n) => Ee(t, e, n);
1020
+ return (r) => (i.red = Be(n.red, s.red, r), i.green = Be(n.green, s.green, r), i.blue = Be(n.blue, s.blue, r), i.alpha = Re(n.alpha, s.alpha, r), j.transform(i));
1021
+ }, Xe = /* @__PURE__ */ new Set(["none", "hidden"]);
1022
+ function zi(t, e) {
1023
+ return Xe.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
534
1024
  }
535
- function gt(t) {
536
- return typeof t == "number" ? Si : typeof t == "string" ? ut(t) ? Se : P.test(t) ? _t : xi : Array.isArray(t) ? Zn : typeof t == "object" ? P.test(t) ? _t : Ti : Se;
1025
+ function Hi(t, e) {
1026
+ return (n) => Re(t, e, n);
537
1027
  }
538
- function Zn(t, e) {
539
- const n = [...t], s = n.length, i = t.map((r, o) => gt(r)(r, e[o]));
1028
+ function yt(t) {
1029
+ return typeof t == "number" ? Hi : typeof t == "string" ? lt(t) ? be : C.test(t) ? qt : Xi : Array.isArray(t) ? Hn : typeof t == "object" ? C.test(t) ? qt : qi : be;
1030
+ }
1031
+ function Hn(t, e) {
1032
+ const n = [...t], s = n.length, i = t.map((r, o) => yt(r)(r, e[o]));
540
1033
  return (r) => {
541
- for (let o = 0; o < s; o++) n[o] = i[o](r);
1034
+ for (let o = 0; o < s; o++)
1035
+ n[o] = i[o](r);
542
1036
  return n;
543
1037
  };
544
1038
  }
545
- function Ti(t, e) {
1039
+ function qi(t, e) {
546
1040
  const n = { ...t, ...e }, s = {};
547
- for (const i in n) t[i] !== void 0 && e[i] !== void 0 && (s[i] = gt(t[i])(t[i], e[i]));
1041
+ for (const i in n)
1042
+ t[i] !== void 0 && e[i] !== void 0 && (s[i] = yt(t[i])(t[i], e[i]));
548
1043
  return (i) => {
549
- for (const r in s) n[r] = s[r](i);
1044
+ for (const r in s)
1045
+ n[r] = s[r](i);
550
1046
  return n;
551
1047
  };
552
1048
  }
553
- const xi = (t, e) => {
554
- const n = se.createTransformer(e), s = ce(t), i = ce(e);
555
- 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 ? Le.has(t) && !i.values.length || Le.has(e) && !s.values.length ? function(r, o) {
556
- return Le.has(r) ? (a) => a <= 0 ? r : o : (a) => a >= 1 ? o : r;
557
- }(t, e) : ke(Zn(function(r, o) {
558
- var a;
559
- const l = [], c = { color: 0, var: 0, number: 0 };
560
- for (let u = 0; u < o.values.length; u++) {
561
- const h = o.types[u], d = r.indexes[h][c[h]], f = (a = r.values[d]) !== null && a !== void 0 ? a : 0;
562
- l[u] = f, c[h]++;
563
- }
564
- return l;
565
- }(s, i), i.values), n) : (te(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), Se(t, e));
1049
+ function Yi(t, e) {
1050
+ var n;
1051
+ const s = [], i = { color: 0, var: 0, number: 0 };
1052
+ for (let r = 0; r < e.values.length; r++) {
1053
+ const o = e.types[r], a = t.indexes[o][i[o]], l = (n = t.values[a]) !== null && n !== void 0 ? n : 0;
1054
+ s[r] = l, i[o]++;
1055
+ }
1056
+ return s;
1057
+ }
1058
+ const Xi = (t, e) => {
1059
+ const n = ie.createTransformer(e), s = de(t), i = de(e);
1060
+ 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 ? Xe.has(t) && !i.values.length || Xe.has(e) && !s.values.length ? zi(t, e) : De(Hn(Yi(s, i), i.values), n) : (ne(!0, `Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), be(t, e));
566
1061
  };
567
- function Jn(t, e, n) {
568
- return typeof t == "number" && typeof e == "number" && typeof n == "number" ? Ee(t, e, n) : gt(t)(t, e);
1062
+ function qn(t, e, n) {
1063
+ return typeof t == "number" && typeof e == "number" && typeof n == "number" ? Re(t, e, n) : yt(t)(t, e);
1064
+ }
1065
+ function Zi(t, e, n) {
1066
+ const s = [], i = n || qn, r = t.length - 1;
1067
+ for (let o = 0; o < r; o++) {
1068
+ let a = i(t[o], t[o + 1]);
1069
+ if (e) {
1070
+ const l = Array.isArray(e) ? e[o] || _ : e;
1071
+ a = De(l, a);
1072
+ }
1073
+ s.push(a);
1074
+ }
1075
+ return s;
569
1076
  }
570
- function Ai(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
1077
+ function Ji(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
571
1078
  const r = t.length;
572
- if (U(r === e.length, "Both input and output ranges must be the same length"), r === 1) return () => e[0];
573
- if (r === 2 && t[0] === t[1]) return () => e[1];
1079
+ if (G(r === e.length, "Both input and output ranges must be the same length"), r === 1)
1080
+ return () => e[0];
1081
+ if (r === 2 && t[0] === t[1])
1082
+ return () => e[1];
574
1083
  t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
575
- const o = function(c, u, h) {
576
- const d = [], f = h || Jn, v = c.length - 1;
577
- for (let p = 0; p < v; p++) {
578
- let g = f(c[p], c[p + 1]);
579
- if (u) {
580
- const m = Array.isArray(u) ? u[p] || $ : u;
581
- g = ke(m, g);
582
- }
583
- d.push(g);
584
- }
585
- return d;
586
- }(e, s, i), a = o.length, l = (c) => {
587
- let u = 0;
588
- if (a > 1) for (; u < t.length - 2 && !(c < t[u + 1]); u++) ;
589
- const h = ft(t[u], t[u + 1], c);
590
- return o[u](h);
1084
+ const o = Zi(e, s, i), a = o.length, l = (u) => {
1085
+ let c = 0;
1086
+ if (a > 1)
1087
+ for (; c < t.length - 2 && !(u < t[c + 1]); c++)
1088
+ ;
1089
+ const f = mt(t[c], t[c + 1], u);
1090
+ return o[c](f);
591
1091
  };
592
- return n ? (c) => l(Y(t[0], t[r - 1], c)) : l;
1092
+ return n ? (u) => l(U(t[0], t[r - 1], u)) : l;
593
1093
  }
594
- function Vi(t) {
595
- const e = [0];
596
- return function(n, s) {
597
- const i = n[n.length - 1];
598
- for (let r = 1; r <= s; r++) {
599
- const o = ft(0, s, r);
600
- n.push(Ee(i, 1, o));
601
- }
602
- }(e, t.length - 1), e;
1094
+ function Qi(t, e) {
1095
+ const n = t[t.length - 1];
1096
+ for (let s = 1; s <= e; s++) {
1097
+ const i = mt(0, e, s);
1098
+ t.push(Re(n, 1, i));
1099
+ }
603
1100
  }
604
- function Te({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
605
- const i = ((u) => Array.isArray(u) && typeof u[0] != "number")(s) ? s.map(Ht) : Ht(s), r = { done: !1, value: e[0] }, o = function(u, h) {
606
- return u.map((d) => d * h);
607
- }(n && n.length === e.length ? n : Vi(e), t), a = Ai(o, e, { ease: Array.isArray(i) ? i : (l = e, c = i, l.map(() => c || Gn).splice(0, l.length - 1)) });
608
- var l, c;
609
- return { calculatedDuration: t, next: (u) => (r.value = a(u), r.done = u >= t, r) };
1101
+ function er(t) {
1102
+ const e = [0];
1103
+ return Qi(e, t.length - 1), e;
1104
+ }
1105
+ function tr(t, e) {
1106
+ return t.map((n) => n * e);
1107
+ }
1108
+ function nr(t, e) {
1109
+ return t.map(() => e || zn).splice(0, t.length - 1);
1110
+ }
1111
+ function we({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
1112
+ const i = $i(s) ? s.map(zt) : zt(s), r = {
1113
+ done: !1,
1114
+ value: e[0]
1115
+ }, o = tr(
1116
+ // Only use the provided offsets if they're the correct length
1117
+ // TODO Maybe we should warn here if there's a length mismatch
1118
+ n && n.length === e.length ? n : er(e),
1119
+ t
1120
+ ), a = Ji(o, e, {
1121
+ ease: Array.isArray(i) ? i : nr(e, i)
1122
+ });
1123
+ return {
1124
+ calculatedDuration: t,
1125
+ next: (l) => (r.value = a(l), r.done = l >= t, r)
1126
+ };
610
1127
  }
611
- const Ci = (t) => {
1128
+ const sr = (t) => {
612
1129
  const e = ({ timestamp: n }) => t(n);
613
- return { start: () => F.update(e, !0), stop: () => Ye(e), now: () => be.isProcessing ? be.timestamp : L.now() };
614
- }, Mi = { decay: qt, inertia: qt, tween: Te, keyframes: Te, spring: _n }, Pi = (t) => t / 100;
615
- class Je extends jn {
1130
+ return {
1131
+ start: () => R.update(e, !0),
1132
+ stop: () => We(e),
1133
+ /**
1134
+ * If we're processing this frame we can use the
1135
+ * framelocked timestamp to keep things in sync.
1136
+ */
1137
+ now: () => ve.isProcessing ? ve.timestamp : K.now()
1138
+ };
1139
+ }, ir = {
1140
+ decay: Gt,
1141
+ inertia: Gt,
1142
+ tween: we,
1143
+ keyframes: we,
1144
+ spring: Un
1145
+ }, rr = (t) => t / 100;
1146
+ class vt extends _n {
616
1147
  constructor(e) {
617
1148
  super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => {
618
- if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") return;
1149
+ if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
1150
+ return;
619
1151
  this.teardown();
620
- const { onStop: a } = this.options;
621
- a && a();
1152
+ const { onStop: l } = this.options;
1153
+ l && l();
622
1154
  };
623
- const { name: n, motionValue: s, element: i, keyframes: r } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || ct;
624
- this.resolver = new o(r, (a, l) => this.onKeyframesResolved(a, l), n, s, i), this.resolver.scheduleResolve();
1155
+ const { name: n, motionValue: s, element: i, keyframes: r } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || ut, a = (l, u) => this.onKeyframesResolved(l, u);
1156
+ this.resolver = new o(r, a, n, s, i), this.resolver.scheduleResolve();
625
1157
  }
626
1158
  flatten() {
627
1159
  super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes));
628
1160
  }
629
1161
  initPlayback(e) {
630
- const { type: n = "keyframes", repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = this.options, a = mt(n) ? n : Mi[n] || Te;
631
- let l, c;
632
- a !== Te && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && U(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), l = ke(Pi, Jn(e[0], e[1])), e = [0, 100]);
633
- const u = a({ ...this.options, keyframes: e });
634
- r === "mirror" && (c = a({ ...this.options, keyframes: [...e].reverse(), velocity: -o })), u.calculatedDuration === null && (u.calculatedDuration = Xn(u));
635
- const { calculatedDuration: h } = u, d = h + i;
636
- return { generator: u, mirroredGenerator: c, mapPercentToKeyframes: l, calculatedDuration: h, resolvedDuration: d, totalDuration: d * (s + 1) - i };
1162
+ const { type: n = "keyframes", repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = this.options, a = pt(n) ? n : ir[n] || we;
1163
+ let l, u;
1164
+ a !== we && typeof e[0] != "number" && (process.env.NODE_ENV !== "production" && G(e.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`), l = De(rr, qn(e[0], e[1])), e = [0, 100]);
1165
+ const c = a({ ...this.options, keyframes: e });
1166
+ r === "mirror" && (u = a({
1167
+ ...this.options,
1168
+ keyframes: [...e].reverse(),
1169
+ velocity: -o
1170
+ })), c.calculatedDuration === null && (c.calculatedDuration = Gn(c));
1171
+ const { calculatedDuration: f } = c, d = f + i, h = d * (s + 1) - i;
1172
+ return {
1173
+ generator: c,
1174
+ mirroredGenerator: u,
1175
+ mapPercentToKeyframes: l,
1176
+ calculatedDuration: f,
1177
+ resolvedDuration: d,
1178
+ totalDuration: h
1179
+ };
637
1180
  }
638
1181
  onPostResolved() {
639
1182
  const { autoplay: e = !0 } = this.options;
640
- this.play(), this.pendingPlayState !== "paused" && e ? this.state = this.pendingPlayState : this.pause();
1183
+ this.play(), this.pendingPlayState === "paused" || !e ? this.pause() : this.state = this.pendingPlayState;
641
1184
  }
642
1185
  tick(e, n = !1) {
643
1186
  const { resolved: s } = this;
644
1187
  if (!s) {
645
- const { keyframes: A } = this.options;
646
- return { done: !0, value: A[A.length - 1] };
1188
+ const { keyframes: T } = this.options;
1189
+ return { done: !0, value: T[T.length - 1] };
647
1190
  }
648
- const { finalKeyframe: i, generator: r, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: l, calculatedDuration: c, totalDuration: u, resolvedDuration: h } = s;
649
- if (this.startTime === null) return r.next(0);
650
- const { delay: d, repeat: f, repeatType: v, repeatDelay: p, onUpdate: g } = this.options;
651
- this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - u / this.speed, this.startTime)), n ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed;
652
- const m = this.currentTime - d * (this.speed >= 0 ? 1 : -1), S = this.speed >= 0 ? m < 0 : m > u;
653
- this.currentTime = Math.max(m, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = u);
654
- let x = this.currentTime, C = r;
655
- if (f) {
656
- const A = Math.min(this.currentTime, u) / h;
657
- let V = Math.floor(A), M = A % 1;
658
- !M && A >= 1 && (M = 1), M === 1 && V--, V = Math.min(V, f + 1), V % 2 && (v === "reverse" ? (M = 1 - M, p && (M -= p / h)) : v === "mirror" && (C = o)), x = Y(0, 1, M) * h;
1191
+ const { finalKeyframe: i, generator: r, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: l, calculatedDuration: u, totalDuration: c, resolvedDuration: f } = s;
1192
+ if (this.startTime === null)
1193
+ return r.next(0);
1194
+ const { delay: d, repeat: h, repeatType: y, repeatDelay: v, onUpdate: b } = this.options;
1195
+ this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - c / this.speed, this.startTime)), n ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed;
1196
+ const p = this.currentTime - d * (this.speed >= 0 ? 1 : -1), g = this.speed >= 0 ? p < 0 : p > c;
1197
+ this.currentTime = Math.max(p, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = c);
1198
+ let V = this.currentTime, A = r;
1199
+ if (h) {
1200
+ const T = Math.min(this.currentTime, c) / f;
1201
+ let D = Math.floor(T), I = T % 1;
1202
+ !I && T >= 1 && (I = 1), I === 1 && D--, D = Math.min(D, h + 1), !!(D % 2) && (y === "reverse" ? (I = 1 - I, v && (I -= v / f)) : y === "mirror" && (A = o)), V = U(0, 1, I) * f;
659
1203
  }
660
- const y = S ? { done: !1, value: l[0] } : C.next(x);
661
- a && (y.value = a(y.value));
662
- let { done: w } = y;
663
- S || c === null || (w = this.speed >= 0 ? this.currentTime >= u : this.currentTime <= 0);
664
- const T = this.holdTime === null && (this.state === "finished" || this.state === "running" && w);
665
- return T && i !== void 0 && (y.value = Pe(l, this.options, i)), g && g(y.value), T && this.finish(), y;
1204
+ const w = g ? { done: !1, value: l[0] } : A.next(V);
1205
+ a && (w.value = a(w.value));
1206
+ let { done: S } = w;
1207
+ !g && u !== null && (S = this.speed >= 0 ? this.currentTime >= c : this.currentTime <= 0);
1208
+ const M = this.holdTime === null && (this.state === "finished" || this.state === "running" && S);
1209
+ return M && i !== void 0 && (w.value = Fe(l, this.options, i)), b && b(w.value), M && this.finish(), w;
666
1210
  }
667
1211
  get duration() {
668
1212
  const { resolved: e } = this;
669
- return e ? N(e.calculatedDuration) : 0;
1213
+ return e ? B(e.calculatedDuration) : 0;
670
1214
  }
671
1215
  get time() {
672
- return N(this.currentTime);
1216
+ return B(this.currentTime);
673
1217
  }
674
1218
  set time(e) {
675
- e = R(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed);
1219
+ e = L(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed);
676
1220
  }
677
1221
  get speed() {
678
1222
  return this.playbackSpeed;
679
1223
  }
680
1224
  set speed(e) {
681
1225
  const n = this.playbackSpeed !== e;
682
- this.playbackSpeed = e, n && (this.time = N(this.currentTime));
1226
+ this.playbackSpeed = e, n && (this.time = B(this.currentTime));
683
1227
  }
684
1228
  play() {
685
- if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) return void (this.pendingPlayState = "running");
686
- if (this.isStopped) return;
687
- const { driver: e = Ci, onPlay: n, startTime: s } = this.options;
1229
+ if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) {
1230
+ this.pendingPlayState = "running";
1231
+ return;
1232
+ }
1233
+ if (this.isStopped)
1234
+ return;
1235
+ const { driver: e = sr, onPlay: n, startTime: s } = this.options;
688
1236
  this.driver || (this.driver = e((r) => this.tick(r))), n && n();
689
1237
  const i = this.driver.now();
690
1238
  this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = s ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start();
691
1239
  }
692
1240
  pause() {
693
1241
  var e;
694
- this._resolved ? (this.state = "paused", this.holdTime = (e = this.currentTime) !== null && e !== void 0 ? e : 0) : this.pendingPlayState = "paused";
1242
+ if (!this._resolved) {
1243
+ this.pendingPlayState = "paused";
1244
+ return;
1245
+ }
1246
+ this.state = "paused", this.holdTime = (e = this.currentTime) !== null && e !== void 0 ? e : 0;
695
1247
  }
696
1248
  complete() {
697
1249
  this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null;
@@ -714,20 +1266,30 @@ class Je extends jn {
714
1266
  return this.startTime = 0, this.tick(e, !0);
715
1267
  }
716
1268
  }
717
- const ki = /* @__PURE__ */ new Set(["opacity", "clipPath", "filter", "transform"]);
718
- function yt(t) {
1269
+ const or = /* @__PURE__ */ new Set([
1270
+ "opacity",
1271
+ "clipPath",
1272
+ "filter",
1273
+ "transform"
1274
+ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
1275
+ // or until we implement support for linear() easing.
1276
+ // "background-color"
1277
+ ]);
1278
+ function bt(t) {
719
1279
  let e;
720
1280
  return () => (e === void 0 && (e = t()), e);
721
1281
  }
722
- const Ei = { linearEasing: void 0 };
723
- function Fi(t, e) {
724
- const n = yt(t);
1282
+ const ar = {
1283
+ linearEasing: void 0
1284
+ };
1285
+ function lr(t, e) {
1286
+ const n = bt(t);
725
1287
  return () => {
726
1288
  var s;
727
- return (s = Ei[e]) !== null && s !== void 0 ? s : n();
1289
+ return (s = ar[e]) !== null && s !== void 0 ? s : n();
728
1290
  };
729
1291
  }
730
- const xe = Fi(() => {
1292
+ const Te = /* @__PURE__ */ lr(() => {
731
1293
  try {
732
1294
  document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
733
1295
  } catch {
@@ -735,125 +1297,202 @@ const xe = Fi(() => {
735
1297
  }
736
1298
  return !0;
737
1299
  }, "linearEasing");
738
- function Qn(t) {
739
- return !!(typeof t == "function" && xe() || !t || typeof t == "string" && (t in Qe || xe()) || vt(t) || Array.isArray(t) && t.every(Qn));
1300
+ function Yn(t) {
1301
+ return !!(typeof t == "function" && Te() || !t || typeof t == "string" && (t in Ze || Te()) || gt(t) || Array.isArray(t) && t.every(Yn));
1302
+ }
1303
+ const oe = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, Ze = {
1304
+ linear: "linear",
1305
+ ease: "ease",
1306
+ easeIn: "ease-in",
1307
+ easeOut: "ease-out",
1308
+ easeInOut: "ease-in-out",
1309
+ circIn: /* @__PURE__ */ oe([0, 0.65, 0.55, 1]),
1310
+ circOut: /* @__PURE__ */ oe([0.55, 0, 1, 0.45]),
1311
+ backIn: /* @__PURE__ */ oe([0.31, 0.01, 0.66, -0.59]),
1312
+ backOut: /* @__PURE__ */ oe([0.33, 1.53, 0.69, 0.99])
1313
+ };
1314
+ function Xn(t, e) {
1315
+ if (t)
1316
+ return typeof t == "function" && Te() ? $n(t, e) : gt(t) ? oe(t) : Array.isArray(t) ? t.map((n) => Xn(n, e) || Ze.easeOut) : Ze[t];
1317
+ }
1318
+ function ur(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeInOut", times: l } = {}) {
1319
+ const u = { [e]: n };
1320
+ l && (u.offset = l);
1321
+ const c = Xn(a, i);
1322
+ return Array.isArray(c) && (u.easing = c), t.animate(u, {
1323
+ delay: s,
1324
+ duration: i,
1325
+ easing: Array.isArray(c) ? "linear" : c,
1326
+ fill: "both",
1327
+ iterations: r + 1,
1328
+ direction: o === "reverse" ? "alternate" : "normal"
1329
+ });
740
1330
  }
741
- const oe = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, Qe = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", circIn: oe([0, 0.65, 0.55, 1]), circOut: oe([0.55, 0, 1, 0.45]), backIn: oe([0.31, 0.01, 0.66, -0.59]), backOut: oe([0.33, 1.53, 0.69, 0.99]) };
742
- function es(t, e) {
743
- return t ? typeof t == "function" && xe() ? Kn(t, e) : vt(t) ? oe(t) : Array.isArray(t) ? t.map((n) => es(n, e) || Qe.easeOut) : Qe[t] : void 0;
1331
+ function Yt(t, e) {
1332
+ t.timeline = e, t.onfinish = null;
744
1333
  }
745
- function Oi(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeInOut", times: l } = {}) {
746
- const c = { [e]: n };
747
- l && (c.offset = l);
748
- const u = es(a, i);
749
- return Array.isArray(u) && (c.easing = u), t.animate(c, { delay: s, duration: i, easing: Array.isArray(u) ? "linear" : u, fill: "both", iterations: r + 1, direction: o === "reverse" ? "alternate" : "normal" });
1334
+ const cr = /* @__PURE__ */ bt(() => Object.hasOwnProperty.call(Element.prototype, "animate")), Ve = 10, dr = 2e4;
1335
+ function fr(t) {
1336
+ return pt(t.type) || t.type === "spring" || !Yn(t.ease);
1337
+ }
1338
+ function hr(t, e) {
1339
+ const n = new vt({
1340
+ ...e,
1341
+ keyframes: t,
1342
+ repeat: 0,
1343
+ delay: 0,
1344
+ isGenerator: !0
1345
+ });
1346
+ let s = { done: !1, value: t[0] };
1347
+ const i = [];
1348
+ let r = 0;
1349
+ for (; !s.done && r < dr; )
1350
+ s = n.sample(r), i.push(s.value), r += Ve;
1351
+ return {
1352
+ times: void 0,
1353
+ keyframes: i,
1354
+ duration: r - Ve,
1355
+ ease: "linear"
1356
+ };
750
1357
  }
751
- function Gt(t, e) {
752
- t.timeline = e, t.onfinish = null;
1358
+ const Zn = {
1359
+ anticipate: Vn,
1360
+ backInOut: Tn,
1361
+ circInOut: Sn
1362
+ };
1363
+ function pr(t) {
1364
+ return t in Zn;
753
1365
  }
754
- const Ii = yt(() => Object.hasOwnProperty.call(Element.prototype, "animate")), Zt = { anticipate: An, backInOut: xn, circInOut: Vn };
755
- class Jt extends jn {
1366
+ class Xt extends _n {
756
1367
  constructor(e) {
757
1368
  super(e);
758
1369
  const { name: n, motionValue: s, element: i, keyframes: r } = this.options;
759
- this.resolver = new $n(r, (o, a) => this.onKeyframesResolved(o, a), n, s, i), this.resolver.scheduleResolve();
1370
+ this.resolver = new Kn(r, (o, a) => this.onKeyframesResolved(o, a), n, s, i), this.resolver.scheduleResolve();
760
1371
  }
761
1372
  initPlayback(e, n) {
762
1373
  var s;
763
- let { duration: i = 300, times: r, ease: o, type: a, motionValue: l, name: c, startTime: u } = this.options;
764
- if (!(!((s = l.owner) === null || s === void 0) && s.current)) return !1;
765
- var h;
766
- if (typeof o == "string" && xe() && o in Zt && (o = Zt[o]), mt((h = this.options).type) || h.type === "spring" || !Qn(h.ease)) {
767
- const { onComplete: f, onUpdate: v, motionValue: p, element: g, ...m } = this.options, S = function(x, C) {
768
- const y = new Je({ ...C, keyframes: x, repeat: 0, delay: 0, isGenerator: !0 });
769
- let w = { done: !1, value: x[0] };
770
- const T = [];
771
- let A = 0;
772
- for (; !w.done && A < 2e4; ) w = y.sample(A), T.push(w.value), A += 10;
773
- return { times: void 0, keyframes: T, duration: A - 10, ease: "linear" };
774
- }(e, m);
775
- (e = S.keyframes).length === 1 && (e[1] = e[0]), i = S.duration, r = S.times, o = S.ease, a = "keyframes";
1374
+ let { duration: i = 300, times: r, ease: o, type: a, motionValue: l, name: u, startTime: c } = this.options;
1375
+ if (!(!((s = l.owner) === null || s === void 0) && s.current))
1376
+ return !1;
1377
+ if (typeof o == "string" && Te() && pr(o) && (o = Zn[o]), fr(this.options)) {
1378
+ const { onComplete: d, onUpdate: h, motionValue: y, element: v, ...b } = this.options, p = hr(e, b);
1379
+ e = p.keyframes, e.length === 1 && (e[1] = e[0]), i = p.duration, r = p.times, o = p.ease, a = "keyframes";
776
1380
  }
777
- const d = Oi(l.owner.current, c, e, { ...this.options, duration: i, times: r, ease: o });
778
- return d.startTime = u ?? this.calcStartTime(), this.pendingTimeline ? (Gt(d, this.pendingTimeline), this.pendingTimeline = void 0) : d.onfinish = () => {
779
- const { onComplete: f } = this.options;
780
- l.set(Pe(e, this.options, n)), f && f(), this.cancel(), this.resolveFinishedPromise();
781
- }, { animation: d, duration: i, times: r, type: a, ease: o, keyframes: e };
1381
+ const f = ur(l.owner.current, u, e, { ...this.options, duration: i, times: r, ease: o });
1382
+ return f.startTime = c ?? this.calcStartTime(), this.pendingTimeline ? (Yt(f, this.pendingTimeline), this.pendingTimeline = void 0) : f.onfinish = () => {
1383
+ const { onComplete: d } = this.options;
1384
+ l.set(Fe(e, this.options, n)), d && d(), this.cancel(), this.resolveFinishedPromise();
1385
+ }, {
1386
+ animation: f,
1387
+ duration: i,
1388
+ times: r,
1389
+ type: a,
1390
+ ease: o,
1391
+ keyframes: e
1392
+ };
782
1393
  }
783
1394
  get duration() {
784
1395
  const { resolved: e } = this;
785
- if (!e) return 0;
1396
+ if (!e)
1397
+ return 0;
786
1398
  const { duration: n } = e;
787
- return N(n);
1399
+ return B(n);
788
1400
  }
789
1401
  get time() {
790
1402
  const { resolved: e } = this;
791
- if (!e) return 0;
1403
+ if (!e)
1404
+ return 0;
792
1405
  const { animation: n } = e;
793
- return N(n.currentTime || 0);
1406
+ return B(n.currentTime || 0);
794
1407
  }
795
1408
  set time(e) {
796
1409
  const { resolved: n } = this;
797
- if (!n) return;
1410
+ if (!n)
1411
+ return;
798
1412
  const { animation: s } = n;
799
- s.currentTime = R(e);
1413
+ s.currentTime = L(e);
800
1414
  }
801
1415
  get speed() {
802
1416
  const { resolved: e } = this;
803
- if (!e) return 1;
1417
+ if (!e)
1418
+ return 1;
804
1419
  const { animation: n } = e;
805
1420
  return n.playbackRate;
806
1421
  }
807
1422
  set speed(e) {
808
1423
  const { resolved: n } = this;
809
- if (!n) return;
1424
+ if (!n)
1425
+ return;
810
1426
  const { animation: s } = n;
811
1427
  s.playbackRate = e;
812
1428
  }
813
1429
  get state() {
814
1430
  const { resolved: e } = this;
815
- if (!e) return "idle";
1431
+ if (!e)
1432
+ return "idle";
816
1433
  const { animation: n } = e;
817
1434
  return n.playState;
818
1435
  }
819
1436
  get startTime() {
820
1437
  const { resolved: e } = this;
821
- if (!e) return null;
1438
+ if (!e)
1439
+ return null;
822
1440
  const { animation: n } = e;
823
1441
  return n.startTime;
824
1442
  }
1443
+ /**
1444
+ * Replace the default DocumentTimeline with another AnimationTimeline.
1445
+ * Currently used for scroll animations.
1446
+ */
825
1447
  attachTimeline(e) {
826
- if (this._resolved) {
1448
+ if (!this._resolved)
1449
+ this.pendingTimeline = e;
1450
+ else {
827
1451
  const { resolved: n } = this;
828
- if (!n) return $;
1452
+ if (!n)
1453
+ return _;
829
1454
  const { animation: s } = n;
830
- Gt(s, e);
831
- } else this.pendingTimeline = e;
832
- return $;
1455
+ Yt(s, e);
1456
+ }
1457
+ return _;
833
1458
  }
834
1459
  play() {
835
- if (this.isStopped) return;
1460
+ if (this.isStopped)
1461
+ return;
836
1462
  const { resolved: e } = this;
837
- if (!e) return;
1463
+ if (!e)
1464
+ return;
838
1465
  const { animation: n } = e;
839
1466
  n.playState === "finished" && this.updateFinishedPromise(), n.play();
840
1467
  }
841
1468
  pause() {
842
1469
  const { resolved: e } = this;
843
- if (!e) return;
1470
+ if (!e)
1471
+ return;
844
1472
  const { animation: n } = e;
845
1473
  n.pause();
846
1474
  }
847
1475
  stop() {
848
- if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle") return;
1476
+ if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
1477
+ return;
849
1478
  this.resolveFinishedPromise(), this.updateFinishedPromise();
850
1479
  const { resolved: e } = this;
851
- if (!e) return;
1480
+ if (!e)
1481
+ return;
852
1482
  const { animation: n, keyframes: s, duration: i, type: r, ease: o, times: a } = e;
853
- if (n.playState === "idle" || n.playState === "finished") return;
1483
+ if (n.playState === "idle" || n.playState === "finished")
1484
+ return;
854
1485
  if (this.time) {
855
- const { motionValue: c, onUpdate: u, onComplete: h, element: d, ...f } = this.options, v = new Je({ ...f, keyframes: s, duration: i, type: r, ease: o, times: a, isGenerator: !0 }), p = R(this.time);
856
- c.setWithVelocity(v.sample(p - 10).value, v.sample(p).value, 10);
1486
+ const { motionValue: u, onUpdate: c, onComplete: f, element: d, ...h } = this.options, y = new vt({
1487
+ ...h,
1488
+ keyframes: s,
1489
+ duration: i,
1490
+ type: r,
1491
+ ease: o,
1492
+ times: a,
1493
+ isGenerator: !0
1494
+ }), v = L(this.time);
1495
+ u.setWithVelocity(y.sample(v - Ve).value, y.sample(v).value, Ve);
857
1496
  }
858
1497
  const { onStop: l } = this.options;
859
1498
  l && l(), this.cancel();
@@ -868,25 +1507,33 @@ class Jt extends jn {
868
1507
  }
869
1508
  static supports(e) {
870
1509
  const { motionValue: n, name: s, repeatDelay: i, repeatType: r, damping: o, type: a } = e;
871
- return Ii() && s && ki.has(s) && n && n.owner && n.owner.current instanceof HTMLElement && !n.owner.getProps().onUpdate && !i && r !== "mirror" && o !== 0 && a !== "inertia";
1510
+ return cr() && s && or.has(s) && n && n.owner && n.owner.current instanceof HTMLElement && /**
1511
+ * If we're outputting values to onUpdate then we can't use WAAPI as there's
1512
+ * no way to read the value from WAAPI every frame.
1513
+ */
1514
+ !n.owner.getProps().onUpdate && !i && r !== "mirror" && o !== 0 && a !== "inertia";
872
1515
  }
873
1516
  }
874
- const Ri = yt(() => window.ScrollTimeline !== void 0);
875
- class Di {
1517
+ const mr = bt(() => window.ScrollTimeline !== void 0);
1518
+ class gr {
876
1519
  constructor(e) {
877
1520
  this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
878
1521
  }
879
1522
  then(e, n) {
880
1523
  return Promise.all(this.animations).then(e).catch(n);
881
1524
  }
1525
+ /**
1526
+ * TODO: Filter out cancelled or stopped animations before returning
1527
+ */
882
1528
  getAll(e) {
883
1529
  return this.animations[0][e];
884
1530
  }
885
1531
  setAll(e, n) {
886
- for (let s = 0; s < this.animations.length; s++) this.animations[s][e] = n;
1532
+ for (let s = 0; s < this.animations.length; s++)
1533
+ this.animations[s][e] = n;
887
1534
  }
888
1535
  attachTimeline(e, n) {
889
- const s = this.animations.map((i) => Ri() && i.attachTimeline ? i.attachTimeline(e) : n(i));
1536
+ const s = this.animations.map((i) => mr() && i.attachTimeline ? i.attachTimeline(e) : n(i));
890
1537
  return () => {
891
1538
  s.forEach((i, r) => {
892
1539
  i && i(), this.animations[r].stop();
@@ -910,7 +1557,8 @@ class Di {
910
1557
  }
911
1558
  get duration() {
912
1559
  let e = 0;
913
- for (let n = 0; n < this.animations.length; n++) e = Math.max(e, this.animations[n].duration);
1560
+ for (let n = 0; n < this.animations.length; n++)
1561
+ e = Math.max(e, this.animations[n].duration);
914
1562
  return e;
915
1563
  }
916
1564
  runAll(e) {
@@ -932,45 +1580,67 @@ class Di {
932
1580
  this.runAll("complete");
933
1581
  }
934
1582
  }
935
- const Bi = (t, e, n, s = {}, i, r) => (o) => {
936
- const a = yn(s, t) || {}, l = a.delay || s.delay || 0;
937
- let { elapsed: c = 0 } = s;
938
- c -= R(l);
939
- let u = { keyframes: Array.isArray(n) ? n : [null, n], ease: "easeOut", velocity: e.getVelocity(), ...a, delay: -c, onUpdate: (d) => {
940
- e.set(d), a.onUpdate && a.onUpdate(d);
941
- }, onComplete: () => {
942
- o(), a.onComplete && a.onComplete();
943
- }, name: t, motionValue: e, element: r ? void 0 : i };
944
- (function({ when: d, delay: f, delayChildren: v, staggerChildren: p, staggerDirection: g, repeat: m, repeatType: S, repeatDelay: x, from: C, elapsed: y, ...w }) {
945
- return !!Object.keys(w).length;
946
- })(a) || (u = { ...u, ...Ns(t, u) }), u.duration && (u.duration = R(u.duration)), u.repeatDelay && (u.repeatDelay = R(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
947
- let h = !1;
948
- if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (u.duration = 0, u.delay === 0 && (h = !0)), h && !r && e.get() !== void 0) {
949
- const d = Pe(u.keyframes, a);
950
- if (d !== void 0) return F.update(() => {
951
- u.onUpdate(d), u.onComplete();
952
- }), new Di([]);
953
- }
954
- return !r && Jt.supports(u) ? new Jt(u) : new Je(u);
955
- };
956
- class ts {
1583
+ function yr({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: l, elapsed: u, ...c }) {
1584
+ return !!Object.keys(c).length;
1585
+ }
1586
+ const vr = (t, e, n, s = {}, i, r) => (o) => {
1587
+ const a = mn(s, t) || {}, l = a.delay || s.delay || 0;
1588
+ let { elapsed: u = 0 } = s;
1589
+ u = u - L(l);
1590
+ let c = {
1591
+ keyframes: Array.isArray(n) ? n : [null, n],
1592
+ ease: "easeOut",
1593
+ velocity: e.getVelocity(),
1594
+ ...a,
1595
+ delay: -u,
1596
+ onUpdate: (d) => {
1597
+ e.set(d), a.onUpdate && a.onUpdate(d);
1598
+ },
1599
+ onComplete: () => {
1600
+ o(), a.onComplete && a.onComplete();
1601
+ },
1602
+ name: t,
1603
+ motionValue: e,
1604
+ element: r ? void 0 : i
1605
+ };
1606
+ yr(a) || (c = {
1607
+ ...c,
1608
+ ..._s(t, c)
1609
+ }), c.duration && (c.duration = L(c.duration)), c.repeatDelay && (c.repeatDelay = L(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
1610
+ let f = !1;
1611
+ if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (c.duration = 0, c.delay === 0 && (f = !0)), f && !r && e.get() !== void 0) {
1612
+ const d = Fe(c.keyframes, a);
1613
+ if (d !== void 0)
1614
+ return R.update(() => {
1615
+ c.onUpdate(d), c.onComplete();
1616
+ }), new gr([]);
1617
+ }
1618
+ return !r && Xt.supports(c) ? new Xt(c) : new vt(c);
1619
+ }, br = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), wr = (t) => je(t) ? t[t.length - 1] || 0 : t;
1620
+ function Tr(t, e) {
1621
+ t.indexOf(e) === -1 && t.push(e);
1622
+ }
1623
+ function Vr(t, e) {
1624
+ const n = t.indexOf(e);
1625
+ n > -1 && t.splice(n, 1);
1626
+ }
1627
+ class Jn {
957
1628
  constructor() {
958
1629
  this.subscriptions = [];
959
1630
  }
960
1631
  add(e) {
961
- var n, s;
962
- return n = this.subscriptions, s = e, n.indexOf(s) === -1 && n.push(s), () => function(i, r) {
963
- const o = i.indexOf(r);
964
- o > -1 && i.splice(o, 1);
965
- }(this.subscriptions, e);
1632
+ return Tr(this.subscriptions, e), () => Vr(this.subscriptions, e);
966
1633
  }
967
1634
  notify(e, n, s) {
968
1635
  const i = this.subscriptions.length;
969
- if (i) if (i === 1) this.subscriptions[0](e, n, s);
970
- else for (let r = 0; r < i; r++) {
971
- const o = this.subscriptions[r];
972
- o && o(e, n, s);
973
- }
1636
+ if (i)
1637
+ if (i === 1)
1638
+ this.subscriptions[0](e, n, s);
1639
+ else
1640
+ for (let r = 0; r < i; r++) {
1641
+ const o = this.subscriptions[r];
1642
+ o && o(e, n, s);
1643
+ }
974
1644
  }
975
1645
  getSize() {
976
1646
  return this.subscriptions.length;
@@ -979,59 +1649,162 @@ class ts {
979
1649
  this.subscriptions.length = 0;
980
1650
  }
981
1651
  }
982
- class Ni {
1652
+ const Zt = 30, Sr = (t) => !isNaN(parseFloat(t));
1653
+ class xr {
1654
+ /**
1655
+ * @param init - The initiating value
1656
+ * @param config - Optional configuration options
1657
+ *
1658
+ * - `transformer`: A function to transform incoming values with.
1659
+ *
1660
+ * @internal
1661
+ */
983
1662
  constructor(e, n = {}) {
984
1663
  this.version = "11.15.0", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
985
- const r = L.now();
1664
+ const r = K.now();
986
1665
  this.updatedAt !== r && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current);
987
1666
  }, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
988
1667
  }
989
1668
  setCurrent(e) {
990
- var n;
991
- this.current = e, this.updatedAt = L.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = (n = this.current, !isNaN(parseFloat(n))));
1669
+ this.current = e, this.updatedAt = K.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = Sr(this.current));
992
1670
  }
993
1671
  setPrevFrameValue(e = this.current) {
994
1672
  this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
995
1673
  }
1674
+ /**
1675
+ * Adds a function that will be notified when the `MotionValue` is updated.
1676
+ *
1677
+ * It returns a function that, when called, will cancel the subscription.
1678
+ *
1679
+ * When calling `onChange` inside a React component, it should be wrapped with the
1680
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
1681
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
1682
+ *
1683
+ * ```jsx
1684
+ * export const MyComponent = () => {
1685
+ * const x = useMotionValue(0)
1686
+ * const y = useMotionValue(0)
1687
+ * const opacity = useMotionValue(1)
1688
+ *
1689
+ * useEffect(() => {
1690
+ * function updateOpacity() {
1691
+ * const maxXY = Math.max(x.get(), y.get())
1692
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
1693
+ * opacity.set(newOpacity)
1694
+ * }
1695
+ *
1696
+ * const unsubscribeX = x.on("change", updateOpacity)
1697
+ * const unsubscribeY = y.on("change", updateOpacity)
1698
+ *
1699
+ * return () => {
1700
+ * unsubscribeX()
1701
+ * unsubscribeY()
1702
+ * }
1703
+ * }, [])
1704
+ *
1705
+ * return <motion.div style={{ x }} />
1706
+ * }
1707
+ * ```
1708
+ *
1709
+ * @param subscriber - A function that receives the latest value.
1710
+ * @returns A function that, when called, will cancel this subscription.
1711
+ *
1712
+ * @deprecated
1713
+ */
996
1714
  onChange(e) {
997
- return process.env.NODE_ENV !== "production" && we(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
1715
+ return process.env.NODE_ENV !== "production" && Me(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
998
1716
  }
999
1717
  on(e, n) {
1000
- this.events[e] || (this.events[e] = new ts());
1718
+ this.events[e] || (this.events[e] = new Jn());
1001
1719
  const s = this.events[e].add(n);
1002
1720
  return e === "change" ? () => {
1003
- s(), F.read(() => {
1721
+ s(), R.read(() => {
1004
1722
  this.events.change.getSize() || this.stop();
1005
1723
  });
1006
1724
  } : s;
1007
1725
  }
1008
1726
  clearListeners() {
1009
- for (const e in this.events) this.events[e].clear();
1010
- }
1727
+ for (const e in this.events)
1728
+ this.events[e].clear();
1729
+ }
1730
+ /**
1731
+ * Attaches a passive effect to the `MotionValue`.
1732
+ *
1733
+ * @internal
1734
+ */
1011
1735
  attach(e, n) {
1012
1736
  this.passiveEffect = e, this.stopPassiveEffect = n;
1013
1737
  }
1738
+ /**
1739
+ * Sets the state of the `MotionValue`.
1740
+ *
1741
+ * @remarks
1742
+ *
1743
+ * ```jsx
1744
+ * const x = useMotionValue(0)
1745
+ * x.set(10)
1746
+ * ```
1747
+ *
1748
+ * @param latest - Latest value to set.
1749
+ * @param render - Whether to notify render subscribers. Defaults to `true`
1750
+ *
1751
+ * @public
1752
+ */
1014
1753
  set(e, n = !0) {
1015
- n && this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e, n);
1754
+ !n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify);
1016
1755
  }
1017
1756
  setWithVelocity(e, n, s) {
1018
1757
  this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
1019
1758
  }
1759
+ /**
1760
+ * Set the state of the `MotionValue`, stopping any active animations,
1761
+ * effects, and resets velocity to `0`.
1762
+ */
1020
1763
  jump(e, n = !0) {
1021
1764
  this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1022
1765
  }
1766
+ /**
1767
+ * Returns the latest state of `MotionValue`
1768
+ *
1769
+ * @returns - The latest state of `MotionValue`
1770
+ *
1771
+ * @public
1772
+ */
1023
1773
  get() {
1024
1774
  return this.current;
1025
1775
  }
1776
+ /**
1777
+ * @public
1778
+ */
1026
1779
  getPrevious() {
1027
1780
  return this.prev;
1028
1781
  }
1782
+ /**
1783
+ * Returns the latest velocity of `MotionValue`
1784
+ *
1785
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
1786
+ *
1787
+ * @public
1788
+ */
1029
1789
  getVelocity() {
1030
- const e = L.now();
1031
- if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > 30) return 0;
1032
- const n = Math.min(this.updatedAt - this.prevUpdatedAt, 30);
1033
- return Wn(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1034
- }
1790
+ const e = K.now();
1791
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > Zt)
1792
+ return 0;
1793
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, Zt);
1794
+ return jn(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1795
+ }
1796
+ /**
1797
+ * Registers a new animation to control this `MotionValue`. Only one
1798
+ * animation can drive a `MotionValue` at one time.
1799
+ *
1800
+ * ```jsx
1801
+ * value.start()
1802
+ * ```
1803
+ *
1804
+ * @param animation - A function that starts the provided animation
1805
+ *
1806
+ * @internal
1807
+ */
1035
1808
  start(e) {
1036
1809
  return this.stop(), new Promise((n) => {
1037
1810
  this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
@@ -1039,712 +1812,1206 @@ class Ni {
1039
1812
  this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1040
1813
  });
1041
1814
  }
1815
+ /**
1816
+ * Stop the currently active animation.
1817
+ *
1818
+ * @public
1819
+ */
1042
1820
  stop() {
1043
1821
  this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1044
1822
  }
1823
+ /**
1824
+ * Returns `true` if this value is currently animating.
1825
+ *
1826
+ * @public
1827
+ */
1045
1828
  isAnimating() {
1046
1829
  return !!this.animation;
1047
1830
  }
1048
1831
  clearAnimation() {
1049
1832
  delete this.animation;
1050
1833
  }
1834
+ /**
1835
+ * Destroy and clean up subscribers to this `MotionValue`.
1836
+ *
1837
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
1838
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
1839
+ * created a `MotionValue` via the `motionValue` function.
1840
+ *
1841
+ * @public
1842
+ */
1051
1843
  destroy() {
1052
1844
  this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1053
1845
  }
1054
1846
  }
1055
- function ye(t, e) {
1056
- return new Ni(t, e);
1847
+ function Se(t, e) {
1848
+ return new xr(t, e);
1849
+ }
1850
+ function Ar(t, e, n) {
1851
+ t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, Se(n));
1852
+ }
1853
+ function Mr(t, e) {
1854
+ const n = Pe(t, e);
1855
+ let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
1856
+ r = { ...r, ...s };
1857
+ for (const o in r) {
1858
+ const a = wr(r[o]);
1859
+ Ar(t, o, a);
1860
+ }
1057
1861
  }
1058
- function Li(t, e, n) {
1059
- t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, ye(n));
1862
+ const wt = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Cr = "framerAppearId", Qn = "data-" + wt(Cr);
1863
+ function Pr(t) {
1864
+ return t.props[Qn];
1060
1865
  }
1061
- const wt = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), ns = "data-" + wt("framerAppearId");
1062
- function $i(t) {
1063
- return t.props[ns];
1866
+ const F = (t) => !!(t && t.getVelocity);
1867
+ function Fr(t) {
1868
+ return !!(F(t) && t.add);
1064
1869
  }
1065
- const E = (t) => !!(t && t.getVelocity);
1066
- function ji(t, e) {
1870
+ function Dr(t, e) {
1067
1871
  const n = t.getValue("willChange");
1068
- if (s = n, !!(E(s) && s.add)) return n.add(e);
1069
- var s;
1872
+ if (Fr(n))
1873
+ return n.add(e);
1070
1874
  }
1071
- function Ki({ protectedKeys: t, needsAnimating: e }, n) {
1875
+ function Rr({ protectedKeys: t, needsAnimating: e }, n) {
1072
1876
  const s = t.hasOwnProperty(n) && e[n] !== !0;
1073
1877
  return e[n] = !1, s;
1074
1878
  }
1075
- function ss(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
1879
+ function es(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
1076
1880
  var r;
1077
1881
  let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...l } = e;
1078
1882
  s && (o = s);
1079
- const c = [], u = i && t.animationState && t.animationState.getState()[i];
1080
- for (const h in l) {
1081
- const d = t.getValue(h, (r = t.latestValues[h]) !== null && r !== void 0 ? r : null), f = l[h];
1082
- if (f === void 0 || u && Ki(u, h)) continue;
1083
- const v = { delay: n, ...yn(o || {}, h) };
1084
- let p = !1;
1883
+ const u = [], c = i && t.animationState && t.animationState.getState()[i];
1884
+ for (const f in l) {
1885
+ const d = t.getValue(f, (r = t.latestValues[f]) !== null && r !== void 0 ? r : null), h = l[f];
1886
+ if (h === void 0 || c && Rr(c, f))
1887
+ continue;
1888
+ const y = {
1889
+ delay: n,
1890
+ ...mn(o || {}, f)
1891
+ };
1892
+ let v = !1;
1085
1893
  if (window.MotionHandoffAnimation) {
1086
- const m = $i(t);
1087
- if (m) {
1088
- const S = window.MotionHandoffAnimation(m, h, F);
1089
- S !== null && (v.startTime = S, p = !0);
1894
+ const p = Pr(t);
1895
+ if (p) {
1896
+ const g = window.MotionHandoffAnimation(p, f, R);
1897
+ g !== null && (y.startTime = g, v = !0);
1090
1898
  }
1091
1899
  }
1092
- ji(t, h), d.start(Bi(h, d, f, t.shouldReduceMotion && q.has(h) ? { type: !1 } : v, t, p));
1093
- const g = d.animation;
1094
- g && c.push(g);
1095
- }
1096
- return a && Promise.all(c).then(() => {
1097
- F.update(() => {
1098
- a && function(h, d) {
1099
- const f = Me(h, d);
1100
- let { transitionEnd: v = {}, transition: p = {}, ...g } = f || {};
1101
- g = { ...g, ...v };
1102
- for (const S in g) Li(h, S, (m = g[S], Ue(m) ? m[m.length - 1] || 0 : m));
1103
- var m;
1104
- }(t, a);
1900
+ Dr(t, f), d.start(vr(f, d, h, t.shouldReduceMotion && z.has(f) ? { type: !1 } : y, t, v));
1901
+ const b = d.animation;
1902
+ b && u.push(b);
1903
+ }
1904
+ return a && Promise.all(u).then(() => {
1905
+ R.update(() => {
1906
+ a && Mr(t, a);
1105
1907
  });
1106
- }), c;
1908
+ }), u;
1107
1909
  }
1108
- function et(t, e, n = {}) {
1910
+ function Je(t, e, n = {}) {
1109
1911
  var s;
1110
- const i = Me(t, e, n.type === "exit" ? (s = t.presenceContext) === null || s === void 0 ? void 0 : s.custom : void 0);
1912
+ const i = Pe(t, e, n.type === "exit" ? (s = t.presenceContext) === null || s === void 0 ? void 0 : s.custom : void 0);
1111
1913
  let { transition: r = t.getDefaultTransition() || {} } = i || {};
1112
1914
  n.transitionOverride && (r = n.transitionOverride);
1113
- const o = i ? () => Promise.all(ss(t, i, n)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (c = 0) => {
1114
- const { delayChildren: u = 0, staggerChildren: h, staggerDirection: d } = r;
1115
- return function(f, v, p = 0, g = 0, m = 1, S) {
1116
- const x = [], C = (f.variantChildren.size - 1) * g, y = m === 1 ? (w = 0) => w * g : (w = 0) => C - w * g;
1117
- return Array.from(f.variantChildren).sort(Wi).forEach((w, T) => {
1118
- w.notify("AnimationStart", v), x.push(et(w, v, { ...S, delay: p + y(T) }).then(() => w.notify("AnimationComplete", v)));
1119
- }), Promise.all(x);
1120
- }(t, e, u + c, h, d, n);
1915
+ const o = i ? () => Promise.all(es(t, i, n)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (u = 0) => {
1916
+ const { delayChildren: c = 0, staggerChildren: f, staggerDirection: d } = r;
1917
+ return Ir(t, e, c + u, f, d, n);
1121
1918
  } : () => Promise.resolve(), { when: l } = r;
1122
1919
  if (l) {
1123
- const [c, u] = l === "beforeChildren" ? [o, a] : [a, o];
1124
- return c().then(() => u());
1125
- }
1126
- return Promise.all([o(), a(n.delay)]);
1127
- }
1128
- function Wi(t, e) {
1920
+ const [u, c] = l === "beforeChildren" ? [o, a] : [a, o];
1921
+ return u().then(() => c());
1922
+ } else
1923
+ return Promise.all([o(), a(n.delay)]);
1924
+ }
1925
+ function Ir(t, e, n = 0, s = 0, i = 1, r) {
1926
+ const o = [], a = (t.variantChildren.size - 1) * s, l = i === 1 ? (u = 0) => u * s : (u = 0) => a - u * s;
1927
+ return Array.from(t.variantChildren).sort(Or).forEach((u, c) => {
1928
+ u.notify("AnimationStart", e), o.push(Je(u, e, {
1929
+ ...r,
1930
+ delay: n + l(c)
1931
+ }).then(() => u.notify("AnimationComplete", e)));
1932
+ }), Promise.all(o);
1933
+ }
1934
+ function Or(t, e) {
1129
1935
  return t.sortNodePosition(e);
1130
1936
  }
1131
- const Ui = ot.length;
1132
- function is(t) {
1133
- if (!t) return;
1937
+ function Er(t, e, n = {}) {
1938
+ t.notify("AnimationStart", e);
1939
+ let s;
1940
+ if (Array.isArray(e)) {
1941
+ const i = e.map((r) => Je(t, r, n));
1942
+ s = Promise.all(i);
1943
+ } else if (typeof e == "string")
1944
+ s = Je(t, e, n);
1945
+ else {
1946
+ const i = typeof e == "function" ? Pe(t, e, n.custom) : e;
1947
+ s = Promise.all(es(t, i, n));
1948
+ }
1949
+ return s.then(() => {
1950
+ t.notify("AnimationComplete", e);
1951
+ });
1952
+ }
1953
+ const kr = rt.length;
1954
+ function ts(t) {
1955
+ if (!t)
1956
+ return;
1134
1957
  if (!t.isControllingVariants) {
1135
- const n = t.parent && is(t.parent) || {};
1958
+ const n = t.parent ? ts(t.parent) || {} : {};
1136
1959
  return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
1137
1960
  }
1138
1961
  const e = {};
1139
- for (let n = 0; n < Ui; n++) {
1140
- const s = ot[n], i = t.props[s];
1141
- (le(i) || i === !1) && (e[s] = i);
1962
+ for (let n = 0; n < kr; n++) {
1963
+ const s = rt[n], i = t.props[s];
1964
+ (ue(i) || i === !1) && (e[s] = i);
1142
1965
  }
1143
1966
  return e;
1144
1967
  }
1145
- const Yi = [...rt].reverse(), qi = rt.length;
1146
- function zi(t) {
1147
- return (e) => Promise.all(e.map(({ animation: n, options: s }) => function(i, r, o = {}) {
1148
- let a;
1149
- if (i.notify("AnimationStart", r), Array.isArray(r)) {
1150
- const l = r.map((c) => et(i, c, o));
1151
- a = Promise.all(l);
1152
- } else if (typeof r == "string") a = et(i, r, o);
1153
- else {
1154
- const l = typeof r == "function" ? Me(i, r, o.custom) : r;
1155
- a = Promise.all(ss(i, l, o));
1968
+ const Lr = [...it].reverse(), Nr = it.length;
1969
+ function Br(t) {
1970
+ return (e) => Promise.all(e.map(({ animation: n, options: s }) => Er(t, n, s)));
1971
+ }
1972
+ function Kr(t) {
1973
+ let e = Br(t), n = Jt(), s = !0;
1974
+ const i = (l) => (u, c) => {
1975
+ var f;
1976
+ const d = Pe(t, c, l === "exit" ? (f = t.presenceContext) === null || f === void 0 ? void 0 : f.custom : void 0);
1977
+ if (d) {
1978
+ const { transition: h, transitionEnd: y, ...v } = d;
1979
+ u = { ...u, ...v, ...y };
1156
1980
  }
1157
- return a.then(() => {
1158
- i.notify("AnimationComplete", r);
1159
- });
1160
- }(t, n, s)));
1161
- }
1162
- function Hi(t) {
1163
- let e = zi(t), n = Qt(), s = !0;
1164
- const i = (o) => (a, l) => {
1165
- var c;
1166
- const u = Me(t, l, o === "exit" ? (c = t.presenceContext) === null || c === void 0 ? void 0 : c.custom : void 0);
1167
- if (u) {
1168
- const { transition: h, transitionEnd: d, ...f } = u;
1169
- a = { ...a, ...f, ...d };
1170
- }
1171
- return a;
1981
+ return u;
1172
1982
  };
1173
- function r(o) {
1174
- const { props: a } = t, l = is(t.parent) || {}, c = [], u = /* @__PURE__ */ new Set();
1175
- let h = {}, d = 1 / 0;
1176
- for (let v = 0; v < qi; v++) {
1177
- const p = Yi[v], g = n[p], m = a[p] !== void 0 ? a[p] : l[p], S = le(m), x = p === o ? g.isActive : null;
1178
- x === !1 && (d = v);
1179
- let C = m === l[p] && m !== a[p] && S;
1180
- if (C && s && t.manuallyAnimateOnMount && (C = !1), g.protectedKeys = { ...h }, !g.isActive && x === null || !m && !g.prevProp || Ce(m) || typeof m == "boolean") continue;
1181
- const y = Xi(g.prevProp, m);
1182
- let w = y || p === o && g.isActive && !C && S || v > d && S, T = !1;
1183
- const A = Array.isArray(m) ? m : [m];
1184
- let V = A.reduce(i(p), {});
1185
- x === !1 && (V = {});
1186
- const { prevResolvedValues: M = {} } = g, Ie = { ...M, ...V }, ie = (k) => {
1187
- w = !0, u.has(k) && (T = !0, u.delete(k)), g.needsAnimating[k] = !0;
1188
- const D = t.getValue(k);
1189
- D && (D.liveStyle = !1);
1983
+ function r(l) {
1984
+ e = l(t);
1985
+ }
1986
+ function o(l) {
1987
+ const { props: u } = t, c = ts(t.parent) || {}, f = [], d = /* @__PURE__ */ new Set();
1988
+ let h = {}, y = 1 / 0;
1989
+ for (let b = 0; b < Nr; b++) {
1990
+ const p = Lr[b], g = n[p], V = u[p] !== void 0 ? u[p] : c[p], A = ue(V), w = p === l ? g.isActive : null;
1991
+ w === !1 && (y = b);
1992
+ let S = V === c[p] && V !== u[p] && A;
1993
+ if (S && s && t.manuallyAnimateOnMount && (S = !1), g.protectedKeys = { ...h }, // If it isn't active and hasn't *just* been set as inactive
1994
+ !g.isActive && w === null || // If we didn't and don't have any defined prop for this animation type
1995
+ !V && !g.prevProp || // Or if the prop doesn't define an animation
1996
+ Ce(V) || typeof V == "boolean")
1997
+ continue;
1998
+ const M = _r(g.prevProp, V);
1999
+ let T = M || // If we're making this variant active, we want to always make it active
2000
+ p === l && g.isActive && !S && A || // If we removed a higher-priority variant (i is in reverse order)
2001
+ b > y && A, D = !1;
2002
+ const I = Array.isArray(V) ? V : [V];
2003
+ let H = I.reduce(i(p), {});
2004
+ w === !1 && (H = {});
2005
+ const { prevResolvedValues: Ft = {} } = g, Ss = {
2006
+ ...Ft,
2007
+ ...H
2008
+ }, Dt = (P) => {
2009
+ T = !0, d.has(P) && (D = !0, d.delete(P)), g.needsAnimating[P] = !0;
2010
+ const k = t.getValue(P);
2011
+ k && (k.liveStyle = !1);
1190
2012
  };
1191
- for (const k in Ie) {
1192
- const D = V[k], Re = M[k];
1193
- if (h.hasOwnProperty(k)) continue;
1194
- let Mt = !1;
1195
- Mt = Ue(D) && Ue(Re) ? !gn(D, Re) : D !== Re, Mt ? D != null ? ie(k) : u.add(k) : D !== void 0 && u.has(k) ? ie(k) : g.protectedKeys[k] = !0;
2013
+ for (const P in Ss) {
2014
+ const k = H[P], Ee = Ft[P];
2015
+ if (h.hasOwnProperty(P))
2016
+ continue;
2017
+ let ke = !1;
2018
+ je(k) && je(Ee) ? ke = !pn(k, Ee) : ke = k !== Ee, ke ? k != null ? Dt(P) : d.add(P) : k !== void 0 && d.has(P) ? Dt(P) : g.protectedKeys[P] = !0;
1196
2019
  }
1197
- g.prevProp = m, g.prevResolvedValues = V, g.isActive && (h = { ...h, ...V }), s && t.blockInitialAnimation && (w = !1), w && (!(C && y) || T) && c.push(...A.map((k) => ({ animation: k, options: { type: p } })));
2020
+ g.prevProp = V, g.prevResolvedValues = H, g.isActive && (h = { ...h, ...H }), s && t.blockInitialAnimation && (T = !1), T && (!(S && M) || D) && f.push(...I.map((P) => ({
2021
+ animation: P,
2022
+ options: { type: p }
2023
+ })));
1198
2024
  }
1199
- if (u.size) {
1200
- const v = {};
1201
- u.forEach((p) => {
1202
- const g = t.getBaseTarget(p), m = t.getValue(p);
1203
- m && (m.liveStyle = !0), v[p] = g ?? null;
1204
- }), c.push({ animation: v });
2025
+ if (d.size) {
2026
+ const b = {};
2027
+ d.forEach((p) => {
2028
+ const g = t.getBaseTarget(p), V = t.getValue(p);
2029
+ V && (V.liveStyle = !0), b[p] = g ?? null;
2030
+ }), f.push({ animation: b });
1205
2031
  }
1206
- let f = !!c.length;
1207
- return !s || a.initial !== !1 && a.initial !== a.animate || t.manuallyAnimateOnMount || (f = !1), s = !1, f ? e(c) : Promise.resolve();
2032
+ let v = !!f.length;
2033
+ return s && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (v = !1), s = !1, v ? e(f) : Promise.resolve();
1208
2034
  }
1209
- return { animateChanges: r, setActive: function(o, a) {
1210
- var l;
1211
- if (n[o].isActive === a) return Promise.resolve();
1212
- (l = t.variantChildren) === null || l === void 0 || l.forEach((u) => {
2035
+ function a(l, u) {
2036
+ var c;
2037
+ if (n[l].isActive === u)
2038
+ return Promise.resolve();
2039
+ (c = t.variantChildren) === null || c === void 0 || c.forEach((d) => {
1213
2040
  var h;
1214
- return (h = u.animationState) === null || h === void 0 ? void 0 : h.setActive(o, a);
1215
- }), n[o].isActive = a;
1216
- const c = r(o);
1217
- for (const u in n) n[u].protectedKeys = {};
1218
- return c;
1219
- }, setAnimateFunction: function(o) {
1220
- e = o(t);
1221
- }, getState: () => n, reset: () => {
1222
- n = Qt(), s = !0;
1223
- } };
1224
- }
1225
- function Xi(t, e) {
1226
- return typeof e == "string" ? e !== t : !!Array.isArray(e) && !gn(e, t);
1227
- }
1228
- function j(t = !1) {
1229
- return { isActive: t, protectedKeys: {}, needsAnimating: {}, prevResolvedValues: {} };
1230
- }
1231
- function Qt() {
1232
- return { animate: j(!0), whileInView: j(), whileHover: j(), whileTap: j(), whileDrag: j(), whileFocus: j(), exit: j() };
1233
- }
1234
- class G {
2041
+ return (h = d.animationState) === null || h === void 0 ? void 0 : h.setActive(l, u);
2042
+ }), n[l].isActive = u;
2043
+ const f = o(l);
2044
+ for (const d in n)
2045
+ n[d].protectedKeys = {};
2046
+ return f;
2047
+ }
2048
+ return {
2049
+ animateChanges: o,
2050
+ setActive: a,
2051
+ setAnimateFunction: r,
2052
+ getState: () => n,
2053
+ reset: () => {
2054
+ n = Jt(), s = !0;
2055
+ }
2056
+ };
2057
+ }
2058
+ function _r(t, e) {
2059
+ return typeof e == "string" ? e !== t : Array.isArray(e) ? !pn(e, t) : !1;
2060
+ }
2061
+ function $(t = !1) {
2062
+ return {
2063
+ isActive: t,
2064
+ protectedKeys: {},
2065
+ needsAnimating: {},
2066
+ prevResolvedValues: {}
2067
+ };
2068
+ }
2069
+ function Jt() {
2070
+ return {
2071
+ animate: $(!0),
2072
+ whileInView: $(),
2073
+ whileHover: $(),
2074
+ whileTap: $(),
2075
+ whileDrag: $(),
2076
+ whileFocus: $(),
2077
+ exit: $()
2078
+ };
2079
+ }
2080
+ class re {
1235
2081
  constructor(e) {
1236
2082
  this.isMounted = !1, this.node = e;
1237
2083
  }
1238
2084
  update() {
1239
2085
  }
1240
2086
  }
1241
- let _i = 0;
1242
- const Gi = { animation: { Feature: class extends G {
1243
- constructor(t) {
1244
- super(t), t.animationState || (t.animationState = Hi(t));
2087
+ class $r extends re {
2088
+ /**
2089
+ * We dynamically generate the AnimationState manager as it contains a reference
2090
+ * to the underlying animation library. We only want to load that if we load this,
2091
+ * so people can optionally code split it out using the `m` component.
2092
+ */
2093
+ constructor(e) {
2094
+ super(e), e.animationState || (e.animationState = Kr(e));
1245
2095
  }
1246
2096
  updateAnimationControlsSubscription() {
1247
- const { animate: t } = this.node.getProps();
1248
- Ce(t) && (this.unmountControls = t.subscribe(this.node));
2097
+ const { animate: e } = this.node.getProps();
2098
+ Ce(e) && (this.unmountControls = e.subscribe(this.node));
1249
2099
  }
2100
+ /**
2101
+ * Subscribe any provided AnimationControls to the component's VisualElement
2102
+ */
1250
2103
  mount() {
1251
2104
  this.updateAnimationControlsSubscription();
1252
2105
  }
1253
2106
  update() {
1254
- const { animate: t } = this.node.getProps(), { animate: e } = this.node.prevProps || {};
1255
- t !== e && this.updateAnimationControlsSubscription();
2107
+ const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
2108
+ e !== n && this.updateAnimationControlsSubscription();
1256
2109
  }
1257
2110
  unmount() {
1258
- var t;
1259
- this.node.animationState.reset(), (t = this.unmountControls) === null || t === void 0 || t.call(this);
2111
+ var e;
2112
+ this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this);
1260
2113
  }
1261
- } }, exit: { Feature: class extends G {
2114
+ }
2115
+ let jr = 0;
2116
+ class Wr extends re {
1262
2117
  constructor() {
1263
- super(...arguments), this.id = _i++;
2118
+ super(...arguments), this.id = jr++;
1264
2119
  }
1265
2120
  update() {
1266
- if (!this.node.presenceContext) return;
1267
- const { isPresent: t, onExitComplete: e } = this.node.presenceContext, { isPresent: n } = this.node.prevPresenceContext || {};
1268
- if (!this.node.animationState || t === n) return;
1269
- const s = this.node.animationState.setActive("exit", !t);
1270
- e && !t && s.then(() => e(this.id));
2121
+ if (!this.node.presenceContext)
2122
+ return;
2123
+ const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
2124
+ if (!this.node.animationState || e === s)
2125
+ return;
2126
+ const i = this.node.animationState.setActive("exit", !e);
2127
+ n && !e && i.then(() => n(this.id));
1271
2128
  }
1272
2129
  mount() {
1273
- const { register: t } = this.node.presenceContext || {};
1274
- t && (this.unmount = t(this.id));
2130
+ const { register: e } = this.node.presenceContext || {};
2131
+ e && (this.unmount = e(this.id));
1275
2132
  }
1276
2133
  unmount() {
1277
2134
  }
1278
- } } }, Zi = !1;
1279
- function rs(t) {
1280
- return { point: { x: t.pageX, y: t.pageY } };
1281
2135
  }
1282
- function en(t, e, n, s = { passive: !0 }) {
2136
+ const Gr = {
2137
+ animation: {
2138
+ Feature: $r
2139
+ },
2140
+ exit: {
2141
+ Feature: Wr
2142
+ }
2143
+ }, Ur = {
2144
+ x: !1,
2145
+ y: !1
2146
+ };
2147
+ function zr() {
2148
+ return Ur.y;
2149
+ }
2150
+ const Hr = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1;
2151
+ function ns(t) {
2152
+ return {
2153
+ point: {
2154
+ x: t.pageX,
2155
+ y: t.pageY
2156
+ }
2157
+ };
2158
+ }
2159
+ function Qt(t, e, n, s = { passive: !0 }) {
1283
2160
  return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
1284
2161
  }
1285
- function os(t) {
2162
+ function ss(t) {
1286
2163
  return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
1287
2164
  }
1288
- const Ji = () => ({ x: { min: 0, max: 0 }, y: { min: 0, max: 0 } }), as = ee(null), Qi = ee({}), er = ee({}), tr = {}, { schedule: nr, cancel: eo } = wn(queueMicrotask, !1);
1289
- function sr(t) {
1290
- const e = E(t) ? t.get() : t;
1291
- return n = e, n && typeof n == "object" && n.mix && n.toValue ? e.toValue() : e;
1292
- var n;
2165
+ const en = () => ({ min: 0, max: 0 }), is = () => ({
2166
+ x: en(),
2167
+ y: en()
2168
+ });
2169
+ function qr({ top: t, left: e, right: n, bottom: s }) {
2170
+ return {
2171
+ x: { min: e, max: n },
2172
+ y: { min: t, max: s }
2173
+ };
1293
2174
  }
1294
- function ls(t, e) {
1295
- const n = function(i) {
1296
- if (i instanceof Element) return [i];
1297
- if (typeof i == "string") {
1298
- const r = document.querySelectorAll(i);
1299
- return r ? Array.from(r) : [];
1300
- }
1301
- return Array.from(i);
1302
- }(t), s = new AbortController();
1303
- return [n, { passive: !0, ...e, signal: s.signal }, () => s.abort()];
2175
+ function Yr(t, e) {
2176
+ if (!e)
2177
+ return t;
2178
+ const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
2179
+ return {
2180
+ top: n.y,
2181
+ left: n.x,
2182
+ bottom: s.y,
2183
+ right: s.x
2184
+ };
2185
+ }
2186
+ function Xr(t, e) {
2187
+ return qr(Yr(t.getBoundingClientRect(), e));
2188
+ }
2189
+ const rs = te(null), Zr = te({}), Jr = te({}), Qr = {}, { schedule: eo, cancel: Pa } = gn(queueMicrotask, !1);
2190
+ function to(t) {
2191
+ const e = F(t) ? t.get() : t;
2192
+ return br(e) ? e.toValue() : e;
2193
+ }
2194
+ function no(t, e, n) {
2195
+ var s;
2196
+ if (t instanceof Element)
2197
+ return [t];
2198
+ if (typeof t == "string") {
2199
+ let i = document;
2200
+ const r = (s = void 0) !== null && s !== void 0 ? s : i.querySelectorAll(t);
2201
+ return r ? Array.from(r) : [];
2202
+ }
2203
+ return Array.from(t);
2204
+ }
2205
+ function os(t, e) {
2206
+ const n = no(t), s = new AbortController(), i = {
2207
+ passive: !0,
2208
+ ...e,
2209
+ signal: s.signal
2210
+ };
2211
+ return [n, i, () => s.abort()];
1304
2212
  }
1305
2213
  function tn(t) {
1306
2214
  return (e) => {
1307
- e.pointerType === "touch" || Zi || t(e);
2215
+ e.pointerType === "touch" || zr() || t(e);
1308
2216
  };
1309
2217
  }
2218
+ function so(t, e, n = {}) {
2219
+ const [s, i, r] = os(t, n), o = tn((a) => {
2220
+ const { target: l } = a, u = e(a);
2221
+ if (!u || !l)
2222
+ return;
2223
+ const c = tn((f) => {
2224
+ u(f), l.removeEventListener("pointerleave", c);
2225
+ });
2226
+ l.addEventListener("pointerleave", c, i);
2227
+ });
2228
+ return s.forEach((a) => {
2229
+ a.addEventListener("pointerenter", o, i);
2230
+ }), r;
2231
+ }
1310
2232
  function nn(t, e, n) {
1311
2233
  const { props: s } = t;
1312
2234
  t.animationState && s.whileHover && t.animationState.setActive("whileHover", n === "Start");
1313
- const i = s["onHover" + n];
1314
- i && F.postRender(() => i(e, rs(e)));
2235
+ const i = "onHover" + n, r = s[i];
2236
+ r && R.postRender(() => r(e, ns(e)));
2237
+ }
2238
+ class io extends re {
2239
+ mount() {
2240
+ const { current: e } = this.node;
2241
+ e && (this.unmount = so(e, (n) => (nn(this.node, n, "Start"), (s) => nn(this.node, s, "End"))));
2242
+ }
2243
+ unmount() {
2244
+ }
1315
2245
  }
1316
- const re = /* @__PURE__ */ new WeakSet();
2246
+ class ro extends re {
2247
+ constructor() {
2248
+ super(...arguments), this.isActive = !1;
2249
+ }
2250
+ onFocus() {
2251
+ let e = !1;
2252
+ try {
2253
+ e = this.node.current.matches(":focus-visible");
2254
+ } catch {
2255
+ e = !0;
2256
+ }
2257
+ !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
2258
+ }
2259
+ onBlur() {
2260
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
2261
+ }
2262
+ mount() {
2263
+ this.unmount = De(Qt(this.node.current, "focus", () => this.onFocus()), Qt(this.node.current, "blur", () => this.onBlur()));
2264
+ }
2265
+ unmount() {
2266
+ }
2267
+ }
2268
+ const ae = /* @__PURE__ */ new WeakSet();
1317
2269
  function sn(t) {
1318
2270
  return (e) => {
1319
2271
  e.key === "Enter" && t(e);
1320
2272
  };
1321
2273
  }
1322
- function $e(t, e) {
2274
+ function Ke(t, e) {
1323
2275
  t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
1324
2276
  }
1325
- const ir = /* @__PURE__ */ new Set(["BUTTON", "INPUT", "SELECT", "TEXTAREA", "A"]), us = (t, e) => !!e && (t === e || us(t, e.parentElement));
2277
+ const oo = (t, e) => {
2278
+ const n = t.currentTarget;
2279
+ if (!n)
2280
+ return;
2281
+ const s = sn(() => {
2282
+ if (ae.has(n))
2283
+ return;
2284
+ Ke(n, "down");
2285
+ const i = sn(() => {
2286
+ Ke(n, "up");
2287
+ }), r = () => Ke(n, "cancel");
2288
+ n.addEventListener("keyup", i, e), n.addEventListener("blur", r, e);
2289
+ });
2290
+ n.addEventListener("keydown", s, e), n.addEventListener("blur", () => n.removeEventListener("keydown", s), e);
2291
+ }, ao = /* @__PURE__ */ new Set([
2292
+ "BUTTON",
2293
+ "INPUT",
2294
+ "SELECT",
2295
+ "TEXTAREA",
2296
+ "A"
2297
+ ]);
2298
+ function lo(t) {
2299
+ return ao.has(t.tagName) || t.tabIndex !== -1;
2300
+ }
2301
+ const as = (t, e) => e ? t === e ? !0 : as(t, e.parentElement) : !1;
1326
2302
  function rn(t) {
1327
- return ((e) => e.pointerType === "mouse" ? typeof e.button != "number" || e.button <= 0 : e.isPrimary !== !1)(t) && !0;
2303
+ return Hr(t) && !0;
1328
2304
  }
1329
- function rr(t, e, n = {}) {
1330
- const [s, i, r] = ls(t, n), o = (a) => {
2305
+ function uo(t, e, n = {}) {
2306
+ const [s, i, r] = os(t, n), o = (a) => {
1331
2307
  const l = a.currentTarget;
1332
- if (!rn(a) || re.has(l)) return;
1333
- re.add(l);
1334
- const c = e(a), u = (f, v) => {
1335
- window.removeEventListener("pointerup", h), window.removeEventListener("pointercancel", d), rn(f) && re.has(l) && (re.delete(l), c && c(f, { success: v }));
1336
- }, h = (f) => {
1337
- u(f, n.useGlobalTarget || us(l, f.target));
1338
- }, d = (f) => {
1339
- u(f, !1);
2308
+ if (!rn(a) || ae.has(l))
2309
+ return;
2310
+ ae.add(l);
2311
+ const u = e(a), c = (h, y) => {
2312
+ window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", d), !(!rn(h) || !ae.has(l)) && (ae.delete(l), u && u(h, { success: y }));
2313
+ }, f = (h) => {
2314
+ c(h, n.useGlobalTarget || as(l, h.target));
2315
+ }, d = (h) => {
2316
+ c(h, !1);
1340
2317
  };
1341
- window.addEventListener("pointerup", h, i), window.addEventListener("pointercancel", d, i);
2318
+ window.addEventListener("pointerup", f, i), window.addEventListener("pointercancel", d, i);
1342
2319
  };
1343
2320
  return s.forEach((a) => {
1344
- (function(l) {
1345
- return ir.has(l.tagName) || l.tabIndex !== -1;
1346
- })(a) || (a.tabIndex = 0), (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), a.addEventListener("focus", (l) => ((c, u) => {
1347
- const h = c.currentTarget;
1348
- if (!h) return;
1349
- const d = sn(() => {
1350
- if (re.has(h)) return;
1351
- $e(h, "down");
1352
- const f = sn(() => {
1353
- $e(h, "up");
1354
- });
1355
- h.addEventListener("keyup", f, u), h.addEventListener("blur", () => $e(h, "cancel"), u);
1356
- });
1357
- h.addEventListener("keydown", d, u), h.addEventListener("blur", () => h.removeEventListener("keydown", d), u);
1358
- })(l, i), i);
2321
+ lo(a) || (a.tabIndex = 0), (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), a.addEventListener("focus", (u) => oo(u, i), i);
1359
2322
  }), r;
1360
2323
  }
1361
2324
  function on(t, e, n) {
1362
2325
  const { props: s } = t;
1363
2326
  t.animationState && s.whileTap && t.animationState.setActive("whileTap", n === "Start");
1364
- const i = s["onTap" + (n === "End" ? "" : n)];
1365
- i && F.postRender(() => i(e, rs(e)));
2327
+ const i = "onTap" + (n === "End" ? "" : n), r = s[i];
2328
+ r && R.postRender(() => r(e, ns(e)));
1366
2329
  }
1367
- const tt = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), or = (t) => {
1368
- const e = tt.get(t.target);
2330
+ class co extends re {
2331
+ mount() {
2332
+ const { current: e } = this.node;
2333
+ e && (this.unmount = uo(e, (n) => (on(this.node, n, "Start"), (s, { success: i }) => on(this.node, s, i ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
2334
+ }
2335
+ unmount() {
2336
+ }
2337
+ }
2338
+ const Qe = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), fo = (t) => {
2339
+ const e = Qe.get(t.target);
1369
2340
  e && e(t);
1370
- }, ar = (t) => {
1371
- t.forEach(or);
2341
+ }, ho = (t) => {
2342
+ t.forEach(fo);
1372
2343
  };
1373
- function lr(t, e, n) {
1374
- const s = function({ root: i, ...r }) {
1375
- const o = i || document;
1376
- je.has(o) || je.set(o, {});
1377
- const a = je.get(o), l = JSON.stringify(r);
1378
- return a[l] || (a[l] = new IntersectionObserver(ar, { root: i, ...r })), a[l];
1379
- }(e);
1380
- return tt.set(t, n), s.observe(t), () => {
1381
- tt.delete(t), s.unobserve(t);
2344
+ function po({ root: t, ...e }) {
2345
+ const n = t || document;
2346
+ _e.has(n) || _e.set(n, {});
2347
+ const s = _e.get(n), i = JSON.stringify(e);
2348
+ return s[i] || (s[i] = new IntersectionObserver(ho, { root: t, ...e })), s[i];
2349
+ }
2350
+ function mo(t, e, n) {
2351
+ const s = po(e);
2352
+ return Qe.set(t, n), s.observe(t), () => {
2353
+ Qe.delete(t), s.unobserve(t);
1382
2354
  };
1383
2355
  }
1384
- const ur = { some: 0, all: 1 }, cr = { inView: { Feature: class extends G {
2356
+ const go = {
2357
+ some: 0,
2358
+ all: 1
2359
+ };
2360
+ class yo extends re {
1385
2361
  constructor() {
1386
2362
  super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
1387
2363
  }
1388
2364
  startObserver() {
1389
2365
  this.unmount();
1390
- const { viewport: t = {} } = this.node.getProps(), { root: e, margin: n, amount: s = "some", once: i } = t, r = { root: e ? e.current : void 0, rootMargin: n, threshold: typeof s == "number" ? s : ur[s] };
1391
- return lr(this.node.current, r, (o) => {
1392
- const { isIntersecting: a } = o;
1393
- if (this.isInView === a || (this.isInView = a, i && !a && this.hasEnteredView)) return;
1394
- a && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", a);
1395
- const { onViewportEnter: l, onViewportLeave: c } = this.node.getProps(), u = a ? l : c;
1396
- u && u(o);
1397
- });
2366
+ const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, o = {
2367
+ root: n ? n.current : void 0,
2368
+ rootMargin: s,
2369
+ threshold: typeof i == "number" ? i : go[i]
2370
+ }, a = (l) => {
2371
+ const { isIntersecting: u } = l;
2372
+ if (this.isInView === u || (this.isInView = u, r && !u && this.hasEnteredView))
2373
+ return;
2374
+ u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
2375
+ const { onViewportEnter: c, onViewportLeave: f } = this.node.getProps(), d = u ? c : f;
2376
+ d && d(l);
2377
+ };
2378
+ return mo(this.node.current, o, a);
1398
2379
  }
1399
2380
  mount() {
1400
2381
  this.startObserver();
1401
2382
  }
1402
2383
  update() {
1403
- if (typeof IntersectionObserver > "u") return;
1404
- const { props: t, prevProps: e } = this.node;
1405
- ["amount", "margin", "root"].some(function({ viewport: n = {} }, { viewport: s = {} } = {}) {
1406
- return (i) => n[i] !== s[i];
1407
- }(t, e)) && this.startObserver();
1408
- }
1409
- unmount() {
1410
- }
1411
- } }, tap: { Feature: class extends G {
1412
- mount() {
1413
- const { current: t } = this.node;
1414
- t && (this.unmount = rr(t, (e) => (on(this.node, e, "Start"), (n, { success: s }) => on(this.node, n, s ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
1415
- }
1416
- unmount() {
1417
- }
1418
- } }, focus: { Feature: class extends G {
1419
- constructor() {
1420
- super(...arguments), this.isActive = !1;
1421
- }
1422
- onFocus() {
1423
- let t = !1;
1424
- try {
1425
- t = this.node.current.matches(":focus-visible");
1426
- } catch {
1427
- t = !0;
1428
- }
1429
- t && this.node.animationState && (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
1430
- }
1431
- onBlur() {
1432
- this.isActive && this.node.animationState && (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
1433
- }
1434
- mount() {
1435
- this.unmount = ke(en(this.node.current, "focus", () => this.onFocus()), en(this.node.current, "blur", () => this.onBlur()));
2384
+ if (typeof IntersectionObserver > "u")
2385
+ return;
2386
+ const { props: e, prevProps: n } = this.node;
2387
+ ["amount", "margin", "root"].some(vo(e, n)) && this.startObserver();
1436
2388
  }
1437
2389
  unmount() {
1438
2390
  }
1439
- } }, hover: { Feature: class extends G {
1440
- mount() {
1441
- const { current: t } = this.node;
1442
- t && (this.unmount = function(e, n, s = {}) {
1443
- const [i, r, o] = ls(e, s), a = tn((l) => {
1444
- const { target: c } = l, u = n(l);
1445
- if (!u || !c) return;
1446
- const h = tn((d) => {
1447
- u(d), c.removeEventListener("pointerleave", h);
1448
- });
1449
- c.addEventListener("pointerleave", h, r);
1450
- });
1451
- return i.forEach((l) => {
1452
- l.addEventListener("pointerenter", a, r);
1453
- }), o;
1454
- }(t, (e) => (nn(this.node, e, "Start"), (n) => nn(this.node, n, "End"))));
1455
- }
1456
- unmount() {
1457
- }
1458
- } } }, cs = ee({ transformPagePoint: (t) => t, isStatic: !1, reducedMotion: "never" }), Fe = ee({}), bt = typeof window < "u", hr = bt ? Ts : st, St = ee({ strict: !1 });
1459
- function dr(t, e, n, s, i) {
2391
+ }
2392
+ function vo({ viewport: t = {} }, { viewport: e = {} } = {}) {
2393
+ return (n) => t[n] !== e[n];
2394
+ }
2395
+ const bo = {
2396
+ inView: {
2397
+ Feature: yo
2398
+ },
2399
+ tap: {
2400
+ Feature: co
2401
+ },
2402
+ focus: {
2403
+ Feature: ro
2404
+ },
2405
+ hover: {
2406
+ Feature: io
2407
+ }
2408
+ }, ls = te({
2409
+ transformPagePoint: (t) => t,
2410
+ isStatic: !1,
2411
+ reducedMotion: "never"
2412
+ }), Ie = te({}), Tt = typeof window < "u", wo = Tt ? xs : nt, Vt = te({ strict: !1 });
2413
+ function To(t, e, n, s, i) {
1460
2414
  var r, o;
1461
- const { visualElement: a } = O(Fe), l = O(St), c = O(as), u = O(cs).reducedMotion, h = Z(null);
1462
- s = s || l.renderer, !h.current && s && (h.current = s(t, { visualState: e, parent: a, props: n, presenceContext: c, blockInitialAnimation: !!c && c.initial === !1, reducedMotionConfig: u }));
1463
- const d = h.current, f = O(er);
1464
- !d || d.projection || !i || d.type !== "html" && d.type !== "svg" || function(m, S, x, C) {
1465
- const { layoutId: y, layout: w, drag: T, dragConstraints: A, layoutScroll: V, layoutRoot: M } = S;
1466
- m.projection = new x(m.latestValues, S["data-framer-portal-id"] ? void 0 : hs(m.parent)), m.projection.setOptions({ layoutId: y, layout: w, alwaysMeasureLayout: !!T || A && os(A), visualElement: m, animationType: typeof w == "string" ? w : "both", initialPromotionConfig: C, layoutScroll: V, layoutRoot: M });
1467
- }(h.current, n, i, f);
1468
- const v = Z(!1);
1469
- xs(() => {
1470
- d && v.current && d.update(n, c);
2415
+ const { visualElement: a } = O(Ie), l = O(Vt), u = O(rs), c = O(ls).reducedMotion, f = Z(null);
2416
+ s = s || l.renderer, !f.current && s && (f.current = s(t, {
2417
+ visualState: e,
2418
+ parent: a,
2419
+ props: n,
2420
+ presenceContext: u,
2421
+ blockInitialAnimation: u ? u.initial === !1 : !1,
2422
+ reducedMotionConfig: c
2423
+ }));
2424
+ const d = f.current, h = O(Jr);
2425
+ d && !d.projection && i && (d.type === "html" || d.type === "svg") && Vo(f.current, n, i, h);
2426
+ const y = Z(!1);
2427
+ As(() => {
2428
+ d && y.current && d.update(n, u);
1471
2429
  });
1472
- const p = n[ns], g = Z(!!p && !(!((r = window.MotionHandoffIsComplete) === null || r === void 0) && r.call(window, p)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, p)));
1473
- return hr(() => {
1474
- d && (v.current = !0, window.MotionIsMounted = !0, d.updateFeatures(), nr.render(d.render), g.current && d.animationState && d.animationState.animateChanges());
1475
- }), st(() => {
1476
- d && (!g.current && d.animationState && d.animationState.animateChanges(), g.current && (queueMicrotask(() => {
1477
- var m;
1478
- (m = window.MotionHandoffMarkAsComplete) === null || m === void 0 || m.call(window, p);
1479
- }), g.current = !1));
2430
+ const v = n[Qn], b = Z(!!v && !(!((r = window.MotionHandoffIsComplete) === null || r === void 0) && r.call(window, v)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, v)));
2431
+ return wo(() => {
2432
+ d && (y.current = !0, window.MotionIsMounted = !0, d.updateFeatures(), eo.render(d.render), b.current && d.animationState && d.animationState.animateChanges());
2433
+ }), nt(() => {
2434
+ d && (!b.current && d.animationState && d.animationState.animateChanges(), b.current && (queueMicrotask(() => {
2435
+ var p;
2436
+ (p = window.MotionHandoffMarkAsComplete) === null || p === void 0 || p.call(window, v);
2437
+ }), b.current = !1));
1480
2438
  }), d;
1481
2439
  }
1482
- function hs(t) {
1483
- if (t) return t.options.allowProjection !== !1 ? t.projection : hs(t.parent);
2440
+ function Vo(t, e, n, s) {
2441
+ const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: l, layoutRoot: u } = e;
2442
+ t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : us(t.parent)), t.projection.setOptions({
2443
+ layoutId: i,
2444
+ layout: r,
2445
+ alwaysMeasureLayout: !!o || a && ss(a),
2446
+ visualElement: t,
2447
+ /**
2448
+ * TODO: Update options in an effect. This could be tricky as it'll be too late
2449
+ * to update by the time layout animations run.
2450
+ * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
2451
+ * ensuring it gets called if there's no potential layout animations.
2452
+ *
2453
+ */
2454
+ animationType: typeof r == "string" ? r : "both",
2455
+ initialPromotionConfig: s,
2456
+ layoutScroll: l,
2457
+ layoutRoot: u
2458
+ });
1484
2459
  }
1485
- function pr(t, e, n) {
1486
- return fn((s) => {
1487
- s && t.mount && t.mount(s), e && (s ? e.mount(s) : e.unmount()), n && (typeof n == "function" ? n(s) : os(n) && (n.current = s));
1488
- }, [e]);
2460
+ function us(t) {
2461
+ if (t)
2462
+ return t.options.allowProjection !== !1 ? t.projection : us(t.parent);
2463
+ }
2464
+ function So(t, e, n) {
2465
+ return fn(
2466
+ (s) => {
2467
+ s && t.mount && t.mount(s), e && (s ? e.mount(s) : e.unmount()), n && (typeof n == "function" ? n(s) : ss(n) && (n.current = s));
2468
+ },
2469
+ /**
2470
+ * Only pass a new ref callback to React if we've received a visual element
2471
+ * factory. Otherwise we'll be mounting/remounting every time externalRef
2472
+ * or other dependencies change.
2473
+ */
2474
+ [e]
2475
+ );
1489
2476
  }
1490
2477
  function Oe(t) {
1491
- return Ce(t.animate) || ot.some((e) => le(t[e]));
2478
+ return Ce(t.animate) || rt.some((e) => ue(t[e]));
1492
2479
  }
1493
- function ds(t) {
2480
+ function cs(t) {
1494
2481
  return !!(Oe(t) || t.variants);
1495
2482
  }
1496
- function mr(t) {
1497
- const { initial: e, animate: n } = function(s, i) {
1498
- if (Oe(s)) {
1499
- const { initial: r, animate: o } = s;
1500
- return { initial: r === !1 || le(r) ? r : void 0, animate: le(o) ? o : void 0 };
1501
- }
1502
- return s.inherit !== !1 ? i : {};
1503
- }(t, O(Fe));
1504
- return Ve(() => ({ initial: e, animate: n }), [an(e), an(n)]);
2483
+ function xo(t, e) {
2484
+ if (Oe(t)) {
2485
+ const { initial: n, animate: s } = t;
2486
+ return {
2487
+ initial: n === !1 || ue(n) ? n : void 0,
2488
+ animate: ue(s) ? s : void 0
2489
+ };
2490
+ }
2491
+ return t.inherit !== !1 ? e : {};
2492
+ }
2493
+ function Ao(t) {
2494
+ const { initial: e, animate: n } = xo(t, O(Ie));
2495
+ return Ae(() => ({ initial: e, animate: n }), [an(e), an(n)]);
1505
2496
  }
1506
2497
  function an(t) {
1507
2498
  return Array.isArray(t) ? t.join(" ") : t;
1508
2499
  }
1509
- const ln = { animation: ["animate", "variants", "whileHover", "whileTap", "exit", "whileInView", "whileFocus", "whileDrag"], exit: ["exit"], drag: ["drag", "dragControls"], focus: ["whileFocus"], hover: ["whileHover", "onHoverStart", "onHoverEnd"], tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"], pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], inView: ["whileInView", "onViewportEnter", "onViewportLeave"], layout: ["layout", "layoutId"] }, Q = {};
1510
- for (const t in ln) Q[t] = { isEnabled: (e) => ln[t].some((n) => !!e[n]) };
1511
- function nt(t) {
1512
- for (const e in t) Q[e] = { ...Q[e], ...t[e] };
1513
- }
1514
- const fr = Symbol.for("motionComponentSymbol");
1515
- function vr({ preloadedFeatures: t, createVisualElement: e, useRender: n, useVisualState: s, Component: i }) {
1516
- t && nt(t);
1517
- const r = As(function(o, a) {
1518
- let l;
1519
- const c = { ...O(cs), ...o, layoutId: gr(o) }, { isStatic: u } = c, h = mr(o), d = s(o, u);
1520
- if (!u && bt) {
1521
- (function(v, p) {
1522
- const g = O(St).strict;
1523
- if (process.env.NODE_ENV !== "production" && p && g) {
1524
- const m = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
1525
- v.ignoreStrict ? te(!1, m) : U(!1, m);
1526
- }
1527
- })(c, t);
1528
- const f = function(v) {
1529
- const { drag: p, layout: g } = Q;
1530
- if (!p && !g) return {};
1531
- const m = { ...p, ...g };
1532
- return { MeasureLayout: p != null && p.isEnabled(v) || g != null && g.isEnabled(v) ? m.MeasureLayout : void 0, ProjectionNode: m.ProjectionNode };
1533
- }(c);
1534
- l = f.MeasureLayout, h.visualElement = dr(i, d, c, e, f.ProjectionNode);
2500
+ const ln = {
2501
+ animation: [
2502
+ "animate",
2503
+ "variants",
2504
+ "whileHover",
2505
+ "whileTap",
2506
+ "exit",
2507
+ "whileInView",
2508
+ "whileFocus",
2509
+ "whileDrag"
2510
+ ],
2511
+ exit: ["exit"],
2512
+ drag: ["drag", "dragControls"],
2513
+ focus: ["whileFocus"],
2514
+ hover: ["whileHover", "onHoverStart", "onHoverEnd"],
2515
+ tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
2516
+ pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
2517
+ inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
2518
+ layout: ["layout", "layoutId"]
2519
+ }, ee = {};
2520
+ for (const t in ln)
2521
+ ee[t] = {
2522
+ isEnabled: (e) => ln[t].some((n) => !!e[n])
2523
+ };
2524
+ function et(t) {
2525
+ for (const e in t)
2526
+ ee[e] = {
2527
+ ...ee[e],
2528
+ ...t[e]
2529
+ };
2530
+ }
2531
+ const Mo = Symbol.for("motionComponentSymbol");
2532
+ function Co({ preloadedFeatures: t, createVisualElement: e, useRender: n, useVisualState: s, Component: i }) {
2533
+ t && et(t);
2534
+ function r(a, l) {
2535
+ let u;
2536
+ const c = {
2537
+ ...O(ls),
2538
+ ...a,
2539
+ layoutId: Po(a)
2540
+ }, { isStatic: f } = c, d = Ao(a), h = s(a, f);
2541
+ if (!f && Tt) {
2542
+ Fo(c, t);
2543
+ const y = Do(c);
2544
+ u = y.MeasureLayout, d.visualElement = To(i, h, c, e, y.ProjectionNode);
1535
2545
  }
1536
- return H(Fe.Provider, { value: h, children: [l && h.visualElement ? I(l, { visualElement: h.visualElement, ...c }) : null, n(i, o, pr(d, h.visualElement, a), d, u, h.visualElement)] });
1537
- });
1538
- return r[fr] = i, r;
2546
+ return Y(Ie.Provider, { value: d, children: [u && d.visualElement ? E(u, { visualElement: d.visualElement, ...c }) : null, n(i, a, So(h, d.visualElement, l), h, f, d.visualElement)] });
2547
+ }
2548
+ const o = Ms(r);
2549
+ return o[Mo] = i, o;
1539
2550
  }
1540
- function gr({ layoutId: t }) {
1541
- const e = O(Qi).id;
2551
+ function Po({ layoutId: t }) {
2552
+ const e = O(Zr).id;
1542
2553
  return e && t !== void 0 ? e + "-" + t : t;
1543
2554
  }
1544
- const yr = ["animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "switch", "symbol", "svg", "text", "tspan", "use", "view"];
1545
- function Tt(t) {
1546
- return typeof t == "string" && !t.includes("-") && !!(yr.indexOf(t) > -1 || /[A-Z]/u.test(t));
1547
- }
1548
- function ps(t, { style: e, vars: n }, s, i) {
1549
- Object.assign(t.style, e, i && i.getProjectionStyles(s));
1550
- for (const r in n) t.style.setProperty(r, n[r]);
2555
+ function Fo(t, e) {
2556
+ const n = O(Vt).strict;
2557
+ if (process.env.NODE_ENV !== "production" && e && n) {
2558
+ const s = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
2559
+ t.ignoreStrict ? ne(!1, s) : G(!1, s);
2560
+ }
1551
2561
  }
1552
- const ms = /* @__PURE__ */ new Set(["baseFrequency", "diffuseConstant", "kernelMatrix", "kernelUnitLength", "keySplines", "keyTimes", "limitingConeAngle", "markerHeight", "markerWidth", "numOctaves", "targetX", "targetY", "surfaceScale", "specularConstant", "specularExponent", "stdDeviation", "tableValues", "viewBox", "gradientTransform", "pathLength", "startOffset", "textLength", "lengthAdjust"]);
1553
- function fs(t, e, n, s) {
1554
- ps(t, e, void 0, s);
1555
- for (const i in e.attrs) t.setAttribute(ms.has(i) ? i : wt(i), e.attrs[i]);
2562
+ function Do(t) {
2563
+ const { drag: e, layout: n } = ee;
2564
+ if (!e && !n)
2565
+ return {};
2566
+ const s = { ...e, ...n };
2567
+ return {
2568
+ MeasureLayout: e != null && e.isEnabled(t) || n != null && n.isEnabled(t) ? s.MeasureLayout : void 0,
2569
+ ProjectionNode: s.ProjectionNode
2570
+ };
1556
2571
  }
1557
- function vs(t, { layout: e, layoutId: n }) {
1558
- return q.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!tr[t] || t === "opacity");
2572
+ const Ro = [
2573
+ "animate",
2574
+ "circle",
2575
+ "defs",
2576
+ "desc",
2577
+ "ellipse",
2578
+ "g",
2579
+ "image",
2580
+ "line",
2581
+ "filter",
2582
+ "marker",
2583
+ "mask",
2584
+ "metadata",
2585
+ "path",
2586
+ "pattern",
2587
+ "polygon",
2588
+ "polyline",
2589
+ "rect",
2590
+ "stop",
2591
+ "switch",
2592
+ "symbol",
2593
+ "svg",
2594
+ "text",
2595
+ "tspan",
2596
+ "use",
2597
+ "view"
2598
+ ];
2599
+ function St(t) {
2600
+ return (
2601
+ /**
2602
+ * If it's not a string, it's a custom React component. Currently we only support
2603
+ * HTML custom React components.
2604
+ */
2605
+ typeof t != "string" || /**
2606
+ * If it contains a dash, the element is a custom HTML webcomponent.
2607
+ */
2608
+ t.includes("-") ? !1 : (
2609
+ /**
2610
+ * If it's in our list of lowercase SVG tags, it's an SVG component
2611
+ */
2612
+ !!(Ro.indexOf(t) > -1 || /**
2613
+ * If it contains a capital letter, it's an SVG component
2614
+ */
2615
+ /[A-Z]/u.test(t))
2616
+ )
2617
+ );
2618
+ }
2619
+ function ds(t, { style: e, vars: n }, s, i) {
2620
+ Object.assign(t.style, e, i && i.getProjectionStyles(s));
2621
+ for (const r in n)
2622
+ t.style.setProperty(r, n[r]);
2623
+ }
2624
+ const fs = /* @__PURE__ */ new Set([
2625
+ "baseFrequency",
2626
+ "diffuseConstant",
2627
+ "kernelMatrix",
2628
+ "kernelUnitLength",
2629
+ "keySplines",
2630
+ "keyTimes",
2631
+ "limitingConeAngle",
2632
+ "markerHeight",
2633
+ "markerWidth",
2634
+ "numOctaves",
2635
+ "targetX",
2636
+ "targetY",
2637
+ "surfaceScale",
2638
+ "specularConstant",
2639
+ "specularExponent",
2640
+ "stdDeviation",
2641
+ "tableValues",
2642
+ "viewBox",
2643
+ "gradientTransform",
2644
+ "pathLength",
2645
+ "startOffset",
2646
+ "textLength",
2647
+ "lengthAdjust"
2648
+ ]);
2649
+ function hs(t, e, n, s) {
2650
+ ds(t, e, void 0, s);
2651
+ for (const i in e.attrs)
2652
+ t.setAttribute(fs.has(i) ? i : wt(i), e.attrs[i]);
2653
+ }
2654
+ function ps(t, { layout: e, layoutId: n }) {
2655
+ return z.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!Qr[t] || t === "opacity");
1559
2656
  }
1560
2657
  function xt(t, e, n) {
1561
2658
  var s;
1562
2659
  const { style: i } = t, r = {};
1563
- for (const o in i) (E(i[o]) || e.style && E(e.style[o]) || vs(o, t) || ((s = n == null ? void 0 : n.getValue(o)) === null || s === void 0 ? void 0 : s.liveStyle) !== void 0) && (r[o] = i[o]);
2660
+ for (const o in i)
2661
+ (F(i[o]) || e.style && F(e.style[o]) || ps(o, t) || ((s = n == null ? void 0 : n.getValue(o)) === null || s === void 0 ? void 0 : s.liveStyle) !== void 0) && (r[o] = i[o]);
1564
2662
  return r;
1565
2663
  }
1566
- function gs(t, e, n) {
2664
+ function ms(t, e, n) {
1567
2665
  const s = xt(t, e, n);
1568
- for (const i in t) (E(t[i]) || E(e[i])) && (s[he.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i] = t[i]);
2666
+ for (const i in t)
2667
+ if (F(t[i]) || F(e[i])) {
2668
+ const r = fe.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
2669
+ s[r] = t[i];
2670
+ }
1569
2671
  return s;
1570
2672
  }
1571
- const ys = (t) => (e, n) => {
1572
- const s = O(Fe), i = O(as), r = () => function({ scrapeMotionValuesFromProps: o, createRenderState: a, onMount: l }, c, u, h) {
1573
- const d = { latestValues: wr(c, u, h, o), renderState: a() };
1574
- return l && (d.mount = (f) => l(c, f, d)), d;
1575
- }(t, e, s, i);
1576
- return n ? r() : function(o) {
1577
- const a = Z(null);
1578
- return a.current === null && (a.current = o()), a.current;
1579
- }(r);
2673
+ function Io(t) {
2674
+ const e = Z(null);
2675
+ return e.current === null && (e.current = t()), e.current;
2676
+ }
2677
+ function Oo({ scrapeMotionValuesFromProps: t, createRenderState: e, onMount: n }, s, i, r) {
2678
+ const o = {
2679
+ latestValues: Eo(s, i, r, t),
2680
+ renderState: e()
2681
+ };
2682
+ return n && (o.mount = (a) => n(s, a, o)), o;
2683
+ }
2684
+ const gs = (t) => (e, n) => {
2685
+ const s = O(Ie), i = O(rs), r = () => Oo(t, e, s, i);
2686
+ return n ? r() : Io(r);
1580
2687
  };
1581
- function wr(t, e, n, s) {
2688
+ function Eo(t, e, n, s) {
1582
2689
  const i = {}, r = s(t, {});
1583
- for (const d in r) i[d] = sr(r[d]);
2690
+ for (const d in r)
2691
+ i[d] = to(r[d]);
1584
2692
  let { initial: o, animate: a } = t;
1585
- const l = Oe(t), c = ds(t);
1586
- e && c && !l && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate));
1587
- let u = !!n && n.initial === !1;
1588
- u = u || o === !1;
1589
- const h = u ? a : o;
1590
- if (h && typeof h != "boolean" && !Ce(h)) {
1591
- const d = Array.isArray(h) ? h : [h];
1592
- for (let f = 0; f < d.length; f++) {
1593
- const v = it(t, d[f]);
1594
- if (v) {
1595
- const { transitionEnd: p, transition: g, ...m } = v;
1596
- for (const S in m) {
1597
- let x = m[S];
1598
- Array.isArray(x) && (x = x[u ? x.length - 1 : 0]), x !== null && (i[S] = x);
2693
+ const l = Oe(t), u = cs(t);
2694
+ e && u && !l && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate));
2695
+ let c = n ? n.initial === !1 : !1;
2696
+ c = c || o === !1;
2697
+ const f = c ? a : o;
2698
+ if (f && typeof f != "boolean" && !Ce(f)) {
2699
+ const d = Array.isArray(f) ? f : [f];
2700
+ for (let h = 0; h < d.length; h++) {
2701
+ const y = st(t, d[h]);
2702
+ if (y) {
2703
+ const { transitionEnd: v, transition: b, ...p } = y;
2704
+ for (const g in p) {
2705
+ let V = p[g];
2706
+ if (Array.isArray(V)) {
2707
+ const A = c ? V.length - 1 : 0;
2708
+ V = V[A];
2709
+ }
2710
+ V !== null && (i[g] = V);
1599
2711
  }
1600
- for (const S in p) i[S] = p[S];
2712
+ for (const g in v)
2713
+ i[g] = v[g];
1601
2714
  }
1602
2715
  }
1603
2716
  }
1604
2717
  return i;
1605
2718
  }
1606
- const br = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {} }), Sr = () => ({ style: {}, transform: {}, transformOrigin: {}, vars: {}, attrs: {} }), un = (t, e) => e && typeof t == "number" ? e.transform(t) : t, Tr = { x: "translateX", y: "translateY", z: "translateZ", transformPerspective: "perspective" }, xr = he.length;
1607
- function At(t, e, n) {
2719
+ const At = () => ({
2720
+ style: {},
2721
+ transform: {},
2722
+ transformOrigin: {},
2723
+ vars: {}
2724
+ }), ys = () => ({
2725
+ ...At(),
2726
+ attrs: {}
2727
+ }), vs = (t, e) => e && typeof t == "number" ? e.transform(t) : t, ko = {
2728
+ x: "translateX",
2729
+ y: "translateY",
2730
+ z: "translateZ",
2731
+ transformPerspective: "perspective"
2732
+ }, Lo = fe.length;
2733
+ function No(t, e, n) {
2734
+ let s = "", i = !0;
2735
+ for (let r = 0; r < Lo; r++) {
2736
+ const o = fe[r], a = t[o];
2737
+ if (a === void 0)
2738
+ continue;
2739
+ let l = !0;
2740
+ if (typeof a == "number" ? l = a === (o.startsWith("scale") ? 1 : 0) : l = parseFloat(a) === 0, !l || n) {
2741
+ const u = vs(a, ft[o]);
2742
+ if (!l) {
2743
+ i = !1;
2744
+ const c = ko[o] || o;
2745
+ s += `${c}(${u}) `;
2746
+ }
2747
+ n && (e[o] = u);
2748
+ }
2749
+ }
2750
+ return s = s.trim(), n ? s = n(e, i ? "" : s) : i && (s = "none"), s;
2751
+ }
2752
+ function Mt(t, e, n) {
1608
2753
  const { style: s, vars: i, transformOrigin: r } = t;
1609
2754
  let o = !1, a = !1;
1610
2755
  for (const l in e) {
1611
- const c = e[l];
1612
- if (q.has(l)) o = !0;
1613
- else if (kn(l)) i[l] = c;
1614
- else {
1615
- const u = un(c, _e[l]);
1616
- l.startsWith("origin") ? (a = !0, r[l] = u) : s[l] = u;
2756
+ const u = e[l];
2757
+ if (z.has(l)) {
2758
+ o = !0;
2759
+ continue;
2760
+ } else if (Cn(l)) {
2761
+ i[l] = u;
2762
+ continue;
2763
+ } else {
2764
+ const c = vs(u, ft[l]);
2765
+ l.startsWith("origin") ? (a = !0, r[l] = c) : s[l] = c;
1617
2766
  }
1618
2767
  }
1619
- if (e.transform || (o || n ? s.transform = function(l, c, u) {
1620
- let h = "", d = !0;
1621
- for (let f = 0; f < xr; f++) {
1622
- const v = he[f], p = l[v];
1623
- if (p === void 0) continue;
1624
- let g = !0;
1625
- if (g = typeof p == "number" ? p === (v.startsWith("scale") ? 1 : 0) : parseFloat(p) === 0, !g || u) {
1626
- const m = un(p, _e[v]);
1627
- g || (d = !1, h += `${Tr[v] || v}(${m}) `), u && (c[v] = m);
1628
- }
1629
- }
1630
- return h = h.trim(), u ? h = u(c, d ? "" : h) : d && (h = "none"), h;
1631
- }(e, t.transform, n) : s.transform && (s.transform = "none")), a) {
1632
- const { originX: l = "50%", originY: c = "50%", originZ: u = 0 } = r;
1633
- s.transformOrigin = `${l} ${c} ${u}`;
2768
+ if (e.transform || (o || n ? s.transform = No(e, t.transform, n) : s.transform && (s.transform = "none")), a) {
2769
+ const { originX: l = "50%", originY: u = "50%", originZ: c = 0 } = r;
2770
+ s.transformOrigin = `${l} ${u} ${c}`;
1634
2771
  }
1635
2772
  }
1636
- function cn(t, e, n) {
1637
- return typeof t == "string" ? t : b.transform(e + n * t);
2773
+ function un(t, e, n) {
2774
+ return typeof t == "string" ? t : m.transform(e + n * t);
2775
+ }
2776
+ function Bo(t, e, n) {
2777
+ const s = un(e, t.x, t.width), i = un(n, t.y, t.height);
2778
+ return `${s} ${i}`;
1638
2779
  }
1639
- const Ar = { offset: "stroke-dashoffset", array: "stroke-dasharray" }, Vr = { offset: "strokeDashoffset", array: "strokeDasharray" };
1640
- function Vt(t, { attrX: e, attrY: n, attrScale: s, originX: i, originY: r, pathLength: o, pathSpacing: a = 1, pathOffset: l = 0, ...c }, u, h) {
1641
- if (At(t, c, h), u) return void (t.style.viewBox && (t.attrs.viewBox = t.style.viewBox));
2780
+ const Ko = {
2781
+ offset: "stroke-dashoffset",
2782
+ array: "stroke-dasharray"
2783
+ }, _o = {
2784
+ offset: "strokeDashoffset",
2785
+ array: "strokeDasharray"
2786
+ };
2787
+ function $o(t, e, n = 1, s = 0, i = !0) {
2788
+ t.pathLength = 1;
2789
+ const r = i ? Ko : _o;
2790
+ t[r.offset] = m.transform(-s);
2791
+ const o = m.transform(e), a = m.transform(n);
2792
+ t[r.array] = `${o} ${a}`;
2793
+ }
2794
+ function Ct(t, {
2795
+ attrX: e,
2796
+ attrY: n,
2797
+ attrScale: s,
2798
+ originX: i,
2799
+ originY: r,
2800
+ pathLength: o,
2801
+ pathSpacing: a = 1,
2802
+ pathOffset: l = 0,
2803
+ // This is object creation, which we try to avoid per-frame.
2804
+ ...u
2805
+ }, c, f) {
2806
+ if (Mt(t, u, f), c) {
2807
+ t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
2808
+ return;
2809
+ }
1642
2810
  t.attrs = t.style, t.style = {};
1643
- const { attrs: d, style: f, dimensions: v } = t;
1644
- d.transform && (v && (f.transform = d.transform), delete d.transform), v && (i !== void 0 || r !== void 0 || f.transform) && (f.transformOrigin = function(p, g, m) {
1645
- return `${cn(g, p.x, p.width)} ${cn(m, p.y, p.height)}`;
1646
- }(v, i !== void 0 ? i : 0.5, r !== void 0 ? r : 0.5)), e !== void 0 && (d.x = e), n !== void 0 && (d.y = n), s !== void 0 && (d.scale = s), o !== void 0 && function(p, g, m = 1, S = 0, x = !0) {
1647
- p.pathLength = 1;
1648
- const C = x ? Ar : Vr;
1649
- p[C.offset] = b.transform(-S);
1650
- const y = b.transform(g), w = b.transform(m);
1651
- p[C.array] = `${y} ${w}`;
1652
- }(d, o, a, l, !1);
1653
- }
1654
- const Ct = (t) => typeof t == "string" && t.toLowerCase() === "svg", Cr = { useVisualState: ys({ scrapeMotionValuesFromProps: gs, createRenderState: Sr, onMount: (t, e, { renderState: n, latestValues: s }) => {
1655
- F.read(() => {
1656
- try {
1657
- n.dimensions = typeof e.getBBox == "function" ? e.getBBox() : e.getBoundingClientRect();
1658
- } catch {
1659
- n.dimensions = { x: 0, y: 0, width: 0, height: 0 };
2811
+ const { attrs: d, style: h, dimensions: y } = t;
2812
+ d.transform && (y && (h.transform = d.transform), delete d.transform), y && (i !== void 0 || r !== void 0 || h.transform) && (h.transformOrigin = Bo(y, i !== void 0 ? i : 0.5, r !== void 0 ? r : 0.5)), e !== void 0 && (d.x = e), n !== void 0 && (d.y = n), s !== void 0 && (d.scale = s), o !== void 0 && $o(d, o, a, l, !1);
2813
+ }
2814
+ const Pt = (t) => typeof t == "string" && t.toLowerCase() === "svg", jo = {
2815
+ useVisualState: gs({
2816
+ scrapeMotionValuesFromProps: ms,
2817
+ createRenderState: ys,
2818
+ onMount: (t, e, { renderState: n, latestValues: s }) => {
2819
+ R.read(() => {
2820
+ try {
2821
+ n.dimensions = typeof e.getBBox == "function" ? e.getBBox() : e.getBoundingClientRect();
2822
+ } catch {
2823
+ n.dimensions = {
2824
+ x: 0,
2825
+ y: 0,
2826
+ width: 0,
2827
+ height: 0
2828
+ };
2829
+ }
2830
+ }), R.render(() => {
2831
+ Ct(n, s, Pt(e.tagName), t.transformTemplate), hs(e, n);
2832
+ });
1660
2833
  }
1661
- }), F.render(() => {
1662
- Vt(n, s, Ct(e.tagName), t.transformTemplate), fs(e, n);
1663
- });
1664
- } }) }, Mr = { useVisualState: ys({ scrapeMotionValuesFromProps: xt, createRenderState: br }) };
1665
- function ws(t, e, n) {
1666
- for (const s in e) E(e[s]) || vs(s, n) || (t[s] = e[s]);
1667
- }
1668
- function Pr(t, e) {
1669
- const n = {};
1670
- return ws(n, t.style || {}, t), Object.assign(n, function({ transformTemplate: s }, i) {
1671
- return Ve(() => {
1672
- const r = { style: {}, transform: {}, transformOrigin: {}, vars: {} };
1673
- return At(r, i, s), Object.assign({}, r.vars, r.style);
1674
- }, [i]);
1675
- }(t, e)), n;
1676
- }
1677
- function kr(t, e) {
1678
- const n = {}, s = Pr(t, e);
1679
- return t.drag && t.dragListener !== !1 && (n.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = t.drag === !0 ? "none" : "pan-" + (t.drag === "x" ? "y" : "x")), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = s, n;
1680
- }
1681
- const Er = /* @__PURE__ */ new Set(["animate", "exit", "variants", "initial", "style", "values", "variants", "transition", "transformTemplate", "custom", "inherit", "onBeforeLayoutMeasure", "onAnimationStart", "onAnimationComplete", "onUpdate", "onDragStart", "onDrag", "onDragEnd", "onMeasureDragConstraints", "onDirectionLock", "onDragTransitionEnd", "_dragX", "_dragY", "onHoverStart", "onHoverEnd", "onViewportEnter", "onViewportLeave", "globalTapTarget", "ignoreStrict", "viewport"]);
1682
- function Ae(t) {
1683
- return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Er.has(t);
1684
- }
1685
- let bs = (t) => !Ae(t);
2834
+ })
2835
+ }, Wo = {
2836
+ useVisualState: gs({
2837
+ scrapeMotionValuesFromProps: xt,
2838
+ createRenderState: At
2839
+ })
2840
+ };
2841
+ function bs(t, e, n) {
2842
+ for (const s in e)
2843
+ !F(e[s]) && !ps(s, n) && (t[s] = e[s]);
2844
+ }
2845
+ function Go({ transformTemplate: t }, e) {
2846
+ return Ae(() => {
2847
+ const n = At();
2848
+ return Mt(n, e, t), Object.assign({}, n.vars, n.style);
2849
+ }, [e]);
2850
+ }
2851
+ function Uo(t, e) {
2852
+ const n = t.style || {}, s = {};
2853
+ return bs(s, n, t), Object.assign(s, Go(t, e)), s;
2854
+ }
2855
+ function zo(t, e) {
2856
+ const n = {}, s = Uo(t, e);
2857
+ return t.drag && t.dragListener !== !1 && (n.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = s, n;
2858
+ }
2859
+ const Ho = /* @__PURE__ */ new Set([
2860
+ "animate",
2861
+ "exit",
2862
+ "variants",
2863
+ "initial",
2864
+ "style",
2865
+ "values",
2866
+ "variants",
2867
+ "transition",
2868
+ "transformTemplate",
2869
+ "custom",
2870
+ "inherit",
2871
+ "onBeforeLayoutMeasure",
2872
+ "onAnimationStart",
2873
+ "onAnimationComplete",
2874
+ "onUpdate",
2875
+ "onDragStart",
2876
+ "onDrag",
2877
+ "onDragEnd",
2878
+ "onMeasureDragConstraints",
2879
+ "onDirectionLock",
2880
+ "onDragTransitionEnd",
2881
+ "_dragX",
2882
+ "_dragY",
2883
+ "onHoverStart",
2884
+ "onHoverEnd",
2885
+ "onViewportEnter",
2886
+ "onViewportLeave",
2887
+ "globalTapTarget",
2888
+ "ignoreStrict",
2889
+ "viewport"
2890
+ ]);
2891
+ function xe(t) {
2892
+ return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Ho.has(t);
2893
+ }
2894
+ let ws = (t) => !xe(t);
2895
+ function qo(t) {
2896
+ t && (ws = (e) => e.startsWith("on") ? !xe(e) : t(e));
2897
+ }
1686
2898
  try {
1687
- (hn = require("@emotion/is-prop-valid").default) && (bs = (t) => t.startsWith("on") ? !Ae(t) : hn(t));
2899
+ qo(require("@emotion/is-prop-valid").default);
1688
2900
  } catch {
1689
2901
  }
1690
- var hn;
1691
- function Fr(t, e, n, s) {
1692
- const i = Ve(() => {
1693
- const r = { style: {}, transform: {}, transformOrigin: {}, vars: {}, attrs: {} };
1694
- return Vt(r, e, Ct(s), t.transformTemplate), { ...r.attrs, style: { ...r.style } };
2902
+ function Yo(t, e, n) {
2903
+ const s = {};
2904
+ for (const i in t)
2905
+ i === "values" && typeof t.values == "object" || (ws(i) || n === !0 && xe(i) || !e && !xe(i) || // If trying to use native HTML drag events, forward drag listeners
2906
+ t.draggable && i.startsWith("onDrag")) && (s[i] = t[i]);
2907
+ return s;
2908
+ }
2909
+ function Xo(t, e, n, s) {
2910
+ const i = Ae(() => {
2911
+ const r = ys();
2912
+ return Ct(r, e, Pt(s), t.transformTemplate), {
2913
+ ...r.attrs,
2914
+ style: { ...r.style }
2915
+ };
1695
2916
  }, [e]);
1696
2917
  if (t.style) {
1697
2918
  const r = {};
1698
- ws(r, t.style, t), i.style = { ...r, ...i.style };
2919
+ bs(r, t.style, t), i.style = { ...r, ...i.style };
1699
2920
  }
1700
2921
  return i;
1701
2922
  }
1702
- function Or(t = !1) {
1703
- return (e, n, s, { latestValues: i }, r) => {
1704
- const o = (Tt(e) ? Fr : kr)(n, i, r, e), a = function(h, d, f) {
1705
- const v = {};
1706
- for (const p in h) p === "values" && typeof h.values == "object" || (bs(p) || f === !0 && Ae(p) || !d && !Ae(p) || h.draggable && p.startsWith("onDrag")) && (v[p] = h[p]);
1707
- return v;
1708
- }(n, typeof e == "string", t), l = e !== vn ? { ...a, ...o, ref: s } : {}, { children: c } = n, u = Ve(() => E(c) ? c.get() : c, [c]);
1709
- return Vs(e, { ...l, children: u });
2923
+ function Zo(t = !1) {
2924
+ return (n, s, i, { latestValues: r }, o) => {
2925
+ const l = (St(n) ? Xo : zo)(s, r, o, n), u = Yo(s, typeof n == "string", t), c = n !== hn ? { ...u, ...l, ref: i } : {}, { children: f } = s, d = Ae(() => F(f) ? f.get() : f, [f]);
2926
+ return Cs(n, {
2927
+ ...c,
2928
+ children: d
2929
+ });
1710
2930
  };
1711
2931
  }
1712
- function Ir(t, e) {
1713
- return function(n, { forwardMotionProps: s } = { forwardMotionProps: !1 }) {
1714
- return vr({ ...Tt(n) ? Cr : Mr, preloadedFeatures: t, useRender: Or(s), createVisualElement: e, Component: n });
2932
+ function Jo(t, e) {
2933
+ return function(s, { forwardMotionProps: i } = { forwardMotionProps: !1 }) {
2934
+ const o = {
2935
+ ...St(s) ? jo : Wo,
2936
+ preloadedFeatures: t,
2937
+ useRender: Zo(i),
2938
+ createVisualElement: e,
2939
+ Component: s
2940
+ };
2941
+ return Co(o);
1715
2942
  };
1716
2943
  }
1717
- const Ke = { current: null }, dn = { current: !1 }, pn = /* @__PURE__ */ new WeakMap(), Rr = [...On, P, se], mn = ["AnimationStart", "AnimationComplete", "Update", "BeforeLayoutMeasure", "LayoutMeasure", "LayoutAnimationStart", "LayoutAnimationComplete"];
1718
- class Dr {
2944
+ const tt = { current: null }, Ts = { current: !1 };
2945
+ function Qo() {
2946
+ if (Ts.current = !0, !!Tt)
2947
+ if (window.matchMedia) {
2948
+ const t = window.matchMedia("(prefers-reduced-motion)"), e = () => tt.current = t.matches;
2949
+ t.addListener(e), e();
2950
+ } else
2951
+ tt.current = !1;
2952
+ }
2953
+ function ea(t, e, n) {
2954
+ for (const s in e) {
2955
+ const i = e[s], r = n[s];
2956
+ if (F(i))
2957
+ t.addValue(s, i), process.env.NODE_ENV === "development" && Me(i.version === "11.15.0", `Attempting to mix Motion versions ${i.version} with 11.15.0 may not work as expected.`);
2958
+ else if (F(r))
2959
+ t.addValue(s, Se(i, { owner: t }));
2960
+ else if (r !== i)
2961
+ if (t.hasValue(s)) {
2962
+ const o = t.getValue(s);
2963
+ o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
2964
+ } else {
2965
+ const o = t.getStaticValue(s);
2966
+ t.addValue(s, Se(o !== void 0 ? o : i, { owner: t }));
2967
+ }
2968
+ }
2969
+ for (const s in n)
2970
+ e[s] === void 0 && t.removeValue(s);
2971
+ return e;
2972
+ }
2973
+ const cn = /* @__PURE__ */ new WeakMap(), ta = [...Dn, C, ie], na = (t) => ta.find(Fn(t)), dn = [
2974
+ "AnimationStart",
2975
+ "AnimationComplete",
2976
+ "Update",
2977
+ "BeforeLayoutMeasure",
2978
+ "LayoutMeasure",
2979
+ "LayoutAnimationStart",
2980
+ "LayoutAnimationComplete"
2981
+ ];
2982
+ class sa {
2983
+ /**
2984
+ * This method takes React props and returns found MotionValues. For example, HTML
2985
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2986
+ *
2987
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2988
+ * intended to be one.
2989
+ */
1719
2990
  scrapeMotionValuesFromProps(e, n, s) {
1720
2991
  return {};
1721
2992
  }
1722
2993
  constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
1723
- 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 = () => {
2994
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = ut, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
1724
2995
  this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
1725
2996
  }, this.renderScheduledAt = 0, this.scheduleRender = () => {
1726
- const d = L.now();
1727
- this.renderScheduledAt < d && (this.renderScheduledAt = d, F.render(this.render, !1, !0));
2997
+ const d = K.now();
2998
+ this.renderScheduledAt < d && (this.renderScheduledAt = d, R.render(this.render, !1, !0));
1728
2999
  };
1729
- const { latestValues: l, renderState: c } = o;
1730
- this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = c, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Oe(n), this.isVariantNode = ds(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
1731
- const { willChange: u, ...h } = this.scrapeMotionValuesFromProps(n, {}, this);
1732
- for (const d in h) {
1733
- const f = h[d];
1734
- l[d] !== void 0 && E(f) && f.set(l[d], !1);
3000
+ const { latestValues: l, renderState: u } = o;
3001
+ this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = u, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Oe(n), this.isVariantNode = cs(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
3002
+ const { willChange: c, ...f } = this.scrapeMotionValuesFromProps(n, {}, this);
3003
+ for (const d in f) {
3004
+ const h = f[d];
3005
+ l[d] !== void 0 && F(h) && h.set(l[d], !1);
1735
3006
  }
1736
3007
  }
1737
3008
  mount(e) {
1738
- this.current = e, pn.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), dn.current || function() {
1739
- if (dn.current = !0, bt) if (window.matchMedia) {
1740
- const n = window.matchMedia("(prefers-reduced-motion)"), s = () => Ke.current = n.matches;
1741
- n.addListener(s), s();
1742
- } else Ke.current = !1;
1743
- }(), this.shouldReduceMotion = this.reducedMotionConfig !== "never" && (this.reducedMotionConfig === "always" || Ke.current), process.env.NODE_ENV !== "production" && we(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);
3009
+ this.current = e, cn.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), Ts.current || Qo(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : tt.current, process.env.NODE_ENV !== "production" && Me(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);
1744
3010
  }
1745
3011
  unmount() {
1746
- pn.delete(this.current), this.projection && this.projection.unmount(), Ye(this.notifyUpdate), Ye(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
1747
- for (const e in this.events) this.events[e].clear();
3012
+ cn.delete(this.current), this.projection && this.projection.unmount(), We(this.notifyUpdate), We(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
3013
+ for (const e in this.events)
3014
+ this.events[e].clear();
1748
3015
  for (const e in this.features) {
1749
3016
  const n = this.features[e];
1750
3017
  n && (n.unmount(), n.isMounted = !1);
@@ -1753,8 +3020,8 @@ class Dr {
1753
3020
  }
1754
3021
  bindToMotionValue(e, n) {
1755
3022
  this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
1756
- const s = q.has(e), i = n.on("change", (a) => {
1757
- this.latestValues[e] = a, this.props.onUpdate && F.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
3023
+ const s = z.has(e), i = n.on("change", (a) => {
3024
+ this.latestValues[e] = a, this.props.onUpdate && R.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
1758
3025
  }), r = n.on("renderRequest", this.scheduleRender);
1759
3026
  let o;
1760
3027
  window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
@@ -1762,13 +3029,14 @@ class Dr {
1762
3029
  });
1763
3030
  }
1764
3031
  sortNodePosition(e) {
1765
- return this.current && this.sortInstanceNodePosition && this.type === e.type ? this.sortInstanceNodePosition(this.current, e.current) : 0;
3032
+ return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
1766
3033
  }
1767
3034
  updateFeatures() {
1768
3035
  let e = "animation";
1769
- for (e in Q) {
1770
- const n = Q[e];
1771
- if (!n) continue;
3036
+ for (e in ee) {
3037
+ const n = ee[e];
3038
+ if (!n)
3039
+ continue;
1772
3040
  const { isEnabled: s, Feature: i } = n;
1773
3041
  if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
1774
3042
  const r = this.features[e];
@@ -1779,8 +3047,13 @@ class Dr {
1779
3047
  triggerBuild() {
1780
3048
  this.build(this.renderState, this.latestValues, this.props);
1781
3049
  }
3050
+ /**
3051
+ * Measure the current viewport box with or without transforms.
3052
+ * Only measures axis-aligned boxes, rotate and skew must be manually
3053
+ * removed with a re-render to work.
3054
+ */
1782
3055
  measureViewportBox() {
1783
- return this.current ? this.measureInstanceViewportBox(this.current, this.props) : { x: { min: 0, max: 0 }, y: { min: 0, max: 0 } };
3056
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : is();
1784
3057
  }
1785
3058
  getStaticValue(e) {
1786
3059
  return this.latestValues[e];
@@ -1788,37 +3061,32 @@ class Dr {
1788
3061
  setStaticValue(e, n) {
1789
3062
  this.latestValues[e] = n;
1790
3063
  }
3064
+ /**
3065
+ * Update the provided props. Ensure any newly-added motion values are
3066
+ * added to our map, old ones removed, and listeners updated.
3067
+ */
1791
3068
  update(e, n) {
1792
3069
  (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
1793
- for (let s = 0; s < mn.length; s++) {
1794
- const i = mn[s];
3070
+ for (let s = 0; s < dn.length; s++) {
3071
+ const i = dn[s];
1795
3072
  this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
1796
- const r = e["on" + i];
1797
- r && (this.propEventSubscriptions[i] = this.on(i, r));
3073
+ const r = "on" + i, o = e[r];
3074
+ o && (this.propEventSubscriptions[i] = this.on(i, o));
1798
3075
  }
1799
- this.prevMotionValues = function(s, i, r) {
1800
- for (const o in i) {
1801
- const a = i[o], l = r[o];
1802
- if (E(a)) s.addValue(o, a), process.env.NODE_ENV === "development" && we(a.version === "11.15.0", `Attempting to mix Motion versions ${a.version} with 11.15.0 may not work as expected.`);
1803
- else if (E(l)) s.addValue(o, ye(a, { owner: s }));
1804
- else if (l !== a) if (s.hasValue(o)) {
1805
- const c = s.getValue(o);
1806
- c.liveStyle === !0 ? c.jump(a) : c.hasAnimated || c.set(a);
1807
- } else {
1808
- const c = s.getStaticValue(o);
1809
- s.addValue(o, ye(c !== void 0 ? c : a, { owner: s }));
1810
- }
1811
- }
1812
- for (const o in r) i[o] === void 0 && s.removeValue(o);
1813
- return i;
1814
- }(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
3076
+ this.prevMotionValues = ea(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
1815
3077
  }
1816
3078
  getProps() {
1817
3079
  return this.props;
1818
3080
  }
3081
+ /**
3082
+ * Returns the variant definition with a given name.
3083
+ */
1819
3084
  getVariant(e) {
1820
3085
  return this.props.variants ? this.props.variants[e] : void 0;
1821
3086
  }
3087
+ /**
3088
+ * Returns the defined default transition on this component.
3089
+ */
1822
3090
  getDefaultTransition() {
1823
3091
  return this.props.transition;
1824
3092
  }
@@ -1828,61 +3096,88 @@ class Dr {
1828
3096
  getClosestVariantNode() {
1829
3097
  return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
1830
3098
  }
3099
+ /**
3100
+ * Add a child visual element to our set of children.
3101
+ */
1831
3102
  addVariantChild(e) {
1832
3103
  const n = this.getClosestVariantNode();
1833
- if (n) return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
3104
+ if (n)
3105
+ return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
1834
3106
  }
3107
+ /**
3108
+ * Add a motion value and bind it to this visual element.
3109
+ */
1835
3110
  addValue(e, n) {
1836
3111
  const s = this.values.get(e);
1837
3112
  n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
1838
3113
  }
3114
+ /**
3115
+ * Remove a motion value and unbind any active subscriptions.
3116
+ */
1839
3117
  removeValue(e) {
1840
3118
  this.values.delete(e);
1841
3119
  const n = this.valueSubscriptions.get(e);
1842
3120
  n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
1843
3121
  }
3122
+ /**
3123
+ * Check whether we have a motion value for this key
3124
+ */
1844
3125
  hasValue(e) {
1845
3126
  return this.values.has(e);
1846
3127
  }
1847
3128
  getValue(e, n) {
1848
- if (this.props.values && this.props.values[e]) return this.props.values[e];
3129
+ if (this.props.values && this.props.values[e])
3130
+ return this.props.values[e];
1849
3131
  let s = this.values.get(e);
1850
- return s === void 0 && n !== void 0 && (s = ye(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
3132
+ return s === void 0 && n !== void 0 && (s = Se(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
1851
3133
  }
3134
+ /**
3135
+ * If we're trying to animate to a previously unencountered value,
3136
+ * we need to check for it in our state and as a last resort read it
3137
+ * directly from the instance (which might have performance implications).
3138
+ */
1852
3139
  readValue(e, n) {
1853
3140
  var s;
1854
- let i = this.latestValues[e] === void 0 && this.current ? (s = this.getBaseTargetFromProps(this.props, e)) !== null && s !== void 0 ? s : this.readValueFromInstance(this.current, e, this.options) : this.latestValues[e];
1855
- var r;
1856
- return i != null && (typeof i == "string" && (Mn(i) || Cn(i)) ? i = parseFloat(i) : (r = i, !Rr.find(Fn(r)) && se.test(n) && (i = Ln(e, n))), this.setBaseTarget(e, E(i) ? i.get() : i)), E(i) ? i.get() : i;
3141
+ let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (s = this.getBaseTargetFromProps(this.props, e)) !== null && s !== void 0 ? s : this.readValueFromInstance(this.current, e, this.options);
3142
+ return i != null && (typeof i == "string" && (An(i) || xn(i)) ? i = parseFloat(i) : !na(i) && ie.test(n) && (i = Bn(e, n)), this.setBaseTarget(e, F(i) ? i.get() : i)), F(i) ? i.get() : i;
1857
3143
  }
3144
+ /**
3145
+ * Set the base target to later animate back to. This is currently
3146
+ * only hydrated on creation and when we first read a value.
3147
+ */
1858
3148
  setBaseTarget(e, n) {
1859
3149
  this.baseTarget[e] = n;
1860
3150
  }
3151
+ /**
3152
+ * Find the base target for a value thats been removed from all animation
3153
+ * props.
3154
+ */
1861
3155
  getBaseTarget(e) {
1862
3156
  var n;
1863
3157
  const { initial: s } = this.props;
1864
3158
  let i;
1865
3159
  if (typeof s == "string" || typeof s == "object") {
1866
- const o = it(this.props, s, (n = this.presenceContext) === null || n === void 0 ? void 0 : n.custom);
3160
+ const o = st(this.props, s, (n = this.presenceContext) === null || n === void 0 ? void 0 : n.custom);
1867
3161
  o && (i = o[e]);
1868
3162
  }
1869
- if (s && i !== void 0) return i;
3163
+ if (s && i !== void 0)
3164
+ return i;
1870
3165
  const r = this.getBaseTargetFromProps(this.props, e);
1871
- return r === void 0 || E(r) ? this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e] : r;
3166
+ return r !== void 0 && !F(r) ? r : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
1872
3167
  }
1873
3168
  on(e, n) {
1874
- return this.events[e] || (this.events[e] = new ts()), this.events[e].add(n);
3169
+ return this.events[e] || (this.events[e] = new Jn()), this.events[e].add(n);
1875
3170
  }
1876
3171
  notify(e, ...n) {
1877
3172
  this.events[e] && this.events[e].notify(...n);
1878
3173
  }
1879
3174
  }
1880
- class Ss extends Dr {
3175
+ class Vs extends sa {
1881
3176
  constructor() {
1882
- super(...arguments), this.KeyframeResolver = $n;
3177
+ super(...arguments), this.KeyframeResolver = Kn;
1883
3178
  }
1884
3179
  sortInstanceNodePosition(e, n) {
1885
- return 2 & e.compareDocumentPosition(n) ? 1 : -1;
3180
+ return e.compareDocumentPosition(n) & 2 ? 1 : -1;
1886
3181
  }
1887
3182
  getBaseTargetFromProps(e, n) {
1888
3183
  return e.style ? e.style[n] : void 0;
@@ -1893,87 +3188,87 @@ class Ss extends Dr {
1893
3188
  handleChildMotionValue() {
1894
3189
  this.childSubscription && (this.childSubscription(), delete this.childSubscription);
1895
3190
  const { children: e } = this.props;
1896
- E(e) && (this.childSubscription = e.on("change", (n) => {
3191
+ F(e) && (this.childSubscription = e.on("change", (n) => {
1897
3192
  this.current && (this.current.textContent = `${n}`);
1898
3193
  }));
1899
3194
  }
1900
3195
  }
1901
- class Br extends Ss {
3196
+ function ia(t) {
3197
+ return window.getComputedStyle(t);
3198
+ }
3199
+ class ra extends Vs {
1902
3200
  constructor() {
1903
- super(...arguments), this.type = "html", this.renderInstance = ps;
3201
+ super(...arguments), this.type = "html", this.renderInstance = ds;
1904
3202
  }
1905
3203
  readValueFromInstance(e, n) {
1906
- if (q.has(n)) {
1907
- const i = pt(n);
1908
- return i && i.default || 0;
1909
- }
1910
- {
1911
- const i = (s = e, window.getComputedStyle(s)), r = (kn(n) ? i.getPropertyValue(n) : i[n]) || 0;
1912
- return typeof r == "string" ? r.trim() : r;
3204
+ if (z.has(n)) {
3205
+ const s = ht(n);
3206
+ return s && s.default || 0;
3207
+ } else {
3208
+ const s = ia(e), i = (Cn(n) ? s.getPropertyValue(n) : s[n]) || 0;
3209
+ return typeof i == "string" ? i.trim() : i;
1913
3210
  }
1914
- var s;
1915
3211
  }
1916
3212
  measureInstanceViewportBox(e, { transformPagePoint: n }) {
1917
- return function(s, i) {
1918
- return function({ top: r, left: o, right: a, bottom: l }) {
1919
- return { x: { min: o, max: a }, y: { min: r, max: l } };
1920
- }(function(r, o) {
1921
- if (!o) return r;
1922
- const a = o({ x: r.left, y: r.top }), l = o({ x: r.right, y: r.bottom });
1923
- return { top: a.y, left: a.x, bottom: l.y, right: l.x };
1924
- }(s.getBoundingClientRect(), i));
1925
- }(e, n);
3213
+ return Xr(e, n);
1926
3214
  }
1927
3215
  build(e, n, s) {
1928
- At(e, n, s.transformTemplate);
3216
+ Mt(e, n, s.transformTemplate);
1929
3217
  }
1930
3218
  scrapeMotionValuesFromProps(e, n, s) {
1931
3219
  return xt(e, n, s);
1932
3220
  }
1933
3221
  }
1934
- class Nr extends Ss {
3222
+ class oa extends Vs {
1935
3223
  constructor() {
1936
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = Ji;
3224
+ super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = is;
1937
3225
  }
1938
3226
  getBaseTargetFromProps(e, n) {
1939
3227
  return e[n];
1940
3228
  }
1941
3229
  readValueFromInstance(e, n) {
1942
- if (q.has(n)) {
1943
- const s = pt(n);
3230
+ if (z.has(n)) {
3231
+ const s = ht(n);
1944
3232
  return s && s.default || 0;
1945
3233
  }
1946
- return n = ms.has(n) ? n : wt(n), e.getAttribute(n);
3234
+ return n = fs.has(n) ? n : wt(n), e.getAttribute(n);
1947
3235
  }
1948
3236
  scrapeMotionValuesFromProps(e, n, s) {
1949
- return gs(e, n, s);
3237
+ return ms(e, n, s);
1950
3238
  }
1951
3239
  build(e, n, s) {
1952
- Vt(e, n, this.isSVGTag, s.transformTemplate);
3240
+ Ct(e, n, this.isSVGTag, s.transformTemplate);
1953
3241
  }
1954
3242
  renderInstance(e, n, s, i) {
1955
- fs(e, n, 0, i);
3243
+ hs(e, n, s, i);
1956
3244
  }
1957
3245
  mount(e) {
1958
- this.isSVGTag = Ct(e.tagName), super.mount(e);
3246
+ this.isSVGTag = Pt(e.tagName), super.mount(e);
1959
3247
  }
1960
3248
  }
1961
- function Lr({ children: t, features: e, strict: n = !1 }) {
1962
- const [, s] = Cs(!We(e)), i = Z(void 0);
1963
- if (!We(e)) {
3249
+ const aa = (t, e) => St(t) ? new oa(e) : new ra(e, {
3250
+ allowProjection: t !== hn
3251
+ }), la = /* @__PURE__ */ Jo(), ua = /* @__PURE__ */ ks(la);
3252
+ function ca({ children: t, features: e, strict: n = !1 }) {
3253
+ const [, s] = Ps(!$e(e)), i = Z(void 0);
3254
+ if (!$e(e)) {
1964
3255
  const { renderer: r, ...o } = e;
1965
- i.current = r, nt(o);
3256
+ i.current = r, et(o);
1966
3257
  }
1967
- return st(() => {
1968
- We(e) && e().then(({ renderer: r, ...o }) => {
1969
- nt(o), i.current = r, s(!0);
3258
+ return nt(() => {
3259
+ $e(e) && e().then(({ renderer: r, ...o }) => {
3260
+ et(o), i.current = r, s(!0);
1970
3261
  });
1971
- }, []), I(St.Provider, { value: { renderer: i.current, strict: n }, children: t });
3262
+ }, []), E(Vt.Provider, { value: { renderer: i.current, strict: n }, children: t });
1972
3263
  }
1973
- function We(t) {
3264
+ function $e(t) {
1974
3265
  return typeof t == "function";
1975
3266
  }
1976
- const $r = { renderer: (t, e) => Tt(t) ? new Nr(e) : new Br(e, { allowProjection: t !== vn }), ...Gi, ...cr }, jr = Ms(Is(Ir()).div)`
3267
+ const da = {
3268
+ renderer: aa,
3269
+ ...Gr,
3270
+ ...bo
3271
+ }, fa = Fs(ua.div)`
1977
3272
  ${({ theme: t }) => `
1978
3273
  background-color: ${t.palette.white};
1979
3274
  box-shadow: ${t.shadows.lg};
@@ -1996,14 +3291,166 @@ const $r = { renderer: (t, e) => Tt(t) ? new Nr(e) : new Br(e, { allowProjection
1996
3291
  height: auto;
1997
3292
  }
1998
3293
  `}
1999
- `, to = ({ children: t, closeIconId: e = "close-menu", isOpen: n, items: s, onClose: i, primaryButtonText: r, primaryOnClick: o, secondaryButtonText: a, secondaryOnClick: l, title: c }) => {
2000
- const u = Ps(), h = Z(null), d = fn((f) => () => {
2001
- f(), i();
2002
- }, [i]);
2003
- return Os(h.current, () => {
2004
- i();
2005
- }, !0), I(Lr, { features: $r, children: I(jr, { animate: n ? { display: "block", x: 0 } : { transitionEnd: { display: "none" }, x: "100%" }, initial: { display: "none", x: "100%" }, ref: h, transition: { bounce: 0, duration: 0.6, type: "spring" }, children: H(z, { height: "100%", position: "relative", children: [H(z, { alignItems: "center", bgColor: u.palette.white, borderBottom: "1px solid", borderColor: u.palette.gray[200], display: "flex", gap: 1.25, justify: "space-between", padding: [1.25, 1.25, 1.25, 1.25], position: "sticky", top: "0", zIndex: 40, children: [I(Fs, { color: u.palette.black, display: "inline", fontWeight: "bold", size: "xl", children: c }), I(Es, { icon: "close", iconColor: u.palette.gray[400], iconSize: "xs", iconTransform: "grow-4", iconType: "fa-light", id: e, onClick: i, px: 0.25, py: 0.25, variant: "ghost" })] }), H(z, { display: "flex", flexDirection: "column", justify: "space-between", minHeight: "100vh", children: [H(z, { py: 1.25, children: [(s ?? []).map(({ customBadge: f, description: v, icon: p, onClick: g, requiresUpgrade: m, title: S }) => I(ks, { customBadge: f, description: v, icon: p, onClick: d(g), requiresUpgrade: m, title: S }, S)), t && I(z, { px: 1.25, children: t })] }), r === void 0 ? void 0 : H(z, { alignItems: "center", bgColor: u.palette.white, borderColor: u.palette.gray[200], borderTop: "1px solid", bottom: "0", display: "flex", gap: 1.25, justify: "end", padding: [1.25, 1.25, 1.25, 1.25], position: "sticky", width: "100%", zIndex: 40, children: [a === void 0 ? void 0 : I(Pt, { color: `${u.palette.primary[500]} !important`, onClick: l, pl: 0.5, pr: 0.5, variant: "ghost", children: a }), I(Pt, { onClick: o, type: "submit", children: r })] })] })] }) }) });
3294
+ `, Fa = ({
3295
+ children: t,
3296
+ closeIconId: e = "close-menu",
3297
+ isOpen: n,
3298
+ items: s,
3299
+ onClose: i,
3300
+ primaryButtonText: r,
3301
+ primaryOnClick: o,
3302
+ secondaryButtonText: a,
3303
+ secondaryOnClick: l,
3304
+ title: u
3305
+ }) => {
3306
+ const c = Ds(), f = Z(null), d = fn(
3307
+ (h) => () => {
3308
+ h(), i();
3309
+ },
3310
+ [i]
3311
+ );
3312
+ return Es(
3313
+ f.current,
3314
+ () => {
3315
+ i();
3316
+ },
3317
+ !0
3318
+ ), /* @__PURE__ */ E(ca, { features: da, children: /* @__PURE__ */ E(
3319
+ fa,
3320
+ {
3321
+ animate: n ? {
3322
+ display: "block",
3323
+ x: 0
3324
+ } : {
3325
+ transitionEnd: {
3326
+ display: "none"
3327
+ },
3328
+ x: "100%"
3329
+ },
3330
+ initial: {
3331
+ display: "none",
3332
+ x: "100%"
3333
+ },
3334
+ ref: f,
3335
+ transition: {
3336
+ bounce: 0,
3337
+ duration: 0.6,
3338
+ type: "spring"
3339
+ },
3340
+ children: /* @__PURE__ */ Y(q, { height: "100%", position: "relative", children: [
3341
+ /* @__PURE__ */ Y(
3342
+ q,
3343
+ {
3344
+ alignItems: "center",
3345
+ bgColor: c.palette.white,
3346
+ borderBottom: "1px solid",
3347
+ borderColor: c.palette.gray[200],
3348
+ display: "flex",
3349
+ gap: 1.25,
3350
+ justify: "space-between",
3351
+ padding: [1.25, 1.25, 1.25, 1.25],
3352
+ position: "sticky",
3353
+ top: "0",
3354
+ zIndex: 40,
3355
+ children: [
3356
+ /* @__PURE__ */ E(
3357
+ Os,
3358
+ {
3359
+ color: c.palette.black,
3360
+ display: "inline",
3361
+ fontWeight: "bold",
3362
+ size: "xl",
3363
+ children: u
3364
+ }
3365
+ ),
3366
+ /* @__PURE__ */ E(
3367
+ Is,
3368
+ {
3369
+ icon: "close",
3370
+ iconColor: c.palette.gray[400],
3371
+ iconSize: "xs",
3372
+ iconTransform: "grow-4",
3373
+ iconType: "fa-light",
3374
+ id: e,
3375
+ onClick: i,
3376
+ px: 0.25,
3377
+ py: 0.25,
3378
+ variant: "ghost"
3379
+ }
3380
+ )
3381
+ ]
3382
+ }
3383
+ ),
3384
+ /* @__PURE__ */ Y(
3385
+ q,
3386
+ {
3387
+ display: "flex",
3388
+ flexDirection: "column",
3389
+ justify: "space-between",
3390
+ minHeight: "100vh",
3391
+ children: [
3392
+ /* @__PURE__ */ Y(q, { py: 1.25, children: [
3393
+ (s ?? []).map(
3394
+ ({
3395
+ customBadge: h,
3396
+ description: y,
3397
+ icon: v,
3398
+ onClick: b,
3399
+ requiresUpgrade: p,
3400
+ title: g
3401
+ }) => /* @__PURE__ */ E(
3402
+ Rs,
3403
+ {
3404
+ customBadge: h,
3405
+ description: y,
3406
+ icon: v,
3407
+ onClick: d(b),
3408
+ requiresUpgrade: p,
3409
+ title: g
3410
+ },
3411
+ g
3412
+ )
3413
+ ),
3414
+ t && /* @__PURE__ */ E(q, { px: 1.25, children: t })
3415
+ ] }),
3416
+ r === void 0 ? void 0 : /* @__PURE__ */ Y(
3417
+ q,
3418
+ {
3419
+ alignItems: "center",
3420
+ bgColor: c.palette.white,
3421
+ borderColor: c.palette.gray[200],
3422
+ borderTop: "1px solid",
3423
+ bottom: "0",
3424
+ display: "flex",
3425
+ gap: 1.25,
3426
+ justify: "end",
3427
+ padding: [1.25, 1.25, 1.25, 1.25],
3428
+ position: "sticky",
3429
+ width: "100%",
3430
+ zIndex: 40,
3431
+ children: [
3432
+ a === void 0 ? void 0 : /* @__PURE__ */ E(
3433
+ Rt,
3434
+ {
3435
+ color: `${c.palette.primary[500]} !important`,
3436
+ onClick: l,
3437
+ pl: 0.5,
3438
+ pr: 0.5,
3439
+ variant: "ghost",
3440
+ children: a
3441
+ }
3442
+ ),
3443
+ /* @__PURE__ */ E(Rt, { onClick: o, type: "submit", children: r })
3444
+ ]
3445
+ }
3446
+ )
3447
+ ]
3448
+ }
3449
+ )
3450
+ ] })
3451
+ }
3452
+ ) });
2006
3453
  };
2007
3454
  export {
2008
- to as SlideOutMenu
3455
+ Fa as SlideOutMenu
2009
3456
  };