@js-empire/emperor-ui 1.2.2 → 1.2.4

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 (157) hide show
  1. package/.cursor/rules/code-conventions.mdc +50 -0
  2. package/README.md +0 -15
  3. package/dist/emperor-ui.js +119 -71
  4. package/dist/emperor-ui.umd.cjs +27 -13
  5. package/dist/globals.css +1 -1
  6. package/dist/index-BXtdEByK.js +5 -0
  7. package/dist/index-CDB93OLO.js +55965 -0
  8. package/dist/index-CYORMghp.js +290 -0
  9. package/dist/index.d.ts +338 -36
  10. package/dist/src-UW24ZMRV-C1Pn8-w8.js +5 -0
  11. package/package.json +32 -2
  12. package/src/animations/blink.ts +26 -0
  13. package/src/animations/floating.ts +12 -0
  14. package/src/animations/index.ts +2 -0
  15. package/src/components/atoms/brand/brand.tsx +1 -1
  16. package/src/components/atoms/color-picker/color-picker.tsx +13 -0
  17. package/src/components/atoms/color-picker/free-color-picker.tsx +60 -0
  18. package/src/components/atoms/color-picker/index.ts +3 -0
  19. package/src/components/atoms/color-picker/preset-color-picker.tsx +64 -0
  20. package/src/components/atoms/color-picker/stories/color-picker.stories.tsx +49 -0
  21. package/src/components/atoms/color-picker/styles/color-picker.css +23 -0
  22. package/src/components/atoms/copy-button/copy-button.tsx +73 -0
  23. package/src/components/atoms/copy-button/index.ts +1 -0
  24. package/src/components/atoms/copy-button/stories/copy-button.stories.tsx +21 -0
  25. package/src/components/atoms/field/field.stories.tsx +27 -0
  26. package/src/components/atoms/field/field.tsx +11 -0
  27. package/src/components/atoms/field/index.ts +1 -0
  28. package/src/components/atoms/field/styles/classes.ts +9 -0
  29. package/src/components/atoms/field/styles/index.ts +1 -0
  30. package/src/components/atoms/filter/filter.tsx +92 -0
  31. package/src/components/atoms/filter/index.ts +3 -0
  32. package/src/components/atoms/filter/stories/filter.stories.tsx +97 -0
  33. package/src/components/atoms/filter/styles/classes.ts +20 -0
  34. package/src/components/atoms/filter/styles/index.ts +1 -0
  35. package/src/components/atoms/filter/units/autocomplete-filter.tsx +39 -0
  36. package/src/components/atoms/filter/units/checkbox-filter.tsx +32 -0
  37. package/src/components/atoms/filter/units/checkbox-group-filter.tsx +37 -0
  38. package/src/components/atoms/filter/units/date-filter.tsx +50 -0
  39. package/src/components/atoms/filter/units/index.ts +9 -0
  40. package/src/components/atoms/filter/units/numeric-filter.tsx +36 -0
  41. package/src/components/atoms/filter/units/range-filter.tsx +36 -0
  42. package/src/components/atoms/filter/units/search-filter.tsx +52 -0
  43. package/src/components/atoms/filter/units/select-filter.tsx +49 -0
  44. package/src/components/atoms/filter/units/switch-filter.tsx +33 -0
  45. package/src/components/atoms/index.ts +5 -0
  46. package/src/components/atoms/theme-switch/index.ts +1 -0
  47. package/src/components/atoms/theme-switch/styles/classes.ts +16 -0
  48. package/src/components/atoms/theme-switch/styles/index.ts +1 -0
  49. package/src/components/atoms/theme-switch/theme-switch.stories.tsx +26 -0
  50. package/src/components/atoms/theme-switch/theme-switch.tsx +54 -0
  51. package/src/components/atoms/uploader/avatar-label.tsx +8 -1
  52. package/src/components/atoms/uploader/stories/uploader.stories.tsx +3 -3
  53. package/src/components/atoms/uploader/upload-file-error-box.tsx +1 -1
  54. package/src/components/atoms/uploader/upload-file-input.tsx +1 -1
  55. package/src/components/atoms/uploader/upload-file-label.tsx +8 -1
  56. package/src/components/atoms/uploader/upload-file-listing.tsx +46 -37
  57. package/src/components/atoms/uploader/view-image-modal.tsx +2 -1
  58. package/src/components/molecules/index.ts +0 -1
  59. package/src/components/molecules/item-card/index.ts +6 -0
  60. package/src/components/molecules/item-card/item-actions-dropdown.tsx +57 -0
  61. package/src/components/molecules/item-card/item-banner.tsx +22 -0
  62. package/src/components/molecules/item-card/item-card-body.tsx +68 -0
  63. package/src/components/molecules/item-card/item-card-footer.tsx +55 -0
  64. package/src/components/molecules/item-card/item-card-header.tsx +61 -0
  65. package/src/components/molecules/item-card/item-card.tsx +83 -3
  66. package/src/components/molecules/item-card/loading-item.tsx +88 -0
  67. package/src/components/molecules/item-card/stories/item-card.stories.tsx +182 -0
  68. package/src/components/molecules/item-card/styles/classes.ts +138 -0
  69. package/src/components/molecules/item-card/styles/index.ts +1 -0
  70. package/src/components/molecules/nav-bar/sub-items-box.tsx +2 -1
  71. package/src/components/molecules/scaffold/index.ts +1 -0
  72. package/src/components/molecules/scaffold/scaffold.tsx +4 -17
  73. package/src/components/molecules/scaffold/styles/index.ts +1 -0
  74. package/src/components/molecules/scaffold/styles/scaffold-classes.ts +10 -0
  75. package/src/components/molecules/side-bar/compact-side-bar.tsx +3 -1
  76. package/src/components/molecules/side-bar/side-bar-drawer.tsx +6 -17
  77. package/src/components/molecules/side-bar/side-bar.stories.tsx +1 -1
  78. package/src/components/organisms/filters/filters.stories.tsx +32 -0
  79. package/src/components/organisms/filters/filters.tsx +36 -0
  80. package/src/components/organisms/filters/index.ts +1 -0
  81. package/src/components/organisms/filters/styles/classes.ts +9 -0
  82. package/src/components/organisms/filters/styles/index.ts +1 -0
  83. package/src/components/organisms/footer/copy-rights-box.tsx +1 -1
  84. package/src/components/organisms/footer/footer.tsx +1 -1
  85. package/src/components/organisms/footer/policies-box.tsx +2 -1
  86. package/src/components/organisms/footer/quick-links-box.tsx +2 -1
  87. package/src/components/organisms/footer/social-links-box.tsx +2 -1
  88. package/src/components/organisms/footer/stories/footer.stories.tsx +1 -1
  89. package/src/components/organisms/header/header.tsx +1 -8
  90. package/src/components/organisms/index.ts +1 -0
  91. package/src/components/organisms/listings/empty-listings.tsx +80 -0
  92. package/src/components/organisms/listings/index.ts +2 -0
  93. package/src/components/organisms/listings/listings.tsx +90 -9
  94. package/src/components/organisms/listings/stories/grid-listings.stories.tsx +153 -0
  95. package/src/components/organisms/listings/stories/list-listings.stories.tsx +171 -0
  96. package/src/components/organisms/listings/styles/classes.ts +41 -3
  97. package/src/constants/animations.ts +14 -0
  98. package/src/constants/card.tsx +26 -0
  99. package/src/constants/defaults.ts +1 -16
  100. package/src/constants/index.ts +2 -0
  101. package/src/hooks/index.ts +3 -0
  102. package/src/hooks/use-filters.ts +20 -0
  103. package/src/hooks/use-search-params-handler.tsx +186 -0
  104. package/src/hooks/use-uploader.tsx +1 -1
  105. package/src/hooks/use-window-size.tsx +53 -0
  106. package/src/i18n/locales/atoms/ar.ts +3 -0
  107. package/src/i18n/locales/atoms/en.ts +3 -0
  108. package/src/i18n/locales/organisms/ar.ts +7 -1
  109. package/src/i18n/locales/organisms/en.ts +7 -1
  110. package/src/mocks/constants.ts +103 -0
  111. package/src/mocks/index.ts +2 -0
  112. package/src/mocks/listings.tsx +154 -0
  113. package/src/mocks/types.ts +64 -0
  114. package/src/providers/config-provider.tsx +0 -8
  115. package/src/providers/emperor-ui-provider.tsx +16 -5
  116. package/src/providers/index.ts +1 -0
  117. package/src/providers/theme-provider.tsx +16 -0
  118. package/src/providers/uploader-provider.tsx +1 -1
  119. package/src/styles/hero.ts +1 -1
  120. package/src/styles/index.css +23 -0
  121. package/src/types/components/atoms/color-picker/color-picker.ts +12 -0
  122. package/src/types/components/atoms/color-picker/index.ts +1 -0
  123. package/src/types/components/atoms/field/field.ts +9 -0
  124. package/src/types/components/atoms/field/index.ts +1 -0
  125. package/src/types/components/atoms/filter/filter.ts +43 -0
  126. package/src/types/components/atoms/filter/index.ts +2 -0
  127. package/src/types/components/atoms/filter/select-filter.ts +8 -0
  128. package/src/types/components/atoms/index.ts +3 -0
  129. package/src/types/components/atoms/uploader.ts +2 -1
  130. package/src/types/components/index.ts +1 -0
  131. package/src/types/components/molecules/index.ts +1 -1
  132. package/src/types/components/molecules/item-card/item-card.ts +50 -0
  133. package/src/types/components/molecules/listings/listings.ts +21 -5
  134. package/src/types/components/molecules/side-bar/side-bar.ts +1 -1
  135. package/src/types/components/molecules/theme-switch/index.ts +1 -0
  136. package/src/types/components/molecules/theme-switch/theme-switch.ts +9 -0
  137. package/src/types/components/organisms/filters/filters.ts +11 -0
  138. package/src/types/components/organisms/filters/index.ts +1 -0
  139. package/src/types/components/organisms/index.ts +1 -0
  140. package/src/types/context/config.ts +3 -4
  141. package/src/types/context/index.ts +0 -1
  142. package/src/types/context/localization.ts +1 -0
  143. package/src/types/shared/components.ts +3 -0
  144. package/src/utils/uploader.ts +1 -1
  145. package/dist/features-animation-uyo1KMg-.js +0 -1938
  146. package/dist/index-B3d8-vnJ.js +0 -1630
  147. package/dist/index-DOwkJus4.js +0 -26528
  148. package/dist/index-DrkA25TM.js +0 -5
  149. package/dist/src-UW24ZMRV-D6kiVea5.js +0 -5
  150. package/src/components/molecules/filter/filter.tsx +0 -6
  151. package/src/components/molecules/filter/index.ts +0 -1
  152. package/src/components/organisms/listings/stories/listings.stories.tsx +0 -30
  153. package/src/main.tsx +0 -3
  154. package/src/mocks/listings.ts +0 -200
  155. package/src/types/components/molecules/filter/filter.ts +0 -9
  156. package/src/types/components/molecules/filter/index.ts +0 -1
  157. package/src/types/context/theme.ts +0 -17
