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