@fluidattacks/design 3.1.13 → 3.1.14

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 (159) hide show
  1. package/dist/assets/design.css +1 -0
  2. package/dist/components/@core/index.js +15 -16
  3. package/dist/components/accordion/accordion-content/index.js +3 -20
  4. package/dist/components/accordion/index.js +5 -76
  5. package/dist/components/alert/index.js +4 -162
  6. package/dist/components/button/index.js +4 -67
  7. package/dist/components/card/card-header/index.js +4 -81
  8. package/dist/components/card/card-with-image/index.js +5 -91
  9. package/dist/components/card/card-with-input/index.js +5 -103
  10. package/dist/components/card/card-with-selector/index.js +4 -69
  11. package/dist/components/card/card-with-switch/index.js +4 -48
  12. package/dist/components/card/index.js +6 -10
  13. package/dist/components/carousel/index.js +4 -73
  14. package/dist/components/checkbox/index.js +4 -116
  15. package/dist/components/cloud-image/index.js +2 -2
  16. package/dist/components/code-snippet/index.js +6 -70
  17. package/dist/components/code-snippet/location-code/index.js +7 -169
  18. package/dist/components/colors/index.js +7 -222
  19. package/dist/components/confirm-dialog/index.js +4 -43
  20. package/dist/components/container/index.js +4 -49
  21. package/dist/components/content-card/category-tag/index.js +4 -40
  22. package/dist/components/content-card/event-date/index.js +5 -59
  23. package/dist/components/content-card/index.js +4 -166
  24. package/dist/components/content-card-carousel/index.js +4 -93
  25. package/dist/components/content-card-carousel/scroll-buttons/index.js +2 -4
  26. package/dist/components/divider/index.js +4 -23
  27. package/dist/components/empty-state/empty-button/index.js +3 -4
  28. package/dist/components/empty-state/index.js +3 -83
  29. package/dist/components/file-preview/index.js +3 -42
  30. package/dist/components/form/index.js +4 -61
  31. package/dist/components/grid-container/index.js +4 -46
  32. package/dist/components/group-selector/index.js +6 -133
  33. package/dist/components/group-selector/option-container/index.js +3 -7
  34. package/dist/components/icon/index.js +4 -106
  35. package/dist/components/icon-button/index.js +4 -74
  36. package/dist/components/indicator-card/index.js +5 -72
  37. package/dist/components/info-sidebar/index.js +4 -114
  38. package/dist/components/inputs/fields/combobox/index.js +7 -144
  39. package/dist/components/inputs/fields/combobox/option/index.js +2 -3
  40. package/dist/components/inputs/fields/date/calendar/cell/index.js +7 -25
  41. package/dist/components/inputs/fields/date/calendar/grid/index.js +5 -24
  42. package/dist/components/inputs/fields/date/calendar/header/index.js +4 -36
  43. package/dist/components/inputs/fields/date/calendar/index.js +6 -28
  44. package/dist/components/inputs/fields/date/index.js +8 -66
  45. package/dist/components/inputs/fields/date-range/calendar/index.js +7 -33
  46. package/dist/components/inputs/fields/date-range/index.js +6 -106
  47. package/dist/components/inputs/fields/date-time/calendar/index.js +7 -62
  48. package/dist/components/inputs/fields/date-time/index.js +6 -67
  49. package/dist/components/inputs/fields/editable/index.js +4 -26
  50. package/dist/components/inputs/fields/input/index.js +5 -75
  51. package/dist/components/inputs/fields/input-file/index.js +6 -123
  52. package/dist/components/inputs/fields/input-tags/index.js +4 -66
  53. package/dist/components/inputs/fields/number/index.js +4 -55
  54. package/dist/components/inputs/fields/number-range/index.js +4 -47
  55. package/dist/components/inputs/fields/phone/index.js +7 -577
  56. package/dist/components/inputs/fields/text-area/index.js +5 -79
  57. package/dist/components/inputs/index.js +14 -26
  58. package/dist/components/inputs/label/index.js +5 -36
  59. package/dist/components/inputs/outline-container/index.js +4 -102
  60. package/dist/components/inputs/utils/action-button/index.js +4 -29
  61. package/dist/components/inputs/utils/calendar-button/index.js +5 -35
  62. package/dist/components/inputs/utils/date-selector/index.js +3 -60
  63. package/dist/components/inputs/utils/date-time-field/index.js +10 -131
  64. package/dist/components/inputs/utils/dialog/index.js +5 -12
  65. package/dist/components/inputs/utils/number-field/index.js +5 -84
  66. package/dist/components/inputs/utils/popover/index.js +5 -42
  67. package/dist/components/interactive-card/icon/index.js +2 -4
  68. package/dist/components/interactive-card/index.js +4 -116
  69. package/dist/components/language-selector/index.js +4 -35
  70. package/dist/components/language-selector/item-list/index.js +2 -5
  71. package/dist/components/link/index.js +3 -104
  72. package/dist/components/list-item/index.js +6 -65
  73. package/dist/components/little-flag/index.js +3 -30
  74. package/dist/components/loading/index.js +4 -92
  75. package/dist/components/logo/index.js +2 -10
  76. package/dist/components/logo-carousel/index.js +4 -85
  77. package/dist/components/lottie/index.js +3 -18
  78. package/dist/components/menu/index.js +5 -64
  79. package/dist/components/message-banner/index.js +5 -99
  80. package/dist/components/modal/index.js +6 -63
  81. package/dist/components/modal/modal-confirm/index.js +3 -49
  82. package/dist/components/modal/modal-footer/index.js +5 -23
  83. package/dist/components/modal/modal-header/index.js +6 -49
  84. package/dist/components/notification/index.js +5 -111
  85. package/dist/components/notification-sign/index.js +4 -45
  86. package/dist/components/number-input/index.js +5 -87
  87. package/dist/components/oauth-selector/index.js +6 -98
  88. package/dist/components/oauth-selector/option-container/index.js +4 -74
  89. package/dist/components/plan-card/index.js +3 -153
  90. package/dist/components/plan-card/recommended-tag/index.js +3 -29
  91. package/dist/components/pop-up/description/index.js +5 -49
  92. package/dist/components/pop-up/index.js +7 -150
  93. package/dist/components/premium-feature/index.js +4 -83
  94. package/dist/components/priority-score/index.js +4 -27
  95. package/dist/components/progress/index.js +5 -45
  96. package/dist/components/progress-bar/index.js +3 -151
  97. package/dist/components/radio-button/index.js +4 -123
  98. package/dist/components/scroll-button/index.js +4 -40
  99. package/dist/components/search/index.js +7 -103
  100. package/dist/components/search-bar/index.js +4 -217
  101. package/dist/components/search-bar/item-searching/index.js +2 -7
  102. package/dist/components/severity-badge/index.js +4 -72
  103. package/dist/components/severity-overview/badge/index.js +4 -67
  104. package/dist/components/severity-overview/index.js +3 -15
  105. package/dist/components/show-on-hover/index.js +3 -29
  106. package/dist/components/slide-out-menu/index.js +6 -3453
  107. package/dist/components/slide-out-menu/menu-item/index.js +4 -65
  108. package/dist/components/slider/index.js +7 -122
  109. package/dist/components/slider/thumb/index.js +5 -15
  110. package/dist/components/step-lapse/index.js +4 -157
  111. package/dist/components/table-button/index.js +4 -95
  112. package/dist/components/tabs/fixed-tabs/index.js +3 -27
  113. package/dist/components/tabs/index.js +6 -55
  114. package/dist/components/tabs/tab/index.js +3 -37
  115. package/dist/components/tag/index.js +4 -182
  116. package/dist/components/timeline/card/index.js +2 -5
  117. package/dist/components/timeline/index.js +4 -15
  118. package/dist/components/toggle/index.js +4 -101
  119. package/dist/components/toggle-buttons/index.js +4 -101
  120. package/dist/components/tooltip/index.js +3 -6
  121. package/dist/components/tour/index.js +7 -4582
  122. package/dist/components/typography/heading/index.js +4 -45
  123. package/dist/components/typography/index.js +4 -6
  124. package/dist/components/typography/span/index.js +4 -39
  125. package/dist/components/typography/text/index.js +4 -45
  126. package/dist/components/web-form/index.js +4 -78
  127. package/dist/components-C2JBXbtI.mjs +9653 -0
  128. package/dist/hooks/index.js +6 -10
  129. package/dist/index.js +113 -205
  130. package/dist/vendor-CVMqCpkZ.mjs +14504 -0
  131. package/package.json +2 -1
  132. package/dist/_commonjsHelpers-C6fGbg64.mjs +0 -6
  133. package/dist/assets/index.css +0 -1
  134. package/dist/assets/index2.css +0 -1
  135. package/dist/index-BMHVi812.mjs +0 -234
  136. package/dist/index-BzAniA2J.mjs +0 -135
  137. package/dist/index-C6LbClYh.mjs +0 -146
  138. package/dist/index-CAIe8hBv.mjs +0 -130
  139. package/dist/index-CUQBAqt_.mjs +0 -75
  140. package/dist/index-CWlrSlUk.mjs +0 -68
  141. package/dist/index-Ckmu1TfV.mjs +0 -86
  142. package/dist/index-DwznImvK.mjs +0 -1678
  143. package/dist/index-maWH3JYC.mjs +0 -3561
  144. package/dist/styles-B2N0JLw1.mjs +0 -114
  145. package/dist/styles-B64DVBIF.mjs +0 -115
  146. package/dist/styles-BXFVwnWT.mjs +0 -133
  147. package/dist/styles-BZQOqe8p.mjs +0 -141
  148. package/dist/styles-Bdque9TT.mjs +0 -65
  149. package/dist/styles-BlHspTrz.mjs +0 -144
  150. package/dist/styles-CROOwXEH.mjs +0 -76
  151. package/dist/styles-CplEd2kw.mjs +0 -228
  152. package/dist/styles-D1eTIklB.mjs +0 -110
  153. package/dist/styles-ePGii_9g.mjs +0 -74
  154. package/dist/use-carousel-CgAF78h3.mjs +0 -23
  155. package/dist/use-click-outside-BUll8Ag-.mjs +0 -18
  156. package/dist/use-cloudinary-image-BCxwj15o.mjs +0 -1176
  157. package/dist/use-modal-CtgexKnf.mjs +0 -14
  158. package/dist/use-search-Dj47QDw9.mjs +0 -15
  159. package/dist/utils-V0EumEPM.mjs +0 -6
