@snowbomb1/nova-ui 1.0.8
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/dist/Box.d.ts +2 -0
- package/dist/chunks/Box-ByLjqYJZ.js +4670 -0
- package/dist/chunks/Box-vMWmmOuo.js +6 -0
- package/dist/components/Box/Box.d.ts +6 -0
- package/dist/components/Box/index.d.ts +1 -0
- package/dist/components/Box/index.js +1 -0
- package/dist/components/Button/Button.d.ts +11 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/FormField/FormField.d.ts +7 -0
- package/dist/components/FormField/index.d.ts +1 -0
- package/dist/components/Header/Header.d.ts +6 -0
- package/dist/components/Header/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +8 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +9 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +15 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Toggle/Toggle.d.ts +7 -0
- package/dist/components/Toggle/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/TopNav/ThemeToggler.d.ts +1 -0
- package/dist/components/TopNav/TopNav.d.ts +7 -0
- package/dist/components/TopNav/index.d.ts +1 -0
- package/dist/components/Viewer/Viewer.d.ts +15 -0
- package/dist/components/Viewer/ViewerLoader.d.ts +6 -0
- package/dist/components/Viewer/index.d.ts +1 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +7 -0
- package/dist/hooks/useMediaLoader.d.ts +11 -0
- package/dist/hooks/useTheme.d.ts +6 -0
- package/dist/icons/close.d.ts +6 -0
- package/dist/icons/hamburger.d.ts +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +9 -0
- package/dist/nova-ui.css +2 -0
- package/package.json +51 -0
|
@@ -0,0 +1,4670 @@
|
|
|
1
|
+
import { Component, Fragment, createContext, createElement, forwardRef, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
2
|
+
var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __hasOwnProp = Object.prototype.hasOwnProperty, __esmMin = (e, g) => () => (e && (g = e(e = 0)), g), __commonJSMin = (e, g) => () => (g || e((g = { exports: {} }).exports, g), g.exports), __export = (e) => {
|
|
3
|
+
let g = {};
|
|
4
|
+
for (var _ in e) __defProp(g, _, {
|
|
5
|
+
get: e[_],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return g;
|
|
9
|
+
}, __copyProps = (e, g, _, v) => {
|
|
10
|
+
if (g && typeof g == "object" || typeof g == "function") for (var y = __getOwnPropNames(g), b = 0, x = y.length, S; b < x; b++) S = y[b], !__hasOwnProp.call(e, S) && S !== _ && __defProp(e, S, {
|
|
11
|
+
get: ((e) => g[e]).bind(null, S),
|
|
12
|
+
enumerable: !(v = __getOwnPropDesc(g, S)) || v.enumerable
|
|
13
|
+
});
|
|
14
|
+
return e;
|
|
15
|
+
}, __toCommonJS = (e) => __copyProps(__defProp({}, "__esModule", { value: !0 }), e), __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, g) => (typeof require < "u" ? require : e)[g] }) : e)(function(e) {
|
|
16
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
17
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function.");
|
|
18
|
+
}), require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
19
|
+
var g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.fragment");
|
|
20
|
+
function v(e, _, v) {
|
|
21
|
+
var y = null;
|
|
22
|
+
if (v !== void 0 && (y = "" + v), _.key !== void 0 && (y = "" + _.key), "key" in _) for (var b in v = {}, _) b !== "key" && (v[b] = _[b]);
|
|
23
|
+
else v = _;
|
|
24
|
+
return _ = v.ref, {
|
|
25
|
+
$$typeof: g,
|
|
26
|
+
type: e,
|
|
27
|
+
key: y,
|
|
28
|
+
ref: _ === void 0 ? null : _,
|
|
29
|
+
props: v
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
e.Fragment = _, e.jsx = v, e.jsxs = v;
|
|
33
|
+
})), require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
34
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
35
|
+
function g(e) {
|
|
36
|
+
if (e == null) return null;
|
|
37
|
+
if (typeof e == "function") return e.$$typeof === W ? null : e.displayName || e.name || null;
|
|
38
|
+
if (typeof e == "string") return e;
|
|
39
|
+
switch (e) {
|
|
40
|
+
case M: return "Fragment";
|
|
41
|
+
case P: return "Profiler";
|
|
42
|
+
case N: return "StrictMode";
|
|
43
|
+
case z: return "Suspense";
|
|
44
|
+
case B: return "SuspenseList";
|
|
45
|
+
case U: return "Activity";
|
|
46
|
+
}
|
|
47
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
48
|
+
case j: return "Portal";
|
|
49
|
+
case I: return e.displayName || "Context";
|
|
50
|
+
case F: return (e._context.displayName || "Context") + ".Consumer";
|
|
51
|
+
case R:
|
|
52
|
+
var _ = e.render;
|
|
53
|
+
return e = e.displayName, e ||= (e = _.displayName || _.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
54
|
+
case V: return _ = e.displayName || null, _ === null ? g(e.type) || "Memo" : _;
|
|
55
|
+
case H:
|
|
56
|
+
_ = e._payload, e = e._init;
|
|
57
|
+
try {
|
|
58
|
+
return g(e(_));
|
|
59
|
+
} catch {}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
function _(e) {
|
|
64
|
+
return "" + e;
|
|
65
|
+
}
|
|
66
|
+
function v(e) {
|
|
67
|
+
try {
|
|
68
|
+
_(e);
|
|
69
|
+
var g = !1;
|
|
70
|
+
} catch {
|
|
71
|
+
g = !0;
|
|
72
|
+
}
|
|
73
|
+
if (g) {
|
|
74
|
+
g = console;
|
|
75
|
+
var v = g.error, y = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
76
|
+
return v.call(g, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", y), _(e);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function y(e) {
|
|
80
|
+
if (e === M) return "<>";
|
|
81
|
+
if (typeof e == "object" && e && e.$$typeof === H) return "<...>";
|
|
82
|
+
try {
|
|
83
|
+
var _ = g(e);
|
|
84
|
+
return _ ? "<" + _ + ">" : "<...>";
|
|
85
|
+
} catch {
|
|
86
|
+
return "<...>";
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function b() {
|
|
90
|
+
var e = G.A;
|
|
91
|
+
return e === null ? null : e.getOwner();
|
|
92
|
+
}
|
|
93
|
+
function x() {
|
|
94
|
+
return Error("react-stack-top-frame");
|
|
95
|
+
}
|
|
96
|
+
function S(e) {
|
|
97
|
+
if (K.call(e, "key")) {
|
|
98
|
+
var g = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
99
|
+
if (g && g.isReactWarning) return !1;
|
|
100
|
+
}
|
|
101
|
+
return e.key !== void 0;
|
|
102
|
+
}
|
|
103
|
+
function C(e, g) {
|
|
104
|
+
function _() {
|
|
105
|
+
Y || (Y = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", g));
|
|
106
|
+
}
|
|
107
|
+
_.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
108
|
+
get: _,
|
|
109
|
+
configurable: !0
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function w() {
|
|
113
|
+
var e = g(this.type);
|
|
114
|
+
return X[e] || (X[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
115
|
+
}
|
|
116
|
+
function T(e, g, _, v, y, b) {
|
|
117
|
+
var x = _.ref;
|
|
118
|
+
return e = {
|
|
119
|
+
$$typeof: A,
|
|
120
|
+
type: e,
|
|
121
|
+
key: g,
|
|
122
|
+
props: _,
|
|
123
|
+
_owner: v
|
|
124
|
+
}, (x === void 0 ? null : x) === null ? Object.defineProperty(e, "ref", {
|
|
125
|
+
enumerable: !1,
|
|
126
|
+
value: null
|
|
127
|
+
}) : Object.defineProperty(e, "ref", {
|
|
128
|
+
enumerable: !1,
|
|
129
|
+
get: w
|
|
130
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
131
|
+
configurable: !1,
|
|
132
|
+
enumerable: !1,
|
|
133
|
+
writable: !0,
|
|
134
|
+
value: 0
|
|
135
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
136
|
+
configurable: !1,
|
|
137
|
+
enumerable: !1,
|
|
138
|
+
writable: !0,
|
|
139
|
+
value: null
|
|
140
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
141
|
+
configurable: !1,
|
|
142
|
+
enumerable: !1,
|
|
143
|
+
writable: !0,
|
|
144
|
+
value: y
|
|
145
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
146
|
+
configurable: !1,
|
|
147
|
+
enumerable: !1,
|
|
148
|
+
writable: !0,
|
|
149
|
+
value: b
|
|
150
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
151
|
+
}
|
|
152
|
+
function E(e, _, y, x, w, E) {
|
|
153
|
+
var O = _.children;
|
|
154
|
+
if (O !== void 0) if (x) if (q(O)) {
|
|
155
|
+
for (x = 0; x < O.length; x++) D(O[x]);
|
|
156
|
+
Object.freeze && Object.freeze(O);
|
|
157
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
158
|
+
else D(O);
|
|
159
|
+
if (K.call(_, "key")) {
|
|
160
|
+
O = g(e);
|
|
161
|
+
var k = Object.keys(_).filter(function(e) {
|
|
162
|
+
return e !== "key";
|
|
163
|
+
});
|
|
164
|
+
x = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", $[O + x] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", x, O, k, O), $[O + x] = !0);
|
|
165
|
+
}
|
|
166
|
+
if (O = null, y !== void 0 && (v(y), O = "" + y), S(_) && (v(_.key), O = "" + _.key), "key" in _) for (var A in y = {}, _) A !== "key" && (y[A] = _[A]);
|
|
167
|
+
else y = _;
|
|
168
|
+
return O && C(y, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), T(e, O, y, b(), w, E);
|
|
169
|
+
}
|
|
170
|
+
function D(e) {
|
|
171
|
+
O(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === H && (e._payload.status === "fulfilled" ? O(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
172
|
+
}
|
|
173
|
+
function O(e) {
|
|
174
|
+
return typeof e == "object" && !!e && e.$$typeof === A;
|
|
175
|
+
}
|
|
176
|
+
var k = __require("react"), A = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), M = Symbol.for("react.fragment"), N = Symbol.for("react.strict_mode"), P = Symbol.for("react.profiler"), F = Symbol.for("react.consumer"), I = Symbol.for("react.context"), R = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), V = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), U = Symbol.for("react.activity"), W = Symbol.for("react.client.reference"), G = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, q = Array.isArray, J = console.createTask ? console.createTask : function() {
|
|
177
|
+
return null;
|
|
178
|
+
};
|
|
179
|
+
k = { react_stack_bottom_frame: function(e) {
|
|
180
|
+
return e();
|
|
181
|
+
} };
|
|
182
|
+
var Y, X = {}, Z = k.react_stack_bottom_frame.bind(k, x)(), Q = J(y(x)), $ = {};
|
|
183
|
+
e.Fragment = M, e.jsx = function(e, g, _) {
|
|
184
|
+
var v = 1e4 > G.recentlyCreatedOwnerStacks++;
|
|
185
|
+
return E(e, g, _, !1, v ? Error("react-stack-top-frame") : Z, v ? J(y(e)) : Q);
|
|
186
|
+
}, e.jsxs = function(e, g, _) {
|
|
187
|
+
var v = 1e4 > G.recentlyCreatedOwnerStacks++;
|
|
188
|
+
return E(e, g, _, !0, v ? Error("react-stack-top-frame") : Z, v ? J(y(e)) : Q);
|
|
189
|
+
};
|
|
190
|
+
})();
|
|
191
|
+
})), require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((e, g) => {
|
|
192
|
+
process.env.NODE_ENV === "production" ? g.exports = require_react_jsx_runtime_production() : g.exports = require_react_jsx_runtime_development();
|
|
193
|
+
})), LayoutGroupContext = createContext({});
|
|
194
|
+
function useConstant(e) {
|
|
195
|
+
let g = useRef(null);
|
|
196
|
+
return g.current === null && (g.current = e()), g.current;
|
|
197
|
+
}
|
|
198
|
+
var isBrowser = typeof window < "u", useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect, PresenceContext = /* @__PURE__ */ createContext(null);
|
|
199
|
+
function addUniqueItem(e, g) {
|
|
200
|
+
e.indexOf(g) === -1 && e.push(g);
|
|
201
|
+
}
|
|
202
|
+
function removeItem(e, g) {
|
|
203
|
+
let _ = e.indexOf(g);
|
|
204
|
+
_ > -1 && e.splice(_, 1);
|
|
205
|
+
}
|
|
206
|
+
var clamp = (e, g, _) => _ > g ? g : _ < e ? e : _;
|
|
207
|
+
function formatErrorMessage(e, g) {
|
|
208
|
+
return g ? `${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${g}` : e;
|
|
209
|
+
}
|
|
210
|
+
var warning = () => {}, invariant = () => {};
|
|
211
|
+
typeof process < "u" && process.env.NODE_ENV !== "production" && (warning = (e, g, _) => {
|
|
212
|
+
!e && typeof console < "u" && console.warn(formatErrorMessage(g, _));
|
|
213
|
+
}, invariant = (e, g, _) => {
|
|
214
|
+
if (!e) throw Error(formatErrorMessage(g, _));
|
|
215
|
+
});
|
|
216
|
+
var MotionGlobalConfig = {}, isNumericalString = (e) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);
|
|
217
|
+
function isObject(e) {
|
|
218
|
+
return typeof e == "object" && !!e;
|
|
219
|
+
}
|
|
220
|
+
var isZeroValueString = (e) => /^0[^.\s]+$/u.test(e);
|
|
221
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
222
|
+
function memo(e) {
|
|
223
|
+
let g;
|
|
224
|
+
return () => (g === void 0 && (g = e()), g);
|
|
225
|
+
}
|
|
226
|
+
var noop = /* @__NO_SIDE_EFFECTS__ */ (e) => e, combineFunctions = (e, g) => (_) => g(e(_)), pipe = (...e) => e.reduce(combineFunctions), progress = /* @__NO_SIDE_EFFECTS__ */ (e, g, _) => {
|
|
227
|
+
let v = g - e;
|
|
228
|
+
return v === 0 ? 1 : (_ - e) / v;
|
|
229
|
+
}, SubscriptionManager = class {
|
|
230
|
+
constructor() {
|
|
231
|
+
this.subscriptions = [];
|
|
232
|
+
}
|
|
233
|
+
add(e) {
|
|
234
|
+
return addUniqueItem(this.subscriptions, e), () => removeItem(this.subscriptions, e);
|
|
235
|
+
}
|
|
236
|
+
notify(e, g, _) {
|
|
237
|
+
let v = this.subscriptions.length;
|
|
238
|
+
if (v) if (v === 1) this.subscriptions[0](e, g, _);
|
|
239
|
+
else for (let y = 0; y < v; y++) {
|
|
240
|
+
let v = this.subscriptions[y];
|
|
241
|
+
v && v(e, g, _);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
getSize() {
|
|
245
|
+
return this.subscriptions.length;
|
|
246
|
+
}
|
|
247
|
+
clear() {
|
|
248
|
+
this.subscriptions.length = 0;
|
|
249
|
+
}
|
|
250
|
+
}, secondsToMilliseconds = /* @__NO_SIDE_EFFECTS__ */ (e) => e * 1e3, millisecondsToSeconds = /* @__NO_SIDE_EFFECTS__ */ (e) => e / 1e3;
|
|
251
|
+
function velocityPerSecond(e, g) {
|
|
252
|
+
return g ? e * (1e3 / g) : 0;
|
|
253
|
+
}
|
|
254
|
+
var warned = /* @__PURE__ */ new Set();
|
|
255
|
+
function warnOnce(e, g, _) {
|
|
256
|
+
e || warned.has(g) || (console.warn(formatErrorMessage(g, _)), warned.add(g));
|
|
257
|
+
}
|
|
258
|
+
var calcBezier = (e, g, _) => (((1 - 3 * _ + 3 * g) * e + (3 * _ - 6 * g)) * e + 3 * g) * e, subdivisionPrecision = 1e-7, subdivisionMaxIterations = 12;
|
|
259
|
+
function binarySubdivide(e, g, _, v, y) {
|
|
260
|
+
let b, x, S = 0;
|
|
261
|
+
do
|
|
262
|
+
x = g + (_ - g) / 2, b = calcBezier(x, v, y) - e, b > 0 ? _ = x : g = x;
|
|
263
|
+
while (Math.abs(b) > subdivisionPrecision && ++S < subdivisionMaxIterations);
|
|
264
|
+
return x;
|
|
265
|
+
}
|
|
266
|
+
function cubicBezier(e, g, _, v) {
|
|
267
|
+
if (e === g && _ === v) return noop;
|
|
268
|
+
let y = (g) => binarySubdivide(g, 0, 1, e, _);
|
|
269
|
+
return (e) => e === 0 || e === 1 ? e : calcBezier(y(e), g, v);
|
|
270
|
+
}
|
|
271
|
+
var mirrorEasing = (e) => (g) => g <= .5 ? e(2 * g) / 2 : (2 - e(2 * (1 - g))) / 2, reverseEasing = (e) => (g) => 1 - e(1 - g), backOut = /* @__PURE__ */ cubicBezier(.33, 1.53, .69, .99), backIn = /* @__PURE__ */ reverseEasing(backOut), backInOut = /* @__PURE__ */ mirrorEasing(backIn), anticipate = (e) => (e *= 2) < 1 ? .5 * backIn(e) : .5 * (2 - 2 ** (-10 * (e - 1))), circIn = (e) => 1 - Math.sin(Math.acos(e)), circOut = reverseEasing(circIn), circInOut = mirrorEasing(circIn), easeIn = /* @__PURE__ */ cubicBezier(.42, 0, 1, 1), easeOut = /* @__PURE__ */ cubicBezier(0, 0, .58, 1), easeInOut = /* @__PURE__ */ cubicBezier(.42, 0, .58, 1), isEasingArray = (e) => Array.isArray(e) && typeof e[0] != "number", isBezierDefinition = (e) => Array.isArray(e) && typeof e[0] == "number", easingLookup = {
|
|
272
|
+
linear: noop,
|
|
273
|
+
easeIn,
|
|
274
|
+
easeInOut,
|
|
275
|
+
easeOut,
|
|
276
|
+
circIn,
|
|
277
|
+
circInOut,
|
|
278
|
+
circOut,
|
|
279
|
+
backIn,
|
|
280
|
+
backInOut,
|
|
281
|
+
backOut,
|
|
282
|
+
anticipate
|
|
283
|
+
}, isValidEasing = (e) => typeof e == "string", easingDefinitionToFunction = (e) => {
|
|
284
|
+
if (isBezierDefinition(e)) {
|
|
285
|
+
invariant(e.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
|
|
286
|
+
let [g, _, v, y] = e;
|
|
287
|
+
return cubicBezier(g, _, v, y);
|
|
288
|
+
} else if (isValidEasing(e)) return invariant(easingLookup[e] !== void 0, `Invalid easing type '${e}'`, "invalid-easing-type"), easingLookup[e];
|
|
289
|
+
return e;
|
|
290
|
+
}, stepsOrder = [
|
|
291
|
+
"setup",
|
|
292
|
+
"read",
|
|
293
|
+
"resolveKeyframes",
|
|
294
|
+
"preUpdate",
|
|
295
|
+
"update",
|
|
296
|
+
"preRender",
|
|
297
|
+
"render",
|
|
298
|
+
"postRender"
|
|
299
|
+
], statsBuffer = {
|
|
300
|
+
value: null,
|
|
301
|
+
addProjectionMetrics: null
|
|
302
|
+
};
|
|
303
|
+
function createRenderStep(e, g) {
|
|
304
|
+
let _ = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), y = !1, b = !1, x = /* @__PURE__ */ new WeakSet(), S = {
|
|
305
|
+
delta: 0,
|
|
306
|
+
timestamp: 0,
|
|
307
|
+
isProcessing: !1
|
|
308
|
+
}, C = 0;
|
|
309
|
+
function w(g) {
|
|
310
|
+
x.has(g) && (T.schedule(g), e()), C++, g(S);
|
|
311
|
+
}
|
|
312
|
+
let T = {
|
|
313
|
+
schedule: (e, g = !1, b = !1) => {
|
|
314
|
+
let S = b && y ? _ : v;
|
|
315
|
+
return g && x.add(e), S.has(e) || S.add(e), e;
|
|
316
|
+
},
|
|
317
|
+
cancel: (e) => {
|
|
318
|
+
v.delete(e), x.delete(e);
|
|
319
|
+
},
|
|
320
|
+
process: (e) => {
|
|
321
|
+
if (S = e, y) {
|
|
322
|
+
b = !0;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
y = !0, [_, v] = [v, _], _.forEach(w), g && statsBuffer.value && statsBuffer.value.frameloop[g].push(C), C = 0, _.clear(), y = !1, b && (b = !1, T.process(e));
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
return T;
|
|
329
|
+
}
|
|
330
|
+
var maxElapsed = 40;
|
|
331
|
+
function createRenderBatcher(e, g) {
|
|
332
|
+
let _ = !1, v = !0, y = {
|
|
333
|
+
delta: 0,
|
|
334
|
+
timestamp: 0,
|
|
335
|
+
isProcessing: !1
|
|
336
|
+
}, b = () => _ = !0, x = stepsOrder.reduce((e, _) => (e[_] = createRenderStep(b, g ? _ : void 0), e), {}), { setup: S, read: C, resolveKeyframes: w, preUpdate: T, update: E, preRender: D, render: O, postRender: k } = x, A = () => {
|
|
337
|
+
let b = MotionGlobalConfig.useManualTiming ? y.timestamp : performance.now();
|
|
338
|
+
_ = !1, MotionGlobalConfig.useManualTiming || (y.delta = v ? 1e3 / 60 : Math.max(Math.min(b - y.timestamp, maxElapsed), 1)), y.timestamp = b, y.isProcessing = !0, S.process(y), C.process(y), w.process(y), T.process(y), E.process(y), D.process(y), O.process(y), k.process(y), y.isProcessing = !1, _ && g && (v = !1, e(A));
|
|
339
|
+
}, j = () => {
|
|
340
|
+
_ = !0, v = !0, y.isProcessing || e(A);
|
|
341
|
+
};
|
|
342
|
+
return {
|
|
343
|
+
schedule: stepsOrder.reduce((e, g) => {
|
|
344
|
+
let v = x[g];
|
|
345
|
+
return e[g] = (e, g = !1, y = !1) => (_ || j(), v.schedule(e, g, y)), e;
|
|
346
|
+
}, {}),
|
|
347
|
+
cancel: (e) => {
|
|
348
|
+
for (let g = 0; g < stepsOrder.length; g++) x[stepsOrder[g]].cancel(e);
|
|
349
|
+
},
|
|
350
|
+
state: y,
|
|
351
|
+
steps: x
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
var { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame < "u" ? requestAnimationFrame : noop, !0), now;
|
|
355
|
+
function clearTime() {
|
|
356
|
+
now = void 0;
|
|
357
|
+
}
|
|
358
|
+
var time = {
|
|
359
|
+
now: () => (now === void 0 && time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now()), now),
|
|
360
|
+
set: (e) => {
|
|
361
|
+
now = e, queueMicrotask(clearTime);
|
|
362
|
+
}
|
|
363
|
+
}, activeAnimations = {
|
|
364
|
+
layout: 0,
|
|
365
|
+
mainThread: 0,
|
|
366
|
+
waapi: 0
|
|
367
|
+
}, checkStringStartsWith = (e) => (g) => typeof g == "string" && g.startsWith(e), isCSSVariableName = /* @__PURE__ */ checkStringStartsWith("--"), startsAsVariableToken = /* @__PURE__ */ checkStringStartsWith("var(--"), isCSSVariableToken = (e) => startsAsVariableToken(e) ? singleCssVariableRegex.test(e.split("/*")[0].trim()) : !1, singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
|
|
368
|
+
function containsCSSVariable(e) {
|
|
369
|
+
return typeof e == "string" ? e.split("/*")[0].includes("var(--") : !1;
|
|
370
|
+
}
|
|
371
|
+
var number = {
|
|
372
|
+
test: (e) => typeof e == "number",
|
|
373
|
+
parse: parseFloat,
|
|
374
|
+
transform: (e) => e
|
|
375
|
+
}, alpha = {
|
|
376
|
+
...number,
|
|
377
|
+
transform: (e) => clamp(0, 1, e)
|
|
378
|
+
}, scale = {
|
|
379
|
+
...number,
|
|
380
|
+
default: 1
|
|
381
|
+
}, sanitize = (e) => Math.round(e * 1e5) / 1e5, floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
|
|
382
|
+
function isNullish(e) {
|
|
383
|
+
return e == null;
|
|
384
|
+
}
|
|
385
|
+
var singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, isColorString = (e, g) => (_) => !!(typeof _ == "string" && singleColorRegex.test(_) && _.startsWith(e) || g && !isNullish(_) && Object.prototype.hasOwnProperty.call(_, g)), splitColor = (e, g, _) => (v) => {
|
|
386
|
+
if (typeof v != "string") return v;
|
|
387
|
+
let [y, b, x, S] = v.match(floatRegex);
|
|
388
|
+
return {
|
|
389
|
+
[e]: parseFloat(y),
|
|
390
|
+
[g]: parseFloat(b),
|
|
391
|
+
[_]: parseFloat(x),
|
|
392
|
+
alpha: S === void 0 ? 1 : parseFloat(S)
|
|
393
|
+
};
|
|
394
|
+
}, clampRgbUnit = (e) => clamp(0, 255, e), rgbUnit = {
|
|
395
|
+
...number,
|
|
396
|
+
transform: (e) => Math.round(clampRgbUnit(e))
|
|
397
|
+
}, rgba = {
|
|
398
|
+
test: /* @__PURE__ */ isColorString("rgb", "red"),
|
|
399
|
+
parse: /* @__PURE__ */ splitColor("red", "green", "blue"),
|
|
400
|
+
transform: ({ red: e, green: g, blue: _, alpha: v = 1 }) => "rgba(" + rgbUnit.transform(e) + ", " + rgbUnit.transform(g) + ", " + rgbUnit.transform(_) + ", " + sanitize(alpha.transform(v)) + ")"
|
|
401
|
+
};
|
|
402
|
+
function parseHex(e) {
|
|
403
|
+
let g = "", _ = "", v = "", y = "";
|
|
404
|
+
return e.length > 5 ? (g = e.substring(1, 3), _ = e.substring(3, 5), v = e.substring(5, 7), y = e.substring(7, 9)) : (g = e.substring(1, 2), _ = e.substring(2, 3), v = e.substring(3, 4), y = e.substring(4, 5), g += g, _ += _, v += v, y += y), {
|
|
405
|
+
red: parseInt(g, 16),
|
|
406
|
+
green: parseInt(_, 16),
|
|
407
|
+
blue: parseInt(v, 16),
|
|
408
|
+
alpha: y ? parseInt(y, 16) / 255 : 1
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
var hex = {
|
|
412
|
+
test: /* @__PURE__ */ isColorString("#"),
|
|
413
|
+
parse: parseHex,
|
|
414
|
+
transform: rgba.transform
|
|
415
|
+
}, createUnitType = /* @__NO_SIDE_EFFECTS__ */ (e) => ({
|
|
416
|
+
test: (g) => typeof g == "string" && g.endsWith(e) && g.split(" ").length === 1,
|
|
417
|
+
parse: parseFloat,
|
|
418
|
+
transform: (g) => `${g}${e}`
|
|
419
|
+
}), degrees = /* @__PURE__ */ createUnitType("deg"), percent = /* @__PURE__ */ createUnitType("%"), px = /* @__PURE__ */ createUnitType("px"), vh = /* @__PURE__ */ createUnitType("vh"), vw = /* @__PURE__ */ createUnitType("vw"), progressPercentage = /* @__PURE__ */ (() => ({
|
|
420
|
+
...percent,
|
|
421
|
+
parse: (e) => percent.parse(e) / 100,
|
|
422
|
+
transform: (e) => percent.transform(e * 100)
|
|
423
|
+
}))(), hsla = {
|
|
424
|
+
test: /* @__PURE__ */ isColorString("hsl", "hue"),
|
|
425
|
+
parse: /* @__PURE__ */ splitColor("hue", "saturation", "lightness"),
|
|
426
|
+
transform: ({ hue: e, saturation: g, lightness: _, alpha: v = 1 }) => "hsla(" + Math.round(e) + ", " + percent.transform(sanitize(g)) + ", " + percent.transform(sanitize(_)) + ", " + sanitize(alpha.transform(v)) + ")"
|
|
427
|
+
}, color = {
|
|
428
|
+
test: (e) => rgba.test(e) || hex.test(e) || hsla.test(e),
|
|
429
|
+
parse: (e) => rgba.test(e) ? rgba.parse(e) : hsla.test(e) ? hsla.parse(e) : hex.parse(e),
|
|
430
|
+
transform: (e) => typeof e == "string" ? e : e.hasOwnProperty("red") ? rgba.transform(e) : hsla.transform(e),
|
|
431
|
+
getAnimatableNone: (e) => {
|
|
432
|
+
let g = color.parse(e);
|
|
433
|
+
return g.alpha = 0, color.transform(g);
|
|
434
|
+
}
|
|
435
|
+
}, colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
|
|
436
|
+
function test(e) {
|
|
437
|
+
return isNaN(e) && typeof e == "string" && (e.match(floatRegex)?.length || 0) + (e.match(colorRegex)?.length || 0) > 0;
|
|
438
|
+
}
|
|
439
|
+
var NUMBER_TOKEN = "number", COLOR_TOKEN = "color", VAR_TOKEN = "var", VAR_FUNCTION_TOKEN = "var(", SPLIT_TOKEN = "${}", complexRegex = /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;
|
|
440
|
+
function analyseComplexValue(e) {
|
|
441
|
+
let g = e.toString(), _ = [], v = {
|
|
442
|
+
color: [],
|
|
443
|
+
number: [],
|
|
444
|
+
var: []
|
|
445
|
+
}, y = [], b = 0;
|
|
446
|
+
return {
|
|
447
|
+
values: _,
|
|
448
|
+
split: g.replace(complexRegex, (e) => (color.test(e) ? (v.color.push(b), y.push(COLOR_TOKEN), _.push(color.parse(e))) : e.startsWith(VAR_FUNCTION_TOKEN) ? (v.var.push(b), y.push(VAR_TOKEN), _.push(e)) : (v.number.push(b), y.push(NUMBER_TOKEN), _.push(parseFloat(e))), ++b, SPLIT_TOKEN)).split(SPLIT_TOKEN),
|
|
449
|
+
indexes: v,
|
|
450
|
+
types: y
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function parseComplexValue(e) {
|
|
454
|
+
return analyseComplexValue(e).values;
|
|
455
|
+
}
|
|
456
|
+
function createTransformer(e) {
|
|
457
|
+
let { split: g, types: _ } = analyseComplexValue(e), v = g.length;
|
|
458
|
+
return (e) => {
|
|
459
|
+
let y = "";
|
|
460
|
+
for (let b = 0; b < v; b++) if (y += g[b], e[b] !== void 0) {
|
|
461
|
+
let g = _[b];
|
|
462
|
+
g === NUMBER_TOKEN ? y += sanitize(e[b]) : g === COLOR_TOKEN ? y += color.transform(e[b]) : y += e[b];
|
|
463
|
+
}
|
|
464
|
+
return y;
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
var convertNumbersToZero = (e) => typeof e == "number" ? 0 : color.test(e) ? color.getAnimatableNone(e) : e;
|
|
468
|
+
function getAnimatableNone$1(e) {
|
|
469
|
+
let g = parseComplexValue(e);
|
|
470
|
+
return createTransformer(e)(g.map(convertNumbersToZero));
|
|
471
|
+
}
|
|
472
|
+
var complex = {
|
|
473
|
+
test,
|
|
474
|
+
parse: parseComplexValue,
|
|
475
|
+
createTransformer,
|
|
476
|
+
getAnimatableNone: getAnimatableNone$1
|
|
477
|
+
};
|
|
478
|
+
function hueToRgb(e, g, _) {
|
|
479
|
+
return _ < 0 && (_ += 1), _ > 1 && --_, _ < 1 / 6 ? e + (g - e) * 6 * _ : _ < 1 / 2 ? g : _ < 2 / 3 ? e + (g - e) * (2 / 3 - _) * 6 : e;
|
|
480
|
+
}
|
|
481
|
+
function hslaToRgba({ hue: e, saturation: g, lightness: _, alpha: v }) {
|
|
482
|
+
e /= 360, g /= 100, _ /= 100;
|
|
483
|
+
let y = 0, b = 0, x = 0;
|
|
484
|
+
if (!g) y = b = x = _;
|
|
485
|
+
else {
|
|
486
|
+
let v = _ < .5 ? _ * (1 + g) : _ + g - _ * g, S = 2 * _ - v;
|
|
487
|
+
y = hueToRgb(S, v, e + 1 / 3), b = hueToRgb(S, v, e), x = hueToRgb(S, v, e - 1 / 3);
|
|
488
|
+
}
|
|
489
|
+
return {
|
|
490
|
+
red: Math.round(y * 255),
|
|
491
|
+
green: Math.round(b * 255),
|
|
492
|
+
blue: Math.round(x * 255),
|
|
493
|
+
alpha: v
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
function mixImmediate(e, g) {
|
|
497
|
+
return (_) => _ > 0 ? g : e;
|
|
498
|
+
}
|
|
499
|
+
var mixNumber = (e, g, _) => e + (g - e) * _, mixLinearColor = (e, g, _) => {
|
|
500
|
+
let v = e * e, y = _ * (g * g - v) + v;
|
|
501
|
+
return y < 0 ? 0 : Math.sqrt(y);
|
|
502
|
+
}, colorTypes = [
|
|
503
|
+
hex,
|
|
504
|
+
rgba,
|
|
505
|
+
hsla
|
|
506
|
+
], getColorType = (e) => colorTypes.find((g) => g.test(e));
|
|
507
|
+
function asRGBA(e) {
|
|
508
|
+
let g = getColorType(e);
|
|
509
|
+
if (warning(!!g, `'${e}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !g) return !1;
|
|
510
|
+
let _ = g.parse(e);
|
|
511
|
+
return g === hsla && (_ = hslaToRgba(_)), _;
|
|
512
|
+
}
|
|
513
|
+
var mixColor = (e, g) => {
|
|
514
|
+
let _ = asRGBA(e), v = asRGBA(g);
|
|
515
|
+
if (!_ || !v) return mixImmediate(e, g);
|
|
516
|
+
let y = { ..._ };
|
|
517
|
+
return (e) => (y.red = mixLinearColor(_.red, v.red, e), y.green = mixLinearColor(_.green, v.green, e), y.blue = mixLinearColor(_.blue, v.blue, e), y.alpha = mixNumber(_.alpha, v.alpha, e), rgba.transform(y));
|
|
518
|
+
}, invisibleValues = new Set(["none", "hidden"]);
|
|
519
|
+
function mixVisibility(e, g) {
|
|
520
|
+
return invisibleValues.has(e) ? (_) => _ <= 0 ? e : g : (_) => _ >= 1 ? g : e;
|
|
521
|
+
}
|
|
522
|
+
function mixNumber$1(e, g) {
|
|
523
|
+
return (_) => mixNumber(e, g, _);
|
|
524
|
+
}
|
|
525
|
+
function getMixer(e) {
|
|
526
|
+
return typeof e == "number" ? mixNumber$1 : typeof e == "string" ? isCSSVariableToken(e) ? mixImmediate : color.test(e) ? mixColor : mixComplex : Array.isArray(e) ? mixArray : typeof e == "object" ? color.test(e) ? mixColor : mixObject : mixImmediate;
|
|
527
|
+
}
|
|
528
|
+
function mixArray(e, g) {
|
|
529
|
+
let _ = [...e], v = _.length, y = e.map((e, _) => getMixer(e)(e, g[_]));
|
|
530
|
+
return (e) => {
|
|
531
|
+
for (let g = 0; g < v; g++) _[g] = y[g](e);
|
|
532
|
+
return _;
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function mixObject(e, g) {
|
|
536
|
+
let _ = {
|
|
537
|
+
...e,
|
|
538
|
+
...g
|
|
539
|
+
}, v = {};
|
|
540
|
+
for (let y in _) e[y] !== void 0 && g[y] !== void 0 && (v[y] = getMixer(e[y])(e[y], g[y]));
|
|
541
|
+
return (e) => {
|
|
542
|
+
for (let g in v) _[g] = v[g](e);
|
|
543
|
+
return _;
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function matchOrder(e, g) {
|
|
547
|
+
let _ = [], v = {
|
|
548
|
+
color: 0,
|
|
549
|
+
var: 0,
|
|
550
|
+
number: 0
|
|
551
|
+
};
|
|
552
|
+
for (let y = 0; y < g.values.length; y++) {
|
|
553
|
+
let b = g.types[y], x = e.indexes[b][v[b]];
|
|
554
|
+
_[y] = e.values[x] ?? 0, v[b]++;
|
|
555
|
+
}
|
|
556
|
+
return _;
|
|
557
|
+
}
|
|
558
|
+
var mixComplex = (e, g) => {
|
|
559
|
+
let _ = complex.createTransformer(g), v = analyseComplexValue(e), y = analyseComplexValue(g);
|
|
560
|
+
return v.indexes.var.length === y.indexes.var.length && v.indexes.color.length === y.indexes.color.length && v.indexes.number.length >= y.indexes.number.length ? invisibleValues.has(e) && !y.values.length || invisibleValues.has(g) && !v.values.length ? mixVisibility(e, g) : pipe(mixArray(matchOrder(v, y), y.values), _) : (warning(!0, `Complex values '${e}' and '${g}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different"), mixImmediate(e, g));
|
|
561
|
+
};
|
|
562
|
+
function mix(e, g, _) {
|
|
563
|
+
return typeof e == "number" && typeof g == "number" && typeof _ == "number" ? mixNumber(e, g, _) : getMixer(e)(e, g);
|
|
564
|
+
}
|
|
565
|
+
var frameloopDriver = (e) => {
|
|
566
|
+
let g = ({ timestamp: g }) => e(g);
|
|
567
|
+
return {
|
|
568
|
+
start: (e = !0) => frame.update(g, e),
|
|
569
|
+
stop: () => cancelFrame(g),
|
|
570
|
+
now: () => frameData.isProcessing ? frameData.timestamp : time.now()
|
|
571
|
+
};
|
|
572
|
+
}, generateLinearEasing = (e, g, _ = 10) => {
|
|
573
|
+
let v = "", y = Math.max(Math.round(g / _), 2);
|
|
574
|
+
for (let g = 0; g < y; g++) v += Math.round(e(g / (y - 1)) * 1e4) / 1e4 + ", ";
|
|
575
|
+
return `linear(${v.substring(0, v.length - 2)})`;
|
|
576
|
+
}, maxGeneratorDuration = 2e4;
|
|
577
|
+
function calcGeneratorDuration(e) {
|
|
578
|
+
let g = 0, _ = e.next(g);
|
|
579
|
+
for (; !_.done && g < 2e4;) g += 50, _ = e.next(g);
|
|
580
|
+
return g >= 2e4 ? Infinity : g;
|
|
581
|
+
}
|
|
582
|
+
function createGeneratorEasing(e, g = 100, _) {
|
|
583
|
+
let v = _({
|
|
584
|
+
...e,
|
|
585
|
+
keyframes: [0, g]
|
|
586
|
+
}), y = Math.min(calcGeneratorDuration(v), maxGeneratorDuration);
|
|
587
|
+
return {
|
|
588
|
+
type: "keyframes",
|
|
589
|
+
ease: (e) => v.next(y * e).value / g,
|
|
590
|
+
duration: /* @__PURE__ */ millisecondsToSeconds(y)
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
var velocitySampleDuration = 5;
|
|
594
|
+
function calcGeneratorVelocity(e, g, _) {
|
|
595
|
+
let v = Math.max(g - velocitySampleDuration, 0);
|
|
596
|
+
return velocityPerSecond(_ - e(v), g - v);
|
|
597
|
+
}
|
|
598
|
+
var springDefaults = {
|
|
599
|
+
stiffness: 100,
|
|
600
|
+
damping: 10,
|
|
601
|
+
mass: 1,
|
|
602
|
+
velocity: 0,
|
|
603
|
+
duration: 800,
|
|
604
|
+
bounce: .3,
|
|
605
|
+
visualDuration: .3,
|
|
606
|
+
restSpeed: {
|
|
607
|
+
granular: .01,
|
|
608
|
+
default: 2
|
|
609
|
+
},
|
|
610
|
+
restDelta: {
|
|
611
|
+
granular: .005,
|
|
612
|
+
default: .5
|
|
613
|
+
},
|
|
614
|
+
minDuration: .01,
|
|
615
|
+
maxDuration: 10,
|
|
616
|
+
minDamping: .05,
|
|
617
|
+
maxDamping: 1
|
|
618
|
+
}, safeMin = .001;
|
|
619
|
+
function findSpring({ duration: e = springDefaults.duration, bounce: g = springDefaults.bounce, velocity: _ = springDefaults.velocity, mass: v = springDefaults.mass }) {
|
|
620
|
+
let y, b;
|
|
621
|
+
warning(e <= /* @__PURE__ */ secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
622
|
+
let x = 1 - g;
|
|
623
|
+
x = clamp(springDefaults.minDamping, springDefaults.maxDamping, x), e = clamp(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(e)), x < 1 ? (y = (g) => {
|
|
624
|
+
let v = g * x, y = v * e, b = v - _, S = calcAngularFreq(g, x), C = Math.exp(-y);
|
|
625
|
+
return safeMin - b / S * C;
|
|
626
|
+
}, b = (g) => {
|
|
627
|
+
let v = g * x * e, b = v * _ + _, S = x ** 2 * g ** 2 * e, C = Math.exp(-v), w = calcAngularFreq(g ** 2, x);
|
|
628
|
+
return (-y(g) + safeMin > 0 ? -1 : 1) * ((b - S) * C) / w;
|
|
629
|
+
}) : (y = (g) => {
|
|
630
|
+
let v = Math.exp(-g * e), y = (g - _) * e + 1;
|
|
631
|
+
return -safeMin + v * y;
|
|
632
|
+
}, b = (g) => Math.exp(-g * e) * ((_ - g) * (e * e)));
|
|
633
|
+
let S = 5 / e, C = approximateRoot(y, b, S);
|
|
634
|
+
if (e = /* @__PURE__ */ secondsToMilliseconds(e), isNaN(C)) return {
|
|
635
|
+
stiffness: springDefaults.stiffness,
|
|
636
|
+
damping: springDefaults.damping,
|
|
637
|
+
duration: e
|
|
638
|
+
};
|
|
639
|
+
{
|
|
640
|
+
let g = C ** 2 * v;
|
|
641
|
+
return {
|
|
642
|
+
stiffness: g,
|
|
643
|
+
damping: x * 2 * Math.sqrt(v * g),
|
|
644
|
+
duration: e
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
var rootIterations = 12;
|
|
649
|
+
function approximateRoot(e, g, _) {
|
|
650
|
+
let v = _;
|
|
651
|
+
for (let _ = 1; _ < rootIterations; _++) v -= e(v) / g(v);
|
|
652
|
+
return v;
|
|
653
|
+
}
|
|
654
|
+
function calcAngularFreq(e, g) {
|
|
655
|
+
return e * Math.sqrt(1 - g * g);
|
|
656
|
+
}
|
|
657
|
+
var durationKeys = ["duration", "bounce"], physicsKeys = [
|
|
658
|
+
"stiffness",
|
|
659
|
+
"damping",
|
|
660
|
+
"mass"
|
|
661
|
+
];
|
|
662
|
+
function isSpringType(e, g) {
|
|
663
|
+
return g.some((g) => e[g] !== void 0);
|
|
664
|
+
}
|
|
665
|
+
function getSpringOptions(e) {
|
|
666
|
+
let g = {
|
|
667
|
+
velocity: springDefaults.velocity,
|
|
668
|
+
stiffness: springDefaults.stiffness,
|
|
669
|
+
damping: springDefaults.damping,
|
|
670
|
+
mass: springDefaults.mass,
|
|
671
|
+
isResolvedFromDuration: !1,
|
|
672
|
+
...e
|
|
673
|
+
};
|
|
674
|
+
if (!isSpringType(e, physicsKeys) && isSpringType(e, durationKeys)) if (e.visualDuration) {
|
|
675
|
+
let _ = e.visualDuration, v = 2 * Math.PI / (_ * 1.2), y = v * v, b = 2 * clamp(.05, 1, 1 - (e.bounce || 0)) * Math.sqrt(y);
|
|
676
|
+
g = {
|
|
677
|
+
...g,
|
|
678
|
+
mass: springDefaults.mass,
|
|
679
|
+
stiffness: y,
|
|
680
|
+
damping: b
|
|
681
|
+
};
|
|
682
|
+
} else {
|
|
683
|
+
let _ = findSpring(e);
|
|
684
|
+
g = {
|
|
685
|
+
...g,
|
|
686
|
+
..._,
|
|
687
|
+
mass: springDefaults.mass
|
|
688
|
+
}, g.isResolvedFromDuration = !0;
|
|
689
|
+
}
|
|
690
|
+
return g;
|
|
691
|
+
}
|
|
692
|
+
function spring(e = springDefaults.visualDuration, g = springDefaults.bounce) {
|
|
693
|
+
let _ = typeof e == "object" ? e : {
|
|
694
|
+
visualDuration: e,
|
|
695
|
+
keyframes: [0, 1],
|
|
696
|
+
bounce: g
|
|
697
|
+
}, { restSpeed: v, restDelta: y } = _, b = _.keyframes[0], x = _.keyframes[_.keyframes.length - 1], S = {
|
|
698
|
+
done: !1,
|
|
699
|
+
value: b
|
|
700
|
+
}, { stiffness: C, damping: w, mass: T, duration: E, velocity: D, isResolvedFromDuration: O } = getSpringOptions({
|
|
701
|
+
..._,
|
|
702
|
+
velocity: -/* @__PURE__ */ millisecondsToSeconds(_.velocity || 0)
|
|
703
|
+
}), k = D || 0, A = w / (2 * Math.sqrt(C * T)), j = x - b, M = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(C / T)), N = Math.abs(j) < 5;
|
|
704
|
+
v ||= N ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, y ||= N ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
705
|
+
let P;
|
|
706
|
+
if (A < 1) {
|
|
707
|
+
let e = calcAngularFreq(M, A);
|
|
708
|
+
P = (g) => x - Math.exp(-A * M * g) * ((k + A * M * j) / e * Math.sin(e * g) + j * Math.cos(e * g));
|
|
709
|
+
} else if (A === 1) P = (e) => x - Math.exp(-M * e) * (j + (k + M * j) * e);
|
|
710
|
+
else {
|
|
711
|
+
let e = M * Math.sqrt(A * A - 1);
|
|
712
|
+
P = (g) => {
|
|
713
|
+
let _ = Math.exp(-A * M * g), v = Math.min(e * g, 300);
|
|
714
|
+
return x - _ * ((k + A * M * j) * Math.sinh(v) + e * j * Math.cosh(v)) / e;
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
let F = {
|
|
718
|
+
calculatedDuration: O && E || null,
|
|
719
|
+
next: (e) => {
|
|
720
|
+
let g = P(e);
|
|
721
|
+
if (O) S.done = e >= E;
|
|
722
|
+
else {
|
|
723
|
+
let _ = e === 0 ? k : 0;
|
|
724
|
+
A < 1 && (_ = e === 0 ? /* @__PURE__ */ secondsToMilliseconds(k) : calcGeneratorVelocity(P, e, g));
|
|
725
|
+
let b = Math.abs(_) <= v, C = Math.abs(x - g) <= y;
|
|
726
|
+
S.done = b && C;
|
|
727
|
+
}
|
|
728
|
+
return S.value = S.done ? x : g, S;
|
|
729
|
+
},
|
|
730
|
+
toString: () => {
|
|
731
|
+
let e = Math.min(calcGeneratorDuration(F), maxGeneratorDuration), g = generateLinearEasing((g) => F.next(e * g).value, e, 30);
|
|
732
|
+
return e + "ms " + g;
|
|
733
|
+
},
|
|
734
|
+
toTransition: () => {}
|
|
735
|
+
};
|
|
736
|
+
return F;
|
|
737
|
+
}
|
|
738
|
+
spring.applyToOptions = (e) => {
|
|
739
|
+
let g = createGeneratorEasing(e, 100, spring);
|
|
740
|
+
return e.ease = g.ease, e.duration = /* @__PURE__ */ secondsToMilliseconds(g.duration), e.type = "keyframes", e;
|
|
741
|
+
};
|
|
742
|
+
function inertia({ keyframes: e, velocity: g = 0, power: _ = .8, timeConstant: v = 325, bounceDamping: y = 10, bounceStiffness: b = 500, modifyTarget: x, min: S, max: C, restDelta: w = .5, restSpeed: T }) {
|
|
743
|
+
let E = e[0], D = {
|
|
744
|
+
done: !1,
|
|
745
|
+
value: E
|
|
746
|
+
}, O = (e) => S !== void 0 && e < S || C !== void 0 && e > C, k = (e) => S === void 0 ? C : C === void 0 || Math.abs(S - e) < Math.abs(C - e) ? S : C, A = _ * g, j = E + A, M = x === void 0 ? j : x(j);
|
|
747
|
+
M !== j && (A = M - E);
|
|
748
|
+
let N = (e) => -A * Math.exp(-e / v), P = (e) => M + N(e), F = (e) => {
|
|
749
|
+
let g = N(e), _ = P(e);
|
|
750
|
+
D.done = Math.abs(g) <= w, D.value = D.done ? M : _;
|
|
751
|
+
}, I, L, R = (e) => {
|
|
752
|
+
O(D.value) && (I = e, L = spring({
|
|
753
|
+
keyframes: [D.value, k(D.value)],
|
|
754
|
+
velocity: calcGeneratorVelocity(P, e, D.value),
|
|
755
|
+
damping: y,
|
|
756
|
+
stiffness: b,
|
|
757
|
+
restDelta: w,
|
|
758
|
+
restSpeed: T
|
|
759
|
+
}));
|
|
760
|
+
};
|
|
761
|
+
return R(0), {
|
|
762
|
+
calculatedDuration: null,
|
|
763
|
+
next: (e) => {
|
|
764
|
+
let g = !1;
|
|
765
|
+
return !L && I === void 0 && (g = !0, F(e), R(e)), I !== void 0 && e >= I ? L.next(e - I) : (!g && F(e), D);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
function createMixers(e, g, _) {
|
|
770
|
+
let v = [], y = _ || MotionGlobalConfig.mix || mix, b = e.length - 1;
|
|
771
|
+
for (let _ = 0; _ < b; _++) {
|
|
772
|
+
let b = y(e[_], e[_ + 1]);
|
|
773
|
+
g && (b = pipe(Array.isArray(g) ? g[_] || noop : g, b)), v.push(b);
|
|
774
|
+
}
|
|
775
|
+
return v;
|
|
776
|
+
}
|
|
777
|
+
function interpolate(e, g, { clamp: _ = !0, ease: v, mixer: y } = {}) {
|
|
778
|
+
let b = e.length;
|
|
779
|
+
if (invariant(b === g.length, "Both input and output ranges must be the same length", "range-length"), b === 1) return () => g[0];
|
|
780
|
+
if (b === 2 && g[0] === g[1]) return () => g[1];
|
|
781
|
+
let x = e[0] === e[1];
|
|
782
|
+
e[0] > e[b - 1] && (e = [...e].reverse(), g = [...g].reverse());
|
|
783
|
+
let S = createMixers(g, v, y), C = S.length, w = (_) => {
|
|
784
|
+
if (x && _ < e[0]) return g[0];
|
|
785
|
+
let v = 0;
|
|
786
|
+
if (C > 1) for (; v < e.length - 2 && !(_ < e[v + 1]); v++);
|
|
787
|
+
let y = /* @__PURE__ */ progress(e[v], e[v + 1], _);
|
|
788
|
+
return S[v](y);
|
|
789
|
+
};
|
|
790
|
+
return _ ? (g) => w(clamp(e[0], e[b - 1], g)) : w;
|
|
791
|
+
}
|
|
792
|
+
function fillOffset(e, g) {
|
|
793
|
+
let _ = e[e.length - 1];
|
|
794
|
+
for (let v = 1; v <= g; v++) {
|
|
795
|
+
let y = /* @__PURE__ */ progress(0, g, v);
|
|
796
|
+
e.push(mixNumber(_, 1, y));
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
function defaultOffset(e) {
|
|
800
|
+
let g = [0];
|
|
801
|
+
return fillOffset(g, e.length - 1), g;
|
|
802
|
+
}
|
|
803
|
+
function convertOffsetToTimes(e, g) {
|
|
804
|
+
return e.map((e) => e * g);
|
|
805
|
+
}
|
|
806
|
+
function defaultEasing(e, g) {
|
|
807
|
+
return e.map(() => g || easeInOut).splice(0, e.length - 1);
|
|
808
|
+
}
|
|
809
|
+
function keyframes({ duration: e = 300, keyframes: g, times: _, ease: v = "easeInOut" }) {
|
|
810
|
+
let y = isEasingArray(v) ? v.map(easingDefinitionToFunction) : easingDefinitionToFunction(v), b = {
|
|
811
|
+
done: !1,
|
|
812
|
+
value: g[0]
|
|
813
|
+
}, x = interpolate(convertOffsetToTimes(_ && _.length === g.length ? _ : defaultOffset(g), e), g, { ease: Array.isArray(y) ? y : defaultEasing(g, y) });
|
|
814
|
+
return {
|
|
815
|
+
calculatedDuration: e,
|
|
816
|
+
next: (g) => (b.value = x(g), b.done = g >= e, b)
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
var isNotNull$1 = (e) => e !== null;
|
|
820
|
+
function getFinalKeyframe$1(e, { repeat: g, repeatType: _ = "loop" }, v, y = 1) {
|
|
821
|
+
let b = e.filter(isNotNull$1), x = y < 0 || g && _ !== "loop" && g % 2 == 1 ? 0 : b.length - 1;
|
|
822
|
+
return !x || v === void 0 ? b[x] : v;
|
|
823
|
+
}
|
|
824
|
+
var transitionTypeMap = {
|
|
825
|
+
decay: inertia,
|
|
826
|
+
inertia,
|
|
827
|
+
tween: keyframes,
|
|
828
|
+
keyframes,
|
|
829
|
+
spring
|
|
830
|
+
};
|
|
831
|
+
function replaceTransitionType(e) {
|
|
832
|
+
typeof e.type == "string" && (e.type = transitionTypeMap[e.type]);
|
|
833
|
+
}
|
|
834
|
+
var WithPromise = class {
|
|
835
|
+
constructor() {
|
|
836
|
+
this.updateFinished();
|
|
837
|
+
}
|
|
838
|
+
get finished() {
|
|
839
|
+
return this._finished;
|
|
840
|
+
}
|
|
841
|
+
updateFinished() {
|
|
842
|
+
this._finished = new Promise((e) => {
|
|
843
|
+
this.resolve = e;
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
notifyFinished() {
|
|
847
|
+
this.resolve();
|
|
848
|
+
}
|
|
849
|
+
then(e, g) {
|
|
850
|
+
return this.finished.then(e, g);
|
|
851
|
+
}
|
|
852
|
+
}, percentToProgress = (e) => e / 100, JSAnimation = class extends WithPromise {
|
|
853
|
+
constructor(e) {
|
|
854
|
+
super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
|
|
855
|
+
let { motionValue: e } = this.options;
|
|
856
|
+
e && e.updatedAt !== time.now() && this.tick(time.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
|
|
857
|
+
}, activeAnimations.mainThread++, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
|
|
858
|
+
}
|
|
859
|
+
initAnimation() {
|
|
860
|
+
let { options: e } = this;
|
|
861
|
+
replaceTransitionType(e);
|
|
862
|
+
let { type: g = keyframes, repeat: _ = 0, repeatDelay: v = 0, repeatType: y, velocity: b = 0 } = e, { keyframes: x } = e, S = g || keyframes;
|
|
863
|
+
process.env.NODE_ENV !== "production" && S !== keyframes && invariant(x.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${x}`, "spring-two-frames"), S !== keyframes && typeof x[0] != "number" && (this.mixKeyframes = pipe(percentToProgress, mix(x[0], x[1])), x = [0, 100]);
|
|
864
|
+
let C = S({
|
|
865
|
+
...e,
|
|
866
|
+
keyframes: x
|
|
867
|
+
});
|
|
868
|
+
y === "mirror" && (this.mirroredGenerator = S({
|
|
869
|
+
...e,
|
|
870
|
+
keyframes: [...x].reverse(),
|
|
871
|
+
velocity: -b
|
|
872
|
+
})), C.calculatedDuration === null && (C.calculatedDuration = calcGeneratorDuration(C));
|
|
873
|
+
let { calculatedDuration: w } = C;
|
|
874
|
+
this.calculatedDuration = w, this.resolvedDuration = w + v, this.totalDuration = this.resolvedDuration * (_ + 1) - v, this.generator = C;
|
|
875
|
+
}
|
|
876
|
+
updateTime(e) {
|
|
877
|
+
let g = Math.round(e - this.startTime) * this.playbackSpeed;
|
|
878
|
+
this.holdTime === null ? this.currentTime = g : this.currentTime = this.holdTime;
|
|
879
|
+
}
|
|
880
|
+
tick(e, g = !1) {
|
|
881
|
+
let { generator: _, totalDuration: v, mixKeyframes: y, mirroredGenerator: b, resolvedDuration: x, calculatedDuration: S } = this;
|
|
882
|
+
if (this.startTime === null) return _.next(0);
|
|
883
|
+
let { delay: C = 0, keyframes: w, repeat: T, repeatType: E, repeatDelay: D, type: O, onUpdate: k, finalKeyframe: A } = this.options;
|
|
884
|
+
this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - v / this.speed, this.startTime)), g ? this.currentTime = e : this.updateTime(e);
|
|
885
|
+
let j = this.currentTime - C * (this.playbackSpeed >= 0 ? 1 : -1), M = this.playbackSpeed >= 0 ? j < 0 : j > v;
|
|
886
|
+
this.currentTime = Math.max(j, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = v);
|
|
887
|
+
let N = this.currentTime, P = _;
|
|
888
|
+
if (T) {
|
|
889
|
+
let e = Math.min(this.currentTime, v) / x, g = Math.floor(e), _ = e % 1;
|
|
890
|
+
!_ && e >= 1 && (_ = 1), _ === 1 && g--, g = Math.min(g, T + 1), g % 2 && (E === "reverse" ? (_ = 1 - _, D && (_ -= D / x)) : E === "mirror" && (P = b)), N = clamp(0, 1, _) * x;
|
|
891
|
+
}
|
|
892
|
+
let F = M ? {
|
|
893
|
+
done: !1,
|
|
894
|
+
value: w[0]
|
|
895
|
+
} : P.next(N);
|
|
896
|
+
y && (F.value = y(F.value));
|
|
897
|
+
let { done: I } = F;
|
|
898
|
+
!M && S !== null && (I = this.playbackSpeed >= 0 ? this.currentTime >= v : this.currentTime <= 0);
|
|
899
|
+
let L = this.holdTime === null && (this.state === "finished" || this.state === "running" && I);
|
|
900
|
+
return L && O !== inertia && (F.value = getFinalKeyframe$1(w, this.options, A, this.speed)), k && k(F.value), L && this.finish(), F;
|
|
901
|
+
}
|
|
902
|
+
then(e, g) {
|
|
903
|
+
return this.finished.then(e, g);
|
|
904
|
+
}
|
|
905
|
+
get duration() {
|
|
906
|
+
return /* @__PURE__ */ millisecondsToSeconds(this.calculatedDuration);
|
|
907
|
+
}
|
|
908
|
+
get iterationDuration() {
|
|
909
|
+
let { delay: e = 0 } = this.options || {};
|
|
910
|
+
return this.duration + /* @__PURE__ */ millisecondsToSeconds(e);
|
|
911
|
+
}
|
|
912
|
+
get time() {
|
|
913
|
+
return /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
|
|
914
|
+
}
|
|
915
|
+
set time(e) {
|
|
916
|
+
e = /* @__PURE__ */ secondsToMilliseconds(e), this.currentTime = e, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.playbackSpeed), this.driver?.start(!1);
|
|
917
|
+
}
|
|
918
|
+
get speed() {
|
|
919
|
+
return this.playbackSpeed;
|
|
920
|
+
}
|
|
921
|
+
set speed(e) {
|
|
922
|
+
this.updateTime(time.now());
|
|
923
|
+
let g = this.playbackSpeed !== e;
|
|
924
|
+
this.playbackSpeed = e, g && (this.time = /* @__PURE__ */ millisecondsToSeconds(this.currentTime));
|
|
925
|
+
}
|
|
926
|
+
play() {
|
|
927
|
+
if (this.isStopped) return;
|
|
928
|
+
let { driver: e = frameloopDriver, startTime: g } = this.options;
|
|
929
|
+
this.driver ||= e((e) => this.tick(e)), this.options.onPlay?.();
|
|
930
|
+
let _ = this.driver.now();
|
|
931
|
+
this.state === "finished" ? (this.updateFinished(), this.startTime = _) : this.holdTime === null ? this.startTime ||= g ?? _ : this.startTime = _ - this.holdTime, this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
|
|
932
|
+
}
|
|
933
|
+
pause() {
|
|
934
|
+
this.state = "paused", this.updateTime(time.now()), this.holdTime = this.currentTime;
|
|
935
|
+
}
|
|
936
|
+
complete() {
|
|
937
|
+
this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
|
|
938
|
+
}
|
|
939
|
+
finish() {
|
|
940
|
+
this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
|
|
941
|
+
}
|
|
942
|
+
cancel() {
|
|
943
|
+
this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
|
|
944
|
+
}
|
|
945
|
+
teardown() {
|
|
946
|
+
this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null, activeAnimations.mainThread--;
|
|
947
|
+
}
|
|
948
|
+
stopDriver() {
|
|
949
|
+
this.driver &&= (this.driver.stop(), void 0);
|
|
950
|
+
}
|
|
951
|
+
sample(e) {
|
|
952
|
+
return this.startTime = 0, this.tick(e, !0);
|
|
953
|
+
}
|
|
954
|
+
attachTimeline(e) {
|
|
955
|
+
return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
function fillWildcards(e) {
|
|
959
|
+
for (let g = 1; g < e.length; g++) e[g] ?? (e[g] = e[g - 1]);
|
|
960
|
+
}
|
|
961
|
+
var radToDeg = (e) => e * 180 / Math.PI, rotate = (e) => rebaseAngle(radToDeg(Math.atan2(e[1], e[0]))), matrix2dParsers = {
|
|
962
|
+
x: 4,
|
|
963
|
+
y: 5,
|
|
964
|
+
translateX: 4,
|
|
965
|
+
translateY: 5,
|
|
966
|
+
scaleX: 0,
|
|
967
|
+
scaleY: 3,
|
|
968
|
+
scale: (e) => (Math.abs(e[0]) + Math.abs(e[3])) / 2,
|
|
969
|
+
rotate,
|
|
970
|
+
rotateZ: rotate,
|
|
971
|
+
skewX: (e) => radToDeg(Math.atan(e[1])),
|
|
972
|
+
skewY: (e) => radToDeg(Math.atan(e[2])),
|
|
973
|
+
skew: (e) => (Math.abs(e[1]) + Math.abs(e[2])) / 2
|
|
974
|
+
}, rebaseAngle = (e) => (e %= 360, e < 0 && (e += 360), e), rotateZ = rotate, scaleX = (e) => Math.sqrt(e[0] * e[0] + e[1] * e[1]), scaleY = (e) => Math.sqrt(e[4] * e[4] + e[5] * e[5]), matrix3dParsers = {
|
|
975
|
+
x: 12,
|
|
976
|
+
y: 13,
|
|
977
|
+
z: 14,
|
|
978
|
+
translateX: 12,
|
|
979
|
+
translateY: 13,
|
|
980
|
+
translateZ: 14,
|
|
981
|
+
scaleX,
|
|
982
|
+
scaleY,
|
|
983
|
+
scale: (e) => (scaleX(e) + scaleY(e)) / 2,
|
|
984
|
+
rotateX: (e) => rebaseAngle(radToDeg(Math.atan2(e[6], e[5]))),
|
|
985
|
+
rotateY: (e) => rebaseAngle(radToDeg(Math.atan2(-e[2], e[0]))),
|
|
986
|
+
rotateZ,
|
|
987
|
+
rotate: rotateZ,
|
|
988
|
+
skewX: (e) => radToDeg(Math.atan(e[4])),
|
|
989
|
+
skewY: (e) => radToDeg(Math.atan(e[1])),
|
|
990
|
+
skew: (e) => (Math.abs(e[1]) + Math.abs(e[4])) / 2
|
|
991
|
+
};
|
|
992
|
+
function defaultTransformValue(e) {
|
|
993
|
+
return e.includes("scale") ? 1 : 0;
|
|
994
|
+
}
|
|
995
|
+
function parseValueFromTransform(e, g) {
|
|
996
|
+
if (!e || e === "none") return defaultTransformValue(g);
|
|
997
|
+
let _ = e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u), v, y;
|
|
998
|
+
if (_) v = matrix3dParsers, y = _;
|
|
999
|
+
else {
|
|
1000
|
+
let g = e.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
1001
|
+
v = matrix2dParsers, y = g;
|
|
1002
|
+
}
|
|
1003
|
+
if (!y) return defaultTransformValue(g);
|
|
1004
|
+
let b = v[g], x = y[1].split(",").map(convertTransformToNumber);
|
|
1005
|
+
return typeof b == "function" ? b(x) : x[b];
|
|
1006
|
+
}
|
|
1007
|
+
var readTransformValue = (e, g) => {
|
|
1008
|
+
let { transform: _ = "none" } = getComputedStyle(e);
|
|
1009
|
+
return parseValueFromTransform(_, g);
|
|
1010
|
+
};
|
|
1011
|
+
function convertTransformToNumber(e) {
|
|
1012
|
+
return parseFloat(e.trim());
|
|
1013
|
+
}
|
|
1014
|
+
var transformPropOrder = [
|
|
1015
|
+
"transformPerspective",
|
|
1016
|
+
"x",
|
|
1017
|
+
"y",
|
|
1018
|
+
"z",
|
|
1019
|
+
"translateX",
|
|
1020
|
+
"translateY",
|
|
1021
|
+
"translateZ",
|
|
1022
|
+
"scale",
|
|
1023
|
+
"scaleX",
|
|
1024
|
+
"scaleY",
|
|
1025
|
+
"rotate",
|
|
1026
|
+
"rotateX",
|
|
1027
|
+
"rotateY",
|
|
1028
|
+
"rotateZ",
|
|
1029
|
+
"skew",
|
|
1030
|
+
"skewX",
|
|
1031
|
+
"skewY"
|
|
1032
|
+
], transformProps = /* @__PURE__ */ (() => new Set(transformPropOrder))(), isNumOrPxType = (e) => e === number || e === px, transformKeys = new Set([
|
|
1033
|
+
"x",
|
|
1034
|
+
"y",
|
|
1035
|
+
"z"
|
|
1036
|
+
]), nonTranslationalTransformKeys = transformPropOrder.filter((e) => !transformKeys.has(e));
|
|
1037
|
+
function removeNonTranslationalTransform(e) {
|
|
1038
|
+
let g = [];
|
|
1039
|
+
return nonTranslationalTransformKeys.forEach((_) => {
|
|
1040
|
+
let v = e.getValue(_);
|
|
1041
|
+
v !== void 0 && (g.push([_, v.get()]), v.set(_.startsWith("scale") ? 1 : 0));
|
|
1042
|
+
}), g;
|
|
1043
|
+
}
|
|
1044
|
+
var positionalValues = {
|
|
1045
|
+
width: ({ x: e }, { paddingLeft: g = "0", paddingRight: _ = "0" }) => e.max - e.min - parseFloat(g) - parseFloat(_),
|
|
1046
|
+
height: ({ y: e }, { paddingTop: g = "0", paddingBottom: _ = "0" }) => e.max - e.min - parseFloat(g) - parseFloat(_),
|
|
1047
|
+
top: (e, { top: g }) => parseFloat(g),
|
|
1048
|
+
left: (e, { left: g }) => parseFloat(g),
|
|
1049
|
+
bottom: ({ y: e }, { top: g }) => parseFloat(g) + (e.max - e.min),
|
|
1050
|
+
right: ({ x: e }, { left: g }) => parseFloat(g) + (e.max - e.min),
|
|
1051
|
+
x: (e, { transform: g }) => parseValueFromTransform(g, "x"),
|
|
1052
|
+
y: (e, { transform: g }) => parseValueFromTransform(g, "y")
|
|
1053
|
+
};
|
|
1054
|
+
positionalValues.translateX = positionalValues.x, positionalValues.translateY = positionalValues.y;
|
|
1055
|
+
var toResolve = /* @__PURE__ */ new Set(), isScheduled = !1, anyNeedsMeasurement = !1, isForced = !1;
|
|
1056
|
+
function measureAllKeyframes() {
|
|
1057
|
+
if (anyNeedsMeasurement) {
|
|
1058
|
+
let e = Array.from(toResolve).filter((e) => e.needsMeasurement), g = new Set(e.map((e) => e.element)), _ = /* @__PURE__ */ new Map();
|
|
1059
|
+
g.forEach((e) => {
|
|
1060
|
+
let g = removeNonTranslationalTransform(e);
|
|
1061
|
+
g.length && (_.set(e, g), e.render());
|
|
1062
|
+
}), e.forEach((e) => e.measureInitialState()), g.forEach((e) => {
|
|
1063
|
+
e.render();
|
|
1064
|
+
let g = _.get(e);
|
|
1065
|
+
g && g.forEach(([g, _]) => {
|
|
1066
|
+
e.getValue(g)?.set(_);
|
|
1067
|
+
});
|
|
1068
|
+
}), e.forEach((e) => e.measureEndState()), e.forEach((e) => {
|
|
1069
|
+
e.suspendedScrollY !== void 0 && window.scrollTo(0, e.suspendedScrollY);
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
anyNeedsMeasurement = !1, isScheduled = !1, toResolve.forEach((e) => e.complete(isForced)), toResolve.clear();
|
|
1073
|
+
}
|
|
1074
|
+
function readAllKeyframes() {
|
|
1075
|
+
toResolve.forEach((e) => {
|
|
1076
|
+
e.readKeyframes(), e.needsMeasurement && (anyNeedsMeasurement = !0);
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
function flushKeyframeResolvers() {
|
|
1080
|
+
isForced = !0, readAllKeyframes(), measureAllKeyframes(), isForced = !1;
|
|
1081
|
+
}
|
|
1082
|
+
var KeyframeResolver = class {
|
|
1083
|
+
constructor(e, g, _, v, y, b = !1) {
|
|
1084
|
+
this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = g, this.name = _, this.motionValue = v, this.element = y, this.isAsync = b;
|
|
1085
|
+
}
|
|
1086
|
+
scheduleResolve() {
|
|
1087
|
+
this.state = "scheduled", this.isAsync ? (toResolve.add(this), isScheduled || (isScheduled = !0, frame.read(readAllKeyframes), frame.resolveKeyframes(measureAllKeyframes))) : (this.readKeyframes(), this.complete());
|
|
1088
|
+
}
|
|
1089
|
+
readKeyframes() {
|
|
1090
|
+
let { unresolvedKeyframes: e, name: g, element: _, motionValue: v } = this;
|
|
1091
|
+
if (e[0] === null) {
|
|
1092
|
+
let y = v?.get(), b = e[e.length - 1];
|
|
1093
|
+
if (y !== void 0) e[0] = y;
|
|
1094
|
+
else if (_ && g) {
|
|
1095
|
+
let v = _.readValue(g, b);
|
|
1096
|
+
v != null && (e[0] = v);
|
|
1097
|
+
}
|
|
1098
|
+
e[0] === void 0 && (e[0] = b), v && y === void 0 && v.set(e[0]);
|
|
1099
|
+
}
|
|
1100
|
+
fillWildcards(e);
|
|
1101
|
+
}
|
|
1102
|
+
setFinalKeyframe() {}
|
|
1103
|
+
measureInitialState() {}
|
|
1104
|
+
renderEndStyles() {}
|
|
1105
|
+
measureEndState() {}
|
|
1106
|
+
complete(e = !1) {
|
|
1107
|
+
this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), toResolve.delete(this);
|
|
1108
|
+
}
|
|
1109
|
+
cancel() {
|
|
1110
|
+
this.state === "scheduled" && (toResolve.delete(this), this.state = "pending");
|
|
1111
|
+
}
|
|
1112
|
+
resume() {
|
|
1113
|
+
this.state === "pending" && this.scheduleResolve();
|
|
1114
|
+
}
|
|
1115
|
+
}, isCSSVar = (e) => e.startsWith("--");
|
|
1116
|
+
function setStyle(e, g, _) {
|
|
1117
|
+
isCSSVar(g) ? e.style.setProperty(g, _) : e.style[g] = _;
|
|
1118
|
+
}
|
|
1119
|
+
var supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0), supportsFlags = {};
|
|
1120
|
+
function memoSupports(e, g) {
|
|
1121
|
+
let _ = /* @__PURE__ */ memo(e);
|
|
1122
|
+
return () => supportsFlags[g] ?? _();
|
|
1123
|
+
}
|
|
1124
|
+
var supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
1125
|
+
try {
|
|
1126
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
1127
|
+
} catch {
|
|
1128
|
+
return !1;
|
|
1129
|
+
}
|
|
1130
|
+
return !0;
|
|
1131
|
+
}, "linearEasing"), cubicBezierAsString = ([e, g, _, v]) => `cubic-bezier(${e}, ${g}, ${_}, ${v})`, supportedWaapiEasing = {
|
|
1132
|
+
linear: "linear",
|
|
1133
|
+
ease: "ease",
|
|
1134
|
+
easeIn: "ease-in",
|
|
1135
|
+
easeOut: "ease-out",
|
|
1136
|
+
easeInOut: "ease-in-out",
|
|
1137
|
+
circIn: /* @__PURE__ */ cubicBezierAsString([
|
|
1138
|
+
0,
|
|
1139
|
+
.65,
|
|
1140
|
+
.55,
|
|
1141
|
+
1
|
|
1142
|
+
]),
|
|
1143
|
+
circOut: /* @__PURE__ */ cubicBezierAsString([
|
|
1144
|
+
.55,
|
|
1145
|
+
0,
|
|
1146
|
+
1,
|
|
1147
|
+
.45
|
|
1148
|
+
]),
|
|
1149
|
+
backIn: /* @__PURE__ */ cubicBezierAsString([
|
|
1150
|
+
.31,
|
|
1151
|
+
.01,
|
|
1152
|
+
.66,
|
|
1153
|
+
-.59
|
|
1154
|
+
]),
|
|
1155
|
+
backOut: /* @__PURE__ */ cubicBezierAsString([
|
|
1156
|
+
.33,
|
|
1157
|
+
1.53,
|
|
1158
|
+
.69,
|
|
1159
|
+
.99
|
|
1160
|
+
])
|
|
1161
|
+
};
|
|
1162
|
+
function mapEasingToNativeEasing(e, g) {
|
|
1163
|
+
if (e) return typeof e == "function" ? supportsLinearEasing() ? generateLinearEasing(e, g) : "ease-out" : isBezierDefinition(e) ? cubicBezierAsString(e) : Array.isArray(e) ? e.map((e) => mapEasingToNativeEasing(e, g) || supportedWaapiEasing.easeOut) : supportedWaapiEasing[e];
|
|
1164
|
+
}
|
|
1165
|
+
function startWaapiAnimation(e, g, _, { delay: v = 0, duration: y = 300, repeat: b = 0, repeatType: x = "loop", ease: S = "easeOut", times: C } = {}, w = void 0) {
|
|
1166
|
+
let T = { [g]: _ };
|
|
1167
|
+
C && (T.offset = C);
|
|
1168
|
+
let E = mapEasingToNativeEasing(S, y);
|
|
1169
|
+
Array.isArray(E) && (T.easing = E), statsBuffer.value && activeAnimations.waapi++;
|
|
1170
|
+
let D = {
|
|
1171
|
+
delay: v,
|
|
1172
|
+
duration: y,
|
|
1173
|
+
easing: Array.isArray(E) ? "linear" : E,
|
|
1174
|
+
fill: "both",
|
|
1175
|
+
iterations: b + 1,
|
|
1176
|
+
direction: x === "reverse" ? "alternate" : "normal"
|
|
1177
|
+
};
|
|
1178
|
+
w && (D.pseudoElement = w);
|
|
1179
|
+
let O = e.animate(T, D);
|
|
1180
|
+
return statsBuffer.value && O.finished.finally(() => {
|
|
1181
|
+
activeAnimations.waapi--;
|
|
1182
|
+
}), O;
|
|
1183
|
+
}
|
|
1184
|
+
function isGenerator(e) {
|
|
1185
|
+
return typeof e == "function" && "applyToOptions" in e;
|
|
1186
|
+
}
|
|
1187
|
+
function applyGeneratorOptions({ type: e, ...g }) {
|
|
1188
|
+
return isGenerator(e) && supportsLinearEasing() ? e.applyToOptions(g) : (g.duration ??= 300, g.ease ??= "easeOut", g);
|
|
1189
|
+
}
|
|
1190
|
+
var NativeAnimation = class extends WithPromise {
|
|
1191
|
+
constructor(e) {
|
|
1192
|
+
if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !e) return;
|
|
1193
|
+
let { element: g, name: _, keyframes: v, pseudoElement: y, allowFlatten: b = !1, finalKeyframe: x, onComplete: S } = e;
|
|
1194
|
+
this.isPseudoElement = !!y, this.allowFlatten = b, this.options = e, invariant(typeof e.type != "string", "Mini animate() doesn't support \"type\" as a string.", "mini-spring");
|
|
1195
|
+
let C = applyGeneratorOptions(e);
|
|
1196
|
+
this.animation = startWaapiAnimation(g, _, v, C, y), C.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
|
|
1197
|
+
if (this.finishedTime = this.time, !y) {
|
|
1198
|
+
let e = getFinalKeyframe$1(v, this.options, x, this.speed);
|
|
1199
|
+
this.updateMotionValue ? this.updateMotionValue(e) : setStyle(g, _, e), this.animation.cancel();
|
|
1200
|
+
}
|
|
1201
|
+
S?.(), this.notifyFinished();
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
play() {
|
|
1205
|
+
this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished());
|
|
1206
|
+
}
|
|
1207
|
+
pause() {
|
|
1208
|
+
this.animation.pause();
|
|
1209
|
+
}
|
|
1210
|
+
complete() {
|
|
1211
|
+
this.animation.finish?.();
|
|
1212
|
+
}
|
|
1213
|
+
cancel() {
|
|
1214
|
+
try {
|
|
1215
|
+
this.animation.cancel();
|
|
1216
|
+
} catch {}
|
|
1217
|
+
}
|
|
1218
|
+
stop() {
|
|
1219
|
+
if (this.isStopped) return;
|
|
1220
|
+
this.isStopped = !0;
|
|
1221
|
+
let { state: e } = this;
|
|
1222
|
+
e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
|
|
1223
|
+
}
|
|
1224
|
+
commitStyles() {
|
|
1225
|
+
let e = this.options?.element;
|
|
1226
|
+
!this.isPseudoElement && e?.isConnected && this.animation.commitStyles?.();
|
|
1227
|
+
}
|
|
1228
|
+
get duration() {
|
|
1229
|
+
let e = this.animation.effect?.getComputedTiming?.().duration || 0;
|
|
1230
|
+
return /* @__PURE__ */ millisecondsToSeconds(Number(e));
|
|
1231
|
+
}
|
|
1232
|
+
get iterationDuration() {
|
|
1233
|
+
let { delay: e = 0 } = this.options || {};
|
|
1234
|
+
return this.duration + /* @__PURE__ */ millisecondsToSeconds(e);
|
|
1235
|
+
}
|
|
1236
|
+
get time() {
|
|
1237
|
+
return /* @__PURE__ */ millisecondsToSeconds(Number(this.animation.currentTime) || 0);
|
|
1238
|
+
}
|
|
1239
|
+
set time(e) {
|
|
1240
|
+
this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ secondsToMilliseconds(e);
|
|
1241
|
+
}
|
|
1242
|
+
get speed() {
|
|
1243
|
+
return this.animation.playbackRate;
|
|
1244
|
+
}
|
|
1245
|
+
set speed(e) {
|
|
1246
|
+
e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
|
|
1247
|
+
}
|
|
1248
|
+
get state() {
|
|
1249
|
+
return this.finishedTime === null ? this.animation.playState : "finished";
|
|
1250
|
+
}
|
|
1251
|
+
get startTime() {
|
|
1252
|
+
return this.manualStartTime ?? Number(this.animation.startTime);
|
|
1253
|
+
}
|
|
1254
|
+
set startTime(e) {
|
|
1255
|
+
this.manualStartTime = this.animation.startTime = e;
|
|
1256
|
+
}
|
|
1257
|
+
attachTimeline({ timeline: e, observe: g }) {
|
|
1258
|
+
return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, e && supportsScrollTimeline() ? (this.animation.timeline = e, noop) : g(this);
|
|
1259
|
+
}
|
|
1260
|
+
}, unsupportedEasingFunctions = {
|
|
1261
|
+
anticipate,
|
|
1262
|
+
backInOut,
|
|
1263
|
+
circInOut
|
|
1264
|
+
};
|
|
1265
|
+
function isUnsupportedEase(e) {
|
|
1266
|
+
return e in unsupportedEasingFunctions;
|
|
1267
|
+
}
|
|
1268
|
+
function replaceStringEasing(e) {
|
|
1269
|
+
typeof e.ease == "string" && isUnsupportedEase(e.ease) && (e.ease = unsupportedEasingFunctions[e.ease]);
|
|
1270
|
+
}
|
|
1271
|
+
var sampleDelta = 10, NativeAnimationExtended = class extends NativeAnimation {
|
|
1272
|
+
constructor(e) {
|
|
1273
|
+
replaceStringEasing(e), replaceTransitionType(e), super(e), e.startTime !== void 0 && (this.startTime = e.startTime), this.options = e;
|
|
1274
|
+
}
|
|
1275
|
+
updateMotionValue(e) {
|
|
1276
|
+
let { motionValue: g, onUpdate: _, onComplete: v, element: y, ...b } = this.options;
|
|
1277
|
+
if (!g) return;
|
|
1278
|
+
if (e !== void 0) {
|
|
1279
|
+
g.set(e);
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
let x = new JSAnimation({
|
|
1283
|
+
...b,
|
|
1284
|
+
autoplay: !1
|
|
1285
|
+
}), S = Math.max(sampleDelta, time.now() - this.startTime), C = clamp(0, sampleDelta, S - sampleDelta);
|
|
1286
|
+
g.setWithVelocity(x.sample(Math.max(0, S - C)).value, x.sample(S).value, C), x.stop();
|
|
1287
|
+
}
|
|
1288
|
+
}, isAnimatable = (e, g) => g === "zIndex" ? !1 : !!(typeof e == "number" || Array.isArray(e) || typeof e == "string" && (complex.test(e) || e === "0") && !e.startsWith("url("));
|
|
1289
|
+
function hasKeyframesChanged(e) {
|
|
1290
|
+
let g = e[0];
|
|
1291
|
+
if (e.length === 1) return !0;
|
|
1292
|
+
for (let _ = 0; _ < e.length; _++) if (e[_] !== g) return !0;
|
|
1293
|
+
}
|
|
1294
|
+
function canAnimate(e, g, _, v) {
|
|
1295
|
+
let y = e[0];
|
|
1296
|
+
if (y === null) return !1;
|
|
1297
|
+
if (g === "display" || g === "visibility") return !0;
|
|
1298
|
+
let b = e[e.length - 1], x = isAnimatable(y, g), S = isAnimatable(b, g);
|
|
1299
|
+
return warning(x === S, `You are trying to animate ${g} from "${y}" to "${b}". "${x ? b : y}" is not an animatable value.`, "value-not-animatable"), !x || !S ? !1 : hasKeyframesChanged(e) || (_ === "spring" || isGenerator(_)) && v;
|
|
1300
|
+
}
|
|
1301
|
+
function makeAnimationInstant(e) {
|
|
1302
|
+
e.duration = 0, e.type = "keyframes";
|
|
1303
|
+
}
|
|
1304
|
+
var acceleratedValues$1 = new Set([
|
|
1305
|
+
"opacity",
|
|
1306
|
+
"clipPath",
|
|
1307
|
+
"filter",
|
|
1308
|
+
"transform"
|
|
1309
|
+
]), supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
1310
|
+
function supportsBrowserAnimation(e) {
|
|
1311
|
+
let { motionValue: g, name: _, repeatDelay: v, repeatType: y, damping: b, type: x } = e;
|
|
1312
|
+
if (!(g?.owner?.current instanceof HTMLElement)) return !1;
|
|
1313
|
+
let { onUpdate: S, transformTemplate: C } = g.owner.getProps();
|
|
1314
|
+
return supportsWaapi() && _ && acceleratedValues$1.has(_) && (_ !== "transform" || !C) && !S && !v && y !== "mirror" && b !== 0 && x !== "inertia";
|
|
1315
|
+
}
|
|
1316
|
+
var MAX_RESOLVE_DELAY = 40, AsyncMotionValueAnimation = class extends WithPromise {
|
|
1317
|
+
constructor({ autoplay: e = !0, delay: g = 0, type: _ = "keyframes", repeat: v = 0, repeatDelay: y = 0, repeatType: b = "loop", keyframes: x, name: S, motionValue: C, element: w, ...T }) {
|
|
1318
|
+
super(), this.stop = () => {
|
|
1319
|
+
this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
|
|
1320
|
+
}, this.createdAt = time.now();
|
|
1321
|
+
let E = {
|
|
1322
|
+
autoplay: e,
|
|
1323
|
+
delay: g,
|
|
1324
|
+
type: _,
|
|
1325
|
+
repeat: v,
|
|
1326
|
+
repeatDelay: y,
|
|
1327
|
+
repeatType: b,
|
|
1328
|
+
name: S,
|
|
1329
|
+
motionValue: C,
|
|
1330
|
+
element: w,
|
|
1331
|
+
...T
|
|
1332
|
+
};
|
|
1333
|
+
this.keyframeResolver = new (w?.KeyframeResolver || KeyframeResolver)(x, (e, g, _) => this.onKeyframesResolved(e, g, E, !_), S, C, w), this.keyframeResolver?.scheduleResolve();
|
|
1334
|
+
}
|
|
1335
|
+
onKeyframesResolved(e, g, _, v) {
|
|
1336
|
+
this.keyframeResolver = void 0;
|
|
1337
|
+
let { name: y, type: b, velocity: x, delay: S, isHandoff: C, onUpdate: w } = _;
|
|
1338
|
+
this.resolvedAt = time.now(), canAnimate(e, y, b, x) || ((MotionGlobalConfig.instantAnimations || !S) && w?.(getFinalKeyframe$1(e, _, g)), e[0] = e[e.length - 1], makeAnimationInstant(_), _.repeat = 0);
|
|
1339
|
+
let T = {
|
|
1340
|
+
startTime: v ? this.resolvedAt && this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY ? this.resolvedAt : this.createdAt : void 0,
|
|
1341
|
+
finalKeyframe: g,
|
|
1342
|
+
..._,
|
|
1343
|
+
keyframes: e
|
|
1344
|
+
}, E = !C && supportsBrowserAnimation(T), D = T.motionValue?.owner?.current, O = E ? new NativeAnimationExtended({
|
|
1345
|
+
...T,
|
|
1346
|
+
element: D
|
|
1347
|
+
}) : new JSAnimation(T);
|
|
1348
|
+
O.finished.then(() => {
|
|
1349
|
+
this.notifyFinished();
|
|
1350
|
+
}).catch(noop), this.pendingTimeline &&= (this.stopTimeline = O.attachTimeline(this.pendingTimeline), void 0), this._animation = O;
|
|
1351
|
+
}
|
|
1352
|
+
get finished() {
|
|
1353
|
+
return this._animation ? this.animation.finished : this._finished;
|
|
1354
|
+
}
|
|
1355
|
+
then(e, g) {
|
|
1356
|
+
return this.finished.finally(e).then(() => {});
|
|
1357
|
+
}
|
|
1358
|
+
get animation() {
|
|
1359
|
+
return this._animation || (this.keyframeResolver?.resume(), flushKeyframeResolvers()), this._animation;
|
|
1360
|
+
}
|
|
1361
|
+
get duration() {
|
|
1362
|
+
return this.animation.duration;
|
|
1363
|
+
}
|
|
1364
|
+
get iterationDuration() {
|
|
1365
|
+
return this.animation.iterationDuration;
|
|
1366
|
+
}
|
|
1367
|
+
get time() {
|
|
1368
|
+
return this.animation.time;
|
|
1369
|
+
}
|
|
1370
|
+
set time(e) {
|
|
1371
|
+
this.animation.time = e;
|
|
1372
|
+
}
|
|
1373
|
+
get speed() {
|
|
1374
|
+
return this.animation.speed;
|
|
1375
|
+
}
|
|
1376
|
+
get state() {
|
|
1377
|
+
return this.animation.state;
|
|
1378
|
+
}
|
|
1379
|
+
set speed(e) {
|
|
1380
|
+
this.animation.speed = e;
|
|
1381
|
+
}
|
|
1382
|
+
get startTime() {
|
|
1383
|
+
return this.animation.startTime;
|
|
1384
|
+
}
|
|
1385
|
+
attachTimeline(e) {
|
|
1386
|
+
return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
|
|
1387
|
+
}
|
|
1388
|
+
play() {
|
|
1389
|
+
this.animation.play();
|
|
1390
|
+
}
|
|
1391
|
+
pause() {
|
|
1392
|
+
this.animation.pause();
|
|
1393
|
+
}
|
|
1394
|
+
complete() {
|
|
1395
|
+
this.animation.complete();
|
|
1396
|
+
}
|
|
1397
|
+
cancel() {
|
|
1398
|
+
this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
function calcChildStagger(e, g, _, v = 0, y = 1) {
|
|
1402
|
+
let b = Array.from(e).sort((e, g) => e.sortNodePosition(g)).indexOf(g), x = e.size, S = (x - 1) * v;
|
|
1403
|
+
return typeof _ == "function" ? _(b, x) : y === 1 ? b * v : S - b * v;
|
|
1404
|
+
}
|
|
1405
|
+
var splitCSSVariableRegex = /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
|
|
1406
|
+
function parseCSSVariable(e) {
|
|
1407
|
+
let g = splitCSSVariableRegex.exec(e);
|
|
1408
|
+
if (!g) return [,];
|
|
1409
|
+
let [, _, v, y] = g;
|
|
1410
|
+
return [`--${_ ?? v}`, y];
|
|
1411
|
+
}
|
|
1412
|
+
var maxDepth = 4;
|
|
1413
|
+
function getVariableValue(e, g, _ = 1) {
|
|
1414
|
+
invariant(_ <= maxDepth, `Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
1415
|
+
let [v, y] = parseCSSVariable(e);
|
|
1416
|
+
if (!v) return;
|
|
1417
|
+
let b = window.getComputedStyle(g).getPropertyValue(v);
|
|
1418
|
+
if (b) {
|
|
1419
|
+
let e = b.trim();
|
|
1420
|
+
return isNumericalString(e) ? parseFloat(e) : e;
|
|
1421
|
+
}
|
|
1422
|
+
return isCSSVariableToken(y) ? getVariableValue(y, g, _ + 1) : y;
|
|
1423
|
+
}
|
|
1424
|
+
var underDampedSpring = {
|
|
1425
|
+
type: "spring",
|
|
1426
|
+
stiffness: 500,
|
|
1427
|
+
damping: 25,
|
|
1428
|
+
restSpeed: 10
|
|
1429
|
+
}, criticallyDampedSpring = (e) => ({
|
|
1430
|
+
type: "spring",
|
|
1431
|
+
stiffness: 550,
|
|
1432
|
+
damping: e === 0 ? 2 * Math.sqrt(550) : 30,
|
|
1433
|
+
restSpeed: 10
|
|
1434
|
+
}), keyframesTransition = {
|
|
1435
|
+
type: "keyframes",
|
|
1436
|
+
duration: .8
|
|
1437
|
+
}, ease = {
|
|
1438
|
+
type: "keyframes",
|
|
1439
|
+
ease: [
|
|
1440
|
+
.25,
|
|
1441
|
+
.1,
|
|
1442
|
+
.35,
|
|
1443
|
+
1
|
|
1444
|
+
],
|
|
1445
|
+
duration: .3
|
|
1446
|
+
}, getDefaultTransition = (e, { keyframes: g }) => g.length > 2 ? keyframesTransition : transformProps.has(e) ? e.startsWith("scale") ? criticallyDampedSpring(g[1]) : underDampedSpring : ease, isNotNull = (e) => e !== null;
|
|
1447
|
+
function getFinalKeyframe(e, { repeat: g, repeatType: _ = "loop" }, v) {
|
|
1448
|
+
let y = e.filter(isNotNull), b = g && _ !== "loop" && g % 2 == 1 ? 0 : y.length - 1;
|
|
1449
|
+
return !b || v === void 0 ? y[b] : v;
|
|
1450
|
+
}
|
|
1451
|
+
function resolveTransition(e, g) {
|
|
1452
|
+
if (e?.inherit && g) {
|
|
1453
|
+
let { inherit: _, ...v } = e;
|
|
1454
|
+
return {
|
|
1455
|
+
...g,
|
|
1456
|
+
...v
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
return e;
|
|
1460
|
+
}
|
|
1461
|
+
function getValueTransition(e, g) {
|
|
1462
|
+
let _ = e?.[g] ?? e?.default ?? e;
|
|
1463
|
+
return _ === e ? _ : resolveTransition(_, e);
|
|
1464
|
+
}
|
|
1465
|
+
function isTransitionDefined({ when: e, delay: g, delayChildren: _, staggerChildren: v, staggerDirection: y, repeat: b, repeatType: x, repeatDelay: S, from: C, elapsed: w, ...T }) {
|
|
1466
|
+
return !!Object.keys(T).length;
|
|
1467
|
+
}
|
|
1468
|
+
var animateMotionValue = (e, g, _, v = {}, y, b) => (x) => {
|
|
1469
|
+
let S = getValueTransition(v, e) || {}, C = S.delay || v.delay || 0, { elapsed: w = 0 } = v;
|
|
1470
|
+
w -= /* @__PURE__ */ secondsToMilliseconds(C);
|
|
1471
|
+
let T = {
|
|
1472
|
+
keyframes: Array.isArray(_) ? _ : [null, _],
|
|
1473
|
+
ease: "easeOut",
|
|
1474
|
+
velocity: g.getVelocity(),
|
|
1475
|
+
...S,
|
|
1476
|
+
delay: -w,
|
|
1477
|
+
onUpdate: (e) => {
|
|
1478
|
+
g.set(e), S.onUpdate && S.onUpdate(e);
|
|
1479
|
+
},
|
|
1480
|
+
onComplete: () => {
|
|
1481
|
+
x(), S.onComplete && S.onComplete();
|
|
1482
|
+
},
|
|
1483
|
+
name: e,
|
|
1484
|
+
motionValue: g,
|
|
1485
|
+
element: b ? void 0 : y
|
|
1486
|
+
};
|
|
1487
|
+
isTransitionDefined(S) || Object.assign(T, getDefaultTransition(e, T)), T.duration &&= /* @__PURE__ */ secondsToMilliseconds(T.duration), T.repeatDelay &&= /* @__PURE__ */ secondsToMilliseconds(T.repeatDelay), T.from !== void 0 && (T.keyframes[0] = T.from);
|
|
1488
|
+
let E = !1;
|
|
1489
|
+
if ((T.type === !1 || T.duration === 0 && !T.repeatDelay) && (makeAnimationInstant(T), T.delay === 0 && (E = !0)), (MotionGlobalConfig.instantAnimations || MotionGlobalConfig.skipAnimations || y?.shouldSkipAnimations) && (E = !0, makeAnimationInstant(T), T.delay = 0), T.allowFlatten = !S.type && !S.ease, E && !b && g.get() !== void 0) {
|
|
1490
|
+
let e = getFinalKeyframe(T.keyframes, S);
|
|
1491
|
+
if (e !== void 0) {
|
|
1492
|
+
frame.update(() => {
|
|
1493
|
+
T.onUpdate(e), T.onComplete();
|
|
1494
|
+
});
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
return S.isSync ? new JSAnimation(T) : new AsyncMotionValueAnimation(T);
|
|
1499
|
+
};
|
|
1500
|
+
function getValueState(e) {
|
|
1501
|
+
let g = [{}, {}];
|
|
1502
|
+
return e?.values.forEach((e, _) => {
|
|
1503
|
+
g[0][_] = e.get(), g[1][_] = e.getVelocity();
|
|
1504
|
+
}), g;
|
|
1505
|
+
}
|
|
1506
|
+
function resolveVariantFromProps(e, g, _, v) {
|
|
1507
|
+
if (typeof g == "function") {
|
|
1508
|
+
let [y, b] = getValueState(v);
|
|
1509
|
+
g = g(_ === void 0 ? e.custom : _, y, b);
|
|
1510
|
+
}
|
|
1511
|
+
if (typeof g == "string" && (g = e.variants && e.variants[g]), typeof g == "function") {
|
|
1512
|
+
let [y, b] = getValueState(v);
|
|
1513
|
+
g = g(_ === void 0 ? e.custom : _, y, b);
|
|
1514
|
+
}
|
|
1515
|
+
return g;
|
|
1516
|
+
}
|
|
1517
|
+
function resolveVariant(e, g, _) {
|
|
1518
|
+
let v = e.getProps();
|
|
1519
|
+
return resolveVariantFromProps(v, g, _ === void 0 ? v.custom : _, e);
|
|
1520
|
+
}
|
|
1521
|
+
var positionalKeys = new Set([
|
|
1522
|
+
"width",
|
|
1523
|
+
"height",
|
|
1524
|
+
"top",
|
|
1525
|
+
"left",
|
|
1526
|
+
"right",
|
|
1527
|
+
"bottom",
|
|
1528
|
+
...transformPropOrder
|
|
1529
|
+
]), MAX_VELOCITY_DELTA = 30, isFloat = (e) => !isNaN(parseFloat(e)), collectMotionValues = { current: void 0 }, MotionValue = class {
|
|
1530
|
+
constructor(e, g = {}) {
|
|
1531
|
+
this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (e) => {
|
|
1532
|
+
let g = time.now();
|
|
1533
|
+
if (this.updatedAt !== g && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(e), this.current !== this.prev && (this.events.change?.notify(this.current), this.dependents)) for (let e of this.dependents) e.dirty();
|
|
1534
|
+
}, this.hasAnimated = !1, this.setCurrent(e), this.owner = g.owner;
|
|
1535
|
+
}
|
|
1536
|
+
setCurrent(e) {
|
|
1537
|
+
this.current = e, this.updatedAt = time.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = isFloat(this.current));
|
|
1538
|
+
}
|
|
1539
|
+
setPrevFrameValue(e = this.current) {
|
|
1540
|
+
this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
|
|
1541
|
+
}
|
|
1542
|
+
onChange(e) {
|
|
1543
|
+
return process.env.NODE_ENV !== "production" && warnOnce(!1, "value.onChange(callback) is deprecated. Switch to value.on(\"change\", callback)."), this.on("change", e);
|
|
1544
|
+
}
|
|
1545
|
+
on(e, g) {
|
|
1546
|
+
this.events[e] || (this.events[e] = new SubscriptionManager());
|
|
1547
|
+
let _ = this.events[e].add(g);
|
|
1548
|
+
return e === "change" ? () => {
|
|
1549
|
+
_(), frame.read(() => {
|
|
1550
|
+
this.events.change.getSize() || this.stop();
|
|
1551
|
+
});
|
|
1552
|
+
} : _;
|
|
1553
|
+
}
|
|
1554
|
+
clearListeners() {
|
|
1555
|
+
for (let e in this.events) this.events[e].clear();
|
|
1556
|
+
}
|
|
1557
|
+
attach(e, g) {
|
|
1558
|
+
this.passiveEffect = e, this.stopPassiveEffect = g;
|
|
1559
|
+
}
|
|
1560
|
+
set(e) {
|
|
1561
|
+
this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
|
|
1562
|
+
}
|
|
1563
|
+
setWithVelocity(e, g, _) {
|
|
1564
|
+
this.set(g), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - _;
|
|
1565
|
+
}
|
|
1566
|
+
jump(e, g = !0) {
|
|
1567
|
+
this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, g && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1568
|
+
}
|
|
1569
|
+
dirty() {
|
|
1570
|
+
this.events.change?.notify(this.current);
|
|
1571
|
+
}
|
|
1572
|
+
addDependent(e) {
|
|
1573
|
+
this.dependents ||= /* @__PURE__ */ new Set(), this.dependents.add(e);
|
|
1574
|
+
}
|
|
1575
|
+
removeDependent(e) {
|
|
1576
|
+
this.dependents && this.dependents.delete(e);
|
|
1577
|
+
}
|
|
1578
|
+
get() {
|
|
1579
|
+
return collectMotionValues.current && collectMotionValues.current.push(this), this.current;
|
|
1580
|
+
}
|
|
1581
|
+
getPrevious() {
|
|
1582
|
+
return this.prev;
|
|
1583
|
+
}
|
|
1584
|
+
getVelocity() {
|
|
1585
|
+
let e = time.now();
|
|
1586
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > MAX_VELOCITY_DELTA) return 0;
|
|
1587
|
+
let g = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
1588
|
+
return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), g);
|
|
1589
|
+
}
|
|
1590
|
+
start(e) {
|
|
1591
|
+
return this.stop(), new Promise((g) => {
|
|
1592
|
+
this.hasAnimated = !0, this.animation = e(g), this.events.animationStart && this.events.animationStart.notify();
|
|
1593
|
+
}).then(() => {
|
|
1594
|
+
this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
stop() {
|
|
1598
|
+
this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
|
|
1599
|
+
}
|
|
1600
|
+
isAnimating() {
|
|
1601
|
+
return !!this.animation;
|
|
1602
|
+
}
|
|
1603
|
+
clearAnimation() {
|
|
1604
|
+
delete this.animation;
|
|
1605
|
+
}
|
|
1606
|
+
destroy() {
|
|
1607
|
+
this.dependents?.clear(), this.events.destroy?.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
function motionValue(e, g) {
|
|
1611
|
+
return new MotionValue(e, g);
|
|
1612
|
+
}
|
|
1613
|
+
var isKeyframesTarget = (e) => Array.isArray(e);
|
|
1614
|
+
function setMotionValue(e, g, _) {
|
|
1615
|
+
e.hasValue(g) ? e.getValue(g).set(_) : e.addValue(g, motionValue(_));
|
|
1616
|
+
}
|
|
1617
|
+
function resolveFinalValueInKeyframes(e) {
|
|
1618
|
+
return isKeyframesTarget(e) ? e[e.length - 1] || 0 : e;
|
|
1619
|
+
}
|
|
1620
|
+
function setTarget(e, g) {
|
|
1621
|
+
let { transitionEnd: _ = {}, transition: v = {}, ...y } = resolveVariant(e, g) || {};
|
|
1622
|
+
for (let g in y = {
|
|
1623
|
+
...y,
|
|
1624
|
+
..._
|
|
1625
|
+
}, y) setMotionValue(e, g, resolveFinalValueInKeyframes(y[g]));
|
|
1626
|
+
}
|
|
1627
|
+
var isMotionValue = (e) => !!(e && e.getVelocity);
|
|
1628
|
+
function isWillChangeMotionValue(e) {
|
|
1629
|
+
return !!(isMotionValue(e) && e.add);
|
|
1630
|
+
}
|
|
1631
|
+
function addValueToWillChange(e, g) {
|
|
1632
|
+
let _ = e.getValue("willChange");
|
|
1633
|
+
if (isWillChangeMotionValue(_)) return _.add(g);
|
|
1634
|
+
if (!_ && MotionGlobalConfig.WillChange) {
|
|
1635
|
+
let _ = new MotionGlobalConfig.WillChange("auto");
|
|
1636
|
+
e.addValue("willChange", _), _.add(g);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
function camelToDash(e) {
|
|
1640
|
+
return e.replace(/([A-Z])/g, (e) => `-${e.toLowerCase()}`);
|
|
1641
|
+
}
|
|
1642
|
+
var optimizedAppearDataAttribute = "data-" + camelToDash("framerAppearId");
|
|
1643
|
+
function getOptimisedAppearId(e) {
|
|
1644
|
+
return e.props[optimizedAppearDataAttribute];
|
|
1645
|
+
}
|
|
1646
|
+
function shouldBlockAnimation({ protectedKeys: e, needsAnimating: g }, _) {
|
|
1647
|
+
let v = e.hasOwnProperty(_) && g[_] !== !0;
|
|
1648
|
+
return g[_] = !1, v;
|
|
1649
|
+
}
|
|
1650
|
+
function animateTarget(e, g, { delay: _ = 0, transitionOverride: v, type: y } = {}) {
|
|
1651
|
+
let { transition: b, transitionEnd: x, ...S } = g, C = e.getDefaultTransition();
|
|
1652
|
+
b = b ? resolveTransition(b, C) : C;
|
|
1653
|
+
let w = b?.reduceMotion;
|
|
1654
|
+
v && (b = v);
|
|
1655
|
+
let T = [], E = y && e.animationState && e.animationState.getState()[y];
|
|
1656
|
+
for (let g in S) {
|
|
1657
|
+
let v = e.getValue(g, e.latestValues[g] ?? null), y = S[g];
|
|
1658
|
+
if (y === void 0 || E && shouldBlockAnimation(E, g)) continue;
|
|
1659
|
+
let x = {
|
|
1660
|
+
delay: _,
|
|
1661
|
+
...getValueTransition(b || {}, g)
|
|
1662
|
+
}, C = v.get();
|
|
1663
|
+
if (C !== void 0 && !v.isAnimating && !Array.isArray(y) && y === C && !x.velocity) continue;
|
|
1664
|
+
let D = !1;
|
|
1665
|
+
if (window.MotionHandoffAnimation) {
|
|
1666
|
+
let _ = getOptimisedAppearId(e);
|
|
1667
|
+
if (_) {
|
|
1668
|
+
let e = window.MotionHandoffAnimation(_, g, frame);
|
|
1669
|
+
e !== null && (x.startTime = e, D = !0);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
addValueToWillChange(e, g);
|
|
1673
|
+
let O = w ?? e.shouldReduceMotion;
|
|
1674
|
+
v.start(animateMotionValue(g, v, y, O && positionalKeys.has(g) ? { type: !1 } : x, e, D));
|
|
1675
|
+
let k = v.animation;
|
|
1676
|
+
k && T.push(k);
|
|
1677
|
+
}
|
|
1678
|
+
if (x) {
|
|
1679
|
+
let g = () => frame.update(() => {
|
|
1680
|
+
x && setTarget(e, x);
|
|
1681
|
+
});
|
|
1682
|
+
T.length ? Promise.all(T).then(g) : g();
|
|
1683
|
+
}
|
|
1684
|
+
return T;
|
|
1685
|
+
}
|
|
1686
|
+
function animateVariant(e, g, _ = {}) {
|
|
1687
|
+
let v = resolveVariant(e, g, _.type === "exit" ? e.presenceContext?.custom : void 0), { transition: y = e.getDefaultTransition() || {} } = v || {};
|
|
1688
|
+
_.transitionOverride && (y = _.transitionOverride);
|
|
1689
|
+
let b = v ? () => Promise.all(animateTarget(e, v, _)) : () => Promise.resolve(), x = e.variantChildren && e.variantChildren.size ? (v = 0) => {
|
|
1690
|
+
let { delayChildren: b = 0, staggerChildren: x, staggerDirection: S } = y;
|
|
1691
|
+
return animateChildren(e, g, v, b, x, S, _);
|
|
1692
|
+
} : () => Promise.resolve(), { when: S } = y;
|
|
1693
|
+
if (S) {
|
|
1694
|
+
let [e, g] = S === "beforeChildren" ? [b, x] : [x, b];
|
|
1695
|
+
return e().then(() => g());
|
|
1696
|
+
} else return Promise.all([b(), x(_.delay)]);
|
|
1697
|
+
}
|
|
1698
|
+
function animateChildren(e, g, _ = 0, v = 0, y = 0, b = 1, x) {
|
|
1699
|
+
let S = [];
|
|
1700
|
+
for (let C of e.variantChildren) C.notify("AnimationStart", g), S.push(animateVariant(C, g, {
|
|
1701
|
+
...x,
|
|
1702
|
+
delay: _ + (typeof v == "function" ? 0 : v) + calcChildStagger(e.variantChildren, C, v, y, b)
|
|
1703
|
+
}).then(() => C.notify("AnimationComplete", g)));
|
|
1704
|
+
return Promise.all(S);
|
|
1705
|
+
}
|
|
1706
|
+
function animateVisualElement(e, g, _ = {}) {
|
|
1707
|
+
e.notify("AnimationStart", g);
|
|
1708
|
+
let v;
|
|
1709
|
+
if (Array.isArray(g)) {
|
|
1710
|
+
let y = g.map((g) => animateVariant(e, g, _));
|
|
1711
|
+
v = Promise.all(y);
|
|
1712
|
+
} else if (typeof g == "string") v = animateVariant(e, g, _);
|
|
1713
|
+
else {
|
|
1714
|
+
let y = typeof g == "function" ? resolveVariant(e, g, _.custom) : g;
|
|
1715
|
+
v = Promise.all(animateTarget(e, y, _));
|
|
1716
|
+
}
|
|
1717
|
+
return v.then(() => {
|
|
1718
|
+
e.notify("AnimationComplete", g);
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
var auto = {
|
|
1722
|
+
test: (e) => e === "auto",
|
|
1723
|
+
parse: (e) => e
|
|
1724
|
+
}, testValueType = (e) => (g) => g.test(e), dimensionValueTypes = [
|
|
1725
|
+
number,
|
|
1726
|
+
px,
|
|
1727
|
+
percent,
|
|
1728
|
+
degrees,
|
|
1729
|
+
vw,
|
|
1730
|
+
vh,
|
|
1731
|
+
auto
|
|
1732
|
+
], findDimensionValueType = (e) => dimensionValueTypes.find(testValueType(e));
|
|
1733
|
+
function isNone(e) {
|
|
1734
|
+
return typeof e == "number" ? e === 0 : e === null ? !0 : e === "none" || e === "0" || isZeroValueString(e);
|
|
1735
|
+
}
|
|
1736
|
+
var maxDefaults = new Set([
|
|
1737
|
+
"brightness",
|
|
1738
|
+
"contrast",
|
|
1739
|
+
"saturate",
|
|
1740
|
+
"opacity"
|
|
1741
|
+
]);
|
|
1742
|
+
function applyDefaultFilter(e) {
|
|
1743
|
+
let [g, _] = e.slice(0, -1).split("(");
|
|
1744
|
+
if (g === "drop-shadow") return e;
|
|
1745
|
+
let [v] = _.match(floatRegex) || [];
|
|
1746
|
+
if (!v) return e;
|
|
1747
|
+
let y = _.replace(v, ""), b = maxDefaults.has(g) ? 1 : 0;
|
|
1748
|
+
return v !== _ && (b *= 100), g + "(" + b + y + ")";
|
|
1749
|
+
}
|
|
1750
|
+
var functionRegex = /\b([a-z-]*)\(.*?\)/gu, filter = {
|
|
1751
|
+
...complex,
|
|
1752
|
+
getAnimatableNone: (e) => {
|
|
1753
|
+
let g = e.match(functionRegex);
|
|
1754
|
+
return g ? g.map(applyDefaultFilter).join(" ") : e;
|
|
1755
|
+
}
|
|
1756
|
+
}, int = {
|
|
1757
|
+
...number,
|
|
1758
|
+
transform: Math.round
|
|
1759
|
+
}, numberValueTypes = {
|
|
1760
|
+
borderWidth: px,
|
|
1761
|
+
borderTopWidth: px,
|
|
1762
|
+
borderRightWidth: px,
|
|
1763
|
+
borderBottomWidth: px,
|
|
1764
|
+
borderLeftWidth: px,
|
|
1765
|
+
borderRadius: px,
|
|
1766
|
+
borderTopLeftRadius: px,
|
|
1767
|
+
borderTopRightRadius: px,
|
|
1768
|
+
borderBottomRightRadius: px,
|
|
1769
|
+
borderBottomLeftRadius: px,
|
|
1770
|
+
width: px,
|
|
1771
|
+
maxWidth: px,
|
|
1772
|
+
height: px,
|
|
1773
|
+
maxHeight: px,
|
|
1774
|
+
top: px,
|
|
1775
|
+
right: px,
|
|
1776
|
+
bottom: px,
|
|
1777
|
+
left: px,
|
|
1778
|
+
inset: px,
|
|
1779
|
+
insetBlock: px,
|
|
1780
|
+
insetBlockStart: px,
|
|
1781
|
+
insetBlockEnd: px,
|
|
1782
|
+
insetInline: px,
|
|
1783
|
+
insetInlineStart: px,
|
|
1784
|
+
insetInlineEnd: px,
|
|
1785
|
+
padding: px,
|
|
1786
|
+
paddingTop: px,
|
|
1787
|
+
paddingRight: px,
|
|
1788
|
+
paddingBottom: px,
|
|
1789
|
+
paddingLeft: px,
|
|
1790
|
+
paddingBlock: px,
|
|
1791
|
+
paddingBlockStart: px,
|
|
1792
|
+
paddingBlockEnd: px,
|
|
1793
|
+
paddingInline: px,
|
|
1794
|
+
paddingInlineStart: px,
|
|
1795
|
+
paddingInlineEnd: px,
|
|
1796
|
+
margin: px,
|
|
1797
|
+
marginTop: px,
|
|
1798
|
+
marginRight: px,
|
|
1799
|
+
marginBottom: px,
|
|
1800
|
+
marginLeft: px,
|
|
1801
|
+
marginBlock: px,
|
|
1802
|
+
marginBlockStart: px,
|
|
1803
|
+
marginBlockEnd: px,
|
|
1804
|
+
marginInline: px,
|
|
1805
|
+
marginInlineStart: px,
|
|
1806
|
+
marginInlineEnd: px,
|
|
1807
|
+
fontSize: px,
|
|
1808
|
+
backgroundPositionX: px,
|
|
1809
|
+
backgroundPositionY: px,
|
|
1810
|
+
rotate: degrees,
|
|
1811
|
+
rotateX: degrees,
|
|
1812
|
+
rotateY: degrees,
|
|
1813
|
+
rotateZ: degrees,
|
|
1814
|
+
scale,
|
|
1815
|
+
scaleX: scale,
|
|
1816
|
+
scaleY: scale,
|
|
1817
|
+
scaleZ: scale,
|
|
1818
|
+
skew: degrees,
|
|
1819
|
+
skewX: degrees,
|
|
1820
|
+
skewY: degrees,
|
|
1821
|
+
distance: px,
|
|
1822
|
+
translateX: px,
|
|
1823
|
+
translateY: px,
|
|
1824
|
+
translateZ: px,
|
|
1825
|
+
x: px,
|
|
1826
|
+
y: px,
|
|
1827
|
+
z: px,
|
|
1828
|
+
perspective: px,
|
|
1829
|
+
transformPerspective: px,
|
|
1830
|
+
opacity: alpha,
|
|
1831
|
+
originX: progressPercentage,
|
|
1832
|
+
originY: progressPercentage,
|
|
1833
|
+
originZ: px,
|
|
1834
|
+
zIndex: int,
|
|
1835
|
+
fillOpacity: alpha,
|
|
1836
|
+
strokeOpacity: alpha,
|
|
1837
|
+
numOctaves: int
|
|
1838
|
+
}, defaultValueTypes = {
|
|
1839
|
+
...numberValueTypes,
|
|
1840
|
+
color,
|
|
1841
|
+
backgroundColor: color,
|
|
1842
|
+
outlineColor: color,
|
|
1843
|
+
fill: color,
|
|
1844
|
+
stroke: color,
|
|
1845
|
+
borderColor: color,
|
|
1846
|
+
borderTopColor: color,
|
|
1847
|
+
borderRightColor: color,
|
|
1848
|
+
borderBottomColor: color,
|
|
1849
|
+
borderLeftColor: color,
|
|
1850
|
+
filter,
|
|
1851
|
+
WebkitFilter: filter
|
|
1852
|
+
}, getDefaultValueType = (e) => defaultValueTypes[e];
|
|
1853
|
+
function getAnimatableNone(e, g) {
|
|
1854
|
+
let _ = getDefaultValueType(e);
|
|
1855
|
+
return _ !== filter && (_ = complex), _.getAnimatableNone ? _.getAnimatableNone(g) : void 0;
|
|
1856
|
+
}
|
|
1857
|
+
var invalidTemplates = new Set([
|
|
1858
|
+
"auto",
|
|
1859
|
+
"none",
|
|
1860
|
+
"0"
|
|
1861
|
+
]);
|
|
1862
|
+
function makeNoneKeyframesAnimatable(e, g, _) {
|
|
1863
|
+
let v = 0, y;
|
|
1864
|
+
for (; v < e.length && !y;) {
|
|
1865
|
+
let g = e[v];
|
|
1866
|
+
typeof g == "string" && !invalidTemplates.has(g) && analyseComplexValue(g).values.length && (y = e[v]), v++;
|
|
1867
|
+
}
|
|
1868
|
+
if (y && _) for (let v of g) e[v] = getAnimatableNone(_, y);
|
|
1869
|
+
}
|
|
1870
|
+
var DOMKeyframesResolver = class extends KeyframeResolver {
|
|
1871
|
+
constructor(e, g, _, v, y) {
|
|
1872
|
+
super(e, g, _, v, y, !0);
|
|
1873
|
+
}
|
|
1874
|
+
readKeyframes() {
|
|
1875
|
+
let { unresolvedKeyframes: e, element: g, name: _ } = this;
|
|
1876
|
+
if (!g || !g.current) return;
|
|
1877
|
+
super.readKeyframes();
|
|
1878
|
+
for (let _ = 0; _ < e.length; _++) {
|
|
1879
|
+
let v = e[_];
|
|
1880
|
+
if (typeof v == "string" && (v = v.trim(), isCSSVariableToken(v))) {
|
|
1881
|
+
let y = getVariableValue(v, g.current);
|
|
1882
|
+
y !== void 0 && (e[_] = y), _ === e.length - 1 && (this.finalKeyframe = v);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
if (this.resolveNoneKeyframes(), !positionalKeys.has(_) || e.length !== 2) return;
|
|
1886
|
+
let [v, y] = e, b = findDimensionValueType(v), x = findDimensionValueType(y);
|
|
1887
|
+
if (containsCSSVariable(v) !== containsCSSVariable(y) && positionalValues[_]) {
|
|
1888
|
+
this.needsMeasurement = !0;
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
if (b !== x) if (isNumOrPxType(b) && isNumOrPxType(x)) for (let g = 0; g < e.length; g++) {
|
|
1892
|
+
let _ = e[g];
|
|
1893
|
+
typeof _ == "string" && (e[g] = parseFloat(_));
|
|
1894
|
+
}
|
|
1895
|
+
else positionalValues[_] && (this.needsMeasurement = !0);
|
|
1896
|
+
}
|
|
1897
|
+
resolveNoneKeyframes() {
|
|
1898
|
+
let { unresolvedKeyframes: e, name: g } = this, _ = [];
|
|
1899
|
+
for (let g = 0; g < e.length; g++) (e[g] === null || isNone(e[g])) && _.push(g);
|
|
1900
|
+
_.length && makeNoneKeyframesAnimatable(e, _, g);
|
|
1901
|
+
}
|
|
1902
|
+
measureInitialState() {
|
|
1903
|
+
let { element: e, unresolvedKeyframes: g, name: _ } = this;
|
|
1904
|
+
if (!e || !e.current) return;
|
|
1905
|
+
_ === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = positionalValues[_](e.measureViewportBox(), window.getComputedStyle(e.current)), g[0] = this.measuredOrigin;
|
|
1906
|
+
let v = g[g.length - 1];
|
|
1907
|
+
v !== void 0 && e.getValue(_, v).jump(v, !1);
|
|
1908
|
+
}
|
|
1909
|
+
measureEndState() {
|
|
1910
|
+
let { element: e, name: g, unresolvedKeyframes: _ } = this;
|
|
1911
|
+
if (!e || !e.current) return;
|
|
1912
|
+
let v = e.getValue(g);
|
|
1913
|
+
v && v.jump(this.measuredOrigin, !1);
|
|
1914
|
+
let y = _.length - 1, b = _[y];
|
|
1915
|
+
_[y] = positionalValues[g](e.measureViewportBox(), window.getComputedStyle(e.current)), b !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = b), this.removedTransforms?.length && this.removedTransforms.forEach(([g, _]) => {
|
|
1916
|
+
e.getValue(g).set(_);
|
|
1917
|
+
}), this.resolveNoneKeyframes();
|
|
1918
|
+
}
|
|
1919
|
+
}, acceleratedValues = new Set([
|
|
1920
|
+
"opacity",
|
|
1921
|
+
"clipPath",
|
|
1922
|
+
"filter",
|
|
1923
|
+
"transform"
|
|
1924
|
+
]);
|
|
1925
|
+
function resolveElements(e, g, _) {
|
|
1926
|
+
if (e == null) return [];
|
|
1927
|
+
if (e instanceof EventTarget) return [e];
|
|
1928
|
+
if (typeof e == "string") {
|
|
1929
|
+
let v = document;
|
|
1930
|
+
g && (v = g.current);
|
|
1931
|
+
let y = _?.[e] ?? v.querySelectorAll(e);
|
|
1932
|
+
return y ? Array.from(y) : [];
|
|
1933
|
+
}
|
|
1934
|
+
return Array.from(e).filter((e) => e != null);
|
|
1935
|
+
}
|
|
1936
|
+
var getValueAsType = (e, g) => g && typeof e == "number" ? g.transform(e) : e;
|
|
1937
|
+
function isHTMLElement(e) {
|
|
1938
|
+
return isObject(e) && "offsetHeight" in e;
|
|
1939
|
+
}
|
|
1940
|
+
var { schedule: microtask, cancel: cancelMicrotask } = /* @__PURE__ */ createRenderBatcher(queueMicrotask, !1), isDragging = {
|
|
1941
|
+
x: !1,
|
|
1942
|
+
y: !1
|
|
1943
|
+
};
|
|
1944
|
+
function isDragActive() {
|
|
1945
|
+
return isDragging.x || isDragging.y;
|
|
1946
|
+
}
|
|
1947
|
+
function setDragLock(e) {
|
|
1948
|
+
return e === "x" || e === "y" ? isDragging[e] ? null : (isDragging[e] = !0, () => {
|
|
1949
|
+
isDragging[e] = !1;
|
|
1950
|
+
}) : isDragging.x || isDragging.y ? null : (isDragging.x = isDragging.y = !0, () => {
|
|
1951
|
+
isDragging.x = isDragging.y = !1;
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
function setupGesture(e, g) {
|
|
1955
|
+
let _ = resolveElements(e), v = new AbortController();
|
|
1956
|
+
return [
|
|
1957
|
+
_,
|
|
1958
|
+
{
|
|
1959
|
+
passive: !0,
|
|
1960
|
+
...g,
|
|
1961
|
+
signal: v.signal
|
|
1962
|
+
},
|
|
1963
|
+
() => v.abort()
|
|
1964
|
+
];
|
|
1965
|
+
}
|
|
1966
|
+
function isValidHover(e) {
|
|
1967
|
+
return !(e.pointerType === "touch" || isDragActive());
|
|
1968
|
+
}
|
|
1969
|
+
function hover(e, g, _ = {}) {
|
|
1970
|
+
let [v, y, b] = setupGesture(e, _);
|
|
1971
|
+
return v.forEach((e) => {
|
|
1972
|
+
let _ = !1, v = !1, b, x = () => {
|
|
1973
|
+
e.removeEventListener("pointerleave", T);
|
|
1974
|
+
}, S = (e) => {
|
|
1975
|
+
b &&= (b(e), void 0), x();
|
|
1976
|
+
}, C = (e) => {
|
|
1977
|
+
_ = !1, window.removeEventListener("pointerup", C), window.removeEventListener("pointercancel", C), v && (v = !1, S(e));
|
|
1978
|
+
}, w = () => {
|
|
1979
|
+
_ = !0, window.addEventListener("pointerup", C, y), window.addEventListener("pointercancel", C, y);
|
|
1980
|
+
}, T = (e) => {
|
|
1981
|
+
if (e.pointerType !== "touch") {
|
|
1982
|
+
if (_) {
|
|
1983
|
+
v = !0;
|
|
1984
|
+
return;
|
|
1985
|
+
}
|
|
1986
|
+
S(e);
|
|
1987
|
+
}
|
|
1988
|
+
};
|
|
1989
|
+
e.addEventListener("pointerenter", (_) => {
|
|
1990
|
+
if (!isValidHover(_)) return;
|
|
1991
|
+
v = !1;
|
|
1992
|
+
let x = g(e, _);
|
|
1993
|
+
typeof x == "function" && (b = x, e.addEventListener("pointerleave", T, y));
|
|
1994
|
+
}, y), e.addEventListener("pointerdown", w, y);
|
|
1995
|
+
}), b;
|
|
1996
|
+
}
|
|
1997
|
+
var isNodeOrChild = (e, g) => g ? e === g ? !0 : isNodeOrChild(e, g.parentElement) : !1, isPrimaryPointer = (e) => e.pointerType === "mouse" ? typeof e.button != "number" || e.button <= 0 : e.isPrimary !== !1, keyboardAccessibleElements = new Set([
|
|
1998
|
+
"BUTTON",
|
|
1999
|
+
"INPUT",
|
|
2000
|
+
"SELECT",
|
|
2001
|
+
"TEXTAREA",
|
|
2002
|
+
"A"
|
|
2003
|
+
]);
|
|
2004
|
+
function isElementKeyboardAccessible(e) {
|
|
2005
|
+
return keyboardAccessibleElements.has(e.tagName) || e.isContentEditable === !0;
|
|
2006
|
+
}
|
|
2007
|
+
var textInputElements = new Set([
|
|
2008
|
+
"INPUT",
|
|
2009
|
+
"SELECT",
|
|
2010
|
+
"TEXTAREA"
|
|
2011
|
+
]);
|
|
2012
|
+
function isElementTextInput(e) {
|
|
2013
|
+
return textInputElements.has(e.tagName) || e.isContentEditable === !0;
|
|
2014
|
+
}
|
|
2015
|
+
var isPressing = /* @__PURE__ */ new WeakSet();
|
|
2016
|
+
function filterEvents(e) {
|
|
2017
|
+
return (g) => {
|
|
2018
|
+
g.key === "Enter" && e(g);
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
function firePointerEvent(e, g) {
|
|
2022
|
+
e.dispatchEvent(new PointerEvent("pointer" + g, {
|
|
2023
|
+
isPrimary: !0,
|
|
2024
|
+
bubbles: !0
|
|
2025
|
+
}));
|
|
2026
|
+
}
|
|
2027
|
+
var enableKeyboardPress = (e, g) => {
|
|
2028
|
+
let _ = e.currentTarget;
|
|
2029
|
+
if (!_) return;
|
|
2030
|
+
let v = filterEvents(() => {
|
|
2031
|
+
if (isPressing.has(_)) return;
|
|
2032
|
+
firePointerEvent(_, "down");
|
|
2033
|
+
let e = filterEvents(() => {
|
|
2034
|
+
firePointerEvent(_, "up");
|
|
2035
|
+
});
|
|
2036
|
+
_.addEventListener("keyup", e, g), _.addEventListener("blur", () => firePointerEvent(_, "cancel"), g);
|
|
2037
|
+
});
|
|
2038
|
+
_.addEventListener("keydown", v, g), _.addEventListener("blur", () => _.removeEventListener("keydown", v), g);
|
|
2039
|
+
};
|
|
2040
|
+
function isValidPressEvent(e) {
|
|
2041
|
+
return isPrimaryPointer(e) && !isDragActive();
|
|
2042
|
+
}
|
|
2043
|
+
var claimedPointerDownEvents = /* @__PURE__ */ new WeakSet();
|
|
2044
|
+
function press(e, g, _ = {}) {
|
|
2045
|
+
let [v, y, b] = setupGesture(e, _), x = (e) => {
|
|
2046
|
+
let v = e.currentTarget;
|
|
2047
|
+
if (!isValidPressEvent(e) || claimedPointerDownEvents.has(e)) return;
|
|
2048
|
+
isPressing.add(v), _.stopPropagation && claimedPointerDownEvents.add(e);
|
|
2049
|
+
let b = g(v, e), x = (e, g) => {
|
|
2050
|
+
window.removeEventListener("pointerup", S), window.removeEventListener("pointercancel", C), isPressing.has(v) && isPressing.delete(v), isValidPressEvent(e) && typeof b == "function" && b(e, { success: g });
|
|
2051
|
+
}, S = (e) => {
|
|
2052
|
+
x(e, v === window || v === document || _.useGlobalTarget || isNodeOrChild(v, e.target));
|
|
2053
|
+
}, C = (e) => {
|
|
2054
|
+
x(e, !1);
|
|
2055
|
+
};
|
|
2056
|
+
window.addEventListener("pointerup", S, y), window.addEventListener("pointercancel", C, y);
|
|
2057
|
+
};
|
|
2058
|
+
return v.forEach((e) => {
|
|
2059
|
+
(_.useGlobalTarget ? window : e).addEventListener("pointerdown", x, y), isHTMLElement(e) && (e.addEventListener("focus", (e) => enableKeyboardPress(e, y)), !isElementKeyboardAccessible(e) && !e.hasAttribute("tabindex") && (e.tabIndex = 0));
|
|
2060
|
+
}), b;
|
|
2061
|
+
}
|
|
2062
|
+
function isSVGElement(e) {
|
|
2063
|
+
return isObject(e) && "ownerSVGElement" in e;
|
|
2064
|
+
}
|
|
2065
|
+
var resizeHandlers = /* @__PURE__ */ new WeakMap(), observer, getSize = (e, g, _) => (v, y) => y && y[0] ? y[0][e + "Size"] : isSVGElement(v) && "getBBox" in v ? v.getBBox()[g] : v[_], getWidth = /* @__PURE__ */ getSize("inline", "width", "offsetWidth"), getHeight = /* @__PURE__ */ getSize("block", "height", "offsetHeight");
|
|
2066
|
+
function notifyTarget({ target: e, borderBoxSize: g }) {
|
|
2067
|
+
resizeHandlers.get(e)?.forEach((_) => {
|
|
2068
|
+
_(e, {
|
|
2069
|
+
get width() {
|
|
2070
|
+
return getWidth(e, g);
|
|
2071
|
+
},
|
|
2072
|
+
get height() {
|
|
2073
|
+
return getHeight(e, g);
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
function notifyAll(e) {
|
|
2079
|
+
e.forEach(notifyTarget);
|
|
2080
|
+
}
|
|
2081
|
+
function createResizeObserver() {
|
|
2082
|
+
typeof ResizeObserver > "u" || (observer = new ResizeObserver(notifyAll));
|
|
2083
|
+
}
|
|
2084
|
+
function resizeElement(e, g) {
|
|
2085
|
+
observer || createResizeObserver();
|
|
2086
|
+
let _ = resolveElements(e);
|
|
2087
|
+
return _.forEach((e) => {
|
|
2088
|
+
let _ = resizeHandlers.get(e);
|
|
2089
|
+
_ || (_ = /* @__PURE__ */ new Set(), resizeHandlers.set(e, _)), _.add(g), observer?.observe(e);
|
|
2090
|
+
}), () => {
|
|
2091
|
+
_.forEach((e) => {
|
|
2092
|
+
let _ = resizeHandlers.get(e);
|
|
2093
|
+
_?.delete(g), _?.size || observer?.unobserve(e);
|
|
2094
|
+
});
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
var windowCallbacks = /* @__PURE__ */ new Set(), windowResizeHandler;
|
|
2098
|
+
function createWindowResizeHandler() {
|
|
2099
|
+
windowResizeHandler = () => {
|
|
2100
|
+
let e = {
|
|
2101
|
+
get width() {
|
|
2102
|
+
return window.innerWidth;
|
|
2103
|
+
},
|
|
2104
|
+
get height() {
|
|
2105
|
+
return window.innerHeight;
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
windowCallbacks.forEach((g) => g(e));
|
|
2109
|
+
}, window.addEventListener("resize", windowResizeHandler);
|
|
2110
|
+
}
|
|
2111
|
+
function resizeWindow(e) {
|
|
2112
|
+
return windowCallbacks.add(e), windowResizeHandler || createWindowResizeHandler(), () => {
|
|
2113
|
+
windowCallbacks.delete(e), !windowCallbacks.size && typeof windowResizeHandler == "function" && (window.removeEventListener("resize", windowResizeHandler), windowResizeHandler = void 0);
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
function resize(e, g) {
|
|
2117
|
+
return typeof e == "function" ? resizeWindow(e) : resizeElement(e, g);
|
|
2118
|
+
}
|
|
2119
|
+
function isSVGSVGElement(e) {
|
|
2120
|
+
return isSVGElement(e) && e.tagName === "svg";
|
|
2121
|
+
}
|
|
2122
|
+
var valueTypes = [
|
|
2123
|
+
...dimensionValueTypes,
|
|
2124
|
+
color,
|
|
2125
|
+
complex
|
|
2126
|
+
], findValueType = (e) => valueTypes.find(testValueType(e)), createAxisDelta = () => ({
|
|
2127
|
+
translate: 0,
|
|
2128
|
+
scale: 1,
|
|
2129
|
+
origin: 0,
|
|
2130
|
+
originPoint: 0
|
|
2131
|
+
}), createDelta = () => ({
|
|
2132
|
+
x: createAxisDelta(),
|
|
2133
|
+
y: createAxisDelta()
|
|
2134
|
+
}), createAxis = () => ({
|
|
2135
|
+
min: 0,
|
|
2136
|
+
max: 0
|
|
2137
|
+
}), createBox = () => ({
|
|
2138
|
+
x: createAxis(),
|
|
2139
|
+
y: createAxis()
|
|
2140
|
+
}), visualElementStore = /* @__PURE__ */ new WeakMap();
|
|
2141
|
+
function isAnimationControls(e) {
|
|
2142
|
+
return typeof e == "object" && !!e && typeof e.start == "function";
|
|
2143
|
+
}
|
|
2144
|
+
function isVariantLabel(e) {
|
|
2145
|
+
return typeof e == "string" || Array.isArray(e);
|
|
2146
|
+
}
|
|
2147
|
+
var variantPriorityOrder = [
|
|
2148
|
+
"animate",
|
|
2149
|
+
"whileInView",
|
|
2150
|
+
"whileFocus",
|
|
2151
|
+
"whileHover",
|
|
2152
|
+
"whileTap",
|
|
2153
|
+
"whileDrag",
|
|
2154
|
+
"exit"
|
|
2155
|
+
], variantProps = ["initial", ...variantPriorityOrder];
|
|
2156
|
+
function isControllingVariants(e) {
|
|
2157
|
+
return isAnimationControls(e.animate) || variantProps.some((g) => isVariantLabel(e[g]));
|
|
2158
|
+
}
|
|
2159
|
+
function isVariantNode(e) {
|
|
2160
|
+
return !!(isControllingVariants(e) || e.variants);
|
|
2161
|
+
}
|
|
2162
|
+
function updateMotionValuesFromProps(e, g, _) {
|
|
2163
|
+
for (let v in g) {
|
|
2164
|
+
let y = g[v], b = _[v];
|
|
2165
|
+
if (isMotionValue(y)) e.addValue(v, y);
|
|
2166
|
+
else if (isMotionValue(b)) e.addValue(v, motionValue(y, { owner: e }));
|
|
2167
|
+
else if (b !== y) if (e.hasValue(v)) {
|
|
2168
|
+
let g = e.getValue(v);
|
|
2169
|
+
g.liveStyle === !0 ? g.jump(y) : g.hasAnimated || g.set(y);
|
|
2170
|
+
} else {
|
|
2171
|
+
let g = e.getStaticValue(v);
|
|
2172
|
+
e.addValue(v, motionValue(g === void 0 ? y : g, { owner: e }));
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
for (let v in _) g[v] === void 0 && e.removeValue(v);
|
|
2176
|
+
return g;
|
|
2177
|
+
}
|
|
2178
|
+
var prefersReducedMotion = { current: null }, hasReducedMotionListener = { current: !1 }, isBrowser$1 = typeof window < "u";
|
|
2179
|
+
function initPrefersReducedMotion() {
|
|
2180
|
+
if (hasReducedMotionListener.current = !0, isBrowser$1) if (window.matchMedia) {
|
|
2181
|
+
let e = window.matchMedia("(prefers-reduced-motion)"), g = () => prefersReducedMotion.current = e.matches;
|
|
2182
|
+
e.addEventListener("change", g), g();
|
|
2183
|
+
} else prefersReducedMotion.current = !1;
|
|
2184
|
+
}
|
|
2185
|
+
var propEventHandlers = [
|
|
2186
|
+
"AnimationStart",
|
|
2187
|
+
"AnimationComplete",
|
|
2188
|
+
"Update",
|
|
2189
|
+
"BeforeLayoutMeasure",
|
|
2190
|
+
"LayoutMeasure",
|
|
2191
|
+
"LayoutAnimationStart",
|
|
2192
|
+
"LayoutAnimationComplete"
|
|
2193
|
+
], featureDefinitions = {};
|
|
2194
|
+
function setFeatureDefinitions(e) {
|
|
2195
|
+
featureDefinitions = e;
|
|
2196
|
+
}
|
|
2197
|
+
function getFeatureDefinitions() {
|
|
2198
|
+
return featureDefinitions;
|
|
2199
|
+
}
|
|
2200
|
+
var VisualElement = class {
|
|
2201
|
+
scrapeMotionValuesFromProps(e, g, _) {
|
|
2202
|
+
return {};
|
|
2203
|
+
}
|
|
2204
|
+
constructor({ parent: e, props: g, presenceContext: _, reducedMotionConfig: v, skipAnimations: y, blockInitialAnimation: b, visualState: x }, S = {}) {
|
|
2205
|
+
this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.shouldSkipAnimations = !1, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = KeyframeResolver, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.hasBeenMounted = !1, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
|
|
2206
|
+
this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
|
|
2207
|
+
}, this.renderScheduledAt = 0, this.scheduleRender = () => {
|
|
2208
|
+
let e = time.now();
|
|
2209
|
+
this.renderScheduledAt < e && (this.renderScheduledAt = e, frame.render(this.render, !1, !0));
|
|
2210
|
+
};
|
|
2211
|
+
let { latestValues: C, renderState: w } = x;
|
|
2212
|
+
this.latestValues = C, this.baseTarget = { ...C }, this.initialValues = g.initial ? { ...C } : {}, this.renderState = w, this.parent = e, this.props = g, this.presenceContext = _, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = v, this.skipAnimationsConfig = y, this.options = S, this.blockInitialAnimation = !!b, this.isControllingVariants = isControllingVariants(g), this.isVariantNode = isVariantNode(g), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
|
|
2213
|
+
let { willChange: T, ...E } = this.scrapeMotionValuesFromProps(g, {}, this);
|
|
2214
|
+
for (let e in E) {
|
|
2215
|
+
let g = E[e];
|
|
2216
|
+
C[e] !== void 0 && isMotionValue(g) && g.set(C[e]);
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
mount(e) {
|
|
2220
|
+
if (this.hasBeenMounted) for (let e in this.initialValues) this.values.get(e)?.jump(this.initialValues[e]), this.latestValues[e] = this.initialValues[e];
|
|
2221
|
+
this.current = e, visualElementStore.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((e, g) => this.bindToMotionValue(g, e)), this.reducedMotionConfig === "never" ? this.shouldReduceMotion = !1 : this.reducedMotionConfig === "always" ? this.shouldReduceMotion = !0 : (hasReducedMotionListener.current || initPrefersReducedMotion(), this.shouldReduceMotion = prefersReducedMotion.current), process.env.NODE_ENV !== "production" && warnOnce(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), this.shouldSkipAnimations = this.skipAnimationsConfig ?? !1, this.parent?.addChild(this), this.update(this.props, this.presenceContext), this.hasBeenMounted = !0;
|
|
2222
|
+
}
|
|
2223
|
+
unmount() {
|
|
2224
|
+
for (let e in this.projection && this.projection.unmount(), cancelFrame(this.notifyUpdate), cancelFrame(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent?.removeChild(this), this.events) this.events[e].clear();
|
|
2225
|
+
for (let e in this.features) {
|
|
2226
|
+
let g = this.features[e];
|
|
2227
|
+
g && (g.unmount(), g.isMounted = !1);
|
|
2228
|
+
}
|
|
2229
|
+
this.current = null;
|
|
2230
|
+
}
|
|
2231
|
+
addChild(e) {
|
|
2232
|
+
this.children.add(e), this.enteringChildren ??= /* @__PURE__ */ new Set(), this.enteringChildren.add(e);
|
|
2233
|
+
}
|
|
2234
|
+
removeChild(e) {
|
|
2235
|
+
this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
|
|
2236
|
+
}
|
|
2237
|
+
bindToMotionValue(e, g) {
|
|
2238
|
+
if (this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)(), g.accelerate && acceleratedValues.has(e) && this.current instanceof HTMLElement) {
|
|
2239
|
+
let { factory: _, keyframes: v, times: y, ease: b, duration: x } = g.accelerate, S = new NativeAnimation({
|
|
2240
|
+
element: this.current,
|
|
2241
|
+
name: e,
|
|
2242
|
+
keyframes: v,
|
|
2243
|
+
times: y,
|
|
2244
|
+
ease: b,
|
|
2245
|
+
duration: /* @__PURE__ */ secondsToMilliseconds(x)
|
|
2246
|
+
}), C = _(S);
|
|
2247
|
+
this.valueSubscriptions.set(e, () => {
|
|
2248
|
+
C(), S.cancel();
|
|
2249
|
+
});
|
|
2250
|
+
return;
|
|
2251
|
+
}
|
|
2252
|
+
let _ = transformProps.has(e);
|
|
2253
|
+
_ && this.onBindTransform && this.onBindTransform();
|
|
2254
|
+
let v = g.on("change", (g) => {
|
|
2255
|
+
this.latestValues[e] = g, this.props.onUpdate && frame.preRender(this.notifyUpdate), _ && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
|
|
2256
|
+
}), y;
|
|
2257
|
+
typeof window < "u" && window.MotionCheckAppearSync && (y = window.MotionCheckAppearSync(this, e, g)), this.valueSubscriptions.set(e, () => {
|
|
2258
|
+
v(), y && y(), g.owner && g.stop();
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
sortNodePosition(e) {
|
|
2262
|
+
return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
|
|
2263
|
+
}
|
|
2264
|
+
updateFeatures() {
|
|
2265
|
+
let e = "animation";
|
|
2266
|
+
for (e in featureDefinitions) {
|
|
2267
|
+
let g = featureDefinitions[e];
|
|
2268
|
+
if (!g) continue;
|
|
2269
|
+
let { isEnabled: _, Feature: v } = g;
|
|
2270
|
+
if (!this.features[e] && v && _(this.props) && (this.features[e] = new v(this)), this.features[e]) {
|
|
2271
|
+
let g = this.features[e];
|
|
2272
|
+
g.isMounted ? g.update() : (g.mount(), g.isMounted = !0);
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
triggerBuild() {
|
|
2277
|
+
this.build(this.renderState, this.latestValues, this.props);
|
|
2278
|
+
}
|
|
2279
|
+
measureViewportBox() {
|
|
2280
|
+
return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox();
|
|
2281
|
+
}
|
|
2282
|
+
getStaticValue(e) {
|
|
2283
|
+
return this.latestValues[e];
|
|
2284
|
+
}
|
|
2285
|
+
setStaticValue(e, g) {
|
|
2286
|
+
this.latestValues[e] = g;
|
|
2287
|
+
}
|
|
2288
|
+
update(e, g) {
|
|
2289
|
+
(e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = g;
|
|
2290
|
+
for (let g = 0; g < propEventHandlers.length; g++) {
|
|
2291
|
+
let _ = propEventHandlers[g];
|
|
2292
|
+
this.propEventSubscriptions[_] && (this.propEventSubscriptions[_](), delete this.propEventSubscriptions[_]);
|
|
2293
|
+
let v = e["on" + _];
|
|
2294
|
+
v && (this.propEventSubscriptions[_] = this.on(_, v));
|
|
2295
|
+
}
|
|
2296
|
+
this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(e, this.prevProps || {}, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
|
|
2297
|
+
}
|
|
2298
|
+
getProps() {
|
|
2299
|
+
return this.props;
|
|
2300
|
+
}
|
|
2301
|
+
getVariant(e) {
|
|
2302
|
+
return this.props.variants ? this.props.variants[e] : void 0;
|
|
2303
|
+
}
|
|
2304
|
+
getDefaultTransition() {
|
|
2305
|
+
return this.props.transition;
|
|
2306
|
+
}
|
|
2307
|
+
getTransformPagePoint() {
|
|
2308
|
+
return this.props.transformPagePoint;
|
|
2309
|
+
}
|
|
2310
|
+
getClosestVariantNode() {
|
|
2311
|
+
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
2312
|
+
}
|
|
2313
|
+
addVariantChild(e) {
|
|
2314
|
+
let g = this.getClosestVariantNode();
|
|
2315
|
+
if (g) return g.variantChildren && g.variantChildren.add(e), () => g.variantChildren.delete(e);
|
|
2316
|
+
}
|
|
2317
|
+
addValue(e, g) {
|
|
2318
|
+
let _ = this.values.get(e);
|
|
2319
|
+
g !== _ && (_ && this.removeValue(e), this.bindToMotionValue(e, g), this.values.set(e, g), this.latestValues[e] = g.get());
|
|
2320
|
+
}
|
|
2321
|
+
removeValue(e) {
|
|
2322
|
+
this.values.delete(e);
|
|
2323
|
+
let g = this.valueSubscriptions.get(e);
|
|
2324
|
+
g && (g(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
|
|
2325
|
+
}
|
|
2326
|
+
hasValue(e) {
|
|
2327
|
+
return this.values.has(e);
|
|
2328
|
+
}
|
|
2329
|
+
getValue(e, g) {
|
|
2330
|
+
if (this.props.values && this.props.values[e]) return this.props.values[e];
|
|
2331
|
+
let _ = this.values.get(e);
|
|
2332
|
+
return _ === void 0 && g !== void 0 && (_ = motionValue(g === null ? void 0 : g, { owner: this }), this.addValue(e, _)), _;
|
|
2333
|
+
}
|
|
2334
|
+
readValue(e, g) {
|
|
2335
|
+
let _ = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
|
|
2336
|
+
return _ != null && (typeof _ == "string" && (isNumericalString(_) || isZeroValueString(_)) ? _ = parseFloat(_) : !findValueType(_) && complex.test(g) && (_ = getAnimatableNone(e, g)), this.setBaseTarget(e, isMotionValue(_) ? _.get() : _)), isMotionValue(_) ? _.get() : _;
|
|
2337
|
+
}
|
|
2338
|
+
setBaseTarget(e, g) {
|
|
2339
|
+
this.baseTarget[e] = g;
|
|
2340
|
+
}
|
|
2341
|
+
getBaseTarget(e) {
|
|
2342
|
+
let { initial: g } = this.props, _;
|
|
2343
|
+
if (typeof g == "string" || typeof g == "object") {
|
|
2344
|
+
let v = resolveVariantFromProps(this.props, g, this.presenceContext?.custom);
|
|
2345
|
+
v && (_ = v[e]);
|
|
2346
|
+
}
|
|
2347
|
+
if (g && _ !== void 0) return _;
|
|
2348
|
+
let v = this.getBaseTargetFromProps(this.props, e);
|
|
2349
|
+
return v !== void 0 && !isMotionValue(v) ? v : this.initialValues[e] !== void 0 && _ === void 0 ? void 0 : this.baseTarget[e];
|
|
2350
|
+
}
|
|
2351
|
+
on(e, g) {
|
|
2352
|
+
return this.events[e] || (this.events[e] = new SubscriptionManager()), this.events[e].add(g);
|
|
2353
|
+
}
|
|
2354
|
+
notify(e, ...g) {
|
|
2355
|
+
this.events[e] && this.events[e].notify(...g);
|
|
2356
|
+
}
|
|
2357
|
+
scheduleRenderMicrotask() {
|
|
2358
|
+
microtask.render(this.render);
|
|
2359
|
+
}
|
|
2360
|
+
}, DOMVisualElement = class extends VisualElement {
|
|
2361
|
+
constructor() {
|
|
2362
|
+
super(...arguments), this.KeyframeResolver = DOMKeyframesResolver;
|
|
2363
|
+
}
|
|
2364
|
+
sortInstanceNodePosition(e, g) {
|
|
2365
|
+
return e.compareDocumentPosition(g) & 2 ? 1 : -1;
|
|
2366
|
+
}
|
|
2367
|
+
getBaseTargetFromProps(e, g) {
|
|
2368
|
+
let _ = e.style;
|
|
2369
|
+
return _ ? _[g] : void 0;
|
|
2370
|
+
}
|
|
2371
|
+
removeValueFromRenderState(e, { vars: g, style: _ }) {
|
|
2372
|
+
delete g[e], delete _[e];
|
|
2373
|
+
}
|
|
2374
|
+
handleChildMotionValue() {
|
|
2375
|
+
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
|
2376
|
+
let { children: e } = this.props;
|
|
2377
|
+
isMotionValue(e) && (this.childSubscription = e.on("change", (e) => {
|
|
2378
|
+
this.current && (this.current.textContent = `${e}`);
|
|
2379
|
+
}));
|
|
2380
|
+
}
|
|
2381
|
+
}, Feature = class {
|
|
2382
|
+
constructor(e) {
|
|
2383
|
+
this.isMounted = !1, this.node = e;
|
|
2384
|
+
}
|
|
2385
|
+
update() {}
|
|
2386
|
+
};
|
|
2387
|
+
function convertBoundingBoxToBox({ top: e, left: g, right: _, bottom: v }) {
|
|
2388
|
+
return {
|
|
2389
|
+
x: {
|
|
2390
|
+
min: g,
|
|
2391
|
+
max: _
|
|
2392
|
+
},
|
|
2393
|
+
y: {
|
|
2394
|
+
min: e,
|
|
2395
|
+
max: v
|
|
2396
|
+
}
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
function convertBoxToBoundingBox({ x: e, y: g }) {
|
|
2400
|
+
return {
|
|
2401
|
+
top: g.min,
|
|
2402
|
+
right: e.max,
|
|
2403
|
+
bottom: g.max,
|
|
2404
|
+
left: e.min
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
function transformBoxPoints(e, g) {
|
|
2408
|
+
if (!g) return e;
|
|
2409
|
+
let _ = g({
|
|
2410
|
+
x: e.left,
|
|
2411
|
+
y: e.top
|
|
2412
|
+
}), v = g({
|
|
2413
|
+
x: e.right,
|
|
2414
|
+
y: e.bottom
|
|
2415
|
+
});
|
|
2416
|
+
return {
|
|
2417
|
+
top: _.y,
|
|
2418
|
+
left: _.x,
|
|
2419
|
+
bottom: v.y,
|
|
2420
|
+
right: v.x
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
function isIdentityScale(e) {
|
|
2424
|
+
return e === void 0 || e === 1;
|
|
2425
|
+
}
|
|
2426
|
+
function hasScale({ scale: e, scaleX: g, scaleY: _ }) {
|
|
2427
|
+
return !isIdentityScale(e) || !isIdentityScale(g) || !isIdentityScale(_);
|
|
2428
|
+
}
|
|
2429
|
+
function hasTransform(e) {
|
|
2430
|
+
return hasScale(e) || has2DTranslate(e) || e.z || e.rotate || e.rotateX || e.rotateY || e.skewX || e.skewY;
|
|
2431
|
+
}
|
|
2432
|
+
function has2DTranslate(e) {
|
|
2433
|
+
return is2DTranslate(e.x) || is2DTranslate(e.y);
|
|
2434
|
+
}
|
|
2435
|
+
function is2DTranslate(e) {
|
|
2436
|
+
return e && e !== "0%";
|
|
2437
|
+
}
|
|
2438
|
+
function scalePoint(e, g, _) {
|
|
2439
|
+
return _ + g * (e - _);
|
|
2440
|
+
}
|
|
2441
|
+
function applyPointDelta(e, g, _, v, y) {
|
|
2442
|
+
return y !== void 0 && (e = scalePoint(e, y, v)), scalePoint(e, _, v) + g;
|
|
2443
|
+
}
|
|
2444
|
+
function applyAxisDelta(e, g = 0, _ = 1, v, y) {
|
|
2445
|
+
e.min = applyPointDelta(e.min, g, _, v, y), e.max = applyPointDelta(e.max, g, _, v, y);
|
|
2446
|
+
}
|
|
2447
|
+
function applyBoxDelta(e, { x: g, y: _ }) {
|
|
2448
|
+
applyAxisDelta(e.x, g.translate, g.scale, g.originPoint), applyAxisDelta(e.y, _.translate, _.scale, _.originPoint);
|
|
2449
|
+
}
|
|
2450
|
+
var TREE_SCALE_SNAP_MIN = .999999999999, TREE_SCALE_SNAP_MAX = 1.0000000000001;
|
|
2451
|
+
function applyTreeDeltas(e, g, _, v = !1) {
|
|
2452
|
+
let y = _.length;
|
|
2453
|
+
if (!y) return;
|
|
2454
|
+
g.x = g.y = 1;
|
|
2455
|
+
let b, x;
|
|
2456
|
+
for (let S = 0; S < y; S++) {
|
|
2457
|
+
b = _[S], x = b.projectionDelta;
|
|
2458
|
+
let { visualElement: y } = b.options;
|
|
2459
|
+
y && y.props.style && y.props.style.display === "contents" || (v && b.options.layoutScroll && b.scroll && b !== b.root && transformBox(e, {
|
|
2460
|
+
x: -b.scroll.offset.x,
|
|
2461
|
+
y: -b.scroll.offset.y
|
|
2462
|
+
}), x && (g.x *= x.x.scale, g.y *= x.y.scale, applyBoxDelta(e, x)), v && hasTransform(b.latestValues) && transformBox(e, b.latestValues));
|
|
2463
|
+
}
|
|
2464
|
+
g.x < TREE_SCALE_SNAP_MAX && g.x > TREE_SCALE_SNAP_MIN && (g.x = 1), g.y < TREE_SCALE_SNAP_MAX && g.y > TREE_SCALE_SNAP_MIN && (g.y = 1);
|
|
2465
|
+
}
|
|
2466
|
+
function translateAxis(e, g) {
|
|
2467
|
+
e.min += g, e.max += g;
|
|
2468
|
+
}
|
|
2469
|
+
function transformAxis(e, g, _, v, y = .5) {
|
|
2470
|
+
applyAxisDelta(e, g, _, mixNumber(e.min, e.max, y), v);
|
|
2471
|
+
}
|
|
2472
|
+
function transformBox(e, g) {
|
|
2473
|
+
transformAxis(e.x, g.x, g.scaleX, g.scale, g.originX), transformAxis(e.y, g.y, g.scaleY, g.scale, g.originY);
|
|
2474
|
+
}
|
|
2475
|
+
function measureViewportBox(e, g) {
|
|
2476
|
+
return convertBoundingBoxToBox(transformBoxPoints(e.getBoundingClientRect(), g));
|
|
2477
|
+
}
|
|
2478
|
+
function measurePageBox(e, g, _) {
|
|
2479
|
+
let v = measureViewportBox(e, _), { scroll: y } = g;
|
|
2480
|
+
return y && (translateAxis(v.x, y.offset.x), translateAxis(v.y, y.offset.y)), v;
|
|
2481
|
+
}
|
|
2482
|
+
var translateAlias = {
|
|
2483
|
+
x: "translateX",
|
|
2484
|
+
y: "translateY",
|
|
2485
|
+
z: "translateZ",
|
|
2486
|
+
transformPerspective: "perspective"
|
|
2487
|
+
}, numTransforms = transformPropOrder.length;
|
|
2488
|
+
function buildTransform(e, g, _) {
|
|
2489
|
+
let v = "", y = !0;
|
|
2490
|
+
for (let b = 0; b < numTransforms; b++) {
|
|
2491
|
+
let x = transformPropOrder[b], S = e[x];
|
|
2492
|
+
if (S === void 0) continue;
|
|
2493
|
+
let C = !0;
|
|
2494
|
+
if (typeof S == "number") C = S === (x.startsWith("scale") ? 1 : 0);
|
|
2495
|
+
else {
|
|
2496
|
+
let e = parseFloat(S);
|
|
2497
|
+
C = x.startsWith("scale") ? e === 1 : e === 0;
|
|
2498
|
+
}
|
|
2499
|
+
if (!C || _) {
|
|
2500
|
+
let e = getValueAsType(S, numberValueTypes[x]);
|
|
2501
|
+
if (!C) {
|
|
2502
|
+
y = !1;
|
|
2503
|
+
let g = translateAlias[x] || x;
|
|
2504
|
+
v += `${g}(${e}) `;
|
|
2505
|
+
}
|
|
2506
|
+
_ && (g[x] = e);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
return v = v.trim(), _ ? v = _(g, y ? "" : v) : y && (v = "none"), v;
|
|
2510
|
+
}
|
|
2511
|
+
function buildHTMLStyles(e, g, _) {
|
|
2512
|
+
let { style: v, vars: y, transformOrigin: b } = e, x = !1, S = !1;
|
|
2513
|
+
for (let e in g) {
|
|
2514
|
+
let _ = g[e];
|
|
2515
|
+
if (transformProps.has(e)) {
|
|
2516
|
+
x = !0;
|
|
2517
|
+
continue;
|
|
2518
|
+
} else if (isCSSVariableName(e)) {
|
|
2519
|
+
y[e] = _;
|
|
2520
|
+
continue;
|
|
2521
|
+
} else {
|
|
2522
|
+
let g = getValueAsType(_, numberValueTypes[e]);
|
|
2523
|
+
e.startsWith("origin") ? (S = !0, b[e] = g) : v[e] = g;
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
if (g.transform || (x || _ ? v.transform = buildTransform(g, e.transform, _) : v.transform &&= "none"), S) {
|
|
2527
|
+
let { originX: e = "50%", originY: g = "50%", originZ: _ = 0 } = b;
|
|
2528
|
+
v.transformOrigin = `${e} ${g} ${_}`;
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
function renderHTML(e, { style: g, vars: _ }, v, y) {
|
|
2532
|
+
let b = e.style, x;
|
|
2533
|
+
for (x in g) b[x] = g[x];
|
|
2534
|
+
for (x in y?.applyProjectionStyles(b, v), _) b.setProperty(x, _[x]);
|
|
2535
|
+
}
|
|
2536
|
+
function pixelsToPercent(e, g) {
|
|
2537
|
+
return g.max === g.min ? 0 : e / (g.max - g.min) * 100;
|
|
2538
|
+
}
|
|
2539
|
+
var correctBorderRadius = { correct: (e, g) => {
|
|
2540
|
+
if (!g.target) return e;
|
|
2541
|
+
if (typeof e == "string") if (px.test(e)) e = parseFloat(e);
|
|
2542
|
+
else return e;
|
|
2543
|
+
return `${pixelsToPercent(e, g.target.x)}% ${pixelsToPercent(e, g.target.y)}%`;
|
|
2544
|
+
} }, correctBoxShadow = { correct: (e, { treeScale: g, projectionDelta: _ }) => {
|
|
2545
|
+
let v = e, y = complex.parse(e);
|
|
2546
|
+
if (y.length > 5) return v;
|
|
2547
|
+
let b = complex.createTransformer(e), x = typeof y[0] == "number" ? 0 : 1, S = _.x.scale * g.x, C = _.y.scale * g.y;
|
|
2548
|
+
y[0 + x] /= S, y[1 + x] /= C;
|
|
2549
|
+
let w = mixNumber(S, C, .5);
|
|
2550
|
+
return typeof y[2 + x] == "number" && (y[2 + x] /= w), typeof y[3 + x] == "number" && (y[3 + x] /= w), b(y);
|
|
2551
|
+
} }, scaleCorrectors = {
|
|
2552
|
+
borderRadius: {
|
|
2553
|
+
...correctBorderRadius,
|
|
2554
|
+
applyTo: [
|
|
2555
|
+
"borderTopLeftRadius",
|
|
2556
|
+
"borderTopRightRadius",
|
|
2557
|
+
"borderBottomLeftRadius",
|
|
2558
|
+
"borderBottomRightRadius"
|
|
2559
|
+
]
|
|
2560
|
+
},
|
|
2561
|
+
borderTopLeftRadius: correctBorderRadius,
|
|
2562
|
+
borderTopRightRadius: correctBorderRadius,
|
|
2563
|
+
borderBottomLeftRadius: correctBorderRadius,
|
|
2564
|
+
borderBottomRightRadius: correctBorderRadius,
|
|
2565
|
+
boxShadow: correctBoxShadow
|
|
2566
|
+
};
|
|
2567
|
+
function isForcedMotionValue(e, { layout: g, layoutId: _ }) {
|
|
2568
|
+
return transformProps.has(e) || e.startsWith("origin") || (g || _ !== void 0) && (!!scaleCorrectors[e] || e === "opacity");
|
|
2569
|
+
}
|
|
2570
|
+
function scrapeMotionValuesFromProps$1(e, g, _) {
|
|
2571
|
+
let v = e.style, y = g?.style, b = {};
|
|
2572
|
+
if (!v) return b;
|
|
2573
|
+
for (let g in v) (isMotionValue(v[g]) || y && isMotionValue(y[g]) || isForcedMotionValue(g, e) || _?.getValue(g)?.liveStyle !== void 0) && (b[g] = v[g]);
|
|
2574
|
+
return b;
|
|
2575
|
+
}
|
|
2576
|
+
function getComputedStyle$1(e) {
|
|
2577
|
+
return window.getComputedStyle(e);
|
|
2578
|
+
}
|
|
2579
|
+
var HTMLVisualElement = class extends DOMVisualElement {
|
|
2580
|
+
constructor() {
|
|
2581
|
+
super(...arguments), this.type = "html", this.renderInstance = renderHTML;
|
|
2582
|
+
}
|
|
2583
|
+
readValueFromInstance(e, g) {
|
|
2584
|
+
if (transformProps.has(g)) return this.projection?.isProjecting ? defaultTransformValue(g) : readTransformValue(e, g);
|
|
2585
|
+
{
|
|
2586
|
+
let _ = getComputedStyle$1(e), v = (isCSSVariableName(g) ? _.getPropertyValue(g) : _[g]) || 0;
|
|
2587
|
+
return typeof v == "string" ? v.trim() : v;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
measureInstanceViewportBox(e, { transformPagePoint: g }) {
|
|
2591
|
+
return measureViewportBox(e, g);
|
|
2592
|
+
}
|
|
2593
|
+
build(e, g, _) {
|
|
2594
|
+
buildHTMLStyles(e, g, _.transformTemplate);
|
|
2595
|
+
}
|
|
2596
|
+
scrapeMotionValuesFromProps(e, g, _) {
|
|
2597
|
+
return scrapeMotionValuesFromProps$1(e, g, _);
|
|
2598
|
+
}
|
|
2599
|
+
}, dashKeys = {
|
|
2600
|
+
offset: "stroke-dashoffset",
|
|
2601
|
+
array: "stroke-dasharray"
|
|
2602
|
+
}, camelKeys = {
|
|
2603
|
+
offset: "strokeDashoffset",
|
|
2604
|
+
array: "strokeDasharray"
|
|
2605
|
+
};
|
|
2606
|
+
function buildSVGPath(e, g, _ = 1, v = 0, y = !0) {
|
|
2607
|
+
e.pathLength = 1;
|
|
2608
|
+
let b = y ? dashKeys : camelKeys;
|
|
2609
|
+
e[b.offset] = `${-v}`, e[b.array] = `${g} ${_}`;
|
|
2610
|
+
}
|
|
2611
|
+
var cssMotionPathProperties = [
|
|
2612
|
+
"offsetDistance",
|
|
2613
|
+
"offsetPath",
|
|
2614
|
+
"offsetRotate",
|
|
2615
|
+
"offsetAnchor"
|
|
2616
|
+
];
|
|
2617
|
+
function buildSVGAttrs(e, { attrX: g, attrY: _, attrScale: v, pathLength: y, pathSpacing: b = 1, pathOffset: x = 0, ...S }, C, w, T) {
|
|
2618
|
+
if (buildHTMLStyles(e, S, w), C) {
|
|
2619
|
+
e.style.viewBox && (e.attrs.viewBox = e.style.viewBox);
|
|
2620
|
+
return;
|
|
2621
|
+
}
|
|
2622
|
+
e.attrs = e.style, e.style = {};
|
|
2623
|
+
let { attrs: E, style: D } = e;
|
|
2624
|
+
E.transform && (D.transform = E.transform, delete E.transform), (D.transform || E.transformOrigin) && (D.transformOrigin = E.transformOrigin ?? "50% 50%", delete E.transformOrigin), D.transform && (D.transformBox = T?.transformBox ?? "fill-box", delete E.transformBox);
|
|
2625
|
+
for (let e of cssMotionPathProperties) E[e] !== void 0 && (D[e] = E[e], delete E[e]);
|
|
2626
|
+
g !== void 0 && (E.x = g), _ !== void 0 && (E.y = _), v !== void 0 && (E.scale = v), y !== void 0 && buildSVGPath(E, y, b, x, !1);
|
|
2627
|
+
}
|
|
2628
|
+
var camelCaseAttributes = new Set([
|
|
2629
|
+
"baseFrequency",
|
|
2630
|
+
"diffuseConstant",
|
|
2631
|
+
"kernelMatrix",
|
|
2632
|
+
"kernelUnitLength",
|
|
2633
|
+
"keySplines",
|
|
2634
|
+
"keyTimes",
|
|
2635
|
+
"limitingConeAngle",
|
|
2636
|
+
"markerHeight",
|
|
2637
|
+
"markerWidth",
|
|
2638
|
+
"numOctaves",
|
|
2639
|
+
"targetX",
|
|
2640
|
+
"targetY",
|
|
2641
|
+
"surfaceScale",
|
|
2642
|
+
"specularConstant",
|
|
2643
|
+
"specularExponent",
|
|
2644
|
+
"stdDeviation",
|
|
2645
|
+
"tableValues",
|
|
2646
|
+
"viewBox",
|
|
2647
|
+
"gradientTransform",
|
|
2648
|
+
"pathLength",
|
|
2649
|
+
"startOffset",
|
|
2650
|
+
"textLength",
|
|
2651
|
+
"lengthAdjust"
|
|
2652
|
+
]), isSVGTag = (e) => typeof e == "string" && e.toLowerCase() === "svg";
|
|
2653
|
+
function renderSVG(e, g, _, v) {
|
|
2654
|
+
for (let _ in renderHTML(e, g, void 0, v), g.attrs) e.setAttribute(camelCaseAttributes.has(_) ? _ : camelToDash(_), g.attrs[_]);
|
|
2655
|
+
}
|
|
2656
|
+
function scrapeMotionValuesFromProps(e, g, _) {
|
|
2657
|
+
let v = scrapeMotionValuesFromProps$1(e, g, _);
|
|
2658
|
+
for (let _ in e) if (isMotionValue(e[_]) || isMotionValue(g[_])) {
|
|
2659
|
+
let g = transformPropOrder.indexOf(_) === -1 ? _ : "attr" + _.charAt(0).toUpperCase() + _.substring(1);
|
|
2660
|
+
v[g] = e[_];
|
|
2661
|
+
}
|
|
2662
|
+
return v;
|
|
2663
|
+
}
|
|
2664
|
+
var SVGVisualElement = class extends DOMVisualElement {
|
|
2665
|
+
constructor() {
|
|
2666
|
+
super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = createBox;
|
|
2667
|
+
}
|
|
2668
|
+
getBaseTargetFromProps(e, g) {
|
|
2669
|
+
return e[g];
|
|
2670
|
+
}
|
|
2671
|
+
readValueFromInstance(e, g) {
|
|
2672
|
+
if (transformProps.has(g)) {
|
|
2673
|
+
let e = getDefaultValueType(g);
|
|
2674
|
+
return e && e.default || 0;
|
|
2675
|
+
}
|
|
2676
|
+
return g = camelCaseAttributes.has(g) ? g : camelToDash(g), e.getAttribute(g);
|
|
2677
|
+
}
|
|
2678
|
+
scrapeMotionValuesFromProps(e, g, _) {
|
|
2679
|
+
return scrapeMotionValuesFromProps(e, g, _);
|
|
2680
|
+
}
|
|
2681
|
+
build(e, g, _) {
|
|
2682
|
+
buildSVGAttrs(e, g, this.isSVGTag, _.transformTemplate, _.style);
|
|
2683
|
+
}
|
|
2684
|
+
renderInstance(e, g, _, v) {
|
|
2685
|
+
renderSVG(e, g, _, v);
|
|
2686
|
+
}
|
|
2687
|
+
mount(e) {
|
|
2688
|
+
this.isSVGTag = isSVGTag(e.tagName), super.mount(e);
|
|
2689
|
+
}
|
|
2690
|
+
}, numVariantProps = variantProps.length;
|
|
2691
|
+
function getVariantContext(e) {
|
|
2692
|
+
if (!e) return;
|
|
2693
|
+
if (!e.isControllingVariants) {
|
|
2694
|
+
let g = e.parent && getVariantContext(e.parent) || {};
|
|
2695
|
+
return e.props.initial !== void 0 && (g.initial = e.props.initial), g;
|
|
2696
|
+
}
|
|
2697
|
+
let g = {};
|
|
2698
|
+
for (let _ = 0; _ < numVariantProps; _++) {
|
|
2699
|
+
let v = variantProps[_], y = e.props[v];
|
|
2700
|
+
(isVariantLabel(y) || y === !1) && (g[v] = y);
|
|
2701
|
+
}
|
|
2702
|
+
return g;
|
|
2703
|
+
}
|
|
2704
|
+
function shallowCompare(e, g) {
|
|
2705
|
+
if (!Array.isArray(g)) return !1;
|
|
2706
|
+
let _ = g.length;
|
|
2707
|
+
if (_ !== e.length) return !1;
|
|
2708
|
+
for (let v = 0; v < _; v++) if (g[v] !== e[v]) return !1;
|
|
2709
|
+
return !0;
|
|
2710
|
+
}
|
|
2711
|
+
var reversePriorityOrder = [...variantPriorityOrder].reverse(), numAnimationTypes = variantPriorityOrder.length;
|
|
2712
|
+
function createAnimateFunction(e) {
|
|
2713
|
+
return (g) => Promise.all(g.map(({ animation: g, options: _ }) => animateVisualElement(e, g, _)));
|
|
2714
|
+
}
|
|
2715
|
+
function createAnimationState(e) {
|
|
2716
|
+
let g = createAnimateFunction(e), _ = createState(), v = !0, y = (g) => (_, v) => {
|
|
2717
|
+
let y = resolveVariant(e, v, g === "exit" ? e.presenceContext?.custom : void 0);
|
|
2718
|
+
if (y) {
|
|
2719
|
+
let { transition: e, transitionEnd: g, ...v } = y;
|
|
2720
|
+
_ = {
|
|
2721
|
+
..._,
|
|
2722
|
+
...v,
|
|
2723
|
+
...g
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
return _;
|
|
2727
|
+
};
|
|
2728
|
+
function b(_) {
|
|
2729
|
+
g = _(e);
|
|
2730
|
+
}
|
|
2731
|
+
function x(b) {
|
|
2732
|
+
let { props: x } = e, S = getVariantContext(e.parent) || {}, C = [], w = /* @__PURE__ */ new Set(), T = {}, E = Infinity;
|
|
2733
|
+
for (let g = 0; g < numAnimationTypes; g++) {
|
|
2734
|
+
let D = reversePriorityOrder[g], O = _[D], k = x[D] === void 0 ? S[D] : x[D], A = isVariantLabel(k), j = D === b ? O.isActive : null;
|
|
2735
|
+
j === !1 && (E = g);
|
|
2736
|
+
let M = k === S[D] && k !== x[D] && A;
|
|
2737
|
+
if (M && v && e.manuallyAnimateOnMount && (M = !1), O.protectedKeys = { ...T }, !O.isActive && j === null || !k && !O.prevProp || isAnimationControls(k) || typeof k == "boolean") continue;
|
|
2738
|
+
if (D === "exit" && O.isActive && j !== !0) {
|
|
2739
|
+
O.prevResolvedValues && (T = {
|
|
2740
|
+
...T,
|
|
2741
|
+
...O.prevResolvedValues
|
|
2742
|
+
});
|
|
2743
|
+
continue;
|
|
2744
|
+
}
|
|
2745
|
+
let N = checkVariantsDidChange(O.prevProp, k), P = N || D === b && O.isActive && !M && A || g > E && A, F = !1, I = Array.isArray(k) ? k : [k], L = I.reduce(y(D), {});
|
|
2746
|
+
j === !1 && (L = {});
|
|
2747
|
+
let { prevResolvedValues: R = {} } = O, z = {
|
|
2748
|
+
...R,
|
|
2749
|
+
...L
|
|
2750
|
+
}, B = (g) => {
|
|
2751
|
+
P = !0, w.has(g) && (F = !0, w.delete(g)), O.needsAnimating[g] = !0;
|
|
2752
|
+
let _ = e.getValue(g);
|
|
2753
|
+
_ && (_.liveStyle = !1);
|
|
2754
|
+
};
|
|
2755
|
+
for (let e in z) {
|
|
2756
|
+
let g = L[e], _ = R[e];
|
|
2757
|
+
if (T.hasOwnProperty(e)) continue;
|
|
2758
|
+
let v = !1;
|
|
2759
|
+
v = isKeyframesTarget(g) && isKeyframesTarget(_) ? !shallowCompare(g, _) : g !== _, v ? g == null ? w.add(e) : B(e) : g !== void 0 && w.has(e) ? B(e) : O.protectedKeys[e] = !0;
|
|
2760
|
+
}
|
|
2761
|
+
O.prevProp = k, O.prevResolvedValues = L, O.isActive && (T = {
|
|
2762
|
+
...T,
|
|
2763
|
+
...L
|
|
2764
|
+
}), v && e.blockInitialAnimation && (P = !1);
|
|
2765
|
+
let V = M && N;
|
|
2766
|
+
P && (!V || F) && C.push(...I.map((g) => {
|
|
2767
|
+
let _ = { type: D };
|
|
2768
|
+
if (typeof g == "string" && v && !V && e.manuallyAnimateOnMount && e.parent) {
|
|
2769
|
+
let { parent: v } = e, y = resolveVariant(v, g);
|
|
2770
|
+
if (v.enteringChildren && y) {
|
|
2771
|
+
let { delayChildren: g } = y.transition || {};
|
|
2772
|
+
_.delay = calcChildStagger(v.enteringChildren, e, g);
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
return {
|
|
2776
|
+
animation: g,
|
|
2777
|
+
options: _
|
|
2778
|
+
};
|
|
2779
|
+
}));
|
|
2780
|
+
}
|
|
2781
|
+
if (w.size) {
|
|
2782
|
+
let g = {};
|
|
2783
|
+
if (typeof x.initial != "boolean") {
|
|
2784
|
+
let _ = resolveVariant(e, Array.isArray(x.initial) ? x.initial[0] : x.initial);
|
|
2785
|
+
_ && _.transition && (g.transition = _.transition);
|
|
2786
|
+
}
|
|
2787
|
+
w.forEach((_) => {
|
|
2788
|
+
let v = e.getBaseTarget(_), y = e.getValue(_);
|
|
2789
|
+
y && (y.liveStyle = !0), g[_] = v ?? null;
|
|
2790
|
+
}), C.push({ animation: g });
|
|
2791
|
+
}
|
|
2792
|
+
let D = !!C.length;
|
|
2793
|
+
return v && (x.initial === !1 || x.initial === x.animate) && !e.manuallyAnimateOnMount && (D = !1), v = !1, D ? g(C) : Promise.resolve();
|
|
2794
|
+
}
|
|
2795
|
+
function S(g, v) {
|
|
2796
|
+
if (_[g].isActive === v) return Promise.resolve();
|
|
2797
|
+
e.variantChildren?.forEach((e) => e.animationState?.setActive(g, v)), _[g].isActive = v;
|
|
2798
|
+
let y = x(g);
|
|
2799
|
+
for (let e in _) _[e].protectedKeys = {};
|
|
2800
|
+
return y;
|
|
2801
|
+
}
|
|
2802
|
+
return {
|
|
2803
|
+
animateChanges: x,
|
|
2804
|
+
setActive: S,
|
|
2805
|
+
setAnimateFunction: b,
|
|
2806
|
+
getState: () => _,
|
|
2807
|
+
reset: () => {
|
|
2808
|
+
_ = createState();
|
|
2809
|
+
}
|
|
2810
|
+
};
|
|
2811
|
+
}
|
|
2812
|
+
function checkVariantsDidChange(e, g) {
|
|
2813
|
+
return typeof g == "string" ? g !== e : Array.isArray(g) ? !shallowCompare(g, e) : !1;
|
|
2814
|
+
}
|
|
2815
|
+
function createTypeState(e = !1) {
|
|
2816
|
+
return {
|
|
2817
|
+
isActive: e,
|
|
2818
|
+
protectedKeys: {},
|
|
2819
|
+
needsAnimating: {},
|
|
2820
|
+
prevResolvedValues: {}
|
|
2821
|
+
};
|
|
2822
|
+
}
|
|
2823
|
+
function createState() {
|
|
2824
|
+
return {
|
|
2825
|
+
animate: createTypeState(!0),
|
|
2826
|
+
whileInView: createTypeState(),
|
|
2827
|
+
whileHover: createTypeState(),
|
|
2828
|
+
whileTap: createTypeState(),
|
|
2829
|
+
whileDrag: createTypeState(),
|
|
2830
|
+
whileFocus: createTypeState(),
|
|
2831
|
+
exit: createTypeState()
|
|
2832
|
+
};
|
|
2833
|
+
}
|
|
2834
|
+
function copyAxisInto(e, g) {
|
|
2835
|
+
e.min = g.min, e.max = g.max;
|
|
2836
|
+
}
|
|
2837
|
+
function copyBoxInto(e, g) {
|
|
2838
|
+
copyAxisInto(e.x, g.x), copyAxisInto(e.y, g.y);
|
|
2839
|
+
}
|
|
2840
|
+
function copyAxisDeltaInto(e, g) {
|
|
2841
|
+
e.translate = g.translate, e.scale = g.scale, e.originPoint = g.originPoint, e.origin = g.origin;
|
|
2842
|
+
}
|
|
2843
|
+
var SCALE_PRECISION = 1e-4, SCALE_MIN = 1 - SCALE_PRECISION, SCALE_MAX = 1 + SCALE_PRECISION, TRANSLATE_PRECISION = .01, TRANSLATE_MIN = 0 - TRANSLATE_PRECISION, TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;
|
|
2844
|
+
function calcLength(e) {
|
|
2845
|
+
return e.max - e.min;
|
|
2846
|
+
}
|
|
2847
|
+
function isNear(e, g, _) {
|
|
2848
|
+
return Math.abs(e - g) <= _;
|
|
2849
|
+
}
|
|
2850
|
+
function calcAxisDelta(e, g, _, v = .5) {
|
|
2851
|
+
e.origin = v, e.originPoint = mixNumber(g.min, g.max, e.origin), e.scale = calcLength(_) / calcLength(g), e.translate = mixNumber(_.min, _.max, e.origin) - e.originPoint, (e.scale >= SCALE_MIN && e.scale <= SCALE_MAX || isNaN(e.scale)) && (e.scale = 1), (e.translate >= TRANSLATE_MIN && e.translate <= TRANSLATE_MAX || isNaN(e.translate)) && (e.translate = 0);
|
|
2852
|
+
}
|
|
2853
|
+
function calcBoxDelta(e, g, _, v) {
|
|
2854
|
+
calcAxisDelta(e.x, g.x, _.x, v ? v.originX : void 0), calcAxisDelta(e.y, g.y, _.y, v ? v.originY : void 0);
|
|
2855
|
+
}
|
|
2856
|
+
function calcRelativeAxis(e, g, _) {
|
|
2857
|
+
e.min = _.min + g.min, e.max = e.min + calcLength(g);
|
|
2858
|
+
}
|
|
2859
|
+
function calcRelativeBox(e, g, _) {
|
|
2860
|
+
calcRelativeAxis(e.x, g.x, _.x), calcRelativeAxis(e.y, g.y, _.y);
|
|
2861
|
+
}
|
|
2862
|
+
function calcRelativeAxisPosition(e, g, _) {
|
|
2863
|
+
e.min = g.min - _.min, e.max = e.min + calcLength(g);
|
|
2864
|
+
}
|
|
2865
|
+
function calcRelativePosition(e, g, _) {
|
|
2866
|
+
calcRelativeAxisPosition(e.x, g.x, _.x), calcRelativeAxisPosition(e.y, g.y, _.y);
|
|
2867
|
+
}
|
|
2868
|
+
function removePointDelta(e, g, _, v, y) {
|
|
2869
|
+
return e -= g, e = scalePoint(e, 1 / _, v), y !== void 0 && (e = scalePoint(e, 1 / y, v)), e;
|
|
2870
|
+
}
|
|
2871
|
+
function removeAxisDelta(e, g = 0, _ = 1, v = .5, y, b = e, x = e) {
|
|
2872
|
+
if (percent.test(g) && (g = parseFloat(g), g = mixNumber(x.min, x.max, g / 100) - x.min), typeof g != "number") return;
|
|
2873
|
+
let S = mixNumber(b.min, b.max, v);
|
|
2874
|
+
e === b && (S -= g), e.min = removePointDelta(e.min, g, _, S, y), e.max = removePointDelta(e.max, g, _, S, y);
|
|
2875
|
+
}
|
|
2876
|
+
function removeAxisTransforms(e, g, [_, v, y], b, x) {
|
|
2877
|
+
removeAxisDelta(e, g[_], g[v], g[y], g.scale, b, x);
|
|
2878
|
+
}
|
|
2879
|
+
var xKeys = [
|
|
2880
|
+
"x",
|
|
2881
|
+
"scaleX",
|
|
2882
|
+
"originX"
|
|
2883
|
+
], yKeys = [
|
|
2884
|
+
"y",
|
|
2885
|
+
"scaleY",
|
|
2886
|
+
"originY"
|
|
2887
|
+
];
|
|
2888
|
+
function removeBoxTransforms(e, g, _, v) {
|
|
2889
|
+
removeAxisTransforms(e.x, g, xKeys, _ ? _.x : void 0, v ? v.x : void 0), removeAxisTransforms(e.y, g, yKeys, _ ? _.y : void 0, v ? v.y : void 0);
|
|
2890
|
+
}
|
|
2891
|
+
function isAxisDeltaZero(e) {
|
|
2892
|
+
return e.translate === 0 && e.scale === 1;
|
|
2893
|
+
}
|
|
2894
|
+
function isDeltaZero(e) {
|
|
2895
|
+
return isAxisDeltaZero(e.x) && isAxisDeltaZero(e.y);
|
|
2896
|
+
}
|
|
2897
|
+
function axisEquals(e, g) {
|
|
2898
|
+
return e.min === g.min && e.max === g.max;
|
|
2899
|
+
}
|
|
2900
|
+
function boxEquals(e, g) {
|
|
2901
|
+
return axisEquals(e.x, g.x) && axisEquals(e.y, g.y);
|
|
2902
|
+
}
|
|
2903
|
+
function axisEqualsRounded(e, g) {
|
|
2904
|
+
return Math.round(e.min) === Math.round(g.min) && Math.round(e.max) === Math.round(g.max);
|
|
2905
|
+
}
|
|
2906
|
+
function boxEqualsRounded(e, g) {
|
|
2907
|
+
return axisEqualsRounded(e.x, g.x) && axisEqualsRounded(e.y, g.y);
|
|
2908
|
+
}
|
|
2909
|
+
function aspectRatio(e) {
|
|
2910
|
+
return calcLength(e.x) / calcLength(e.y);
|
|
2911
|
+
}
|
|
2912
|
+
function axisDeltaEquals(e, g) {
|
|
2913
|
+
return e.translate === g.translate && e.scale === g.scale && e.originPoint === g.originPoint;
|
|
2914
|
+
}
|
|
2915
|
+
function eachAxis(e) {
|
|
2916
|
+
return [e("x"), e("y")];
|
|
2917
|
+
}
|
|
2918
|
+
function buildProjectionTransform(e, g, _) {
|
|
2919
|
+
let v = "", y = e.x.translate / g.x, b = e.y.translate / g.y, x = _?.z || 0;
|
|
2920
|
+
if ((y || b || x) && (v = `translate3d(${y}px, ${b}px, ${x}px) `), (g.x !== 1 || g.y !== 1) && (v += `scale(${1 / g.x}, ${1 / g.y}) `), _) {
|
|
2921
|
+
let { transformPerspective: e, rotate: g, rotateX: y, rotateY: b, skewX: x, skewY: S } = _;
|
|
2922
|
+
e && (v = `perspective(${e}px) ${v}`), g && (v += `rotate(${g}deg) `), y && (v += `rotateX(${y}deg) `), b && (v += `rotateY(${b}deg) `), x && (v += `skewX(${x}deg) `), S && (v += `skewY(${S}deg) `);
|
|
2923
|
+
}
|
|
2924
|
+
let S = e.x.scale * g.x, C = e.y.scale * g.y;
|
|
2925
|
+
return (S !== 1 || C !== 1) && (v += `scale(${S}, ${C})`), v || "none";
|
|
2926
|
+
}
|
|
2927
|
+
var borders = [
|
|
2928
|
+
"TopLeft",
|
|
2929
|
+
"TopRight",
|
|
2930
|
+
"BottomLeft",
|
|
2931
|
+
"BottomRight"
|
|
2932
|
+
], numBorders = borders.length, asNumber = (e) => typeof e == "string" ? parseFloat(e) : e, isPx = (e) => typeof e == "number" || px.test(e);
|
|
2933
|
+
function mixValues(e, g, _, v, y, b) {
|
|
2934
|
+
y ? (e.opacity = mixNumber(0, _.opacity ?? 1, easeCrossfadeIn(v)), e.opacityExit = mixNumber(g.opacity ?? 1, 0, easeCrossfadeOut(v))) : b && (e.opacity = mixNumber(g.opacity ?? 1, _.opacity ?? 1, v));
|
|
2935
|
+
for (let y = 0; y < numBorders; y++) {
|
|
2936
|
+
let b = `border${borders[y]}Radius`, x = getRadius(g, b), S = getRadius(_, b);
|
|
2937
|
+
x === void 0 && S === void 0 || (x ||= 0, S ||= 0, x === 0 || S === 0 || isPx(x) === isPx(S) ? (e[b] = Math.max(mixNumber(asNumber(x), asNumber(S), v), 0), (percent.test(S) || percent.test(x)) && (e[b] += "%")) : e[b] = S);
|
|
2938
|
+
}
|
|
2939
|
+
(g.rotate || _.rotate) && (e.rotate = mixNumber(g.rotate || 0, _.rotate || 0, v));
|
|
2940
|
+
}
|
|
2941
|
+
function getRadius(e, g) {
|
|
2942
|
+
return e[g] === void 0 ? e.borderRadius : e[g];
|
|
2943
|
+
}
|
|
2944
|
+
var easeCrossfadeIn = /* @__PURE__ */ compress(0, .5, circOut), easeCrossfadeOut = /* @__PURE__ */ compress(.5, .95, noop);
|
|
2945
|
+
function compress(e, g, _) {
|
|
2946
|
+
return (v) => v < e ? 0 : v > g ? 1 : _(/* @__PURE__ */ progress(e, g, v));
|
|
2947
|
+
}
|
|
2948
|
+
function animateSingleValue(e, g, _) {
|
|
2949
|
+
let v = isMotionValue(e) ? e : motionValue(e);
|
|
2950
|
+
return v.start(animateMotionValue("", v, g, _)), v.animation;
|
|
2951
|
+
}
|
|
2952
|
+
function addDomEvent(e, g, _, v = { passive: !0 }) {
|
|
2953
|
+
return e.addEventListener(g, _, v), () => e.removeEventListener(g, _);
|
|
2954
|
+
}
|
|
2955
|
+
var compareByDepth = (e, g) => e.depth - g.depth, FlatTree = class {
|
|
2956
|
+
constructor() {
|
|
2957
|
+
this.children = [], this.isDirty = !1;
|
|
2958
|
+
}
|
|
2959
|
+
add(e) {
|
|
2960
|
+
addUniqueItem(this.children, e), this.isDirty = !0;
|
|
2961
|
+
}
|
|
2962
|
+
remove(e) {
|
|
2963
|
+
removeItem(this.children, e), this.isDirty = !0;
|
|
2964
|
+
}
|
|
2965
|
+
forEach(e) {
|
|
2966
|
+
this.isDirty && this.children.sort(compareByDepth), this.isDirty = !1, this.children.forEach(e);
|
|
2967
|
+
}
|
|
2968
|
+
};
|
|
2969
|
+
function delay(e, g) {
|
|
2970
|
+
let _ = time.now(), v = ({ timestamp: y }) => {
|
|
2971
|
+
let b = y - _;
|
|
2972
|
+
b >= g && (cancelFrame(v), e(b - g));
|
|
2973
|
+
};
|
|
2974
|
+
return frame.setup(v, !0), () => cancelFrame(v);
|
|
2975
|
+
}
|
|
2976
|
+
function resolveMotionValue(e) {
|
|
2977
|
+
return isMotionValue(e) ? e.get() : e;
|
|
2978
|
+
}
|
|
2979
|
+
var NodeStack = class {
|
|
2980
|
+
constructor() {
|
|
2981
|
+
this.members = [];
|
|
2982
|
+
}
|
|
2983
|
+
add(e) {
|
|
2984
|
+
addUniqueItem(this.members, e);
|
|
2985
|
+
for (let g = this.members.length - 1; g >= 0; g--) {
|
|
2986
|
+
let _ = this.members[g];
|
|
2987
|
+
if (_ === e || _ === this.lead || _ === this.prevLead) continue;
|
|
2988
|
+
let v = _.instance;
|
|
2989
|
+
v && v.isConnected === !1 && _.isPresent !== !1 && !_.snapshot && removeItem(this.members, _);
|
|
2990
|
+
}
|
|
2991
|
+
e.scheduleRender();
|
|
2992
|
+
}
|
|
2993
|
+
remove(e) {
|
|
2994
|
+
if (removeItem(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
|
|
2995
|
+
let e = this.members[this.members.length - 1];
|
|
2996
|
+
e && this.promote(e);
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
relegate(e) {
|
|
3000
|
+
let g = this.members.findIndex((g) => e === g);
|
|
3001
|
+
if (g === 0) return !1;
|
|
3002
|
+
let _;
|
|
3003
|
+
for (let e = g; e >= 0; e--) {
|
|
3004
|
+
let g = this.members[e], v = g.instance;
|
|
3005
|
+
if (g.isPresent !== !1 && (!v || v.isConnected !== !1)) {
|
|
3006
|
+
_ = g;
|
|
3007
|
+
break;
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
return _ ? (this.promote(_), !0) : !1;
|
|
3011
|
+
}
|
|
3012
|
+
promote(e, g) {
|
|
3013
|
+
let _ = this.lead;
|
|
3014
|
+
if (e !== _ && (this.prevLead = _, this.lead = e, e.show(), _)) {
|
|
3015
|
+
_.instance && _.scheduleRender(), e.scheduleRender();
|
|
3016
|
+
let v = _.options.layoutDependency, y = e.options.layoutDependency;
|
|
3017
|
+
if (!(v !== void 0 && y !== void 0 && v === y)) {
|
|
3018
|
+
let v = _.instance;
|
|
3019
|
+
v && v.isConnected === !1 && !_.snapshot || (e.resumeFrom = _, g && (e.resumeFrom.preserveOpacity = !0), _.snapshot && (e.snapshot = _.snapshot, e.snapshot.latestValues = _.animationValues || _.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0));
|
|
3020
|
+
}
|
|
3021
|
+
let { crossfade: b } = e.options;
|
|
3022
|
+
b === !1 && _.hide();
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
exitAnimationComplete() {
|
|
3026
|
+
this.members.forEach((e) => {
|
|
3027
|
+
let { options: g, resumingFrom: _ } = e;
|
|
3028
|
+
g.onExitComplete && g.onExitComplete(), _ && _.options.onExitComplete && _.options.onExitComplete();
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
scheduleRender() {
|
|
3032
|
+
this.members.forEach((e) => {
|
|
3033
|
+
e.instance && e.scheduleRender(!1);
|
|
3034
|
+
});
|
|
3035
|
+
}
|
|
3036
|
+
removeLeadSnapshot() {
|
|
3037
|
+
this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
|
|
3038
|
+
}
|
|
3039
|
+
}, globalProjectionState = {
|
|
3040
|
+
hasAnimatedSinceResize: !0,
|
|
3041
|
+
hasEverUpdated: !1
|
|
3042
|
+
}, metrics = {
|
|
3043
|
+
nodes: 0,
|
|
3044
|
+
calculatedTargetDeltas: 0,
|
|
3045
|
+
calculatedProjections: 0
|
|
3046
|
+
}, transformAxes = [
|
|
3047
|
+
"",
|
|
3048
|
+
"X",
|
|
3049
|
+
"Y",
|
|
3050
|
+
"Z"
|
|
3051
|
+
], animationTarget = 1e3, id$1 = 0;
|
|
3052
|
+
function resetDistortingTransform(e, g, _, v) {
|
|
3053
|
+
let { latestValues: y } = g;
|
|
3054
|
+
y[e] && (_[e] = y[e], g.setStaticValue(e, 0), v && (v[e] = 0));
|
|
3055
|
+
}
|
|
3056
|
+
function cancelTreeOptimisedTransformAnimations(e) {
|
|
3057
|
+
if (e.hasCheckedOptimisedAppear = !0, e.root === e) return;
|
|
3058
|
+
let { visualElement: g } = e.options;
|
|
3059
|
+
if (!g) return;
|
|
3060
|
+
let _ = getOptimisedAppearId(g);
|
|
3061
|
+
if (window.MotionHasOptimisedAnimation(_, "transform")) {
|
|
3062
|
+
let { layout: g, layoutId: v } = e.options;
|
|
3063
|
+
window.MotionCancelOptimisedAnimation(_, "transform", frame, !(g || v));
|
|
3064
|
+
}
|
|
3065
|
+
let { parent: v } = e;
|
|
3066
|
+
v && !v.hasCheckedOptimisedAppear && cancelTreeOptimisedTransformAnimations(v);
|
|
3067
|
+
}
|
|
3068
|
+
function createProjectionNode$1({ attachResizeListener: e, defaultParent: g, measureScroll: _, checkIsScrollRoot: v, resetTransform: y }) {
|
|
3069
|
+
return class {
|
|
3070
|
+
constructor(e = {}, _ = g?.()) {
|
|
3071
|
+
this.id = id$1++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = {
|
|
3072
|
+
x: 1,
|
|
3073
|
+
y: 1
|
|
3074
|
+
}, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
|
|
3075
|
+
this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
|
|
3076
|
+
}, this.updateProjection = () => {
|
|
3077
|
+
this.projectionUpdateScheduled = !1, statsBuffer.value && (metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0), this.nodes.forEach(propagateDirtyNodes), this.nodes.forEach(resolveTargetDelta), this.nodes.forEach(calcProjection), this.nodes.forEach(cleanDirtyNodes), statsBuffer.addProjectionMetrics && statsBuffer.addProjectionMetrics(metrics);
|
|
3078
|
+
}, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = e, this.root = _ ? _.root || _ : this, this.path = _ ? [..._.path, _] : [], this.parent = _, this.depth = _ ? _.depth + 1 : 0;
|
|
3079
|
+
for (let e = 0; e < this.path.length; e++) this.path[e].shouldResetTransform = !0;
|
|
3080
|
+
this.root === this && (this.nodes = new FlatTree());
|
|
3081
|
+
}
|
|
3082
|
+
addEventListener(e, g) {
|
|
3083
|
+
return this.eventHandlers.has(e) || this.eventHandlers.set(e, new SubscriptionManager()), this.eventHandlers.get(e).add(g);
|
|
3084
|
+
}
|
|
3085
|
+
notifyListeners(e, ...g) {
|
|
3086
|
+
let _ = this.eventHandlers.get(e);
|
|
3087
|
+
_ && _.notify(...g);
|
|
3088
|
+
}
|
|
3089
|
+
hasListeners(e) {
|
|
3090
|
+
return this.eventHandlers.has(e);
|
|
3091
|
+
}
|
|
3092
|
+
mount(g) {
|
|
3093
|
+
if (this.instance) return;
|
|
3094
|
+
this.isSVG = isSVGElement(g) && !isSVGSVGElement(g), this.instance = g;
|
|
3095
|
+
let { layoutId: _, layout: v, visualElement: y } = this.options;
|
|
3096
|
+
if (y && !y.current && y.mount(g), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (v || _) && (this.isLayoutDirty = !0), e) {
|
|
3097
|
+
let _, v = 0, y = () => this.root.updateBlockedByResize = !1;
|
|
3098
|
+
frame.read(() => {
|
|
3099
|
+
v = window.innerWidth;
|
|
3100
|
+
}), e(g, () => {
|
|
3101
|
+
let e = window.innerWidth;
|
|
3102
|
+
e !== v && (v = e, this.root.updateBlockedByResize = !0, _ && _(), _ = delay(y, 250), globalProjectionState.hasAnimatedSinceResize && (globalProjectionState.hasAnimatedSinceResize = !1, this.nodes.forEach(finishAnimation)));
|
|
3103
|
+
});
|
|
3104
|
+
}
|
|
3105
|
+
_ && this.root.registerSharedNode(_, this), this.options.animate !== !1 && y && (_ || v) && this.addEventListener("didUpdate", ({ delta: e, hasLayoutChanged: g, hasRelativeLayoutChanged: _, layout: v }) => {
|
|
3106
|
+
if (this.isTreeAnimationBlocked()) {
|
|
3107
|
+
this.target = void 0, this.relativeTarget = void 0;
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
let b = this.options.transition || y.getDefaultTransition() || defaultLayoutTransition, { onLayoutAnimationStart: x, onLayoutAnimationComplete: S } = y.getProps(), C = !this.targetLayout || !boxEqualsRounded(this.targetLayout, v), w = !g && _;
|
|
3111
|
+
if (this.options.layoutRoot || this.resumeFrom || w || g && (C || !this.currentAnimation)) {
|
|
3112
|
+
this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
|
|
3113
|
+
let g = {
|
|
3114
|
+
...getValueTransition(b, "layout"),
|
|
3115
|
+
onPlay: x,
|
|
3116
|
+
onComplete: S
|
|
3117
|
+
};
|
|
3118
|
+
(y.shouldReduceMotion || this.options.layoutRoot) && (g.delay = 0, g.type = !1), this.startAnimation(g), this.setAnimationOrigin(e, w);
|
|
3119
|
+
} else g || finishAnimation(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
|
|
3120
|
+
this.targetLayout = v;
|
|
3121
|
+
});
|
|
3122
|
+
}
|
|
3123
|
+
unmount() {
|
|
3124
|
+
this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
|
|
3125
|
+
let e = this.getStack();
|
|
3126
|
+
e && e.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), cancelFrame(this.updateProjection);
|
|
3127
|
+
}
|
|
3128
|
+
blockUpdate() {
|
|
3129
|
+
this.updateManuallyBlocked = !0;
|
|
3130
|
+
}
|
|
3131
|
+
unblockUpdate() {
|
|
3132
|
+
this.updateManuallyBlocked = !1;
|
|
3133
|
+
}
|
|
3134
|
+
isUpdateBlocked() {
|
|
3135
|
+
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
3136
|
+
}
|
|
3137
|
+
isTreeAnimationBlocked() {
|
|
3138
|
+
return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
|
|
3139
|
+
}
|
|
3140
|
+
startUpdate() {
|
|
3141
|
+
this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(resetSkewAndRotation), this.animationId++);
|
|
3142
|
+
}
|
|
3143
|
+
getTransformTemplate() {
|
|
3144
|
+
let { visualElement: e } = this.options;
|
|
3145
|
+
return e && e.getProps().transformTemplate;
|
|
3146
|
+
}
|
|
3147
|
+
willUpdate(e = !0) {
|
|
3148
|
+
if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
|
|
3149
|
+
this.options.onExitComplete && this.options.onExitComplete();
|
|
3150
|
+
return;
|
|
3151
|
+
}
|
|
3152
|
+
if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && cancelTreeOptimisedTransformAnimations(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return;
|
|
3153
|
+
this.isLayoutDirty = !0;
|
|
3154
|
+
for (let e = 0; e < this.path.length; e++) {
|
|
3155
|
+
let g = this.path[e];
|
|
3156
|
+
g.shouldResetTransform = !0, g.updateScroll("snapshot"), g.options.layoutRoot && g.willUpdate(!1);
|
|
3157
|
+
}
|
|
3158
|
+
let { layoutId: g, layout: _ } = this.options;
|
|
3159
|
+
if (g === void 0 && !_) return;
|
|
3160
|
+
let v = this.getTransformTemplate();
|
|
3161
|
+
this.prevTransformTemplateValue = v ? v(this.latestValues, "") : void 0, this.updateSnapshot(), e && this.notifyListeners("willUpdate");
|
|
3162
|
+
}
|
|
3163
|
+
update() {
|
|
3164
|
+
if (this.updateScheduled = !1, this.isUpdateBlocked()) {
|
|
3165
|
+
this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(clearMeasurements);
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
if (this.animationId <= this.animationCommitId) {
|
|
3169
|
+
this.nodes.forEach(clearIsLayoutDirty);
|
|
3170
|
+
return;
|
|
3171
|
+
}
|
|
3172
|
+
this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(resetTransformStyle), this.nodes.forEach(updateLayout), this.nodes.forEach(notifyLayoutUpdate)) : this.nodes.forEach(clearIsLayoutDirty), this.clearAllSnapshots();
|
|
3173
|
+
let e = time.now();
|
|
3174
|
+
frameData.delta = clamp(0, 1e3 / 60, e - frameData.timestamp), frameData.timestamp = e, frameData.isProcessing = !0, frameSteps.update.process(frameData), frameSteps.preRender.process(frameData), frameSteps.render.process(frameData), frameData.isProcessing = !1;
|
|
3175
|
+
}
|
|
3176
|
+
didUpdate() {
|
|
3177
|
+
this.updateScheduled || (this.updateScheduled = !0, microtask.read(this.scheduleUpdate));
|
|
3178
|
+
}
|
|
3179
|
+
clearAllSnapshots() {
|
|
3180
|
+
this.nodes.forEach(clearSnapshot), this.sharedNodes.forEach(removeLeadSnapshots);
|
|
3181
|
+
}
|
|
3182
|
+
scheduleUpdateProjection() {
|
|
3183
|
+
this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, frame.preRender(this.updateProjection, !1, !0));
|
|
3184
|
+
}
|
|
3185
|
+
scheduleCheckAfterUnmount() {
|
|
3186
|
+
frame.postRender(() => {
|
|
3187
|
+
this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
updateSnapshot() {
|
|
3191
|
+
this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !calcLength(this.snapshot.measuredBox.x) && !calcLength(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
|
|
3192
|
+
}
|
|
3193
|
+
updateLayout() {
|
|
3194
|
+
if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty)) return;
|
|
3195
|
+
if (this.resumeFrom && !this.resumeFrom.instance) for (let e = 0; e < this.path.length; e++) this.path[e].updateScroll();
|
|
3196
|
+
let e = this.layout;
|
|
3197
|
+
this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected = createBox(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
|
|
3198
|
+
let { visualElement: g } = this.options;
|
|
3199
|
+
g && g.notify("LayoutMeasure", this.layout.layoutBox, e ? e.layoutBox : void 0);
|
|
3200
|
+
}
|
|
3201
|
+
updateScroll(e = "measure") {
|
|
3202
|
+
let g = !!(this.options.layoutScroll && this.instance);
|
|
3203
|
+
if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === e && (g = !1), g && this.instance) {
|
|
3204
|
+
let g = v(this.instance);
|
|
3205
|
+
this.scroll = {
|
|
3206
|
+
animationId: this.root.animationId,
|
|
3207
|
+
phase: e,
|
|
3208
|
+
isRoot: g,
|
|
3209
|
+
offset: _(this.instance),
|
|
3210
|
+
wasRoot: this.scroll ? this.scroll.isRoot : g
|
|
3211
|
+
};
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
resetTransform() {
|
|
3215
|
+
if (!y) return;
|
|
3216
|
+
let e = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, g = this.projectionDelta && !isDeltaZero(this.projectionDelta), _ = this.getTransformTemplate(), v = _ ? _(this.latestValues, "") : void 0, b = v !== this.prevTransformTemplateValue;
|
|
3217
|
+
e && this.instance && (g || hasTransform(this.latestValues) || b) && (y(this.instance, v), this.shouldResetTransform = !1, this.scheduleRender());
|
|
3218
|
+
}
|
|
3219
|
+
measure(e = !0) {
|
|
3220
|
+
let g = this.measurePageBox(), _ = this.removeElementScroll(g);
|
|
3221
|
+
return e && (_ = this.removeTransform(_)), roundBox(_), {
|
|
3222
|
+
animationId: this.root.animationId,
|
|
3223
|
+
measuredBox: g,
|
|
3224
|
+
layoutBox: _,
|
|
3225
|
+
latestValues: {},
|
|
3226
|
+
source: this.id
|
|
3227
|
+
};
|
|
3228
|
+
}
|
|
3229
|
+
measurePageBox() {
|
|
3230
|
+
let { visualElement: e } = this.options;
|
|
3231
|
+
if (!e) return createBox();
|
|
3232
|
+
let g = e.measureViewportBox();
|
|
3233
|
+
if (!(this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot))) {
|
|
3234
|
+
let { scroll: e } = this.root;
|
|
3235
|
+
e && (translateAxis(g.x, e.offset.x), translateAxis(g.y, e.offset.y));
|
|
3236
|
+
}
|
|
3237
|
+
return g;
|
|
3238
|
+
}
|
|
3239
|
+
removeElementScroll(e) {
|
|
3240
|
+
let g = createBox();
|
|
3241
|
+
if (copyBoxInto(g, e), this.scroll?.wasRoot) return g;
|
|
3242
|
+
for (let _ = 0; _ < this.path.length; _++) {
|
|
3243
|
+
let v = this.path[_], { scroll: y, options: b } = v;
|
|
3244
|
+
v !== this.root && y && b.layoutScroll && (y.wasRoot && copyBoxInto(g, e), translateAxis(g.x, y.offset.x), translateAxis(g.y, y.offset.y));
|
|
3245
|
+
}
|
|
3246
|
+
return g;
|
|
3247
|
+
}
|
|
3248
|
+
applyTransform(e, g = !1) {
|
|
3249
|
+
let _ = createBox();
|
|
3250
|
+
copyBoxInto(_, e);
|
|
3251
|
+
for (let e = 0; e < this.path.length; e++) {
|
|
3252
|
+
let v = this.path[e];
|
|
3253
|
+
!g && v.options.layoutScroll && v.scroll && v !== v.root && transformBox(_, {
|
|
3254
|
+
x: -v.scroll.offset.x,
|
|
3255
|
+
y: -v.scroll.offset.y
|
|
3256
|
+
}), hasTransform(v.latestValues) && transformBox(_, v.latestValues);
|
|
3257
|
+
}
|
|
3258
|
+
return hasTransform(this.latestValues) && transformBox(_, this.latestValues), _;
|
|
3259
|
+
}
|
|
3260
|
+
removeTransform(e) {
|
|
3261
|
+
let g = createBox();
|
|
3262
|
+
copyBoxInto(g, e);
|
|
3263
|
+
for (let e = 0; e < this.path.length; e++) {
|
|
3264
|
+
let _ = this.path[e];
|
|
3265
|
+
if (!_.instance || !hasTransform(_.latestValues)) continue;
|
|
3266
|
+
hasScale(_.latestValues) && _.updateSnapshot();
|
|
3267
|
+
let v = createBox();
|
|
3268
|
+
copyBoxInto(v, _.measurePageBox()), removeBoxTransforms(g, _.latestValues, _.snapshot ? _.snapshot.layoutBox : void 0, v);
|
|
3269
|
+
}
|
|
3270
|
+
return hasTransform(this.latestValues) && removeBoxTransforms(g, this.latestValues), g;
|
|
3271
|
+
}
|
|
3272
|
+
setTargetDelta(e) {
|
|
3273
|
+
this.targetDelta = e, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
|
|
3274
|
+
}
|
|
3275
|
+
setOptions(e) {
|
|
3276
|
+
this.options = {
|
|
3277
|
+
...this.options,
|
|
3278
|
+
...e,
|
|
3279
|
+
crossfade: e.crossfade === void 0 ? !0 : e.crossfade
|
|
3280
|
+
};
|
|
3281
|
+
}
|
|
3282
|
+
clearMeasurements() {
|
|
3283
|
+
this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
|
|
3284
|
+
}
|
|
3285
|
+
forceRelativeParentToResolveTarget() {
|
|
3286
|
+
this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp && this.relativeParent.resolveTargetDelta(!0);
|
|
3287
|
+
}
|
|
3288
|
+
resolveTargetDelta(e = !1) {
|
|
3289
|
+
let g = this.getLead();
|
|
3290
|
+
this.isProjectionDirty ||= g.isProjectionDirty, this.isTransformDirty ||= g.isTransformDirty, this.isSharedProjectionDirty ||= g.isSharedProjectionDirty;
|
|
3291
|
+
let _ = !!this.resumingFrom || this !== g;
|
|
3292
|
+
if (!(e || _ && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) return;
|
|
3293
|
+
let { layout: v, layoutId: y } = this.options;
|
|
3294
|
+
if (!this.layout || !(v || y)) return;
|
|
3295
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
3296
|
+
let b = this.getClosestProjectingParent();
|
|
3297
|
+
b && this.linkedParentVersion !== b.layoutVersion && !b.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (b && b.layout ? this.createRelativeTarget(b, this.layout.layoutBox, b.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = createBox(), this.targetWithTransforms = createBox()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : copyBoxInto(this.target, this.layout.layoutBox), applyBoxDelta(this.target, this.targetDelta)) : copyBoxInto(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, b && !!b.resumingFrom == !!this.resumingFrom && !b.options.layoutScroll && b.target && this.animationProgress !== 1 ? this.createRelativeTarget(b, this.target, b.target) : this.relativeParent = this.relativeTarget = void 0), statsBuffer.value && metrics.calculatedTargetDeltas++);
|
|
3298
|
+
}
|
|
3299
|
+
getClosestProjectingParent() {
|
|
3300
|
+
if (!(!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
|
|
3301
|
+
}
|
|
3302
|
+
isProjecting() {
|
|
3303
|
+
return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
3304
|
+
}
|
|
3305
|
+
createRelativeTarget(e, g, _) {
|
|
3306
|
+
this.relativeParent = e, this.linkedParentVersion = e.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = createBox(), this.relativeTargetOrigin = createBox(), calcRelativePosition(this.relativeTargetOrigin, g, _), copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
3307
|
+
}
|
|
3308
|
+
removeRelativeTarget() {
|
|
3309
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
3310
|
+
}
|
|
3311
|
+
calcProjection() {
|
|
3312
|
+
let e = this.getLead(), g = !!this.resumingFrom || this !== e, _ = !0;
|
|
3313
|
+
if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (_ = !1), g && (this.isSharedProjectionDirty || this.isTransformDirty) && (_ = !1), this.resolvedRelativeTargetAt === frameData.timestamp && (_ = !1), _) return;
|
|
3314
|
+
let { layout: v, layoutId: y } = this.options;
|
|
3315
|
+
if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(v || y)) return;
|
|
3316
|
+
copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
|
|
3317
|
+
let b = this.treeScale.x, x = this.treeScale.y;
|
|
3318
|
+
applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, g), e.layout && !e.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (e.target = e.layout.layoutBox, e.targetWithTransforms = createBox());
|
|
3319
|
+
let { target: S } = e;
|
|
3320
|
+
if (!S) {
|
|
3321
|
+
this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3324
|
+
!this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x), copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y)), calcBoxDelta(this.projectionDelta, this.layoutCorrected, S, this.latestValues), (this.treeScale.x !== b || this.treeScale.y !== x || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", S)), statsBuffer.value && metrics.calculatedProjections++;
|
|
3325
|
+
}
|
|
3326
|
+
hide() {
|
|
3327
|
+
this.isVisible = !1;
|
|
3328
|
+
}
|
|
3329
|
+
show() {
|
|
3330
|
+
this.isVisible = !0;
|
|
3331
|
+
}
|
|
3332
|
+
scheduleRender(e = !0) {
|
|
3333
|
+
if (this.options.visualElement?.scheduleRender(), e) {
|
|
3334
|
+
let e = this.getStack();
|
|
3335
|
+
e && e.scheduleRender();
|
|
3336
|
+
}
|
|
3337
|
+
this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
|
|
3338
|
+
}
|
|
3339
|
+
createProjectionDeltas() {
|
|
3340
|
+
this.prevProjectionDelta = createDelta(), this.projectionDelta = createDelta(), this.projectionDeltaWithTransform = createDelta();
|
|
3341
|
+
}
|
|
3342
|
+
setAnimationOrigin(e, g = !1) {
|
|
3343
|
+
let _ = this.snapshot, v = _ ? _.latestValues : {}, y = { ...this.latestValues }, b = createDelta();
|
|
3344
|
+
(!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !g;
|
|
3345
|
+
let x = createBox(), S = (_ ? _.source : void 0) !== (this.layout ? this.layout.source : void 0), C = this.getStack(), w = !C || C.members.length <= 1, T = !!(S && !w && this.options.crossfade === !0 && !this.path.some(hasOpacityCrossfade));
|
|
3346
|
+
this.animationProgress = 0;
|
|
3347
|
+
let E;
|
|
3348
|
+
this.mixTargetDelta = (g) => {
|
|
3349
|
+
let _ = g / 1e3;
|
|
3350
|
+
mixAxisDelta(b.x, e.x, _), mixAxisDelta(b.y, e.y, _), this.setTargetDelta(b), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (calcRelativePosition(x, this.layout.layoutBox, this.relativeParent.layout.layoutBox), mixBox(this.relativeTarget, this.relativeTargetOrigin, x, _), E && boxEquals(this.relativeTarget, E) && (this.isProjectionDirty = !1), E ||= createBox(), copyBoxInto(E, this.relativeTarget)), S && (this.animationValues = y, mixValues(y, v, this.latestValues, _, T, w)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = _;
|
|
3351
|
+
}, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
|
|
3352
|
+
}
|
|
3353
|
+
startAnimation(e) {
|
|
3354
|
+
this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation &&= (cancelFrame(this.pendingAnimation), void 0), this.pendingAnimation = frame.update(() => {
|
|
3355
|
+
globalProjectionState.hasAnimatedSinceResize = !0, activeAnimations.layout++, this.motionValue ||= motionValue(0), this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], {
|
|
3356
|
+
...e,
|
|
3357
|
+
velocity: 0,
|
|
3358
|
+
isSync: !0,
|
|
3359
|
+
onUpdate: (g) => {
|
|
3360
|
+
this.mixTargetDelta(g), e.onUpdate && e.onUpdate(g);
|
|
3361
|
+
},
|
|
3362
|
+
onStop: () => {
|
|
3363
|
+
activeAnimations.layout--;
|
|
3364
|
+
},
|
|
3365
|
+
onComplete: () => {
|
|
3366
|
+
activeAnimations.layout--, e.onComplete && e.onComplete(), this.completeAnimation();
|
|
3367
|
+
}
|
|
3368
|
+
}), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
|
|
3369
|
+
});
|
|
3370
|
+
}
|
|
3371
|
+
completeAnimation() {
|
|
3372
|
+
this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
|
|
3373
|
+
let e = this.getStack();
|
|
3374
|
+
e && e.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
|
|
3375
|
+
}
|
|
3376
|
+
finishAnimation() {
|
|
3377
|
+
this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(animationTarget), this.currentAnimation.stop()), this.completeAnimation();
|
|
3378
|
+
}
|
|
3379
|
+
applyTransformsToTarget() {
|
|
3380
|
+
let e = this.getLead(), { targetWithTransforms: g, target: _, layout: v, latestValues: y } = e;
|
|
3381
|
+
if (!(!g || !_ || !v)) {
|
|
3382
|
+
if (this !== e && this.layout && v && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, v.layoutBox)) {
|
|
3383
|
+
_ = this.target || createBox();
|
|
3384
|
+
let g = calcLength(this.layout.layoutBox.x);
|
|
3385
|
+
_.x.min = e.target.x.min, _.x.max = _.x.min + g;
|
|
3386
|
+
let v = calcLength(this.layout.layoutBox.y);
|
|
3387
|
+
_.y.min = e.target.y.min, _.y.max = _.y.min + v;
|
|
3388
|
+
}
|
|
3389
|
+
copyBoxInto(g, _), transformBox(g, y), calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, g, y);
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
registerSharedNode(e, g) {
|
|
3393
|
+
this.sharedNodes.has(e) || this.sharedNodes.set(e, new NodeStack()), this.sharedNodes.get(e).add(g);
|
|
3394
|
+
let _ = g.options.initialPromotionConfig;
|
|
3395
|
+
g.promote({
|
|
3396
|
+
transition: _ ? _.transition : void 0,
|
|
3397
|
+
preserveFollowOpacity: _ && _.shouldPreserveFollowOpacity ? _.shouldPreserveFollowOpacity(g) : void 0
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
isLead() {
|
|
3401
|
+
let e = this.getStack();
|
|
3402
|
+
return e ? e.lead === this : !0;
|
|
3403
|
+
}
|
|
3404
|
+
getLead() {
|
|
3405
|
+
let { layoutId: e } = this.options;
|
|
3406
|
+
return e && this.getStack()?.lead || this;
|
|
3407
|
+
}
|
|
3408
|
+
getPrevLead() {
|
|
3409
|
+
let { layoutId: e } = this.options;
|
|
3410
|
+
return e ? this.getStack()?.prevLead : void 0;
|
|
3411
|
+
}
|
|
3412
|
+
getStack() {
|
|
3413
|
+
let { layoutId: e } = this.options;
|
|
3414
|
+
if (e) return this.root.sharedNodes.get(e);
|
|
3415
|
+
}
|
|
3416
|
+
promote({ needsReset: e, transition: g, preserveFollowOpacity: _ } = {}) {
|
|
3417
|
+
let v = this.getStack();
|
|
3418
|
+
v && v.promote(this, _), e && (this.projectionDelta = void 0, this.needsReset = !0), g && this.setOptions({ transition: g });
|
|
3419
|
+
}
|
|
3420
|
+
relegate() {
|
|
3421
|
+
let e = this.getStack();
|
|
3422
|
+
return e ? e.relegate(this) : !1;
|
|
3423
|
+
}
|
|
3424
|
+
resetSkewAndRotation() {
|
|
3425
|
+
let { visualElement: e } = this.options;
|
|
3426
|
+
if (!e) return;
|
|
3427
|
+
let g = !1, { latestValues: _ } = e;
|
|
3428
|
+
if ((_.z || _.rotate || _.rotateX || _.rotateY || _.rotateZ || _.skewX || _.skewY) && (g = !0), !g) return;
|
|
3429
|
+
let v = {};
|
|
3430
|
+
_.z && resetDistortingTransform("z", e, v, this.animationValues);
|
|
3431
|
+
for (let g = 0; g < transformAxes.length; g++) resetDistortingTransform(`rotate${transformAxes[g]}`, e, v, this.animationValues), resetDistortingTransform(`skew${transformAxes[g]}`, e, v, this.animationValues);
|
|
3432
|
+
for (let g in e.render(), v) e.setStaticValue(g, v[g]), this.animationValues && (this.animationValues[g] = v[g]);
|
|
3433
|
+
e.scheduleRender();
|
|
3434
|
+
}
|
|
3435
|
+
applyProjectionStyles(e, g) {
|
|
3436
|
+
if (!this.instance || this.isSVG) return;
|
|
3437
|
+
if (!this.isVisible) {
|
|
3438
|
+
e.visibility = "hidden";
|
|
3439
|
+
return;
|
|
3440
|
+
}
|
|
3441
|
+
let _ = this.getTransformTemplate();
|
|
3442
|
+
if (this.needsReset) {
|
|
3443
|
+
this.needsReset = !1, e.visibility = "", e.opacity = "", e.pointerEvents = resolveMotionValue(g?.pointerEvents) || "", e.transform = _ ? _(this.latestValues, "") : "none";
|
|
3444
|
+
return;
|
|
3445
|
+
}
|
|
3446
|
+
let v = this.getLead();
|
|
3447
|
+
if (!this.projectionDelta || !this.layout || !v.target) {
|
|
3448
|
+
this.options.layoutId && (e.opacity = this.latestValues.opacity === void 0 ? 1 : this.latestValues.opacity, e.pointerEvents = resolveMotionValue(g?.pointerEvents) || ""), this.hasProjected && !hasTransform(this.latestValues) && (e.transform = _ ? _({}, "") : "none", this.hasProjected = !1);
|
|
3449
|
+
return;
|
|
3450
|
+
}
|
|
3451
|
+
e.visibility = "";
|
|
3452
|
+
let y = v.animationValues || v.latestValues;
|
|
3453
|
+
this.applyTransformsToTarget();
|
|
3454
|
+
let b = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, y);
|
|
3455
|
+
_ && (b = _(y, b)), e.transform = b;
|
|
3456
|
+
let { x, y: S } = this.projectionDelta;
|
|
3457
|
+
for (let g in e.transformOrigin = `${x.origin * 100}% ${S.origin * 100}% 0`, v.animationValues ? e.opacity = v === this ? y.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : y.opacityExit : e.opacity = v === this ? y.opacity === void 0 ? "" : y.opacity : y.opacityExit === void 0 ? 0 : y.opacityExit, scaleCorrectors) {
|
|
3458
|
+
if (y[g] === void 0) continue;
|
|
3459
|
+
let { correct: _, applyTo: x, isCSSVariable: S } = scaleCorrectors[g], C = b === "none" ? y[g] : _(y[g], v);
|
|
3460
|
+
if (x) {
|
|
3461
|
+
let g = x.length;
|
|
3462
|
+
for (let _ = 0; _ < g; _++) e[x[_]] = C;
|
|
3463
|
+
} else S ? this.options.visualElement.renderState.vars[g] = C : e[g] = C;
|
|
3464
|
+
}
|
|
3465
|
+
this.options.layoutId && (e.pointerEvents = v === this ? resolveMotionValue(g?.pointerEvents) || "" : "none");
|
|
3466
|
+
}
|
|
3467
|
+
clearSnapshot() {
|
|
3468
|
+
this.resumeFrom = this.snapshot = void 0;
|
|
3469
|
+
}
|
|
3470
|
+
resetTree() {
|
|
3471
|
+
this.root.nodes.forEach((e) => e.currentAnimation?.stop()), this.root.nodes.forEach(clearMeasurements), this.root.sharedNodes.clear();
|
|
3472
|
+
}
|
|
3473
|
+
};
|
|
3474
|
+
}
|
|
3475
|
+
function updateLayout(e) {
|
|
3476
|
+
e.updateLayout();
|
|
3477
|
+
}
|
|
3478
|
+
function notifyLayoutUpdate(e) {
|
|
3479
|
+
let g = e.resumeFrom?.snapshot || e.snapshot;
|
|
3480
|
+
if (e.isLead() && e.layout && g && e.hasListeners("didUpdate")) {
|
|
3481
|
+
let { layoutBox: _, measuredBox: v } = e.layout, { animationType: y } = e.options, b = g.source !== e.layout.source;
|
|
3482
|
+
y === "size" ? eachAxis((e) => {
|
|
3483
|
+
let v = b ? g.measuredBox[e] : g.layoutBox[e], y = calcLength(v);
|
|
3484
|
+
v.min = _[e].min, v.max = v.min + y;
|
|
3485
|
+
}) : shouldAnimatePositionOnly(y, g.layoutBox, _) && eachAxis((v) => {
|
|
3486
|
+
let y = b ? g.measuredBox[v] : g.layoutBox[v], x = calcLength(_[v]);
|
|
3487
|
+
y.max = y.min + x, e.relativeTarget && !e.currentAnimation && (e.isProjectionDirty = !0, e.relativeTarget[v].max = e.relativeTarget[v].min + x);
|
|
3488
|
+
});
|
|
3489
|
+
let x = createDelta();
|
|
3490
|
+
calcBoxDelta(x, _, g.layoutBox);
|
|
3491
|
+
let S = createDelta();
|
|
3492
|
+
b ? calcBoxDelta(S, e.applyTransform(v, !0), g.measuredBox) : calcBoxDelta(S, _, g.layoutBox);
|
|
3493
|
+
let C = !isDeltaZero(x), w = !1;
|
|
3494
|
+
if (!e.resumeFrom) {
|
|
3495
|
+
let v = e.getClosestProjectingParent();
|
|
3496
|
+
if (v && !v.resumeFrom) {
|
|
3497
|
+
let { snapshot: y, layout: b } = v;
|
|
3498
|
+
if (y && b) {
|
|
3499
|
+
let x = createBox();
|
|
3500
|
+
calcRelativePosition(x, g.layoutBox, y.layoutBox);
|
|
3501
|
+
let S = createBox();
|
|
3502
|
+
calcRelativePosition(S, _, b.layoutBox), boxEqualsRounded(x, S) || (w = !0), v.options.layoutRoot && (e.relativeTarget = S, e.relativeTargetOrigin = x, e.relativeParent = v);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
e.notifyListeners("didUpdate", {
|
|
3507
|
+
layout: _,
|
|
3508
|
+
snapshot: g,
|
|
3509
|
+
delta: S,
|
|
3510
|
+
layoutDelta: x,
|
|
3511
|
+
hasLayoutChanged: C,
|
|
3512
|
+
hasRelativeLayoutChanged: w
|
|
3513
|
+
});
|
|
3514
|
+
} else if (e.isLead()) {
|
|
3515
|
+
let { onExitComplete: g } = e.options;
|
|
3516
|
+
g && g();
|
|
3517
|
+
}
|
|
3518
|
+
e.options.transition = void 0;
|
|
3519
|
+
}
|
|
3520
|
+
function propagateDirtyNodes(e) {
|
|
3521
|
+
statsBuffer.value && metrics.nodes++, e.parent && (e.isProjecting() || (e.isProjectionDirty = e.parent.isProjectionDirty), e.isSharedProjectionDirty ||= !!(e.isProjectionDirty || e.parent.isProjectionDirty || e.parent.isSharedProjectionDirty), e.isTransformDirty ||= e.parent.isTransformDirty);
|
|
3522
|
+
}
|
|
3523
|
+
function cleanDirtyNodes(e) {
|
|
3524
|
+
e.isProjectionDirty = e.isSharedProjectionDirty = e.isTransformDirty = !1;
|
|
3525
|
+
}
|
|
3526
|
+
function clearSnapshot(e) {
|
|
3527
|
+
e.clearSnapshot();
|
|
3528
|
+
}
|
|
3529
|
+
function clearMeasurements(e) {
|
|
3530
|
+
e.clearMeasurements();
|
|
3531
|
+
}
|
|
3532
|
+
function clearIsLayoutDirty(e) {
|
|
3533
|
+
e.isLayoutDirty = !1;
|
|
3534
|
+
}
|
|
3535
|
+
function resetTransformStyle(e) {
|
|
3536
|
+
let { visualElement: g } = e.options;
|
|
3537
|
+
g && g.getProps().onBeforeLayoutMeasure && g.notify("BeforeLayoutMeasure"), e.resetTransform();
|
|
3538
|
+
}
|
|
3539
|
+
function finishAnimation(e) {
|
|
3540
|
+
e.finishAnimation(), e.targetDelta = e.relativeTarget = e.target = void 0, e.isProjectionDirty = !0;
|
|
3541
|
+
}
|
|
3542
|
+
function resolveTargetDelta(e) {
|
|
3543
|
+
e.resolveTargetDelta();
|
|
3544
|
+
}
|
|
3545
|
+
function calcProjection(e) {
|
|
3546
|
+
e.calcProjection();
|
|
3547
|
+
}
|
|
3548
|
+
function resetSkewAndRotation(e) {
|
|
3549
|
+
e.resetSkewAndRotation();
|
|
3550
|
+
}
|
|
3551
|
+
function removeLeadSnapshots(e) {
|
|
3552
|
+
e.removeLeadSnapshot();
|
|
3553
|
+
}
|
|
3554
|
+
function mixAxisDelta(e, g, _) {
|
|
3555
|
+
e.translate = mixNumber(g.translate, 0, _), e.scale = mixNumber(g.scale, 1, _), e.origin = g.origin, e.originPoint = g.originPoint;
|
|
3556
|
+
}
|
|
3557
|
+
function mixAxis(e, g, _, v) {
|
|
3558
|
+
e.min = mixNumber(g.min, _.min, v), e.max = mixNumber(g.max, _.max, v);
|
|
3559
|
+
}
|
|
3560
|
+
function mixBox(e, g, _, v) {
|
|
3561
|
+
mixAxis(e.x, g.x, _.x, v), mixAxis(e.y, g.y, _.y, v);
|
|
3562
|
+
}
|
|
3563
|
+
function hasOpacityCrossfade(e) {
|
|
3564
|
+
return e.animationValues && e.animationValues.opacityExit !== void 0;
|
|
3565
|
+
}
|
|
3566
|
+
var defaultLayoutTransition = {
|
|
3567
|
+
duration: .45,
|
|
3568
|
+
ease: [
|
|
3569
|
+
.4,
|
|
3570
|
+
0,
|
|
3571
|
+
.1,
|
|
3572
|
+
1
|
|
3573
|
+
]
|
|
3574
|
+
}, userAgentContains = (e) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(e), roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop;
|
|
3575
|
+
function roundAxis(e) {
|
|
3576
|
+
e.min = roundPoint(e.min), e.max = roundPoint(e.max);
|
|
3577
|
+
}
|
|
3578
|
+
function roundBox(e) {
|
|
3579
|
+
roundAxis(e.x), roundAxis(e.y);
|
|
3580
|
+
}
|
|
3581
|
+
function shouldAnimatePositionOnly(e, g, _) {
|
|
3582
|
+
return e === "position" || e === "preserve-aspect" && !isNear(aspectRatio(g), aspectRatio(_), .2);
|
|
3583
|
+
}
|
|
3584
|
+
function checkNodeWasScrollRoot(e) {
|
|
3585
|
+
return e !== e.root && e.scroll?.wasRoot;
|
|
3586
|
+
}
|
|
3587
|
+
var DocumentProjectionNode = createProjectionNode$1({
|
|
3588
|
+
attachResizeListener: (e, g) => addDomEvent(e, "resize", g),
|
|
3589
|
+
measureScroll: () => ({
|
|
3590
|
+
x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0,
|
|
3591
|
+
y: document.documentElement.scrollTop || document.body?.scrollTop || 0
|
|
3592
|
+
}),
|
|
3593
|
+
checkIsScrollRoot: () => !0
|
|
3594
|
+
}), rootProjectionNode = { current: void 0 }, HTMLProjectionNode = createProjectionNode$1({
|
|
3595
|
+
measureScroll: (e) => ({
|
|
3596
|
+
x: e.scrollLeft,
|
|
3597
|
+
y: e.scrollTop
|
|
3598
|
+
}),
|
|
3599
|
+
defaultParent: () => {
|
|
3600
|
+
if (!rootProjectionNode.current) {
|
|
3601
|
+
let e = new DocumentProjectionNode({});
|
|
3602
|
+
e.mount(window), e.setOptions({ layoutScroll: !0 }), rootProjectionNode.current = e;
|
|
3603
|
+
}
|
|
3604
|
+
return rootProjectionNode.current;
|
|
3605
|
+
},
|
|
3606
|
+
resetTransform: (e, g) => {
|
|
3607
|
+
e.style.transform = g === void 0 ? "none" : g;
|
|
3608
|
+
},
|
|
3609
|
+
checkIsScrollRoot: (e) => window.getComputedStyle(e).position === "fixed"
|
|
3610
|
+
}), MotionConfigContext = createContext({
|
|
3611
|
+
transformPagePoint: (e) => e,
|
|
3612
|
+
isStatic: !1,
|
|
3613
|
+
reducedMotion: "never"
|
|
3614
|
+
});
|
|
3615
|
+
function usePresence(e = !0) {
|
|
3616
|
+
let g = useContext(PresenceContext);
|
|
3617
|
+
if (g === null) return [!0, null];
|
|
3618
|
+
let { isPresent: _, onExitComplete: v, register: y } = g, w = useId();
|
|
3619
|
+
useEffect(() => {
|
|
3620
|
+
if (e) return y(w);
|
|
3621
|
+
}, [e]);
|
|
3622
|
+
let T = useCallback(() => e && v && v(w), [
|
|
3623
|
+
w,
|
|
3624
|
+
v,
|
|
3625
|
+
e
|
|
3626
|
+
]);
|
|
3627
|
+
return !_ && v ? [!1, T] : [!0];
|
|
3628
|
+
}
|
|
3629
|
+
var LazyContext = createContext({ strict: !1 }), featureProps = {
|
|
3630
|
+
animation: [
|
|
3631
|
+
"animate",
|
|
3632
|
+
"variants",
|
|
3633
|
+
"whileHover",
|
|
3634
|
+
"whileTap",
|
|
3635
|
+
"exit",
|
|
3636
|
+
"whileInView",
|
|
3637
|
+
"whileFocus",
|
|
3638
|
+
"whileDrag"
|
|
3639
|
+
],
|
|
3640
|
+
exit: ["exit"],
|
|
3641
|
+
drag: ["drag", "dragControls"],
|
|
3642
|
+
focus: ["whileFocus"],
|
|
3643
|
+
hover: [
|
|
3644
|
+
"whileHover",
|
|
3645
|
+
"onHoverStart",
|
|
3646
|
+
"onHoverEnd"
|
|
3647
|
+
],
|
|
3648
|
+
tap: [
|
|
3649
|
+
"whileTap",
|
|
3650
|
+
"onTap",
|
|
3651
|
+
"onTapStart",
|
|
3652
|
+
"onTapCancel"
|
|
3653
|
+
],
|
|
3654
|
+
pan: [
|
|
3655
|
+
"onPan",
|
|
3656
|
+
"onPanStart",
|
|
3657
|
+
"onPanSessionStart",
|
|
3658
|
+
"onPanEnd"
|
|
3659
|
+
],
|
|
3660
|
+
inView: [
|
|
3661
|
+
"whileInView",
|
|
3662
|
+
"onViewportEnter",
|
|
3663
|
+
"onViewportLeave"
|
|
3664
|
+
],
|
|
3665
|
+
layout: ["layout", "layoutId"]
|
|
3666
|
+
}, isInitialized = !1;
|
|
3667
|
+
function initFeatureDefinitions() {
|
|
3668
|
+
if (isInitialized) return;
|
|
3669
|
+
let e = {};
|
|
3670
|
+
for (let g in featureProps) e[g] = { isEnabled: (e) => featureProps[g].some((g) => !!e[g]) };
|
|
3671
|
+
setFeatureDefinitions(e), isInitialized = !0;
|
|
3672
|
+
}
|
|
3673
|
+
function getInitializedFeatureDefinitions() {
|
|
3674
|
+
return initFeatureDefinitions(), getFeatureDefinitions();
|
|
3675
|
+
}
|
|
3676
|
+
function loadFeatures(e) {
|
|
3677
|
+
let g = getInitializedFeatureDefinitions();
|
|
3678
|
+
for (let _ in e) g[_] = {
|
|
3679
|
+
...g[_],
|
|
3680
|
+
...e[_]
|
|
3681
|
+
};
|
|
3682
|
+
setFeatureDefinitions(g);
|
|
3683
|
+
}
|
|
3684
|
+
var validMotionProps = new Set(/* @__PURE__ */ "animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport".split("."));
|
|
3685
|
+
function isValidMotionProp(e) {
|
|
3686
|
+
return e.startsWith("while") || e.startsWith("drag") && e !== "draggable" || e.startsWith("layout") || e.startsWith("onTap") || e.startsWith("onPan") || e.startsWith("onLayout") || validMotionProps.has(e);
|
|
3687
|
+
}
|
|
3688
|
+
var is_prop_valid_framer_motion_exports = /* @__PURE__ */ __export({ default: () => is_prop_valid_framer_motion_default }), is_prop_valid_framer_motion_default, init_is_prop_valid_framer_motion = __esmMin((() => {
|
|
3689
|
+
throw is_prop_valid_framer_motion_default = {}, Error("Could not resolve \"@emotion/is-prop-valid\" imported by \"framer-motion\". Is it installed?");
|
|
3690
|
+
})), shouldForward = (e) => !isValidMotionProp(e);
|
|
3691
|
+
function loadExternalIsValidProp(e) {
|
|
3692
|
+
typeof e == "function" && (shouldForward = (g) => g.startsWith("on") ? !isValidMotionProp(g) : e(g));
|
|
3693
|
+
}
|
|
3694
|
+
try {
|
|
3695
|
+
loadExternalIsValidProp((init_is_prop_valid_framer_motion(), __toCommonJS(is_prop_valid_framer_motion_exports)).default);
|
|
3696
|
+
} catch {}
|
|
3697
|
+
function filterProps(e, g, _) {
|
|
3698
|
+
let v = {};
|
|
3699
|
+
for (let y in e) y === "values" && typeof e.values == "object" || (shouldForward(y) || _ === !0 && isValidMotionProp(y) || !g && !isValidMotionProp(y) || e.draggable && y.startsWith("onDrag")) && (v[y] = e[y]);
|
|
3700
|
+
return v;
|
|
3701
|
+
}
|
|
3702
|
+
var MotionContext = /* @__PURE__ */ createContext({});
|
|
3703
|
+
function getCurrentTreeVariants(e, g) {
|
|
3704
|
+
if (isControllingVariants(e)) {
|
|
3705
|
+
let { initial: g, animate: _ } = e;
|
|
3706
|
+
return {
|
|
3707
|
+
initial: g === !1 || isVariantLabel(g) ? g : void 0,
|
|
3708
|
+
animate: isVariantLabel(_) ? _ : void 0
|
|
3709
|
+
};
|
|
3710
|
+
}
|
|
3711
|
+
return e.inherit === !1 ? {} : g;
|
|
3712
|
+
}
|
|
3713
|
+
function useCreateMotionContext(e) {
|
|
3714
|
+
let { initial: g, animate: _ } = getCurrentTreeVariants(e, useContext(MotionContext));
|
|
3715
|
+
return useMemo(() => ({
|
|
3716
|
+
initial: g,
|
|
3717
|
+
animate: _
|
|
3718
|
+
}), [variantLabelsAsDependency(g), variantLabelsAsDependency(_)]);
|
|
3719
|
+
}
|
|
3720
|
+
function variantLabelsAsDependency(e) {
|
|
3721
|
+
return Array.isArray(e) ? e.join(" ") : e;
|
|
3722
|
+
}
|
|
3723
|
+
var createHtmlRenderState = () => ({
|
|
3724
|
+
style: {},
|
|
3725
|
+
transform: {},
|
|
3726
|
+
transformOrigin: {},
|
|
3727
|
+
vars: {}
|
|
3728
|
+
});
|
|
3729
|
+
function copyRawValuesOnly(e, g, _) {
|
|
3730
|
+
for (let v in g) !isMotionValue(g[v]) && !isForcedMotionValue(v, _) && (e[v] = g[v]);
|
|
3731
|
+
}
|
|
3732
|
+
function useInitialMotionValues({ transformTemplate: e }, g) {
|
|
3733
|
+
return useMemo(() => {
|
|
3734
|
+
let _ = createHtmlRenderState();
|
|
3735
|
+
return buildHTMLStyles(_, g, e), Object.assign({}, _.vars, _.style);
|
|
3736
|
+
}, [g]);
|
|
3737
|
+
}
|
|
3738
|
+
function useStyle(e, g) {
|
|
3739
|
+
let _ = e.style || {}, v = {};
|
|
3740
|
+
return copyRawValuesOnly(v, _, e), Object.assign(v, useInitialMotionValues(e, g)), v;
|
|
3741
|
+
}
|
|
3742
|
+
function useHTMLProps(e, g) {
|
|
3743
|
+
let _ = {}, v = useStyle(e, g);
|
|
3744
|
+
return e.drag && e.dragListener !== !1 && (_.draggable = !1, v.userSelect = v.WebkitUserSelect = v.WebkitTouchCallout = "none", v.touchAction = e.drag === !0 ? "none" : `pan-${e.drag === "x" ? "y" : "x"}`), e.tabIndex === void 0 && (e.onTap || e.onTapStart || e.whileTap) && (_.tabIndex = 0), _.style = v, _;
|
|
3745
|
+
}
|
|
3746
|
+
var createSvgRenderState = () => ({
|
|
3747
|
+
...createHtmlRenderState(),
|
|
3748
|
+
attrs: {}
|
|
3749
|
+
});
|
|
3750
|
+
function useSVGProps(e, g, _, v) {
|
|
3751
|
+
let y = useMemo(() => {
|
|
3752
|
+
let _ = createSvgRenderState();
|
|
3753
|
+
return buildSVGAttrs(_, g, isSVGTag(v), e.transformTemplate, e.style), {
|
|
3754
|
+
..._.attrs,
|
|
3755
|
+
style: { ..._.style }
|
|
3756
|
+
};
|
|
3757
|
+
}, [g]);
|
|
3758
|
+
if (e.style) {
|
|
3759
|
+
let g = {};
|
|
3760
|
+
copyRawValuesOnly(g, e.style, e), y.style = {
|
|
3761
|
+
...g,
|
|
3762
|
+
...y.style
|
|
3763
|
+
};
|
|
3764
|
+
}
|
|
3765
|
+
return y;
|
|
3766
|
+
}
|
|
3767
|
+
var lowercaseSVGElements = [
|
|
3768
|
+
"animate",
|
|
3769
|
+
"circle",
|
|
3770
|
+
"defs",
|
|
3771
|
+
"desc",
|
|
3772
|
+
"ellipse",
|
|
3773
|
+
"g",
|
|
3774
|
+
"image",
|
|
3775
|
+
"line",
|
|
3776
|
+
"filter",
|
|
3777
|
+
"marker",
|
|
3778
|
+
"mask",
|
|
3779
|
+
"metadata",
|
|
3780
|
+
"path",
|
|
3781
|
+
"pattern",
|
|
3782
|
+
"polygon",
|
|
3783
|
+
"polyline",
|
|
3784
|
+
"rect",
|
|
3785
|
+
"stop",
|
|
3786
|
+
"switch",
|
|
3787
|
+
"symbol",
|
|
3788
|
+
"svg",
|
|
3789
|
+
"text",
|
|
3790
|
+
"tspan",
|
|
3791
|
+
"use",
|
|
3792
|
+
"view"
|
|
3793
|
+
];
|
|
3794
|
+
function isSVGComponent(e) {
|
|
3795
|
+
return typeof e != "string" || e.includes("-") ? !1 : !!(lowercaseSVGElements.indexOf(e) > -1 || /[A-Z]/u.test(e));
|
|
3796
|
+
}
|
|
3797
|
+
function useRender(e, _, y, { latestValues: b }, x, S = !1, C) {
|
|
3798
|
+
let w = (C ?? isSVGComponent(e) ? useSVGProps : useHTMLProps)(_, b, x, e), T = filterProps(_, typeof e == "string", S), D = e === Fragment ? {} : {
|
|
3799
|
+
...T,
|
|
3800
|
+
...w,
|
|
3801
|
+
ref: y
|
|
3802
|
+
}, { children: O } = _, k = useMemo(() => isMotionValue(O) ? O.get() : O, [O]);
|
|
3803
|
+
return createElement(e, {
|
|
3804
|
+
...D,
|
|
3805
|
+
children: k
|
|
3806
|
+
});
|
|
3807
|
+
}
|
|
3808
|
+
function makeState({ scrapeMotionValuesFromProps: e, createRenderState: g }, _, v, y) {
|
|
3809
|
+
return {
|
|
3810
|
+
latestValues: makeLatestValues(_, v, y, e),
|
|
3811
|
+
renderState: g()
|
|
3812
|
+
};
|
|
3813
|
+
}
|
|
3814
|
+
function makeLatestValues(e, g, _, v) {
|
|
3815
|
+
let y = {}, b = v(e, {});
|
|
3816
|
+
for (let e in b) y[e] = resolveMotionValue(b[e]);
|
|
3817
|
+
let { initial: x, animate: S } = e, C = isControllingVariants(e), w = isVariantNode(e);
|
|
3818
|
+
g && w && !C && e.inherit !== !1 && (x === void 0 && (x = g.initial), S === void 0 && (S = g.animate));
|
|
3819
|
+
let T = _ ? _.initial === !1 : !1;
|
|
3820
|
+
T ||= x === !1;
|
|
3821
|
+
let E = T ? S : x;
|
|
3822
|
+
if (E && typeof E != "boolean" && !isAnimationControls(E)) {
|
|
3823
|
+
let g = Array.isArray(E) ? E : [E];
|
|
3824
|
+
for (let _ = 0; _ < g.length; _++) {
|
|
3825
|
+
let v = resolveVariantFromProps(e, g[_]);
|
|
3826
|
+
if (v) {
|
|
3827
|
+
let { transitionEnd: e, transition: g, ..._ } = v;
|
|
3828
|
+
for (let e in _) {
|
|
3829
|
+
let g = _[e];
|
|
3830
|
+
if (Array.isArray(g)) {
|
|
3831
|
+
let e = T ? g.length - 1 : 0;
|
|
3832
|
+
g = g[e];
|
|
3833
|
+
}
|
|
3834
|
+
g !== null && (y[e] = g);
|
|
3835
|
+
}
|
|
3836
|
+
for (let g in e) y[g] = e[g];
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
return y;
|
|
3841
|
+
}
|
|
3842
|
+
var makeUseVisualState = (e) => (g, _) => {
|
|
3843
|
+
let v = useContext(MotionContext), y = useContext(PresenceContext), b = () => makeState(e, g, v, y);
|
|
3844
|
+
return _ ? b() : useConstant(b);
|
|
3845
|
+
}, useHTMLVisualState = /* @__PURE__ */ makeUseVisualState({
|
|
3846
|
+
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
|
|
3847
|
+
createRenderState: createHtmlRenderState
|
|
3848
|
+
}), useSVGVisualState = /* @__PURE__ */ makeUseVisualState({
|
|
3849
|
+
scrapeMotionValuesFromProps,
|
|
3850
|
+
createRenderState: createSvgRenderState
|
|
3851
|
+
}), motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
3852
|
+
function useMotionRef(e, g, _) {
|
|
3853
|
+
let v = useRef(_);
|
|
3854
|
+
useInsertionEffect(() => {
|
|
3855
|
+
v.current = _;
|
|
3856
|
+
});
|
|
3857
|
+
let y = useRef(null);
|
|
3858
|
+
return useCallback((_) => {
|
|
3859
|
+
_ && e.onMount?.(_), g && (_ ? g.mount(_) : g.unmount());
|
|
3860
|
+
let b = v.current;
|
|
3861
|
+
if (typeof b == "function") if (_) {
|
|
3862
|
+
let e = b(_);
|
|
3863
|
+
typeof e == "function" && (y.current = e);
|
|
3864
|
+
} else y.current ? (y.current(), y.current = null) : b(_);
|
|
3865
|
+
else b && (b.current = _);
|
|
3866
|
+
}, [g]);
|
|
3867
|
+
}
|
|
3868
|
+
var SwitchLayoutGroupContext = createContext({});
|
|
3869
|
+
function isRefObject(e) {
|
|
3870
|
+
return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "current");
|
|
3871
|
+
}
|
|
3872
|
+
function useVisualElement(e, g, _, v, y, b) {
|
|
3873
|
+
let { visualElement: C } = useContext(MotionContext), T = useContext(LazyContext), E = useContext(PresenceContext), O = useContext(MotionConfigContext), k = O.reducedMotion, A = O.skipAnimations, j = useRef(null), M = useRef(!1);
|
|
3874
|
+
v ||= T.renderer, !j.current && v && (j.current = v(e, {
|
|
3875
|
+
visualState: g,
|
|
3876
|
+
parent: C,
|
|
3877
|
+
props: _,
|
|
3878
|
+
presenceContext: E,
|
|
3879
|
+
blockInitialAnimation: E ? E.initial === !1 : !1,
|
|
3880
|
+
reducedMotionConfig: k,
|
|
3881
|
+
skipAnimations: A,
|
|
3882
|
+
isSVG: b
|
|
3883
|
+
}), M.current && j.current && (j.current.manuallyAnimateOnMount = !0));
|
|
3884
|
+
let N = j.current, P = useContext(SwitchLayoutGroupContext);
|
|
3885
|
+
N && !N.projection && y && (N.type === "html" || N.type === "svg") && createProjectionNode(j.current, _, y, P);
|
|
3886
|
+
let F = useRef(!1);
|
|
3887
|
+
useInsertionEffect(() => {
|
|
3888
|
+
N && F.current && N.update(_, E);
|
|
3889
|
+
});
|
|
3890
|
+
let I = _[optimizedAppearDataAttribute], L = useRef(!!I && !window.MotionHandoffIsComplete?.(I) && window.MotionHasOptimisedAnimation?.(I));
|
|
3891
|
+
return useIsomorphicLayoutEffect(() => {
|
|
3892
|
+
M.current = !0, N && (F.current = !0, window.MotionIsMounted = !0, N.updateFeatures(), N.scheduleRenderMicrotask(), L.current && N.animationState && N.animationState.animateChanges());
|
|
3893
|
+
}), useEffect(() => {
|
|
3894
|
+
N && (!L.current && N.animationState && N.animationState.animateChanges(), L.current &&= (queueMicrotask(() => {
|
|
3895
|
+
window.MotionHandoffMarkAsComplete?.(I);
|
|
3896
|
+
}), !1), N.enteringChildren = void 0);
|
|
3897
|
+
}), N;
|
|
3898
|
+
}
|
|
3899
|
+
function createProjectionNode(e, g, _, v) {
|
|
3900
|
+
let { layoutId: y, layout: b, drag: x, dragConstraints: S, layoutScroll: C, layoutRoot: w, layoutCrossfade: T } = g;
|
|
3901
|
+
e.projection = new _(e.latestValues, g["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(e.parent)), e.projection.setOptions({
|
|
3902
|
+
layoutId: y,
|
|
3903
|
+
layout: b,
|
|
3904
|
+
alwaysMeasureLayout: !!x || S && isRefObject(S),
|
|
3905
|
+
visualElement: e,
|
|
3906
|
+
animationType: typeof b == "string" ? b : "both",
|
|
3907
|
+
initialPromotionConfig: v,
|
|
3908
|
+
crossfade: T,
|
|
3909
|
+
layoutScroll: C,
|
|
3910
|
+
layoutRoot: w
|
|
3911
|
+
});
|
|
3912
|
+
}
|
|
3913
|
+
function getClosestProjectingNode(e) {
|
|
3914
|
+
if (e) return e.options.allowProjection === !1 ? getClosestProjectingNode(e.parent) : e.projection;
|
|
3915
|
+
}
|
|
3916
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
3917
|
+
function createMotionComponent(e, { forwardMotionProps: g = !1, type: _ } = {}, v, b) {
|
|
3918
|
+
v && loadFeatures(v);
|
|
3919
|
+
let S = _ ? _ === "svg" : isSVGComponent(e), C = S ? useSVGVisualState : useHTMLVisualState;
|
|
3920
|
+
function w(_, y) {
|
|
3921
|
+
let w, T = {
|
|
3922
|
+
...useContext(MotionConfigContext),
|
|
3923
|
+
..._,
|
|
3924
|
+
layoutId: useLayoutId(_)
|
|
3925
|
+
}, { isStatic: E } = T, D = useCreateMotionContext(_), O = C(_, E);
|
|
3926
|
+
if (!E && isBrowser) {
|
|
3927
|
+
useStrictMode(T, v);
|
|
3928
|
+
let g = getProjectionFunctionality(T);
|
|
3929
|
+
w = g.MeasureLayout, D.visualElement = useVisualElement(e, O, T, b, g.ProjectionNode, S);
|
|
3930
|
+
}
|
|
3931
|
+
return (0, import_jsx_runtime.jsxs)(MotionContext.Provider, {
|
|
3932
|
+
value: D,
|
|
3933
|
+
children: [w && D.visualElement ? (0, import_jsx_runtime.jsx)(w, {
|
|
3934
|
+
visualElement: D.visualElement,
|
|
3935
|
+
...T
|
|
3936
|
+
}) : null, useRender(e, _, useMotionRef(O, D.visualElement, y), O, E, g, S)]
|
|
3937
|
+
});
|
|
3938
|
+
}
|
|
3939
|
+
w.displayName = `motion.${typeof e == "string" ? e : `create(${e.displayName ?? e.name ?? ""})`}`;
|
|
3940
|
+
let T = forwardRef(w);
|
|
3941
|
+
return T[motionComponentSymbol] = e, T;
|
|
3942
|
+
}
|
|
3943
|
+
function useLayoutId({ layoutId: e }) {
|
|
3944
|
+
let g = useContext(LayoutGroupContext).id;
|
|
3945
|
+
return g && e !== void 0 ? g + "-" + e : e;
|
|
3946
|
+
}
|
|
3947
|
+
function useStrictMode(e, g) {
|
|
3948
|
+
let _ = useContext(LazyContext).strict;
|
|
3949
|
+
if (process.env.NODE_ENV !== "production" && g && _) {
|
|
3950
|
+
let g = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
|
|
3951
|
+
e.ignoreStrict ? warning(!1, g, "lazy-strict-mode") : invariant(!1, g, "lazy-strict-mode");
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
function getProjectionFunctionality(e) {
|
|
3955
|
+
let { drag: g, layout: _ } = getInitializedFeatureDefinitions();
|
|
3956
|
+
if (!g && !_) return {};
|
|
3957
|
+
let v = {
|
|
3958
|
+
...g,
|
|
3959
|
+
..._
|
|
3960
|
+
};
|
|
3961
|
+
return {
|
|
3962
|
+
MeasureLayout: g?.isEnabled(e) || _?.isEnabled(e) ? v.MeasureLayout : void 0,
|
|
3963
|
+
ProjectionNode: v.ProjectionNode
|
|
3964
|
+
};
|
|
3965
|
+
}
|
|
3966
|
+
function createMotionProxy(e, g) {
|
|
3967
|
+
if (typeof Proxy > "u") return createMotionComponent;
|
|
3968
|
+
let _ = /* @__PURE__ */ new Map(), v = (_, v) => createMotionComponent(_, v, e, g);
|
|
3969
|
+
return new Proxy((e, g) => (process.env.NODE_ENV !== "production" && warnOnce(!1, "motion() is deprecated. Use motion.create() instead."), v(e, g)), { get: (y, b) => b === "create" ? v : (_.has(b) || _.set(b, createMotionComponent(b, void 0, e, g)), _.get(b)) });
|
|
3970
|
+
}
|
|
3971
|
+
var createDomVisualElement = (e, _) => _.isSVG ?? isSVGComponent(e) ? new SVGVisualElement(_) : new HTMLVisualElement(_, { allowProjection: e !== Fragment }), AnimationFeature = class extends Feature {
|
|
3972
|
+
constructor(e) {
|
|
3973
|
+
super(e), e.animationState ||= createAnimationState(e);
|
|
3974
|
+
}
|
|
3975
|
+
updateAnimationControlsSubscription() {
|
|
3976
|
+
let { animate: e } = this.node.getProps();
|
|
3977
|
+
isAnimationControls(e) && (this.unmountControls = e.subscribe(this.node));
|
|
3978
|
+
}
|
|
3979
|
+
mount() {
|
|
3980
|
+
this.updateAnimationControlsSubscription();
|
|
3981
|
+
}
|
|
3982
|
+
update() {
|
|
3983
|
+
let { animate: e } = this.node.getProps(), { animate: g } = this.node.prevProps || {};
|
|
3984
|
+
e !== g && this.updateAnimationControlsSubscription();
|
|
3985
|
+
}
|
|
3986
|
+
unmount() {
|
|
3987
|
+
this.node.animationState.reset(), this.unmountControls?.();
|
|
3988
|
+
}
|
|
3989
|
+
}, id = 0, animations = {
|
|
3990
|
+
animation: { Feature: AnimationFeature },
|
|
3991
|
+
exit: { Feature: class extends Feature {
|
|
3992
|
+
constructor() {
|
|
3993
|
+
super(...arguments), this.id = id++;
|
|
3994
|
+
}
|
|
3995
|
+
update() {
|
|
3996
|
+
if (!this.node.presenceContext) return;
|
|
3997
|
+
let { isPresent: e, onExitComplete: g } = this.node.presenceContext, { isPresent: _ } = this.node.prevPresenceContext || {};
|
|
3998
|
+
if (!this.node.animationState || e === _) return;
|
|
3999
|
+
let v = this.node.animationState.setActive("exit", !e);
|
|
4000
|
+
g && !e && v.then(() => {
|
|
4001
|
+
g(this.id);
|
|
4002
|
+
});
|
|
4003
|
+
}
|
|
4004
|
+
mount() {
|
|
4005
|
+
let { register: e, onExitComplete: g } = this.node.presenceContext || {};
|
|
4006
|
+
g && g(this.id), e && (this.unmount = e(this.id));
|
|
4007
|
+
}
|
|
4008
|
+
unmount() {}
|
|
4009
|
+
} }
|
|
4010
|
+
};
|
|
4011
|
+
function extractEventInfo(e) {
|
|
4012
|
+
return { point: {
|
|
4013
|
+
x: e.pageX,
|
|
4014
|
+
y: e.pageY
|
|
4015
|
+
} };
|
|
4016
|
+
}
|
|
4017
|
+
var addPointerInfo = (e) => (g) => isPrimaryPointer(g) && e(g, extractEventInfo(g));
|
|
4018
|
+
function addPointerEvent(e, g, _, v) {
|
|
4019
|
+
return addDomEvent(e, g, addPointerInfo(_), v);
|
|
4020
|
+
}
|
|
4021
|
+
var getContextWindow = ({ current: e }) => e ? e.ownerDocument.defaultView : null, distance = (e, g) => Math.abs(e - g);
|
|
4022
|
+
function distance2D(e, g) {
|
|
4023
|
+
let _ = distance(e.x, g.x), v = distance(e.y, g.y);
|
|
4024
|
+
return Math.sqrt(_ ** 2 + v ** 2);
|
|
4025
|
+
}
|
|
4026
|
+
var overflowStyles = /* @__PURE__ */ new Set(["auto", "scroll"]), PanSession = class {
|
|
4027
|
+
constructor(e, g, { transformPagePoint: _, contextWindow: v = window, dragSnapToOrigin: y = !1, distanceThreshold: b = 3, element: x } = {}) {
|
|
4028
|
+
if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.scrollPositions = /* @__PURE__ */ new Map(), this.removeScrollListeners = null, this.onElementScroll = (e) => {
|
|
4029
|
+
this.handleScroll(e.target);
|
|
4030
|
+
}, this.onWindowScroll = () => {
|
|
4031
|
+
this.handleScroll(window);
|
|
4032
|
+
}, this.updatePoint = () => {
|
|
4033
|
+
if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return;
|
|
4034
|
+
let e = getPanInfo(this.lastMoveEventInfo, this.history), g = this.startEvent !== null, _ = distance2D(e.offset, {
|
|
4035
|
+
x: 0,
|
|
4036
|
+
y: 0
|
|
4037
|
+
}) >= this.distanceThreshold;
|
|
4038
|
+
if (!g && !_) return;
|
|
4039
|
+
let { point: v } = e, { timestamp: y } = frameData;
|
|
4040
|
+
this.history.push({
|
|
4041
|
+
...v,
|
|
4042
|
+
timestamp: y
|
|
4043
|
+
});
|
|
4044
|
+
let { onStart: b, onMove: x } = this.handlers;
|
|
4045
|
+
g || (b && b(this.lastMoveEvent, e), this.startEvent = this.lastMoveEvent), x && x(this.lastMoveEvent, e);
|
|
4046
|
+
}, this.handlePointerMove = (e, g) => {
|
|
4047
|
+
this.lastMoveEvent = e, this.lastMoveEventInfo = transformPoint(g, this.transformPagePoint), frame.update(this.updatePoint, !0);
|
|
4048
|
+
}, this.handlePointerUp = (e, g) => {
|
|
4049
|
+
this.end();
|
|
4050
|
+
let { onEnd: _, onSessionEnd: v, resumeAnimation: y } = this.handlers;
|
|
4051
|
+
if ((this.dragSnapToOrigin || !this.startEvent) && y && y(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return;
|
|
4052
|
+
let b = getPanInfo(e.type === "pointercancel" ? this.lastMoveEventInfo : transformPoint(g, this.transformPagePoint), this.history);
|
|
4053
|
+
this.startEvent && _ && _(e, b), v && v(e, b);
|
|
4054
|
+
}, !isPrimaryPointer(e)) return;
|
|
4055
|
+
this.dragSnapToOrigin = y, this.handlers = g, this.transformPagePoint = _, this.distanceThreshold = b, this.contextWindow = v || window;
|
|
4056
|
+
let S = transformPoint(extractEventInfo(e), this.transformPagePoint), { point: C } = S, { timestamp: w } = frameData;
|
|
4057
|
+
this.history = [{
|
|
4058
|
+
...C,
|
|
4059
|
+
timestamp: w
|
|
4060
|
+
}];
|
|
4061
|
+
let { onSessionStart: T } = g;
|
|
4062
|
+
T && T(e, getPanInfo(S, this.history)), this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp)), x && this.startScrollTracking(x);
|
|
4063
|
+
}
|
|
4064
|
+
startScrollTracking(e) {
|
|
4065
|
+
let g = e.parentElement;
|
|
4066
|
+
for (; g;) {
|
|
4067
|
+
let e = getComputedStyle(g);
|
|
4068
|
+
(overflowStyles.has(e.overflowX) || overflowStyles.has(e.overflowY)) && this.scrollPositions.set(g, {
|
|
4069
|
+
x: g.scrollLeft,
|
|
4070
|
+
y: g.scrollTop
|
|
4071
|
+
}), g = g.parentElement;
|
|
4072
|
+
}
|
|
4073
|
+
this.scrollPositions.set(window, {
|
|
4074
|
+
x: window.scrollX,
|
|
4075
|
+
y: window.scrollY
|
|
4076
|
+
}), window.addEventListener("scroll", this.onElementScroll, {
|
|
4077
|
+
capture: !0,
|
|
4078
|
+
passive: !0
|
|
4079
|
+
}), window.addEventListener("scroll", this.onWindowScroll, { passive: !0 }), this.removeScrollListeners = () => {
|
|
4080
|
+
window.removeEventListener("scroll", this.onElementScroll, { capture: !0 }), window.removeEventListener("scroll", this.onWindowScroll);
|
|
4081
|
+
};
|
|
4082
|
+
}
|
|
4083
|
+
handleScroll(e) {
|
|
4084
|
+
let g = this.scrollPositions.get(e);
|
|
4085
|
+
if (!g) return;
|
|
4086
|
+
let _ = e === window, v = _ ? {
|
|
4087
|
+
x: window.scrollX,
|
|
4088
|
+
y: window.scrollY
|
|
4089
|
+
} : {
|
|
4090
|
+
x: e.scrollLeft,
|
|
4091
|
+
y: e.scrollTop
|
|
4092
|
+
}, y = {
|
|
4093
|
+
x: v.x - g.x,
|
|
4094
|
+
y: v.y - g.y
|
|
4095
|
+
};
|
|
4096
|
+
y.x === 0 && y.y === 0 || (_ ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += y.x, this.lastMoveEventInfo.point.y += y.y) : this.history.length > 0 && (this.history[0].x -= y.x, this.history[0].y -= y.y), this.scrollPositions.set(e, v), frame.update(this.updatePoint, !0));
|
|
4097
|
+
}
|
|
4098
|
+
updateHandlers(e) {
|
|
4099
|
+
this.handlers = e;
|
|
4100
|
+
}
|
|
4101
|
+
end() {
|
|
4102
|
+
this.removeListeners && this.removeListeners(), this.removeScrollListeners && this.removeScrollListeners(), this.scrollPositions.clear(), cancelFrame(this.updatePoint);
|
|
4103
|
+
}
|
|
4104
|
+
};
|
|
4105
|
+
function transformPoint(e, g) {
|
|
4106
|
+
return g ? { point: g(e.point) } : e;
|
|
4107
|
+
}
|
|
4108
|
+
function subtractPoint(e, g) {
|
|
4109
|
+
return {
|
|
4110
|
+
x: e.x - g.x,
|
|
4111
|
+
y: e.y - g.y
|
|
4112
|
+
};
|
|
4113
|
+
}
|
|
4114
|
+
function getPanInfo({ point: e }, g) {
|
|
4115
|
+
return {
|
|
4116
|
+
point: e,
|
|
4117
|
+
delta: subtractPoint(e, lastDevicePoint(g)),
|
|
4118
|
+
offset: subtractPoint(e, startDevicePoint(g)),
|
|
4119
|
+
velocity: getVelocity(g, .1)
|
|
4120
|
+
};
|
|
4121
|
+
}
|
|
4122
|
+
function startDevicePoint(e) {
|
|
4123
|
+
return e[0];
|
|
4124
|
+
}
|
|
4125
|
+
function lastDevicePoint(e) {
|
|
4126
|
+
return e[e.length - 1];
|
|
4127
|
+
}
|
|
4128
|
+
function getVelocity(e, g) {
|
|
4129
|
+
if (e.length < 2) return {
|
|
4130
|
+
x: 0,
|
|
4131
|
+
y: 0
|
|
4132
|
+
};
|
|
4133
|
+
let _ = e.length - 1, v = null, y = lastDevicePoint(e);
|
|
4134
|
+
for (; _ >= 0 && (v = e[_], !(y.timestamp - v.timestamp > /* @__PURE__ */ secondsToMilliseconds(g)));) _--;
|
|
4135
|
+
if (!v) return {
|
|
4136
|
+
x: 0,
|
|
4137
|
+
y: 0
|
|
4138
|
+
};
|
|
4139
|
+
v === e[0] && e.length > 2 && y.timestamp - v.timestamp > /* @__PURE__ */ secondsToMilliseconds(g) * 2 && (v = e[1]);
|
|
4140
|
+
let b = /* @__PURE__ */ millisecondsToSeconds(y.timestamp - v.timestamp);
|
|
4141
|
+
if (b === 0) return {
|
|
4142
|
+
x: 0,
|
|
4143
|
+
y: 0
|
|
4144
|
+
};
|
|
4145
|
+
let x = {
|
|
4146
|
+
x: (y.x - v.x) / b,
|
|
4147
|
+
y: (y.y - v.y) / b
|
|
4148
|
+
};
|
|
4149
|
+
return x.x === Infinity && (x.x = 0), x.y === Infinity && (x.y = 0), x;
|
|
4150
|
+
}
|
|
4151
|
+
function applyConstraints(e, { min: g, max: _ }, v) {
|
|
4152
|
+
return g !== void 0 && e < g ? e = v ? mixNumber(g, e, v.min) : Math.max(e, g) : _ !== void 0 && e > _ && (e = v ? mixNumber(_, e, v.max) : Math.min(e, _)), e;
|
|
4153
|
+
}
|
|
4154
|
+
function calcRelativeAxisConstraints(e, g, _) {
|
|
4155
|
+
return {
|
|
4156
|
+
min: g === void 0 ? void 0 : e.min + g,
|
|
4157
|
+
max: _ === void 0 ? void 0 : e.max + _ - (e.max - e.min)
|
|
4158
|
+
};
|
|
4159
|
+
}
|
|
4160
|
+
function calcRelativeConstraints(e, { top: g, left: _, bottom: v, right: y }) {
|
|
4161
|
+
return {
|
|
4162
|
+
x: calcRelativeAxisConstraints(e.x, _, y),
|
|
4163
|
+
y: calcRelativeAxisConstraints(e.y, g, v)
|
|
4164
|
+
};
|
|
4165
|
+
}
|
|
4166
|
+
function calcViewportAxisConstraints(e, g) {
|
|
4167
|
+
let _ = g.min - e.min, v = g.max - e.max;
|
|
4168
|
+
return g.max - g.min < e.max - e.min && ([_, v] = [v, _]), {
|
|
4169
|
+
min: _,
|
|
4170
|
+
max: v
|
|
4171
|
+
};
|
|
4172
|
+
}
|
|
4173
|
+
function calcViewportConstraints(e, g) {
|
|
4174
|
+
return {
|
|
4175
|
+
x: calcViewportAxisConstraints(e.x, g.x),
|
|
4176
|
+
y: calcViewportAxisConstraints(e.y, g.y)
|
|
4177
|
+
};
|
|
4178
|
+
}
|
|
4179
|
+
function calcOrigin(e, g) {
|
|
4180
|
+
let _ = .5, v = calcLength(e), y = calcLength(g);
|
|
4181
|
+
return y > v ? _ = /* @__PURE__ */ progress(g.min, g.max - v, e.min) : v > y && (_ = /* @__PURE__ */ progress(e.min, e.max - y, g.min)), clamp(0, 1, _);
|
|
4182
|
+
}
|
|
4183
|
+
function rebaseAxisConstraints(e, g) {
|
|
4184
|
+
let _ = {};
|
|
4185
|
+
return g.min !== void 0 && (_.min = g.min - e.min), g.max !== void 0 && (_.max = g.max - e.min), _;
|
|
4186
|
+
}
|
|
4187
|
+
var defaultElastic = .35;
|
|
4188
|
+
function resolveDragElastic(e = defaultElastic) {
|
|
4189
|
+
return e === !1 ? e = 0 : e === !0 && (e = defaultElastic), {
|
|
4190
|
+
x: resolveAxisElastic(e, "left", "right"),
|
|
4191
|
+
y: resolveAxisElastic(e, "top", "bottom")
|
|
4192
|
+
};
|
|
4193
|
+
}
|
|
4194
|
+
function resolveAxisElastic(e, g, _) {
|
|
4195
|
+
return {
|
|
4196
|
+
min: resolvePointElastic(e, g),
|
|
4197
|
+
max: resolvePointElastic(e, _)
|
|
4198
|
+
};
|
|
4199
|
+
}
|
|
4200
|
+
function resolvePointElastic(e, g) {
|
|
4201
|
+
return typeof e == "number" ? e : e[g] || 0;
|
|
4202
|
+
}
|
|
4203
|
+
var elementDragControls = /* @__PURE__ */ new WeakMap(), VisualElementDragControls = class {
|
|
4204
|
+
constructor(e) {
|
|
4205
|
+
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = {
|
|
4206
|
+
x: 0,
|
|
4207
|
+
y: 0
|
|
4208
|
+
}, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = createBox(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
|
|
4209
|
+
}
|
|
4210
|
+
start(e, { snapToCursor: g = !1, distanceThreshold: _ } = {}) {
|
|
4211
|
+
let { presenceContext: v } = this.visualElement;
|
|
4212
|
+
if (v && v.isPresent === !1) return;
|
|
4213
|
+
let y = (e) => {
|
|
4214
|
+
g && this.snapToCursor(extractEventInfo(e).point), this.stopAnimation();
|
|
4215
|
+
}, b = (e, g) => {
|
|
4216
|
+
let { drag: _, dragPropagation: v, onDragStart: y } = this.getProps();
|
|
4217
|
+
if (_ && !v && (this.openDragLock && this.openDragLock(), this.openDragLock = setDragLock(_), !this.openDragLock)) return;
|
|
4218
|
+
this.latestPointerEvent = e, this.latestPanInfo = g, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), eachAxis((e) => {
|
|
4219
|
+
let g = this.getAxisMotionValue(e).get() || 0;
|
|
4220
|
+
if (percent.test(g)) {
|
|
4221
|
+
let { projection: _ } = this.visualElement;
|
|
4222
|
+
if (_ && _.layout) {
|
|
4223
|
+
let v = _.layout.layoutBox[e];
|
|
4224
|
+
v && (g = calcLength(v) * (parseFloat(g) / 100));
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
this.originPoint[e] = g;
|
|
4228
|
+
}), y && frame.update(() => y(e, g), !1, !0), addValueToWillChange(this.visualElement, "transform");
|
|
4229
|
+
let { animationState: b } = this.visualElement;
|
|
4230
|
+
b && b.setActive("whileDrag", !0);
|
|
4231
|
+
}, x = (e, g) => {
|
|
4232
|
+
this.latestPointerEvent = e, this.latestPanInfo = g;
|
|
4233
|
+
let { dragPropagation: _, dragDirectionLock: v, onDirectionLock: y, onDrag: b } = this.getProps();
|
|
4234
|
+
if (!_ && !this.openDragLock) return;
|
|
4235
|
+
let { offset: x } = g;
|
|
4236
|
+
if (v && this.currentDirection === null) {
|
|
4237
|
+
this.currentDirection = getCurrentDirection(x), this.currentDirection !== null && y && y(this.currentDirection);
|
|
4238
|
+
return;
|
|
4239
|
+
}
|
|
4240
|
+
this.updateAxis("x", g.point, x), this.updateAxis("y", g.point, x), this.visualElement.render(), b && frame.update(() => b(e, g), !1, !0);
|
|
4241
|
+
}, S = (e, g) => {
|
|
4242
|
+
this.latestPointerEvent = e, this.latestPanInfo = g, this.stop(e, g), this.latestPointerEvent = null, this.latestPanInfo = null;
|
|
4243
|
+
}, C = () => {
|
|
4244
|
+
let { dragSnapToOrigin: e } = this.getProps();
|
|
4245
|
+
(e || this.constraints) && this.startAnimation({
|
|
4246
|
+
x: 0,
|
|
4247
|
+
y: 0
|
|
4248
|
+
});
|
|
4249
|
+
}, { dragSnapToOrigin: w } = this.getProps();
|
|
4250
|
+
this.panSession = new PanSession(e, {
|
|
4251
|
+
onSessionStart: y,
|
|
4252
|
+
onStart: b,
|
|
4253
|
+
onMove: x,
|
|
4254
|
+
onSessionEnd: S,
|
|
4255
|
+
resumeAnimation: C
|
|
4256
|
+
}, {
|
|
4257
|
+
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
4258
|
+
dragSnapToOrigin: w,
|
|
4259
|
+
distanceThreshold: _,
|
|
4260
|
+
contextWindow: getContextWindow(this.visualElement),
|
|
4261
|
+
element: this.visualElement.current
|
|
4262
|
+
});
|
|
4263
|
+
}
|
|
4264
|
+
stop(e, g) {
|
|
4265
|
+
let _ = e || this.latestPointerEvent, v = g || this.latestPanInfo, y = this.isDragging;
|
|
4266
|
+
if (this.cancel(), !y || !v || !_) return;
|
|
4267
|
+
let { velocity: b } = v;
|
|
4268
|
+
this.startAnimation(b);
|
|
4269
|
+
let { onDragEnd: x } = this.getProps();
|
|
4270
|
+
x && frame.postRender(() => x(_, v));
|
|
4271
|
+
}
|
|
4272
|
+
cancel() {
|
|
4273
|
+
this.isDragging = !1;
|
|
4274
|
+
let { projection: e, animationState: g } = this.visualElement;
|
|
4275
|
+
e && (e.isAnimationBlocked = !1), this.endPanSession();
|
|
4276
|
+
let { dragPropagation: _ } = this.getProps();
|
|
4277
|
+
!_ && this.openDragLock && (this.openDragLock(), this.openDragLock = null), g && g.setActive("whileDrag", !1);
|
|
4278
|
+
}
|
|
4279
|
+
endPanSession() {
|
|
4280
|
+
this.panSession && this.panSession.end(), this.panSession = void 0;
|
|
4281
|
+
}
|
|
4282
|
+
updateAxis(e, g, _) {
|
|
4283
|
+
let { drag: v } = this.getProps();
|
|
4284
|
+
if (!_ || !shouldDrag(e, v, this.currentDirection)) return;
|
|
4285
|
+
let y = this.getAxisMotionValue(e), b = this.originPoint[e] + _[e];
|
|
4286
|
+
this.constraints && this.constraints[e] && (b = applyConstraints(b, this.constraints[e], this.elastic[e])), y.set(b);
|
|
4287
|
+
}
|
|
4288
|
+
resolveConstraints() {
|
|
4289
|
+
let { dragConstraints: e, dragElastic: g } = this.getProps(), _ = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, v = this.constraints;
|
|
4290
|
+
e && isRefObject(e) ? this.constraints ||= this.resolveRefConstraints() : e && _ ? this.constraints = calcRelativeConstraints(_.layoutBox, e) : this.constraints = !1, this.elastic = resolveDragElastic(g), v !== this.constraints && !isRefObject(e) && _ && this.constraints && !this.hasMutatedConstraints && eachAxis((e) => {
|
|
4291
|
+
this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] = rebaseAxisConstraints(_.layoutBox[e], this.constraints[e]));
|
|
4292
|
+
});
|
|
4293
|
+
}
|
|
4294
|
+
resolveRefConstraints() {
|
|
4295
|
+
let { dragConstraints: e, onMeasureDragConstraints: g } = this.getProps();
|
|
4296
|
+
if (!e || !isRefObject(e)) return !1;
|
|
4297
|
+
let _ = e.current;
|
|
4298
|
+
invariant(_ !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
|
|
4299
|
+
let { projection: v } = this.visualElement;
|
|
4300
|
+
if (!v || !v.layout) return !1;
|
|
4301
|
+
let y = measurePageBox(_, v.root, this.visualElement.getTransformPagePoint()), b = calcViewportConstraints(v.layout.layoutBox, y);
|
|
4302
|
+
if (g) {
|
|
4303
|
+
let e = g(convertBoxToBoundingBox(b));
|
|
4304
|
+
this.hasMutatedConstraints = !!e, e && (b = convertBoundingBoxToBox(e));
|
|
4305
|
+
}
|
|
4306
|
+
return b;
|
|
4307
|
+
}
|
|
4308
|
+
startAnimation(e) {
|
|
4309
|
+
let { drag: g, dragMomentum: _, dragElastic: v, dragTransition: y, dragSnapToOrigin: b, onDragTransitionEnd: x } = this.getProps(), S = this.constraints || {}, C = eachAxis((x) => {
|
|
4310
|
+
if (!shouldDrag(x, g, this.currentDirection)) return;
|
|
4311
|
+
let C = S && S[x] || {};
|
|
4312
|
+
b && (C = {
|
|
4313
|
+
min: 0,
|
|
4314
|
+
max: 0
|
|
4315
|
+
});
|
|
4316
|
+
let w = v ? 200 : 1e6, T = v ? 40 : 1e7, E = {
|
|
4317
|
+
type: "inertia",
|
|
4318
|
+
velocity: _ ? e[x] : 0,
|
|
4319
|
+
bounceStiffness: w,
|
|
4320
|
+
bounceDamping: T,
|
|
4321
|
+
timeConstant: 750,
|
|
4322
|
+
restDelta: 1,
|
|
4323
|
+
restSpeed: 10,
|
|
4324
|
+
...y,
|
|
4325
|
+
...C
|
|
4326
|
+
};
|
|
4327
|
+
return this.startAxisValueAnimation(x, E);
|
|
4328
|
+
});
|
|
4329
|
+
return Promise.all(C).then(x);
|
|
4330
|
+
}
|
|
4331
|
+
startAxisValueAnimation(e, g) {
|
|
4332
|
+
let _ = this.getAxisMotionValue(e);
|
|
4333
|
+
return addValueToWillChange(this.visualElement, e), _.start(animateMotionValue(e, _, 0, g, this.visualElement, !1));
|
|
4334
|
+
}
|
|
4335
|
+
stopAnimation() {
|
|
4336
|
+
eachAxis((e) => this.getAxisMotionValue(e).stop());
|
|
4337
|
+
}
|
|
4338
|
+
getAxisMotionValue(e) {
|
|
4339
|
+
let g = `_drag${e.toUpperCase()}`, _ = this.visualElement.getProps();
|
|
4340
|
+
return _[g] || this.visualElement.getValue(e, (_.initial ? _.initial[e] : void 0) || 0);
|
|
4341
|
+
}
|
|
4342
|
+
snapToCursor(e) {
|
|
4343
|
+
eachAxis((g) => {
|
|
4344
|
+
let { drag: _ } = this.getProps();
|
|
4345
|
+
if (!shouldDrag(g, _, this.currentDirection)) return;
|
|
4346
|
+
let { projection: v } = this.visualElement, y = this.getAxisMotionValue(g);
|
|
4347
|
+
if (v && v.layout) {
|
|
4348
|
+
let { min: _, max: b } = v.layout.layoutBox[g], x = y.get() || 0;
|
|
4349
|
+
y.set(e[g] - mixNumber(_, b, .5) + x);
|
|
4350
|
+
}
|
|
4351
|
+
});
|
|
4352
|
+
}
|
|
4353
|
+
scalePositionWithinConstraints() {
|
|
4354
|
+
if (!this.visualElement.current) return;
|
|
4355
|
+
let { drag: e, dragConstraints: g } = this.getProps(), { projection: _ } = this.visualElement;
|
|
4356
|
+
if (!isRefObject(g) || !_ || !this.constraints) return;
|
|
4357
|
+
this.stopAnimation();
|
|
4358
|
+
let v = {
|
|
4359
|
+
x: 0,
|
|
4360
|
+
y: 0
|
|
4361
|
+
};
|
|
4362
|
+
eachAxis((e) => {
|
|
4363
|
+
let g = this.getAxisMotionValue(e);
|
|
4364
|
+
if (g && this.constraints !== !1) {
|
|
4365
|
+
let _ = g.get();
|
|
4366
|
+
v[e] = calcOrigin({
|
|
4367
|
+
min: _,
|
|
4368
|
+
max: _
|
|
4369
|
+
}, this.constraints[e]);
|
|
4370
|
+
}
|
|
4371
|
+
});
|
|
4372
|
+
let { transformTemplate: y } = this.visualElement.getProps();
|
|
4373
|
+
this.visualElement.current.style.transform = y ? y({}, "") : "none", _.root && _.root.updateScroll(), _.updateLayout(), this.constraints = !1, this.resolveConstraints(), eachAxis((g) => {
|
|
4374
|
+
if (!shouldDrag(g, e, null)) return;
|
|
4375
|
+
let _ = this.getAxisMotionValue(g), { min: y, max: b } = this.constraints[g];
|
|
4376
|
+
_.set(mixNumber(y, b, v[g]));
|
|
4377
|
+
}), this.visualElement.render();
|
|
4378
|
+
}
|
|
4379
|
+
addListeners() {
|
|
4380
|
+
if (!this.visualElement.current) return;
|
|
4381
|
+
elementDragControls.set(this.visualElement, this);
|
|
4382
|
+
let e = this.visualElement.current, g = addPointerEvent(e, "pointerdown", (g) => {
|
|
4383
|
+
let { drag: _, dragListener: v = !0 } = this.getProps(), y = g.target, b = y !== e && isElementTextInput(y);
|
|
4384
|
+
_ && v && !b && this.start(g);
|
|
4385
|
+
}), _, v = () => {
|
|
4386
|
+
let { dragConstraints: g } = this.getProps();
|
|
4387
|
+
isRefObject(g) && g.current && (this.constraints = this.resolveRefConstraints(), _ ||= startResizeObservers(e, g.current, () => this.scalePositionWithinConstraints()));
|
|
4388
|
+
}, { projection: y } = this.visualElement, b = y.addEventListener("measure", v);
|
|
4389
|
+
y && !y.layout && (y.root && y.root.updateScroll(), y.updateLayout()), frame.read(v);
|
|
4390
|
+
let x = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints()), S = y.addEventListener("didUpdate", (({ delta: e, hasLayoutChanged: g }) => {
|
|
4391
|
+
this.isDragging && g && (eachAxis((g) => {
|
|
4392
|
+
let _ = this.getAxisMotionValue(g);
|
|
4393
|
+
_ && (this.originPoint[g] += e[g].translate, _.set(_.get() + e[g].translate));
|
|
4394
|
+
}), this.visualElement.render());
|
|
4395
|
+
}));
|
|
4396
|
+
return () => {
|
|
4397
|
+
x(), g(), b(), S && S(), _ && _();
|
|
4398
|
+
};
|
|
4399
|
+
}
|
|
4400
|
+
getProps() {
|
|
4401
|
+
let e = this.visualElement.getProps(), { drag: g = !1, dragDirectionLock: _ = !1, dragPropagation: v = !1, dragConstraints: y = !1, dragElastic: b = defaultElastic, dragMomentum: x = !0 } = e;
|
|
4402
|
+
return {
|
|
4403
|
+
...e,
|
|
4404
|
+
drag: g,
|
|
4405
|
+
dragDirectionLock: _,
|
|
4406
|
+
dragPropagation: v,
|
|
4407
|
+
dragConstraints: y,
|
|
4408
|
+
dragElastic: b,
|
|
4409
|
+
dragMomentum: x
|
|
4410
|
+
};
|
|
4411
|
+
}
|
|
4412
|
+
};
|
|
4413
|
+
function skipFirstCall(e) {
|
|
4414
|
+
let g = !0;
|
|
4415
|
+
return () => {
|
|
4416
|
+
if (g) {
|
|
4417
|
+
g = !1;
|
|
4418
|
+
return;
|
|
4419
|
+
}
|
|
4420
|
+
e();
|
|
4421
|
+
};
|
|
4422
|
+
}
|
|
4423
|
+
function startResizeObservers(e, g, _) {
|
|
4424
|
+
let v = resize(e, skipFirstCall(_)), y = resize(g, skipFirstCall(_));
|
|
4425
|
+
return () => {
|
|
4426
|
+
v(), y();
|
|
4427
|
+
};
|
|
4428
|
+
}
|
|
4429
|
+
function shouldDrag(e, g, _) {
|
|
4430
|
+
return (g === !0 || g === e) && (_ === null || _ === e);
|
|
4431
|
+
}
|
|
4432
|
+
function getCurrentDirection(e, g = 10) {
|
|
4433
|
+
let _ = null;
|
|
4434
|
+
return Math.abs(e.y) > g ? _ = "y" : Math.abs(e.x) > g && (_ = "x"), _;
|
|
4435
|
+
}
|
|
4436
|
+
var DragGesture = class extends Feature {
|
|
4437
|
+
constructor(e) {
|
|
4438
|
+
super(e), this.removeGroupControls = noop, this.removeListeners = noop, this.controls = new VisualElementDragControls(e);
|
|
4439
|
+
}
|
|
4440
|
+
mount() {
|
|
4441
|
+
let { dragControls: e } = this.node.getProps();
|
|
4442
|
+
e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || noop;
|
|
4443
|
+
}
|
|
4444
|
+
update() {
|
|
4445
|
+
let { dragControls: e } = this.node.getProps(), { dragControls: g } = this.node.prevProps || {};
|
|
4446
|
+
e !== g && (this.removeGroupControls(), e && (this.removeGroupControls = e.subscribe(this.controls)));
|
|
4447
|
+
}
|
|
4448
|
+
unmount() {
|
|
4449
|
+
this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
|
|
4450
|
+
}
|
|
4451
|
+
}, asyncHandler = (e) => (g, _) => {
|
|
4452
|
+
e && frame.update(() => e(g, _), !1, !0);
|
|
4453
|
+
}, PanGesture = class extends Feature {
|
|
4454
|
+
constructor() {
|
|
4455
|
+
super(...arguments), this.removePointerDownListener = noop;
|
|
4456
|
+
}
|
|
4457
|
+
onPointerDown(e) {
|
|
4458
|
+
this.session = new PanSession(e, this.createPanHandlers(), {
|
|
4459
|
+
transformPagePoint: this.node.getTransformPagePoint(),
|
|
4460
|
+
contextWindow: getContextWindow(this.node)
|
|
4461
|
+
});
|
|
4462
|
+
}
|
|
4463
|
+
createPanHandlers() {
|
|
4464
|
+
let { onPanSessionStart: e, onPanStart: g, onPan: _, onPanEnd: v } = this.node.getProps();
|
|
4465
|
+
return {
|
|
4466
|
+
onSessionStart: asyncHandler(e),
|
|
4467
|
+
onStart: asyncHandler(g),
|
|
4468
|
+
onMove: asyncHandler(_),
|
|
4469
|
+
onEnd: (e, g) => {
|
|
4470
|
+
delete this.session, v && frame.postRender(() => v(e, g));
|
|
4471
|
+
}
|
|
4472
|
+
};
|
|
4473
|
+
}
|
|
4474
|
+
mount() {
|
|
4475
|
+
this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
|
|
4476
|
+
}
|
|
4477
|
+
update() {
|
|
4478
|
+
this.session && this.session.updateHandlers(this.createPanHandlers());
|
|
4479
|
+
}
|
|
4480
|
+
unmount() {
|
|
4481
|
+
this.removePointerDownListener(), this.session && this.session.end();
|
|
4482
|
+
}
|
|
4483
|
+
}, hasTakenAnySnapshot = !1, MeasureLayoutWithContext = class extends Component {
|
|
4484
|
+
componentDidMount() {
|
|
4485
|
+
let { visualElement: e, layoutGroup: g, switchLayoutGroup: _, layoutId: v } = this.props, { projection: y } = e;
|
|
4486
|
+
y && (g.group && g.group.add(y), _ && _.register && v && _.register(y), hasTakenAnySnapshot && y.root.didUpdate(), y.addEventListener("animationComplete", () => {
|
|
4487
|
+
this.safeToRemove();
|
|
4488
|
+
}), y.setOptions({
|
|
4489
|
+
...y.options,
|
|
4490
|
+
layoutDependency: this.props.layoutDependency,
|
|
4491
|
+
onExitComplete: () => this.safeToRemove()
|
|
4492
|
+
})), globalProjectionState.hasEverUpdated = !0;
|
|
4493
|
+
}
|
|
4494
|
+
getSnapshotBeforeUpdate(e) {
|
|
4495
|
+
let { layoutDependency: g, visualElement: _, drag: v, isPresent: y } = this.props, { projection: b } = _;
|
|
4496
|
+
return b ? (b.isPresent = y, e.layoutDependency !== g && b.setOptions({
|
|
4497
|
+
...b.options,
|
|
4498
|
+
layoutDependency: g
|
|
4499
|
+
}), hasTakenAnySnapshot = !0, v || e.layoutDependency !== g || g === void 0 || e.isPresent !== y ? b.willUpdate() : this.safeToRemove(), e.isPresent !== y && (y ? b.promote() : b.relegate() || frame.postRender(() => {
|
|
4500
|
+
let e = b.getStack();
|
|
4501
|
+
(!e || !e.members.length) && this.safeToRemove();
|
|
4502
|
+
})), null) : null;
|
|
4503
|
+
}
|
|
4504
|
+
componentDidUpdate() {
|
|
4505
|
+
let { projection: e } = this.props.visualElement;
|
|
4506
|
+
e && (e.root.didUpdate(), microtask.postRender(() => {
|
|
4507
|
+
!e.currentAnimation && e.isLead() && this.safeToRemove();
|
|
4508
|
+
}));
|
|
4509
|
+
}
|
|
4510
|
+
componentWillUnmount() {
|
|
4511
|
+
let { visualElement: e, layoutGroup: g, switchLayoutGroup: _ } = this.props, { projection: v } = e;
|
|
4512
|
+
hasTakenAnySnapshot = !0, v && (v.scheduleCheckAfterUnmount(), g && g.group && g.group.remove(v), _ && _.deregister && _.deregister(v));
|
|
4513
|
+
}
|
|
4514
|
+
safeToRemove() {
|
|
4515
|
+
let { safeToRemove: e } = this.props;
|
|
4516
|
+
e && e();
|
|
4517
|
+
}
|
|
4518
|
+
render() {
|
|
4519
|
+
return null;
|
|
4520
|
+
}
|
|
4521
|
+
};
|
|
4522
|
+
function MeasureLayout(e) {
|
|
4523
|
+
let [g, _] = usePresence(), v = useContext(LayoutGroupContext);
|
|
4524
|
+
return (0, import_jsx_runtime.jsx)(MeasureLayoutWithContext, {
|
|
4525
|
+
...e,
|
|
4526
|
+
layoutGroup: v,
|
|
4527
|
+
switchLayoutGroup: useContext(SwitchLayoutGroupContext),
|
|
4528
|
+
isPresent: g,
|
|
4529
|
+
safeToRemove: _
|
|
4530
|
+
});
|
|
4531
|
+
}
|
|
4532
|
+
var drag = {
|
|
4533
|
+
pan: { Feature: PanGesture },
|
|
4534
|
+
drag: {
|
|
4535
|
+
Feature: DragGesture,
|
|
4536
|
+
ProjectionNode: HTMLProjectionNode,
|
|
4537
|
+
MeasureLayout
|
|
4538
|
+
}
|
|
4539
|
+
};
|
|
4540
|
+
function handleHoverEvent(e, g, _) {
|
|
4541
|
+
let { props: v } = e;
|
|
4542
|
+
e.animationState && v.whileHover && e.animationState.setActive("whileHover", _ === "Start");
|
|
4543
|
+
let y = v["onHover" + _];
|
|
4544
|
+
y && frame.postRender(() => y(g, extractEventInfo(g)));
|
|
4545
|
+
}
|
|
4546
|
+
var HoverGesture = class extends Feature {
|
|
4547
|
+
mount() {
|
|
4548
|
+
let { current: e } = this.node;
|
|
4549
|
+
e && (this.unmount = hover(e, (e, g) => (handleHoverEvent(this.node, g, "Start"), (e) => handleHoverEvent(this.node, e, "End"))));
|
|
4550
|
+
}
|
|
4551
|
+
unmount() {}
|
|
4552
|
+
}, FocusGesture = class extends Feature {
|
|
4553
|
+
constructor() {
|
|
4554
|
+
super(...arguments), this.isActive = !1;
|
|
4555
|
+
}
|
|
4556
|
+
onFocus() {
|
|
4557
|
+
let e = !1;
|
|
4558
|
+
try {
|
|
4559
|
+
e = this.node.current.matches(":focus-visible");
|
|
4560
|
+
} catch {
|
|
4561
|
+
e = !0;
|
|
4562
|
+
}
|
|
4563
|
+
!e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
|
|
4564
|
+
}
|
|
4565
|
+
onBlur() {
|
|
4566
|
+
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
|
|
4567
|
+
}
|
|
4568
|
+
mount() {
|
|
4569
|
+
this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
|
|
4570
|
+
}
|
|
4571
|
+
unmount() {}
|
|
4572
|
+
};
|
|
4573
|
+
function handlePressEvent(e, g, _) {
|
|
4574
|
+
let { props: v } = e;
|
|
4575
|
+
if (e.current instanceof HTMLButtonElement && e.current.disabled) return;
|
|
4576
|
+
e.animationState && v.whileTap && e.animationState.setActive("whileTap", _ === "Start");
|
|
4577
|
+
let y = v["onTap" + (_ === "End" ? "" : _)];
|
|
4578
|
+
y && frame.postRender(() => y(g, extractEventInfo(g)));
|
|
4579
|
+
}
|
|
4580
|
+
var PressGesture = class extends Feature {
|
|
4581
|
+
mount() {
|
|
4582
|
+
let { current: e } = this.node;
|
|
4583
|
+
if (!e) return;
|
|
4584
|
+
let { globalTapTarget: g, propagate: _ } = this.node.props;
|
|
4585
|
+
this.unmount = press(e, (e, g) => (handlePressEvent(this.node, g, "Start"), (e, { success: g }) => handlePressEvent(this.node, e, g ? "End" : "Cancel")), {
|
|
4586
|
+
useGlobalTarget: g,
|
|
4587
|
+
stopPropagation: _?.tap === !1
|
|
4588
|
+
});
|
|
4589
|
+
}
|
|
4590
|
+
unmount() {}
|
|
4591
|
+
}, observerCallbacks = /* @__PURE__ */ new WeakMap(), observers = /* @__PURE__ */ new WeakMap(), fireObserverCallback = (e) => {
|
|
4592
|
+
let g = observerCallbacks.get(e.target);
|
|
4593
|
+
g && g(e);
|
|
4594
|
+
}, fireAllObserverCallbacks = (e) => {
|
|
4595
|
+
e.forEach(fireObserverCallback);
|
|
4596
|
+
};
|
|
4597
|
+
function initIntersectionObserver({ root: e, ...g }) {
|
|
4598
|
+
let _ = e || document;
|
|
4599
|
+
observers.has(_) || observers.set(_, {});
|
|
4600
|
+
let v = observers.get(_), y = JSON.stringify(g);
|
|
4601
|
+
return v[y] || (v[y] = new IntersectionObserver(fireAllObserverCallbacks, {
|
|
4602
|
+
root: e,
|
|
4603
|
+
...g
|
|
4604
|
+
})), v[y];
|
|
4605
|
+
}
|
|
4606
|
+
function observeIntersection(e, g, _) {
|
|
4607
|
+
let v = initIntersectionObserver(g);
|
|
4608
|
+
return observerCallbacks.set(e, _), v.observe(e), () => {
|
|
4609
|
+
observerCallbacks.delete(e), v.unobserve(e);
|
|
4610
|
+
};
|
|
4611
|
+
}
|
|
4612
|
+
var thresholdNames = {
|
|
4613
|
+
some: 0,
|
|
4614
|
+
all: 1
|
|
4615
|
+
}, InViewFeature = class extends Feature {
|
|
4616
|
+
constructor() {
|
|
4617
|
+
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
|
|
4618
|
+
}
|
|
4619
|
+
startObserver() {
|
|
4620
|
+
this.unmount();
|
|
4621
|
+
let { viewport: e = {} } = this.node.getProps(), { root: g, margin: _, amount: v = "some", once: y } = e, b = {
|
|
4622
|
+
root: g ? g.current : void 0,
|
|
4623
|
+
rootMargin: _,
|
|
4624
|
+
threshold: typeof v == "number" ? v : thresholdNames[v]
|
|
4625
|
+
};
|
|
4626
|
+
return observeIntersection(this.node.current, b, (e) => {
|
|
4627
|
+
let { isIntersecting: g } = e;
|
|
4628
|
+
if (this.isInView === g || (this.isInView = g, y && !g && this.hasEnteredView)) return;
|
|
4629
|
+
g && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", g);
|
|
4630
|
+
let { onViewportEnter: _, onViewportLeave: v } = this.node.getProps(), b = g ? _ : v;
|
|
4631
|
+
b && b(e);
|
|
4632
|
+
});
|
|
4633
|
+
}
|
|
4634
|
+
mount() {
|
|
4635
|
+
this.startObserver();
|
|
4636
|
+
}
|
|
4637
|
+
update() {
|
|
4638
|
+
if (typeof IntersectionObserver > "u") return;
|
|
4639
|
+
let { props: e, prevProps: g } = this.node;
|
|
4640
|
+
[
|
|
4641
|
+
"amount",
|
|
4642
|
+
"margin",
|
|
4643
|
+
"root"
|
|
4644
|
+
].some(hasViewportOptionChanged(e, g)) && this.startObserver();
|
|
4645
|
+
}
|
|
4646
|
+
unmount() {}
|
|
4647
|
+
};
|
|
4648
|
+
function hasViewportOptionChanged({ viewport: e = {} }, { viewport: g = {} } = {}) {
|
|
4649
|
+
return (_) => e[_] !== g[_];
|
|
4650
|
+
}
|
|
4651
|
+
var gestureAnimations = {
|
|
4652
|
+
inView: { Feature: InViewFeature },
|
|
4653
|
+
tap: { Feature: PressGesture },
|
|
4654
|
+
focus: { Feature: FocusGesture },
|
|
4655
|
+
hover: { Feature: HoverGesture }
|
|
4656
|
+
}, layout = { layout: {
|
|
4657
|
+
ProjectionNode: HTMLProjectionNode,
|
|
4658
|
+
MeasureLayout
|
|
4659
|
+
} }, motion = /* @__PURE__ */ createMotionProxy({
|
|
4660
|
+
...animations,
|
|
4661
|
+
...gestureAnimations,
|
|
4662
|
+
...drag,
|
|
4663
|
+
...layout
|
|
4664
|
+
}, createDomVisualElement), box_module_default = { box: "box-module__box___FP5Js" };
|
|
4665
|
+
const Box = ({ children: e, position: g }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(motion.div, {
|
|
4666
|
+
className: box_module_default.box,
|
|
4667
|
+
"data-position": g,
|
|
4668
|
+
children: e
|
|
4669
|
+
});
|
|
4670
|
+
export { isHTMLElement as a, useConstant as c, MotionConfigContext as i, LayoutGroupContext as l, motion as n, PresenceContext as o, usePresence as r, useIsomorphicLayoutEffect as s, Box as t, require_jsx_runtime as u };
|