@@ -1,1938 +0,0 @@
1
- import { n as j, v as N, m as U, ac as at, a9 as Zt, aa as rt, aW as Q, X as ge, a8 as Fe, ae as ot, ad as le, h as Oe, t as O, e as Jt, f as G, aZ as Qt, g as _, N as $, Z as lt, _ as en, aX as tn, a5 as Te, aE as nn, a4 as sn, c as an, b as ct, F as rn, aY as on, at as ln, ag as Ie, U as Ee, a$ as q, b0 as Ke, a6 as cn, V as un, a1 as fn, a3 as hn, W as dn, aO as mn, aP as pn, aN as ut, l as yn, ai as gn, aT as Tn, aQ as bn, aR as vn, aC as ft, aG as ht, ay as dt, aF as mt, b1 as xn } from "./index-DOwkJus4.js";
2
- import { Fragment as An } from "react";
3
- // @__NO_SIDE_EFFECTS__
4
- function be(e) {
5
- let t;
6
- return () => (t === void 0 && (t = e()), t);
7
- }
8
- const wn = (e, t) => (n) => t(e(n)), ee = (...e) => e.reduce(wn), pt = /* @__NO_SIDE_EFFECTS__ */ (e, t, n) => {
9
- const i = t - e;
10
- return i === 0 ? 1 : (n - e) / i;
11
- }, F = /* @__NO_SIDE_EFFECTS__ */ (e) => e * 1e3, k = /* @__NO_SIDE_EFFECTS__ */ (e) => e / 1e3, yt = (e, t, n) => (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e, Sn = 1e-7, Vn = 12;
12
- function Dn(e, t, n, i, s) {
13
- let a, r, o = 0;
14
- do
15
- r = t + (n - t) / 2, a = yt(r, i, s) - e, a > 0 ? n = r : t = r;
16
- while (Math.abs(a) > Sn && ++o < Vn);
17
- return r;
18
- }
19
- function z(e, t, n, i) {
20
- if (e === t && n === i)
21
- return j;
22
- const s = (a) => Dn(a, 0, 1, e, n);
23
- return (a) => a === 0 || a === 1 ? a : yt(s(a), t, i);
24
- }
25
- const gt = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, Tt = (e) => (t) => 1 - e(1 - t), bt = /* @__PURE__ */ z(0.33, 1.53, 0.69, 0.99), ve = /* @__PURE__ */ Tt(bt), vt = /* @__PURE__ */ gt(ve), xt = (e) => (e *= 2) < 1 ? 0.5 * ve(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), xe = (e) => 1 - Math.sin(Math.acos(e)), Mn = Tt(xe), At = gt(xe), Cn = /* @__PURE__ */ z(0.42, 0, 1, 1), Pn = /* @__PURE__ */ z(0, 0, 0.58, 1), wt = /* @__PURE__ */ z(0.42, 0, 0.58, 1), kn = (e) => Array.isArray(e) && typeof e[0] != "number", St = (e) => Array.isArray(e) && typeof e[0] == "number", Re = {
26
- linear: j,
27
- easeIn: Cn,
28
- easeInOut: wt,
29
- easeOut: Pn,
30
- circIn: xe,
31
- circInOut: At,
32
- circOut: Mn,
33
- backIn: ve,
34
- backInOut: vt,
35
- backOut: bt,
36
- anticipate: xt
37
- }, Fn = (e) => typeof e == "string", Be = (e) => {
38
- if (St(e)) {
39
- N(e.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
40
- const [t, n, i, s] = e;
41
- return z(t, n, i, s);
42
- } else if (Fn(e))
43
- return N(Re[e] !== void 0, `Invalid easing type '${e}'`, "invalid-easing-type"), Re[e];
44
- return e;
45
- };
46
- function te(e, t, n) {
47
- return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
48
- }
49
- function On({ hue: e, saturation: t, lightness: n, alpha: i }) {
50
- e /= 360, t /= 100, n /= 100;
51
- let s = 0, a = 0, r = 0;
52
- if (!t)
53
- s = a = r = n;
54
- else {
55
- const o = n < 0.5 ? n * (1 + t) : n + t - n * t, c = 2 * n - o;
56
- s = te(c, o, e + 1 / 3), a = te(c, o, e), r = te(c, o, e - 1 / 3);
57
- }
58
- return {
59
- red: Math.round(s * 255),
60
- green: Math.round(a * 255),
61
- blue: Math.round(r * 255),
62
- alpha: i
63
- };
64
- }
65
- function Y(e, t) {
66
- return (n) => n > 0 ? t : e;
67
- }
68
- const ne = (e, t, n) => {
69
- const i = e * e, s = n * (t * t - i) + i;
70
- return s < 0 ? 0 : Math.sqrt(s);
71
- }, In = [Zt, at, rt], En = (e) => In.find((t) => t.test(e));
72
- function Le(e) {
73
- const t = En(e);
74
- if (Q(!!t, `'${e}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !t)
75
- return !1;
76
- let n = t.parse(e);
77
- return t === rt && (n = On(n)), n;
78
- }
79
- const Ne = (e, t) => {
80
- const n = Le(e), i = Le(t);
81
- if (!n || !i)
82
- return Y(e, t);
83
- const s = { ...n };
84
- return (a) => (s.red = ne(n.red, i.red, a), s.green = ne(n.green, i.green, a), s.blue = ne(n.blue, i.blue, a), s.alpha = U(n.alpha, i.alpha, a), at.transform(s));
85
- }, ce = /* @__PURE__ */ new Set(["none", "hidden"]);
86
- function Kn(e, t) {
87
- return ce.has(e) ? (n) => n <= 0 ? e : t : (n) => n >= 1 ? t : e;
88
- }
89
- function Rn(e, t) {
90
- return (n) => U(e, t, n);
91
- }
92
- function Ae(e) {
93
- return typeof e == "number" ? Rn : typeof e == "string" ? ge(e) ? Y : Fe.test(e) ? Ne : Nn : Array.isArray(e) ? Vt : typeof e == "object" ? Fe.test(e) ? Ne : Bn : Y;
94
- }
95
- function Vt(e, t) {
96
- const n = [...e], i = n.length, s = e.map((a, r) => Ae(a)(a, t[r]));
97
- return (a) => {
98
- for (let r = 0; r < i; r++)
99
- n[r] = s[r](a);
100
- return n;
101
- };
102
- }
103
- function Bn(e, t) {
104
- const n = { ...e, ...t }, i = {};
105
- for (const s in n)
106
- e[s] !== void 0 && t[s] !== void 0 && (i[s] = Ae(e[s])(e[s], t[s]));
107
- return (s) => {
108
- for (const a in i)
109
- n[a] = i[a](s);
110
- return n;
111
- };
112
- }
113
- function Ln(e, t) {
114
- const n = [], i = { color: 0, var: 0, number: 0 };
115
- for (let s = 0; s < t.values.length; s++) {
116
- const a = t.types[s], r = e.indexes[a][i[a]], o = e.values[r] ?? 0;
117
- n[s] = o, i[a]++;
118
- }
119
- return n;
120
- }
121
- const Nn = (e, t) => {
122
- const n = ot.createTransformer(t), i = le(e), s = le(t);
123
- return i.indexes.var.length === s.indexes.var.length && i.indexes.color.length === s.indexes.color.length && i.indexes.number.length >= s.indexes.number.length ? ce.has(e) && !s.values.length || ce.has(t) && !i.values.length ? Kn(e, t) : ee(Vt(Ln(i, s), s.values), n) : (Q(!0, `Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), Y(e, t));
124
- };
125
- function Dt(e, t, n) {
126
- return typeof e == "number" && typeof t == "number" && typeof n == "number" ? U(e, t, n) : Ae(e)(e, t);
127
- }
128
- const Gn = (e) => {
129
- const t = ({ timestamp: n }) => e(n);
130
- return {
131
- start: (n = !0) => G.update(t, n),
132
- stop: () => Jt(t),
133
- /**
134
- * If we're processing this frame we can use the
135
- * framelocked timestamp to keep things in sync.
136
- */
137
- now: () => Oe.isProcessing ? Oe.timestamp : O.now()
138
- };
139
- }, Mt = (e, t, n = 10) => {
140
- let i = "";
141
- const s = Math.max(Math.round(t / n), 2);
142
- for (let a = 0; a < s; a++)
143
- i += Math.round(e(a / (s - 1)) * 1e4) / 1e4 + ", ";
144
- return `linear(${i.substring(0, i.length - 2)})`;
145
- }, Z = 2e4;
146
- function we(e) {
147
- let t = 0;
148
- const n = 50;
149
- let i = e.next(t);
150
- for (; !i.done && t < Z; )
151
- t += n, i = e.next(t);
152
- return t >= Z ? 1 / 0 : t;
153
- }
154
- function _n(e, t = 100, n) {
155
- const i = n({ ...e, keyframes: [0, t] }), s = Math.min(we(i), Z);
156
- return {
157
- type: "keyframes",
158
- ease: (a) => i.next(s * a).value / t,
159
- duration: /* @__PURE__ */ k(s)
160
- };
161
- }
162
- const $n = 5;
163
- function Ct(e, t, n) {
164
- const i = Math.max(t - $n, 0);
165
- return Qt(n - e(i), t - i);
166
- }
167
- const w = {
168
- // Default spring physics
169
- stiffness: 100,
170
- damping: 10,
171
- mass: 1,
172
- velocity: 0,
173
- // Default duration/bounce-based options
174
- duration: 800,
175
- // in ms
176
- bounce: 0.3,
177
- visualDuration: 0.3,
178
- // in seconds
179
- // Rest thresholds
180
- restSpeed: {
181
- granular: 0.01,
182
- default: 2
183
- },
184
- restDelta: {
185
- granular: 5e-3,
186
- default: 0.5
187
- },
188
- // Limits
189
- minDuration: 0.01,
190
- // in seconds
191
- maxDuration: 10,
192
- // in seconds
193
- minDamping: 0.05,
194
- maxDamping: 1
195
- }, ie = 1e-3;
196
- function Wn({ duration: e = w.duration, bounce: t = w.bounce, velocity: n = w.velocity, mass: i = w.mass }) {
197
- let s, a;
198
- Q(e <= /* @__PURE__ */ F(w.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
199
- let r = 1 - t;
200
- r = _(w.minDamping, w.maxDamping, r), e = _(w.minDuration, w.maxDuration, /* @__PURE__ */ k(e)), r < 1 ? (s = (u) => {
201
- const l = u * r, f = l * e, h = l - n, p = ue(u, r), b = Math.exp(-f);
202
- return ie - h / p * b;
203
- }, a = (u) => {
204
- const f = u * r * e, h = f * n + n, p = Math.pow(r, 2) * Math.pow(u, 2) * e, b = Math.exp(-f), g = ue(Math.pow(u, 2), r);
205
- return (-s(u) + ie > 0 ? -1 : 1) * ((h - p) * b) / g;
206
- }) : (s = (u) => {
207
- const l = Math.exp(-u * e), f = (u - n) * e + 1;
208
- return -ie + l * f;
209
- }, a = (u) => {
210
- const l = Math.exp(-u * e), f = (n - u) * (e * e);
211
- return l * f;
212
- });
213
- const o = 5 / e, c = jn(s, a, o);
214
- if (e = /* @__PURE__ */ F(e), isNaN(c))
215
- return {
216
- stiffness: w.stiffness,
217
- damping: w.damping,
218
- duration: e
219
- };
220
- {
221
- const u = Math.pow(c, 2) * i;
222
- return {
223
- stiffness: u,
224
- damping: r * 2 * Math.sqrt(i * u),
225
- duration: e
226
- };
227
- }
228
- }
229
- const Hn = 12;
230
- function jn(e, t, n) {
231
- let i = n;
232
- for (let s = 1; s < Hn; s++)
233
- i = i - e(i) / t(i);
234
- return i;
235
- }
236
- function ue(e, t) {
237
- return e * Math.sqrt(1 - t * t);
238
- }
239
- const Un = ["duration", "bounce"], zn = ["stiffness", "damping", "mass"];
240
- function Ge(e, t) {
241
- return t.some((n) => e[n] !== void 0);
242
- }
243
- function qn(e) {
244
- let t = {
245
- velocity: w.velocity,
246
- stiffness: w.stiffness,
247
- damping: w.damping,
248
- mass: w.mass,
249
- isResolvedFromDuration: !1,
250
- ...e
251
- };
252
- if (!Ge(e, zn) && Ge(e, Un))
253
- if (e.visualDuration) {
254
- const n = e.visualDuration, i = 2 * Math.PI / (n * 1.2), s = i * i, a = 2 * _(0.05, 1, 1 - (e.bounce || 0)) * Math.sqrt(s);
255
- t = {
256
- ...t,
257
- mass: w.mass,
258
- stiffness: s,
259
- damping: a
260
- };
261
- } else {
262
- const n = Wn(e);
263
- t = {
264
- ...t,
265
- ...n,
266
- mass: w.mass
267
- }, t.isResolvedFromDuration = !0;
268
- }
269
- return t;
270
- }
271
- function J(e = w.visualDuration, t = w.bounce) {
272
- const n = typeof e != "object" ? {
273
- visualDuration: e,
274
- keyframes: [0, 1],
275
- bounce: t
276
- } : e;
277
- let { restSpeed: i, restDelta: s } = n;
278
- const a = n.keyframes[0], r = n.keyframes[n.keyframes.length - 1], o = { done: !1, value: a }, { stiffness: c, damping: u, mass: l, duration: f, velocity: h, isResolvedFromDuration: p } = qn({
279
- ...n,
280
- velocity: -/* @__PURE__ */ k(n.velocity || 0)
281
- }), b = h || 0, g = u / (2 * Math.sqrt(c * l)), T = r - a, d = /* @__PURE__ */ k(Math.sqrt(c / l)), v = Math.abs(T) < 5;
282
- i || (i = v ? w.restSpeed.granular : w.restSpeed.default), s || (s = v ? w.restDelta.granular : w.restDelta.default);
283
- let x;
284
- if (g < 1) {
285
- const m = ue(d, g);
286
- x = (A) => {
287
- const S = Math.exp(-g * d * A);
288
- return r - S * ((b + g * d * T) / m * Math.sin(m * A) + T * Math.cos(m * A));
289
- };
290
- } else if (g === 1)
291
- x = (m) => r - Math.exp(-d * m) * (T + (b + d * T) * m);
292
- else {
293
- const m = d * Math.sqrt(g * g - 1);
294
- x = (A) => {
295
- const S = Math.exp(-g * d * A), y = Math.min(m * A, 300);
296
- return r - S * ((b + g * d * T) * Math.sinh(y) + m * T * Math.cosh(y)) / m;
297
- };
298
- }
299
- const M = {
300
- calculatedDuration: p && f || null,
301
- next: (m) => {
302
- const A = x(m);
303
- if (p)
304
- o.done = m >= f;
305
- else {
306
- let S = m === 0 ? b : 0;
307
- g < 1 && (S = m === 0 ? /* @__PURE__ */ F(b) : Ct(x, m, A));
308
- const y = Math.abs(S) <= i, D = Math.abs(r - A) <= s;
309
- o.done = y && D;
310
- }
311
- return o.value = o.done ? r : A, o;
312
- },
313
- toString: () => {
314
- const m = Math.min(we(M), Z), A = Mt((S) => M.next(m * S).value, m, 30);
315
- return m + "ms " + A;
316
- },
317
- toTransition: () => {
318
- }
319
- };
320
- return M;
321
- }
322
- J.applyToOptions = (e) => {
323
- const t = _n(e, 100, J);
324
- return e.ease = t.ease, e.duration = /* @__PURE__ */ F(t.duration), e.type = "keyframes", e;
325
- };
326
- function fe({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: i = 325, bounceDamping: s = 10, bounceStiffness: a = 500, modifyTarget: r, min: o, max: c, restDelta: u = 0.5, restSpeed: l }) {
327
- const f = e[0], h = {
328
- done: !1,
329
- value: f
330
- }, p = (y) => o !== void 0 && y < o || c !== void 0 && y > c, b = (y) => o === void 0 ? c : c === void 0 || Math.abs(o - y) < Math.abs(c - y) ? o : c;
331
- let g = n * t;
332
- const T = f + g, d = r === void 0 ? T : r(T);
333
- d !== T && (g = d - f);
334
- const v = (y) => -g * Math.exp(-y / i), x = (y) => d + v(y), M = (y) => {
335
- const D = v(y), C = x(y);
336
- h.done = Math.abs(D) <= u, h.value = h.done ? d : C;
337
- };
338
- let m, A;
339
- const S = (y) => {
340
- p(h.value) && (m = y, A = J({
341
- keyframes: [h.value, b(h.value)],
342
- velocity: Ct(x, y, h.value),
343
- // TODO: This should be passing * 1000
344
- damping: s,
345
- stiffness: a,
346
- restDelta: u,
347
- restSpeed: l
348
- }));
349
- };
350
- return S(0), {
351
- calculatedDuration: null,
352
- next: (y) => {
353
- let D = !1;
354
- return !A && m === void 0 && (D = !0, M(y), S(y)), m !== void 0 && y >= m ? A.next(y - m) : (!D && M(y), h);
355
- }
356
- };
357
- }
358
- function Xn(e, t, n) {
359
- const i = [], s = n || $.mix || Dt, a = e.length - 1;
360
- for (let r = 0; r < a; r++) {
361
- let o = s(e[r], e[r + 1]);
362
- if (t) {
363
- const c = Array.isArray(t) ? t[r] || j : t;
364
- o = ee(c, o);
365
- }
366
- i.push(o);
367
- }
368
- return i;
369
- }
370
- function Yn(e, t, { clamp: n = !0, ease: i, mixer: s } = {}) {
371
- const a = e.length;
372
- if (N(a === t.length, "Both input and output ranges must be the same length", "range-length"), a === 1)
373
- return () => t[0];
374
- if (a === 2 && t[0] === t[1])
375
- return () => t[1];
376
- const r = e[0] === e[1];
377
- e[0] > e[a - 1] && (e = [...e].reverse(), t = [...t].reverse());
378
- const o = Xn(t, i, s), c = o.length, u = (l) => {
379
- if (r && l < e[0])
380
- return t[0];
381
- let f = 0;
382
- if (c > 1)
383
- for (; f < e.length - 2 && !(l < e[f + 1]); f++)
384
- ;
385
- const h = /* @__PURE__ */ pt(e[f], e[f + 1], l);
386
- return o[f](h);
387
- };
388
- return n ? (l) => u(_(e[0], e[a - 1], l)) : u;
389
- }
390
- function Zn(e, t) {
391
- const n = e[e.length - 1];
392
- for (let i = 1; i <= t; i++) {
393
- const s = /* @__PURE__ */ pt(0, t, i);
394
- e.push(U(n, 1, s));
395
- }
396
- }
397
- function Jn(e) {
398
- const t = [0];
399
- return Zn(t, e.length - 1), t;
400
- }
401
- function Qn(e, t) {
402
- return e.map((n) => n * t);
403
- }
404
- function ei(e, t) {
405
- return e.map(() => t || wt).splice(0, e.length - 1);
406
- }
407
- function B({ duration: e = 300, keyframes: t, times: n, ease: i = "easeInOut" }) {
408
- const s = kn(i) ? i.map(Be) : Be(i), a = {
409
- done: !1,
410
- value: t[0]
411
- }, r = Qn(
412
- // Only use the provided offsets if they're the correct length
413
- // TODO Maybe we should warn here if there's a length mismatch
414
- n && n.length === t.length ? n : Jn(t),
415
- e
416
- ), o = Yn(r, t, {
417
- ease: Array.isArray(s) ? s : ei(t, s)
418
- });
419
- return {
420
- calculatedDuration: e,
421
- next: (c) => (a.value = o(c), a.done = c >= e, a)
422
- };
423
- }
424
- const ti = (e) => e !== null;
425
- function Se(e, { repeat: t, repeatType: n = "loop" }, i, s = 1) {
426
- const a = e.filter(ti), o = s < 0 || t && n !== "loop" && t % 2 === 1 ? 0 : a.length - 1;
427
- return !o || i === void 0 ? a[o] : i;
428
- }
429
- const ni = {
430
- decay: fe,
431
- inertia: fe,
432
- tween: B,
433
- keyframes: B,
434
- spring: J
435
- };
436
- function Pt(e) {
437
- typeof e.type == "string" && (e.type = ni[e.type]);
438
- }
439
- class Ve {
440
- constructor() {
441
- this.updateFinished();
442
- }
443
- get finished() {
444
- return this._finished;
445
- }
446
- updateFinished() {
447
- this._finished = new Promise((t) => {
448
- this.resolve = t;
449
- });
450
- }
451
- notifyFinished() {
452
- this.resolve();
453
- }
454
- /**
455
- * Allows the animation to be awaited.
456
- *
457
- * @deprecated Use `finished` instead.
458
- */
459
- then(t, n) {
460
- return this.finished.then(t, n);
461
- }
462
- }
463
- const ii = (e) => e / 100;
464
- class De extends Ve {
465
- constructor(t) {
466
- super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
467
- const { motionValue: n } = this.options;
468
- n && n.updatedAt !== O.now() && this.tick(O.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
469
- }, this.options = t, this.initAnimation(), this.play(), t.autoplay === !1 && this.pause();
470
- }
471
- initAnimation() {
472
- const { options: t } = this;
473
- Pt(t);
474
- const { type: n = B, repeat: i = 0, repeatDelay: s = 0, repeatType: a, velocity: r = 0 } = t;
475
- let { keyframes: o } = t;
476
- const c = n || B;
477
- process.env.NODE_ENV !== "production" && c !== B && N(o.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`, "spring-two-frames"), c !== B && typeof o[0] != "number" && (this.mixKeyframes = ee(ii, Dt(o[0], o[1])), o = [0, 100]);
478
- const u = c({ ...t, keyframes: o });
479
- a === "mirror" && (this.mirroredGenerator = c({
480
- ...t,
481
- keyframes: [...o].reverse(),
482
- velocity: -r
483
- })), u.calculatedDuration === null && (u.calculatedDuration = we(u));
484
- const { calculatedDuration: l } = u;
485
- this.calculatedDuration = l, this.resolvedDuration = l + s, this.totalDuration = this.resolvedDuration * (i + 1) - s, this.generator = u;
486
- }
487
- updateTime(t) {
488
- const n = Math.round(t - this.startTime) * this.playbackSpeed;
489
- this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
490
- }
491
- tick(t, n = !1) {
492
- const { generator: i, totalDuration: s, mixKeyframes: a, mirroredGenerator: r, resolvedDuration: o, calculatedDuration: c } = this;
493
- if (this.startTime === null)
494
- return i.next(0);
495
- const { delay: u = 0, keyframes: l, repeat: f, repeatType: h, repeatDelay: p, type: b, onUpdate: g, finalKeyframe: T } = this.options;
496
- this.speed > 0 ? this.startTime = Math.min(this.startTime, t) : this.speed < 0 && (this.startTime = Math.min(t - s / this.speed, this.startTime)), n ? this.currentTime = t : this.updateTime(t);
497
- const d = this.currentTime - u * (this.playbackSpeed >= 0 ? 1 : -1), v = this.playbackSpeed >= 0 ? d < 0 : d > s;
498
- this.currentTime = Math.max(d, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = s);
499
- let x = this.currentTime, M = i;
500
- if (f) {
501
- const y = Math.min(this.currentTime, s) / o;
502
- let D = Math.floor(y), C = y % 1;
503
- !C && y >= 1 && (C = 1), C === 1 && D--, D = Math.min(D, f + 1), D % 2 && (h === "reverse" ? (C = 1 - C, p && (C -= p / o)) : h === "mirror" && (M = r)), x = _(0, 1, C) * o;
504
- }
505
- const m = v ? { done: !1, value: l[0] } : M.next(x);
506
- a && (m.value = a(m.value));
507
- let { done: A } = m;
508
- !v && c !== null && (A = this.playbackSpeed >= 0 ? this.currentTime >= s : this.currentTime <= 0);
509
- const S = this.holdTime === null && (this.state === "finished" || this.state === "running" && A);
510
- return S && b !== fe && (m.value = Se(l, this.options, T, this.speed)), g && g(m.value), S && this.finish(), m;
511
- }
512
- /**
513
- * Allows the returned animation to be awaited or promise-chained. Currently
514
- * resolves when the animation finishes at all but in a future update could/should
515
- * reject if its cancels.
516
- */
517
- then(t, n) {
518
- return this.finished.then(t, n);
519
- }
520
- get duration() {
521
- return /* @__PURE__ */ k(this.calculatedDuration);
522
- }
523
- get iterationDuration() {
524
- const { delay: t = 0 } = this.options || {};
525
- return this.duration + /* @__PURE__ */ k(t);
526
- }
527
- get time() {
528
- return /* @__PURE__ */ k(this.currentTime);
529
- }
530
- set time(t) {
531
- t = /* @__PURE__ */ F(t), this.currentTime = t, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = t : this.driver && (this.startTime = this.driver.now() - t / this.playbackSpeed), this.driver?.start(!1);
532
- }
533
- get speed() {
534
- return this.playbackSpeed;
535
- }
536
- set speed(t) {
537
- this.updateTime(O.now());
538
- const n = this.playbackSpeed !== t;
539
- this.playbackSpeed = t, n && (this.time = /* @__PURE__ */ k(this.currentTime));
540
- }
541
- play() {
542
- if (this.isStopped)
543
- return;
544
- const { driver: t = Gn, startTime: n } = this.options;
545
- this.driver || (this.driver = t((s) => this.tick(s))), this.options.onPlay?.();
546
- const i = this.driver.now();
547
- this.state === "finished" ? (this.updateFinished(), this.startTime = i) : this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime || (this.startTime = n ?? i), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
548
- }
549
- pause() {
550
- this.state = "paused", this.updateTime(O.now()), this.holdTime = this.currentTime;
551
- }
552
- complete() {
553
- this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
554
- }
555
- finish() {
556
- this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
557
- }
558
- cancel() {
559
- this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
560
- }
561
- teardown() {
562
- this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
563
- }
564
- stopDriver() {
565
- this.driver && (this.driver.stop(), this.driver = void 0);
566
- }
567
- sample(t) {
568
- return this.startTime = 0, this.tick(t, !0);
569
- }
570
- attachTimeline(t) {
571
- return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), t.observe(this);
572
- }
573
- }
574
- const si = (e) => e.startsWith("--");
575
- function ai(e, t, n) {
576
- si(t) ? e.style.setProperty(t, n) : e.style[t] = n;
577
- }
578
- const ri = /* @__PURE__ */ be(() => window.ScrollTimeline !== void 0), oi = {};
579
- function li(e, t) {
580
- const n = /* @__PURE__ */ be(e);
581
- return () => oi[t] ?? n();
582
- }
583
- const kt = /* @__PURE__ */ li(() => {
584
- try {
585
- document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
586
- } catch {
587
- return !1;
588
- }
589
- return !0;
590
- }, "linearEasing"), H = ([e, t, n, i]) => `cubic-bezier(${e}, ${t}, ${n}, ${i})`, _e = {
591
- linear: "linear",
592
- ease: "ease",
593
- easeIn: "ease-in",
594
- easeOut: "ease-out",
595
- easeInOut: "ease-in-out",
596
- circIn: /* @__PURE__ */ H([0, 0.65, 0.55, 1]),
597
- circOut: /* @__PURE__ */ H([0.55, 0, 1, 0.45]),
598
- backIn: /* @__PURE__ */ H([0.31, 0.01, 0.66, -0.59]),
599
- backOut: /* @__PURE__ */ H([0.33, 1.53, 0.69, 0.99])
600
- };
601
- function Ft(e, t) {
602
- if (e)
603
- return typeof e == "function" ? kt() ? Mt(e, t) : "ease-out" : St(e) ? H(e) : Array.isArray(e) ? e.map((n) => Ft(n, t) || _e.easeOut) : _e[e];
604
- }
605
- function ci(e, t, n, { delay: i = 0, duration: s = 300, repeat: a = 0, repeatType: r = "loop", ease: o = "easeOut", times: c } = {}, u = void 0) {
606
- const l = {
607
- [t]: n
608
- };
609
- c && (l.offset = c);
610
- const f = Ft(o, s);
611
- Array.isArray(f) && (l.easing = f);
612
- const h = {
613
- delay: i,
614
- duration: s,
615
- easing: Array.isArray(f) ? "linear" : f,
616
- fill: "both",
617
- iterations: a + 1,
618
- direction: r === "reverse" ? "alternate" : "normal"
619
- };
620
- return u && (h.pseudoElement = u), e.animate(l, h);
621
- }
622
- function Ot(e) {
623
- return typeof e == "function" && "applyToOptions" in e;
624
- }
625
- function ui({ type: e, ...t }) {
626
- return Ot(e) && kt() ? e.applyToOptions(t) : (t.duration ?? (t.duration = 300), t.ease ?? (t.ease = "easeOut"), t);
627
- }
628
- class fi extends Ve {
629
- constructor(t) {
630
- if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !t)
631
- return;
632
- const { element: n, name: i, keyframes: s, pseudoElement: a, allowFlatten: r = !1, finalKeyframe: o, onComplete: c } = t;
633
- this.isPseudoElement = !!a, this.allowFlatten = r, this.options = t, N(typeof t.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
634
- const u = ui(t);
635
- this.animation = ci(n, i, s, u, a), u.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
636
- if (this.finishedTime = this.time, !a) {
637
- const l = Se(s, this.options, o, this.speed);
638
- this.updateMotionValue ? this.updateMotionValue(l) : ai(n, i, l), this.animation.cancel();
639
- }
640
- c?.(), this.notifyFinished();
641
- };
642
- }
643
- play() {
644
- this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished());
645
- }
646
- pause() {
647
- this.animation.pause();
648
- }
649
- complete() {
650
- this.animation.finish?.();
651
- }
652
- cancel() {
653
- try {
654
- this.animation.cancel();
655
- } catch {
656
- }
657
- }
658
- stop() {
659
- if (this.isStopped)
660
- return;
661
- this.isStopped = !0;
662
- const { state: t } = this;
663
- t === "idle" || t === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
664
- }
665
- /**
666
- * WAAPI doesn't natively have any interruption capabilities.
667
- *
668
- * In this method, we commit styles back to the DOM before cancelling
669
- * the animation.
670
- *
671
- * This is designed to be overridden by NativeAnimationExtended, which
672
- * will create a renderless JS animation and sample it twice to calculate
673
- * its current value, "previous" value, and therefore allow
674
- * Motion to also correctly calculate velocity for any subsequent animation
675
- * while deferring the commit until the next animation frame.
676
- */
677
- commitStyles() {
678
- this.isPseudoElement || this.animation.commitStyles?.();
679
- }
680
- get duration() {
681
- const t = this.animation.effect?.getComputedTiming?.().duration || 0;
682
- return /* @__PURE__ */ k(Number(t));
683
- }
684
- get iterationDuration() {
685
- const { delay: t = 0 } = this.options || {};
686
- return this.duration + /* @__PURE__ */ k(t);
687
- }
688
- get time() {
689
- return /* @__PURE__ */ k(Number(this.animation.currentTime) || 0);
690
- }
691
- set time(t) {
692
- this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ F(t);
693
- }
694
- /**
695
- * The playback speed of the animation.
696
- * 1 = normal speed, 2 = double speed, 0.5 = half speed.
697
- */
698
- get speed() {
699
- return this.animation.playbackRate;
700
- }
701
- set speed(t) {
702
- t < 0 && (this.finishedTime = null), this.animation.playbackRate = t;
703
- }
704
- get state() {
705
- return this.finishedTime !== null ? "finished" : this.animation.playState;
706
- }
707
- get startTime() {
708
- return this.manualStartTime ?? Number(this.animation.startTime);
709
- }
710
- set startTime(t) {
711
- this.manualStartTime = this.animation.startTime = t;
712
- }
713
- /**
714
- * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
715
- */
716
- attachTimeline({ timeline: t, observe: n }) {
717
- return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, t && ri() ? (this.animation.timeline = t, j) : n(this);
718
- }
719
- }
720
- const It = {
721
- anticipate: xt,
722
- backInOut: vt,
723
- circInOut: At
724
- };
725
- function hi(e) {
726
- return e in It;
727
- }
728
- function di(e) {
729
- typeof e.ease == "string" && hi(e.ease) && (e.ease = It[e.ease]);
730
- }
731
- const se = 10;
732
- class mi extends fi {
733
- constructor(t) {
734
- di(t), Pt(t), super(t), t.startTime !== void 0 && (this.startTime = t.startTime), this.options = t;
735
- }
736
- /**
737
- * WAAPI doesn't natively have any interruption capabilities.
738
- *
739
- * Rather than read committed styles back out of the DOM, we can
740
- * create a renderless JS animation and sample it twice to calculate
741
- * its current value, "previous" value, and therefore allow
742
- * Motion to calculate velocity for any subsequent animation.
743
- */
744
- updateMotionValue(t) {
745
- const { motionValue: n, onUpdate: i, onComplete: s, element: a, ...r } = this.options;
746
- if (!n)
747
- return;
748
- if (t !== void 0) {
749
- n.set(t);
750
- return;
751
- }
752
- const o = new De({
753
- ...r,
754
- autoplay: !1
755
- }), c = Math.max(se, O.now() - this.startTime), u = _(0, se, c - se);
756
- n.setWithVelocity(o.sample(Math.max(0, c - u)).value, o.sample(c).value, u), o.stop();
757
- }
758
- }
759
- const $e = (e, t) => t === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && // It's animatable if we have a string
760
- (ot.test(e) || e === "0") && // And it contains numbers and/or colors
761
- !e.startsWith("url("));
762
- function pi(e) {
763
- const t = e[0];
764
- if (e.length === 1)
765
- return !0;
766
- for (let n = 0; n < e.length; n++)
767
- if (e[n] !== t)
768
- return !0;
769
- }
770
- function yi(e, t, n, i) {
771
- const s = e[0];
772
- if (s === null)
773
- return !1;
774
- if (t === "display" || t === "visibility")
775
- return !0;
776
- const a = e[e.length - 1], r = $e(s, t), o = $e(a, t);
777
- return Q(r === o, `You are trying to animate ${t} from "${s}" to "${a}". "${r ? a : s}" is not an animatable value.`, "value-not-animatable"), !r || !o ? !1 : pi(e) || (n === "spring" || Ot(n)) && i;
778
- }
779
- function he(e) {
780
- e.duration = 0, e.type = "keyframes";
781
- }
782
- const gi = /* @__PURE__ */ new Set([
783
- "opacity",
784
- "clipPath",
785
- "filter",
786
- "transform"
787
- // TODO: Could be re-enabled now we have support for linear() easing
788
- // "background-color"
789
- ]), Ti = /* @__PURE__ */ be(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
790
- function bi(e) {
791
- const { motionValue: t, name: n, repeatDelay: i, repeatType: s, damping: a, type: r } = e;
792
- if (!(t?.owner?.current instanceof HTMLElement))
793
- return !1;
794
- const { onUpdate: c, transformTemplate: u } = t.owner.getProps();
795
- return Ti() && n && gi.has(n) && (n !== "transform" || !u) && /**
796
- * If we're outputting values to onUpdate then we can't use WAAPI as there's
797
- * no way to read the value from WAAPI every frame.
798
- */
799
- !c && !i && s !== "mirror" && a !== 0 && r !== "inertia";
800
- }
801
- const vi = 40;
802
- class xi extends Ve {
803
- constructor({ autoplay: t = !0, delay: n = 0, type: i = "keyframes", repeat: s = 0, repeatDelay: a = 0, repeatType: r = "loop", keyframes: o, name: c, motionValue: u, element: l, ...f }) {
804
- super(), this.stop = () => {
805
- this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
806
- }, this.createdAt = O.now();
807
- const h = {
808
- autoplay: t,
809
- delay: n,
810
- type: i,
811
- repeat: s,
812
- repeatDelay: a,
813
- repeatType: r,
814
- name: c,
815
- motionValue: u,
816
- element: l,
817
- ...f
818
- }, p = l?.KeyframeResolver || lt;
819
- this.keyframeResolver = new p(o, (b, g, T) => this.onKeyframesResolved(b, g, h, !T), c, u, l), this.keyframeResolver?.scheduleResolve();
820
- }
821
- onKeyframesResolved(t, n, i, s) {
822
- this.keyframeResolver = void 0;
823
- const { name: a, type: r, velocity: o, delay: c, isHandoff: u, onUpdate: l } = i;
824
- this.resolvedAt = O.now(), yi(t, a, r, o) || (($.instantAnimations || !c) && l?.(Se(t, i, n)), t[0] = t[t.length - 1], he(i), i.repeat = 0);
825
- const h = {
826
- startTime: s ? this.resolvedAt ? this.resolvedAt - this.createdAt > vi ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
827
- finalKeyframe: n,
828
- ...i,
829
- keyframes: t
830
- }, p = !u && bi(h), b = h.motionValue?.owner?.current, g = p ? new mi({
831
- ...h,
832
- element: b
833
- }) : new De(h);
834
- g.finished.then(() => {
835
- this.notifyFinished();
836
- }).catch(j), this.pendingTimeline && (this.stopTimeline = g.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = g;
837
- }
838
- get finished() {
839
- return this._animation ? this.animation.finished : this._finished;
840
- }
841
- then(t, n) {
842
- return this.finished.finally(t).then(() => {
843
- });
844
- }
845
- get animation() {
846
- return this._animation || (this.keyframeResolver?.resume(), en()), this._animation;
847
- }
848
- get duration() {
849
- return this.animation.duration;
850
- }
851
- get iterationDuration() {
852
- return this.animation.iterationDuration;
853
- }
854
- get time() {
855
- return this.animation.time;
856
- }
857
- set time(t) {
858
- this.animation.time = t;
859
- }
860
- get speed() {
861
- return this.animation.speed;
862
- }
863
- get state() {
864
- return this.animation.state;
865
- }
866
- set speed(t) {
867
- this.animation.speed = t;
868
- }
869
- get startTime() {
870
- return this.animation.startTime;
871
- }
872
- attachTimeline(t) {
873
- return this._animation ? this.stopTimeline = this.animation.attachTimeline(t) : this.pendingTimeline = t, () => this.stop();
874
- }
875
- play() {
876
- this.animation.play();
877
- }
878
- pause() {
879
- this.animation.pause();
880
- }
881
- complete() {
882
- this.animation.complete();
883
- }
884
- cancel() {
885
- this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
886
- }
887
- }
888
- function Et(e, t, n, i = 0, s = 1) {
889
- const a = Array.from(e).sort((u, l) => u.sortNodePosition(l)).indexOf(t), r = e.size, o = (r - 1) * i;
890
- return typeof n == "function" ? n(a, r) : s === 1 ? a * i : o - a * i;
891
- }
892
- const Ai = (
893
- // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
894
- /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
895
- );
896
- function wi(e) {
897
- const t = Ai.exec(e);
898
- if (!t)
899
- return [,];
900
- const [, n, i, s] = t;
901
- return [`--${n ?? i}`, s];
902
- }
903
- const Si = 4;
904
- function Kt(e, t, n = 1) {
905
- N(n <= Si, `Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
906
- const [i, s] = wi(e);
907
- if (!i)
908
- return;
909
- const a = window.getComputedStyle(t).getPropertyValue(i);
910
- if (a) {
911
- const r = a.trim();
912
- return tn(r) ? parseFloat(r) : r;
913
- }
914
- return ge(s) ? Kt(s, t, n + 1) : s;
915
- }
916
- const Vi = {
917
- type: "spring",
918
- stiffness: 500,
919
- damping: 25,
920
- restSpeed: 10
921
- }, Di = (e) => ({
922
- type: "spring",
923
- stiffness: 550,
924
- damping: e === 0 ? 2 * Math.sqrt(550) : 30,
925
- restSpeed: 10
926
- }), Mi = {
927
- type: "keyframes",
928
- duration: 0.8
929
- }, Ci = {
930
- type: "keyframes",
931
- ease: [0.25, 0.1, 0.35, 1],
932
- duration: 0.3
933
- }, Pi = (e, { keyframes: t }) => t.length > 2 ? Mi : Te.has(e) ? e.startsWith("scale") ? Di(t[1]) : Vi : Ci, ki = (e) => e !== null;
934
- function Fi(e, { repeat: t, repeatType: n = "loop" }, i) {
935
- const s = e.filter(ki), a = t && n !== "loop" && t % 2 === 1 ? 0 : s.length - 1;
936
- return s[a];
937
- }
938
- function Rt(e, t) {
939
- return e?.[t] ?? e?.default ?? e;
940
- }
941
- function Oi({ when: e, delay: t, delayChildren: n, staggerChildren: i, staggerDirection: s, repeat: a, repeatType: r, repeatDelay: o, from: c, elapsed: u, ...l }) {
942
- return !!Object.keys(l).length;
943
- }
944
- const Ii = (e, t, n, i = {}, s, a) => (r) => {
945
- const o = Rt(i, e) || {}, c = o.delay || i.delay || 0;
946
- let { elapsed: u = 0 } = i;
947
- u = u - /* @__PURE__ */ F(c);
948
- const l = {
949
- keyframes: Array.isArray(n) ? n : [null, n],
950
- ease: "easeOut",
951
- velocity: t.getVelocity(),
952
- ...o,
953
- delay: -u,
954
- onUpdate: (h) => {
955
- t.set(h), o.onUpdate && o.onUpdate(h);
956
- },
957
- onComplete: () => {
958
- r(), o.onComplete && o.onComplete();
959
- },
960
- name: e,
961
- motionValue: t,
962
- element: a ? void 0 : s
963
- };
964
- Oi(o) || Object.assign(l, Pi(e, l)), l.duration && (l.duration = /* @__PURE__ */ F(l.duration)), l.repeatDelay && (l.repeatDelay = /* @__PURE__ */ F(l.repeatDelay)), l.from !== void 0 && (l.keyframes[0] = l.from);
965
- let f = !1;
966
- if ((l.type === !1 || l.duration === 0 && !l.repeatDelay) && (he(l), l.delay === 0 && (f = !0)), ($.instantAnimations || $.skipAnimations) && (f = !0, he(l), l.delay = 0), l.allowFlatten = !o.type && !o.ease, f && !a && t.get() !== void 0) {
967
- const h = Fi(l.keyframes, o);
968
- if (h !== void 0) {
969
- G.update(() => {
970
- l.onUpdate(h), l.onComplete();
971
- });
972
- return;
973
- }
974
- }
975
- return o.isSync ? new De(l) : new xi(l);
976
- };
977
- function L(e, t, n) {
978
- const i = e.getProps();
979
- return nn(i, t, n !== void 0 ? n : i.custom, e);
980
- }
981
- const Bt = /* @__PURE__ */ new Set([
982
- "width",
983
- "height",
984
- "top",
985
- "left",
986
- "right",
987
- "bottom",
988
- ...sn
989
- ]), de = (e) => Array.isArray(e);
990
- function Ei(e, t, n) {
991
- e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, an(n));
992
- }
993
- function Ki(e) {
994
- return de(e) ? e[e.length - 1] || 0 : e;
995
- }
996
- function Ri(e, t) {
997
- const n = L(e, t);
998
- let { transitionEnd: i = {}, transition: s = {}, ...a } = n || {};
999
- a = { ...a, ...i };
1000
- for (const r in a) {
1001
- const o = Ki(a[r]);
1002
- Ei(e, r, o);
1003
- }
1004
- }
1005
- function Bi(e) {
1006
- return !!(ct(e) && e.add);
1007
- }
1008
- function Li(e, t) {
1009
- const n = e.getValue("willChange");
1010
- if (Bi(n))
1011
- return n.add(t);
1012
- if (!n && $.WillChange) {
1013
- const i = new $.WillChange("auto");
1014
- e.addValue("willChange", i), i.add(t);
1015
- }
1016
- }
1017
- function Ni(e) {
1018
- return e.props[rn];
1019
- }
1020
- function Gi({ protectedKeys: e, needsAnimating: t }, n) {
1021
- const i = e.hasOwnProperty(n) && t[n] !== !0;
1022
- return t[n] = !1, i;
1023
- }
1024
- function Lt(e, t, { delay: n = 0, transitionOverride: i, type: s } = {}) {
1025
- let { transition: a = e.getDefaultTransition(), transitionEnd: r, ...o } = t;
1026
- i && (a = i);
1027
- const c = [], u = s && e.animationState && e.animationState.getState()[s];
1028
- for (const l in o) {
1029
- const f = e.getValue(l, e.latestValues[l] ?? null), h = o[l];
1030
- if (h === void 0 || u && Gi(u, l))
1031
- continue;
1032
- const p = {
1033
- delay: n,
1034
- ...Rt(a || {}, l)
1035
- }, b = f.get();
1036
- if (b !== void 0 && !f.isAnimating && !Array.isArray(h) && h === b && !p.velocity)
1037
- continue;
1038
- let g = !1;
1039
- if (window.MotionHandoffAnimation) {
1040
- const d = Ni(e);
1041
- if (d) {
1042
- const v = window.MotionHandoffAnimation(d, l, G);
1043
- v !== null && (p.startTime = v, g = !0);
1044
- }
1045
- }
1046
- Li(e, l), f.start(Ii(l, f, h, e.shouldReduceMotion && Bt.has(l) ? { type: !1 } : p, e, g));
1047
- const T = f.animation;
1048
- T && c.push(T);
1049
- }
1050
- return r && Promise.all(c).then(() => {
1051
- G.update(() => {
1052
- r && Ri(e, r);
1053
- });
1054
- }), c;
1055
- }
1056
- function me(e, t, n = {}) {
1057
- const i = L(e, t, n.type === "exit" ? e.presenceContext?.custom : void 0);
1058
- let { transition: s = e.getDefaultTransition() || {} } = i || {};
1059
- n.transitionOverride && (s = n.transitionOverride);
1060
- const a = i ? () => Promise.all(Lt(e, i, n)) : () => Promise.resolve(), r = e.variantChildren && e.variantChildren.size ? (c = 0) => {
1061
- const { delayChildren: u = 0, staggerChildren: l, staggerDirection: f } = s;
1062
- return _i(e, t, c, u, l, f, n);
1063
- } : () => Promise.resolve(), { when: o } = s;
1064
- if (o) {
1065
- const [c, u] = o === "beforeChildren" ? [a, r] : [r, a];
1066
- return c().then(() => u());
1067
- } else
1068
- return Promise.all([a(), r(n.delay)]);
1069
- }
1070
- function _i(e, t, n = 0, i = 0, s = 0, a = 1, r) {
1071
- const o = [];
1072
- for (const c of e.variantChildren)
1073
- c.notify("AnimationStart", t), o.push(me(c, t, {
1074
- ...r,
1075
- delay: n + (typeof i == "function" ? 0 : i) + Et(e.variantChildren, c, i, s, a)
1076
- }).then(() => c.notify("AnimationComplete", t)));
1077
- return Promise.all(o);
1078
- }
1079
- function $i(e, t, n = {}) {
1080
- e.notify("AnimationStart", t);
1081
- let i;
1082
- if (Array.isArray(t)) {
1083
- const s = t.map((a) => me(e, a, n));
1084
- i = Promise.all(s);
1085
- } else if (typeof t == "string")
1086
- i = me(e, t, n);
1087
- else {
1088
- const s = typeof t == "function" ? L(e, t, n.custom) : t;
1089
- i = Promise.all(Lt(e, s, n));
1090
- }
1091
- return i.then(() => {
1092
- e.notify("AnimationComplete", t);
1093
- });
1094
- }
1095
- function Wi(e) {
1096
- return typeof e == "number" ? e === 0 : e !== null ? e === "none" || e === "0" || on(e) : !0;
1097
- }
1098
- const Hi = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1099
- function ji(e, t, n) {
1100
- let i = 0, s;
1101
- for (; i < e.length && !s; ) {
1102
- const a = e[i];
1103
- typeof a == "string" && !Hi.has(a) && le(a).values.length && (s = e[i]), i++;
1104
- }
1105
- if (s && n)
1106
- for (const a of t)
1107
- e[a] = ln(n, s);
1108
- }
1109
- class Ui extends lt {
1110
- constructor(t, n, i, s, a) {
1111
- super(t, n, i, s, a, !0);
1112
- }
1113
- readKeyframes() {
1114
- const { unresolvedKeyframes: t, element: n, name: i } = this;
1115
- if (!n || !n.current)
1116
- return;
1117
- super.readKeyframes();
1118
- for (let l = 0; l < t.length; l++) {
1119
- let f = t[l];
1120
- if (typeof f == "string" && (f = f.trim(), ge(f))) {
1121
- const h = Kt(f, n.current);
1122
- h !== void 0 && (t[l] = h), l === t.length - 1 && (this.finalKeyframe = f);
1123
- }
1124
- }
1125
- if (this.resolveNoneKeyframes(), !Bt.has(i) || t.length !== 2)
1126
- return;
1127
- const [s, a] = t, r = Ie(s), o = Ie(a), c = Ee(s), u = Ee(a);
1128
- if (c !== u && q[i]) {
1129
- this.needsMeasurement = !0;
1130
- return;
1131
- }
1132
- if (r !== o)
1133
- if (Ke(r) && Ke(o))
1134
- for (let l = 0; l < t.length; l++) {
1135
- const f = t[l];
1136
- typeof f == "string" && (t[l] = parseFloat(f));
1137
- }
1138
- else q[i] && (this.needsMeasurement = !0);
1139
- }
1140
- resolveNoneKeyframes() {
1141
- const { unresolvedKeyframes: t, name: n } = this, i = [];
1142
- for (let s = 0; s < t.length; s++)
1143
- (t[s] === null || Wi(t[s])) && i.push(s);
1144
- i.length && ji(t, i, n);
1145
- }
1146
- measureInitialState() {
1147
- const { element: t, unresolvedKeyframes: n, name: i } = this;
1148
- if (!t || !t.current)
1149
- return;
1150
- i === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = q[i](t.measureViewportBox(), window.getComputedStyle(t.current)), n[0] = this.measuredOrigin;
1151
- const s = n[n.length - 1];
1152
- s !== void 0 && t.getValue(i, s).jump(s, !1);
1153
- }
1154
- measureEndState() {
1155
- const { element: t, name: n, unresolvedKeyframes: i } = this;
1156
- if (!t || !t.current)
1157
- return;
1158
- const s = t.getValue(n);
1159
- s && s.jump(this.measuredOrigin, !1);
1160
- const a = i.length - 1, r = i[a];
1161
- i[a] = q[n](t.measureViewportBox(), window.getComputedStyle(t.current)), r !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = r), this.removedTransforms?.length && this.removedTransforms.forEach(([o, c]) => {
1162
- t.getValue(o).set(c);
1163
- }), this.resolveNoneKeyframes();
1164
- }
1165
- }
1166
- function zi(e, t, n) {
1167
- if (e == null)
1168
- return [];
1169
- if (e instanceof EventTarget)
1170
- return [e];
1171
- if (typeof e == "string") {
1172
- let i = document;
1173
- const s = n?.[e] ?? i.querySelectorAll(e);
1174
- return s ? Array.from(s) : [];
1175
- }
1176
- return Array.from(e).filter((i) => i != null);
1177
- }
1178
- const We = {
1179
- x: !1,
1180
- y: !1
1181
- };
1182
- function Nt() {
1183
- return We.x || We.y;
1184
- }
1185
- function Gt(e, t) {
1186
- const n = zi(e), i = new AbortController(), s = {
1187
- passive: !0,
1188
- ...t,
1189
- signal: i.signal
1190
- };
1191
- return [n, s, () => i.abort()];
1192
- }
1193
- function He(e) {
1194
- return !(e.pointerType === "touch" || Nt());
1195
- }
1196
- function qi(e, t, n = {}) {
1197
- const [i, s, a] = Gt(e, n), r = (o) => {
1198
- if (!He(o))
1199
- return;
1200
- const { target: c } = o, u = t(c, o);
1201
- if (typeof u != "function" || !c)
1202
- return;
1203
- const l = (f) => {
1204
- He(f) && (u(f), c.removeEventListener("pointerleave", l));
1205
- };
1206
- c.addEventListener("pointerleave", l, s);
1207
- };
1208
- return i.forEach((o) => {
1209
- o.addEventListener("pointerenter", r, s);
1210
- }), a;
1211
- }
1212
- const _t = (e, t) => t ? e === t ? !0 : _t(e, t.parentElement) : !1, $t = (e) => e.pointerType === "mouse" ? typeof e.button != "number" || e.button <= 0 : e.isPrimary !== !1, Xi = /* @__PURE__ */ new Set([
1213
- "BUTTON",
1214
- "INPUT",
1215
- "SELECT",
1216
- "TEXTAREA",
1217
- "A"
1218
- ]);
1219
- function Yi(e) {
1220
- return Xi.has(e.tagName) || e.isContentEditable === !0;
1221
- }
1222
- const X = /* @__PURE__ */ new WeakSet();
1223
- function je(e) {
1224
- return (t) => {
1225
- t.key === "Enter" && e(t);
1226
- };
1227
- }
1228
- function ae(e, t) {
1229
- e.dispatchEvent(new PointerEvent("pointer" + t, { isPrimary: !0, bubbles: !0 }));
1230
- }
1231
- const Zi = (e, t) => {
1232
- const n = e.currentTarget;
1233
- if (!n)
1234
- return;
1235
- const i = je(() => {
1236
- if (X.has(n))
1237
- return;
1238
- ae(n, "down");
1239
- const s = je(() => {
1240
- ae(n, "up");
1241
- }), a = () => ae(n, "cancel");
1242
- n.addEventListener("keyup", s, t), n.addEventListener("blur", a, t);
1243
- });
1244
- n.addEventListener("keydown", i, t), n.addEventListener("blur", () => n.removeEventListener("keydown", i), t);
1245
- };
1246
- function Ue(e) {
1247
- return $t(e) && !Nt();
1248
- }
1249
- function Ji(e, t, n = {}) {
1250
- const [i, s, a] = Gt(e, n), r = (o) => {
1251
- const c = o.currentTarget;
1252
- if (!Ue(o))
1253
- return;
1254
- X.add(c);
1255
- const u = t(c, o), l = (p, b) => {
1256
- window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", h), X.has(c) && X.delete(c), Ue(p) && typeof u == "function" && u(p, { success: b });
1257
- }, f = (p) => {
1258
- l(p, c === window || c === document || n.useGlobalTarget || _t(c, p.target));
1259
- }, h = (p) => {
1260
- l(p, !1);
1261
- };
1262
- window.addEventListener("pointerup", f, s), window.addEventListener("pointercancel", h, s);
1263
- };
1264
- return i.forEach((o) => {
1265
- (n.useGlobalTarget ? window : o).addEventListener("pointerdown", r, s), cn(o) && (o.addEventListener("focus", (u) => Zi(u, s)), !Yi(o) && !o.hasAttribute("tabindex") && (o.tabIndex = 0));
1266
- }), a;
1267
- }
1268
- class Wt extends un {
1269
- constructor() {
1270
- super(...arguments), this.KeyframeResolver = Ui;
1271
- }
1272
- sortInstanceNodePosition(t, n) {
1273
- return t.compareDocumentPosition(n) & 2 ? 1 : -1;
1274
- }
1275
- getBaseTargetFromProps(t, n) {
1276
- const i = t.style;
1277
- return i ? i[n] : void 0;
1278
- }
1279
- removeValueFromRenderState(t, { vars: n, style: i }) {
1280
- delete n[t], delete i[t];
1281
- }
1282
- handleChildMotionValue() {
1283
- this.childSubscription && (this.childSubscription(), delete this.childSubscription);
1284
- const { children: t } = this.props;
1285
- ct(t) && (this.childSubscription = t.on("change", (n) => {
1286
- this.current && (this.current.textContent = `${n}`);
1287
- }));
1288
- }
1289
- }
1290
- class W {
1291
- constructor(t) {
1292
- this.isMounted = !1, this.node = t;
1293
- }
1294
- update() {
1295
- }
1296
- }
1297
- function Qi({ top: e, left: t, right: n, bottom: i }) {
1298
- return {
1299
- x: { min: t, max: n },
1300
- y: { min: e, max: i }
1301
- };
1302
- }
1303
- function Es({ x: e, y: t }) {
1304
- return { top: t.min, right: e.max, bottom: t.max, left: e.min };
1305
- }
1306
- function es(e, t) {
1307
- if (!t)
1308
- return e;
1309
- const n = t({ x: e.left, y: e.top }), i = t({ x: e.right, y: e.bottom });
1310
- return {
1311
- top: n.y,
1312
- left: n.x,
1313
- bottom: i.y,
1314
- right: i.x
1315
- };
1316
- }
1317
- function re(e) {
1318
- return e === void 0 || e === 1;
1319
- }
1320
- function ts({ scale: e, scaleX: t, scaleY: n }) {
1321
- return !re(e) || !re(t) || !re(n);
1322
- }
1323
- function ns(e) {
1324
- return ts(e) || is(e) || e.z || e.rotate || e.rotateX || e.rotateY || e.skewX || e.skewY;
1325
- }
1326
- function is(e) {
1327
- return ze(e.x) || ze(e.y);
1328
- }
1329
- function ze(e) {
1330
- return e && e !== "0%";
1331
- }
1332
- function qe(e, t, n) {
1333
- const i = e - n, s = t * i;
1334
- return n + s;
1335
- }
1336
- function Xe(e, t, n, i, s) {
1337
- return s !== void 0 && (e = qe(e, s, i)), qe(e, n, i) + t;
1338
- }
1339
- function pe(e, t = 0, n = 1, i, s) {
1340
- e.min = Xe(e.min, t, n, i, s), e.max = Xe(e.max, t, n, i, s);
1341
- }
1342
- function ss(e, { x: t, y: n }) {
1343
- pe(e.x, t.translate, t.scale, t.originPoint), pe(e.y, n.translate, n.scale, n.originPoint);
1344
- }
1345
- const Ye = 0.999999999999, Ze = 1.0000000000001;
1346
- function Ks(e, t, n, i = !1) {
1347
- const s = n.length;
1348
- if (!s)
1349
- return;
1350
- t.x = t.y = 1;
1351
- let a, r;
1352
- for (let o = 0; o < s; o++) {
1353
- a = n[o], r = a.projectionDelta;
1354
- const { visualElement: c } = a.options;
1355
- c && c.props.style && c.props.style.display === "contents" || (i && a.options.layoutScroll && a.scroll && a !== a.root && et(e, {
1356
- x: -a.scroll.offset.x,
1357
- y: -a.scroll.offset.y
1358
- }), r && (t.x *= r.x.scale, t.y *= r.y.scale, ss(e, r)), i && ns(a.latestValues) && et(e, a.latestValues));
1359
- }
1360
- t.x < Ze && t.x > Ye && (t.x = 1), t.y < Ze && t.y > Ye && (t.y = 1);
1361
- }
1362
- function Je(e, t) {
1363
- e.min = e.min + t, e.max = e.max + t;
1364
- }
1365
- function Qe(e, t, n, i, s = 0.5) {
1366
- const a = U(e.min, e.max, s);
1367
- pe(e, t, n, a, i);
1368
- }
1369
- function et(e, t) {
1370
- Qe(e.x, t.x, t.scaleX, t.scale, t.originX), Qe(e.y, t.y, t.scaleY, t.scale, t.originY);
1371
- }
1372
- function Ht(e, t) {
1373
- return Qi(es(e.getBoundingClientRect(), t));
1374
- }
1375
- function Rs(e, t, n) {
1376
- const i = Ht(e, n), { scroll: s } = t;
1377
- return s && (Je(i.x, s.offset.x), Je(i.y, s.offset.y)), i;
1378
- }
1379
- function jt(e, { style: t, vars: n }, i, s) {
1380
- const a = e.style;
1381
- let r;
1382
- for (r in t)
1383
- a[r] = t[r];
1384
- s?.applyProjectionStyles(a, i);
1385
- for (r in n)
1386
- a.setProperty(r, n[r]);
1387
- }
1388
- function as(e) {
1389
- return window.getComputedStyle(e);
1390
- }
1391
- class rs extends Wt {
1392
- constructor() {
1393
- super(...arguments), this.type = "html", this.renderInstance = jt;
1394
- }
1395
- readValueFromInstance(t, n) {
1396
- if (Te.has(n))
1397
- return this.projection?.isProjecting ? fn(n) : hn(t, n);
1398
- {
1399
- const i = as(t), s = (dn(n) ? i.getPropertyValue(n) : i[n]) || 0;
1400
- return typeof s == "string" ? s.trim() : s;
1401
- }
1402
- }
1403
- measureInstanceViewportBox(t, { transformPagePoint: n }) {
1404
- return Ht(t, n);
1405
- }
1406
- build(t, n, i) {
1407
- mn(t, n, i.transformTemplate);
1408
- }
1409
- scrapeMotionValuesFromProps(t, n, i) {
1410
- return pn(t, n, i);
1411
- }
1412
- }
1413
- const Ut = /* @__PURE__ */ new Set([
1414
- "baseFrequency",
1415
- "diffuseConstant",
1416
- "kernelMatrix",
1417
- "kernelUnitLength",
1418
- "keySplines",
1419
- "keyTimes",
1420
- "limitingConeAngle",
1421
- "markerHeight",
1422
- "markerWidth",
1423
- "numOctaves",
1424
- "targetX",
1425
- "targetY",
1426
- "surfaceScale",
1427
- "specularConstant",
1428
- "specularExponent",
1429
- "stdDeviation",
1430
- "tableValues",
1431
- "viewBox",
1432
- "gradientTransform",
1433
- "pathLength",
1434
- "startOffset",
1435
- "textLength",
1436
- "lengthAdjust"
1437
- ]);
1438
- function os(e, t, n, i) {
1439
- jt(e, t, void 0, i);
1440
- for (const s in t.attrs)
1441
- e.setAttribute(Ut.has(s) ? s : ut(s), t.attrs[s]);
1442
- }
1443
- class ls extends Wt {
1444
- constructor() {
1445
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = yn;
1446
- }
1447
- getBaseTargetFromProps(t, n) {
1448
- return t[n];
1449
- }
1450
- readValueFromInstance(t, n) {
1451
- if (Te.has(n)) {
1452
- const i = gn(n);
1453
- return i && i.default || 0;
1454
- }
1455
- return n = Ut.has(n) ? n : ut(n), t.getAttribute(n);
1456
- }
1457
- scrapeMotionValuesFromProps(t, n, i) {
1458
- return Tn(t, n, i);
1459
- }
1460
- build(t, n, i) {
1461
- bn(t, n, this.isSVGTag, i.transformTemplate, i.style);
1462
- }
1463
- renderInstance(t, n, i, s) {
1464
- os(t, n, i, s);
1465
- }
1466
- mount(t) {
1467
- this.isSVGTag = vn(t.tagName), super.mount(t);
1468
- }
1469
- }
1470
- const cs = ht.length;
1471
- function zt(e) {
1472
- if (!e)
1473
- return;
1474
- if (!e.isControllingVariants) {
1475
- const n = e.parent ? zt(e.parent) || {} : {};
1476
- return e.props.initial !== void 0 && (n.initial = e.props.initial), n;
1477
- }
1478
- const t = {};
1479
- for (let n = 0; n < cs; n++) {
1480
- const i = ht[n], s = e.props[i];
1481
- (ft(s) || s === !1) && (t[i] = s);
1482
- }
1483
- return t;
1484
- }
1485
- function qt(e, t) {
1486
- if (!Array.isArray(t))
1487
- return !1;
1488
- const n = t.length;
1489
- if (n !== e.length)
1490
- return !1;
1491
- for (let i = 0; i < n; i++)
1492
- if (t[i] !== e[i])
1493
- return !1;
1494
- return !0;
1495
- }
1496
- const us = [...mt].reverse(), fs = mt.length;
1497
- function hs(e) {
1498
- return (t) => Promise.all(t.map(({ animation: n, options: i }) => $i(e, n, i)));
1499
- }
1500
- function ds(e) {
1501
- let t = hs(e), n = tt(), i = !0;
1502
- const s = (c) => (u, l) => {
1503
- const f = L(e, l, c === "exit" ? e.presenceContext?.custom : void 0);
1504
- if (f) {
1505
- const { transition: h, transitionEnd: p, ...b } = f;
1506
- u = { ...u, ...b, ...p };
1507
- }
1508
- return u;
1509
- };
1510
- function a(c) {
1511
- t = c(e);
1512
- }
1513
- function r(c) {
1514
- const { props: u } = e, l = zt(e.parent) || {}, f = [], h = /* @__PURE__ */ new Set();
1515
- let p = {}, b = 1 / 0;
1516
- for (let T = 0; T < fs; T++) {
1517
- const d = us[T], v = n[d], x = u[d] !== void 0 ? u[d] : l[d], M = ft(x), m = d === c ? v.isActive : null;
1518
- m === !1 && (b = T);
1519
- let A = x === l[d] && x !== u[d] && M;
1520
- if (A && i && e.manuallyAnimateOnMount && (A = !1), v.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
1521
- !v.isActive && m === null || // If we didn't and don't have any defined prop for this animation type
1522
- !x && !v.prevProp || // Or if the prop doesn't define an animation
1523
- dt(x) || typeof x == "boolean")
1524
- continue;
1525
- const S = ms(v.prevProp, x);
1526
- let y = S || // If we're making this variant active, we want to always make it active
1527
- d === c && v.isActive && !A && M || // If we removed a higher-priority variant (i is in reverse order)
1528
- T > b && M, D = !1;
1529
- const C = Array.isArray(x) ? x : [x];
1530
- let K = C.reduce(s(d), {});
1531
- m === !1 && (K = {});
1532
- const { prevResolvedValues: Ce = {} } = v, Xt = {
1533
- ...Ce,
1534
- ...K
1535
- }, Pe = (V) => {
1536
- y = !0, h.has(V) && (D = !0, h.delete(V)), v.needsAnimating[V] = !0;
1537
- const P = e.getValue(V);
1538
- P && (P.liveStyle = !1);
1539
- };
1540
- for (const V in Xt) {
1541
- const P = K[V], I = Ce[V];
1542
- if (p.hasOwnProperty(V))
1543
- continue;
1544
- let R = !1;
1545
- de(P) && de(I) ? R = !qt(P, I) : R = P !== I, R ? P != null ? Pe(V) : h.add(V) : P !== void 0 && h.has(V) ? Pe(V) : v.protectedKeys[V] = !0;
1546
- }
1547
- v.prevProp = x, v.prevResolvedValues = K, v.isActive && (p = { ...p, ...K }), i && e.blockInitialAnimation && (y = !1);
1548
- const ke = A && S;
1549
- y && (!ke || D) && f.push(...C.map((V) => {
1550
- const P = { type: d };
1551
- if (typeof V == "string" && i && !ke && e.manuallyAnimateOnMount && e.parent) {
1552
- const { parent: I } = e, R = L(I, V);
1553
- if (I.enteringChildren && R) {
1554
- const { delayChildren: Yt } = R.transition || {};
1555
- P.delay = Et(I.enteringChildren, e, Yt);
1556
- }
1557
- }
1558
- return {
1559
- animation: V,
1560
- options: P
1561
- };
1562
- }));
1563
- }
1564
- if (h.size) {
1565
- const T = {};
1566
- if (typeof u.initial != "boolean") {
1567
- const d = L(e, Array.isArray(u.initial) ? u.initial[0] : u.initial);
1568
- d && d.transition && (T.transition = d.transition);
1569
- }
1570
- h.forEach((d) => {
1571
- const v = e.getBaseTarget(d), x = e.getValue(d);
1572
- x && (x.liveStyle = !0), T[d] = v ?? null;
1573
- }), f.push({ animation: T });
1574
- }
1575
- let g = !!f.length;
1576
- return i && (u.initial === !1 || u.initial === u.animate) && !e.manuallyAnimateOnMount && (g = !1), i = !1, g ? t(f) : Promise.resolve();
1577
- }
1578
- function o(c, u) {
1579
- if (n[c].isActive === u)
1580
- return Promise.resolve();
1581
- e.variantChildren?.forEach((f) => f.animationState?.setActive(c, u)), n[c].isActive = u;
1582
- const l = r(c);
1583
- for (const f in n)
1584
- n[f].protectedKeys = {};
1585
- return l;
1586
- }
1587
- return {
1588
- animateChanges: r,
1589
- setActive: o,
1590
- setAnimateFunction: a,
1591
- getState: () => n,
1592
- reset: () => {
1593
- n = tt();
1594
- }
1595
- };
1596
- }
1597
- function ms(e, t) {
1598
- return typeof t == "string" ? t !== e : Array.isArray(t) ? !qt(t, e) : !1;
1599
- }
1600
- function E(e = !1) {
1601
- return {
1602
- isActive: e,
1603
- protectedKeys: {},
1604
- needsAnimating: {},
1605
- prevResolvedValues: {}
1606
- };
1607
- }
1608
- function tt() {
1609
- return {
1610
- animate: E(!0),
1611
- whileInView: E(),
1612
- whileHover: E(),
1613
- whileTap: E(),
1614
- whileDrag: E(),
1615
- whileFocus: E(),
1616
- exit: E()
1617
- };
1618
- }
1619
- function nt(e, t, n, i = { passive: !0 }) {
1620
- return e.addEventListener(t, n, i), () => e.removeEventListener(t, n);
1621
- }
1622
- const ps = (e, t) => t.isSVG ?? xn(e) ? new ls(t) : new rs(t, {
1623
- allowProjection: e !== An
1624
- });
1625
- class ys extends W {
1626
- /**
1627
- * We dynamically generate the AnimationState manager as it contains a reference
1628
- * to the underlying animation library. We only want to load that if we load this,
1629
- * so people can optionally code split it out using the `m` component.
1630
- */
1631
- constructor(t) {
1632
- super(t), t.animationState || (t.animationState = ds(t));
1633
- }
1634
- updateAnimationControlsSubscription() {
1635
- const { animate: t } = this.node.getProps();
1636
- dt(t) && (this.unmountControls = t.subscribe(this.node));
1637
- }
1638
- /**
1639
- * Subscribe any provided AnimationControls to the component's VisualElement
1640
- */
1641
- mount() {
1642
- this.updateAnimationControlsSubscription();
1643
- }
1644
- update() {
1645
- const { animate: t } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
1646
- t !== n && this.updateAnimationControlsSubscription();
1647
- }
1648
- unmount() {
1649
- this.node.animationState.reset(), this.unmountControls?.();
1650
- }
1651
- }
1652
- let gs = 0;
1653
- class Ts extends W {
1654
- constructor() {
1655
- super(...arguments), this.id = gs++;
1656
- }
1657
- update() {
1658
- if (!this.node.presenceContext)
1659
- return;
1660
- const { isPresent: t, onExitComplete: n } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
1661
- if (!this.node.animationState || t === i)
1662
- return;
1663
- const s = this.node.animationState.setActive("exit", !t);
1664
- n && !t && s.then(() => {
1665
- n(this.id);
1666
- });
1667
- }
1668
- mount() {
1669
- const { register: t, onExitComplete: n } = this.node.presenceContext || {};
1670
- n && n(this.id), t && (this.unmount = t(this.id));
1671
- }
1672
- unmount() {
1673
- }
1674
- }
1675
- const bs = {
1676
- animation: {
1677
- Feature: ys
1678
- },
1679
- exit: {
1680
- Feature: Ts
1681
- }
1682
- };
1683
- function Me(e) {
1684
- return {
1685
- point: {
1686
- x: e.pageX,
1687
- y: e.pageY
1688
- }
1689
- };
1690
- }
1691
- const Bs = (e) => (t) => $t(t) && e(t, Me(t));
1692
- function it(e, t, n) {
1693
- const { props: i } = e;
1694
- e.animationState && i.whileHover && e.animationState.setActive("whileHover", n === "Start");
1695
- const s = "onHover" + n, a = i[s];
1696
- a && G.postRender(() => a(t, Me(t)));
1697
- }
1698
- class vs extends W {
1699
- mount() {
1700
- const { current: t } = this.node;
1701
- t && (this.unmount = qi(t, (n, i) => (it(this.node, i, "Start"), (s) => it(this.node, s, "End"))));
1702
- }
1703
- unmount() {
1704
- }
1705
- }
1706
- class xs extends W {
1707
- constructor() {
1708
- super(...arguments), this.isActive = !1;
1709
- }
1710
- onFocus() {
1711
- let t = !1;
1712
- try {
1713
- t = this.node.current.matches(":focus-visible");
1714
- } catch {
1715
- t = !0;
1716
- }
1717
- !t || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
1718
- }
1719
- onBlur() {
1720
- !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
1721
- }
1722
- mount() {
1723
- this.unmount = ee(nt(this.node.current, "focus", () => this.onFocus()), nt(this.node.current, "blur", () => this.onBlur()));
1724
- }
1725
- unmount() {
1726
- }
1727
- }
1728
- function st(e, t, n) {
1729
- const { props: i } = e;
1730
- if (e.current instanceof HTMLButtonElement && e.current.disabled)
1731
- return;
1732
- e.animationState && i.whileTap && e.animationState.setActive("whileTap", n === "Start");
1733
- const s = "onTap" + (n === "End" ? "" : n), a = i[s];
1734
- a && G.postRender(() => a(t, Me(t)));
1735
- }
1736
- class As extends W {
1737
- mount() {
1738
- const { current: t } = this.node;
1739
- t && (this.unmount = Ji(t, (n, i) => (st(this.node, i, "Start"), (s, { success: a }) => st(this.node, s, a ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
1740
- }
1741
- unmount() {
1742
- }
1743
- }
1744
- const ye = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakMap(), ws = (e) => {
1745
- const t = ye.get(e.target);
1746
- t && t(e);
1747
- }, Ss = (e) => {
1748
- e.forEach(ws);
1749
- };
1750
- function Vs({ root: e, ...t }) {
1751
- const n = e || document;
1752
- oe.has(n) || oe.set(n, {});
1753
- const i = oe.get(n), s = JSON.stringify(t);
1754
- return i[s] || (i[s] = new IntersectionObserver(Ss, { root: e, ...t })), i[s];
1755
- }
1756
- function Ds(e, t, n) {
1757
- const i = Vs(t);
1758
- return ye.set(e, n), i.observe(e), () => {
1759
- ye.delete(e), i.unobserve(e);
1760
- };
1761
- }
1762
- const Ms = {
1763
- some: 0,
1764
- all: 1
1765
- };
1766
- class Cs extends W {
1767
- constructor() {
1768
- super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
1769
- }
1770
- startObserver() {
1771
- this.unmount();
1772
- const { viewport: t = {} } = this.node.getProps(), { root: n, margin: i, amount: s = "some", once: a } = t, r = {
1773
- root: n ? n.current : void 0,
1774
- rootMargin: i,
1775
- threshold: typeof s == "number" ? s : Ms[s]
1776
- }, o = (c) => {
1777
- const { isIntersecting: u } = c;
1778
- if (this.isInView === u || (this.isInView = u, a && !u && this.hasEnteredView))
1779
- return;
1780
- u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
1781
- const { onViewportEnter: l, onViewportLeave: f } = this.node.getProps(), h = u ? l : f;
1782
- h && h(c);
1783
- };
1784
- return Ds(this.node.current, r, o);
1785
- }
1786
- mount() {
1787
- this.startObserver();
1788
- }
1789
- update() {
1790
- if (typeof IntersectionObserver > "u")
1791
- return;
1792
- const { props: t, prevProps: n } = this.node;
1793
- ["amount", "margin", "root"].some(Ps(t, n)) && this.startObserver();
1794
- }
1795
- unmount() {
1796
- }
1797
- }
1798
- function Ps({ viewport: e = {} }, { viewport: t = {} } = {}) {
1799
- return (n) => e[n] !== t[n];
1800
- }
1801
- const ks = {
1802
- inView: {
1803
- Feature: Cs
1804
- },
1805
- tap: {
1806
- Feature: As
1807
- },
1808
- focus: {
1809
- Feature: xs
1810
- },
1811
- hover: {
1812
- Feature: vs
1813
- }
1814
- }, Ls = {
1815
- renderer: ps,
1816
- ...bs,
1817
- ...ks
1818
- };
1819
- export {
1820
- Zn as $,
1821
- Yi as A,
1822
- bs as B,
1823
- $i as C,
1824
- xi as D,
1825
- mi as E,
1826
- W as F,
1827
- Et as G,
1828
- Kt as H,
1829
- wi as I,
1830
- De as J,
1831
- Pi as K,
1832
- Fi as L,
1833
- Oi as M,
1834
- fi as N,
1835
- he as O,
1836
- Lt as P,
1837
- me as Q,
1838
- fe as R,
1839
- ei as S,
1840
- B as T,
1841
- J as U,
1842
- we as V,
1843
- Z as W,
1844
- _n as X,
1845
- Ot as Y,
1846
- Ui as Z,
1847
- Jn as _,
1848
- Ii as a,
1849
- Be as a$,
1850
- Qn as a0,
1851
- H as a1,
1852
- Ft as a2,
1853
- _e as a3,
1854
- ci as a4,
1855
- bi as a5,
1856
- ui as a6,
1857
- Mt as a7,
1858
- Nt as a8,
1859
- qi as a9,
1860
- ds as aA,
1861
- zt as aB,
1862
- L as aC,
1863
- Ri as aD,
1864
- es as aE,
1865
- pe as aF,
1866
- Xe as aG,
1867
- Qe as aH,
1868
- Ht as aI,
1869
- jt as aJ,
1870
- Ut as aK,
1871
- os as aL,
1872
- be as aM,
1873
- xt as aN,
1874
- ve as aO,
1875
- vt as aP,
1876
- bt as aQ,
1877
- xe as aR,
1878
- At as aS,
1879
- z as aT,
1880
- Cn as aU,
1881
- wt as aV,
1882
- Pn as aW,
1883
- gt as aX,
1884
- Tt as aY,
1885
- St as aZ,
1886
- kn as a_,
1887
- Ji as aa,
1888
- _t as ab,
1889
- ai as ac,
1890
- de as ad,
1891
- Bt as ae,
1892
- Yn as af,
1893
- Dt as ag,
1894
- Ne as ah,
1895
- ne as ai,
1896
- Ae as aj,
1897
- Vt as ak,
1898
- Nn as al,
1899
- Bn as am,
1900
- Y as an,
1901
- ce as ao,
1902
- Kn as ap,
1903
- zi as aq,
1904
- oi as ar,
1905
- kt as as,
1906
- ri as at,
1907
- On as au,
1908
- Bi as av,
1909
- Wt as aw,
1910
- rs as ax,
1911
- ls as ay,
1912
- ms as az,
1913
- et as b,
1914
- Mn as c,
1915
- Ls as d,
1916
- ts as e,
1917
- ss as f,
1918
- Rt as g,
1919
- ns as h,
1920
- We as i,
1921
- is as j,
1922
- Ks as k,
1923
- Ni as l,
1924
- nt as m,
1925
- Bs as n,
1926
- $t as o,
1927
- pt as p,
1928
- Me as q,
1929
- ee as r,
1930
- qe as s,
1931
- Je as t,
1932
- F as u,
1933
- k as v,
1934
- Rs as w,
1935
- Es as x,
1936
- Qi as y,
1937
- Li as z
1938
- };