@@ -1,3456 +1,9 @@
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
- import "../typography/heading/index.js";
9
- import "../typography/span/index.js";
10
- import { Text as Os } from "../typography/text/index.js";
11
- import { u as Es } from "../../use-click-outside-BUll8Ag-.mjs";
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "styled-components";
4
+ import { av as a } from "../../components-C2JBXbtI.mjs";
12
5
  import "lodash";
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
- });
29
- }
30
- function Ce(t) {
31
- return t !== null && typeof t == "object" && typeof t.start == "function";
32
- }
33
- const je = (t) => Array.isArray(t);
34
- function pn(t, e) {
35
- if (!Array.isArray(e))
36
- return !1;
37
- const n = e.length;
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;
43
- return !0;
44
- }
45
- function ue(t) {
46
- return typeof t == "string" || Array.isArray(t);
47
- }
48
- function Ot(t) {
49
- const e = [{}, {}];
50
- return t == null || t.values.forEach((n, s) => {
51
- e[0][s] = n.get(), e[1][s] = n.getVelocity();
52
- }), e;
53
- }
54
- function st(t, e, n, s) {
55
- if (typeof e == "function") {
56
- const [i, r] = Ot(s);
57
- e = e(n !== void 0 ? n : t.custom, i, r);
58
- }
59
- if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
60
- const [i, r] = Ot(s);
61
- e = e(n !== void 0 ? n : t.custom, i, r);
62
- }
63
- return e;
64
- }
65
- function Pe(t, e, n) {
66
- const s = t.getProps();
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) {
114
- return t ? t[e] || t.default || t : void 0;
115
- }
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);
131
- });
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));
166
- }
167
- };
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);
202
- }, state: i, steps: o };
203
- }
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;
239
- const r = window.getComputedStyle(e).getPropertyValue(s);
240
- if (r) {
241
- const o = r.trim();
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;
278
- const i = s.match(/^matrix3d\((.+)\)$/u);
279
- if (i)
280
- return Lt(i[1], e);
281
- {
282
- const r = s.match(/^matrix\((.+)\)$/u);
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) {
314
- const t = Array.from(W).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
315
- e.forEach((s) => {
316
- const i = oi(s);
317
- i.length && (n.set(s, i), s.render());
318
- }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
319
- s.render();
320
- const i = n.get(s);
321
- i && i.forEach(([r, o]) => {
322
- var a;
323
- (a = s.getValue(r)) === null || a === void 0 || a.set(o);
324
- });
325
- }), t.forEach((s) => s.measureEndState()), t.forEach((s) => {
326
- s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
327
- });
328
- }
329
- Ue = !1, Ge = !1, W.forEach((t) => t.complete()), W.clear();
330
- }
331
- function In() {
332
- W.forEach((t) => {
333
- t.readKeyframes(), t.needsMeasurement && (Ue = !0);
334
- });
335
- }
336
- function li() {
337
- In(), Rn();
338
- }
339
- class ut {
340
- constructor(e, n, s, i, r, o = !1) {
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;
342
- }
343
- scheduleResolve() {
344
- this.isScheduled = !0, this.isAsync ? (W.add(this), Ge || (Ge = !0, R.read(In), R.resolveKeyframes(Rn))) : (this.readKeyframes(), this.complete());
345
- }
346
- readKeyframes() {
347
- const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
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];
361
- }
362
- setFinalKeyframe() {
363
- }
364
- measureInitialState() {
365
- }
366
- renderEndStyles() {
367
- }
368
- measureEndState() {
369
- }
370
- complete() {
371
- this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), W.delete(this);
372
- }
373
- cancel() {
374
- this.isComplete || (this.isScheduled = !1, W.delete(this));
375
- }
376
- resume() {
377
- this.isComplete || this.scheduleResolve();
378
- }
379
- }
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) {
403
- let e = "", n = "", s = "", 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 = [];
435
- let r = 0;
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 };
438
- }
439
- function Ln(t) {
440
- return de(t).values;
441
- }
442
- function Nn(t) {
443
- const { split: e, types: n } = de(t), s = e.length;
444
- return (i) => {
445
- let r = "";
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
- }
451
- return r;
452
- };
453
- }
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) {
466
- const [e, n] = t.slice(0, -1).split("(");
467
- if (e === "drop-shadow")
468
- return t;
469
- const [s] = n.match(ct) || [];
470
- if (!s)
471
- return t;
472
- const i = n.replace(s, "");
473
- let r = wi.has(e) ? 1 : 0;
474
- return s !== n && (r *= 100), e + "(" + r + i + ")";
475
- }
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 {
588
- constructor(e, n, s, i, r) {
589
- super(e, n, s, i, r, !0);
590
- }
591
- readKeyframes() {
592
- const { unresolvedKeyframes: e, element: n, name: s } = this;
593
- if (!n || !n.current)
594
- return;
595
- super.readKeyframes();
596
- for (let l = 0; l < e.length; l++) {
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);
601
- }
602
- }
603
- if (this.resolveNoneKeyframes(), !si.has(s) || e.length !== 2)
604
- return;
605
- const [i, r] = e, o = Bt(i), a = Bt(r);
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;
614
- }
615
- resolveNoneKeyframes() {
616
- const { unresolvedKeyframes: e, name: n } = this, s = [];
617
- for (let i = 0; i < e.length; i++)
618
- Ys(e[i]) && s.push(i);
619
- s.length && Ci(e, s, n);
620
- }
621
- measureInitialState() {
622
- const { element: e, unresolvedKeyframes: n, name: s } = this;
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;
626
- const i = n[n.length - 1];
627
- i !== void 0 && e.getValue(s, i).jump(i, !1);
628
- }
629
- measureEndState() {
630
- var e;
631
- const { element: n, name: s, unresolvedKeyframes: i } = this;
632
- if (!n || !n.current)
633
- return;
634
- const r = n.getValue(s);
635
- r && r.jump(this.measuredOrigin, !1);
636
- const o = i.length - 1, a = i[o];
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);
639
- }), this.resolveNoneKeyframes();
640
- }
641
- }
642
- function pt(t) {
643
- return typeof t == "function";
644
- }
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) {
666
- const i = t[0];
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 {
676
- constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", ...a }) {
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
- */
697
- calcStartTime() {
698
- return this.resolvedAt ? this.resolvedAt - this.createdAt > Ri ? this.resolvedAt : this.createdAt : this.createdAt;
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
- */
705
- get resolved() {
706
- return !this._resolved && !this.hasAttemptedResolve && li(), this._resolved;
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
- */
713
- onKeyframesResolved(e, n) {
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());
729
- }
730
- onPostResolved() {
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
- */
737
- then(e, n) {
738
- return this.currentFinishedPromise.then(e, n);
739
- }
740
- flatten() {
741
- this.options.type = "keyframes", this.options.ease = "linear";
742
- }
743
- updateFinishedPromise() {
744
- this.currentFinishedPromise = new Promise((e) => {
745
- this.resolveFinishedPromise = e;
746
- });
747
- }
748
- }
749
- const mt = (t, e, n) => {
750
- const s = e - t;
751
- return s === 0 ? 1 : (n - t) / s;
752
- }, $n = (t, e, n = 10) => {
753
- let s = "";
754
- const i = Math.max(Math.round(e / n), 2);
755
- for (let r = 0; r < i; r++)
756
- s += t(mt(0, i - 1, r)) + ", ";
757
- return `linear(${s.substring(0, s.length - 2)})`;
758
- };
759
- function jn(t, e) {
760
- return e ? t * (1e3 / e) : 0;
761
- }
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 }) {
797
- let i, r;
798
- ne(t <= L(x.maxDuration), "Spring duration must be 10 seconds or less");
799
- let o = 1 - e;
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
- };
820
- {
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
- };
827
- }
828
- }
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;
835
- }
836
- function qe(t, e) {
837
- return t * Math.sqrt(1 - e * e);
838
- }
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) {
850
- return e.some((n) => t[n] !== void 0);
851
- }
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
- };
870
- } else {
871
- const n = Oi(t);
872
- e = {
873
- ...e,
874
- ...n,
875
- mass: x.mass
876
- }, e.isResolvedFromDuration = !0;
877
- }
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));
898
- };
899
- } else if (v === 1)
900
- V = (w) => o - Math.exp(-p * w) * (b + (y + p * b) * w);
901
- else {
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;
906
- };
907
- }
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;
925
- }
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;
934
- let v = n * e;
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;
940
- };
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
- }
959
- };
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.");
976
- const [e, n, s, i] = 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
- };
1000
- }
1001
- function be(t, e) {
1002
- return (n) => n > 0 ? e : t;
1003
- }
1004
- const Be = (t, e, n) => {
1005
- const s = t * t, i = n * (e * e - s) + s;
1006
- return i < 0 ? 0 : Math.sqrt(i);
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);
1019
- const i = { ...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;
1024
- }
1025
- function Hi(t, e) {
1026
- return (n) => Re(t, e, n);
1027
- }
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]));
1033
- return (r) => {
1034
- for (let o = 0; o < s; o++)
1035
- n[o] = i[o](r);
1036
- return n;
1037
- };
1038
- }
1039
- function qi(t, e) {
1040
- const n = { ...t, ...e }, s = {};
1041
- for (const i in n)
1042
- t[i] !== void 0 && e[i] !== void 0 && (s[i] = yt(t[i])(t[i], e[i]));
1043
- return (i) => {
1044
- for (const r in s)
1045
- n[r] = s[r](i);
1046
- return n;
1047
- };
1048
- }
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));
1061
- };
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;
1076
- }
1077
- function Ji(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
1078
- const r = t.length;
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];
1083
- t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
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);
1091
- };
1092
- return n ? (u) => l(U(t[0], t[r - 1], u)) : l;
1093
- }
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
- }
1100
- }
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
- };
1127
- }
1128
- const sr = (t) => {
1129
- const e = ({ timestamp: n }) => t(n);
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 {
1147
- constructor(e) {
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 = () => {
1149
- if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
1150
- return;
1151
- this.teardown();
1152
- const { onStop: l } = this.options;
1153
- l && l();
1154
- };
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();
1157
- }
1158
- flatten() {
1159
- super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes));
1160
- }
1161
- initPlayback(e) {
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
- };
1180
- }
1181
- onPostResolved() {
1182
- const { autoplay: e = !0 } = this.options;
1183
- this.play(), this.pendingPlayState === "paused" || !e ? this.pause() : this.state = this.pendingPlayState;
1184
- }
1185
- tick(e, n = !1) {
1186
- const { resolved: s } = this;
1187
- if (!s) {
1188
- const { keyframes: T } = this.options;
1189
- return { done: !0, value: T[T.length - 1] };
1190
- }
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;
1203
- }
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;
1210
- }
1211
- get duration() {
1212
- const { resolved: e } = this;
1213
- return e ? B(e.calculatedDuration) : 0;
1214
- }
1215
- get time() {
1216
- return B(this.currentTime);
1217
- }
1218
- set time(e) {
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);
1220
- }
1221
- get speed() {
1222
- return this.playbackSpeed;
1223
- }
1224
- set speed(e) {
1225
- const n = this.playbackSpeed !== e;
1226
- this.playbackSpeed = e, n && (this.time = B(this.currentTime));
1227
- }
1228
- play() {
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;
1236
- this.driver || (this.driver = e((r) => this.tick(r))), n && n();
1237
- const i = this.driver.now();
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();
1239
- }
1240
- pause() {
1241
- var e;
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;
1247
- }
1248
- complete() {
1249
- this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null;
1250
- }
1251
- finish() {
1252
- this.teardown(), this.state = "finished";
1253
- const { onComplete: e } = this.options;
1254
- e && e();
1255
- }
1256
- cancel() {
1257
- this.cancelTime !== null && this.tick(this.cancelTime), this.teardown(), this.updateFinishedPromise();
1258
- }
1259
- teardown() {
1260
- this.state = "idle", this.stopDriver(), this.resolveFinishedPromise(), this.updateFinishedPromise(), this.startTime = this.cancelTime = null, this.resolver.cancel();
1261
- }
1262
- stopDriver() {
1263
- this.driver && (this.driver.stop(), this.driver = void 0);
1264
- }
1265
- sample(e) {
1266
- return this.startTime = 0, this.tick(e, !0);
1267
- }
1268
- }
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) {
1279
- let e;
1280
- return () => (e === void 0 && (e = t()), e);
1281
- }
1282
- const ar = {
1283
- linearEasing: void 0
1284
- };
1285
- function lr(t, e) {
1286
- const n = bt(t);
1287
- return () => {
1288
- var s;
1289
- return (s = ar[e]) !== null && s !== void 0 ? s : n();
1290
- };
1291
- }
1292
- const Te = /* @__PURE__ */ lr(() => {
1293
- try {
1294
- document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1295
- } catch {
1296
- return !1;
1297
- }
1298
- return !0;
1299
- }, "linearEasing");
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
- });
1330
- }
1331
- function Yt(t, e) {
1332
- t.timeline = e, t.onfinish = null;
1333
- }
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
- };
1357
- }
1358
- const Zn = {
1359
- anticipate: Vn,
1360
- backInOut: Tn,
1361
- circInOut: Sn
1362
- };
1363
- function pr(t) {
1364
- return t in Zn;
1365
- }
1366
- class Xt extends _n {
1367
- constructor(e) {
1368
- super(e);
1369
- const { name: n, motionValue: s, element: i, keyframes: r } = this.options;
1370
- this.resolver = new Kn(r, (o, a) => this.onKeyframesResolved(o, a), n, s, i), this.resolver.scheduleResolve();
1371
- }
1372
- initPlayback(e, n) {
1373
- var s;
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";
1380
- }
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
- };
1393
- }
1394
- get duration() {
1395
- const { resolved: e } = this;
1396
- if (!e)
1397
- return 0;
1398
- const { duration: n } = e;
1399
- return B(n);
1400
- }
1401
- get time() {
1402
- const { resolved: e } = this;
1403
- if (!e)
1404
- return 0;
1405
- const { animation: n } = e;
1406
- return B(n.currentTime || 0);
1407
- }
1408
- set time(e) {
1409
- const { resolved: n } = this;
1410
- if (!n)
1411
- return;
1412
- const { animation: s } = n;
1413
- s.currentTime = L(e);
1414
- }
1415
- get speed() {
1416
- const { resolved: e } = this;
1417
- if (!e)
1418
- return 1;
1419
- const { animation: n } = e;
1420
- return n.playbackRate;
1421
- }
1422
- set speed(e) {
1423
- const { resolved: n } = this;
1424
- if (!n)
1425
- return;
1426
- const { animation: s } = n;
1427
- s.playbackRate = e;
1428
- }
1429
- get state() {
1430
- const { resolved: e } = this;
1431
- if (!e)
1432
- return "idle";
1433
- const { animation: n } = e;
1434
- return n.playState;
1435
- }
1436
- get startTime() {
1437
- const { resolved: e } = this;
1438
- if (!e)
1439
- return null;
1440
- const { animation: n } = e;
1441
- return n.startTime;
1442
- }
1443
- /**
1444
- * Replace the default DocumentTimeline with another AnimationTimeline.
1445
- * Currently used for scroll animations.
1446
- */
1447
- attachTimeline(e) {
1448
- if (!this._resolved)
1449
- this.pendingTimeline = e;
1450
- else {
1451
- const { resolved: n } = this;
1452
- if (!n)
1453
- return _;
1454
- const { animation: s } = n;
1455
- Yt(s, e);
1456
- }
1457
- return _;
1458
- }
1459
- play() {
1460
- if (this.isStopped)
1461
- return;
1462
- const { resolved: e } = this;
1463
- if (!e)
1464
- return;
1465
- const { animation: n } = e;
1466
- n.playState === "finished" && this.updateFinishedPromise(), n.play();
1467
- }
1468
- pause() {
1469
- const { resolved: e } = this;
1470
- if (!e)
1471
- return;
1472
- const { animation: n } = e;
1473
- n.pause();
1474
- }
1475
- stop() {
1476
- if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
1477
- return;
1478
- this.resolveFinishedPromise(), this.updateFinishedPromise();
1479
- const { resolved: e } = this;
1480
- if (!e)
1481
- return;
1482
- const { animation: n, keyframes: s, duration: i, type: r, ease: o, times: a } = e;
1483
- if (n.playState === "idle" || n.playState === "finished")
1484
- return;
1485
- if (this.time) {
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);
1496
- }
1497
- const { onStop: l } = this.options;
1498
- l && l(), this.cancel();
1499
- }
1500
- complete() {
1501
- const { resolved: e } = this;
1502
- e && e.animation.finish();
1503
- }
1504
- cancel() {
1505
- const { resolved: e } = this;
1506
- e && e.animation.cancel();
1507
- }
1508
- static supports(e) {
1509
- const { motionValue: n, name: s, repeatDelay: i, repeatType: r, damping: o, type: a } = e;
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";
1515
- }
1516
- }
1517
- const mr = bt(() => window.ScrollTimeline !== void 0);
1518
- class gr {
1519
- constructor(e) {
1520
- this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
1521
- }
1522
- then(e, n) {
1523
- return Promise.all(this.animations).then(e).catch(n);
1524
- }
1525
- /**
1526
- * TODO: Filter out cancelled or stopped animations before returning
1527
- */
1528
- getAll(e) {
1529
- return this.animations[0][e];
1530
- }
1531
- setAll(e, n) {
1532
- for (let s = 0; s < this.animations.length; s++)
1533
- this.animations[s][e] = n;
1534
- }
1535
- attachTimeline(e, n) {
1536
- const s = this.animations.map((i) => mr() && i.attachTimeline ? i.attachTimeline(e) : n(i));
1537
- return () => {
1538
- s.forEach((i, r) => {
1539
- i && i(), this.animations[r].stop();
1540
- });
1541
- };
1542
- }
1543
- get time() {
1544
- return this.getAll("time");
1545
- }
1546
- set time(e) {
1547
- this.setAll("time", e);
1548
- }
1549
- get speed() {
1550
- return this.getAll("speed");
1551
- }
1552
- set speed(e) {
1553
- this.setAll("speed", e);
1554
- }
1555
- get startTime() {
1556
- return this.getAll("startTime");
1557
- }
1558
- get duration() {
1559
- let e = 0;
1560
- for (let n = 0; n < this.animations.length; n++)
1561
- e = Math.max(e, this.animations[n].duration);
1562
- return e;
1563
- }
1564
- runAll(e) {
1565
- this.animations.forEach((n) => n[e]());
1566
- }
1567
- flatten() {
1568
- this.runAll("flatten");
1569
- }
1570
- play() {
1571
- this.runAll("play");
1572
- }
1573
- pause() {
1574
- this.runAll("pause");
1575
- }
1576
- cancel() {
1577
- this.runAll("cancel");
1578
- }
1579
- complete() {
1580
- this.runAll("complete");
1581
- }
1582
- }
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 {
1628
- constructor() {
1629
- this.subscriptions = [];
1630
- }
1631
- add(e) {
1632
- return Tr(this.subscriptions, e), () => Vr(this.subscriptions, e);
1633
- }
1634
- notify(e, n, s) {
1635
- const i = this.subscriptions.length;
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
- }
1644
- }
1645
- getSize() {
1646
- return this.subscriptions.length;
1647
- }
1648
- clear() {
1649
- this.subscriptions.length = 0;
1650
- }
1651
- }
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
- */
1662
- constructor(e, n = {}) {
1663
- this.version = "11.15.0", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
1664
- const r = K.now();
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);
1666
- }, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
1667
- }
1668
- setCurrent(e) {
1669
- this.current = e, this.updatedAt = K.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = Sr(this.current));
1670
- }
1671
- setPrevFrameValue(e = this.current) {
1672
- this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
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
- */
1714
- onChange(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);
1716
- }
1717
- on(e, n) {
1718
- this.events[e] || (this.events[e] = new Jn());
1719
- const s = this.events[e].add(n);
1720
- return e === "change" ? () => {
1721
- s(), R.read(() => {
1722
- this.events.change.getSize() || this.stop();
1723
- });
1724
- } : s;
1725
- }
1726
- clearListeners() {
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
- */
1735
- attach(e, n) {
1736
- this.passiveEffect = e, this.stopPassiveEffect = n;
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
- */
1753
- set(e, n = !0) {
1754
- !n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify);
1755
- }
1756
- setWithVelocity(e, n, s) {
1757
- this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
1758
- }
1759
- /**
1760
- * Set the state of the `MotionValue`, stopping any active animations,
1761
- * effects, and resets velocity to `0`.
1762
- */
1763
- jump(e, n = !0) {
1764
- this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1765
- }
1766
- /**
1767
- * Returns the latest state of `MotionValue`
1768
- *
1769
- * @returns - The latest state of `MotionValue`
1770
- *
1771
- * @public
1772
- */
1773
- get() {
1774
- return this.current;
1775
- }
1776
- /**
1777
- * @public
1778
- */
1779
- getPrevious() {
1780
- return this.prev;
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
- */
1789
- getVelocity() {
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
- */
1808
- start(e) {
1809
- return this.stop(), new Promise((n) => {
1810
- this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
1811
- }).then(() => {
1812
- this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1813
- });
1814
- }
1815
- /**
1816
- * Stop the currently active animation.
1817
- *
1818
- * @public
1819
- */
1820
- stop() {
1821
- this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1822
- }
1823
- /**
1824
- * Returns `true` if this value is currently animating.
1825
- *
1826
- * @public
1827
- */
1828
- isAnimating() {
1829
- return !!this.animation;
1830
- }
1831
- clearAnimation() {
1832
- delete this.animation;
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
- */
1843
- destroy() {
1844
- this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1845
- }
1846
- }
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
- }
1861
- }
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];
1865
- }
1866
- const F = (t) => !!(t && t.getVelocity);
1867
- function Fr(t) {
1868
- return !!(F(t) && t.add);
1869
- }
1870
- function Dr(t, e) {
1871
- const n = t.getValue("willChange");
1872
- if (Fr(n))
1873
- return n.add(e);
1874
- }
1875
- function Rr({ protectedKeys: t, needsAnimating: e }, n) {
1876
- const s = t.hasOwnProperty(n) && e[n] !== !0;
1877
- return e[n] = !1, s;
1878
- }
1879
- function es(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
1880
- var r;
1881
- let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...l } = e;
1882
- s && (o = s);
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;
1893
- if (window.MotionHandoffAnimation) {
1894
- const p = Pr(t);
1895
- if (p) {
1896
- const g = window.MotionHandoffAnimation(p, f, R);
1897
- g !== null && (y.startTime = g, v = !0);
1898
- }
1899
- }
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);
1907
- });
1908
- }), u;
1909
- }
1910
- function Je(t, e, n = {}) {
1911
- var s;
1912
- const i = Pe(t, e, n.type === "exit" ? (s = t.presenceContext) === null || s === void 0 ? void 0 : s.custom : void 0);
1913
- let { transition: r = t.getDefaultTransition() || {} } = i || {};
1914
- n.transitionOverride && (r = n.transitionOverride);
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);
1918
- } : () => Promise.resolve(), { when: l } = r;
1919
- if (l) {
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) {
1935
- return t.sortNodePosition(e);
1936
- }
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;
1957
- if (!t.isControllingVariants) {
1958
- const n = t.parent ? ts(t.parent) || {} : {};
1959
- return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
1960
- }
1961
- const e = {};
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);
1965
- }
1966
- return e;
1967
- }
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 };
1980
- }
1981
- return u;
1982
- };
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);
2012
- };
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;
2019
- }
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
- })));
2024
- }
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 });
2031
- }
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();
2034
- }
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) => {
2040
- var h;
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 {
2081
- constructor(e) {
2082
- this.isMounted = !1, this.node = e;
2083
- }
2084
- update() {
2085
- }
2086
- }
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));
2095
- }
2096
- updateAnimationControlsSubscription() {
2097
- const { animate: e } = this.node.getProps();
2098
- Ce(e) && (this.unmountControls = e.subscribe(this.node));
2099
- }
2100
- /**
2101
- * Subscribe any provided AnimationControls to the component's VisualElement
2102
- */
2103
- mount() {
2104
- this.updateAnimationControlsSubscription();
2105
- }
2106
- update() {
2107
- const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
2108
- e !== n && this.updateAnimationControlsSubscription();
2109
- }
2110
- unmount() {
2111
- var e;
2112
- this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this);
2113
- }
2114
- }
2115
- let jr = 0;
2116
- class Wr extends re {
2117
- constructor() {
2118
- super(...arguments), this.id = jr++;
2119
- }
2120
- update() {
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));
2128
- }
2129
- mount() {
2130
- const { register: e } = this.node.presenceContext || {};
2131
- e && (this.unmount = e(this.id));
2132
- }
2133
- unmount() {
2134
- }
2135
- }
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 }) {
2160
- return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
2161
- }
2162
- function ss(t) {
2163
- return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
2164
- }
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
- };
2174
- }
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()];
2212
- }
2213
- function tn(t) {
2214
- return (e) => {
2215
- e.pointerType === "touch" || zr() || t(e);
2216
- };
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
- }
2232
- function nn(t, e, n) {
2233
- const { props: s } = t;
2234
- t.animationState && s.whileHover && t.animationState.setActive("whileHover", n === "Start");
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
- }
2245
- }
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();
2269
- function sn(t) {
2270
- return (e) => {
2271
- e.key === "Enter" && t(e);
2272
- };
2273
- }
2274
- function Ke(t, e) {
2275
- t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
2276
- }
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;
2302
- function rn(t) {
2303
- return Hr(t) && !0;
2304
- }
2305
- function uo(t, e, n = {}) {
2306
- const [s, i, r] = os(t, n), o = (a) => {
2307
- const l = a.currentTarget;
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);
2317
- };
2318
- window.addEventListener("pointerup", f, i), window.addEventListener("pointercancel", d, i);
2319
- };
2320
- return s.forEach((a) => {
2321
- lo(a) || (a.tabIndex = 0), (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), a.addEventListener("focus", (u) => oo(u, i), i);
2322
- }), r;
2323
- }
2324
- function on(t, e, n) {
2325
- const { props: s } = t;
2326
- t.animationState && s.whileTap && t.animationState.setActive("whileTap", n === "Start");
2327
- const i = "onTap" + (n === "End" ? "" : n), r = s[i];
2328
- r && R.postRender(() => r(e, ns(e)));
2329
- }
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);
2340
- e && e(t);
2341
- }, ho = (t) => {
2342
- t.forEach(fo);
2343
- };
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);
2354
- };
2355
- }
2356
- const go = {
2357
- some: 0,
2358
- all: 1
2359
- };
2360
- class yo extends re {
2361
- constructor() {
2362
- super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
2363
- }
2364
- startObserver() {
2365
- this.unmount();
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);
2379
- }
2380
- mount() {
2381
- this.startObserver();
2382
- }
2383
- update() {
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();
2388
- }
2389
- unmount() {
2390
- }
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) {
2414
- var r, o;
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);
2429
- });
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));
2438
- }), d;
2439
- }
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
- });
2459
- }
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
- );
2476
- }
2477
- function Oe(t) {
2478
- return Ce(t.animate) || rt.some((e) => ue(t[e]));
2479
- }
2480
- function cs(t) {
2481
- return !!(Oe(t) || t.variants);
2482
- }
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)]);
2496
- }
2497
- function an(t) {
2498
- return Array.isArray(t) ? t.join(" ") : t;
2499
- }
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);
2545
- }
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;
2550
- }
2551
- function Po({ layoutId: t }) {
2552
- const e = O(Zr).id;
2553
- return e && t !== void 0 ? e + "-" + t : t;
2554
- }
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
- }
2561
- }
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
- };
2571
- }
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");
2656
- }
2657
- function xt(t, e, n) {
2658
- var s;
2659
- const { style: i } = t, r = {};
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]);
2662
- return r;
2663
- }
2664
- function ms(t, e, n) {
2665
- const s = xt(t, e, n);
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
- }
2671
- return s;
2672
- }
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);
2687
- };
2688
- function Eo(t, e, n, s) {
2689
- const i = {}, r = s(t, {});
2690
- for (const d in r)
2691
- i[d] = to(r[d]);
2692
- let { initial: o, animate: a } = t;
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);
2711
- }
2712
- for (const g in v)
2713
- i[g] = v[g];
2714
- }
2715
- }
2716
- }
2717
- return i;
2718
- }
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) {
2753
- const { style: s, vars: i, transformOrigin: r } = t;
2754
- let o = !1, a = !1;
2755
- for (const l in e) {
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;
2766
- }
2767
- }
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}`;
2771
- }
2772
- }
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}`;
2779
- }
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
- }
2810
- t.attrs = t.style, t.style = {};
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
- });
2833
- }
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
- }
2898
- try {
2899
- qo(require("@emotion/is-prop-valid").default);
2900
- } catch {
2901
- }
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
- };
2916
- }, [e]);
2917
- if (t.style) {
2918
- const r = {};
2919
- bs(r, t.style, t), i.style = { ...r, ...i.style };
2920
- }
2921
- return i;
2922
- }
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
- });
2930
- };
2931
- }
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);
2942
- };
2943
- }
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
- */
2990
- scrapeMotionValuesFromProps(e, n, s) {
2991
- return {};
2992
- }
2993
- constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
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 = () => {
2995
- this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2996
- }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2997
- const d = K.now();
2998
- this.renderScheduledAt < d && (this.renderScheduledAt = d, R.render(this.render, !1, !0));
2999
- };
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);
3006
- }
3007
- }
3008
- mount(e) {
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);
3010
- }
3011
- unmount() {
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();
3015
- for (const e in this.features) {
3016
- const n = this.features[e];
3017
- n && (n.unmount(), n.isMounted = !1);
3018
- }
3019
- this.current = null;
3020
- }
3021
- bindToMotionValue(e, n) {
3022
- this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
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);
3025
- }), r = n.on("renderRequest", this.scheduleRender);
3026
- let o;
3027
- window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
3028
- i(), r(), o && o(), n.owner && n.stop();
3029
- });
3030
- }
3031
- sortNodePosition(e) {
3032
- return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
3033
- }
3034
- updateFeatures() {
3035
- let e = "animation";
3036
- for (e in ee) {
3037
- const n = ee[e];
3038
- if (!n)
3039
- continue;
3040
- const { isEnabled: s, Feature: i } = n;
3041
- if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
3042
- const r = this.features[e];
3043
- r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
3044
- }
3045
- }
3046
- }
3047
- triggerBuild() {
3048
- this.build(this.renderState, this.latestValues, this.props);
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
- */
3055
- measureViewportBox() {
3056
- return this.current ? this.measureInstanceViewportBox(this.current, this.props) : is();
3057
- }
3058
- getStaticValue(e) {
3059
- return this.latestValues[e];
3060
- }
3061
- setStaticValue(e, n) {
3062
- this.latestValues[e] = n;
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
- */
3068
- update(e, n) {
3069
- (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
3070
- for (let s = 0; s < dn.length; s++) {
3071
- const i = dn[s];
3072
- this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
3073
- const r = "on" + i, o = e[r];
3074
- o && (this.propEventSubscriptions[i] = this.on(i, o));
3075
- }
3076
- this.prevMotionValues = ea(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
3077
- }
3078
- getProps() {
3079
- return this.props;
3080
- }
3081
- /**
3082
- * Returns the variant definition with a given name.
3083
- */
3084
- getVariant(e) {
3085
- return this.props.variants ? this.props.variants[e] : void 0;
3086
- }
3087
- /**
3088
- * Returns the defined default transition on this component.
3089
- */
3090
- getDefaultTransition() {
3091
- return this.props.transition;
3092
- }
3093
- getTransformPagePoint() {
3094
- return this.props.transformPagePoint;
3095
- }
3096
- getClosestVariantNode() {
3097
- return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
3098
- }
3099
- /**
3100
- * Add a child visual element to our set of children.
3101
- */
3102
- addVariantChild(e) {
3103
- const n = this.getClosestVariantNode();
3104
- if (n)
3105
- return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
3106
- }
3107
- /**
3108
- * Add a motion value and bind it to this visual element.
3109
- */
3110
- addValue(e, n) {
3111
- const s = this.values.get(e);
3112
- n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
3113
- }
3114
- /**
3115
- * Remove a motion value and unbind any active subscriptions.
3116
- */
3117
- removeValue(e) {
3118
- this.values.delete(e);
3119
- const n = this.valueSubscriptions.get(e);
3120
- n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
3121
- }
3122
- /**
3123
- * Check whether we have a motion value for this key
3124
- */
3125
- hasValue(e) {
3126
- return this.values.has(e);
3127
- }
3128
- getValue(e, n) {
3129
- if (this.props.values && this.props.values[e])
3130
- return this.props.values[e];
3131
- let s = this.values.get(e);
3132
- return s === void 0 && n !== void 0 && (s = Se(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
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
- */
3139
- readValue(e, n) {
3140
- var s;
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;
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
- */
3148
- setBaseTarget(e, n) {
3149
- this.baseTarget[e] = n;
3150
- }
3151
- /**
3152
- * Find the base target for a value thats been removed from all animation
3153
- * props.
3154
- */
3155
- getBaseTarget(e) {
3156
- var n;
3157
- const { initial: s } = this.props;
3158
- let i;
3159
- if (typeof s == "string" || typeof s == "object") {
3160
- const o = st(this.props, s, (n = this.presenceContext) === null || n === void 0 ? void 0 : n.custom);
3161
- o && (i = o[e]);
3162
- }
3163
- if (s && i !== void 0)
3164
- return i;
3165
- const r = this.getBaseTargetFromProps(this.props, e);
3166
- return r !== void 0 && !F(r) ? r : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
3167
- }
3168
- on(e, n) {
3169
- return this.events[e] || (this.events[e] = new Jn()), this.events[e].add(n);
3170
- }
3171
- notify(e, ...n) {
3172
- this.events[e] && this.events[e].notify(...n);
3173
- }
3174
- }
3175
- class Vs extends sa {
3176
- constructor() {
3177
- super(...arguments), this.KeyframeResolver = Kn;
3178
- }
3179
- sortInstanceNodePosition(e, n) {
3180
- return e.compareDocumentPosition(n) & 2 ? 1 : -1;
3181
- }
3182
- getBaseTargetFromProps(e, n) {
3183
- return e.style ? e.style[n] : void 0;
3184
- }
3185
- removeValueFromRenderState(e, { vars: n, style: s }) {
3186
- delete n[e], delete s[e];
3187
- }
3188
- handleChildMotionValue() {
3189
- this.childSubscription && (this.childSubscription(), delete this.childSubscription);
3190
- const { children: e } = this.props;
3191
- F(e) && (this.childSubscription = e.on("change", (n) => {
3192
- this.current && (this.current.textContent = `${n}`);
3193
- }));
3194
- }
3195
- }
3196
- function ia(t) {
3197
- return window.getComputedStyle(t);
3198
- }
3199
- class ra extends Vs {
3200
- constructor() {
3201
- super(...arguments), this.type = "html", this.renderInstance = ds;
3202
- }
3203
- readValueFromInstance(e, n) {
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;
3210
- }
3211
- }
3212
- measureInstanceViewportBox(e, { transformPagePoint: n }) {
3213
- return Xr(e, n);
3214
- }
3215
- build(e, n, s) {
3216
- Mt(e, n, s.transformTemplate);
3217
- }
3218
- scrapeMotionValuesFromProps(e, n, s) {
3219
- return xt(e, n, s);
3220
- }
3221
- }
3222
- class oa extends Vs {
3223
- constructor() {
3224
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = is;
3225
- }
3226
- getBaseTargetFromProps(e, n) {
3227
- return e[n];
3228
- }
3229
- readValueFromInstance(e, n) {
3230
- if (z.has(n)) {
3231
- const s = ht(n);
3232
- return s && s.default || 0;
3233
- }
3234
- return n = fs.has(n) ? n : wt(n), e.getAttribute(n);
3235
- }
3236
- scrapeMotionValuesFromProps(e, n, s) {
3237
- return ms(e, n, s);
3238
- }
3239
- build(e, n, s) {
3240
- Ct(e, n, this.isSVGTag, s.transformTemplate);
3241
- }
3242
- renderInstance(e, n, s, i) {
3243
- hs(e, n, s, i);
3244
- }
3245
- mount(e) {
3246
- this.isSVGTag = Pt(e.tagName), super.mount(e);
3247
- }
3248
- }
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)) {
3255
- const { renderer: r, ...o } = e;
3256
- i.current = r, et(o);
3257
- }
3258
- return nt(() => {
3259
- $e(e) && e().then(({ renderer: r, ...o }) => {
3260
- et(o), i.current = r, s(!0);
3261
- });
3262
- }, []), E(Vt.Provider, { value: { renderer: i.current, strict: n }, children: t });
3263
- }
3264
- function $e(t) {
3265
- return typeof t == "function";
3266
- }
3267
- const da = {
3268
- renderer: aa,
3269
- ...Gr,
3270
- ...bo
3271
- }, fa = Fs(ua.div)`
3272
- ${({ theme: t }) => `
3273
- background-color: ${t.palette.white};
3274
- box-shadow: ${t.shadows.lg};
3275
- max-width: 350px;
3276
- min-width: 350px;
3277
- height: 100%;
3278
- position: absolute;
3279
- right: 0;
3280
- top: 0;
3281
- overflow: hidden auto;
3282
- scrollbar-color: ${t.palette.gray[600]} ${t.palette.gray[100]};
3283
- scroll-padding: ${t.spacing[0.5]};
3284
- scrollbar-width: thin;
3285
- z-index: 99999;
3286
-
3287
- > div {
3288
- border: 1px solid ${t.palette.gray[100]};
3289
- width: auto;
3290
- min-height: 100vh;
3291
- height: auto;
3292
- }
3293
- `}
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
- ) });
3453
- };
6
+ import "../../vendor-CVMqCpkZ.mjs";
3454
7
  export {
3455
- Fa as SlideOutMenu
8
+ a as SlideOutMenu
3456
9
  };