6652 lines
213 KiB
JavaScript
6652 lines
213 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 836d2aeda096d319.fb0a464622.js
|
|
* Module id: 532527
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (t) => {
|
|
"use strict";
|
|
let e, i, n;
|
|
var o,
|
|
r = t.i(23741),
|
|
s = t.i(462214),
|
|
a = t.i(358379);
|
|
let l = (0, a.createContext)({});
|
|
function c(t) {
|
|
let e = (0, a.useRef)(null);
|
|
return null === e.current && (e.current = t()), e.current;
|
|
}
|
|
let u = "u" > typeof window,
|
|
h = u ? a.useLayoutEffect : a.useEffect,
|
|
d = (0, a.createContext)(null);
|
|
function p(t) {
|
|
return "object" == typeof t && null !== t;
|
|
}
|
|
function m(t) {
|
|
return p(t) && "offsetHeight" in t;
|
|
}
|
|
var f = a;
|
|
let g = (0, a.createContext)({
|
|
transformPagePoint: (t) => t,
|
|
isStatic: !1,
|
|
reducedMotion: "never",
|
|
});
|
|
function v(t, e) {
|
|
if ("function" == typeof t) return t(e);
|
|
null != t && (t.current = e);
|
|
}
|
|
class y extends f.Component {
|
|
getSnapshotBeforeUpdate(t) {
|
|
let e = this.props.childRef.current;
|
|
if (e && t.isPresent && !this.props.isPresent) {
|
|
let t = e.offsetParent,
|
|
i = (m(t) && t.offsetWidth) || 0,
|
|
n = (m(t) && t.offsetHeight) || 0,
|
|
o = this.props.sizeRef.current;
|
|
(o.height = e.offsetHeight || 0),
|
|
(o.width = e.offsetWidth || 0),
|
|
(o.top = e.offsetTop),
|
|
(o.left = e.offsetLeft),
|
|
(o.right = i - o.width - o.left),
|
|
(o.bottom = n - o.height - o.top);
|
|
}
|
|
return null;
|
|
}
|
|
componentDidUpdate() {}
|
|
render() {
|
|
return this.props.children;
|
|
}
|
|
}
|
|
function b({ children: t, isPresent: e, anchorX: i, anchorY: n, root: o }) {
|
|
let r = (0, f.useId)(),
|
|
l = (0, f.useRef)(null),
|
|
c = (0, f.useRef)({
|
|
width: 0,
|
|
height: 0,
|
|
top: 0,
|
|
left: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
}),
|
|
{ nonce: u } = (0, f.useContext)(g),
|
|
h = (function (...t) {
|
|
return a.useCallback(
|
|
(function (...t) {
|
|
return (e) => {
|
|
let i = !1,
|
|
n = t.map((t) => {
|
|
let n = v(t, e);
|
|
return i || "function" != typeof n || (i = !0), n;
|
|
});
|
|
if (i)
|
|
return () => {
|
|
for (let e = 0; e < n.length; e++) {
|
|
let i = n[e];
|
|
"function" == typeof i ? i() : v(t[e], null);
|
|
}
|
|
};
|
|
};
|
|
})(...t),
|
|
t,
|
|
);
|
|
})(l, t.props?.ref ?? t?.ref);
|
|
return (
|
|
(0, f.useInsertionEffect)(() => {
|
|
let {
|
|
width: t,
|
|
height: s,
|
|
top: a,
|
|
left: h,
|
|
right: d,
|
|
bottom: p,
|
|
} = c.current;
|
|
if (e || !l.current || !t || !s) return;
|
|
let m = "left" === i ? `left: ${h}` : `right: ${d}`,
|
|
f = "bottom" === n ? `bottom: ${p}` : `top: ${a}`;
|
|
l.current.dataset.motionPopId = r;
|
|
let g = document.createElement("style");
|
|
u && (g.nonce = u);
|
|
let v = o ?? document.head;
|
|
return (
|
|
v.appendChild(g),
|
|
g.sheet &&
|
|
g.sheet.insertRule(`
|
|
[data-motion-pop-id="${r}"] {
|
|
position: absolute !important;
|
|
width: ${t}px !important;
|
|
height: ${s}px !important;
|
|
${m}px !important;
|
|
${f}px !important;
|
|
}
|
|
`),
|
|
() => {
|
|
v.contains(g) && v.removeChild(g);
|
|
}
|
|
);
|
|
}, [e]),
|
|
(0, s.jsx)(y, {
|
|
isPresent: e,
|
|
childRef: l,
|
|
sizeRef: c,
|
|
children: f.cloneElement(t, { ref: h }),
|
|
})
|
|
);
|
|
}
|
|
let I = ({
|
|
children: t,
|
|
initial: e,
|
|
isPresent: i,
|
|
onExitComplete: n,
|
|
custom: o,
|
|
presenceAffectsLayout: r,
|
|
mode: l,
|
|
anchorX: u,
|
|
anchorY: h,
|
|
root: p,
|
|
}) => {
|
|
let m = c(x),
|
|
f = (0, a.useId)(),
|
|
g = !0,
|
|
v = (0, a.useMemo)(
|
|
() => (
|
|
(g = !1),
|
|
{
|
|
id: f,
|
|
initial: e,
|
|
isPresent: i,
|
|
custom: o,
|
|
onExitComplete: (t) => {
|
|
for (let e of (m.set(t, !0), m.values())) if (!e) return;
|
|
n && n();
|
|
},
|
|
register: (t) => (m.set(t, !1), () => m.delete(t)),
|
|
}
|
|
),
|
|
[i, m, n],
|
|
);
|
|
return (
|
|
r && g && (v = { ...v }),
|
|
(0, a.useMemo)(() => {
|
|
m.forEach((t, e) => m.set(e, !1));
|
|
}, [i]),
|
|
a.useEffect(() => {
|
|
i || m.size || !n || n();
|
|
}, [i]),
|
|
"popLayout" === l &&
|
|
(t = (0, s.jsx)(b, {
|
|
isPresent: i,
|
|
anchorX: u,
|
|
anchorY: h,
|
|
root: p,
|
|
children: t,
|
|
})),
|
|
(0, s.jsx)(d.Provider, { value: v, children: t })
|
|
);
|
|
};
|
|
function x() {
|
|
return new Map();
|
|
}
|
|
function w(t = !0) {
|
|
let e = (0, a.useContext)(d);
|
|
if (null === e) return [!0, null];
|
|
let { isPresent: i, onExitComplete: n, register: o } = e,
|
|
r = (0, a.useId)();
|
|
(0, a.useEffect)(() => {
|
|
if (t) return o(r);
|
|
}, [t]);
|
|
let s = (0, a.useCallback)(() => t && n && n(r), [r, n, t]);
|
|
return !i && n ? [!1, s] : [!0];
|
|
}
|
|
let S = (t) => t.key || "";
|
|
function T(t) {
|
|
let e = [];
|
|
return (
|
|
a.Children.forEach(t, (t) => {
|
|
(0, a.isValidElement)(t) && e.push(t);
|
|
}),
|
|
e
|
|
);
|
|
}
|
|
let P = ({
|
|
children: t,
|
|
custom: e,
|
|
initial: i = !0,
|
|
onExitComplete: n,
|
|
presenceAffectsLayout: o = !0,
|
|
mode: r = "sync",
|
|
propagate: u = !1,
|
|
anchorX: d = "left",
|
|
anchorY: p = "top",
|
|
root: m,
|
|
}) => {
|
|
let [f, g] = w(u),
|
|
v = (0, a.useMemo)(() => T(t), [t]),
|
|
y = u && !f ? [] : v.map(S),
|
|
b = (0, a.useRef)(!0),
|
|
x = (0, a.useRef)(v),
|
|
P = c(() => new Map()),
|
|
k = (0, a.useRef)(new Set()),
|
|
[A, C] = (0, a.useState)(v),
|
|
[E, L] = (0, a.useState)(v);
|
|
h(() => {
|
|
(b.current = !1), (x.current = v);
|
|
for (let t = 0; t < E.length; t++) {
|
|
let e = S(E[t]);
|
|
y.includes(e)
|
|
? (P.delete(e), k.current.delete(e))
|
|
: !0 !== P.get(e) && P.set(e, !1);
|
|
}
|
|
}, [E, y.length, y.join("-")]);
|
|
let M = [];
|
|
if (v !== A) {
|
|
let t = [...v];
|
|
for (let e = 0; e < E.length; e++) {
|
|
let i = E[e],
|
|
n = S(i);
|
|
y.includes(n) || (t.splice(e, 0, i), M.push(i));
|
|
}
|
|
return "wait" === r && M.length && (t = M), L(T(t)), C(v), null;
|
|
}
|
|
let { forceRender: R } = (0, a.useContext)(l);
|
|
return (0, s.jsx)(s.Fragment, {
|
|
children: E.map((t) => {
|
|
let a = S(t),
|
|
l = (!u || !!f) && (v === E || y.includes(a));
|
|
return (0, s.jsx)(
|
|
I,
|
|
{
|
|
isPresent: l,
|
|
initial: (!b.current || !!i) && void 0,
|
|
custom: e,
|
|
presenceAffectsLayout: o,
|
|
mode: r,
|
|
root: m,
|
|
onExitComplete: l
|
|
? void 0
|
|
: () => {
|
|
if (k.current.has(a) || (k.current.add(a), !P.has(a)))
|
|
return;
|
|
P.set(a, !0);
|
|
let t = !0;
|
|
P.forEach((e) => {
|
|
e || (t = !1);
|
|
}),
|
|
t && (R?.(), L(x.current), u && g?.(), n && n());
|
|
},
|
|
anchorX: d,
|
|
anchorY: p,
|
|
children: t,
|
|
},
|
|
a,
|
|
);
|
|
}),
|
|
});
|
|
};
|
|
t.s(["AnimatePresence", () => P], 955595);
|
|
let k = [
|
|
"transformPerspective",
|
|
"x",
|
|
"y",
|
|
"z",
|
|
"translateX",
|
|
"translateY",
|
|
"translateZ",
|
|
"scale",
|
|
"scaleX",
|
|
"scaleY",
|
|
"rotate",
|
|
"rotateX",
|
|
"rotateY",
|
|
"rotateZ",
|
|
"skew",
|
|
"skewX",
|
|
"skewY",
|
|
],
|
|
A = new Set(k),
|
|
C = (t, e, i) => (i > e ? e : i < t ? t : i),
|
|
E = {
|
|
test: (t) => "number" == typeof t,
|
|
parse: parseFloat,
|
|
transform: (t) => t,
|
|
},
|
|
L = { ...E, transform: (t) => C(0, 1, t) },
|
|
M = { ...E, default: 1 },
|
|
R = (t) => Math.round(1e5 * t) / 1e5,
|
|
D = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu,
|
|
V =
|
|
/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,
|
|
F = (t, e) => (i) =>
|
|
!!(
|
|
("string" == typeof i && V.test(i) && i.startsWith(t)) ||
|
|
(e && null != i && Object.prototype.hasOwnProperty.call(i, e))
|
|
),
|
|
j = (t, e, i) => (n) => {
|
|
if ("string" != typeof n) return n;
|
|
let [o, r, s, a] = n.match(D);
|
|
return {
|
|
[t]: parseFloat(o),
|
|
[e]: parseFloat(r),
|
|
[i]: parseFloat(s),
|
|
alpha: void 0 !== a ? parseFloat(a) : 1,
|
|
};
|
|
},
|
|
N = { ...E, transform: (t) => Math.round(C(0, 255, t)) },
|
|
B = {
|
|
test: F("rgb", "red"),
|
|
parse: j("red", "green", "blue"),
|
|
transform: ({ red: t, green: e, blue: i, alpha: n = 1 }) =>
|
|
"rgba(" +
|
|
N.transform(t) +
|
|
", " +
|
|
N.transform(e) +
|
|
", " +
|
|
N.transform(i) +
|
|
", " +
|
|
R(L.transform(n)) +
|
|
")",
|
|
},
|
|
O = {
|
|
test: F("#"),
|
|
parse: function (t) {
|
|
let e = "",
|
|
i = "",
|
|
n = "",
|
|
o = "";
|
|
return (
|
|
t.length > 5
|
|
? ((e = t.substring(1, 3)),
|
|
(i = t.substring(3, 5)),
|
|
(n = t.substring(5, 7)),
|
|
(o = t.substring(7, 9)))
|
|
: ((e = t.substring(1, 2)),
|
|
(i = t.substring(2, 3)),
|
|
(n = t.substring(3, 4)),
|
|
(o = t.substring(4, 5)),
|
|
(e += e),
|
|
(i += i),
|
|
(n += n),
|
|
(o += o)),
|
|
{
|
|
red: parseInt(e, 16),
|
|
green: parseInt(i, 16),
|
|
blue: parseInt(n, 16),
|
|
alpha: o ? parseInt(o, 16) / 255 : 1,
|
|
}
|
|
);
|
|
},
|
|
transform: B.transform,
|
|
},
|
|
U = (t) => ({
|
|
test: (e) =>
|
|
"string" == typeof e && e.endsWith(t) && 1 === e.split(" ").length,
|
|
parse: parseFloat,
|
|
transform: (e) => `${e}${t}`,
|
|
}),
|
|
H = U("deg"),
|
|
z = U("%"),
|
|
W = U("px"),
|
|
$ = U("vh"),
|
|
G = U("vw"),
|
|
X = {
|
|
...z,
|
|
parse: (t) => z.parse(t) / 100,
|
|
transform: (t) => z.transform(100 * t),
|
|
},
|
|
Y = {
|
|
test: F("hsl", "hue"),
|
|
parse: j("hue", "saturation", "lightness"),
|
|
transform: ({ hue: t, saturation: e, lightness: i, alpha: n = 1 }) =>
|
|
"hsla(" +
|
|
Math.round(t) +
|
|
", " +
|
|
z.transform(R(e)) +
|
|
", " +
|
|
z.transform(R(i)) +
|
|
", " +
|
|
R(L.transform(n)) +
|
|
")",
|
|
},
|
|
q = {
|
|
test: (t) => B.test(t) || O.test(t) || Y.test(t),
|
|
parse: (t) =>
|
|
B.test(t) ? B.parse(t) : Y.test(t) ? Y.parse(t) : O.parse(t),
|
|
transform: (t) =>
|
|
"string" == typeof t
|
|
? t
|
|
: t.hasOwnProperty("red")
|
|
? B.transform(t)
|
|
: Y.transform(t),
|
|
getAnimatableNone: (t) => {
|
|
let e = q.parse(t);
|
|
return (e.alpha = 0), q.transform(e);
|
|
},
|
|
},
|
|
K =
|
|
/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,
|
|
_ = "number",
|
|
Z = "color",
|
|
Q =
|
|
/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;
|
|
function J(t) {
|
|
let e = t.toString(),
|
|
i = [],
|
|
n = { color: [], number: [], var: [] },
|
|
o = [],
|
|
r = 0,
|
|
s = e
|
|
.replace(
|
|
Q,
|
|
(t) => (
|
|
q.test(t)
|
|
? (n.color.push(r), o.push(Z), i.push(q.parse(t)))
|
|
: t.startsWith("var(")
|
|
? (n.var.push(r), o.push("var"), i.push(t))
|
|
: (n.number.push(r), o.push(_), i.push(parseFloat(t))),
|
|
++r,
|
|
"${}"
|
|
),
|
|
)
|
|
.split("${}");
|
|
return { values: i, split: s, indexes: n, types: o };
|
|
}
|
|
function tt(t) {
|
|
return J(t).values;
|
|
}
|
|
function te(t) {
|
|
let { split: e, types: i } = J(t),
|
|
n = e.length;
|
|
return (t) => {
|
|
let o = "";
|
|
for (let r = 0; r < n; r++)
|
|
if (((o += e[r]), void 0 !== t[r])) {
|
|
let e = i[r];
|
|
e === _
|
|
? (o += R(t[r]))
|
|
: e === Z
|
|
? (o += q.transform(t[r]))
|
|
: (o += t[r]);
|
|
}
|
|
return o;
|
|
};
|
|
}
|
|
let ti = (t) =>
|
|
"number" == typeof t ? 0 : q.test(t) ? q.getAnimatableNone(t) : t,
|
|
tn = {
|
|
test: function (t) {
|
|
return (
|
|
isNaN(t) &&
|
|
"string" == typeof t &&
|
|
(t.match(D)?.length || 0) + (t.match(K)?.length || 0) > 0
|
|
);
|
|
},
|
|
parse: tt,
|
|
createTransformer: te,
|
|
getAnimatableNone: function (t) {
|
|
let e = tt(t);
|
|
return te(t)(e.map(ti));
|
|
},
|
|
},
|
|
to = new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
function tr(t) {
|
|
let [e, i] = t.slice(0, -1).split("(");
|
|
if ("drop-shadow" === e) return t;
|
|
let [n] = i.match(D) || [];
|
|
if (!n) return t;
|
|
let o = i.replace(n, ""),
|
|
r = +!!to.has(e);
|
|
return n !== i && (r *= 100), e + "(" + r + o + ")";
|
|
}
|
|
let ts = /\b([a-z-]*)\(.*?\)/gu,
|
|
ta = {
|
|
...tn,
|
|
getAnimatableNone: (t) => {
|
|
let e = t.match(ts);
|
|
return e ? e.map(tr).join(" ") : t;
|
|
},
|
|
},
|
|
tl = { ...E, transform: Math.round },
|
|
tc = {
|
|
borderWidth: W,
|
|
borderTopWidth: W,
|
|
borderRightWidth: W,
|
|
borderBottomWidth: W,
|
|
borderLeftWidth: W,
|
|
borderRadius: W,
|
|
borderTopLeftRadius: W,
|
|
borderTopRightRadius: W,
|
|
borderBottomRightRadius: W,
|
|
borderBottomLeftRadius: W,
|
|
width: W,
|
|
maxWidth: W,
|
|
height: W,
|
|
maxHeight: W,
|
|
top: W,
|
|
right: W,
|
|
bottom: W,
|
|
left: W,
|
|
inset: W,
|
|
insetBlock: W,
|
|
insetBlockStart: W,
|
|
insetBlockEnd: W,
|
|
insetInline: W,
|
|
insetInlineStart: W,
|
|
insetInlineEnd: W,
|
|
padding: W,
|
|
paddingTop: W,
|
|
paddingRight: W,
|
|
paddingBottom: W,
|
|
paddingLeft: W,
|
|
paddingBlock: W,
|
|
paddingBlockStart: W,
|
|
paddingBlockEnd: W,
|
|
paddingInline: W,
|
|
paddingInlineStart: W,
|
|
paddingInlineEnd: W,
|
|
margin: W,
|
|
marginTop: W,
|
|
marginRight: W,
|
|
marginBottom: W,
|
|
marginLeft: W,
|
|
marginBlock: W,
|
|
marginBlockStart: W,
|
|
marginBlockEnd: W,
|
|
marginInline: W,
|
|
marginInlineStart: W,
|
|
marginInlineEnd: W,
|
|
fontSize: W,
|
|
backgroundPositionX: W,
|
|
backgroundPositionY: W,
|
|
rotate: H,
|
|
rotateX: H,
|
|
rotateY: H,
|
|
rotateZ: H,
|
|
scale: M,
|
|
scaleX: M,
|
|
scaleY: M,
|
|
scaleZ: M,
|
|
skew: H,
|
|
skewX: H,
|
|
skewY: H,
|
|
distance: W,
|
|
translateX: W,
|
|
translateY: W,
|
|
translateZ: W,
|
|
x: W,
|
|
y: W,
|
|
z: W,
|
|
perspective: W,
|
|
transformPerspective: W,
|
|
opacity: L,
|
|
originX: X,
|
|
originY: X,
|
|
originZ: W,
|
|
zIndex: tl,
|
|
fillOpacity: L,
|
|
strokeOpacity: L,
|
|
numOctaves: tl,
|
|
},
|
|
tu = {
|
|
...tc,
|
|
color: q,
|
|
backgroundColor: q,
|
|
outlineColor: q,
|
|
fill: q,
|
|
stroke: q,
|
|
borderColor: q,
|
|
borderTopColor: q,
|
|
borderRightColor: q,
|
|
borderBottomColor: q,
|
|
borderLeftColor: q,
|
|
filter: ta,
|
|
WebkitFilter: ta,
|
|
},
|
|
th = (t) => tu[t],
|
|
td = () => ({ translate: 0, scale: 1, origin: 0, originPoint: 0 }),
|
|
tp = () => ({ x: td(), y: td() }),
|
|
tm = () => ({ min: 0, max: 0 }),
|
|
tf = () => ({ x: tm(), y: tm() }),
|
|
tg = (t) => !!(t && t.getVelocity),
|
|
tv = new Set(["width", "height", "top", "left", "right", "bottom", ...k]),
|
|
ty = (t) => (e) => e.test(t),
|
|
tb = [E, W, z, H, G, $, { test: (t) => "auto" === t, parse: (t) => t }],
|
|
tI = (t) => tb.find(ty(t)),
|
|
tx = () => {},
|
|
tw = () => {};
|
|
r.default;
|
|
let tS = (t) => (e) => "string" == typeof e && e.startsWith(t),
|
|
tT = tS("--"),
|
|
tP = tS("var(--"),
|
|
tk = (t) => !!tP(t) && tA.test(t.split("/*")[0].trim()),
|
|
tA =
|
|
/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
|
|
function tC(t) {
|
|
return "string" == typeof t && t.split("/*")[0].includes("var(--");
|
|
}
|
|
let tE = /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,
|
|
tL = (t) => (180 * t) / Math.PI,
|
|
tM = (t) => tD(tL(Math.atan2(t[1], t[0]))),
|
|
tR = {
|
|
x: 4,
|
|
y: 5,
|
|
translateX: 4,
|
|
translateY: 5,
|
|
scaleX: 0,
|
|
scaleY: 3,
|
|
scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
|
|
rotate: tM,
|
|
rotateZ: tM,
|
|
skewX: (t) => tL(Math.atan(t[1])),
|
|
skewY: (t) => tL(Math.atan(t[2])),
|
|
skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2,
|
|
},
|
|
tD = (t) => ((t %= 360) < 0 && (t += 360), t),
|
|
tV = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]),
|
|
tF = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]),
|
|
tj = {
|
|
x: 12,
|
|
y: 13,
|
|
z: 14,
|
|
translateX: 12,
|
|
translateY: 13,
|
|
translateZ: 14,
|
|
scaleX: tV,
|
|
scaleY: tF,
|
|
scale: (t) => (tV(t) + tF(t)) / 2,
|
|
rotateX: (t) => tD(tL(Math.atan2(t[6], t[5]))),
|
|
rotateY: (t) => tD(tL(Math.atan2(-t[2], t[0]))),
|
|
rotateZ: tM,
|
|
rotate: tM,
|
|
skewX: (t) => tL(Math.atan(t[4])),
|
|
skewY: (t) => tL(Math.atan(t[1])),
|
|
skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2,
|
|
};
|
|
function tN(t) {
|
|
return +!!t.includes("scale");
|
|
}
|
|
function tB(t, e) {
|
|
let i, n;
|
|
if (!t || "none" === t) return tN(e);
|
|
let o = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
|
if (o) (i = tj), (n = o);
|
|
else {
|
|
let e = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
|
(i = tR), (n = e);
|
|
}
|
|
if (!n) return tN(e);
|
|
let r = i[e],
|
|
s = n[1].split(",").map(tO);
|
|
return "function" == typeof r ? r(s) : s[r];
|
|
}
|
|
function tO(t) {
|
|
return parseFloat(t.trim());
|
|
}
|
|
let tU = (t) => t === E || t === W,
|
|
tH = new Set(["x", "y", "z"]),
|
|
tz = k.filter((t) => !tH.has(t)),
|
|
tW = {
|
|
width: ({ x: t }, { paddingLeft: e = "0", paddingRight: i = "0" }) =>
|
|
t.max - t.min - parseFloat(e) - parseFloat(i),
|
|
height: ({ y: t }, { paddingTop: e = "0", paddingBottom: i = "0" }) =>
|
|
t.max - t.min - parseFloat(e) - parseFloat(i),
|
|
top: (t, { top: e }) => parseFloat(e),
|
|
left: (t, { left: e }) => parseFloat(e),
|
|
bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
|
|
right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
|
|
x: (t, { transform: e }) => tB(e, "x"),
|
|
y: (t, { transform: e }) => tB(e, "y"),
|
|
};
|
|
(tW.translateX = tW.x), (tW.translateY = tW.y);
|
|
let t$ = (t) => t,
|
|
tG = {},
|
|
tX = [
|
|
"setup",
|
|
"read",
|
|
"resolveKeyframes",
|
|
"preUpdate",
|
|
"update",
|
|
"preRender",
|
|
"render",
|
|
"postRender",
|
|
];
|
|
function tY(t, e) {
|
|
let i = !1,
|
|
n = !0,
|
|
o = { delta: 0, timestamp: 0, isProcessing: !1 },
|
|
r = () => (i = !0),
|
|
s = tX.reduce(
|
|
(t, i) => (
|
|
(t[i] = (function (t, e) {
|
|
let i = new Set(),
|
|
n = new Set(),
|
|
o = !1,
|
|
r = !1,
|
|
s = new WeakSet(),
|
|
a = { delta: 0, timestamp: 0, isProcessing: !1 },
|
|
l = 0;
|
|
function c(e) {
|
|
s.has(e) && (u.schedule(e), t()), l++, e(a);
|
|
}
|
|
let u = {
|
|
schedule: (t, e = !1, r = !1) => {
|
|
let a = r && o ? i : n;
|
|
return e && s.add(t), a.has(t) || a.add(t), t;
|
|
},
|
|
cancel: (t) => {
|
|
n.delete(t), s.delete(t);
|
|
},
|
|
process: (t) => {
|
|
if (((a = t), o)) {
|
|
r = !0;
|
|
return;
|
|
}
|
|
(o = !0),
|
|
([i, n] = [n, i]),
|
|
i.forEach(c),
|
|
e,
|
|
(l = 0),
|
|
i.clear(),
|
|
(o = !1),
|
|
r && ((r = !1), u.process(t));
|
|
},
|
|
};
|
|
return u;
|
|
})(r, e ? i : void 0)),
|
|
t
|
|
),
|
|
{},
|
|
),
|
|
{
|
|
setup: a,
|
|
read: l,
|
|
resolveKeyframes: c,
|
|
preUpdate: u,
|
|
update: h,
|
|
preRender: d,
|
|
render: p,
|
|
postRender: m,
|
|
} = s,
|
|
f = () => {
|
|
let r = tG.useManualTiming ? o.timestamp : performance.now();
|
|
(i = !1),
|
|
tG.useManualTiming ||
|
|
(o.delta = n
|
|
? 1e3 / 60
|
|
: Math.max(Math.min(r - o.timestamp, 40), 1)),
|
|
(o.timestamp = r),
|
|
(o.isProcessing = !0),
|
|
a.process(o),
|
|
l.process(o),
|
|
c.process(o),
|
|
u.process(o),
|
|
h.process(o),
|
|
d.process(o),
|
|
p.process(o),
|
|
m.process(o),
|
|
(o.isProcessing = !1),
|
|
i && e && ((n = !1), t(f));
|
|
};
|
|
return {
|
|
schedule: tX.reduce((e, r) => {
|
|
let a = s[r];
|
|
return (
|
|
(e[r] = (e, r = !1, s = !1) => (
|
|
!i && ((i = !0), (n = !0), o.isProcessing || t(f)),
|
|
a.schedule(e, r, s)
|
|
)),
|
|
e
|
|
);
|
|
}, {}),
|
|
cancel: (t) => {
|
|
for (let e = 0; e < tX.length; e++) s[tX[e]].cancel(t);
|
|
},
|
|
state: o,
|
|
steps: s,
|
|
};
|
|
}
|
|
let {
|
|
schedule: tq,
|
|
cancel: tK,
|
|
state: t_,
|
|
steps: tZ,
|
|
} = tY(
|
|
"u" > typeof requestAnimationFrame ? requestAnimationFrame : t$,
|
|
!0,
|
|
),
|
|
tQ = new Set(),
|
|
tJ = !1,
|
|
t0 = !1,
|
|
t1 = !1;
|
|
function t2() {
|
|
if (t0) {
|
|
let t = Array.from(tQ).filter((t) => t.needsMeasurement),
|
|
e = new Set(t.map((t) => t.element)),
|
|
i = new Map();
|
|
e.forEach((t) => {
|
|
let e,
|
|
n =
|
|
((e = []),
|
|
tz.forEach((i) => {
|
|
let n = t.getValue(i);
|
|
void 0 !== n &&
|
|
(e.push([i, n.get()]), n.set(+!!i.startsWith("scale")));
|
|
}),
|
|
e);
|
|
n.length && (i.set(t, n), t.render());
|
|
}),
|
|
t.forEach((t) => t.measureInitialState()),
|
|
e.forEach((t) => {
|
|
t.render();
|
|
let e = i.get(t);
|
|
e &&
|
|
e.forEach(([e, i]) => {
|
|
t.getValue(e)?.set(i);
|
|
});
|
|
}),
|
|
t.forEach((t) => t.measureEndState()),
|
|
t.forEach((t) => {
|
|
void 0 !== t.suspendedScrollY &&
|
|
window.scrollTo(0, t.suspendedScrollY);
|
|
});
|
|
}
|
|
(t0 = !1), (tJ = !1), tQ.forEach((t) => t.complete(t1)), tQ.clear();
|
|
}
|
|
function t5() {
|
|
tQ.forEach((t) => {
|
|
t.readKeyframes(), t.needsMeasurement && (t0 = !0);
|
|
});
|
|
}
|
|
class t3 {
|
|
constructor(t, e, i, n, o, r = !1) {
|
|
(this.state = "pending"),
|
|
(this.isAsync = !1),
|
|
(this.needsMeasurement = !1),
|
|
(this.unresolvedKeyframes = [...t]),
|
|
(this.onComplete = e),
|
|
(this.name = i),
|
|
(this.motionValue = n),
|
|
(this.element = o),
|
|
(this.isAsync = r);
|
|
}
|
|
scheduleResolve() {
|
|
(this.state = "scheduled"),
|
|
this.isAsync
|
|
? (tQ.add(this),
|
|
tJ || ((tJ = !0), tq.read(t5), tq.resolveKeyframes(t2)))
|
|
: (this.readKeyframes(), this.complete());
|
|
}
|
|
readKeyframes() {
|
|
let {
|
|
unresolvedKeyframes: t,
|
|
name: e,
|
|
element: i,
|
|
motionValue: n,
|
|
} = this;
|
|
if (null === t[0]) {
|
|
let o = n?.get(),
|
|
r = t[t.length - 1];
|
|
if (void 0 !== o) t[0] = o;
|
|
else if (i && e) {
|
|
let n = i.readValue(e, r);
|
|
null != n && (t[0] = n);
|
|
}
|
|
void 0 === t[0] && (t[0] = r), n && void 0 === o && n.set(t[0]);
|
|
}
|
|
for (let e = 1; e < t.length; e++) t[e] ?? (t[e] = t[e - 1]);
|
|
}
|
|
setFinalKeyframe() {}
|
|
measureInitialState() {}
|
|
renderEndStyles() {}
|
|
measureEndState() {}
|
|
complete(t = !1) {
|
|
(this.state = "complete"),
|
|
this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, t),
|
|
tQ.delete(this);
|
|
}
|
|
cancel() {
|
|
"scheduled" === this.state &&
|
|
(tQ.delete(this), (this.state = "pending"));
|
|
}
|
|
resume() {
|
|
"pending" === this.state && this.scheduleResolve();
|
|
}
|
|
}
|
|
function t9(t, e) {
|
|
let i = th(t);
|
|
return (
|
|
i !== ta && (i = tn),
|
|
i.getAnimatableNone ? i.getAnimatableNone(e) : void 0
|
|
);
|
|
}
|
|
let t4 = new Set(["auto", "none", "0"]);
|
|
class t6 extends t3 {
|
|
constructor(t, e, i, n, o) {
|
|
super(t, e, i, n, o, !0);
|
|
}
|
|
readKeyframes() {
|
|
let { unresolvedKeyframes: t, element: e, name: i } = this;
|
|
if (!e || !e.current) return;
|
|
super.readKeyframes();
|
|
for (let i = 0; i < t.length; i++) {
|
|
let n = t[i];
|
|
if ("string" == typeof n && tk((n = n.trim()))) {
|
|
let o = (function t(e, i, n = 1) {
|
|
tw(
|
|
n <= 4,
|
|
`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,
|
|
"max-css-var-depth",
|
|
);
|
|
let [o, r] = (function (t) {
|
|
let e = tE.exec(t);
|
|
if (!e) return [,];
|
|
let [, i, n, o] = e;
|
|
return [`--${i ?? n}`, o];
|
|
})(e);
|
|
if (!o) return;
|
|
let s = window.getComputedStyle(i).getPropertyValue(o);
|
|
if (s) {
|
|
let t = s.trim();
|
|
return /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t)
|
|
? parseFloat(t)
|
|
: t;
|
|
}
|
|
return tk(r) ? t(r, i, n + 1) : r;
|
|
})(n, e.current);
|
|
void 0 !== o && (t[i] = o),
|
|
i === t.length - 1 && (this.finalKeyframe = n);
|
|
}
|
|
}
|
|
if ((this.resolveNoneKeyframes(), !tv.has(i) || 2 !== t.length)) return;
|
|
let [n, o] = t,
|
|
r = tI(n),
|
|
s = tI(o);
|
|
if (tC(n) !== tC(o) && tW[i]) {
|
|
this.needsMeasurement = !0;
|
|
return;
|
|
}
|
|
if (r !== s)
|
|
if (tU(r) && tU(s))
|
|
for (let e = 0; e < t.length; e++) {
|
|
let i = t[e];
|
|
"string" == typeof i && (t[e] = parseFloat(i));
|
|
}
|
|
else tW[i] && (this.needsMeasurement = !0);
|
|
}
|
|
resolveNoneKeyframes() {
|
|
let { unresolvedKeyframes: t, name: e } = this,
|
|
i = [];
|
|
for (let e = 0; e < t.length; e++)
|
|
(null === t[e] ||
|
|
(function (t) {
|
|
if ("number" == typeof t) return 0 === t;
|
|
if (null === t) return !0;
|
|
return "none" === t || "0" === t || /^0[^.\s]+$/u.test(t);
|
|
})(t[e])) &&
|
|
i.push(e);
|
|
i.length &&
|
|
(function (t, e, i) {
|
|
let n,
|
|
o = 0;
|
|
for (; o < t.length && !n; ) {
|
|
let e = t[o];
|
|
"string" == typeof e &&
|
|
!t4.has(e) &&
|
|
J(e).values.length &&
|
|
(n = t[o]),
|
|
o++;
|
|
}
|
|
if (n && i) for (let o of e) t[o] = t9(i, n);
|
|
})(t, i, e);
|
|
}
|
|
measureInitialState() {
|
|
let { element: t, unresolvedKeyframes: e, name: i } = this;
|
|
if (!t || !t.current) return;
|
|
"height" === i && (this.suspendedScrollY = window.pageYOffset),
|
|
(this.measuredOrigin = tW[i](
|
|
t.measureViewportBox(),
|
|
window.getComputedStyle(t.current),
|
|
)),
|
|
(e[0] = this.measuredOrigin);
|
|
let n = e[e.length - 1];
|
|
void 0 !== n && t.getValue(i, n).jump(n, !1);
|
|
}
|
|
measureEndState() {
|
|
let { element: t, name: e, unresolvedKeyframes: i } = this;
|
|
if (!t || !t.current) return;
|
|
let n = t.getValue(e);
|
|
n && n.jump(this.measuredOrigin, !1);
|
|
let o = i.length - 1,
|
|
r = i[o];
|
|
(i[o] = tW[e](
|
|
t.measureViewportBox(),
|
|
window.getComputedStyle(t.current),
|
|
)),
|
|
null !== r &&
|
|
void 0 === this.finalKeyframe &&
|
|
(this.finalKeyframe = r),
|
|
this.removedTransforms?.length &&
|
|
this.removedTransforms.forEach(([e, i]) => {
|
|
t.getValue(e).set(i);
|
|
}),
|
|
this.resolveNoneKeyframes();
|
|
}
|
|
}
|
|
function t7(t, e) {
|
|
-1 === t.indexOf(e) && t.push(e);
|
|
}
|
|
function t8(t, e) {
|
|
let i = t.indexOf(e);
|
|
i > -1 && t.splice(i, 1);
|
|
}
|
|
class et {
|
|
constructor() {
|
|
this.subscriptions = [];
|
|
}
|
|
add(t) {
|
|
return t7(this.subscriptions, t), () => t8(this.subscriptions, t);
|
|
}
|
|
notify(t, e, i) {
|
|
let n = this.subscriptions.length;
|
|
if (n)
|
|
if (1 === n) this.subscriptions[0](t, e, i);
|
|
else
|
|
for (let o = 0; o < n; o++) {
|
|
let n = this.subscriptions[o];
|
|
n && n(t, e, i);
|
|
}
|
|
}
|
|
getSize() {
|
|
return this.subscriptions.length;
|
|
}
|
|
clear() {
|
|
this.subscriptions.length = 0;
|
|
}
|
|
}
|
|
let { schedule: ee } = tY(queueMicrotask, !1);
|
|
function ei() {
|
|
e = void 0;
|
|
}
|
|
let en = {
|
|
now: () => (
|
|
void 0 === e &&
|
|
en.set(
|
|
t_.isProcessing || tG.useManualTiming
|
|
? t_.timestamp
|
|
: performance.now(),
|
|
),
|
|
e
|
|
),
|
|
set: (t) => {
|
|
(e = t), queueMicrotask(ei);
|
|
},
|
|
};
|
|
class eo {
|
|
constructor(t, e = {}) {
|
|
(this.canTrackVelocity = null),
|
|
(this.events = {}),
|
|
(this.updateAndNotify = (t) => {
|
|
let e = en.now();
|
|
if (
|
|
(this.updatedAt !== e && this.setPrevFrameValue(),
|
|
(this.prev = this.current),
|
|
this.setCurrent(t),
|
|
this.current !== this.prev &&
|
|
(this.events.change?.notify(this.current), this.dependents))
|
|
)
|
|
for (let t of this.dependents) t.dirty();
|
|
}),
|
|
(this.hasAnimated = !1),
|
|
this.setCurrent(t),
|
|
(this.owner = e.owner);
|
|
}
|
|
setCurrent(t) {
|
|
(this.current = t),
|
|
(this.updatedAt = en.now()),
|
|
null === this.canTrackVelocity &&
|
|
void 0 !== t &&
|
|
(this.canTrackVelocity = !isNaN(parseFloat(this.current)));
|
|
}
|
|
setPrevFrameValue(t = this.current) {
|
|
(this.prevFrameValue = t), (this.prevUpdatedAt = this.updatedAt);
|
|
}
|
|
onChange(t) {
|
|
return this.on("change", t);
|
|
}
|
|
on(t, e) {
|
|
this.events[t] || (this.events[t] = new et());
|
|
let i = this.events[t].add(e);
|
|
return "change" === t
|
|
? () => {
|
|
i(),
|
|
tq.read(() => {
|
|
this.events.change.getSize() || this.stop();
|
|
});
|
|
}
|
|
: i;
|
|
}
|
|
clearListeners() {
|
|
for (let t in this.events) this.events[t].clear();
|
|
}
|
|
attach(t, e) {
|
|
(this.passiveEffect = t), (this.stopPassiveEffect = e);
|
|
}
|
|
set(t) {
|
|
this.passiveEffect
|
|
? this.passiveEffect(t, this.updateAndNotify)
|
|
: this.updateAndNotify(t);
|
|
}
|
|
setWithVelocity(t, e, i) {
|
|
this.set(e),
|
|
(this.prev = void 0),
|
|
(this.prevFrameValue = t),
|
|
(this.prevUpdatedAt = this.updatedAt - i);
|
|
}
|
|
jump(t, e = !0) {
|
|
this.updateAndNotify(t),
|
|
(this.prev = t),
|
|
(this.prevUpdatedAt = this.prevFrameValue = void 0),
|
|
e && this.stop(),
|
|
this.stopPassiveEffect && this.stopPassiveEffect();
|
|
}
|
|
dirty() {
|
|
this.events.change?.notify(this.current);
|
|
}
|
|
addDependent(t) {
|
|
this.dependents || (this.dependents = new Set()),
|
|
this.dependents.add(t);
|
|
}
|
|
removeDependent(t) {
|
|
this.dependents && this.dependents.delete(t);
|
|
}
|
|
get() {
|
|
return n && n.push(this), this.current;
|
|
}
|
|
getPrevious() {
|
|
return this.prev;
|
|
}
|
|
getVelocity() {
|
|
var t;
|
|
let e = en.now();
|
|
if (
|
|
!this.canTrackVelocity ||
|
|
void 0 === this.prevFrameValue ||
|
|
e - this.updatedAt > 30
|
|
)
|
|
return 0;
|
|
let i = Math.min(this.updatedAt - this.prevUpdatedAt, 30);
|
|
return (
|
|
(t = parseFloat(this.current) - parseFloat(this.prevFrameValue)),
|
|
i ? (1e3 / i) * t : 0
|
|
);
|
|
}
|
|
start(t) {
|
|
return (
|
|
this.stop(),
|
|
new Promise((e) => {
|
|
(this.hasAnimated = !0),
|
|
(this.animation = t(e)),
|
|
this.events.animationStart && this.events.animationStart.notify();
|
|
}).then(() => {
|
|
this.events.animationComplete &&
|
|
this.events.animationComplete.notify(),
|
|
this.clearAnimation();
|
|
})
|
|
);
|
|
}
|
|
stop() {
|
|
this.animation &&
|
|
(this.animation.stop(),
|
|
this.events.animationCancel && this.events.animationCancel.notify()),
|
|
this.clearAnimation();
|
|
}
|
|
isAnimating() {
|
|
return !!this.animation;
|
|
}
|
|
clearAnimation() {
|
|
delete this.animation;
|
|
}
|
|
destroy() {
|
|
this.dependents?.clear(),
|
|
this.events.destroy?.notify(),
|
|
this.clearListeners(),
|
|
this.stop(),
|
|
this.stopPassiveEffect && this.stopPassiveEffect();
|
|
}
|
|
}
|
|
function er(t, e) {
|
|
return new eo(t, e);
|
|
}
|
|
let es = [...tb, q, tn],
|
|
ea = { current: null },
|
|
el = { current: !1 };
|
|
t.s(
|
|
["hasReducedMotionListener", () => el, "prefersReducedMotion", () => ea],
|
|
364306,
|
|
);
|
|
let ec = "u" > typeof window;
|
|
function eu() {
|
|
if (((el.current = !0), ec))
|
|
if (window.matchMedia) {
|
|
let t = window.matchMedia("(prefers-reduced-motion)"),
|
|
e = () => (ea.current = t.matches);
|
|
t.addEventListener("change", e), e();
|
|
} else ea.current = !1;
|
|
}
|
|
t.s(["initPrefersReducedMotion", () => eu], 780086);
|
|
let eh = new WeakMap();
|
|
function ed(t) {
|
|
return null !== t && "object" == typeof t && "function" == typeof t.start;
|
|
}
|
|
function ep(t) {
|
|
return "string" == typeof t || Array.isArray(t);
|
|
}
|
|
let em = [
|
|
"animate",
|
|
"whileInView",
|
|
"whileFocus",
|
|
"whileHover",
|
|
"whileTap",
|
|
"whileDrag",
|
|
"exit",
|
|
],
|
|
ef = ["initial", ...em];
|
|
function eg(t) {
|
|
return ed(t.animate) || ef.some((e) => ep(t[e]));
|
|
}
|
|
function ev(t) {
|
|
return !!(eg(t) || t.variants);
|
|
}
|
|
function ey(t) {
|
|
let e = [{}, {}];
|
|
return (
|
|
t?.values.forEach((t, i) => {
|
|
(e[0][i] = t.get()), (e[1][i] = t.getVelocity());
|
|
}),
|
|
e
|
|
);
|
|
}
|
|
function eb(t, e, i, n) {
|
|
if ("function" == typeof e) {
|
|
let [o, r] = ey(n);
|
|
e = e(void 0 !== i ? i : t.custom, o, r);
|
|
}
|
|
if (
|
|
("string" == typeof e && (e = t.variants && t.variants[e]),
|
|
"function" == typeof e)
|
|
) {
|
|
let [o, r] = ey(n);
|
|
e = e(void 0 !== i ? i : t.custom, o, r);
|
|
}
|
|
return e;
|
|
}
|
|
let eI = [
|
|
"AnimationStart",
|
|
"AnimationComplete",
|
|
"Update",
|
|
"BeforeLayoutMeasure",
|
|
"LayoutMeasure",
|
|
"LayoutAnimationStart",
|
|
"LayoutAnimationComplete",
|
|
],
|
|
ex = {};
|
|
class ew {
|
|
scrapeMotionValuesFromProps(t, e, i) {
|
|
return {};
|
|
}
|
|
constructor(
|
|
{
|
|
parent: t,
|
|
props: e,
|
|
presenceContext: i,
|
|
reducedMotionConfig: n,
|
|
skipAnimations: o,
|
|
blockInitialAnimation: r,
|
|
visualState: s,
|
|
},
|
|
a = {},
|
|
) {
|
|
(this.current = null),
|
|
(this.children = new Set()),
|
|
(this.isVariantNode = !1),
|
|
(this.isControllingVariants = !1),
|
|
(this.shouldReduceMotion = null),
|
|
(this.shouldSkipAnimations = !1),
|
|
(this.values = new Map()),
|
|
(this.KeyframeResolver = t3),
|
|
(this.features = {}),
|
|
(this.valueSubscriptions = new Map()),
|
|
(this.prevMotionValues = {}),
|
|
(this.events = {}),
|
|
(this.propEventSubscriptions = {}),
|
|
(this.notifyUpdate = () => this.notify("Update", this.latestValues)),
|
|
(this.render = () => {
|
|
this.current &&
|
|
(this.triggerBuild(),
|
|
this.renderInstance(
|
|
this.current,
|
|
this.renderState,
|
|
this.props.style,
|
|
this.projection,
|
|
));
|
|
}),
|
|
(this.renderScheduledAt = 0),
|
|
(this.scheduleRender = () => {
|
|
let t = en.now();
|
|
this.renderScheduledAt < t &&
|
|
((this.renderScheduledAt = t), tq.render(this.render, !1, !0));
|
|
});
|
|
const { latestValues: l, renderState: c } = s;
|
|
(this.latestValues = l),
|
|
(this.baseTarget = { ...l }),
|
|
(this.initialValues = e.initial ? { ...l } : {}),
|
|
(this.renderState = c),
|
|
(this.parent = t),
|
|
(this.props = e),
|
|
(this.presenceContext = i),
|
|
(this.depth = t ? t.depth + 1 : 0),
|
|
(this.reducedMotionConfig = n),
|
|
(this.skipAnimationsConfig = o),
|
|
(this.options = a),
|
|
(this.blockInitialAnimation = !!r),
|
|
(this.isControllingVariants = eg(e)),
|
|
(this.isVariantNode = ev(e)),
|
|
this.isVariantNode && (this.variantChildren = new Set()),
|
|
(this.manuallyAnimateOnMount = !!(t && t.current));
|
|
const { willChange: u, ...h } = this.scrapeMotionValuesFromProps(
|
|
e,
|
|
{},
|
|
this,
|
|
);
|
|
for (const t in h) {
|
|
const e = h[t];
|
|
void 0 !== l[t] && tg(e) && e.set(l[t]);
|
|
}
|
|
}
|
|
mount(t) {
|
|
(this.current = t),
|
|
eh.set(t, this),
|
|
this.projection &&
|
|
!this.projection.instance &&
|
|
this.projection.mount(t),
|
|
this.parent &&
|
|
this.isVariantNode &&
|
|
!this.isControllingVariants &&
|
|
(this.removeFromVariantTree = this.parent.addVariantChild(this)),
|
|
this.values.forEach((t, e) => this.bindToMotionValue(e, t)),
|
|
"never" === this.reducedMotionConfig
|
|
? (this.shouldReduceMotion = !1)
|
|
: "always" === this.reducedMotionConfig
|
|
? (this.shouldReduceMotion = !0)
|
|
: (el.current || eu(), (this.shouldReduceMotion = ea.current)),
|
|
(this.shouldSkipAnimations = this.skipAnimationsConfig ?? !1),
|
|
this.parent?.addChild(this),
|
|
this.update(this.props, this.presenceContext);
|
|
}
|
|
unmount() {
|
|
for (let t in (this.projection && this.projection.unmount(),
|
|
tK(this.notifyUpdate),
|
|
tK(this.render),
|
|
this.valueSubscriptions.forEach((t) => t()),
|
|
this.valueSubscriptions.clear(),
|
|
this.removeFromVariantTree && this.removeFromVariantTree(),
|
|
this.parent?.removeChild(this),
|
|
this.events))
|
|
this.events[t].clear();
|
|
for (let t in this.features) {
|
|
let e = this.features[t];
|
|
e && (e.unmount(), (e.isMounted = !1));
|
|
}
|
|
this.current = null;
|
|
}
|
|
addChild(t) {
|
|
this.children.add(t),
|
|
this.enteringChildren ?? (this.enteringChildren = new Set()),
|
|
this.enteringChildren.add(t);
|
|
}
|
|
removeChild(t) {
|
|
this.children.delete(t),
|
|
this.enteringChildren && this.enteringChildren.delete(t);
|
|
}
|
|
bindToMotionValue(t, e) {
|
|
let i;
|
|
this.valueSubscriptions.has(t) && this.valueSubscriptions.get(t)();
|
|
let n = A.has(t);
|
|
n && this.onBindTransform && this.onBindTransform();
|
|
let o = e.on("change", (e) => {
|
|
(this.latestValues[t] = e),
|
|
this.props.onUpdate && tq.preRender(this.notifyUpdate),
|
|
n && this.projection && (this.projection.isTransformDirty = !0),
|
|
this.scheduleRender();
|
|
});
|
|
"u" > typeof window &&
|
|
window.MotionCheckAppearSync &&
|
|
(i = window.MotionCheckAppearSync(this, t, e)),
|
|
this.valueSubscriptions.set(t, () => {
|
|
o(), i && i(), e.owner && e.stop();
|
|
});
|
|
}
|
|
sortNodePosition(t) {
|
|
return this.current &&
|
|
this.sortInstanceNodePosition &&
|
|
this.type === t.type
|
|
? this.sortInstanceNodePosition(this.current, t.current)
|
|
: 0;
|
|
}
|
|
updateFeatures() {
|
|
let t = "animation";
|
|
for (t in ex) {
|
|
let e = ex[t];
|
|
if (!e) continue;
|
|
let { isEnabled: i, Feature: n } = e;
|
|
if (
|
|
(!this.features[t] &&
|
|
n &&
|
|
i(this.props) &&
|
|
(this.features[t] = new n(this)),
|
|
this.features[t])
|
|
) {
|
|
let e = this.features[t];
|
|
e.isMounted ? e.update() : (e.mount(), (e.isMounted = !0));
|
|
}
|
|
}
|
|
}
|
|
triggerBuild() {
|
|
this.build(this.renderState, this.latestValues, this.props);
|
|
}
|
|
measureViewportBox() {
|
|
return this.current
|
|
? this.measureInstanceViewportBox(this.current, this.props)
|
|
: tf();
|
|
}
|
|
getStaticValue(t) {
|
|
return this.latestValues[t];
|
|
}
|
|
setStaticValue(t, e) {
|
|
this.latestValues[t] = e;
|
|
}
|
|
update(t, e) {
|
|
(t.transformTemplate || this.props.transformTemplate) &&
|
|
this.scheduleRender(),
|
|
(this.prevProps = this.props),
|
|
(this.props = t),
|
|
(this.prevPresenceContext = this.presenceContext),
|
|
(this.presenceContext = e);
|
|
for (let e = 0; e < eI.length; e++) {
|
|
let i = eI[e];
|
|
this.propEventSubscriptions[i] &&
|
|
(this.propEventSubscriptions[i](),
|
|
delete this.propEventSubscriptions[i]);
|
|
let n = t["on" + i];
|
|
n && (this.propEventSubscriptions[i] = this.on(i, n));
|
|
}
|
|
(this.prevMotionValues = (function (t, e, i) {
|
|
for (let n in e) {
|
|
let o = e[n],
|
|
r = i[n];
|
|
if (tg(o)) t.addValue(n, o);
|
|
else if (tg(r)) t.addValue(n, er(o, { owner: t }));
|
|
else if (r !== o)
|
|
if (t.hasValue(n)) {
|
|
let e = t.getValue(n);
|
|
!0 === e.liveStyle ? e.jump(o) : e.hasAnimated || e.set(o);
|
|
} else {
|
|
let e = t.getStaticValue(n);
|
|
t.addValue(n, er(void 0 !== e ? e : o, { owner: t }));
|
|
}
|
|
}
|
|
for (let n in i) void 0 === e[n] && t.removeValue(n);
|
|
return e;
|
|
})(
|
|
this,
|
|
this.scrapeMotionValuesFromProps(t, this.prevProps || {}, this),
|
|
this.prevMotionValues,
|
|
)),
|
|
this.handleChildMotionValue && this.handleChildMotionValue();
|
|
}
|
|
getProps() {
|
|
return this.props;
|
|
}
|
|
getVariant(t) {
|
|
return this.props.variants ? this.props.variants[t] : void 0;
|
|
}
|
|
getDefaultTransition() {
|
|
return this.props.transition;
|
|
}
|
|
getTransformPagePoint() {
|
|
return this.props.transformPagePoint;
|
|
}
|
|
getClosestVariantNode() {
|
|
return this.isVariantNode
|
|
? this
|
|
: this.parent
|
|
? this.parent.getClosestVariantNode()
|
|
: void 0;
|
|
}
|
|
addVariantChild(t) {
|
|
let e = this.getClosestVariantNode();
|
|
if (e)
|
|
return (
|
|
e.variantChildren && e.variantChildren.add(t),
|
|
() => e.variantChildren.delete(t)
|
|
);
|
|
}
|
|
addValue(t, e) {
|
|
let i = this.values.get(t);
|
|
e !== i &&
|
|
(i && this.removeValue(t),
|
|
this.bindToMotionValue(t, e),
|
|
this.values.set(t, e),
|
|
(this.latestValues[t] = e.get()));
|
|
}
|
|
removeValue(t) {
|
|
this.values.delete(t);
|
|
let e = this.valueSubscriptions.get(t);
|
|
e && (e(), this.valueSubscriptions.delete(t)),
|
|
delete this.latestValues[t],
|
|
this.removeValueFromRenderState(t, this.renderState);
|
|
}
|
|
hasValue(t) {
|
|
return this.values.has(t);
|
|
}
|
|
getValue(t, e) {
|
|
if (this.props.values && this.props.values[t])
|
|
return this.props.values[t];
|
|
let i = this.values.get(t);
|
|
return (
|
|
void 0 === i &&
|
|
void 0 !== e &&
|
|
((i = er(null === e ? void 0 : e, { owner: this })),
|
|
this.addValue(t, i)),
|
|
i
|
|
);
|
|
}
|
|
readValue(t, e) {
|
|
let i =
|
|
void 0 === this.latestValues[t] && this.current
|
|
? (this.getBaseTargetFromProps(this.props, t) ??
|
|
this.readValueFromInstance(this.current, t, this.options))
|
|
: this.latestValues[t];
|
|
if (null != i) {
|
|
let n, o;
|
|
if (
|
|
"string" == typeof i &&
|
|
((n = i),
|
|
/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n) ||
|
|
((o = i), /^0[^.\s]+$/u.test(o)))
|
|
)
|
|
i = parseFloat(i);
|
|
else {
|
|
let n;
|
|
(n = i), !es.find(ty(n)) && tn.test(e) && (i = t9(t, e));
|
|
}
|
|
this.setBaseTarget(t, tg(i) ? i.get() : i);
|
|
}
|
|
return tg(i) ? i.get() : i;
|
|
}
|
|
setBaseTarget(t, e) {
|
|
this.baseTarget[t] = e;
|
|
}
|
|
getBaseTarget(t) {
|
|
let e,
|
|
{ initial: i } = this.props;
|
|
if ("string" == typeof i || "object" == typeof i) {
|
|
let n = eb(this.props, i, this.presenceContext?.custom);
|
|
n && (e = n[t]);
|
|
}
|
|
if (i && void 0 !== e) return e;
|
|
let n = this.getBaseTargetFromProps(this.props, t);
|
|
return void 0 === n || tg(n)
|
|
? void 0 !== this.initialValues[t] && void 0 === e
|
|
? void 0
|
|
: this.baseTarget[t]
|
|
: n;
|
|
}
|
|
on(t, e) {
|
|
return (
|
|
this.events[t] || (this.events[t] = new et()), this.events[t].add(e)
|
|
);
|
|
}
|
|
notify(t, ...e) {
|
|
this.events[t] && this.events[t].notify(...e);
|
|
}
|
|
scheduleRenderMicrotask() {
|
|
ee.render(this.render);
|
|
}
|
|
}
|
|
class eS extends ew {
|
|
constructor() {
|
|
super(...arguments), (this.KeyframeResolver = t6);
|
|
}
|
|
sortInstanceNodePosition(t, e) {
|
|
return 2 & t.compareDocumentPosition(e) ? 1 : -1;
|
|
}
|
|
getBaseTargetFromProps(t, e) {
|
|
let i = t.style;
|
|
return i ? i[e] : void 0;
|
|
}
|
|
removeValueFromRenderState(t, { vars: e, style: i }) {
|
|
delete e[t], delete i[t];
|
|
}
|
|
handleChildMotionValue() {
|
|
this.childSubscription &&
|
|
(this.childSubscription(), delete this.childSubscription);
|
|
let { children: t } = this.props;
|
|
tg(t) &&
|
|
(this.childSubscription = t.on("change", (t) => {
|
|
this.current && (this.current.textContent = `${t}`);
|
|
}));
|
|
}
|
|
}
|
|
function eT(t) {
|
|
return t.replace(/([A-Z])/g, (t) => `-${t.toLowerCase()}`);
|
|
}
|
|
let eP = (t, e) => (e && "number" == typeof t ? e.transform(t) : t),
|
|
ek = {
|
|
x: "translateX",
|
|
y: "translateY",
|
|
z: "translateZ",
|
|
transformPerspective: "perspective",
|
|
},
|
|
eA = k.length;
|
|
function eC(t, e, i) {
|
|
let { style: n, vars: o, transformOrigin: r } = t,
|
|
s = !1,
|
|
a = !1;
|
|
for (let t in e) {
|
|
let i = e[t];
|
|
if (A.has(t)) {
|
|
s = !0;
|
|
continue;
|
|
}
|
|
if (tT(t)) {
|
|
o[t] = i;
|
|
continue;
|
|
}
|
|
{
|
|
let e = eP(i, tc[t]);
|
|
t.startsWith("origin") ? ((a = !0), (r[t] = e)) : (n[t] = e);
|
|
}
|
|
}
|
|
if (
|
|
(!e.transform &&
|
|
(s || i
|
|
? (n.transform = (function (t, e, i) {
|
|
let n = "",
|
|
o = !0;
|
|
for (let r = 0; r < eA; r++) {
|
|
let s = k[r],
|
|
a = t[s];
|
|
if (void 0 === a) continue;
|
|
let l = !0;
|
|
if ("number" == typeof a) l = a === +!!s.startsWith("scale");
|
|
else {
|
|
let t = parseFloat(a);
|
|
l = s.startsWith("scale") ? 1 === t : 0 === t;
|
|
}
|
|
if (!l || i) {
|
|
let t = eP(a, tc[s]);
|
|
if (!l) {
|
|
o = !1;
|
|
let e = ek[s] || s;
|
|
n += `${e}(${t}) `;
|
|
}
|
|
i && (e[s] = t);
|
|
}
|
|
}
|
|
return (
|
|
(n = n.trim()),
|
|
i ? (n = i(e, o ? "" : n)) : o && (n = "none"),
|
|
n
|
|
);
|
|
})(e, t.transform, i))
|
|
: n.transform && (n.transform = "none")),
|
|
a)
|
|
) {
|
|
let { originX: t = "50%", originY: e = "50%", originZ: i = 0 } = r;
|
|
n.transformOrigin = `${t} ${e} ${i}`;
|
|
}
|
|
}
|
|
let eE = { offset: "stroke-dashoffset", array: "stroke-dasharray" },
|
|
eL = { offset: "strokeDashoffset", array: "strokeDasharray" },
|
|
eM = ["offsetDistance", "offsetPath", "offsetRotate", "offsetAnchor"];
|
|
function eR(
|
|
t,
|
|
{
|
|
attrX: e,
|
|
attrY: i,
|
|
attrScale: n,
|
|
pathLength: o,
|
|
pathSpacing: r = 1,
|
|
pathOffset: s = 0,
|
|
...a
|
|
},
|
|
l,
|
|
c,
|
|
u,
|
|
) {
|
|
if ((eC(t, a, c), l)) {
|
|
t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
|
|
return;
|
|
}
|
|
(t.attrs = t.style), (t.style = {});
|
|
let { attrs: h, style: d } = t;
|
|
for (let t of (h.transform &&
|
|
((d.transform = h.transform), delete h.transform),
|
|
(d.transform || h.transformOrigin) &&
|
|
((d.transformOrigin = h.transformOrigin ?? "50% 50%"),
|
|
delete h.transformOrigin),
|
|
d.transform &&
|
|
((d.transformBox = u?.transformBox ?? "fill-box"),
|
|
delete h.transformBox),
|
|
eM))
|
|
void 0 !== h[t] && ((d[t] = h[t]), delete h[t]);
|
|
void 0 !== e && (h.x = e),
|
|
void 0 !== i && (h.y = i),
|
|
void 0 !== n && (h.scale = n),
|
|
void 0 !== o &&
|
|
(function (t, e, i = 1, n = 0, o = !0) {
|
|
t.pathLength = 1;
|
|
let r = o ? eE : eL;
|
|
(t[r.offset] = `${-n}`), (t[r.array] = `${e} ${i}`);
|
|
})(h, o, r, s, !1);
|
|
}
|
|
let eD = new Set([
|
|
"baseFrequency",
|
|
"diffuseConstant",
|
|
"kernelMatrix",
|
|
"kernelUnitLength",
|
|
"keySplines",
|
|
"keyTimes",
|
|
"limitingConeAngle",
|
|
"markerHeight",
|
|
"markerWidth",
|
|
"numOctaves",
|
|
"targetX",
|
|
"targetY",
|
|
"surfaceScale",
|
|
"specularConstant",
|
|
"specularExponent",
|
|
"stdDeviation",
|
|
"tableValues",
|
|
"viewBox",
|
|
"gradientTransform",
|
|
"pathLength",
|
|
"startOffset",
|
|
"textLength",
|
|
"lengthAdjust",
|
|
]),
|
|
eV = (t) => "string" == typeof t && "svg" === t.toLowerCase();
|
|
function eF(t, { style: e, vars: i }, n, o) {
|
|
let r,
|
|
s = t.style;
|
|
for (r in e) s[r] = e[r];
|
|
for (r in (o?.applyProjectionStyles(s, n), i)) s.setProperty(r, i[r]);
|
|
}
|
|
function ej(t, e) {
|
|
return e.max === e.min ? 0 : (t / (e.max - e.min)) * 100;
|
|
}
|
|
let eN = {
|
|
correct: (t, e) => {
|
|
if (!e.target) return t;
|
|
if ("string" == typeof t)
|
|
if (!W.test(t)) return t;
|
|
else t = parseFloat(t);
|
|
let i = ej(t, e.target.x),
|
|
n = ej(t, e.target.y);
|
|
return `${i}% ${n}%`;
|
|
},
|
|
},
|
|
eB = (t, e, i) => t + (e - t) * i,
|
|
eO = {
|
|
borderRadius: {
|
|
...eN,
|
|
applyTo: [
|
|
"borderTopLeftRadius",
|
|
"borderTopRightRadius",
|
|
"borderBottomLeftRadius",
|
|
"borderBottomRightRadius",
|
|
],
|
|
},
|
|
borderTopLeftRadius: eN,
|
|
borderTopRightRadius: eN,
|
|
borderBottomLeftRadius: eN,
|
|
borderBottomRightRadius: eN,
|
|
boxShadow: {
|
|
correct: (t, { treeScale: e, projectionDelta: i }) => {
|
|
let n = tn.parse(t);
|
|
if (n.length > 5) return t;
|
|
let o = tn.createTransformer(t),
|
|
r = +("number" != typeof n[0]),
|
|
s = i.x.scale * e.x,
|
|
a = i.y.scale * e.y;
|
|
(n[0 + r] /= s), (n[1 + r] /= a);
|
|
let l = eB(s, a, 0.5);
|
|
return (
|
|
"number" == typeof n[2 + r] && (n[2 + r] /= l),
|
|
"number" == typeof n[3 + r] && (n[3 + r] /= l),
|
|
o(n)
|
|
);
|
|
},
|
|
},
|
|
};
|
|
function eU(t, { layout: e, layoutId: i }) {
|
|
return (
|
|
A.has(t) ||
|
|
t.startsWith("origin") ||
|
|
((e || void 0 !== i) && (!!eO[t] || "opacity" === t))
|
|
);
|
|
}
|
|
function eH(t, e, i) {
|
|
let n = t.style,
|
|
o = e?.style,
|
|
r = {};
|
|
if (!n) return r;
|
|
for (let e in n)
|
|
(tg(n[e]) ||
|
|
(o && tg(o[e])) ||
|
|
eU(e, t) ||
|
|
i?.getValue(e)?.liveStyle !== void 0) &&
|
|
(r[e] = n[e]);
|
|
return r;
|
|
}
|
|
function ez(t, e, i) {
|
|
let n = eH(t, e, i);
|
|
for (let i in t)
|
|
(tg(t[i]) || tg(e[i])) &&
|
|
(n[
|
|
-1 !== k.indexOf(i)
|
|
? "attr" + i.charAt(0).toUpperCase() + i.substring(1)
|
|
: i
|
|
] = t[i]);
|
|
return n;
|
|
}
|
|
class eW extends eS {
|
|
constructor() {
|
|
super(...arguments),
|
|
(this.type = "svg"),
|
|
(this.isSVGTag = !1),
|
|
(this.measureInstanceViewportBox = tf);
|
|
}
|
|
getBaseTargetFromProps(t, e) {
|
|
return t[e];
|
|
}
|
|
readValueFromInstance(t, e) {
|
|
if (A.has(e)) {
|
|
let t = th(e);
|
|
return (t && t.default) || 0;
|
|
}
|
|
return (e = eD.has(e) ? e : eT(e)), t.getAttribute(e);
|
|
}
|
|
scrapeMotionValuesFromProps(t, e, i) {
|
|
return ez(t, e, i);
|
|
}
|
|
build(t, e, i) {
|
|
eR(t, e, this.isSVGTag, i.transformTemplate, i.style);
|
|
}
|
|
renderInstance(t, e, i, n) {
|
|
for (let i in (eF(t, e, void 0, n), e.attrs))
|
|
t.setAttribute(eD.has(i) ? i : eT(i), e.attrs[i]);
|
|
}
|
|
mount(t) {
|
|
(this.isSVGTag = eV(t.tagName)), super.mount(t);
|
|
}
|
|
}
|
|
function e$({ top: t, left: e, right: i, bottom: n }) {
|
|
return { x: { min: e, max: i }, y: { min: t, max: n } };
|
|
}
|
|
function eG(t) {
|
|
return void 0 === t || 1 === t;
|
|
}
|
|
function eX({ scale: t, scaleX: e, scaleY: i }) {
|
|
return !eG(t) || !eG(e) || !eG(i);
|
|
}
|
|
function eY(t) {
|
|
return (
|
|
eX(t) ||
|
|
eq(t) ||
|
|
t.z ||
|
|
t.rotate ||
|
|
t.rotateX ||
|
|
t.rotateY ||
|
|
t.skewX ||
|
|
t.skewY
|
|
);
|
|
}
|
|
function eq(t) {
|
|
var e, i;
|
|
return ((e = t.x) && "0%" !== e) || ((i = t.y) && "0%" !== i);
|
|
}
|
|
function eK(t, e, i, n, o) {
|
|
return void 0 !== o && (t = n + o * (t - n)), n + i * (t - n) + e;
|
|
}
|
|
function e_(t, e = 0, i = 1, n, o) {
|
|
(t.min = eK(t.min, e, i, n, o)), (t.max = eK(t.max, e, i, n, o));
|
|
}
|
|
function eZ(t, { x: e, y: i }) {
|
|
e_(t.x, e.translate, e.scale, e.originPoint),
|
|
e_(t.y, i.translate, i.scale, i.originPoint);
|
|
}
|
|
function eQ(t, e) {
|
|
(t.min = t.min + e), (t.max = t.max + e);
|
|
}
|
|
function eJ(t, e, i, n, o = 0.5) {
|
|
let r = eB(t.min, t.max, o);
|
|
e_(t, e, i, r, n);
|
|
}
|
|
function e0(t, e) {
|
|
eJ(t.x, e.x, e.scaleX, e.scale, e.originX),
|
|
eJ(t.y, e.y, e.scaleY, e.scale, e.originY);
|
|
}
|
|
function e1(t, e) {
|
|
return e$(
|
|
(function (t, e) {
|
|
if (!e) return t;
|
|
let i = e({ x: t.left, y: t.top }),
|
|
n = e({ x: t.right, y: t.bottom });
|
|
return { top: i.y, left: i.x, bottom: n.y, right: n.x };
|
|
})(t.getBoundingClientRect(), e),
|
|
);
|
|
}
|
|
class e2 extends eS {
|
|
constructor() {
|
|
super(...arguments), (this.type = "html"), (this.renderInstance = eF);
|
|
}
|
|
readValueFromInstance(t, e) {
|
|
if (A.has(e))
|
|
return this.projection?.isProjecting
|
|
? tN(e)
|
|
: ((t, e) => {
|
|
let { transform: i = "none" } = getComputedStyle(t);
|
|
return tB(i, e);
|
|
})(t, e);
|
|
{
|
|
let i = window.getComputedStyle(t),
|
|
n = (tT(e) ? i.getPropertyValue(e) : i[e]) || 0;
|
|
return "string" == typeof n ? n.trim() : n;
|
|
}
|
|
}
|
|
measureInstanceViewportBox(t, { transformPagePoint: e }) {
|
|
return e1(t, e);
|
|
}
|
|
build(t, e, i) {
|
|
eC(t, e, i.transformTemplate);
|
|
}
|
|
scrapeMotionValuesFromProps(t, e, i) {
|
|
return eH(t, e, i);
|
|
}
|
|
}
|
|
let e5 = [
|
|
"animate",
|
|
"circle",
|
|
"defs",
|
|
"desc",
|
|
"ellipse",
|
|
"g",
|
|
"image",
|
|
"line",
|
|
"filter",
|
|
"marker",
|
|
"mask",
|
|
"metadata",
|
|
"path",
|
|
"pattern",
|
|
"polygon",
|
|
"polyline",
|
|
"rect",
|
|
"stop",
|
|
"switch",
|
|
"symbol",
|
|
"svg",
|
|
"text",
|
|
"tspan",
|
|
"use",
|
|
"view",
|
|
];
|
|
function e3(t) {
|
|
if ("string" != typeof t || t.includes("-"));
|
|
else if (e5.indexOf(t) > -1 || /[A-Z]/u.test(t)) return !0;
|
|
return !1;
|
|
}
|
|
let e9 = (0, a.createContext)({ strict: !1 }),
|
|
e4 = (0, a.createContext)({});
|
|
function e6(t) {
|
|
return Array.isArray(t) ? t.join(" ") : t;
|
|
}
|
|
let e7 = () => ({
|
|
style: {},
|
|
transform: {},
|
|
transformOrigin: {},
|
|
vars: {},
|
|
});
|
|
function e8(t, e, i) {
|
|
for (let n in e) tg(e[n]) || eU(n, i) || (t[n] = e[n]);
|
|
}
|
|
let it = () => ({ ...e7(), attrs: {} }),
|
|
ie = new Set([
|
|
"animate",
|
|
"exit",
|
|
"variants",
|
|
"initial",
|
|
"style",
|
|
"values",
|
|
"variants",
|
|
"transition",
|
|
"transformTemplate",
|
|
"custom",
|
|
"inherit",
|
|
"onBeforeLayoutMeasure",
|
|
"onAnimationStart",
|
|
"onAnimationComplete",
|
|
"onUpdate",
|
|
"onDragStart",
|
|
"onDrag",
|
|
"onDragEnd",
|
|
"onMeasureDragConstraints",
|
|
"onDirectionLock",
|
|
"onDragTransitionEnd",
|
|
"_dragX",
|
|
"_dragY",
|
|
"onHoverStart",
|
|
"onHoverEnd",
|
|
"onViewportEnter",
|
|
"onViewportLeave",
|
|
"globalTapTarget",
|
|
"ignoreStrict",
|
|
"viewport",
|
|
]);
|
|
function ii(t) {
|
|
return (
|
|
t.startsWith("while") ||
|
|
(t.startsWith("drag") && "draggable" !== t) ||
|
|
t.startsWith("layout") ||
|
|
t.startsWith("onTap") ||
|
|
t.startsWith("onPan") ||
|
|
t.startsWith("onLayout") ||
|
|
ie.has(t)
|
|
);
|
|
}
|
|
let io = (t) => !ii(t);
|
|
try {
|
|
(o = t.r(570606).default),
|
|
"function" == typeof o &&
|
|
(io = (t) => (t.startsWith("on") ? !ii(t) : o(t)));
|
|
} catch {}
|
|
function ir(t) {
|
|
return tg(t) ? t.get() : t;
|
|
}
|
|
let is = (t) => (e, i) => {
|
|
let n = (0, a.useContext)(e4),
|
|
o = (0, a.useContext)(d),
|
|
r = () =>
|
|
(function (
|
|
{ scrapeMotionValuesFromProps: t, createRenderState: e },
|
|
i,
|
|
n,
|
|
o,
|
|
) {
|
|
return {
|
|
latestValues: (function (t, e, i, n) {
|
|
let o = {},
|
|
r = n(t, {});
|
|
for (let t in r) o[t] = ir(r[t]);
|
|
let { initial: s, animate: a } = t,
|
|
l = eg(t),
|
|
c = ev(t);
|
|
e &&
|
|
c &&
|
|
!l &&
|
|
!1 !== t.inherit &&
|
|
(void 0 === s && (s = e.initial),
|
|
void 0 === a && (a = e.animate));
|
|
let u = !!i && !1 === i.initial,
|
|
h = (u = u || !1 === s) ? a : s;
|
|
if (h && "boolean" != typeof h && !ed(h)) {
|
|
let e = Array.isArray(h) ? h : [h];
|
|
for (let i = 0; i < e.length; i++) {
|
|
let n = eb(t, e[i]);
|
|
if (n) {
|
|
let { transitionEnd: t, transition: e, ...i } = n;
|
|
for (let t in i) {
|
|
let e = i[t];
|
|
if (Array.isArray(e)) {
|
|
let t = u ? e.length - 1 : 0;
|
|
e = e[t];
|
|
}
|
|
null !== e && (o[t] = e);
|
|
}
|
|
for (let e in t) o[e] = t[e];
|
|
}
|
|
}
|
|
}
|
|
return o;
|
|
})(i, n, o, t),
|
|
renderState: e(),
|
|
};
|
|
})(t, e, n, o);
|
|
return i ? r() : c(r);
|
|
},
|
|
ia = is({ scrapeMotionValuesFromProps: eH, createRenderState: e7 }),
|
|
il = is({ scrapeMotionValuesFromProps: ez, createRenderState: it }),
|
|
ic = {
|
|
animation: [
|
|
"animate",
|
|
"variants",
|
|
"whileHover",
|
|
"whileTap",
|
|
"exit",
|
|
"whileInView",
|
|
"whileFocus",
|
|
"whileDrag",
|
|
],
|
|
exit: ["exit"],
|
|
drag: ["drag", "dragControls"],
|
|
focus: ["whileFocus"],
|
|
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
|
|
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
|
|
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
|
|
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
|
|
layout: ["layout", "layoutId"],
|
|
},
|
|
iu = !1;
|
|
function ih() {
|
|
return (
|
|
!(function () {
|
|
if (iu) return;
|
|
let t = {};
|
|
for (let e in ic)
|
|
t[e] = { isEnabled: (t) => ic[e].some((e) => !!t[e]) };
|
|
(ex = t), (iu = !0);
|
|
})(),
|
|
ex
|
|
);
|
|
}
|
|
let id = Symbol.for("motionComponentSymbol"),
|
|
ip = "data-" + eT("framerAppearId"),
|
|
im = (0, a.createContext)({});
|
|
function ig(t) {
|
|
return (
|
|
t &&
|
|
"object" == typeof t &&
|
|
Object.prototype.hasOwnProperty.call(t, "current")
|
|
);
|
|
}
|
|
function iv(t, { forwardMotionProps: e = !1, type: i } = {}, n, o) {
|
|
n &&
|
|
(function (t) {
|
|
let e = ih();
|
|
for (let i in t) e[i] = { ...e[i], ...t[i] };
|
|
ex = e;
|
|
})(n);
|
|
let r = i ? "svg" === i : e3(t),
|
|
c = r ? il : ia;
|
|
function p(i, n) {
|
|
var p;
|
|
let m,
|
|
f,
|
|
v,
|
|
y = {
|
|
...(0, a.useContext)(g),
|
|
...i,
|
|
layoutId: (function ({ layoutId: t }) {
|
|
let e = (0, a.useContext)(l).id;
|
|
return e && void 0 !== t ? e + "-" + t : t;
|
|
})(i),
|
|
},
|
|
{ isStatic: b } = y,
|
|
I = (function (t) {
|
|
let { initial: e, animate: i } = (function (t, e) {
|
|
if (eg(t)) {
|
|
let { initial: e, animate: i } = t;
|
|
return {
|
|
initial: !1 === e || ep(e) ? e : void 0,
|
|
animate: ep(i) ? i : void 0,
|
|
};
|
|
}
|
|
return !1 !== t.inherit ? e : {};
|
|
})(t, (0, a.useContext)(e4));
|
|
return (0, a.useMemo)(
|
|
() => ({ initial: e, animate: i }),
|
|
[e6(e), e6(i)],
|
|
);
|
|
})(i),
|
|
x = c(i, b);
|
|
if (!b && u) {
|
|
(0, a.useContext)(e9).strict;
|
|
let e = (function (t) {
|
|
let { drag: e, layout: i } = ih();
|
|
if (!e && !i) return {};
|
|
let n = { ...e, ...i };
|
|
return {
|
|
MeasureLayout:
|
|
e?.isEnabled(t) || i?.isEnabled(t) ? n.MeasureLayout : void 0,
|
|
ProjectionNode: n.ProjectionNode,
|
|
};
|
|
})(y);
|
|
(m = e.MeasureLayout),
|
|
(I.visualElement = (function (t, e, i, n, o, r) {
|
|
let { visualElement: s } = (0, a.useContext)(e4),
|
|
l = (0, a.useContext)(e9),
|
|
c = (0, a.useContext)(d),
|
|
u = (0, a.useContext)(g),
|
|
p = u.reducedMotion,
|
|
m = u.skipAnimations,
|
|
f = (0, a.useRef)(null),
|
|
v = (0, a.useRef)(!1);
|
|
(n = n || l.renderer),
|
|
!f.current &&
|
|
n &&
|
|
((f.current = n(t, {
|
|
visualState: e,
|
|
parent: s,
|
|
props: i,
|
|
presenceContext: c,
|
|
blockInitialAnimation: !!c && !1 === c.initial,
|
|
reducedMotionConfig: p,
|
|
skipAnimations: m,
|
|
isSVG: r,
|
|
})),
|
|
v.current &&
|
|
f.current &&
|
|
(f.current.manuallyAnimateOnMount = !0));
|
|
let y = f.current,
|
|
b = (0, a.useContext)(im);
|
|
y &&
|
|
!y.projection &&
|
|
o &&
|
|
("html" === y.type || "svg" === y.type) &&
|
|
(function (t, e, i, n) {
|
|
let {
|
|
layoutId: o,
|
|
layout: r,
|
|
drag: s,
|
|
dragConstraints: a,
|
|
layoutScroll: l,
|
|
layoutRoot: c,
|
|
layoutCrossfade: u,
|
|
} = e;
|
|
(t.projection = new i(
|
|
t.latestValues,
|
|
e["data-framer-portal-id"]
|
|
? void 0
|
|
: (function t(e) {
|
|
if (e)
|
|
return !1 !== e.options.allowProjection
|
|
? e.projection
|
|
: t(e.parent);
|
|
})(t.parent),
|
|
)),
|
|
t.projection.setOptions({
|
|
layoutId: o,
|
|
layout: r,
|
|
alwaysMeasureLayout: !!s || (a && ig(a)),
|
|
visualElement: t,
|
|
animationType: "string" == typeof r ? r : "both",
|
|
initialPromotionConfig: n,
|
|
crossfade: u,
|
|
layoutScroll: l,
|
|
layoutRoot: c,
|
|
});
|
|
})(f.current, i, o, b);
|
|
let I = (0, a.useRef)(!1);
|
|
(0, a.useInsertionEffect)(() => {
|
|
y && I.current && y.update(i, c);
|
|
});
|
|
let x = i[ip],
|
|
w = (0, a.useRef)(
|
|
!!x &&
|
|
!window.MotionHandoffIsComplete?.(x) &&
|
|
window.MotionHasOptimisedAnimation?.(x),
|
|
);
|
|
return (
|
|
h(() => {
|
|
(v.current = !0),
|
|
y &&
|
|
((I.current = !0),
|
|
(window.MotionIsMounted = !0),
|
|
y.updateFeatures(),
|
|
y.scheduleRenderMicrotask(),
|
|
w.current &&
|
|
y.animationState &&
|
|
y.animationState.animateChanges());
|
|
}),
|
|
(0, a.useEffect)(() => {
|
|
y &&
|
|
(!w.current &&
|
|
y.animationState &&
|
|
y.animationState.animateChanges(),
|
|
w.current &&
|
|
(queueMicrotask(() => {
|
|
window.MotionHandoffMarkAsComplete?.(x);
|
|
}),
|
|
(w.current = !1)),
|
|
(y.enteringChildren = void 0));
|
|
}),
|
|
y
|
|
);
|
|
})(t, x, y, o, e.ProjectionNode, r));
|
|
}
|
|
return (0, s.jsxs)(e4.Provider, {
|
|
value: I,
|
|
children: [
|
|
m && I.visualElement
|
|
? (0, s.jsx)(m, { visualElement: I.visualElement, ...y })
|
|
: null,
|
|
(function (t, e, i, { latestValues: n }, o, r = !1, s) {
|
|
let l = (
|
|
(s ?? e3(t))
|
|
? function (t, e, i, n) {
|
|
let o = (0, a.useMemo)(() => {
|
|
let i = it();
|
|
return (
|
|
eR(i, e, eV(n), t.transformTemplate, t.style),
|
|
{ ...i.attrs, style: { ...i.style } }
|
|
);
|
|
}, [e]);
|
|
if (t.style) {
|
|
let e = {};
|
|
e8(e, t.style, t), (o.style = { ...e, ...o.style });
|
|
}
|
|
return o;
|
|
}
|
|
: function (t, e) {
|
|
let i,
|
|
n,
|
|
o = {},
|
|
r =
|
|
((i = t.style || {}),
|
|
e8((n = {}), i, t),
|
|
Object.assign(
|
|
n,
|
|
(function ({ transformTemplate: t }, e) {
|
|
return (0, a.useMemo)(() => {
|
|
let i = e7();
|
|
return (
|
|
eC(i, e, t),
|
|
Object.assign({}, i.vars, i.style)
|
|
);
|
|
}, [e]);
|
|
})(t, e),
|
|
),
|
|
n);
|
|
return (
|
|
t.drag &&
|
|
!1 !== t.dragListener &&
|
|
((o.draggable = !1),
|
|
(r.userSelect =
|
|
r.WebkitUserSelect =
|
|
r.WebkitTouchCallout =
|
|
"none"),
|
|
(r.touchAction =
|
|
!0 === t.drag
|
|
? "none"
|
|
: `pan-${"x" === t.drag ? "y" : "x"}`)),
|
|
void 0 === t.tabIndex &&
|
|
(t.onTap || t.onTapStart || t.whileTap) &&
|
|
(o.tabIndex = 0),
|
|
(o.style = r),
|
|
o
|
|
);
|
|
}
|
|
)(e, n, o, t),
|
|
c = (function (t, e, i) {
|
|
let n = {};
|
|
for (let o in t)
|
|
("values" !== o || "object" != typeof t.values) &&
|
|
(io(o) ||
|
|
(!0 === i && ii(o)) ||
|
|
(!e && !ii(o)) ||
|
|
(t.draggable && o.startsWith("onDrag"))) &&
|
|
(n[o] = t[o]);
|
|
return n;
|
|
})(e, "string" == typeof t, r),
|
|
u = t !== a.Fragment ? { ...c, ...l, ref: i } : {},
|
|
{ children: h } = e,
|
|
d = (0, a.useMemo)(() => (tg(h) ? h.get() : h), [h]);
|
|
return (0, a.createElement)(t, { ...u, children: d });
|
|
})(
|
|
t,
|
|
i,
|
|
((p = I.visualElement),
|
|
(f = (0, a.useRef)(n)),
|
|
(0, a.useInsertionEffect)(() => {
|
|
f.current = n;
|
|
}),
|
|
(v = (0, a.useRef)(null)),
|
|
(0, a.useCallback)(
|
|
(t) => {
|
|
t && x.onMount?.(t), p && (t ? p.mount(t) : p.unmount());
|
|
let e = f.current;
|
|
if ("function" == typeof e)
|
|
if (t) {
|
|
let i = e(t);
|
|
"function" == typeof i && (v.current = i);
|
|
} else v.current ? (v.current(), (v.current = null)) : e(t);
|
|
else e && (e.current = t);
|
|
},
|
|
[p],
|
|
)),
|
|
x,
|
|
b,
|
|
e,
|
|
r,
|
|
),
|
|
],
|
|
});
|
|
}
|
|
p.displayName = `motion.${"string" == typeof t ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
|
|
let m = (0, a.forwardRef)(p);
|
|
return (m[id] = t), m;
|
|
}
|
|
class iy {
|
|
constructor(t) {
|
|
(this.isMounted = !1), (this.node = t);
|
|
}
|
|
update() {}
|
|
}
|
|
function ib(t, e, i) {
|
|
let n = t.getProps();
|
|
return eb(n, e, void 0 !== i ? i : n.custom, t);
|
|
}
|
|
function iI(t, e) {
|
|
return t?.[e] ?? t?.default ?? t;
|
|
}
|
|
let ix = (t) => Array.isArray(t);
|
|
function iw(t, e) {
|
|
let i = t.getValue("willChange");
|
|
if (tg(i) && i.add) return i.add(e);
|
|
if (!i && tG.WillChange) {
|
|
let i = new tG.WillChange("auto");
|
|
t.addValue("willChange", i), i.add(e);
|
|
}
|
|
}
|
|
let iS = (t) => 1e3 * t,
|
|
iT = (t, e) => (i) => e(t(i)),
|
|
iP = (...t) => t.reduce(iT),
|
|
ik = { layout: 0, mainThread: 0, waapi: 0 };
|
|
function iA(t, e, i) {
|
|
return (i < 0 && (i += 1), i > 1 && (i -= 1), i < 1 / 6)
|
|
? t + (e - t) * 6 * i
|
|
: i < 0.5
|
|
? e
|
|
: i < 2 / 3
|
|
? t + (e - t) * (2 / 3 - i) * 6
|
|
: t;
|
|
}
|
|
function iC(t, e) {
|
|
return (i) => (i > 0 ? e : t);
|
|
}
|
|
let iE = (t, e, i) => {
|
|
let n = t * t,
|
|
o = i * (e * e - n) + n;
|
|
return o < 0 ? 0 : Math.sqrt(o);
|
|
},
|
|
iL = [O, B, Y];
|
|
function iM(t) {
|
|
let e = iL.find((e) => e.test(t));
|
|
if (
|
|
(tx(
|
|
!!e,
|
|
`'${t}' is not an animatable color. Use the equivalent color code instead.`,
|
|
"color-not-animatable",
|
|
),
|
|
!e)
|
|
)
|
|
return !1;
|
|
let i = e.parse(t);
|
|
return (
|
|
e === Y &&
|
|
(i = (function ({ hue: t, saturation: e, lightness: i, alpha: n }) {
|
|
(t /= 360), (i /= 100);
|
|
let o = 0,
|
|
r = 0,
|
|
s = 0;
|
|
if ((e /= 100)) {
|
|
let n = i < 0.5 ? i * (1 + e) : i + e - i * e,
|
|
a = 2 * i - n;
|
|
(o = iA(a, n, t + 1 / 3)),
|
|
(r = iA(a, n, t)),
|
|
(s = iA(a, n, t - 1 / 3));
|
|
} else o = r = s = i;
|
|
return {
|
|
red: Math.round(255 * o),
|
|
green: Math.round(255 * r),
|
|
blue: Math.round(255 * s),
|
|
alpha: n,
|
|
};
|
|
})(i)),
|
|
i
|
|
);
|
|
}
|
|
let iR = (t, e) => {
|
|
let i = iM(t),
|
|
n = iM(e);
|
|
if (!i || !n) return iC(t, e);
|
|
let o = { ...i };
|
|
return (t) => (
|
|
(o.red = iE(i.red, n.red, t)),
|
|
(o.green = iE(i.green, n.green, t)),
|
|
(o.blue = iE(i.blue, n.blue, t)),
|
|
(o.alpha = eB(i.alpha, n.alpha, t)),
|
|
B.transform(o)
|
|
);
|
|
},
|
|
iD = new Set(["none", "hidden"]);
|
|
function iV(t, e) {
|
|
return (i) => eB(t, e, i);
|
|
}
|
|
function iF(t) {
|
|
return "number" == typeof t
|
|
? iV
|
|
: "string" == typeof t
|
|
? tk(t)
|
|
? iC
|
|
: q.test(t)
|
|
? iR
|
|
: iB
|
|
: Array.isArray(t)
|
|
? ij
|
|
: "object" == typeof t
|
|
? q.test(t)
|
|
? iR
|
|
: iN
|
|
: iC;
|
|
}
|
|
function ij(t, e) {
|
|
let i = [...t],
|
|
n = i.length,
|
|
o = t.map((t, i) => iF(t)(t, e[i]));
|
|
return (t) => {
|
|
for (let e = 0; e < n; e++) i[e] = o[e](t);
|
|
return i;
|
|
};
|
|
}
|
|
function iN(t, e) {
|
|
let i = { ...t, ...e },
|
|
n = {};
|
|
for (let o in i)
|
|
void 0 !== t[o] && void 0 !== e[o] && (n[o] = iF(t[o])(t[o], e[o]));
|
|
return (t) => {
|
|
for (let e in n) i[e] = n[e](t);
|
|
return i;
|
|
};
|
|
}
|
|
let iB = (t, e) => {
|
|
let i = tn.createTransformer(e),
|
|
n = J(t),
|
|
o = J(e);
|
|
if (
|
|
!(
|
|
n.indexes.var.length === o.indexes.var.length &&
|
|
n.indexes.color.length === o.indexes.color.length &&
|
|
n.indexes.number.length >= o.indexes.number.length
|
|
)
|
|
)
|
|
return (
|
|
tx(
|
|
!0,
|
|
`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,
|
|
"complex-values-different",
|
|
),
|
|
iC(t, e)
|
|
);
|
|
if ((iD.has(t) && !o.values.length) || (iD.has(e) && !n.values.length))
|
|
return iD.has(t) ? (i) => (i <= 0 ? t : e) : (i) => (i >= 1 ? e : t);
|
|
return iP(
|
|
ij(
|
|
(function (t, e) {
|
|
let i = [],
|
|
n = { color: 0, var: 0, number: 0 };
|
|
for (let o = 0; o < e.values.length; o++) {
|
|
let r = e.types[o],
|
|
s = t.indexes[r][n[r]],
|
|
a = t.values[s] ?? 0;
|
|
(i[o] = a), n[r]++;
|
|
}
|
|
return i;
|
|
})(n, o),
|
|
o.values,
|
|
),
|
|
i,
|
|
);
|
|
};
|
|
function iO(t, e, i) {
|
|
return "number" == typeof t &&
|
|
"number" == typeof e &&
|
|
"number" == typeof i
|
|
? eB(t, e, i)
|
|
: iF(t)(t, e);
|
|
}
|
|
let iU = (t) => {
|
|
let e = ({ timestamp: e }) => t(e);
|
|
return {
|
|
start: (t = !0) => tq.update(e, t),
|
|
stop: () => tK(e),
|
|
now: () => (t_.isProcessing ? t_.timestamp : en.now()),
|
|
};
|
|
},
|
|
iH = (t, e, i = 10) => {
|
|
let n = "",
|
|
o = Math.max(Math.round(e / i), 2);
|
|
for (let e = 0; e < o; e++)
|
|
n += Math.round(1e4 * t(e / (o - 1))) / 1e4 + ", ";
|
|
return `linear(${n.substring(0, n.length - 2)})`;
|
|
};
|
|
function iz(t) {
|
|
let e = 0,
|
|
i = t.next(e);
|
|
for (; !i.done && e < 2e4; ) (e += 50), (i = t.next(e));
|
|
return e >= 2e4 ? 1 / 0 : e;
|
|
}
|
|
function iW(t, e, i) {
|
|
var n, o;
|
|
let r = Math.max(e - 5, 0);
|
|
return (n = i - t(r)), (o = e - r) ? (1e3 / o) * n : 0;
|
|
}
|
|
let i$ = 0.01,
|
|
iG = 2,
|
|
iX = 0.005,
|
|
iY = 0.5;
|
|
function iq(t, e) {
|
|
return t * Math.sqrt(1 - e * e);
|
|
}
|
|
let iK = ["duration", "bounce"],
|
|
i_ = ["stiffness", "damping", "mass"];
|
|
function iZ(t, e) {
|
|
return e.some((e) => void 0 !== t[e]);
|
|
}
|
|
function iQ(t = 0.3, e = 0.3) {
|
|
let i,
|
|
n =
|
|
"object" != typeof t
|
|
? { visualDuration: t, keyframes: [0, 1], bounce: e }
|
|
: t,
|
|
{ restSpeed: o, restDelta: r } = n,
|
|
s = n.keyframes[0],
|
|
a = n.keyframes[n.keyframes.length - 1],
|
|
l = { done: !1, value: s },
|
|
{
|
|
stiffness: c,
|
|
damping: u,
|
|
mass: h,
|
|
duration: d,
|
|
velocity: p,
|
|
isResolvedFromDuration: m,
|
|
} = (function (t) {
|
|
let e = {
|
|
velocity: 0,
|
|
stiffness: 100,
|
|
damping: 10,
|
|
mass: 1,
|
|
isResolvedFromDuration: !1,
|
|
...t,
|
|
};
|
|
if (!iZ(t, i_) && iZ(t, iK))
|
|
if (t.visualDuration) {
|
|
let i = (2 * Math.PI) / (1.2 * t.visualDuration),
|
|
n = i * i,
|
|
o = 2 * C(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(n);
|
|
e = { ...e, mass: 1, stiffness: n, damping: o };
|
|
} else {
|
|
let i = (function ({
|
|
duration: t = 800,
|
|
bounce: e = 0.3,
|
|
velocity: i = 0,
|
|
mass: n = 1,
|
|
}) {
|
|
let o, r;
|
|
tx(
|
|
t <= iS(10),
|
|
"Spring duration must be 10 seconds or less",
|
|
"spring-duration-limit",
|
|
);
|
|
let s = 1 - e;
|
|
(s = C(0.05, 1, s)),
|
|
(t = C(0.01, 10, t / 1e3)),
|
|
s < 1
|
|
? ((o = (e) => {
|
|
let n = e * s,
|
|
o = n * t;
|
|
return 0.001 - ((n - i) / iq(e, s)) * Math.exp(-o);
|
|
}),
|
|
(r = (e) => {
|
|
let n = e * s * t,
|
|
r = Math.pow(s, 2) * Math.pow(e, 2) * t,
|
|
a = Math.exp(-n),
|
|
l = iq(Math.pow(e, 2), s);
|
|
return (
|
|
((n * i + i - r) * a * (-o(e) + 0.001 > 0 ? -1 : 1)) /
|
|
l
|
|
);
|
|
}))
|
|
: ((o = (e) =>
|
|
-0.001 + Math.exp(-e * t) * ((e - i) * t + 1)),
|
|
(r = (e) => t * t * (i - e) * Math.exp(-e * t)));
|
|
let a = (function (t, e, i) {
|
|
let n = i;
|
|
for (let i = 1; i < 12; i++) n -= t(n) / e(n);
|
|
return n;
|
|
})(o, r, 5 / t);
|
|
if (((t = iS(t)), isNaN(a)))
|
|
return { stiffness: 100, damping: 10, duration: t };
|
|
{
|
|
let e = Math.pow(a, 2) * n;
|
|
return {
|
|
stiffness: e,
|
|
damping: 2 * s * Math.sqrt(n * e),
|
|
duration: t,
|
|
};
|
|
}
|
|
})(t);
|
|
(e = { ...e, ...i, mass: 1 }).isResolvedFromDuration = !0;
|
|
}
|
|
return e;
|
|
})({ ...n, velocity: -((n.velocity || 0) / 1e3) }),
|
|
f = p || 0,
|
|
g = u / (2 * Math.sqrt(c * h)),
|
|
v = a - s,
|
|
y = Math.sqrt(c / h) / 1e3,
|
|
b = 5 > Math.abs(v);
|
|
if ((o || (o = b ? i$ : iG), r || (r = b ? iX : iY), g < 1)) {
|
|
let t = iq(y, g);
|
|
i = (e) =>
|
|
a -
|
|
Math.exp(-g * y * e) *
|
|
(((f + g * y * v) / t) * Math.sin(t * e) + v * Math.cos(t * e));
|
|
} else if (1 === g)
|
|
i = (t) => a - Math.exp(-y * t) * (v + (f + y * v) * t);
|
|
else {
|
|
let t = y * Math.sqrt(g * g - 1);
|
|
i = (e) => {
|
|
let i = Math.exp(-g * y * e),
|
|
n = Math.min(t * e, 300);
|
|
return (
|
|
a -
|
|
(i * ((f + g * y * v) * Math.sinh(n) + t * v * Math.cosh(n))) / t
|
|
);
|
|
};
|
|
}
|
|
let I = {
|
|
calculatedDuration: (m && d) || null,
|
|
next: (t) => {
|
|
let e = i(t);
|
|
if (m) l.done = t >= d;
|
|
else {
|
|
let n = 0 === t ? f : 0;
|
|
g < 1 && (n = 0 === t ? iS(f) : iW(i, t, e));
|
|
let s = Math.abs(a - e) <= r;
|
|
l.done = Math.abs(n) <= o && s;
|
|
}
|
|
return (l.value = l.done ? a : e), l;
|
|
},
|
|
toString: () => {
|
|
let t = Math.min(iz(I), 2e4),
|
|
e = iH((e) => I.next(t * e).value, t, 30);
|
|
return t + "ms " + e;
|
|
},
|
|
toTransition: () => {},
|
|
};
|
|
return I;
|
|
}
|
|
function iJ({
|
|
keyframes: t,
|
|
velocity: e = 0,
|
|
power: i = 0.8,
|
|
timeConstant: n = 325,
|
|
bounceDamping: o = 10,
|
|
bounceStiffness: r = 500,
|
|
modifyTarget: s,
|
|
min: a,
|
|
max: l,
|
|
restDelta: c = 0.5,
|
|
restSpeed: u,
|
|
}) {
|
|
let h,
|
|
d,
|
|
p = t[0],
|
|
m = { done: !1, value: p },
|
|
f = i * e,
|
|
g = p + f,
|
|
v = void 0 === s ? g : s(g);
|
|
v !== g && (f = v - p);
|
|
let y = (t) => -f * Math.exp(-t / n),
|
|
b = (t) => v + y(t),
|
|
I = (t) => {
|
|
let e = y(t),
|
|
i = b(t);
|
|
(m.done = Math.abs(e) <= c), (m.value = m.done ? v : i);
|
|
},
|
|
x = (t) => {
|
|
let e;
|
|
if (
|
|
((e = m.value), (void 0 !== a && e < a) || (void 0 !== l && e > l))
|
|
) {
|
|
var i;
|
|
(h = t),
|
|
(d = iQ({
|
|
keyframes: [
|
|
m.value,
|
|
((i = m.value),
|
|
void 0 === a
|
|
? l
|
|
: void 0 === l || Math.abs(a - i) < Math.abs(l - i)
|
|
? a
|
|
: l),
|
|
],
|
|
velocity: iW(b, t, m.value),
|
|
damping: o,
|
|
stiffness: r,
|
|
restDelta: c,
|
|
restSpeed: u,
|
|
}));
|
|
}
|
|
};
|
|
return (
|
|
x(0),
|
|
{
|
|
calculatedDuration: null,
|
|
next: (t) => {
|
|
let e = !1;
|
|
return (d || void 0 !== h || ((e = !0), I(t), x(t)),
|
|
void 0 !== h && t >= h)
|
|
? d.next(t - h)
|
|
: (e || I(t), m);
|
|
},
|
|
}
|
|
);
|
|
}
|
|
iQ.applyToOptions = (t) => {
|
|
let e = (function (t, e = 100, i) {
|
|
let n = i({ ...t, keyframes: [0, e] }),
|
|
o = Math.min(iz(n), 2e4);
|
|
return {
|
|
type: "keyframes",
|
|
ease: (t) => n.next(o * t).value / e,
|
|
duration: o / 1e3,
|
|
};
|
|
})(t, 100, iQ);
|
|
return (
|
|
(t.ease = e.ease),
|
|
(t.duration = iS(e.duration)),
|
|
(t.type = "keyframes"),
|
|
t
|
|
);
|
|
};
|
|
let i0 = (t, e, i) =>
|
|
(((1 - 3 * i + 3 * e) * t + (3 * i - 6 * e)) * t + 3 * e) * t;
|
|
function i1(t, e, i, n) {
|
|
return t === e && i === n
|
|
? t$
|
|
: (o) =>
|
|
0 === o || 1 === o
|
|
? o
|
|
: i0(
|
|
(function (t, e, i, n, o) {
|
|
let r,
|
|
s,
|
|
a = 0;
|
|
do
|
|
(r = i0((s = e + (i - e) / 2), n, o) - t) > 0
|
|
? (i = s)
|
|
: (e = s);
|
|
while (Math.abs(r) > 1e-7 && ++a < 12);
|
|
return s;
|
|
})(o, 0, 1, t, i),
|
|
e,
|
|
n,
|
|
);
|
|
}
|
|
let i2 = i1(0.42, 0, 1, 1),
|
|
i5 = i1(0, 0, 0.58, 1),
|
|
i3 = i1(0.42, 0, 0.58, 1),
|
|
i9 = (t) => (e) => (e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2),
|
|
i4 = (t) => (e) => 1 - t(1 - e),
|
|
i6 = i1(0.33, 1.53, 0.69, 0.99),
|
|
i7 = i4(i6),
|
|
i8 = i9(i7),
|
|
nt = (t) =>
|
|
(t *= 2) < 1 ? 0.5 * i7(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))),
|
|
ne = (t) => 1 - Math.sin(Math.acos(t)),
|
|
ni = i4(ne),
|
|
nn = i9(ne),
|
|
no = (t) => Array.isArray(t) && "number" == typeof t[0],
|
|
nr = {
|
|
linear: t$,
|
|
easeIn: i2,
|
|
easeInOut: i3,
|
|
easeOut: i5,
|
|
circIn: ne,
|
|
circInOut: nn,
|
|
circOut: ni,
|
|
backIn: i7,
|
|
backInOut: i8,
|
|
backOut: i6,
|
|
anticipate: nt,
|
|
},
|
|
ns = (t) => {
|
|
if (no(t)) {
|
|
tw(
|
|
4 === t.length,
|
|
"Cubic bezier arrays must contain four numerical values.",
|
|
"cubic-bezier-length",
|
|
);
|
|
let [e, i, n, o] = t;
|
|
return i1(e, i, n, o);
|
|
}
|
|
return "string" == typeof t
|
|
? (tw(
|
|
void 0 !== nr[t],
|
|
`Invalid easing type '${t}'`,
|
|
"invalid-easing-type",
|
|
),
|
|
nr[t])
|
|
: t;
|
|
},
|
|
na = (t, e, i) => {
|
|
let n = e - t;
|
|
return 0 === n ? 1 : (i - t) / n;
|
|
};
|
|
function nl({
|
|
duration: t = 300,
|
|
keyframes: e,
|
|
times: i,
|
|
ease: n = "easeInOut",
|
|
}) {
|
|
var o;
|
|
let r,
|
|
s = Array.isArray(n) && "number" != typeof n[0] ? n.map(ns) : ns(n),
|
|
a = { done: !1, value: e[0] },
|
|
l = (function (t, e, { clamp: i = !0, ease: n, mixer: o } = {}) {
|
|
let r = t.length;
|
|
if (
|
|
(tw(
|
|
r === e.length,
|
|
"Both input and output ranges must be the same length",
|
|
"range-length",
|
|
),
|
|
1 === r)
|
|
)
|
|
return () => e[0];
|
|
if (2 === r && e[0] === e[1]) return () => e[1];
|
|
let s = t[0] === t[1];
|
|
t[0] > t[r - 1] && ((t = [...t].reverse()), (e = [...e].reverse()));
|
|
let a = (function (t, e, i) {
|
|
let n = [],
|
|
o = i || tG.mix || iO,
|
|
r = t.length - 1;
|
|
for (let i = 0; i < r; i++) {
|
|
let r = o(t[i], t[i + 1]);
|
|
e && (r = iP(Array.isArray(e) ? e[i] || t$ : e, r)), n.push(r);
|
|
}
|
|
return n;
|
|
})(e, n, o),
|
|
l = a.length,
|
|
c = (i) => {
|
|
if (s && i < t[0]) return e[0];
|
|
let n = 0;
|
|
if (l > 1) for (; n < t.length - 2 && !(i < t[n + 1]); n++);
|
|
let o = na(t[n], t[n + 1], i);
|
|
return a[n](o);
|
|
};
|
|
return i ? (e) => c(C(t[0], t[r - 1], e)) : c;
|
|
})(
|
|
((o =
|
|
i && i.length === e.length
|
|
? i
|
|
: (!(function (t, e) {
|
|
let i = t[t.length - 1];
|
|
for (let n = 1; n <= e; n++) {
|
|
let o = na(0, e, n);
|
|
t.push(eB(i, 1, o));
|
|
}
|
|
})((r = [0]), e.length - 1),
|
|
r)),
|
|
o.map((e) => e * t)),
|
|
e,
|
|
{
|
|
ease: Array.isArray(s)
|
|
? s
|
|
: e.map(() => s || i3).splice(0, e.length - 1),
|
|
},
|
|
);
|
|
return {
|
|
calculatedDuration: t,
|
|
next: (e) => ((a.value = l(e)), (a.done = e >= t), a),
|
|
};
|
|
}
|
|
let nc = (t) => null !== t;
|
|
function nu(t, { repeat: e, repeatType: i = "loop" }, n, o = 1) {
|
|
let r = t.filter(nc),
|
|
s = o < 0 || (e && "loop" !== i && e % 2 == 1) ? 0 : r.length - 1;
|
|
return s && void 0 !== n ? n : r[s];
|
|
}
|
|
let nh = { decay: iJ, inertia: iJ, tween: nl, keyframes: nl, spring: iQ };
|
|
function nd(t) {
|
|
"string" == typeof t.type && (t.type = nh[t.type]);
|
|
}
|
|
class np {
|
|
constructor() {
|
|
this.updateFinished();
|
|
}
|
|
get finished() {
|
|
return this._finished;
|
|
}
|
|
updateFinished() {
|
|
this._finished = new Promise((t) => {
|
|
this.resolve = t;
|
|
});
|
|
}
|
|
notifyFinished() {
|
|
this.resolve();
|
|
}
|
|
then(t, e) {
|
|
return this.finished.then(t, e);
|
|
}
|
|
}
|
|
let nm = (t) => t / 100;
|
|
class nf extends np {
|
|
constructor(t) {
|
|
super(),
|
|
(this.state = "idle"),
|
|
(this.startTime = null),
|
|
(this.isStopped = !1),
|
|
(this.currentTime = 0),
|
|
(this.holdTime = null),
|
|
(this.playbackSpeed = 1),
|
|
(this.stop = () => {
|
|
let { motionValue: t } = this.options;
|
|
t && t.updatedAt !== en.now() && this.tick(en.now()),
|
|
(this.isStopped = !0),
|
|
"idle" !== this.state &&
|
|
(this.teardown(), this.options.onStop?.());
|
|
}),
|
|
ik.mainThread++,
|
|
(this.options = t),
|
|
this.initAnimation(),
|
|
this.play(),
|
|
!1 === t.autoplay && this.pause();
|
|
}
|
|
initAnimation() {
|
|
let { options: t } = this;
|
|
nd(t);
|
|
let {
|
|
type: e = nl,
|
|
repeat: i = 0,
|
|
repeatDelay: n = 0,
|
|
repeatType: o,
|
|
velocity: r = 0,
|
|
} = t,
|
|
{ keyframes: s } = t,
|
|
a = e || nl;
|
|
a !== nl &&
|
|
"number" != typeof s[0] &&
|
|
((this.mixKeyframes = iP(nm, iO(s[0], s[1]))), (s = [0, 100]));
|
|
let l = a({ ...t, keyframes: s });
|
|
"mirror" === o &&
|
|
(this.mirroredGenerator = a({
|
|
...t,
|
|
keyframes: [...s].reverse(),
|
|
velocity: -r,
|
|
})),
|
|
null === l.calculatedDuration && (l.calculatedDuration = iz(l));
|
|
let { calculatedDuration: c } = l;
|
|
(this.calculatedDuration = c),
|
|
(this.resolvedDuration = c + n),
|
|
(this.totalDuration = this.resolvedDuration * (i + 1) - n),
|
|
(this.generator = l);
|
|
}
|
|
updateTime(t) {
|
|
let e = Math.round(t - this.startTime) * this.playbackSpeed;
|
|
null !== this.holdTime
|
|
? (this.currentTime = this.holdTime)
|
|
: (this.currentTime = e);
|
|
}
|
|
tick(t, e = !1) {
|
|
let {
|
|
generator: i,
|
|
totalDuration: n,
|
|
mixKeyframes: o,
|
|
mirroredGenerator: r,
|
|
resolvedDuration: s,
|
|
calculatedDuration: a,
|
|
} = this;
|
|
if (null === this.startTime) return i.next(0);
|
|
let {
|
|
delay: l = 0,
|
|
keyframes: c,
|
|
repeat: u,
|
|
repeatType: h,
|
|
repeatDelay: d,
|
|
type: p,
|
|
onUpdate: m,
|
|
finalKeyframe: f,
|
|
} = this.options;
|
|
this.speed > 0
|
|
? (this.startTime = Math.min(this.startTime, t))
|
|
: this.speed < 0 &&
|
|
(this.startTime = Math.min(t - n / this.speed, this.startTime)),
|
|
e ? (this.currentTime = t) : this.updateTime(t);
|
|
let g = this.currentTime - l * (this.playbackSpeed >= 0 ? 1 : -1),
|
|
v = this.playbackSpeed >= 0 ? g < 0 : g > n;
|
|
(this.currentTime = Math.max(g, 0)),
|
|
"finished" === this.state &&
|
|
null === this.holdTime &&
|
|
(this.currentTime = n);
|
|
let y = this.currentTime,
|
|
b = i;
|
|
if (u) {
|
|
let t = Math.min(this.currentTime, n) / s,
|
|
e = Math.floor(t),
|
|
i = t % 1;
|
|
!i && t >= 1 && (i = 1),
|
|
1 === i && e--,
|
|
(e = Math.min(e, u + 1)) % 2 &&
|
|
("reverse" === h
|
|
? ((i = 1 - i), d && (i -= d / s))
|
|
: "mirror" === h && (b = r)),
|
|
(y = C(0, 1, i) * s);
|
|
}
|
|
let I = v ? { done: !1, value: c[0] } : b.next(y);
|
|
o && (I.value = o(I.value));
|
|
let { done: x } = I;
|
|
v ||
|
|
null === a ||
|
|
(x =
|
|
this.playbackSpeed >= 0
|
|
? this.currentTime >= n
|
|
: this.currentTime <= 0);
|
|
let w =
|
|
null === this.holdTime &&
|
|
("finished" === this.state || ("running" === this.state && x));
|
|
return (
|
|
w && p !== iJ && (I.value = nu(c, this.options, f, this.speed)),
|
|
m && m(I.value),
|
|
w && this.finish(),
|
|
I
|
|
);
|
|
}
|
|
then(t, e) {
|
|
return this.finished.then(t, e);
|
|
}
|
|
get duration() {
|
|
return this.calculatedDuration / 1e3;
|
|
}
|
|
get iterationDuration() {
|
|
let { delay: t = 0 } = this.options || {};
|
|
return this.duration + t / 1e3;
|
|
}
|
|
get time() {
|
|
return this.currentTime / 1e3;
|
|
}
|
|
set time(t) {
|
|
(t = iS(t)),
|
|
(this.currentTime = t),
|
|
null === this.startTime ||
|
|
null !== this.holdTime ||
|
|
0 === this.playbackSpeed
|
|
? (this.holdTime = t)
|
|
: this.driver &&
|
|
(this.startTime = this.driver.now() - t / this.playbackSpeed),
|
|
this.driver?.start(!1);
|
|
}
|
|
get speed() {
|
|
return this.playbackSpeed;
|
|
}
|
|
set speed(t) {
|
|
this.updateTime(en.now());
|
|
let e = this.playbackSpeed !== t;
|
|
(this.playbackSpeed = t), e && (this.time = this.currentTime / 1e3);
|
|
}
|
|
play() {
|
|
if (this.isStopped) return;
|
|
let { driver: t = iU, startTime: e } = this.options;
|
|
this.driver || (this.driver = t((t) => this.tick(t))),
|
|
this.options.onPlay?.();
|
|
let i = this.driver.now();
|
|
"finished" === this.state
|
|
? (this.updateFinished(), (this.startTime = i))
|
|
: null !== this.holdTime
|
|
? (this.startTime = i - this.holdTime)
|
|
: this.startTime || (this.startTime = e ?? i),
|
|
"finished" === this.state &&
|
|
this.speed < 0 &&
|
|
(this.startTime += this.calculatedDuration),
|
|
(this.holdTime = null),
|
|
(this.state = "running"),
|
|
this.driver.start();
|
|
}
|
|
pause() {
|
|
(this.state = "paused"),
|
|
this.updateTime(en.now()),
|
|
(this.holdTime = this.currentTime);
|
|
}
|
|
complete() {
|
|
"running" !== this.state && this.play(),
|
|
(this.state = "finished"),
|
|
(this.holdTime = null);
|
|
}
|
|
finish() {
|
|
this.notifyFinished(),
|
|
this.teardown(),
|
|
(this.state = "finished"),
|
|
this.options.onComplete?.();
|
|
}
|
|
cancel() {
|
|
(this.holdTime = null),
|
|
(this.startTime = 0),
|
|
this.tick(0),
|
|
this.teardown(),
|
|
this.options.onCancel?.();
|
|
}
|
|
teardown() {
|
|
(this.state = "idle"),
|
|
this.stopDriver(),
|
|
(this.startTime = this.holdTime = null),
|
|
ik.mainThread--;
|
|
}
|
|
stopDriver() {
|
|
this.driver && (this.driver.stop(), (this.driver = void 0));
|
|
}
|
|
sample(t) {
|
|
return (this.startTime = 0), this.tick(t, !0);
|
|
}
|
|
attachTimeline(t) {
|
|
return (
|
|
this.options.allowFlatten &&
|
|
((this.options.type = "keyframes"),
|
|
(this.options.ease = "linear"),
|
|
this.initAnimation()),
|
|
this.driver?.stop(),
|
|
t.observe(this)
|
|
);
|
|
}
|
|
}
|
|
function ng(t) {
|
|
let e;
|
|
return () => (void 0 === e && (e = t()), e);
|
|
}
|
|
let nv = ng(() => void 0 !== window.ScrollTimeline),
|
|
ny = {},
|
|
nb =
|
|
((i = ng(() => {
|
|
try {
|
|
document
|
|
.createElement("div")
|
|
.animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
} catch (t) {
|
|
return !1;
|
|
}
|
|
return !0;
|
|
})),
|
|
() => ny.linearEasing ?? i()),
|
|
nI = ([t, e, i, n]) => `cubic-bezier(${t}, ${e}, ${i}, ${n})`,
|
|
nx = {
|
|
linear: "linear",
|
|
ease: "ease",
|
|
easeIn: "ease-in",
|
|
easeOut: "ease-out",
|
|
easeInOut: "ease-in-out",
|
|
circIn: nI([0, 0.65, 0.55, 1]),
|
|
circOut: nI([0.55, 0, 1, 0.45]),
|
|
backIn: nI([0.31, 0.01, 0.66, -0.59]),
|
|
backOut: nI([0.33, 1.53, 0.69, 0.99]),
|
|
};
|
|
function nw(t) {
|
|
return "function" == typeof t && "applyToOptions" in t;
|
|
}
|
|
class nS extends np {
|
|
constructor(t) {
|
|
if (
|
|
(super(),
|
|
(this.finishedTime = null),
|
|
(this.isStopped = !1),
|
|
(this.manualStartTime = null),
|
|
!t)
|
|
)
|
|
return;
|
|
const {
|
|
element: e,
|
|
name: i,
|
|
keyframes: n,
|
|
pseudoElement: o,
|
|
allowFlatten: r = !1,
|
|
finalKeyframe: s,
|
|
onComplete: a,
|
|
} = t;
|
|
(this.isPseudoElement = !!o),
|
|
(this.allowFlatten = r),
|
|
(this.options = t),
|
|
tw(
|
|
"string" != typeof t.type,
|
|
'Mini animate() doesn\'t support "type" as a string.',
|
|
"mini-spring",
|
|
);
|
|
const l = (function ({ type: t, ...e }) {
|
|
return nw(t) && nb()
|
|
? t.applyToOptions(e)
|
|
: (e.duration ?? (e.duration = 300),
|
|
e.ease ?? (e.ease = "easeOut"),
|
|
e);
|
|
})(t);
|
|
(this.animation = (function (
|
|
t,
|
|
e,
|
|
i,
|
|
{
|
|
delay: n = 0,
|
|
duration: o = 300,
|
|
repeat: r = 0,
|
|
repeatType: s = "loop",
|
|
ease: a = "easeOut",
|
|
times: l,
|
|
} = {},
|
|
c,
|
|
) {
|
|
let u = { [e]: i };
|
|
l && (u.offset = l);
|
|
let h = (function t(e, i) {
|
|
if (e)
|
|
return "function" == typeof e
|
|
? nb()
|
|
? iH(e, i)
|
|
: "ease-out"
|
|
: no(e)
|
|
? nI(e)
|
|
: Array.isArray(e)
|
|
? e.map((e) => t(e, i) || nx.easeOut)
|
|
: nx[e];
|
|
})(a, o);
|
|
Array.isArray(h) && (u.easing = h);
|
|
let d = {
|
|
delay: n,
|
|
duration: o,
|
|
easing: Array.isArray(h) ? "linear" : h,
|
|
fill: "both",
|
|
iterations: r + 1,
|
|
direction: "reverse" === s ? "alternate" : "normal",
|
|
};
|
|
c && (d.pseudoElement = c);
|
|
let p = t.animate(u, d);
|
|
return p;
|
|
})(e, i, n, l, o)),
|
|
!1 === l.autoplay && this.animation.pause(),
|
|
(this.animation.onfinish = () => {
|
|
if (((this.finishedTime = this.time), !o)) {
|
|
let t = nu(n, this.options, s, this.speed);
|
|
this.updateMotionValue
|
|
? this.updateMotionValue(t)
|
|
: i.startsWith("--")
|
|
? e.style.setProperty(i, t)
|
|
: (e.style[i] = t),
|
|
this.animation.cancel();
|
|
}
|
|
a?.(), this.notifyFinished();
|
|
});
|
|
}
|
|
play() {
|
|
this.isStopped ||
|
|
((this.manualStartTime = null),
|
|
this.animation.play(),
|
|
"finished" === this.state && this.updateFinished());
|
|
}
|
|
pause() {
|
|
this.animation.pause();
|
|
}
|
|
complete() {
|
|
this.animation.finish?.();
|
|
}
|
|
cancel() {
|
|
try {
|
|
this.animation.cancel();
|
|
} catch (t) {}
|
|
}
|
|
stop() {
|
|
if (this.isStopped) return;
|
|
this.isStopped = !0;
|
|
let { state: t } = this;
|
|
"idle" !== t &&
|
|
"finished" !== t &&
|
|
(this.updateMotionValue
|
|
? this.updateMotionValue()
|
|
: this.commitStyles(),
|
|
this.isPseudoElement || this.cancel());
|
|
}
|
|
commitStyles() {
|
|
let t = this.options?.element;
|
|
!this.isPseudoElement &&
|
|
t?.isConnected &&
|
|
this.animation.commitStyles?.();
|
|
}
|
|
get duration() {
|
|
return (
|
|
Number(this.animation.effect?.getComputedTiming?.().duration || 0) /
|
|
1e3
|
|
);
|
|
}
|
|
get iterationDuration() {
|
|
let { delay: t = 0 } = this.options || {};
|
|
return this.duration + t / 1e3;
|
|
}
|
|
get time() {
|
|
return (Number(this.animation.currentTime) || 0) / 1e3;
|
|
}
|
|
set time(t) {
|
|
(this.manualStartTime = null),
|
|
(this.finishedTime = null),
|
|
(this.animation.currentTime = iS(t));
|
|
}
|
|
get speed() {
|
|
return this.animation.playbackRate;
|
|
}
|
|
set speed(t) {
|
|
t < 0 && (this.finishedTime = null), (this.animation.playbackRate = t);
|
|
}
|
|
get state() {
|
|
return null !== this.finishedTime
|
|
? "finished"
|
|
: this.animation.playState;
|
|
}
|
|
get startTime() {
|
|
return this.manualStartTime ?? Number(this.animation.startTime);
|
|
}
|
|
set startTime(t) {
|
|
this.manualStartTime = this.animation.startTime = t;
|
|
}
|
|
attachTimeline({ timeline: t, observe: e }) {
|
|
return (this.allowFlatten &&
|
|
this.animation.effect?.updateTiming({ easing: "linear" }),
|
|
(this.animation.onfinish = null),
|
|
t && nv())
|
|
? ((this.animation.timeline = t), t$)
|
|
: e(this);
|
|
}
|
|
}
|
|
let nT = { anticipate: nt, backInOut: i8, circInOut: nn };
|
|
class nP extends nS {
|
|
constructor(t) {
|
|
!(function (t) {
|
|
"string" == typeof t.ease && t.ease in nT && (t.ease = nT[t.ease]);
|
|
})(t),
|
|
nd(t),
|
|
super(t),
|
|
void 0 !== t.startTime && (this.startTime = t.startTime),
|
|
(this.options = t);
|
|
}
|
|
updateMotionValue(t) {
|
|
let {
|
|
motionValue: e,
|
|
onUpdate: i,
|
|
onComplete: n,
|
|
element: o,
|
|
...r
|
|
} = this.options;
|
|
if (!e) return;
|
|
if (void 0 !== t) return void e.set(t);
|
|
let s = new nf({ ...r, autoplay: !1 }),
|
|
a = Math.max(10, en.now() - this.startTime),
|
|
l = C(0, 10, a - 10);
|
|
e.setWithVelocity(
|
|
s.sample(Math.max(0, a - l)).value,
|
|
s.sample(a).value,
|
|
l,
|
|
),
|
|
s.stop();
|
|
}
|
|
}
|
|
let nk = (t, e) =>
|
|
"zIndex" !== e &&
|
|
!!(
|
|
"number" == typeof t ||
|
|
Array.isArray(t) ||
|
|
("string" == typeof t &&
|
|
(tn.test(t) || "0" === t) &&
|
|
!t.startsWith("url("))
|
|
);
|
|
function nA(t) {
|
|
(t.duration = 0), (t.type = "keyframes");
|
|
}
|
|
let nC = new Set(["opacity", "clipPath", "filter", "transform"]),
|
|
nE = ng(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
class nL extends np {
|
|
constructor({
|
|
autoplay: t = !0,
|
|
delay: e = 0,
|
|
type: i = "keyframes",
|
|
repeat: n = 0,
|
|
repeatDelay: o = 0,
|
|
repeatType: r = "loop",
|
|
keyframes: s,
|
|
name: a,
|
|
motionValue: l,
|
|
element: c,
|
|
...u
|
|
}) {
|
|
super(),
|
|
(this.stop = () => {
|
|
this._animation && (this._animation.stop(), this.stopTimeline?.()),
|
|
this.keyframeResolver?.cancel();
|
|
}),
|
|
(this.createdAt = en.now());
|
|
const h = {
|
|
autoplay: t,
|
|
delay: e,
|
|
type: i,
|
|
repeat: n,
|
|
repeatDelay: o,
|
|
repeatType: r,
|
|
name: a,
|
|
motionValue: l,
|
|
element: c,
|
|
...u,
|
|
},
|
|
d = c?.KeyframeResolver || t3;
|
|
(this.keyframeResolver = new d(
|
|
s,
|
|
(t, e, i) => this.onKeyframesResolved(t, e, h, !i),
|
|
a,
|
|
l,
|
|
c,
|
|
)),
|
|
this.keyframeResolver?.scheduleResolve();
|
|
}
|
|
onKeyframesResolved(t, e, i, n) {
|
|
this.keyframeResolver = void 0;
|
|
let {
|
|
name: o,
|
|
type: r,
|
|
velocity: s,
|
|
delay: a,
|
|
isHandoff: l,
|
|
onUpdate: c,
|
|
} = i;
|
|
(this.resolvedAt = en.now()),
|
|
!(function (t, e, i, n) {
|
|
let o = t[0];
|
|
if (null === o) return !1;
|
|
if ("display" === e || "visibility" === e) return !0;
|
|
let r = t[t.length - 1],
|
|
s = nk(o, e),
|
|
a = nk(r, e);
|
|
return (
|
|
tx(
|
|
s === a,
|
|
`You are trying to animate ${e} from "${o}" to "${r}". "${s ? r : o}" is not an animatable value.`,
|
|
"value-not-animatable",
|
|
),
|
|
!!s &&
|
|
!!a &&
|
|
((function (t) {
|
|
let e = t[0];
|
|
if (1 === t.length) return !0;
|
|
for (let i = 0; i < t.length; i++) if (t[i] !== e) return !0;
|
|
})(t) ||
|
|
(("spring" === i || nw(i)) && n))
|
|
);
|
|
})(t, o, r, s) &&
|
|
((tG.instantAnimations || !a) && c?.(nu(t, i, e)),
|
|
(t[0] = t[t.length - 1]),
|
|
nA(i),
|
|
(i.repeat = 0));
|
|
let u = {
|
|
startTime: n
|
|
? this.resolvedAt && this.resolvedAt - this.createdAt > 40
|
|
? this.resolvedAt
|
|
: this.createdAt
|
|
: void 0,
|
|
finalKeyframe: e,
|
|
...i,
|
|
keyframes: t,
|
|
},
|
|
h =
|
|
!l &&
|
|
(function (t) {
|
|
let {
|
|
motionValue: e,
|
|
name: i,
|
|
repeatDelay: n,
|
|
repeatType: o,
|
|
damping: r,
|
|
type: s,
|
|
} = t;
|
|
if (!(e?.owner?.current instanceof HTMLElement)) return !1;
|
|
let { onUpdate: a, transformTemplate: l } = e.owner.getProps();
|
|
return (
|
|
nE() &&
|
|
i &&
|
|
nC.has(i) &&
|
|
("transform" !== i || !l) &&
|
|
!a &&
|
|
!n &&
|
|
"mirror" !== o &&
|
|
0 !== r &&
|
|
"inertia" !== s
|
|
);
|
|
})(u),
|
|
d = u.motionValue?.owner?.current,
|
|
p = h ? new nP({ ...u, element: d }) : new nf(u);
|
|
p.finished
|
|
.then(() => {
|
|
this.notifyFinished();
|
|
})
|
|
.catch(t$),
|
|
this.pendingTimeline &&
|
|
((this.stopTimeline = p.attachTimeline(this.pendingTimeline)),
|
|
(this.pendingTimeline = void 0)),
|
|
(this._animation = p);
|
|
}
|
|
get finished() {
|
|
return this._animation ? this.animation.finished : this._finished;
|
|
}
|
|
then(t, e) {
|
|
return this.finished.finally(t).then(() => {});
|
|
}
|
|
get animation() {
|
|
return (
|
|
this._animation ||
|
|
(this.keyframeResolver?.resume(), (t1 = !0), t5(), t2(), (t1 = !1)),
|
|
this._animation
|
|
);
|
|
}
|
|
get duration() {
|
|
return this.animation.duration;
|
|
}
|
|
get iterationDuration() {
|
|
return this.animation.iterationDuration;
|
|
}
|
|
get time() {
|
|
return this.animation.time;
|
|
}
|
|
set time(t) {
|
|
this.animation.time = t;
|
|
}
|
|
get speed() {
|
|
return this.animation.speed;
|
|
}
|
|
get state() {
|
|
return this.animation.state;
|
|
}
|
|
set speed(t) {
|
|
this.animation.speed = t;
|
|
}
|
|
get startTime() {
|
|
return this.animation.startTime;
|
|
}
|
|
attachTimeline(t) {
|
|
return (
|
|
this._animation
|
|
? (this.stopTimeline = this.animation.attachTimeline(t))
|
|
: (this.pendingTimeline = t),
|
|
() => this.stop()
|
|
);
|
|
}
|
|
play() {
|
|
this.animation.play();
|
|
}
|
|
pause() {
|
|
this.animation.pause();
|
|
}
|
|
complete() {
|
|
this.animation.complete();
|
|
}
|
|
cancel() {
|
|
this._animation && this.animation.cancel(),
|
|
this.keyframeResolver?.cancel();
|
|
}
|
|
}
|
|
let nM = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 },
|
|
nR = { type: "keyframes", duration: 0.8 },
|
|
nD = { type: "keyframes", ease: [0.25, 0.1, 0.35, 1], duration: 0.3 },
|
|
nV = (t) => null !== t,
|
|
nF =
|
|
(t, e, i, n = {}, o, r) =>
|
|
(s) => {
|
|
let a = iI(n, t) || {},
|
|
l = a.delay || n.delay || 0,
|
|
{ elapsed: c = 0 } = n;
|
|
c -= iS(l);
|
|
let u = {
|
|
keyframes: Array.isArray(i) ? i : [null, i],
|
|
ease: "easeOut",
|
|
velocity: e.getVelocity(),
|
|
...a,
|
|
delay: -c,
|
|
onUpdate: (t) => {
|
|
e.set(t), a.onUpdate && a.onUpdate(t);
|
|
},
|
|
onComplete: () => {
|
|
s(), a.onComplete && a.onComplete();
|
|
},
|
|
name: t,
|
|
motionValue: e,
|
|
element: r ? void 0 : o,
|
|
};
|
|
!(function ({
|
|
when: t,
|
|
delay: e,
|
|
delayChildren: i,
|
|
staggerChildren: n,
|
|
staggerDirection: o,
|
|
repeat: r,
|
|
repeatType: s,
|
|
repeatDelay: a,
|
|
from: l,
|
|
elapsed: c,
|
|
...u
|
|
}) {
|
|
return !!Object.keys(u).length;
|
|
})(a) &&
|
|
Object.assign(
|
|
u,
|
|
((t, { keyframes: e }) =>
|
|
e.length > 2
|
|
? nR
|
|
: A.has(t)
|
|
? t.startsWith("scale")
|
|
? {
|
|
type: "spring",
|
|
stiffness: 550,
|
|
damping: 0 === e[1] ? 2 * Math.sqrt(550) : 30,
|
|
restSpeed: 10,
|
|
}
|
|
: nM
|
|
: nD)(t, u),
|
|
),
|
|
u.duration && (u.duration = iS(u.duration)),
|
|
u.repeatDelay && (u.repeatDelay = iS(u.repeatDelay)),
|
|
void 0 !== u.from && (u.keyframes[0] = u.from);
|
|
let h = !1;
|
|
if (
|
|
((!1 !== u.type && (0 !== u.duration || u.repeatDelay)) ||
|
|
(nA(u), 0 === u.delay && (h = !0)),
|
|
(tG.instantAnimations ||
|
|
tG.skipAnimations ||
|
|
o?.shouldSkipAnimations) &&
|
|
((h = !0), nA(u), (u.delay = 0)),
|
|
(u.allowFlatten = !a.type && !a.ease),
|
|
h && !r && void 0 !== e.get())
|
|
) {
|
|
let t = (function (t, { repeat: e, repeatType: i = "loop" }, n) {
|
|
let o = t.filter(nV),
|
|
r = e && "loop" !== i && e % 2 == 1 ? 0 : o.length - 1;
|
|
return o[r];
|
|
})(u.keyframes, a);
|
|
if (void 0 !== t)
|
|
return void tq.update(() => {
|
|
u.onUpdate(t), u.onComplete();
|
|
});
|
|
}
|
|
return a.isSync ? new nf(u) : new nL(u);
|
|
};
|
|
function nj(t, e, { delay: i = 0, transitionOverride: n, type: o } = {}) {
|
|
let {
|
|
transition: r = t.getDefaultTransition(),
|
|
transitionEnd: s,
|
|
...a
|
|
} = e,
|
|
l = r?.reduceMotion;
|
|
n && (r = n);
|
|
let c = [],
|
|
u = o && t.animationState && t.animationState.getState()[o];
|
|
for (let e in a) {
|
|
let n = t.getValue(e, t.latestValues[e] ?? null),
|
|
o = a[e];
|
|
if (
|
|
void 0 === o ||
|
|
(u &&
|
|
(function ({ protectedKeys: t, needsAnimating: e }, i) {
|
|
let n = t.hasOwnProperty(i) && !0 !== e[i];
|
|
return (e[i] = !1), n;
|
|
})(u, e))
|
|
)
|
|
continue;
|
|
let s = { delay: i, ...iI(r || {}, e) },
|
|
h = n.get();
|
|
if (
|
|
void 0 !== h &&
|
|
!n.isAnimating &&
|
|
!Array.isArray(o) &&
|
|
o === h &&
|
|
!s.velocity
|
|
)
|
|
continue;
|
|
let d = !1;
|
|
if (window.MotionHandoffAnimation) {
|
|
let i = t.props[ip];
|
|
if (i) {
|
|
let t = window.MotionHandoffAnimation(i, e, tq);
|
|
null !== t && ((s.startTime = t), (d = !0));
|
|
}
|
|
}
|
|
iw(t, e);
|
|
let p = l ?? t.shouldReduceMotion;
|
|
n.start(nF(e, n, o, p && tv.has(e) ? { type: !1 } : s, t, d));
|
|
let m = n.animation;
|
|
m && c.push(m);
|
|
}
|
|
return (
|
|
s &&
|
|
Promise.all(c).then(() => {
|
|
tq.update(() => {
|
|
s &&
|
|
(function (t, e) {
|
|
let {
|
|
transitionEnd: i = {},
|
|
transition: n = {},
|
|
...o
|
|
} = ib(t, e) || {};
|
|
for (let e in (o = { ...o, ...i })) {
|
|
var r;
|
|
let i = ix((r = o[e])) ? r[r.length - 1] || 0 : r;
|
|
t.hasValue(e) ? t.getValue(e).set(i) : t.addValue(e, er(i));
|
|
}
|
|
})(t, s);
|
|
});
|
|
}),
|
|
c
|
|
);
|
|
}
|
|
function nN(t, e, i, n = 0, o = 1) {
|
|
let r = Array.from(t)
|
|
.sort((t, e) => t.sortNodePosition(e))
|
|
.indexOf(e),
|
|
s = t.size,
|
|
a = (s - 1) * n;
|
|
return "function" == typeof i ? i(r, s) : 1 === o ? r * n : a - r * n;
|
|
}
|
|
function nB(t, e, i = {}) {
|
|
let n = ib(t, e, "exit" === i.type ? t.presenceContext?.custom : void 0),
|
|
{ transition: o = t.getDefaultTransition() || {} } = n || {};
|
|
i.transitionOverride && (o = i.transitionOverride);
|
|
let r = n ? () => Promise.all(nj(t, n, i)) : () => Promise.resolve(),
|
|
s =
|
|
t.variantChildren && t.variantChildren.size
|
|
? (n = 0) => {
|
|
let {
|
|
delayChildren: r = 0,
|
|
staggerChildren: s,
|
|
staggerDirection: a,
|
|
} = o;
|
|
return (function (t, e, i = 0, n = 0, o = 0, r = 1, s) {
|
|
let a = [];
|
|
for (let l of t.variantChildren)
|
|
l.notify("AnimationStart", e),
|
|
a.push(
|
|
nB(l, e, {
|
|
...s,
|
|
delay:
|
|
i +
|
|
("function" == typeof n ? 0 : n) +
|
|
nN(t.variantChildren, l, n, o, r),
|
|
}).then(() => l.notify("AnimationComplete", e)),
|
|
);
|
|
return Promise.all(a);
|
|
})(t, e, n, r, s, a, i);
|
|
}
|
|
: () => Promise.resolve(),
|
|
{ when: a } = o;
|
|
if (!a) return Promise.all([r(), s(i.delay)]);
|
|
{
|
|
let [t, e] = "beforeChildren" === a ? [r, s] : [s, r];
|
|
return t().then(() => e());
|
|
}
|
|
}
|
|
let nO = ef.length;
|
|
function nU(t, e) {
|
|
if (!Array.isArray(e)) return !1;
|
|
let i = e.length;
|
|
if (i !== t.length) return !1;
|
|
for (let n = 0; n < i; n++) if (e[n] !== t[n]) return !1;
|
|
return !0;
|
|
}
|
|
let nH = [...em].reverse(),
|
|
nz = em.length;
|
|
function nW(t = !1) {
|
|
return {
|
|
isActive: t,
|
|
protectedKeys: {},
|
|
needsAnimating: {},
|
|
prevResolvedValues: {},
|
|
};
|
|
}
|
|
function n$() {
|
|
return {
|
|
animate: nW(!0),
|
|
whileInView: nW(),
|
|
whileHover: nW(),
|
|
whileTap: nW(),
|
|
whileDrag: nW(),
|
|
whileFocus: nW(),
|
|
exit: nW(),
|
|
};
|
|
}
|
|
let nG = 0;
|
|
function nX(t) {
|
|
return [t("x"), t("y")];
|
|
}
|
|
let nY = new Set(["BUTTON", "INPUT", "SELECT", "TEXTAREA", "A"]),
|
|
nq = new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
function nK(t, e, i, n = { passive: !0 }) {
|
|
return t.addEventListener(e, i, n), () => t.removeEventListener(e, i);
|
|
}
|
|
let n_ = { x: !1, y: !1 };
|
|
function nZ(t) {
|
|
return t.max - t.min;
|
|
}
|
|
function nQ(t, e, i, n = 0.5) {
|
|
(t.origin = n),
|
|
(t.originPoint = eB(e.min, e.max, t.origin)),
|
|
(t.scale = nZ(i) / nZ(e)),
|
|
(t.translate = eB(i.min, i.max, t.origin) - t.originPoint),
|
|
((t.scale >= 0.9999 && t.scale <= 1.0001) || isNaN(t.scale)) &&
|
|
(t.scale = 1),
|
|
((t.translate >= -0.01 && t.translate <= 0.01) || isNaN(t.translate)) &&
|
|
(t.translate = 0);
|
|
}
|
|
function nJ(t, e, i, n) {
|
|
nQ(t.x, e.x, i.x, n ? n.originX : void 0),
|
|
nQ(t.y, e.y, i.y, n ? n.originY : void 0);
|
|
}
|
|
function n0(t, e, i) {
|
|
(t.min = i.min + e.min), (t.max = t.min + nZ(e));
|
|
}
|
|
function n1(t, e, i) {
|
|
(t.min = e.min - i.min), (t.max = t.min + nZ(e));
|
|
}
|
|
function n2(t, e, i) {
|
|
n1(t.x, e.x, i.x), n1(t.y, e.y, i.y);
|
|
}
|
|
let n5 = (t) =>
|
|
"mouse" === t.pointerType
|
|
? "number" != typeof t.button || t.button <= 0
|
|
: !1 !== t.isPrimary;
|
|
function n3(t) {
|
|
return { point: { x: t.pageX, y: t.pageY } };
|
|
}
|
|
function n9(t, e, i, n) {
|
|
return nK(t, e, (t) => n5(t) && i(t, n3(t)), n);
|
|
}
|
|
let n4 = ({ current: t }) => (t ? t.ownerDocument.defaultView : null),
|
|
n6 = (t, e) => Math.abs(t - e),
|
|
n7 = new Set(["auto", "scroll"]);
|
|
class n8 {
|
|
constructor(
|
|
t,
|
|
e,
|
|
{
|
|
transformPagePoint: i,
|
|
contextWindow: n = window,
|
|
dragSnapToOrigin: o = !1,
|
|
distanceThreshold: r = 3,
|
|
element: s,
|
|
} = {},
|
|
) {
|
|
if (
|
|
((this.startEvent = null),
|
|
(this.lastMoveEvent = null),
|
|
(this.lastMoveEventInfo = null),
|
|
(this.handlers = {}),
|
|
(this.contextWindow = window),
|
|
(this.scrollPositions = new Map()),
|
|
(this.removeScrollListeners = null),
|
|
(this.onElementScroll = (t) => {
|
|
this.handleScroll(t.target);
|
|
}),
|
|
(this.onWindowScroll = () => {
|
|
this.handleScroll(window);
|
|
}),
|
|
(this.updatePoint = () => {
|
|
var t, e;
|
|
if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return;
|
|
let i = oi(this.lastMoveEventInfo, this.history),
|
|
n = null !== this.startEvent,
|
|
o =
|
|
((t = i.offset),
|
|
(e = { x: 0, y: 0 }),
|
|
Math.sqrt(n6(t.x, e.x) ** 2 + n6(t.y, e.y) ** 2) >=
|
|
this.distanceThreshold);
|
|
if (!n && !o) return;
|
|
let { point: r } = i,
|
|
{ timestamp: s } = t_;
|
|
this.history.push({ ...r, timestamp: s });
|
|
let { onStart: a, onMove: l } = this.handlers;
|
|
n ||
|
|
(a && a(this.lastMoveEvent, i),
|
|
(this.startEvent = this.lastMoveEvent)),
|
|
l && l(this.lastMoveEvent, i);
|
|
}),
|
|
(this.handlePointerMove = (t, e) => {
|
|
(this.lastMoveEvent = t),
|
|
(this.lastMoveEventInfo = ot(e, this.transformPagePoint)),
|
|
tq.update(this.updatePoint, !0);
|
|
}),
|
|
(this.handlePointerUp = (t, e) => {
|
|
this.end();
|
|
let {
|
|
onEnd: i,
|
|
onSessionEnd: n,
|
|
resumeAnimation: o,
|
|
} = this.handlers;
|
|
if (
|
|
((this.dragSnapToOrigin || !this.startEvent) && o && o(),
|
|
!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
)
|
|
return;
|
|
let r = oi(
|
|
"pointercancel" === t.type
|
|
? this.lastMoveEventInfo
|
|
: ot(e, this.transformPagePoint),
|
|
this.history,
|
|
);
|
|
this.startEvent && i && i(t, r), n && n(t, r);
|
|
}),
|
|
!n5(t))
|
|
)
|
|
return;
|
|
(this.dragSnapToOrigin = o),
|
|
(this.handlers = e),
|
|
(this.transformPagePoint = i),
|
|
(this.distanceThreshold = r),
|
|
(this.contextWindow = n || window);
|
|
const a = ot(n3(t), this.transformPagePoint),
|
|
{ point: l } = a,
|
|
{ timestamp: c } = t_;
|
|
this.history = [{ ...l, timestamp: c }];
|
|
const { onSessionStart: u } = e;
|
|
u && u(t, oi(a, this.history)),
|
|
(this.removeListeners = iP(
|
|
n9(this.contextWindow, "pointermove", this.handlePointerMove),
|
|
n9(this.contextWindow, "pointerup", this.handlePointerUp),
|
|
n9(this.contextWindow, "pointercancel", this.handlePointerUp),
|
|
)),
|
|
s && this.startScrollTracking(s);
|
|
}
|
|
startScrollTracking(t) {
|
|
let e = t.parentElement;
|
|
for (; e; ) {
|
|
let t = getComputedStyle(e);
|
|
(n7.has(t.overflowX) || n7.has(t.overflowY)) &&
|
|
this.scrollPositions.set(e, { x: e.scrollLeft, y: e.scrollTop }),
|
|
(e = e.parentElement);
|
|
}
|
|
this.scrollPositions.set(window, {
|
|
x: window.scrollX,
|
|
y: window.scrollY,
|
|
}),
|
|
window.addEventListener("scroll", this.onElementScroll, {
|
|
capture: !0,
|
|
passive: !0,
|
|
}),
|
|
window.addEventListener("scroll", this.onWindowScroll, {
|
|
passive: !0,
|
|
}),
|
|
(this.removeScrollListeners = () => {
|
|
window.removeEventListener("scroll", this.onElementScroll, {
|
|
capture: !0,
|
|
}),
|
|
window.removeEventListener("scroll", this.onWindowScroll);
|
|
});
|
|
}
|
|
handleScroll(t) {
|
|
let e = this.scrollPositions.get(t);
|
|
if (!e) return;
|
|
let i = t === window,
|
|
n = i
|
|
? { x: window.scrollX, y: window.scrollY }
|
|
: { x: t.scrollLeft, y: t.scrollTop },
|
|
o = { x: n.x - e.x, y: n.y - e.y };
|
|
(0 !== o.x || 0 !== o.y) &&
|
|
(i
|
|
? this.lastMoveEventInfo &&
|
|
((this.lastMoveEventInfo.point.x += o.x),
|
|
(this.lastMoveEventInfo.point.y += o.y))
|
|
: this.history.length > 0 &&
|
|
((this.history[0].x -= o.x), (this.history[0].y -= o.y)),
|
|
this.scrollPositions.set(t, n),
|
|
tq.update(this.updatePoint, !0));
|
|
}
|
|
updateHandlers(t) {
|
|
this.handlers = t;
|
|
}
|
|
end() {
|
|
this.removeListeners && this.removeListeners(),
|
|
this.removeScrollListeners && this.removeScrollListeners(),
|
|
this.scrollPositions.clear(),
|
|
tK(this.updatePoint);
|
|
}
|
|
}
|
|
function ot(t, e) {
|
|
return e ? { point: e(t.point) } : t;
|
|
}
|
|
function oe(t, e) {
|
|
return { x: t.x - e.x, y: t.y - e.y };
|
|
}
|
|
function oi({ point: t }, e) {
|
|
return {
|
|
point: t,
|
|
delta: oe(t, on(e)),
|
|
offset: oe(t, e[0]),
|
|
velocity: (function (t, e) {
|
|
if (t.length < 2) return { x: 0, y: 0 };
|
|
let i = t.length - 1,
|
|
n = null,
|
|
o = on(t);
|
|
for (
|
|
;
|
|
i >= 0 && ((n = t[i]), !(o.timestamp - n.timestamp > iS(0.1)));
|
|
|
|
)
|
|
i--;
|
|
if (!n) return { x: 0, y: 0 };
|
|
let r = (o.timestamp - n.timestamp) / 1e3;
|
|
if (0 === r) return { x: 0, y: 0 };
|
|
let s = { x: (o.x - n.x) / r, y: (o.y - n.y) / r };
|
|
return s.x === 1 / 0 && (s.x = 0), s.y === 1 / 0 && (s.y = 0), s;
|
|
})(e, 0.1),
|
|
};
|
|
}
|
|
function on(t) {
|
|
return t[t.length - 1];
|
|
}
|
|
function oo(t, e, i) {
|
|
return {
|
|
min: void 0 !== e ? t.min + e : void 0,
|
|
max: void 0 !== i ? t.max + i - (t.max - t.min) : void 0,
|
|
};
|
|
}
|
|
function or(t, e) {
|
|
let i = e.min - t.min,
|
|
n = e.max - t.max;
|
|
return (
|
|
e.max - e.min < t.max - t.min && ([i, n] = [n, i]), { min: i, max: n }
|
|
);
|
|
}
|
|
function os(t, e, i) {
|
|
return { min: oa(t, e), max: oa(t, i) };
|
|
}
|
|
function oa(t, e) {
|
|
return "number" == typeof t ? t : t[e] || 0;
|
|
}
|
|
let ol = new WeakMap();
|
|
class oc {
|
|
constructor(t) {
|
|
(this.openDragLock = null),
|
|
(this.isDragging = !1),
|
|
(this.currentDirection = null),
|
|
(this.originPoint = { x: 0, y: 0 }),
|
|
(this.constraints = !1),
|
|
(this.hasMutatedConstraints = !1),
|
|
(this.elastic = tf()),
|
|
(this.latestPointerEvent = null),
|
|
(this.latestPanInfo = null),
|
|
(this.visualElement = t);
|
|
}
|
|
start(t, { snapToCursor: e = !1, distanceThreshold: i } = {}) {
|
|
let { presenceContext: n } = this.visualElement;
|
|
if (n && !1 === n.isPresent) return;
|
|
let o = (t) => {
|
|
e
|
|
? (this.stopAnimation(), this.snapToCursor(n3(t).point))
|
|
: this.pauseAnimation();
|
|
},
|
|
r = (t, e) => {
|
|
this.stopAnimation();
|
|
let {
|
|
drag: i,
|
|
dragPropagation: n,
|
|
onDragStart: o,
|
|
} = this.getProps();
|
|
if (
|
|
i &&
|
|
!n &&
|
|
(this.openDragLock && this.openDragLock(),
|
|
(this.openDragLock = (function (t) {
|
|
if ("x" === t || "y" === t)
|
|
if (n_[t]) return null;
|
|
else
|
|
return (
|
|
(n_[t] = !0),
|
|
() => {
|
|
n_[t] = !1;
|
|
}
|
|
);
|
|
return n_.x || n_.y
|
|
? null
|
|
: ((n_.x = n_.y = !0),
|
|
() => {
|
|
n_.x = n_.y = !1;
|
|
});
|
|
})(i)),
|
|
!this.openDragLock)
|
|
)
|
|
return;
|
|
(this.latestPointerEvent = t),
|
|
(this.latestPanInfo = e),
|
|
(this.isDragging = !0),
|
|
(this.currentDirection = null),
|
|
this.resolveConstraints(),
|
|
this.visualElement.projection &&
|
|
((this.visualElement.projection.isAnimationBlocked = !0),
|
|
(this.visualElement.projection.target = void 0)),
|
|
nX((t) => {
|
|
let e = this.getAxisMotionValue(t).get() || 0;
|
|
if (z.test(e)) {
|
|
let { projection: i } = this.visualElement;
|
|
if (i && i.layout) {
|
|
let n = i.layout.layoutBox[t];
|
|
n && (e = nZ(n) * (parseFloat(e) / 100));
|
|
}
|
|
}
|
|
this.originPoint[t] = e;
|
|
}),
|
|
o && tq.update(() => o(t, e), !1, !0),
|
|
iw(this.visualElement, "transform");
|
|
let { animationState: r } = this.visualElement;
|
|
r && r.setActive("whileDrag", !0);
|
|
},
|
|
s = (t, e) => {
|
|
(this.latestPointerEvent = t), (this.latestPanInfo = e);
|
|
let {
|
|
dragPropagation: i,
|
|
dragDirectionLock: n,
|
|
onDirectionLock: o,
|
|
onDrag: r,
|
|
} = this.getProps();
|
|
if (!i && !this.openDragLock) return;
|
|
let { offset: s } = e;
|
|
if (n && null === this.currentDirection) {
|
|
(this.currentDirection = (function (t, e = 10) {
|
|
let i = null;
|
|
return (
|
|
Math.abs(t.y) > e
|
|
? (i = "y")
|
|
: Math.abs(t.x) > e && (i = "x"),
|
|
i
|
|
);
|
|
})(s)),
|
|
null !== this.currentDirection && o && o(this.currentDirection);
|
|
return;
|
|
}
|
|
this.updateAxis("x", e.point, s),
|
|
this.updateAxis("y", e.point, s),
|
|
this.visualElement.render(),
|
|
r && tq.update(() => r(t, e), !1, !0);
|
|
},
|
|
a = (t, e) => {
|
|
(this.latestPointerEvent = t),
|
|
(this.latestPanInfo = e),
|
|
this.stop(t, e),
|
|
(this.latestPointerEvent = null),
|
|
(this.latestPanInfo = null);
|
|
},
|
|
l = () =>
|
|
nX(
|
|
(t) =>
|
|
"paused" === this.getAnimationState(t) &&
|
|
this.getAxisMotionValue(t).animation?.play(),
|
|
),
|
|
{ dragSnapToOrigin: c } = this.getProps();
|
|
this.panSession = new n8(
|
|
t,
|
|
{
|
|
onSessionStart: o,
|
|
onStart: r,
|
|
onMove: s,
|
|
onSessionEnd: a,
|
|
resumeAnimation: l,
|
|
},
|
|
{
|
|
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
dragSnapToOrigin: c,
|
|
distanceThreshold: i,
|
|
contextWindow: n4(this.visualElement),
|
|
element: this.visualElement.current,
|
|
},
|
|
);
|
|
}
|
|
stop(t, e) {
|
|
let i = t || this.latestPointerEvent,
|
|
n = e || this.latestPanInfo,
|
|
o = this.isDragging;
|
|
if ((this.cancel(), !o || !n || !i)) return;
|
|
let { velocity: r } = n;
|
|
this.startAnimation(r);
|
|
let { onDragEnd: s } = this.getProps();
|
|
s && tq.postRender(() => s(i, n));
|
|
}
|
|
cancel() {
|
|
this.isDragging = !1;
|
|
let { projection: t, animationState: e } = this.visualElement;
|
|
t && (t.isAnimationBlocked = !1), this.endPanSession();
|
|
let { dragPropagation: i } = this.getProps();
|
|
!i &&
|
|
this.openDragLock &&
|
|
(this.openDragLock(), (this.openDragLock = null)),
|
|
e && e.setActive("whileDrag", !1);
|
|
}
|
|
endPanSession() {
|
|
this.panSession && this.panSession.end(), (this.panSession = void 0);
|
|
}
|
|
updateAxis(t, e, i) {
|
|
let { drag: n } = this.getProps();
|
|
if (!i || !ou(t, n, this.currentDirection)) return;
|
|
let o = this.getAxisMotionValue(t),
|
|
r = this.originPoint[t] + i[t];
|
|
this.constraints &&
|
|
this.constraints[t] &&
|
|
(r = (function (t, { min: e, max: i }, n) {
|
|
return (
|
|
void 0 !== e && t < e
|
|
? (t = n ? eB(e, t, n.min) : Math.max(t, e))
|
|
: void 0 !== i &&
|
|
t > i &&
|
|
(t = n ? eB(i, t, n.max) : Math.min(t, i)),
|
|
t
|
|
);
|
|
})(r, this.constraints[t], this.elastic[t])),
|
|
o.set(r);
|
|
}
|
|
resolveConstraints() {
|
|
let { dragConstraints: t, dragElastic: e } = this.getProps(),
|
|
i =
|
|
this.visualElement.projection &&
|
|
!this.visualElement.projection.layout
|
|
? this.visualElement.projection.measure(!1)
|
|
: this.visualElement.projection?.layout,
|
|
n = this.constraints;
|
|
t && ig(t)
|
|
? this.constraints ||
|
|
(this.constraints = this.resolveRefConstraints())
|
|
: t && i
|
|
? (this.constraints = (function (
|
|
t,
|
|
{ top: e, left: i, bottom: n, right: o },
|
|
) {
|
|
return { x: oo(t.x, i, o), y: oo(t.y, e, n) };
|
|
})(i.layoutBox, t))
|
|
: (this.constraints = !1),
|
|
(this.elastic = (function (t = 0.35) {
|
|
return (
|
|
!1 === t ? (t = 0) : !0 === t && (t = 0.35),
|
|
{ x: os(t, "left", "right"), y: os(t, "top", "bottom") }
|
|
);
|
|
})(e)),
|
|
n !== this.constraints &&
|
|
i &&
|
|
this.constraints &&
|
|
!this.hasMutatedConstraints &&
|
|
nX((t) => {
|
|
var e, n;
|
|
let o;
|
|
!1 !== this.constraints &&
|
|
this.getAxisMotionValue(t) &&
|
|
(this.constraints[t] =
|
|
((e = i.layoutBox[t]),
|
|
(n = this.constraints[t]),
|
|
(o = {}),
|
|
void 0 !== n.min && (o.min = n.min - e.min),
|
|
void 0 !== n.max && (o.max = n.max - e.min),
|
|
o));
|
|
});
|
|
}
|
|
resolveRefConstraints() {
|
|
var t;
|
|
let { dragConstraints: e, onMeasureDragConstraints: i } =
|
|
this.getProps();
|
|
if (!e || !ig(e)) return !1;
|
|
let n = e.current;
|
|
tw(
|
|
null !== n,
|
|
"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.",
|
|
"drag-constraints-ref",
|
|
);
|
|
let { projection: o } = this.visualElement;
|
|
if (!o || !o.layout) return !1;
|
|
let r = (function (t, e, i) {
|
|
let n = e1(t, i),
|
|
{ scroll: o } = e;
|
|
return o && (eQ(n.x, o.offset.x), eQ(n.y, o.offset.y)), n;
|
|
})(n, o.root, this.visualElement.getTransformPagePoint()),
|
|
s = ((t = o.layout.layoutBox), { x: or(t.x, r.x), y: or(t.y, r.y) });
|
|
if (i) {
|
|
let t = i(
|
|
(function ({ x: t, y: e }) {
|
|
return { top: e.min, right: t.max, bottom: e.max, left: t.min };
|
|
})(s),
|
|
);
|
|
(this.hasMutatedConstraints = !!t), t && (s = e$(t));
|
|
}
|
|
return s;
|
|
}
|
|
startAnimation(t) {
|
|
let {
|
|
drag: e,
|
|
dragMomentum: i,
|
|
dragElastic: n,
|
|
dragTransition: o,
|
|
dragSnapToOrigin: r,
|
|
onDragTransitionEnd: s,
|
|
} = this.getProps(),
|
|
a = this.constraints || {};
|
|
return Promise.all(
|
|
nX((s) => {
|
|
if (!ou(s, e, this.currentDirection)) return;
|
|
let l = (a && a[s]) || {};
|
|
r && (l = { min: 0, max: 0 });
|
|
let c = {
|
|
type: "inertia",
|
|
velocity: i ? t[s] : 0,
|
|
bounceStiffness: n ? 200 : 1e6,
|
|
bounceDamping: n ? 40 : 1e7,
|
|
timeConstant: 750,
|
|
restDelta: 1,
|
|
restSpeed: 10,
|
|
...o,
|
|
...l,
|
|
};
|
|
return this.startAxisValueAnimation(s, c);
|
|
}),
|
|
).then(s);
|
|
}
|
|
startAxisValueAnimation(t, e) {
|
|
let i = this.getAxisMotionValue(t);
|
|
return (
|
|
iw(this.visualElement, t),
|
|
i.start(nF(t, i, 0, e, this.visualElement, !1))
|
|
);
|
|
}
|
|
stopAnimation() {
|
|
nX((t) => this.getAxisMotionValue(t).stop());
|
|
}
|
|
pauseAnimation() {
|
|
nX((t) => this.getAxisMotionValue(t).animation?.pause());
|
|
}
|
|
getAnimationState(t) {
|
|
return this.getAxisMotionValue(t).animation?.state;
|
|
}
|
|
getAxisMotionValue(t) {
|
|
let e = `_drag${t.toUpperCase()}`,
|
|
i = this.visualElement.getProps();
|
|
return (
|
|
i[e] ||
|
|
this.visualElement.getValue(
|
|
t,
|
|
(i.initial ? i.initial[t] : void 0) || 0,
|
|
)
|
|
);
|
|
}
|
|
snapToCursor(t) {
|
|
nX((e) => {
|
|
let { drag: i } = this.getProps();
|
|
if (!ou(e, i, this.currentDirection)) return;
|
|
let { projection: n } = this.visualElement,
|
|
o = this.getAxisMotionValue(e);
|
|
if (n && n.layout) {
|
|
let { min: i, max: r } = n.layout.layoutBox[e],
|
|
s = o.get() || 0;
|
|
o.set(t[e] - eB(i, r, 0.5) + s);
|
|
}
|
|
});
|
|
}
|
|
scalePositionWithinConstraints() {
|
|
if (!this.visualElement.current) return;
|
|
let { drag: t, dragConstraints: e } = this.getProps(),
|
|
{ projection: i } = this.visualElement;
|
|
if (!ig(e) || !i || !this.constraints) return;
|
|
this.stopAnimation();
|
|
let n = { x: 0, y: 0 };
|
|
nX((t) => {
|
|
let e = this.getAxisMotionValue(t);
|
|
if (e && !1 !== this.constraints) {
|
|
var i, o;
|
|
let r,
|
|
s,
|
|
a,
|
|
l = e.get();
|
|
n[t] =
|
|
((i = { min: l, max: l }),
|
|
(o = this.constraints[t]),
|
|
(r = 0.5),
|
|
(s = nZ(i)),
|
|
(a = nZ(o)) > s
|
|
? (r = na(o.min, o.max - s, i.min))
|
|
: s > a && (r = na(i.min, i.max - a, o.min)),
|
|
C(0, 1, r));
|
|
}
|
|
});
|
|
let { transformTemplate: o } = this.visualElement.getProps();
|
|
(this.visualElement.current.style.transform = o ? o({}, "") : "none"),
|
|
i.root && i.root.updateScroll(),
|
|
i.updateLayout(),
|
|
this.resolveConstraints(),
|
|
nX((e) => {
|
|
if (!ou(e, t, null)) return;
|
|
let i = this.getAxisMotionValue(e),
|
|
{ min: o, max: r } = this.constraints[e];
|
|
i.set(eB(o, r, n[e]));
|
|
});
|
|
}
|
|
addListeners() {
|
|
if (!this.visualElement.current) return;
|
|
ol.set(this.visualElement, this);
|
|
let t = this.visualElement.current,
|
|
e = n9(t, "pointerdown", (e) => {
|
|
let { drag: i, dragListener: n = !0 } = this.getProps(),
|
|
o = e.target,
|
|
r = o !== t && (nq.has(o.tagName) || !0 === o.isContentEditable);
|
|
i && n && !r && this.start(e);
|
|
}),
|
|
i = () => {
|
|
let { dragConstraints: t } = this.getProps();
|
|
ig(t) &&
|
|
t.current &&
|
|
(this.constraints = this.resolveRefConstraints());
|
|
},
|
|
{ projection: n } = this.visualElement,
|
|
o = n.addEventListener("measure", i);
|
|
n && !n.layout && (n.root && n.root.updateScroll(), n.updateLayout()),
|
|
tq.read(i);
|
|
let r = nK(window, "resize", () =>
|
|
this.scalePositionWithinConstraints(),
|
|
),
|
|
s = n.addEventListener(
|
|
"didUpdate",
|
|
({ delta: t, hasLayoutChanged: e }) => {
|
|
this.isDragging &&
|
|
e &&
|
|
(nX((e) => {
|
|
let i = this.getAxisMotionValue(e);
|
|
i &&
|
|
((this.originPoint[e] += t[e].translate),
|
|
i.set(i.get() + t[e].translate));
|
|
}),
|
|
this.visualElement.render());
|
|
},
|
|
);
|
|
return () => {
|
|
r(), e(), o(), s && s();
|
|
};
|
|
}
|
|
getProps() {
|
|
let t = this.visualElement.getProps(),
|
|
{
|
|
drag: e = !1,
|
|
dragDirectionLock: i = !1,
|
|
dragPropagation: n = !1,
|
|
dragConstraints: o = !1,
|
|
dragElastic: r = 0.35,
|
|
dragMomentum: s = !0,
|
|
} = t;
|
|
return {
|
|
...t,
|
|
drag: e,
|
|
dragDirectionLock: i,
|
|
dragPropagation: n,
|
|
dragConstraints: o,
|
|
dragElastic: r,
|
|
dragMomentum: s,
|
|
};
|
|
}
|
|
}
|
|
function ou(t, e, i) {
|
|
return (!0 === e || e === t) && (null === i || i === t);
|
|
}
|
|
let oh = (t) => (e, i) => {
|
|
t && tq.update(() => t(e, i), !1, !0);
|
|
},
|
|
od = { hasAnimatedSinceResize: !0, hasEverUpdated: !1 };
|
|
var op = a;
|
|
let om = !1;
|
|
class of extends op.Component {
|
|
componentDidMount() {
|
|
let {
|
|
visualElement: t,
|
|
layoutGroup: e,
|
|
switchLayoutGroup: i,
|
|
layoutId: n,
|
|
} = this.props,
|
|
{ projection: o } = t;
|
|
o &&
|
|
(e.group && e.group.add(o),
|
|
i && i.register && n && i.register(o),
|
|
om && o.root.didUpdate(),
|
|
o.addEventListener("animationComplete", () => {
|
|
this.safeToRemove();
|
|
}),
|
|
o.setOptions({
|
|
...o.options,
|
|
layoutDependency: this.props.layoutDependency,
|
|
onExitComplete: () => this.safeToRemove(),
|
|
})),
|
|
(od.hasEverUpdated = !0);
|
|
}
|
|
getSnapshotBeforeUpdate(t) {
|
|
let {
|
|
layoutDependency: e,
|
|
visualElement: i,
|
|
drag: n,
|
|
isPresent: o,
|
|
} = this.props,
|
|
{ projection: r } = i;
|
|
return (
|
|
r &&
|
|
((r.isPresent = o),
|
|
t.layoutDependency !== e &&
|
|
r.setOptions({ ...r.options, layoutDependency: e }),
|
|
(om = !0),
|
|
n || t.layoutDependency !== e || void 0 === e || t.isPresent !== o
|
|
? r.willUpdate()
|
|
: this.safeToRemove(),
|
|
t.isPresent !== o &&
|
|
(o
|
|
? r.promote()
|
|
: r.relegate() ||
|
|
tq.postRender(() => {
|
|
let t = r.getStack();
|
|
(t && t.members.length) || this.safeToRemove();
|
|
}))),
|
|
null
|
|
);
|
|
}
|
|
componentDidUpdate() {
|
|
let { projection: t } = this.props.visualElement;
|
|
t &&
|
|
(t.root.didUpdate(),
|
|
ee.postRender(() => {
|
|
!t.currentAnimation && t.isLead() && this.safeToRemove();
|
|
}));
|
|
}
|
|
componentWillUnmount() {
|
|
let {
|
|
visualElement: t,
|
|
layoutGroup: e,
|
|
switchLayoutGroup: i,
|
|
} = this.props,
|
|
{ projection: n } = t;
|
|
(om = !0),
|
|
n &&
|
|
(n.scheduleCheckAfterUnmount(),
|
|
e && e.group && e.group.remove(n),
|
|
i && i.deregister && i.deregister(n));
|
|
}
|
|
safeToRemove() {
|
|
let { safeToRemove: t } = this.props;
|
|
t && t();
|
|
}
|
|
render() {
|
|
return null;
|
|
}
|
|
}
|
|
function og(t) {
|
|
let [e, i] = w(),
|
|
n = (0, op.useContext)(l);
|
|
return (0, s.jsx)(of, {
|
|
...t,
|
|
layoutGroup: n,
|
|
switchLayoutGroup: (0, op.useContext)(im),
|
|
isPresent: e,
|
|
safeToRemove: i,
|
|
});
|
|
}
|
|
function ov(t) {
|
|
return p(t) && "ownerSVGElement" in t;
|
|
}
|
|
let oy = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"],
|
|
ob = oy.length,
|
|
oI = (t) => ("string" == typeof t ? parseFloat(t) : t),
|
|
ox = (t) => "number" == typeof t || W.test(t);
|
|
function ow(t, e) {
|
|
return void 0 !== t[e] ? t[e] : t.borderRadius;
|
|
}
|
|
let oS = oP(0, 0.5, ni),
|
|
oT = oP(0.5, 0.95, t$);
|
|
function oP(t, e, i) {
|
|
return (n) => (n < t ? 0 : n > e ? 1 : i(na(t, e, n)));
|
|
}
|
|
function ok(t, e) {
|
|
(t.min = e.min), (t.max = e.max);
|
|
}
|
|
function oA(t, e) {
|
|
ok(t.x, e.x), ok(t.y, e.y);
|
|
}
|
|
function oC(t, e) {
|
|
(t.translate = e.translate),
|
|
(t.scale = e.scale),
|
|
(t.originPoint = e.originPoint),
|
|
(t.origin = e.origin);
|
|
}
|
|
function oE(t, e, i, n, o) {
|
|
return (
|
|
(t -= e),
|
|
(t = n + (1 / i) * (t - n)),
|
|
void 0 !== o && (t = n + (1 / o) * (t - n)),
|
|
t
|
|
);
|
|
}
|
|
function oL(t, e, [i, n, o], r, s) {
|
|
!(function (t, e = 0, i = 1, n = 0.5, o, r = t, s = t) {
|
|
if (
|
|
(z.test(e) &&
|
|
((e = parseFloat(e)), (e = eB(s.min, s.max, e / 100) - s.min)),
|
|
"number" != typeof e)
|
|
)
|
|
return;
|
|
let a = eB(r.min, r.max, n);
|
|
t === r && (a -= e),
|
|
(t.min = oE(t.min, e, i, a, o)),
|
|
(t.max = oE(t.max, e, i, a, o));
|
|
})(t, e[i], e[n], e[o], e.scale, r, s);
|
|
}
|
|
let oM = ["x", "scaleX", "originX"],
|
|
oR = ["y", "scaleY", "originY"];
|
|
function oD(t, e, i, n) {
|
|
oL(t.x, e, oM, i ? i.x : void 0, n ? n.x : void 0),
|
|
oL(t.y, e, oR, i ? i.y : void 0, n ? n.y : void 0);
|
|
}
|
|
function oV(t) {
|
|
return 0 === t.translate && 1 === t.scale;
|
|
}
|
|
function oF(t) {
|
|
return oV(t.x) && oV(t.y);
|
|
}
|
|
function oj(t, e) {
|
|
return t.min === e.min && t.max === e.max;
|
|
}
|
|
function oN(t, e) {
|
|
return (
|
|
Math.round(t.min) === Math.round(e.min) &&
|
|
Math.round(t.max) === Math.round(e.max)
|
|
);
|
|
}
|
|
function oB(t, e) {
|
|
return oN(t.x, e.x) && oN(t.y, e.y);
|
|
}
|
|
function oO(t) {
|
|
return nZ(t.x) / nZ(t.y);
|
|
}
|
|
function oU(t, e) {
|
|
return (
|
|
t.translate === e.translate &&
|
|
t.scale === e.scale &&
|
|
t.originPoint === e.originPoint
|
|
);
|
|
}
|
|
class oH {
|
|
constructor() {
|
|
this.members = [];
|
|
}
|
|
add(t) {
|
|
t7(this.members, t), t.scheduleRender();
|
|
}
|
|
remove(t) {
|
|
if (
|
|
(t8(this.members, t),
|
|
t === this.prevLead && (this.prevLead = void 0),
|
|
t === this.lead)
|
|
) {
|
|
let t = this.members[this.members.length - 1];
|
|
t && this.promote(t);
|
|
}
|
|
}
|
|
relegate(t) {
|
|
let e,
|
|
i = this.members.findIndex((e) => t === e);
|
|
if (0 === i) return !1;
|
|
for (let t = i; t >= 0; t--) {
|
|
let i = this.members[t];
|
|
if (!1 !== i.isPresent) {
|
|
e = i;
|
|
break;
|
|
}
|
|
}
|
|
return !!e && (this.promote(e), !0);
|
|
}
|
|
promote(t, e) {
|
|
let i = this.lead;
|
|
if (t !== i && ((this.prevLead = i), (this.lead = t), t.show(), i)) {
|
|
i.instance && i.scheduleRender(), t.scheduleRender();
|
|
let n = i.options.layoutDependency,
|
|
o = t.options.layoutDependency;
|
|
(void 0 === n || void 0 === o || n !== o) &&
|
|
((t.resumeFrom = i),
|
|
e && (t.resumeFrom.preserveOpacity = !0),
|
|
i.snapshot &&
|
|
((t.snapshot = i.snapshot),
|
|
(t.snapshot.latestValues = i.animationValues || i.latestValues)),
|
|
t.root && t.root.isUpdating && (t.isLayoutDirty = !0));
|
|
let { crossfade: r } = t.options;
|
|
!1 === r && i.hide();
|
|
}
|
|
}
|
|
exitAnimationComplete() {
|
|
this.members.forEach((t) => {
|
|
let { options: e, resumingFrom: i } = t;
|
|
e.onExitComplete && e.onExitComplete(),
|
|
i && i.options.onExitComplete && i.options.onExitComplete();
|
|
});
|
|
}
|
|
scheduleRender() {
|
|
this.members.forEach((t) => {
|
|
t.instance && t.scheduleRender(!1);
|
|
});
|
|
}
|
|
removeLeadSnapshot() {
|
|
this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
|
|
}
|
|
}
|
|
let oz = (t, e) => t.depth - e.depth;
|
|
class oW {
|
|
constructor() {
|
|
(this.children = []), (this.isDirty = !1);
|
|
}
|
|
add(t) {
|
|
t7(this.children, t), (this.isDirty = !0);
|
|
}
|
|
remove(t) {
|
|
t8(this.children, t), (this.isDirty = !0);
|
|
}
|
|
forEach(t) {
|
|
this.isDirty && this.children.sort(oz),
|
|
(this.isDirty = !1),
|
|
this.children.forEach(t);
|
|
}
|
|
}
|
|
let o$ = ["", "X", "Y", "Z"],
|
|
oG = 0;
|
|
function oX(t, e, i, n) {
|
|
let { latestValues: o } = e;
|
|
o[t] && ((i[t] = o[t]), e.setStaticValue(t, 0), n && (n[t] = 0));
|
|
}
|
|
function oY({
|
|
attachResizeListener: t,
|
|
defaultParent: e,
|
|
measureScroll: i,
|
|
checkIsScrollRoot: n,
|
|
resetTransform: o,
|
|
}) {
|
|
return class {
|
|
constructor(t = {}, i = e?.()) {
|
|
(this.id = oG++),
|
|
(this.animationId = 0),
|
|
(this.animationCommitId = 0),
|
|
(this.children = 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 = { x: 1, y: 1 }),
|
|
(this.eventHandlers = new Map()),
|
|
(this.hasTreeAnimated = !1),
|
|
(this.layoutVersion = 0),
|
|
(this.updateScheduled = !1),
|
|
(this.scheduleUpdate = () => this.update()),
|
|
(this.projectionUpdateScheduled = !1),
|
|
(this.checkUpdateFailed = () => {
|
|
this.isUpdating &&
|
|
((this.isUpdating = !1), this.clearAllSnapshots());
|
|
}),
|
|
(this.updateProjection = () => {
|
|
(this.projectionUpdateScheduled = !1),
|
|
this.nodes.forEach(o_),
|
|
this.nodes.forEach(o5),
|
|
this.nodes.forEach(o3),
|
|
this.nodes.forEach(oZ);
|
|
}),
|
|
(this.resolvedRelativeTargetAt = 0),
|
|
(this.linkedParentVersion = 0),
|
|
(this.hasProjected = !1),
|
|
(this.isVisible = !0),
|
|
(this.animationProgress = 0),
|
|
(this.sharedNodes = new Map()),
|
|
(this.latestValues = t),
|
|
(this.root = i ? i.root || i : this),
|
|
(this.path = i ? [...i.path, i] : []),
|
|
(this.parent = i),
|
|
(this.depth = i ? i.depth + 1 : 0);
|
|
for (let t = 0; t < this.path.length; t++)
|
|
this.path[t].shouldResetTransform = !0;
|
|
this.root === this && (this.nodes = new oW());
|
|
}
|
|
addEventListener(t, e) {
|
|
return (
|
|
this.eventHandlers.has(t) || this.eventHandlers.set(t, new et()),
|
|
this.eventHandlers.get(t).add(e)
|
|
);
|
|
}
|
|
notifyListeners(t, ...e) {
|
|
let i = this.eventHandlers.get(t);
|
|
i && i.notify(...e);
|
|
}
|
|
hasListeners(t) {
|
|
return this.eventHandlers.has(t);
|
|
}
|
|
mount(e) {
|
|
if (this.instance) return;
|
|
(this.isSVG = ov(e) && !(ov(e) && "svg" === e.tagName)),
|
|
(this.instance = e);
|
|
let { layoutId: i, layout: n, visualElement: o } = this.options;
|
|
if (
|
|
(o && !o.current && o.mount(e),
|
|
this.root.nodes.add(this),
|
|
this.parent && this.parent.children.add(this),
|
|
this.root.hasTreeAnimated && (n || i) && (this.isLayoutDirty = !0),
|
|
t)
|
|
) {
|
|
let i,
|
|
n = 0,
|
|
o = () => (this.root.updateBlockedByResize = !1);
|
|
tq.read(() => {
|
|
n = window.innerWidth;
|
|
}),
|
|
t(e, () => {
|
|
let t = window.innerWidth;
|
|
if (t !== n) {
|
|
let e, r;
|
|
(n = t),
|
|
(this.root.updateBlockedByResize = !0),
|
|
i && i(),
|
|
(e = en.now()),
|
|
(r = ({ timestamp: t }) => {
|
|
let i = t - e;
|
|
i >= 250 && (tK(r), o(i - 250));
|
|
}),
|
|
tq.setup(r, !0),
|
|
(i = () => tK(r)),
|
|
od.hasAnimatedSinceResize &&
|
|
((od.hasAnimatedSinceResize = !1),
|
|
this.nodes.forEach(o2));
|
|
}
|
|
});
|
|
}
|
|
i && this.root.registerSharedNode(i, this),
|
|
!1 !== this.options.animate &&
|
|
o &&
|
|
(i || n) &&
|
|
this.addEventListener(
|
|
"didUpdate",
|
|
({
|
|
delta: t,
|
|
hasLayoutChanged: e,
|
|
hasRelativeLayoutChanged: i,
|
|
layout: n,
|
|
}) => {
|
|
if (this.isTreeAnimationBlocked()) {
|
|
(this.target = void 0), (this.relativeTarget = void 0);
|
|
return;
|
|
}
|
|
let r =
|
|
this.options.transition || o.getDefaultTransition() || rt,
|
|
{
|
|
onLayoutAnimationStart: s,
|
|
onLayoutAnimationComplete: a,
|
|
} = o.getProps(),
|
|
l = !this.targetLayout || !oB(this.targetLayout, n),
|
|
c = !e && i;
|
|
if (
|
|
this.options.layoutRoot ||
|
|
this.resumeFrom ||
|
|
c ||
|
|
(e && (l || !this.currentAnimation))
|
|
) {
|
|
this.resumeFrom &&
|
|
((this.resumingFrom = this.resumeFrom),
|
|
(this.resumingFrom.resumingFrom = void 0));
|
|
let e = { ...iI(r, "layout"), onPlay: s, onComplete: a };
|
|
(o.shouldReduceMotion || this.options.layoutRoot) &&
|
|
((e.delay = 0), (e.type = !1)),
|
|
this.startAnimation(e),
|
|
this.setAnimationOrigin(t, c);
|
|
} else
|
|
e || o2(this),
|
|
this.isLead() &&
|
|
this.options.onExitComplete &&
|
|
this.options.onExitComplete();
|
|
this.targetLayout = n;
|
|
},
|
|
);
|
|
}
|
|
unmount() {
|
|
this.options.layoutId && this.willUpdate(),
|
|
this.root.nodes.remove(this);
|
|
let t = this.getStack();
|
|
t && t.remove(this),
|
|
this.parent && this.parent.children.delete(this),
|
|
(this.instance = void 0),
|
|
this.eventHandlers.clear(),
|
|
tK(this.updateProjection);
|
|
}
|
|
blockUpdate() {
|
|
this.updateManuallyBlocked = !0;
|
|
}
|
|
unblockUpdate() {
|
|
this.updateManuallyBlocked = !1;
|
|
}
|
|
isUpdateBlocked() {
|
|
return this.updateManuallyBlocked || this.updateBlockedByResize;
|
|
}
|
|
isTreeAnimationBlocked() {
|
|
return (
|
|
this.isAnimationBlocked ||
|
|
(this.parent && this.parent.isTreeAnimationBlocked()) ||
|
|
!1
|
|
);
|
|
}
|
|
startUpdate() {
|
|
!this.isUpdateBlocked() &&
|
|
((this.isUpdating = !0),
|
|
this.nodes && this.nodes.forEach(o9),
|
|
this.animationId++);
|
|
}
|
|
getTransformTemplate() {
|
|
let { visualElement: t } = this.options;
|
|
return t && t.getProps().transformTemplate;
|
|
}
|
|
willUpdate(t = !0) {
|
|
if (((this.root.hasTreeAnimated = !0), this.root.isUpdateBlocked())) {
|
|
this.options.onExitComplete && this.options.onExitComplete();
|
|
return;
|
|
}
|
|
if (
|
|
(window.MotionCancelOptimisedAnimation &&
|
|
!this.hasCheckedOptimisedAppear &&
|
|
(function t(e) {
|
|
if (((e.hasCheckedOptimisedAppear = !0), e.root === e)) return;
|
|
let { visualElement: i } = e.options;
|
|
if (!i) return;
|
|
let n = i.props[ip];
|
|
if (window.MotionHasOptimisedAnimation(n, "transform")) {
|
|
let { layout: t, layoutId: i } = e.options;
|
|
window.MotionCancelOptimisedAnimation(
|
|
n,
|
|
"transform",
|
|
tq,
|
|
!(t || i),
|
|
);
|
|
}
|
|
let { parent: o } = e;
|
|
o && !o.hasCheckedOptimisedAppear && t(o);
|
|
})(this),
|
|
this.root.isUpdating || this.root.startUpdate(),
|
|
this.isLayoutDirty)
|
|
)
|
|
return;
|
|
this.isLayoutDirty = !0;
|
|
for (let t = 0; t < this.path.length; t++) {
|
|
let e = this.path[t];
|
|
(e.shouldResetTransform = !0),
|
|
e.updateScroll("snapshot"),
|
|
e.options.layoutRoot && e.willUpdate(!1);
|
|
}
|
|
let { layoutId: e, layout: i } = this.options;
|
|
if (void 0 === e && !i) return;
|
|
let n = this.getTransformTemplate();
|
|
(this.prevTransformTemplateValue = n
|
|
? n(this.latestValues, "")
|
|
: void 0),
|
|
this.updateSnapshot(),
|
|
t && this.notifyListeners("willUpdate");
|
|
}
|
|
update() {
|
|
if (((this.updateScheduled = !1), this.isUpdateBlocked())) {
|
|
this.unblockUpdate(),
|
|
this.clearAllSnapshots(),
|
|
this.nodes.forEach(oJ);
|
|
return;
|
|
}
|
|
if (this.animationId <= this.animationCommitId)
|
|
return void this.nodes.forEach(o0);
|
|
(this.animationCommitId = this.animationId),
|
|
this.isUpdating
|
|
? ((this.isUpdating = !1),
|
|
this.nodes.forEach(o1),
|
|
this.nodes.forEach(oq),
|
|
this.nodes.forEach(oK))
|
|
: this.nodes.forEach(o0),
|
|
this.clearAllSnapshots();
|
|
let t = en.now();
|
|
(t_.delta = C(0, 1e3 / 60, t - t_.timestamp)),
|
|
(t_.timestamp = t),
|
|
(t_.isProcessing = !0),
|
|
tZ.update.process(t_),
|
|
tZ.preRender.process(t_),
|
|
tZ.render.process(t_),
|
|
(t_.isProcessing = !1);
|
|
}
|
|
didUpdate() {
|
|
this.updateScheduled ||
|
|
((this.updateScheduled = !0), ee.read(this.scheduleUpdate));
|
|
}
|
|
clearAllSnapshots() {
|
|
this.nodes.forEach(oQ), this.sharedNodes.forEach(o4);
|
|
}
|
|
scheduleUpdateProjection() {
|
|
this.projectionUpdateScheduled ||
|
|
((this.projectionUpdateScheduled = !0),
|
|
tq.preRender(this.updateProjection, !1, !0));
|
|
}
|
|
scheduleCheckAfterUnmount() {
|
|
tq.postRender(() => {
|
|
this.isLayoutDirty
|
|
? this.root.didUpdate()
|
|
: this.root.checkUpdateFailed();
|
|
});
|
|
}
|
|
updateSnapshot() {
|
|
!this.snapshot &&
|
|
this.instance &&
|
|
((this.snapshot = this.measure()),
|
|
!this.snapshot ||
|
|
nZ(this.snapshot.measuredBox.x) ||
|
|
nZ(this.snapshot.measuredBox.y) ||
|
|
(this.snapshot = void 0));
|
|
}
|
|
updateLayout() {
|
|
if (
|
|
!this.instance ||
|
|
(this.updateScroll(),
|
|
!(this.options.alwaysMeasureLayout && this.isLead()) &&
|
|
!this.isLayoutDirty)
|
|
)
|
|
return;
|
|
if (this.resumeFrom && !this.resumeFrom.instance)
|
|
for (let t = 0; t < this.path.length; t++)
|
|
this.path[t].updateScroll();
|
|
let t = this.layout;
|
|
(this.layout = this.measure(!1)),
|
|
this.layoutVersion++,
|
|
(this.layoutCorrected = tf()),
|
|
(this.isLayoutDirty = !1),
|
|
(this.projectionDelta = void 0),
|
|
this.notifyListeners("measure", this.layout.layoutBox);
|
|
let { visualElement: e } = this.options;
|
|
e &&
|
|
e.notify(
|
|
"LayoutMeasure",
|
|
this.layout.layoutBox,
|
|
t ? t.layoutBox : void 0,
|
|
);
|
|
}
|
|
updateScroll(t = "measure") {
|
|
let e = !!(this.options.layoutScroll && this.instance);
|
|
if (
|
|
(this.scroll &&
|
|
this.scroll.animationId === this.root.animationId &&
|
|
this.scroll.phase === t &&
|
|
(e = !1),
|
|
e && this.instance)
|
|
) {
|
|
let e = n(this.instance);
|
|
this.scroll = {
|
|
animationId: this.root.animationId,
|
|
phase: t,
|
|
isRoot: e,
|
|
offset: i(this.instance),
|
|
wasRoot: this.scroll ? this.scroll.isRoot : e,
|
|
};
|
|
}
|
|
}
|
|
resetTransform() {
|
|
if (!o) return;
|
|
let t =
|
|
this.isLayoutDirty ||
|
|
this.shouldResetTransform ||
|
|
this.options.alwaysMeasureLayout,
|
|
e = this.projectionDelta && !oF(this.projectionDelta),
|
|
i = this.getTransformTemplate(),
|
|
n = i ? i(this.latestValues, "") : void 0,
|
|
r = n !== this.prevTransformTemplateValue;
|
|
t &&
|
|
this.instance &&
|
|
(e || eY(this.latestValues) || r) &&
|
|
(o(this.instance, n),
|
|
(this.shouldResetTransform = !1),
|
|
this.scheduleRender());
|
|
}
|
|
measure(t = !0) {
|
|
var e;
|
|
let i = this.measurePageBox(),
|
|
n = this.removeElementScroll(i);
|
|
return (
|
|
t && (n = this.removeTransform(n)),
|
|
rn((e = n).x),
|
|
rn(e.y),
|
|
{
|
|
animationId: this.root.animationId,
|
|
measuredBox: i,
|
|
layoutBox: n,
|
|
latestValues: {},
|
|
source: this.id,
|
|
}
|
|
);
|
|
}
|
|
measurePageBox() {
|
|
let { visualElement: t } = this.options;
|
|
if (!t) return tf();
|
|
let e = t.measureViewportBox();
|
|
if (!(this.scroll?.wasRoot || this.path.some(rr))) {
|
|
let { scroll: t } = this.root;
|
|
t && (eQ(e.x, t.offset.x), eQ(e.y, t.offset.y));
|
|
}
|
|
return e;
|
|
}
|
|
removeElementScroll(t) {
|
|
let e = tf();
|
|
if ((oA(e, t), this.scroll?.wasRoot)) return e;
|
|
for (let i = 0; i < this.path.length; i++) {
|
|
let n = this.path[i],
|
|
{ scroll: o, options: r } = n;
|
|
n !== this.root &&
|
|
o &&
|
|
r.layoutScroll &&
|
|
(o.wasRoot && oA(e, t), eQ(e.x, o.offset.x), eQ(e.y, o.offset.y));
|
|
}
|
|
return e;
|
|
}
|
|
applyTransform(t, e = !1) {
|
|
let i = tf();
|
|
oA(i, t);
|
|
for (let t = 0; t < this.path.length; t++) {
|
|
let n = this.path[t];
|
|
!e &&
|
|
n.options.layoutScroll &&
|
|
n.scroll &&
|
|
n !== n.root &&
|
|
e0(i, { x: -n.scroll.offset.x, y: -n.scroll.offset.y }),
|
|
eY(n.latestValues) && e0(i, n.latestValues);
|
|
}
|
|
return eY(this.latestValues) && e0(i, this.latestValues), i;
|
|
}
|
|
removeTransform(t) {
|
|
let e = tf();
|
|
oA(e, t);
|
|
for (let t = 0; t < this.path.length; t++) {
|
|
let i = this.path[t];
|
|
if (!i.instance || !eY(i.latestValues)) continue;
|
|
eX(i.latestValues) && i.updateSnapshot();
|
|
let n = tf();
|
|
oA(n, i.measurePageBox()),
|
|
oD(
|
|
e,
|
|
i.latestValues,
|
|
i.snapshot ? i.snapshot.layoutBox : void 0,
|
|
n,
|
|
);
|
|
}
|
|
return eY(this.latestValues) && oD(e, this.latestValues), e;
|
|
}
|
|
setTargetDelta(t) {
|
|
(this.targetDelta = t),
|
|
this.root.scheduleUpdateProjection(),
|
|
(this.isProjectionDirty = !0);
|
|
}
|
|
setOptions(t) {
|
|
this.options = {
|
|
...this.options,
|
|
...t,
|
|
crossfade: void 0 === t.crossfade || t.crossfade,
|
|
};
|
|
}
|
|
clearMeasurements() {
|
|
(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);
|
|
}
|
|
forceRelativeParentToResolveTarget() {
|
|
this.relativeParent &&
|
|
this.relativeParent.resolvedRelativeTargetAt !== t_.timestamp &&
|
|
this.relativeParent.resolveTargetDelta(!0);
|
|
}
|
|
resolveTargetDelta(t = !1) {
|
|
let e = this.getLead();
|
|
this.isProjectionDirty ||
|
|
(this.isProjectionDirty = e.isProjectionDirty),
|
|
this.isTransformDirty ||
|
|
(this.isTransformDirty = e.isTransformDirty),
|
|
this.isSharedProjectionDirty ||
|
|
(this.isSharedProjectionDirty = e.isSharedProjectionDirty);
|
|
let i = !!this.resumingFrom || this !== e;
|
|
if (
|
|
!(
|
|
t ||
|
|
(i && this.isSharedProjectionDirty) ||
|
|
this.isProjectionDirty ||
|
|
this.parent?.isProjectionDirty ||
|
|
this.attemptToResolveRelativeTarget ||
|
|
this.root.updateBlockedByResize
|
|
)
|
|
)
|
|
return;
|
|
let { layout: n, layoutId: o } = this.options;
|
|
if (!this.layout || !(n || o)) return;
|
|
this.resolvedRelativeTargetAt = t_.timestamp;
|
|
let r = this.getClosestProjectingParent();
|
|
if (
|
|
(r &&
|
|
this.linkedParentVersion !== r.layoutVersion &&
|
|
!r.options.layoutRoot &&
|
|
this.removeRelativeTarget(),
|
|
this.targetDelta ||
|
|
this.relativeTarget ||
|
|
(r && r.layout
|
|
? this.createRelativeTarget(
|
|
r,
|
|
this.layout.layoutBox,
|
|
r.layout.layoutBox,
|
|
)
|
|
: this.removeRelativeTarget()),
|
|
this.relativeTarget || this.targetDelta)
|
|
) {
|
|
if (
|
|
(this.target ||
|
|
((this.target = tf()), (this.targetWithTransforms = tf())),
|
|
this.relativeTarget &&
|
|
this.relativeTargetOrigin &&
|
|
this.relativeParent &&
|
|
this.relativeParent.target)
|
|
) {
|
|
var s, a, l;
|
|
this.forceRelativeParentToResolveTarget(),
|
|
(s = this.target),
|
|
(a = this.relativeTarget),
|
|
(l = this.relativeParent.target),
|
|
n0(s.x, a.x, l.x),
|
|
n0(s.y, a.y, l.y);
|
|
} else
|
|
this.targetDelta
|
|
? (this.resumingFrom
|
|
? (this.target = this.applyTransform(this.layout.layoutBox))
|
|
: oA(this.target, this.layout.layoutBox),
|
|
eZ(this.target, this.targetDelta))
|
|
: oA(this.target, this.layout.layoutBox);
|
|
this.attemptToResolveRelativeTarget &&
|
|
((this.attemptToResolveRelativeTarget = !1),
|
|
r &&
|
|
!!r.resumingFrom == !!this.resumingFrom &&
|
|
!r.options.layoutScroll &&
|
|
r.target &&
|
|
1 !== this.animationProgress
|
|
? this.createRelativeTarget(r, this.target, r.target)
|
|
: (this.relativeParent = this.relativeTarget = void 0));
|
|
}
|
|
}
|
|
getClosestProjectingParent() {
|
|
if (
|
|
!(
|
|
!this.parent ||
|
|
eX(this.parent.latestValues) ||
|
|
eq(this.parent.latestValues)
|
|
)
|
|
)
|
|
if (this.parent.isProjecting()) return this.parent;
|
|
else return this.parent.getClosestProjectingParent();
|
|
}
|
|
isProjecting() {
|
|
return !!(
|
|
(this.relativeTarget ||
|
|
this.targetDelta ||
|
|
this.options.layoutRoot) &&
|
|
this.layout
|
|
);
|
|
}
|
|
createRelativeTarget(t, e, i) {
|
|
(this.relativeParent = t),
|
|
(this.linkedParentVersion = t.layoutVersion),
|
|
this.forceRelativeParentToResolveTarget(),
|
|
(this.relativeTarget = tf()),
|
|
(this.relativeTargetOrigin = tf()),
|
|
n2(this.relativeTargetOrigin, e, i),
|
|
oA(this.relativeTarget, this.relativeTargetOrigin);
|
|
}
|
|
removeRelativeTarget() {
|
|
this.relativeParent = this.relativeTarget = void 0;
|
|
}
|
|
calcProjection() {
|
|
let t = this.getLead(),
|
|
e = !!this.resumingFrom || this !== t,
|
|
i = !0;
|
|
if (
|
|
((this.isProjectionDirty || this.parent?.isProjectionDirty) &&
|
|
(i = !1),
|
|
e &&
|
|
(this.isSharedProjectionDirty || this.isTransformDirty) &&
|
|
(i = !1),
|
|
this.resolvedRelativeTargetAt === t_.timestamp && (i = !1),
|
|
i)
|
|
)
|
|
return;
|
|
let { layout: n, layoutId: o } = this.options;
|
|
if (
|
|
((this.isTreeAnimating = !!(
|
|
(this.parent && this.parent.isTreeAnimating) ||
|
|
this.currentAnimation ||
|
|
this.pendingAnimation
|
|
)),
|
|
this.isTreeAnimating ||
|
|
(this.targetDelta = this.relativeTarget = void 0),
|
|
!this.layout || !(n || o))
|
|
)
|
|
return;
|
|
oA(this.layoutCorrected, this.layout.layoutBox);
|
|
let r = this.treeScale.x,
|
|
s = this.treeScale.y;
|
|
!(function (t, e, i, n = !1) {
|
|
let o,
|
|
r,
|
|
s = i.length;
|
|
if (s) {
|
|
e.x = e.y = 1;
|
|
for (let a = 0; a < s; a++) {
|
|
r = (o = i[a]).projectionDelta;
|
|
let { visualElement: s } = o.options;
|
|
(!s ||
|
|
!s.props.style ||
|
|
"contents" !== s.props.style.display) &&
|
|
(n &&
|
|
o.options.layoutScroll &&
|
|
o.scroll &&
|
|
o !== o.root &&
|
|
e0(t, { x: -o.scroll.offset.x, y: -o.scroll.offset.y }),
|
|
r && ((e.x *= r.x.scale), (e.y *= r.y.scale), eZ(t, r)),
|
|
n && eY(o.latestValues) && e0(t, o.latestValues));
|
|
}
|
|
e.x < 1.0000000000001 && e.x > 0.999999999999 && (e.x = 1),
|
|
e.y < 1.0000000000001 && e.y > 0.999999999999 && (e.y = 1);
|
|
}
|
|
})(this.layoutCorrected, this.treeScale, this.path, e),
|
|
t.layout &&
|
|
!t.target &&
|
|
(1 !== this.treeScale.x || 1 !== this.treeScale.y) &&
|
|
((t.target = t.layout.layoutBox),
|
|
(t.targetWithTransforms = tf()));
|
|
let { target: a } = t;
|
|
if (!a) {
|
|
this.prevProjectionDelta &&
|
|
(this.createProjectionDeltas(), this.scheduleRender());
|
|
return;
|
|
}
|
|
this.projectionDelta && this.prevProjectionDelta
|
|
? (oC(this.prevProjectionDelta.x, this.projectionDelta.x),
|
|
oC(this.prevProjectionDelta.y, this.projectionDelta.y))
|
|
: this.createProjectionDeltas(),
|
|
nJ(
|
|
this.projectionDelta,
|
|
this.layoutCorrected,
|
|
a,
|
|
this.latestValues,
|
|
),
|
|
(this.treeScale.x === r &&
|
|
this.treeScale.y === s &&
|
|
oU(this.projectionDelta.x, this.prevProjectionDelta.x) &&
|
|
oU(this.projectionDelta.y, this.prevProjectionDelta.y)) ||
|
|
((this.hasProjected = !0),
|
|
this.scheduleRender(),
|
|
this.notifyListeners("projectionUpdate", a));
|
|
}
|
|
hide() {
|
|
this.isVisible = !1;
|
|
}
|
|
show() {
|
|
this.isVisible = !0;
|
|
}
|
|
scheduleRender(t = !0) {
|
|
if ((this.options.visualElement?.scheduleRender(), t)) {
|
|
let t = this.getStack();
|
|
t && t.scheduleRender();
|
|
}
|
|
this.resumingFrom &&
|
|
!this.resumingFrom.instance &&
|
|
(this.resumingFrom = void 0);
|
|
}
|
|
createProjectionDeltas() {
|
|
(this.prevProjectionDelta = tp()),
|
|
(this.projectionDelta = tp()),
|
|
(this.projectionDeltaWithTransform = tp());
|
|
}
|
|
setAnimationOrigin(t, e = !1) {
|
|
let i,
|
|
n = this.snapshot,
|
|
o = n ? n.latestValues : {},
|
|
r = { ...this.latestValues },
|
|
s = tp();
|
|
(this.relativeParent && this.relativeParent.options.layoutRoot) ||
|
|
(this.relativeTarget = this.relativeTargetOrigin = void 0),
|
|
(this.attemptToResolveRelativeTarget = !e);
|
|
let a = tf(),
|
|
l =
|
|
(n ? n.source : void 0) !==
|
|
(this.layout ? this.layout.source : void 0),
|
|
c = this.getStack(),
|
|
u = !c || c.members.length <= 1,
|
|
h = !!(
|
|
l &&
|
|
!u &&
|
|
!0 === this.options.crossfade &&
|
|
!this.path.some(o8)
|
|
);
|
|
(this.animationProgress = 0),
|
|
(this.mixTargetDelta = (e) => {
|
|
let n = e / 1e3;
|
|
if (
|
|
(o6(s.x, t.x, n),
|
|
o6(s.y, t.y, n),
|
|
this.setTargetDelta(s),
|
|
this.relativeTarget &&
|
|
this.relativeTargetOrigin &&
|
|
this.layout &&
|
|
this.relativeParent &&
|
|
this.relativeParent.layout)
|
|
) {
|
|
var c, d, p, m, f, g;
|
|
n2(
|
|
a,
|
|
this.layout.layoutBox,
|
|
this.relativeParent.layout.layoutBox,
|
|
),
|
|
(p = this.relativeTarget),
|
|
(m = this.relativeTargetOrigin),
|
|
(f = a),
|
|
(g = n),
|
|
o7(p.x, m.x, f.x, g),
|
|
o7(p.y, m.y, f.y, g),
|
|
i &&
|
|
((c = this.relativeTarget),
|
|
(d = i),
|
|
oj(c.x, d.x) && oj(c.y, d.y)) &&
|
|
(this.isProjectionDirty = !1),
|
|
i || (i = tf()),
|
|
oA(i, this.relativeTarget);
|
|
}
|
|
l &&
|
|
((this.animationValues = r),
|
|
(function (t, e, i, n, o, r) {
|
|
o
|
|
? ((t.opacity = eB(0, i.opacity ?? 1, oS(n))),
|
|
(t.opacityExit = eB(e.opacity ?? 1, 0, oT(n))))
|
|
: r && (t.opacity = eB(e.opacity ?? 1, i.opacity ?? 1, n));
|
|
for (let o = 0; o < ob; o++) {
|
|
let r = `border${oy[o]}Radius`,
|
|
s = ow(e, r),
|
|
a = ow(i, r);
|
|
(void 0 !== s || void 0 !== a) &&
|
|
(s || (s = 0),
|
|
a || (a = 0),
|
|
0 === s || 0 === a || ox(s) === ox(a)
|
|
? ((t[r] = Math.max(eB(oI(s), oI(a), n), 0)),
|
|
(z.test(a) || z.test(s)) && (t[r] += "%"))
|
|
: (t[r] = a));
|
|
}
|
|
(e.rotate || i.rotate) &&
|
|
(t.rotate = eB(e.rotate || 0, i.rotate || 0, n));
|
|
})(r, o, this.latestValues, n, h, u)),
|
|
this.root.scheduleUpdateProjection(),
|
|
this.scheduleRender(),
|
|
(this.animationProgress = n);
|
|
}),
|
|
this.mixTargetDelta(1e3 * !!this.options.layoutRoot);
|
|
}
|
|
startAnimation(t) {
|
|
this.notifyListeners("animationStart"),
|
|
this.currentAnimation?.stop(),
|
|
this.resumingFrom?.currentAnimation?.stop(),
|
|
this.pendingAnimation &&
|
|
(tK(this.pendingAnimation), (this.pendingAnimation = void 0)),
|
|
(this.pendingAnimation = tq.update(() => {
|
|
var e, i, n;
|
|
let o;
|
|
(od.hasAnimatedSinceResize = !0),
|
|
ik.layout++,
|
|
this.motionValue || (this.motionValue = er(0)),
|
|
(this.currentAnimation =
|
|
((e = this.motionValue),
|
|
(i = [0, 1e3]),
|
|
(n = {
|
|
...t,
|
|
velocity: 0,
|
|
isSync: !0,
|
|
onUpdate: (e) => {
|
|
this.mixTargetDelta(e), t.onUpdate && t.onUpdate(e);
|
|
},
|
|
onStop: () => {
|
|
ik.layout--;
|
|
},
|
|
onComplete: () => {
|
|
ik.layout--,
|
|
t.onComplete && t.onComplete(),
|
|
this.completeAnimation();
|
|
},
|
|
}),
|
|
(o = tg(e) ? e : er(e)).start(nF("", o, i, n)),
|
|
o.animation)),
|
|
this.resumingFrom &&
|
|
(this.resumingFrom.currentAnimation = this.currentAnimation),
|
|
(this.pendingAnimation = void 0);
|
|
}));
|
|
}
|
|
completeAnimation() {
|
|
this.resumingFrom &&
|
|
((this.resumingFrom.currentAnimation = void 0),
|
|
(this.resumingFrom.preserveOpacity = void 0));
|
|
let t = this.getStack();
|
|
t && t.exitAnimationComplete(),
|
|
(this.resumingFrom =
|
|
this.currentAnimation =
|
|
this.animationValues =
|
|
void 0),
|
|
this.notifyListeners("animationComplete");
|
|
}
|
|
finishAnimation() {
|
|
this.currentAnimation &&
|
|
(this.mixTargetDelta && this.mixTargetDelta(1e3),
|
|
this.currentAnimation.stop()),
|
|
this.completeAnimation();
|
|
}
|
|
applyTransformsToTarget() {
|
|
let t = this.getLead(),
|
|
{
|
|
targetWithTransforms: e,
|
|
target: i,
|
|
layout: n,
|
|
latestValues: o,
|
|
} = t;
|
|
if (e && i && n) {
|
|
if (
|
|
this !== t &&
|
|
this.layout &&
|
|
n &&
|
|
ro(this.options.animationType, this.layout.layoutBox, n.layoutBox)
|
|
) {
|
|
i = this.target || tf();
|
|
let e = nZ(this.layout.layoutBox.x);
|
|
(i.x.min = t.target.x.min), (i.x.max = i.x.min + e);
|
|
let n = nZ(this.layout.layoutBox.y);
|
|
(i.y.min = t.target.y.min), (i.y.max = i.y.min + n);
|
|
}
|
|
oA(e, i),
|
|
e0(e, o),
|
|
nJ(this.projectionDeltaWithTransform, this.layoutCorrected, e, o);
|
|
}
|
|
}
|
|
registerSharedNode(t, e) {
|
|
this.sharedNodes.has(t) || this.sharedNodes.set(t, new oH()),
|
|
this.sharedNodes.get(t).add(e);
|
|
let i = e.options.initialPromotionConfig;
|
|
e.promote({
|
|
transition: i ? i.transition : void 0,
|
|
preserveFollowOpacity:
|
|
i && i.shouldPreserveFollowOpacity
|
|
? i.shouldPreserveFollowOpacity(e)
|
|
: void 0,
|
|
});
|
|
}
|
|
isLead() {
|
|
let t = this.getStack();
|
|
return !t || t.lead === this;
|
|
}
|
|
getLead() {
|
|
let { layoutId: t } = this.options;
|
|
return (t && this.getStack()?.lead) || this;
|
|
}
|
|
getPrevLead() {
|
|
let { layoutId: t } = this.options;
|
|
return t ? this.getStack()?.prevLead : void 0;
|
|
}
|
|
getStack() {
|
|
let { layoutId: t } = this.options;
|
|
if (t) return this.root.sharedNodes.get(t);
|
|
}
|
|
promote({
|
|
needsReset: t,
|
|
transition: e,
|
|
preserveFollowOpacity: i,
|
|
} = {}) {
|
|
let n = this.getStack();
|
|
n && n.promote(this, i),
|
|
t && ((this.projectionDelta = void 0), (this.needsReset = !0)),
|
|
e && this.setOptions({ transition: e });
|
|
}
|
|
relegate() {
|
|
let t = this.getStack();
|
|
return !!t && t.relegate(this);
|
|
}
|
|
resetSkewAndRotation() {
|
|
let { visualElement: t } = this.options;
|
|
if (!t) return;
|
|
let e = !1,
|
|
{ latestValues: i } = t;
|
|
if (
|
|
((i.z ||
|
|
i.rotate ||
|
|
i.rotateX ||
|
|
i.rotateY ||
|
|
i.rotateZ ||
|
|
i.skewX ||
|
|
i.skewY) &&
|
|
(e = !0),
|
|
!e)
|
|
)
|
|
return;
|
|
let n = {};
|
|
i.z && oX("z", t, n, this.animationValues);
|
|
for (let e = 0; e < o$.length; e++)
|
|
oX(`rotate${o$[e]}`, t, n, this.animationValues),
|
|
oX(`skew${o$[e]}`, t, n, this.animationValues);
|
|
for (let e in (t.render(), n))
|
|
t.setStaticValue(e, n[e]),
|
|
this.animationValues && (this.animationValues[e] = n[e]);
|
|
t.scheduleRender();
|
|
}
|
|
applyProjectionStyles(t, e) {
|
|
if (!this.instance || this.isSVG) return;
|
|
if (!this.isVisible) {
|
|
t.visibility = "hidden";
|
|
return;
|
|
}
|
|
let i = this.getTransformTemplate();
|
|
if (this.needsReset) {
|
|
(this.needsReset = !1),
|
|
(t.visibility = ""),
|
|
(t.opacity = ""),
|
|
(t.pointerEvents = ir(e?.pointerEvents) || ""),
|
|
(t.transform = i ? i(this.latestValues, "") : "none");
|
|
return;
|
|
}
|
|
let n = this.getLead();
|
|
if (!this.projectionDelta || !this.layout || !n.target) {
|
|
this.options.layoutId &&
|
|
((t.opacity =
|
|
void 0 !== this.latestValues.opacity
|
|
? this.latestValues.opacity
|
|
: 1),
|
|
(t.pointerEvents = ir(e?.pointerEvents) || "")),
|
|
this.hasProjected &&
|
|
!eY(this.latestValues) &&
|
|
((t.transform = i ? i({}, "") : "none"),
|
|
(this.hasProjected = !1));
|
|
return;
|
|
}
|
|
t.visibility = "";
|
|
let o = n.animationValues || n.latestValues;
|
|
this.applyTransformsToTarget();
|
|
let r = (function (t, e, i) {
|
|
let n = "",
|
|
o = t.x.translate / e.x,
|
|
r = t.y.translate / e.y,
|
|
s = i?.z || 0;
|
|
if (
|
|
((o || r || s) && (n = `translate3d(${o}px, ${r}px, ${s}px) `),
|
|
(1 !== e.x || 1 !== e.y) &&
|
|
(n += `scale(${1 / e.x}, ${1 / e.y}) `),
|
|
i)
|
|
) {
|
|
let {
|
|
transformPerspective: t,
|
|
rotate: e,
|
|
rotateX: o,
|
|
rotateY: r,
|
|
skewX: s,
|
|
skewY: a,
|
|
} = i;
|
|
t && (n = `perspective(${t}px) ${n}`),
|
|
e && (n += `rotate(${e}deg) `),
|
|
o && (n += `rotateX(${o}deg) `),
|
|
r && (n += `rotateY(${r}deg) `),
|
|
s && (n += `skewX(${s}deg) `),
|
|
a && (n += `skewY(${a}deg) `);
|
|
}
|
|
let a = t.x.scale * e.x,
|
|
l = t.y.scale * e.y;
|
|
return (
|
|
(1 !== a || 1 !== l) && (n += `scale(${a}, ${l})`), n || "none"
|
|
);
|
|
})(this.projectionDeltaWithTransform, this.treeScale, o);
|
|
i && (r = i(o, r)), (t.transform = r);
|
|
let { x: s, y: a } = this.projectionDelta;
|
|
for (let e in ((t.transformOrigin = `${100 * s.origin}% ${100 * a.origin}% 0`),
|
|
n.animationValues
|
|
? (t.opacity =
|
|
n === this
|
|
? (o.opacity ?? this.latestValues.opacity ?? 1)
|
|
: this.preserveOpacity
|
|
? this.latestValues.opacity
|
|
: o.opacityExit)
|
|
: (t.opacity =
|
|
n === this
|
|
? void 0 !== o.opacity
|
|
? o.opacity
|
|
: ""
|
|
: void 0 !== o.opacityExit
|
|
? o.opacityExit
|
|
: 0),
|
|
eO)) {
|
|
if (void 0 === o[e]) continue;
|
|
let { correct: i, applyTo: s, isCSSVariable: a } = eO[e],
|
|
l = "none" === r ? o[e] : i(o[e], n);
|
|
if (s) {
|
|
let e = s.length;
|
|
for (let i = 0; i < e; i++) t[s[i]] = l;
|
|
} else
|
|
a
|
|
? (this.options.visualElement.renderState.vars[e] = l)
|
|
: (t[e] = l);
|
|
}
|
|
this.options.layoutId &&
|
|
(t.pointerEvents =
|
|
n === this ? ir(e?.pointerEvents) || "" : "none");
|
|
}
|
|
clearSnapshot() {
|
|
this.resumeFrom = this.snapshot = void 0;
|
|
}
|
|
resetTree() {
|
|
this.root.nodes.forEach((t) => t.currentAnimation?.stop()),
|
|
this.root.nodes.forEach(oJ),
|
|
this.root.sharedNodes.clear();
|
|
}
|
|
};
|
|
}
|
|
function oq(t) {
|
|
t.updateLayout();
|
|
}
|
|
function oK(t) {
|
|
let e = t.resumeFrom?.snapshot || t.snapshot;
|
|
if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
|
|
let { layoutBox: i, measuredBox: n } = t.layout,
|
|
{ animationType: o } = t.options,
|
|
r = e.source !== t.layout.source;
|
|
"size" === o
|
|
? nX((t) => {
|
|
let n = r ? e.measuredBox[t] : e.layoutBox[t],
|
|
o = nZ(n);
|
|
(n.min = i[t].min), (n.max = n.min + o);
|
|
})
|
|
: ro(o, e.layoutBox, i) &&
|
|
nX((n) => {
|
|
let o = r ? e.measuredBox[n] : e.layoutBox[n],
|
|
s = nZ(i[n]);
|
|
(o.max = o.min + s),
|
|
t.relativeTarget &&
|
|
!t.currentAnimation &&
|
|
((t.isProjectionDirty = !0),
|
|
(t.relativeTarget[n].max = t.relativeTarget[n].min + s));
|
|
});
|
|
let s = tp();
|
|
nJ(s, i, e.layoutBox);
|
|
let a = tp();
|
|
r
|
|
? nJ(a, t.applyTransform(n, !0), e.measuredBox)
|
|
: nJ(a, i, e.layoutBox);
|
|
let l = !oF(s),
|
|
c = !1;
|
|
if (!t.resumeFrom) {
|
|
let n = t.getClosestProjectingParent();
|
|
if (n && !n.resumeFrom) {
|
|
let { snapshot: o, layout: r } = n;
|
|
if (o && r) {
|
|
let s = tf();
|
|
n2(s, e.layoutBox, o.layoutBox);
|
|
let a = tf();
|
|
n2(a, i, r.layoutBox),
|
|
oB(s, a) || (c = !0),
|
|
n.options.layoutRoot &&
|
|
((t.relativeTarget = a),
|
|
(t.relativeTargetOrigin = s),
|
|
(t.relativeParent = n));
|
|
}
|
|
}
|
|
}
|
|
t.notifyListeners("didUpdate", {
|
|
layout: i,
|
|
snapshot: e,
|
|
delta: a,
|
|
layoutDelta: s,
|
|
hasLayoutChanged: l,
|
|
hasRelativeLayoutChanged: c,
|
|
});
|
|
} else if (t.isLead()) {
|
|
let { onExitComplete: e } = t.options;
|
|
e && e();
|
|
}
|
|
t.options.transition = void 0;
|
|
}
|
|
function o_(t) {
|
|
t.parent &&
|
|
(t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty),
|
|
t.isSharedProjectionDirty ||
|
|
(t.isSharedProjectionDirty = !!(
|
|
t.isProjectionDirty ||
|
|
t.parent.isProjectionDirty ||
|
|
t.parent.isSharedProjectionDirty
|
|
)),
|
|
t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
|
|
}
|
|
function oZ(t) {
|
|
t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
|
|
}
|
|
function oQ(t) {
|
|
t.clearSnapshot();
|
|
}
|
|
function oJ(t) {
|
|
t.clearMeasurements();
|
|
}
|
|
function o0(t) {
|
|
t.isLayoutDirty = !1;
|
|
}
|
|
function o1(t) {
|
|
let { visualElement: e } = t.options;
|
|
e &&
|
|
e.getProps().onBeforeLayoutMeasure &&
|
|
e.notify("BeforeLayoutMeasure"),
|
|
t.resetTransform();
|
|
}
|
|
function o2(t) {
|
|
t.finishAnimation(),
|
|
(t.targetDelta = t.relativeTarget = t.target = void 0),
|
|
(t.isProjectionDirty = !0);
|
|
}
|
|
function o5(t) {
|
|
t.resolveTargetDelta();
|
|
}
|
|
function o3(t) {
|
|
t.calcProjection();
|
|
}
|
|
function o9(t) {
|
|
t.resetSkewAndRotation();
|
|
}
|
|
function o4(t) {
|
|
t.removeLeadSnapshot();
|
|
}
|
|
function o6(t, e, i) {
|
|
(t.translate = eB(e.translate, 0, i)),
|
|
(t.scale = eB(e.scale, 1, i)),
|
|
(t.origin = e.origin),
|
|
(t.originPoint = e.originPoint);
|
|
}
|
|
function o7(t, e, i, n) {
|
|
(t.min = eB(e.min, i.min, n)), (t.max = eB(e.max, i.max, n));
|
|
}
|
|
function o8(t) {
|
|
return t.animationValues && void 0 !== t.animationValues.opacityExit;
|
|
}
|
|
let rt = { duration: 0.45, ease: [0.4, 0, 0.1, 1] },
|
|
re = (t) =>
|
|
"u" > typeof navigator &&
|
|
navigator.userAgent &&
|
|
navigator.userAgent.toLowerCase().includes(t),
|
|
ri = re("applewebkit/") && !re("chrome/") ? Math.round : t$;
|
|
function rn(t) {
|
|
(t.min = ri(t.min)), (t.max = ri(t.max));
|
|
}
|
|
function ro(t, e, i) {
|
|
return (
|
|
"position" === t ||
|
|
("preserve-aspect" === t && !(0.2 >= Math.abs(oO(e) - oO(i))))
|
|
);
|
|
}
|
|
function rr(t) {
|
|
return t !== t.root && t.scroll?.wasRoot;
|
|
}
|
|
let rs = oY({
|
|
attachResizeListener: (t, e) => nK(t, "resize", e),
|
|
measureScroll: () => ({
|
|
x:
|
|
document.documentElement.scrollLeft ||
|
|
document.body?.scrollLeft ||
|
|
0,
|
|
y:
|
|
document.documentElement.scrollTop || document.body?.scrollTop || 0,
|
|
}),
|
|
checkIsScrollRoot: () => !0,
|
|
}),
|
|
ra = { current: void 0 },
|
|
rl = oY({
|
|
measureScroll: (t) => ({ x: t.scrollLeft, y: t.scrollTop }),
|
|
defaultParent: () => {
|
|
if (!ra.current) {
|
|
let t = new rs({});
|
|
t.mount(window),
|
|
t.setOptions({ layoutScroll: !0 }),
|
|
(ra.current = t);
|
|
}
|
|
return ra.current;
|
|
},
|
|
resetTransform: (t, e) => {
|
|
t.style.transform = void 0 !== e ? e : "none";
|
|
},
|
|
checkIsScrollRoot: (t) =>
|
|
"fixed" === window.getComputedStyle(t).position,
|
|
});
|
|
function rc(t, e) {
|
|
let i = (function (t, e, i) {
|
|
if (null == t) return [];
|
|
if (t instanceof EventTarget) return [t];
|
|
if ("string" == typeof t) {
|
|
let e = document,
|
|
i = void 0 ?? e.querySelectorAll(t);
|
|
return i ? Array.from(i) : [];
|
|
}
|
|
return Array.from(t).filter((t) => null != t);
|
|
})(t),
|
|
n = new AbortController();
|
|
return [i, { passive: !0, ...e, signal: n.signal }, () => n.abort()];
|
|
}
|
|
function ru(t) {
|
|
return !("touch" === t.pointerType || n_.x || n_.y);
|
|
}
|
|
function rh(t, e, i) {
|
|
let { props: n } = t;
|
|
t.animationState &&
|
|
n.whileHover &&
|
|
t.animationState.setActive("whileHover", "Start" === i);
|
|
let o = n["onHover" + i];
|
|
o && tq.postRender(() => o(e, n3(e)));
|
|
}
|
|
let rd = (t, e) => !!e && (t === e || rd(t, e.parentElement)),
|
|
rp = new WeakSet();
|
|
function rm(t) {
|
|
return (e) => {
|
|
"Enter" === e.key && t(e);
|
|
};
|
|
}
|
|
function rf(t, e) {
|
|
t.dispatchEvent(
|
|
new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }),
|
|
);
|
|
}
|
|
function rg(t) {
|
|
return n5(t) && !(n_.x || n_.y);
|
|
}
|
|
function rv(t, e, i) {
|
|
let { props: n } = t;
|
|
if (t.current instanceof HTMLButtonElement && t.current.disabled) return;
|
|
t.animationState &&
|
|
n.whileTap &&
|
|
t.animationState.setActive("whileTap", "Start" === i);
|
|
let o = n["onTap" + ("End" === i ? "" : i)];
|
|
o && tq.postRender(() => o(e, n3(e)));
|
|
}
|
|
let ry = new WeakMap(),
|
|
rb = new WeakMap(),
|
|
rI = (t) => {
|
|
let e = ry.get(t.target);
|
|
e && e(t);
|
|
},
|
|
rx = (t) => {
|
|
t.forEach(rI);
|
|
},
|
|
rw = { some: 0, all: 1 },
|
|
rS = (function (t, e) {
|
|
if ("u" < typeof Proxy) return iv;
|
|
let i = new Map(),
|
|
n = (i, n) => iv(i, n, t, e);
|
|
return new Proxy((t, e) => n(t, e), {
|
|
get: (o, r) =>
|
|
"create" === r
|
|
? n
|
|
: (i.has(r) || i.set(r, iv(r, void 0, t, e)), i.get(r)),
|
|
});
|
|
})(
|
|
{
|
|
animation: {
|
|
Feature: class extends iy {
|
|
constructor(t) {
|
|
super(t),
|
|
t.animationState ||
|
|
(t.animationState = (function (t) {
|
|
let e = (e) =>
|
|
Promise.all(
|
|
e.map(({ animation: e, options: i }) =>
|
|
(function (t, e, i = {}) {
|
|
let n;
|
|
if (
|
|
(t.notify("AnimationStart", e),
|
|
Array.isArray(e))
|
|
)
|
|
n = Promise.all(e.map((e) => nB(t, e, i)));
|
|
else if ("string" == typeof e) n = nB(t, e, i);
|
|
else {
|
|
let o =
|
|
"function" == typeof e
|
|
? ib(t, e, i.custom)
|
|
: e;
|
|
n = Promise.all(nj(t, o, i));
|
|
}
|
|
return n.then(() => {
|
|
t.notify("AnimationComplete", e);
|
|
});
|
|
})(t, e, i),
|
|
),
|
|
),
|
|
i = n$(),
|
|
n = !0,
|
|
o = (e) => (i, n) => {
|
|
let o = ib(
|
|
t,
|
|
n,
|
|
"exit" === e ? t.presenceContext?.custom : void 0,
|
|
);
|
|
if (o) {
|
|
let { transition: t, transitionEnd: e, ...n } = o;
|
|
i = { ...i, ...n, ...e };
|
|
}
|
|
return i;
|
|
};
|
|
function r(r) {
|
|
let { props: s } = t,
|
|
a =
|
|
(function t(e) {
|
|
if (!e) return;
|
|
if (!e.isControllingVariants) {
|
|
let i = (e.parent && t(e.parent)) || {};
|
|
return (
|
|
void 0 !== e.props.initial &&
|
|
(i.initial = e.props.initial),
|
|
i
|
|
);
|
|
}
|
|
let i = {};
|
|
for (let t = 0; t < nO; t++) {
|
|
let n = ef[t],
|
|
o = e.props[n];
|
|
(ep(o) || !1 === o) && (i[n] = o);
|
|
}
|
|
return i;
|
|
})(t.parent) || {},
|
|
l = [],
|
|
c = new Set(),
|
|
u = {},
|
|
h = 1 / 0;
|
|
for (let e = 0; e < nz; e++) {
|
|
var d, p;
|
|
let m = nH[e],
|
|
f = i[m],
|
|
g = void 0 !== s[m] ? s[m] : a[m],
|
|
v = ep(g),
|
|
y = m === r ? f.isActive : null;
|
|
!1 === y && (h = e);
|
|
let b = g === a[m] && g !== s[m] && v;
|
|
if (
|
|
(b && n && t.manuallyAnimateOnMount && (b = !1),
|
|
(f.protectedKeys = { ...u }),
|
|
(!f.isActive && null === y) ||
|
|
(!g && !f.prevProp) ||
|
|
ed(g) ||
|
|
"boolean" == typeof g)
|
|
)
|
|
continue;
|
|
let I =
|
|
((d = f.prevProp),
|
|
"string" == typeof (p = g)
|
|
? p !== d
|
|
: !!Array.isArray(p) && !nU(p, d)),
|
|
x =
|
|
I ||
|
|
(m === r && f.isActive && !b && v) ||
|
|
(e > h && v),
|
|
w = !1,
|
|
S = Array.isArray(g) ? g : [g],
|
|
T = S.reduce(o(m), {});
|
|
!1 === y && (T = {});
|
|
let { prevResolvedValues: P = {} } = f,
|
|
k = { ...P, ...T },
|
|
A = (e) => {
|
|
(x = !0),
|
|
c.has(e) && ((w = !0), c.delete(e)),
|
|
(f.needsAnimating[e] = !0);
|
|
let i = t.getValue(e);
|
|
i && (i.liveStyle = !1);
|
|
};
|
|
for (let t in k) {
|
|
let e = T[t],
|
|
i = P[t];
|
|
if (!u.hasOwnProperty(t))
|
|
(ix(e) && ix(i) ? nU(e, i) : e === i)
|
|
? void 0 !== e && c.has(t)
|
|
? A(t)
|
|
: (f.protectedKeys[t] = !0)
|
|
: null != e
|
|
? A(t)
|
|
: c.add(t);
|
|
}
|
|
(f.prevProp = g),
|
|
(f.prevResolvedValues = T),
|
|
f.isActive && (u = { ...u, ...T }),
|
|
n && t.blockInitialAnimation && (x = !1);
|
|
let C = b && I,
|
|
E = !C || w;
|
|
x &&
|
|
E &&
|
|
l.push(
|
|
...S.map((e) => {
|
|
let i = { type: m };
|
|
if (
|
|
"string" == typeof e &&
|
|
n &&
|
|
!C &&
|
|
t.manuallyAnimateOnMount &&
|
|
t.parent
|
|
) {
|
|
let { parent: n } = t,
|
|
o = ib(n, e);
|
|
if (n.enteringChildren && o) {
|
|
let { delayChildren: e } =
|
|
o.transition || {};
|
|
i.delay = nN(n.enteringChildren, t, e);
|
|
}
|
|
}
|
|
return { animation: e, options: i };
|
|
}),
|
|
);
|
|
}
|
|
if (c.size) {
|
|
let e = {};
|
|
if ("boolean" != typeof s.initial) {
|
|
let i = ib(
|
|
t,
|
|
Array.isArray(s.initial)
|
|
? s.initial[0]
|
|
: s.initial,
|
|
);
|
|
i && i.transition && (e.transition = i.transition);
|
|
}
|
|
c.forEach((i) => {
|
|
let n = t.getBaseTarget(i),
|
|
o = t.getValue(i);
|
|
o && (o.liveStyle = !0), (e[i] = n ?? null);
|
|
}),
|
|
l.push({ animation: e });
|
|
}
|
|
let m = !!l.length;
|
|
return (
|
|
n &&
|
|
(!1 === s.initial || s.initial === s.animate) &&
|
|
!t.manuallyAnimateOnMount &&
|
|
(m = !1),
|
|
(n = !1),
|
|
m ? e(l) : Promise.resolve()
|
|
);
|
|
}
|
|
return {
|
|
animateChanges: r,
|
|
setActive: function (e, n) {
|
|
if (i[e].isActive === n) return Promise.resolve();
|
|
t.variantChildren?.forEach((t) =>
|
|
t.animationState?.setActive(e, n),
|
|
),
|
|
(i[e].isActive = n);
|
|
let o = r(e);
|
|
for (let t in i) i[t].protectedKeys = {};
|
|
return o;
|
|
},
|
|
setAnimateFunction: function (i) {
|
|
e = i(t);
|
|
},
|
|
getState: () => i,
|
|
reset: () => {
|
|
i = n$();
|
|
},
|
|
};
|
|
})(t));
|
|
}
|
|
updateAnimationControlsSubscription() {
|
|
let { animate: t } = this.node.getProps();
|
|
ed(t) && (this.unmountControls = t.subscribe(this.node));
|
|
}
|
|
mount() {
|
|
this.updateAnimationControlsSubscription();
|
|
}
|
|
update() {
|
|
let { animate: t } = this.node.getProps(),
|
|
{ animate: e } = this.node.prevProps || {};
|
|
t !== e && this.updateAnimationControlsSubscription();
|
|
}
|
|
unmount() {
|
|
this.node.animationState.reset(), this.unmountControls?.();
|
|
}
|
|
},
|
|
},
|
|
exit: {
|
|
Feature: class extends iy {
|
|
constructor() {
|
|
super(...arguments), (this.id = nG++);
|
|
}
|
|
update() {
|
|
if (!this.node.presenceContext) return;
|
|
let { isPresent: t, onExitComplete: e } =
|
|
this.node.presenceContext,
|
|
{ isPresent: i } = this.node.prevPresenceContext || {};
|
|
if (!this.node.animationState || t === i) return;
|
|
let n = this.node.animationState.setActive("exit", !t);
|
|
e &&
|
|
!t &&
|
|
n.then(() => {
|
|
e(this.id);
|
|
});
|
|
}
|
|
mount() {
|
|
let { register: t, onExitComplete: e } =
|
|
this.node.presenceContext || {};
|
|
e && e(this.id), t && (this.unmount = t(this.id));
|
|
}
|
|
unmount() {}
|
|
},
|
|
},
|
|
inView: {
|
|
Feature: class extends iy {
|
|
constructor() {
|
|
super(...arguments),
|
|
(this.hasEnteredView = !1),
|
|
(this.isInView = !1);
|
|
}
|
|
startObserver() {
|
|
var t;
|
|
let e;
|
|
this.unmount();
|
|
let { viewport: i = {} } = this.node.getProps(),
|
|
{ root: n, margin: o, amount: r = "some", once: s } = i,
|
|
a = {
|
|
root: n ? n.current : void 0,
|
|
rootMargin: o,
|
|
threshold: "number" == typeof r ? r : rw[r],
|
|
},
|
|
l = (t) => {
|
|
let { isIntersecting: e } = t;
|
|
if (
|
|
this.isInView === e ||
|
|
((this.isInView = e), s && !e && this.hasEnteredView)
|
|
)
|
|
return;
|
|
e && (this.hasEnteredView = !0),
|
|
this.node.animationState &&
|
|
this.node.animationState.setActive("whileInView", e);
|
|
let { onViewportEnter: i, onViewportLeave: n } =
|
|
this.node.getProps(),
|
|
o = e ? i : n;
|
|
o && o(t);
|
|
};
|
|
return (
|
|
(t = this.node.current),
|
|
(e = (function ({ root: t, ...e }) {
|
|
let i = t || document;
|
|
rb.has(i) || rb.set(i, {});
|
|
let n = rb.get(i),
|
|
o = JSON.stringify(e);
|
|
return (
|
|
n[o] ||
|
|
(n[o] = new IntersectionObserver(rx, {
|
|
root: t,
|
|
...e,
|
|
})),
|
|
n[o]
|
|
);
|
|
})(a)),
|
|
ry.set(t, l),
|
|
e.observe(t),
|
|
() => {
|
|
ry.delete(t), e.unobserve(t);
|
|
}
|
|
);
|
|
}
|
|
mount() {
|
|
this.startObserver();
|
|
}
|
|
update() {
|
|
if ("u" < typeof IntersectionObserver) return;
|
|
let { props: t, prevProps: e } = this.node;
|
|
["amount", "margin", "root"].some(
|
|
(function ({ viewport: t = {} }, { viewport: e = {} } = {}) {
|
|
return (i) => t[i] !== e[i];
|
|
})(t, e),
|
|
) && this.startObserver();
|
|
}
|
|
unmount() {}
|
|
},
|
|
},
|
|
tap: {
|
|
Feature: class extends iy {
|
|
mount() {
|
|
let { current: t } = this.node;
|
|
t &&
|
|
(this.unmount = (function (t, e, i = {}) {
|
|
let [n, o, r] = rc(t, i),
|
|
s = (t) => {
|
|
let n = t.currentTarget;
|
|
if (!rg(t)) return;
|
|
rp.add(n);
|
|
let r = e(n, t),
|
|
s = (t, e) => {
|
|
window.removeEventListener("pointerup", a),
|
|
window.removeEventListener("pointercancel", l),
|
|
rp.has(n) && rp.delete(n),
|
|
rg(t) &&
|
|
"function" == typeof r &&
|
|
r(t, { success: e });
|
|
},
|
|
a = (t) => {
|
|
s(
|
|
t,
|
|
n === window ||
|
|
n === document ||
|
|
i.useGlobalTarget ||
|
|
rd(n, t.target),
|
|
);
|
|
},
|
|
l = (t) => {
|
|
s(t, !1);
|
|
};
|
|
window.addEventListener("pointerup", a, o),
|
|
window.addEventListener("pointercancel", l, o);
|
|
};
|
|
return (
|
|
n.forEach((t) => {
|
|
((i.useGlobalTarget ? window : t).addEventListener(
|
|
"pointerdown",
|
|
s,
|
|
o,
|
|
),
|
|
m(t)) &&
|
|
(t.addEventListener("focus", (t) =>
|
|
((t, e) => {
|
|
let i = t.currentTarget;
|
|
if (!i) return;
|
|
let n = rm(() => {
|
|
if (rp.has(i)) return;
|
|
rf(i, "down");
|
|
let t = rm(() => {
|
|
rf(i, "up");
|
|
});
|
|
i.addEventListener("keyup", t, e),
|
|
i.addEventListener(
|
|
"blur",
|
|
() => rf(i, "cancel"),
|
|
e,
|
|
);
|
|
});
|
|
i.addEventListener("keydown", n, e),
|
|
i.addEventListener(
|
|
"blur",
|
|
() => i.removeEventListener("keydown", n),
|
|
e,
|
|
);
|
|
})(t, o),
|
|
),
|
|
nY.has(t.tagName) ||
|
|
!0 === t.isContentEditable ||
|
|
t.hasAttribute("tabindex") ||
|
|
(t.tabIndex = 0));
|
|
}),
|
|
r
|
|
);
|
|
})(
|
|
t,
|
|
(t, e) => (
|
|
rv(this.node, e, "Start"),
|
|
(t, { success: e }) =>
|
|
rv(this.node, t, e ? "End" : "Cancel")
|
|
),
|
|
{ useGlobalTarget: this.node.props.globalTapTarget },
|
|
));
|
|
}
|
|
unmount() {}
|
|
},
|
|
},
|
|
focus: {
|
|
Feature: class extends iy {
|
|
constructor() {
|
|
super(...arguments), (this.isActive = !1);
|
|
}
|
|
onFocus() {
|
|
let t = !1;
|
|
try {
|
|
t = this.node.current.matches(":focus-visible");
|
|
} catch (e) {
|
|
t = !0;
|
|
}
|
|
t &&
|
|
this.node.animationState &&
|
|
(this.node.animationState.setActive("whileFocus", !0),
|
|
(this.isActive = !0));
|
|
}
|
|
onBlur() {
|
|
this.isActive &&
|
|
this.node.animationState &&
|
|
(this.node.animationState.setActive("whileFocus", !1),
|
|
(this.isActive = !1));
|
|
}
|
|
mount() {
|
|
this.unmount = iP(
|
|
nK(this.node.current, "focus", () => this.onFocus()),
|
|
nK(this.node.current, "blur", () => this.onBlur()),
|
|
);
|
|
}
|
|
unmount() {}
|
|
},
|
|
},
|
|
hover: {
|
|
Feature: class extends iy {
|
|
mount() {
|
|
let { current: t } = this.node;
|
|
t &&
|
|
(this.unmount = (function (t, e, i = {}) {
|
|
let [n, o, r] = rc(t, i),
|
|
s = (t) => {
|
|
if (!ru(t)) return;
|
|
let { target: i } = t,
|
|
n = e(i, t);
|
|
if ("function" != typeof n || !i) return;
|
|
let r = (t) => {
|
|
ru(t) &&
|
|
(n(t), i.removeEventListener("pointerleave", r));
|
|
};
|
|
i.addEventListener("pointerleave", r, o);
|
|
};
|
|
return (
|
|
n.forEach((t) => {
|
|
t.addEventListener("pointerenter", s, o);
|
|
}),
|
|
r
|
|
);
|
|
})(
|
|
t,
|
|
(t, e) => (
|
|
rh(this.node, e, "Start"), (t) => rh(this.node, t, "End")
|
|
),
|
|
));
|
|
}
|
|
unmount() {}
|
|
},
|
|
},
|
|
pan: {
|
|
Feature: class extends iy {
|
|
constructor() {
|
|
super(...arguments), (this.removePointerDownListener = t$);
|
|
}
|
|
onPointerDown(t) {
|
|
this.session = new n8(t, this.createPanHandlers(), {
|
|
transformPagePoint: this.node.getTransformPagePoint(),
|
|
contextWindow: n4(this.node),
|
|
});
|
|
}
|
|
createPanHandlers() {
|
|
let {
|
|
onPanSessionStart: t,
|
|
onPanStart: e,
|
|
onPan: i,
|
|
onPanEnd: n,
|
|
} = this.node.getProps();
|
|
return {
|
|
onSessionStart: oh(t),
|
|
onStart: oh(e),
|
|
onMove: oh(i),
|
|
onEnd: (t, e) => {
|
|
delete this.session, n && tq.postRender(() => n(t, e));
|
|
},
|
|
};
|
|
}
|
|
mount() {
|
|
this.removePointerDownListener = n9(
|
|
this.node.current,
|
|
"pointerdown",
|
|
(t) => this.onPointerDown(t),
|
|
);
|
|
}
|
|
update() {
|
|
this.session &&
|
|
this.session.updateHandlers(this.createPanHandlers());
|
|
}
|
|
unmount() {
|
|
this.removePointerDownListener(),
|
|
this.session && this.session.end();
|
|
}
|
|
},
|
|
},
|
|
drag: {
|
|
Feature: class extends iy {
|
|
constructor(t) {
|
|
super(t),
|
|
(this.removeGroupControls = t$),
|
|
(this.removeListeners = t$),
|
|
(this.controls = new oc(t));
|
|
}
|
|
mount() {
|
|
let { dragControls: t } = this.node.getProps();
|
|
t && (this.removeGroupControls = t.subscribe(this.controls)),
|
|
(this.removeListeners = this.controls.addListeners() || t$);
|
|
}
|
|
update() {
|
|
let { dragControls: t } = this.node.getProps(),
|
|
{ dragControls: e } = this.node.prevProps || {};
|
|
t !== e &&
|
|
(this.removeGroupControls(),
|
|
t && (this.removeGroupControls = t.subscribe(this.controls)));
|
|
}
|
|
unmount() {
|
|
this.removeGroupControls(),
|
|
this.removeListeners(),
|
|
this.controls.isDragging || this.controls.endPanSession();
|
|
}
|
|
},
|
|
ProjectionNode: rl,
|
|
MeasureLayout: og,
|
|
},
|
|
layout: { ProjectionNode: rl, MeasureLayout: og },
|
|
},
|
|
(t, e) =>
|
|
(e.isSVG ?? e3(t))
|
|
? new eW(e)
|
|
: new e2(e, { allowProjection: t !== a.Fragment }),
|
|
);
|
|
t.s(["motion", () => rS], 532527);
|
|
};
|
|
|
|
export default moduleFactory;
|