motion-dom 12.12.0 → 12.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +95 -51
- package/dist/es/animation/JSAnimation.mjs +4 -6
- package/dist/es/animation/waapi/supports/waapi.mjs +3 -5
- package/dist/es/effects/MotionValueState.mjs +8 -2
- package/dist/es/effects/style/index.mjs +6 -24
- package/dist/es/effects/utils/create-dom-effect.mjs +18 -0
- package/dist/es/effects/utils/create-effect.mjs +21 -0
- package/dist/es/gestures/press/index.mjs +2 -1
- package/dist/es/index.mjs +4 -1
- package/dist/es/utils/is-html-element.mjs +11 -0
- package/dist/es/utils/is-svg-element.mjs +11 -0
- package/dist/es/utils/is-svg-svg-element.mjs +11 -0
- package/dist/index.d.ts +43 -14
- package/dist/motion-dom.dev.js +95 -51
- package/dist/motion-dom.js +1 -1
- package/dist/size-rollup-style-effect.js +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1304,12 +1304,10 @@ class JSAnimation extends WithPromise {
|
|
|
1304
1304
|
* This method is bound to the instance to fix a pattern where
|
|
1305
1305
|
* animation.stop is returned as a reference from a useEffect.
|
|
1306
1306
|
*/
|
|
1307
|
-
this.stop = (
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
this.tick(time.now());
|
|
1312
|
-
}
|
|
1307
|
+
this.stop = () => {
|
|
1308
|
+
const { motionValue } = this.options;
|
|
1309
|
+
if (motionValue && motionValue.updatedAt !== time.now()) {
|
|
1310
|
+
this.tick(time.now());
|
|
1313
1311
|
}
|
|
1314
1312
|
this.isStopped = true;
|
|
1315
1313
|
if (this.state === "idle")
|
|
@@ -2303,6 +2301,14 @@ function canAnimate(keyframes, name, type, velocity) {
|
|
|
2303
2301
|
((type === "spring" || isGenerator(type)) && velocity));
|
|
2304
2302
|
}
|
|
2305
2303
|
|
|
2304
|
+
/**
|
|
2305
|
+
* Checks if an element is an HTML element in a way
|
|
2306
|
+
* that works across iframes
|
|
2307
|
+
*/
|
|
2308
|
+
function isHTMLElement(element) {
|
|
2309
|
+
return motionUtils.isObject(element) && "offsetHeight" in element;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2306
2312
|
/**
|
|
2307
2313
|
* A list of values that can be hardware-accelerated.
|
|
2308
2314
|
*/
|
|
@@ -2311,16 +2317,13 @@ const acceleratedValues$1 = new Set([
|
|
|
2311
2317
|
"clipPath",
|
|
2312
2318
|
"filter",
|
|
2313
2319
|
"transform",
|
|
2314
|
-
// TODO:
|
|
2315
|
-
// or until we implement support for linear() easing.
|
|
2320
|
+
// TODO: Could be re-enabled now we have support for linear() easing
|
|
2316
2321
|
// "background-color"
|
|
2317
2322
|
]);
|
|
2318
2323
|
const supportsWaapi = /*@__PURE__*/ motionUtils.memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
2319
2324
|
function supportsBrowserAnimation(options) {
|
|
2320
2325
|
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
2321
|
-
if (!motionValue
|
|
2322
|
-
!motionValue.owner ||
|
|
2323
|
-
!(motionValue.owner.current instanceof HTMLElement)) {
|
|
2326
|
+
if (!isHTMLElement(motionValue?.owner?.current)) {
|
|
2324
2327
|
return false;
|
|
2325
2328
|
}
|
|
2326
2329
|
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
|
@@ -3047,22 +3050,6 @@ const acceleratedValues = new Set([
|
|
|
3047
3050
|
// "background-color"
|
|
3048
3051
|
]);
|
|
3049
3052
|
|
|
3050
|
-
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
3051
|
-
if (elementOrSelector instanceof EventTarget) {
|
|
3052
|
-
return [elementOrSelector];
|
|
3053
|
-
}
|
|
3054
|
-
else if (typeof elementOrSelector === "string") {
|
|
3055
|
-
let root = document;
|
|
3056
|
-
if (scope) {
|
|
3057
|
-
root = scope.current;
|
|
3058
|
-
}
|
|
3059
|
-
const elements = selectorCache?.[elementOrSelector] ??
|
|
3060
|
-
root.querySelectorAll(elementOrSelector);
|
|
3061
|
-
return elements ? Array.from(elements) : [];
|
|
3062
|
-
}
|
|
3063
|
-
return Array.from(elementOrSelector);
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
3053
|
/**
|
|
3067
3054
|
* Maximum time between the value of two frames, beyond which we
|
|
3068
3055
|
* assume the velocity has since been 0.
|
|
@@ -3385,6 +3372,37 @@ function motionValue(init, options) {
|
|
|
3385
3372
|
return new MotionValue(init, options);
|
|
3386
3373
|
}
|
|
3387
3374
|
|
|
3375
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
3376
|
+
if (elementOrSelector instanceof EventTarget) {
|
|
3377
|
+
return [elementOrSelector];
|
|
3378
|
+
}
|
|
3379
|
+
else if (typeof elementOrSelector === "string") {
|
|
3380
|
+
let root = document;
|
|
3381
|
+
if (scope) {
|
|
3382
|
+
root = scope.current;
|
|
3383
|
+
}
|
|
3384
|
+
const elements = selectorCache?.[elementOrSelector] ??
|
|
3385
|
+
root.querySelectorAll(elementOrSelector);
|
|
3386
|
+
return elements ? Array.from(elements) : [];
|
|
3387
|
+
}
|
|
3388
|
+
return Array.from(elementOrSelector);
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
function createSelectorEffect(subjectEffect) {
|
|
3392
|
+
return (subject, values) => {
|
|
3393
|
+
const elements = resolveElements(subject);
|
|
3394
|
+
const subscriptions = [];
|
|
3395
|
+
for (const element of elements) {
|
|
3396
|
+
const remove = subjectEffect(element, values);
|
|
3397
|
+
subscriptions.push(remove);
|
|
3398
|
+
}
|
|
3399
|
+
return () => {
|
|
3400
|
+
for (const remove of subscriptions)
|
|
3401
|
+
remove();
|
|
3402
|
+
};
|
|
3403
|
+
};
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3388
3406
|
/**
|
|
3389
3407
|
* Provided a value and a ValueType, returns the value as that value type.
|
|
3390
3408
|
*/
|
|
@@ -3399,13 +3417,19 @@ class MotionValueState {
|
|
|
3399
3417
|
this.latest = {};
|
|
3400
3418
|
this.values = new Map();
|
|
3401
3419
|
}
|
|
3402
|
-
set(name, value, render, computed) {
|
|
3420
|
+
set(name, value, render, computed, useDefaultValueType = true) {
|
|
3403
3421
|
const existingValue = this.values.get(name);
|
|
3404
3422
|
if (existingValue) {
|
|
3405
3423
|
existingValue.onRemove();
|
|
3406
3424
|
}
|
|
3407
3425
|
const onChange = () => {
|
|
3408
|
-
|
|
3426
|
+
const v = value.get();
|
|
3427
|
+
if (useDefaultValueType) {
|
|
3428
|
+
this.latest[name] = getValueAsType(v, numberValueTypes[name]);
|
|
3429
|
+
}
|
|
3430
|
+
else {
|
|
3431
|
+
this.latest[name] = v;
|
|
3432
|
+
}
|
|
3409
3433
|
render && frame.render(render);
|
|
3410
3434
|
};
|
|
3411
3435
|
onChange();
|
|
@@ -3430,6 +3454,24 @@ class MotionValueState {
|
|
|
3430
3454
|
}
|
|
3431
3455
|
}
|
|
3432
3456
|
|
|
3457
|
+
function createEffect(addValue) {
|
|
3458
|
+
const stateCache = new WeakMap();
|
|
3459
|
+
const subscriptions = [];
|
|
3460
|
+
return (subject, values) => {
|
|
3461
|
+
const state = stateCache.get(subject) ?? new MotionValueState();
|
|
3462
|
+
stateCache.set(subject, state);
|
|
3463
|
+
for (const key in values) {
|
|
3464
|
+
const value = values[key];
|
|
3465
|
+
const remove = addValue(subject, state, key, value);
|
|
3466
|
+
subscriptions.push(remove);
|
|
3467
|
+
}
|
|
3468
|
+
return () => {
|
|
3469
|
+
for (const cancel of subscriptions)
|
|
3470
|
+
cancel();
|
|
3471
|
+
};
|
|
3472
|
+
};
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3433
3475
|
const translateAlias = {
|
|
3434
3476
|
x: "translateX",
|
|
3435
3477
|
y: "translateY",
|
|
@@ -3465,26 +3507,7 @@ function buildTransform(state) {
|
|
|
3465
3507
|
return transformIsDefault ? "none" : transform.trim();
|
|
3466
3508
|
}
|
|
3467
3509
|
|
|
3468
|
-
const
|
|
3469
|
-
function styleEffect(subject, values) {
|
|
3470
|
-
const elements = resolveElements(subject);
|
|
3471
|
-
const subscriptions = [];
|
|
3472
|
-
for (let i = 0; i < elements.length; i++) {
|
|
3473
|
-
const element = elements[i];
|
|
3474
|
-
const state = stateMap.get(element) ?? new MotionValueState();
|
|
3475
|
-
stateMap.set(element, state);
|
|
3476
|
-
for (const key in values) {
|
|
3477
|
-
const value = values[key];
|
|
3478
|
-
const remove = addValue(element, state, key, value);
|
|
3479
|
-
subscriptions.push(remove);
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
return () => {
|
|
3483
|
-
for (const cancel of subscriptions)
|
|
3484
|
-
cancel();
|
|
3485
|
-
};
|
|
3486
|
-
}
|
|
3487
|
-
function addValue(element, state, key, value) {
|
|
3510
|
+
const addStyleValue = (element, state, key, value) => {
|
|
3488
3511
|
let render = undefined;
|
|
3489
3512
|
let computed = undefined;
|
|
3490
3513
|
if (transformProps.has(key)) {
|
|
@@ -3506,7 +3529,8 @@ function addValue(element, state, key, value) {
|
|
|
3506
3529
|
};
|
|
3507
3530
|
}
|
|
3508
3531
|
return state.set(key, value, render, computed);
|
|
3509
|
-
}
|
|
3532
|
+
};
|
|
3533
|
+
const styleEffect = createSelectorEffect(createEffect(addStyleValue));
|
|
3510
3534
|
|
|
3511
3535
|
const { schedule: microtask, cancel: cancelMicrotask } =
|
|
3512
3536
|
/* @__PURE__ */ createRenderBatcher(queueMicrotask, false);
|
|
@@ -3736,7 +3760,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
3736
3760
|
targets.forEach((target) => {
|
|
3737
3761
|
const pointerDownTarget = options.useGlobalTarget ? window : target;
|
|
3738
3762
|
pointerDownTarget.addEventListener("pointerdown", startPress, eventOptions);
|
|
3739
|
-
if (target
|
|
3763
|
+
if (isHTMLElement(target)) {
|
|
3740
3764
|
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions));
|
|
3741
3765
|
if (!isElementKeyboardAccessible(target) &&
|
|
3742
3766
|
!target.hasAttribute("tabindex")) {
|
|
@@ -3881,6 +3905,22 @@ function recordStats() {
|
|
|
3881
3905
|
return reportStats;
|
|
3882
3906
|
}
|
|
3883
3907
|
|
|
3908
|
+
/**
|
|
3909
|
+
* Checks if an element is an SVG element in a way
|
|
3910
|
+
* that works across iframes
|
|
3911
|
+
*/
|
|
3912
|
+
function isSVGElement(element) {
|
|
3913
|
+
return motionUtils.isObject(element) && "ownerSVGElement" in element;
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
/**
|
|
3917
|
+
* Checks if an element is specifically an SVGSVGElement (the root SVG element)
|
|
3918
|
+
* in a way that works across iframes
|
|
3919
|
+
*/
|
|
3920
|
+
function isSVGSVGElement(element) {
|
|
3921
|
+
return isSVGElement(element) && element.tagName === "svg";
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3884
3924
|
function transform(...args) {
|
|
3885
3925
|
const useImmediate = !Array.isArray(args[0]);
|
|
3886
3926
|
const argOffset = useImmediate ? 0 : -1;
|
|
@@ -4392,6 +4432,7 @@ exports.NativeAnimationWrapper = NativeAnimationWrapper;
|
|
|
4392
4432
|
exports.ViewTransitionBuilder = ViewTransitionBuilder;
|
|
4393
4433
|
exports.acceleratedValues = acceleratedValues;
|
|
4394
4434
|
exports.activeAnimations = activeAnimations;
|
|
4435
|
+
exports.addStyleValue = addStyleValue;
|
|
4395
4436
|
exports.alpha = alpha;
|
|
4396
4437
|
exports.analyseComplexValue = analyseComplexValue;
|
|
4397
4438
|
exports.animateValue = animateValue;
|
|
@@ -4445,9 +4486,12 @@ exports.isCSSVariableToken = isCSSVariableToken;
|
|
|
4445
4486
|
exports.isDragActive = isDragActive;
|
|
4446
4487
|
exports.isDragging = isDragging;
|
|
4447
4488
|
exports.isGenerator = isGenerator;
|
|
4489
|
+
exports.isHTMLElement = isHTMLElement;
|
|
4448
4490
|
exports.isMotionValue = isMotionValue;
|
|
4449
4491
|
exports.isNodeOrChild = isNodeOrChild;
|
|
4450
4492
|
exports.isPrimaryPointer = isPrimaryPointer;
|
|
4493
|
+
exports.isSVGElement = isSVGElement;
|
|
4494
|
+
exports.isSVGSVGElement = isSVGSVGElement;
|
|
4451
4495
|
exports.isWaapiSupportedEasing = isWaapiSupportedEasing;
|
|
4452
4496
|
exports.keyframes = keyframes;
|
|
4453
4497
|
exports.mapEasingToNativeEasing = mapEasingToNativeEasing;
|
|
@@ -33,12 +33,10 @@ class JSAnimation extends WithPromise {
|
|
|
33
33
|
* This method is bound to the instance to fix a pattern where
|
|
34
34
|
* animation.stop is returned as a reference from a useEffect.
|
|
35
35
|
*/
|
|
36
|
-
this.stop = (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.tick(time.now());
|
|
41
|
-
}
|
|
36
|
+
this.stop = () => {
|
|
37
|
+
const { motionValue } = this.options;
|
|
38
|
+
if (motionValue && motionValue.updatedAt !== time.now()) {
|
|
39
|
+
this.tick(time.now());
|
|
42
40
|
}
|
|
43
41
|
this.isStopped = true;
|
|
44
42
|
if (this.state === "idle")
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { memo } from 'motion-utils';
|
|
2
|
+
import { isHTMLElement } from '../../../utils/is-html-element.mjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A list of values that can be hardware-accelerated.
|
|
@@ -8,16 +9,13 @@ const acceleratedValues = new Set([
|
|
|
8
9
|
"clipPath",
|
|
9
10
|
"filter",
|
|
10
11
|
"transform",
|
|
11
|
-
// TODO:
|
|
12
|
-
// or until we implement support for linear() easing.
|
|
12
|
+
// TODO: Could be re-enabled now we have support for linear() easing
|
|
13
13
|
// "background-color"
|
|
14
14
|
]);
|
|
15
15
|
const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
16
16
|
function supportsBrowserAnimation(options) {
|
|
17
17
|
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
18
|
-
if (!motionValue
|
|
19
|
-
!motionValue.owner ||
|
|
20
|
-
!(motionValue.owner.current instanceof HTMLElement)) {
|
|
18
|
+
if (!isHTMLElement(motionValue?.owner?.current)) {
|
|
21
19
|
return false;
|
|
22
20
|
}
|
|
23
21
|
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
|
@@ -7,13 +7,19 @@ class MotionValueState {
|
|
|
7
7
|
this.latest = {};
|
|
8
8
|
this.values = new Map();
|
|
9
9
|
}
|
|
10
|
-
set(name, value, render, computed) {
|
|
10
|
+
set(name, value, render, computed, useDefaultValueType = true) {
|
|
11
11
|
const existingValue = this.values.get(name);
|
|
12
12
|
if (existingValue) {
|
|
13
13
|
existingValue.onRemove();
|
|
14
14
|
}
|
|
15
15
|
const onChange = () => {
|
|
16
|
-
|
|
16
|
+
const v = value.get();
|
|
17
|
+
if (useDefaultValueType) {
|
|
18
|
+
this.latest[name] = getValueAsType(v, numberValueTypes[name]);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.latest[name] = v;
|
|
22
|
+
}
|
|
17
23
|
render && frame.render(render);
|
|
18
24
|
};
|
|
19
25
|
onChange();
|
|
@@ -1,30 +1,11 @@
|
|
|
1
1
|
import { isCSSVar } from '../../render/dom/is-css-var.mjs';
|
|
2
2
|
import { transformProps } from '../../render/utils/keys-transform.mjs';
|
|
3
|
-
import { resolveElements } from '../../utils/resolve-elements.mjs';
|
|
4
3
|
import { MotionValue } from '../../value/index.mjs';
|
|
5
|
-
import {
|
|
4
|
+
import { createSelectorEffect } from '../utils/create-dom-effect.mjs';
|
|
5
|
+
import { createEffect } from '../utils/create-effect.mjs';
|
|
6
6
|
import { buildTransform } from './transform.mjs';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
function styleEffect(subject, values) {
|
|
10
|
-
const elements = resolveElements(subject);
|
|
11
|
-
const subscriptions = [];
|
|
12
|
-
for (let i = 0; i < elements.length; i++) {
|
|
13
|
-
const element = elements[i];
|
|
14
|
-
const state = stateMap.get(element) ?? new MotionValueState();
|
|
15
|
-
stateMap.set(element, state);
|
|
16
|
-
for (const key in values) {
|
|
17
|
-
const value = values[key];
|
|
18
|
-
const remove = addValue(element, state, key, value);
|
|
19
|
-
subscriptions.push(remove);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return () => {
|
|
23
|
-
for (const cancel of subscriptions)
|
|
24
|
-
cancel();
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function addValue(element, state, key, value) {
|
|
8
|
+
const addStyleValue = (element, state, key, value) => {
|
|
28
9
|
let render = undefined;
|
|
29
10
|
let computed = undefined;
|
|
30
11
|
if (transformProps.has(key)) {
|
|
@@ -46,6 +27,7 @@ function addValue(element, state, key, value) {
|
|
|
46
27
|
};
|
|
47
28
|
}
|
|
48
29
|
return state.set(key, value, render, computed);
|
|
49
|
-
}
|
|
30
|
+
};
|
|
31
|
+
const styleEffect = createSelectorEffect(createEffect(addStyleValue));
|
|
50
32
|
|
|
51
|
-
export { styleEffect };
|
|
33
|
+
export { addStyleValue, styleEffect };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveElements } from '../../utils/resolve-elements.mjs';
|
|
2
|
+
|
|
3
|
+
function createSelectorEffect(subjectEffect) {
|
|
4
|
+
return (subject, values) => {
|
|
5
|
+
const elements = resolveElements(subject);
|
|
6
|
+
const subscriptions = [];
|
|
7
|
+
for (const element of elements) {
|
|
8
|
+
const remove = subjectEffect(element, values);
|
|
9
|
+
subscriptions.push(remove);
|
|
10
|
+
}
|
|
11
|
+
return () => {
|
|
12
|
+
for (const remove of subscriptions)
|
|
13
|
+
remove();
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { createSelectorEffect };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MotionValueState } from '../MotionValueState.mjs';
|
|
2
|
+
|
|
3
|
+
function createEffect(addValue) {
|
|
4
|
+
const stateCache = new WeakMap();
|
|
5
|
+
const subscriptions = [];
|
|
6
|
+
return (subject, values) => {
|
|
7
|
+
const state = stateCache.get(subject) ?? new MotionValueState();
|
|
8
|
+
stateCache.set(subject, state);
|
|
9
|
+
for (const key in values) {
|
|
10
|
+
const value = values[key];
|
|
11
|
+
const remove = addValue(subject, state, key, value);
|
|
12
|
+
subscriptions.push(remove);
|
|
13
|
+
}
|
|
14
|
+
return () => {
|
|
15
|
+
for (const cancel of subscriptions)
|
|
16
|
+
cancel();
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { createEffect };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isHTMLElement } from '../../utils/is-html-element.mjs';
|
|
1
2
|
import { isDragActive } from '../drag/state/is-active.mjs';
|
|
2
3
|
import { isNodeOrChild } from '../utils/is-node-or-child.mjs';
|
|
3
4
|
import { isPrimaryPointer } from '../utils/is-primary-pointer.mjs';
|
|
@@ -68,7 +69,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
68
69
|
targets.forEach((target) => {
|
|
69
70
|
const pointerDownTarget = options.useGlobalTarget ? window : target;
|
|
70
71
|
pointerDownTarget.addEventListener("pointerdown", startPress, eventOptions);
|
|
71
|
-
if (target
|
|
72
|
+
if (isHTMLElement(target)) {
|
|
72
73
|
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions));
|
|
73
74
|
if (!isElementKeyboardAccessible(target) &&
|
|
74
75
|
!target.hasAttribute("tabindex")) {
|
package/dist/es/index.mjs
CHANGED
|
@@ -31,7 +31,7 @@ export { supportsPartialKeyframes } from './animation/waapi/supports/partial-key
|
|
|
31
31
|
export { supportsBrowserAnimation } from './animation/waapi/supports/waapi.mjs';
|
|
32
32
|
export { acceleratedValues } from './animation/waapi/utils/accelerated-values.mjs';
|
|
33
33
|
export { generateLinearEasing } from './animation/waapi/utils/linear.mjs';
|
|
34
|
-
export { styleEffect } from './effects/style/index.mjs';
|
|
34
|
+
export { addStyleValue, styleEffect } from './effects/style/index.mjs';
|
|
35
35
|
export { createRenderBatcher } from './frameloop/batcher.mjs';
|
|
36
36
|
export { cancelMicrotask, microtask } from './frameloop/microtask.mjs';
|
|
37
37
|
export { time } from './frameloop/sync-time.mjs';
|
|
@@ -51,6 +51,9 @@ export { recordStats } from './stats/index.mjs';
|
|
|
51
51
|
export { activeAnimations } from './stats/animation-count.mjs';
|
|
52
52
|
export { statsBuffer } from './stats/buffer.mjs';
|
|
53
53
|
export { interpolate } from './utils/interpolate.mjs';
|
|
54
|
+
export { isHTMLElement } from './utils/is-html-element.mjs';
|
|
55
|
+
export { isSVGElement } from './utils/is-svg-element.mjs';
|
|
56
|
+
export { isSVGSVGElement } from './utils/is-svg-svg-element.mjs';
|
|
54
57
|
export { mix } from './utils/mix/index.mjs';
|
|
55
58
|
export { mixColor, mixLinearColor } from './utils/mix/color.mjs';
|
|
56
59
|
export { getMixer, mixArray, mixComplex, mixObject } from './utils/mix/complex.mjs';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isObject } from 'motion-utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if an element is an HTML element in a way
|
|
5
|
+
* that works across iframes
|
|
6
|
+
*/
|
|
7
|
+
function isHTMLElement(element) {
|
|
8
|
+
return isObject(element) && "offsetHeight" in element;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { isHTMLElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isObject } from 'motion-utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if an element is an SVG element in a way
|
|
5
|
+
* that works across iframes
|
|
6
|
+
*/
|
|
7
|
+
function isSVGElement(element) {
|
|
8
|
+
return isObject(element) && "ownerSVGElement" in element;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { isSVGElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isSVGElement } from './is-svg-element.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if an element is specifically an SVGSVGElement (the root SVG element)
|
|
5
|
+
* in a way that works across iframes
|
|
6
|
+
*/
|
|
7
|
+
function isSVGSVGElement(element) {
|
|
8
|
+
return isSVGElement(element) && element.tagName === "svg";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { isSVGSVGElement };
|
package/dist/index.d.ts
CHANGED
|
@@ -895,7 +895,7 @@ declare class JSAnimation<T extends number | string> extends WithPromise impleme
|
|
|
895
895
|
* This method is bound to the instance to fix a pattern where
|
|
896
896
|
* animation.stop is returned as a reference from a useEffect.
|
|
897
897
|
*/
|
|
898
|
-
stop: (
|
|
898
|
+
stop: () => void;
|
|
899
899
|
complete(): void;
|
|
900
900
|
finish(): void;
|
|
901
901
|
cancel(): void;
|
|
@@ -1074,20 +1074,18 @@ declare const acceleratedValues: Set<string>;
|
|
|
1074
1074
|
|
|
1075
1075
|
declare const generateLinearEasing: (easing: EasingFunction, duration: number, resolution?: number) => string;
|
|
1076
1076
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
interface SelectorCache {
|
|
1086
|
-
[key: string]: NodeListOf<Element>;
|
|
1077
|
+
declare class MotionValueState {
|
|
1078
|
+
latest: {
|
|
1079
|
+
[name: string]: string | number;
|
|
1080
|
+
};
|
|
1081
|
+
private values;
|
|
1082
|
+
set(name: string, value: MotionValue, render?: VoidFunction, computed?: MotionValue, useDefaultValueType?: boolean): () => void;
|
|
1083
|
+
get(name: string): MotionValue | undefined;
|
|
1084
|
+
destroy(): void;
|
|
1087
1085
|
}
|
|
1088
|
-
declare function resolveElements(elementOrSelector: ElementOrSelector, scope?: AnimationScope, selectorCache?: SelectorCache): Element[];
|
|
1089
1086
|
|
|
1090
|
-
declare
|
|
1087
|
+
declare const addStyleValue: (element: HTMLElement | SVGElement, state: MotionValueState, key: string, value: MotionValue) => () => void;
|
|
1088
|
+
declare const styleEffect: (subject: ElementOrSelector, values: Record<string, MotionValue<any>>) => () => void;
|
|
1091
1089
|
|
|
1092
1090
|
declare const frame: Batcher;
|
|
1093
1091
|
declare const cancelFrame: (process: Process) => void;
|
|
@@ -1146,6 +1144,19 @@ declare function isDragActive(): boolean;
|
|
|
1146
1144
|
|
|
1147
1145
|
declare function setDragLock(axis: boolean | "x" | "y" | "lockDirection"): (() => void) | null;
|
|
1148
1146
|
|
|
1147
|
+
type ElementOrSelector = Element | Element[] | NodeListOf<Element> | string;
|
|
1148
|
+
interface WithQuerySelectorAll {
|
|
1149
|
+
querySelectorAll: Element["querySelectorAll"];
|
|
1150
|
+
}
|
|
1151
|
+
interface AnimationScope<T = any> {
|
|
1152
|
+
readonly current: T;
|
|
1153
|
+
animations: any[];
|
|
1154
|
+
}
|
|
1155
|
+
interface SelectorCache {
|
|
1156
|
+
[key: string]: NodeListOf<Element>;
|
|
1157
|
+
}
|
|
1158
|
+
declare function resolveElements(elementOrSelector: ElementOrSelector, scope?: AnimationScope, selectorCache?: SelectorCache): Element[];
|
|
1159
|
+
|
|
1149
1160
|
/**
|
|
1150
1161
|
* Options for event listeners.
|
|
1151
1162
|
*
|
|
@@ -1335,6 +1346,24 @@ interface InterpolateOptions<T> {
|
|
|
1335
1346
|
*/
|
|
1336
1347
|
declare function interpolate<T>(input: number[], output: T[], { clamp: isClamp, ease, mixer }?: InterpolateOptions<T>): (v: number) => T;
|
|
1337
1348
|
|
|
1349
|
+
/**
|
|
1350
|
+
* Checks if an element is an HTML element in a way
|
|
1351
|
+
* that works across iframes
|
|
1352
|
+
*/
|
|
1353
|
+
declare function isHTMLElement(element: unknown): element is HTMLElement;
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Checks if an element is an SVG element in a way
|
|
1357
|
+
* that works across iframes
|
|
1358
|
+
*/
|
|
1359
|
+
declare function isSVGElement(element: unknown): element is SVGElement;
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Checks if an element is specifically an SVGSVGElement (the root SVG element)
|
|
1363
|
+
* in a way that works across iframes
|
|
1364
|
+
*/
|
|
1365
|
+
declare function isSVGSVGElement(element: unknown): element is SVGSVGElement;
|
|
1366
|
+
|
|
1338
1367
|
declare function mix<T>(from: T, to: T): Mixer<T>;
|
|
1339
1368
|
declare function mix(from: number, to: number, p: number): number;
|
|
1340
1369
|
|
|
@@ -1816,4 +1845,4 @@ declare const sync: Batcher;
|
|
|
1816
1845
|
*/
|
|
1817
1846
|
declare const cancelSync: Record<string, (process: Process) => void>;
|
|
1818
1847
|
|
|
1819
|
-
export { type AcceptedAnimations, type ActiveStatsBuffer, type AnimationGeneratorType, type AnimationOptions, type AnimationOptionsWithValueOverrides, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, AsyncMotionValueAnimation, type Batcher, type CSSStyleDeclarationWithTransform, type CSSVariableName, type CSSVariableToken, type CancelProcess, type Color, type ComplexValueInfo, type ComplexValues, type DOMKeyframesDefinition, DOMKeyframesResolver, type DOMValueAnimationOptions, type DecayOptions, type DurationSpringOptions, type DynamicOption, type ElementOrSelector, type EventOptions, type FrameData, type FrameStats, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type HSLA, type InactiveStatsBuffer, type InertiaOptions, type InterpolateOptions, JSAnimation, type KeyframeGenerator, type KeyframeOptions, KeyframeResolver, type MapInputRange, type Mixer, type MixerFactory, MotionValue, type MotionValueEventCallbacks, type MotionValueOptions, type MultiTransformer, NativeAnimation, NativeAnimationExtended, type NativeAnimationOptions, type NativeAnimationOptionsExtended, NativeAnimationWrapper, type NumberMap, type OnHoverEndEvent, type OnHoverStartEvent, type OnKeyframesResolved, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PassiveEffect, type PointerEventOptions, type PressGestureInfo, type Process, type ProgressTimeline, type RGBA, type RepeatType, type ResolvedKeyframes, type ResolvedValueKeyframe, type SVGAttributes, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGTransitions, type Schedule, type SelectorCache, type SingleTransformer, type SpringOptions, type StartAnimation, type Stats, type StatsBuffer, type StatsRecording, type StatsSummary, type Step, type StepId, type Steps, type StyleKeyframesDefinition, type StyleTransitions, type Subscriber, type Summary, type Target, type TimelineWithFallback, type TransformInputRange, type TransformOptions, type TransformProperties, type Transformer, type Transition, type UnresolvedKeyframes, type UnresolvedValueKeyframe, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueIndexes, type ValueKeyframe, type ValueKeyframesDefinition, type ValueTransformer, type ValueType, type ValueTypeMap, type VariableKeyframesDefinition, type VariableTransitions, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type WithQuerySelectorAll, acceleratedValues, activeAnimations, alpha, analyseComplexValue, animateValue, animateView, animationMapKey, applyPxDefaults, attachSpring, calcGeneratorDuration, cancelFrame, cancelMicrotask, cancelSync, collectMotionValues, color, complex, convertOffsetToTimes, createGeneratorEasing, createRenderBatcher, cubicBezierAsString, defaultEasing, defaultOffset, defaultTransformValue, defaultValueTypes, degrees, dimensionValueTypes, fillOffset, fillWildcards, findDimensionValueType, findValueType, flushKeyframeResolvers, frame, frameData, frameSteps, generateLinearEasing, getAnimatableNone, getAnimationMap, getComputedStyle, getDefaultValueType, getMixer, getValueAsType, getValueTransition, getVariableValue, hex, hover, hsla, hslaToRgba, inertia, interpolate, invisibleValues, isCSSVariableName, isCSSVariableToken, isDragActive, isDragging, isGenerator, isMotionValue, isNodeOrChild, isPrimaryPointer, isWaapiSupportedEasing, keyframes, mapEasingToNativeEasing, mapValue, maxGeneratorDuration, microtask, mix, mixArray, mixColor, mixComplex, mixImmediate, mixLinearColor, mixNumber, mixObject, mixVisibility, motionValue, number, numberValueTypes, observeTimeline, parseCSSVariable, parseValueFromTransform, percent, positionalKeys, press, progressPercentage, px, readTransformValue, recordStats, resolveElements, rgbUnit, rgba, scale, setDragLock, setStyle, spring, springValue, startWaapiAnimation, statsBuffer, styleEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, sync, testValueType, time, transform, transformPropOrder, transformProps, transformValue, transformValueTypes, vh, vw };
|
|
1848
|
+
export { type AcceptedAnimations, type ActiveStatsBuffer, type AnimationGeneratorType, type AnimationOptions, type AnimationOptionsWithValueOverrides, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, AsyncMotionValueAnimation, type Batcher, type CSSStyleDeclarationWithTransform, type CSSVariableName, type CSSVariableToken, type CancelProcess, type Color, type ComplexValueInfo, type ComplexValues, type DOMKeyframesDefinition, DOMKeyframesResolver, type DOMValueAnimationOptions, type DecayOptions, type DurationSpringOptions, type DynamicOption, type ElementOrSelector, type EventOptions, type FrameData, type FrameStats, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type HSLA, type InactiveStatsBuffer, type InertiaOptions, type InterpolateOptions, JSAnimation, type KeyframeGenerator, type KeyframeOptions, KeyframeResolver, type MapInputRange, type Mixer, type MixerFactory, MotionValue, type MotionValueEventCallbacks, type MotionValueOptions, type MultiTransformer, NativeAnimation, NativeAnimationExtended, type NativeAnimationOptions, type NativeAnimationOptionsExtended, NativeAnimationWrapper, type NumberMap, type OnHoverEndEvent, type OnHoverStartEvent, type OnKeyframesResolved, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PassiveEffect, type PointerEventOptions, type PressGestureInfo, type Process, type ProgressTimeline, type RGBA, type RepeatType, type ResolvedKeyframes, type ResolvedValueKeyframe, type SVGAttributes, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGTransitions, type Schedule, type SelectorCache, type SingleTransformer, type SpringOptions, type StartAnimation, type Stats, type StatsBuffer, type StatsRecording, type StatsSummary, type Step, type StepId, type Steps, type StyleKeyframesDefinition, type StyleTransitions, type Subscriber, type Summary, type Target, type TimelineWithFallback, type TransformInputRange, type TransformOptions, type TransformProperties, type Transformer, type Transition, type UnresolvedKeyframes, type UnresolvedValueKeyframe, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueIndexes, type ValueKeyframe, type ValueKeyframesDefinition, type ValueTransformer, type ValueType, type ValueTypeMap, type VariableKeyframesDefinition, type VariableTransitions, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type WithQuerySelectorAll, acceleratedValues, activeAnimations, addStyleValue, alpha, analyseComplexValue, animateValue, animateView, animationMapKey, applyPxDefaults, attachSpring, calcGeneratorDuration, cancelFrame, cancelMicrotask, cancelSync, collectMotionValues, color, complex, convertOffsetToTimes, createGeneratorEasing, createRenderBatcher, cubicBezierAsString, defaultEasing, defaultOffset, defaultTransformValue, defaultValueTypes, degrees, dimensionValueTypes, fillOffset, fillWildcards, findDimensionValueType, findValueType, flushKeyframeResolvers, frame, frameData, frameSteps, generateLinearEasing, getAnimatableNone, getAnimationMap, getComputedStyle, getDefaultValueType, getMixer, getValueAsType, getValueTransition, getVariableValue, hex, hover, hsla, hslaToRgba, inertia, interpolate, invisibleValues, isCSSVariableName, isCSSVariableToken, isDragActive, isDragging, isGenerator, isHTMLElement, isMotionValue, isNodeOrChild, isPrimaryPointer, isSVGElement, isSVGSVGElement, isWaapiSupportedEasing, keyframes, mapEasingToNativeEasing, mapValue, maxGeneratorDuration, microtask, mix, mixArray, mixColor, mixComplex, mixImmediate, mixLinearColor, mixNumber, mixObject, mixVisibility, motionValue, number, numberValueTypes, observeTimeline, parseCSSVariable, parseValueFromTransform, percent, positionalKeys, press, progressPercentage, px, readTransformValue, recordStats, resolveElements, rgbUnit, rgba, scale, setDragLock, setStyle, spring, springValue, startWaapiAnimation, statsBuffer, styleEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, sync, testValueType, time, transform, transformPropOrder, transformProps, transformValue, transformValueTypes, vh, vw };
|
package/dist/motion-dom.dev.js
CHANGED
|
@@ -1304,12 +1304,10 @@
|
|
|
1304
1304
|
* This method is bound to the instance to fix a pattern where
|
|
1305
1305
|
* animation.stop is returned as a reference from a useEffect.
|
|
1306
1306
|
*/
|
|
1307
|
-
this.stop = (
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
this.tick(time.now());
|
|
1312
|
-
}
|
|
1307
|
+
this.stop = () => {
|
|
1308
|
+
const { motionValue } = this.options;
|
|
1309
|
+
if (motionValue && motionValue.updatedAt !== time.now()) {
|
|
1310
|
+
this.tick(time.now());
|
|
1313
1311
|
}
|
|
1314
1312
|
this.isStopped = true;
|
|
1315
1313
|
if (this.state === "idle")
|
|
@@ -2302,6 +2300,14 @@
|
|
|
2302
2300
|
((type === "spring" || isGenerator(type)) && velocity));
|
|
2303
2301
|
}
|
|
2304
2302
|
|
|
2303
|
+
/**
|
|
2304
|
+
* Checks if an element is an HTML element in a way
|
|
2305
|
+
* that works across iframes
|
|
2306
|
+
*/
|
|
2307
|
+
function isHTMLElement(element) {
|
|
2308
|
+
return motionUtils.isObject(element) && "offsetHeight" in element;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2305
2311
|
/**
|
|
2306
2312
|
* A list of values that can be hardware-accelerated.
|
|
2307
2313
|
*/
|
|
@@ -2310,16 +2316,13 @@
|
|
|
2310
2316
|
"clipPath",
|
|
2311
2317
|
"filter",
|
|
2312
2318
|
"transform",
|
|
2313
|
-
// TODO:
|
|
2314
|
-
// or until we implement support for linear() easing.
|
|
2319
|
+
// TODO: Could be re-enabled now we have support for linear() easing
|
|
2315
2320
|
// "background-color"
|
|
2316
2321
|
]);
|
|
2317
2322
|
const supportsWaapi = /*@__PURE__*/ motionUtils.memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
2318
2323
|
function supportsBrowserAnimation(options) {
|
|
2319
2324
|
const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
|
|
2320
|
-
if (!motionValue
|
|
2321
|
-
!motionValue.owner ||
|
|
2322
|
-
!(motionValue.owner.current instanceof HTMLElement)) {
|
|
2325
|
+
if (!isHTMLElement(motionValue?.owner?.current)) {
|
|
2323
2326
|
return false;
|
|
2324
2327
|
}
|
|
2325
2328
|
const { onUpdate, transformTemplate } = motionValue.owner.getProps();
|
|
@@ -3046,22 +3049,6 @@
|
|
|
3046
3049
|
// "background-color"
|
|
3047
3050
|
]);
|
|
3048
3051
|
|
|
3049
|
-
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
3050
|
-
if (elementOrSelector instanceof EventTarget) {
|
|
3051
|
-
return [elementOrSelector];
|
|
3052
|
-
}
|
|
3053
|
-
else if (typeof elementOrSelector === "string") {
|
|
3054
|
-
let root = document;
|
|
3055
|
-
if (scope) {
|
|
3056
|
-
root = scope.current;
|
|
3057
|
-
}
|
|
3058
|
-
const elements = selectorCache?.[elementOrSelector] ??
|
|
3059
|
-
root.querySelectorAll(elementOrSelector);
|
|
3060
|
-
return elements ? Array.from(elements) : [];
|
|
3061
|
-
}
|
|
3062
|
-
return Array.from(elementOrSelector);
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
3052
|
/**
|
|
3066
3053
|
* Maximum time between the value of two frames, beyond which we
|
|
3067
3054
|
* assume the velocity has since been 0.
|
|
@@ -3384,6 +3371,37 @@
|
|
|
3384
3371
|
return new MotionValue(init, options);
|
|
3385
3372
|
}
|
|
3386
3373
|
|
|
3374
|
+
function resolveElements(elementOrSelector, scope, selectorCache) {
|
|
3375
|
+
if (elementOrSelector instanceof EventTarget) {
|
|
3376
|
+
return [elementOrSelector];
|
|
3377
|
+
}
|
|
3378
|
+
else if (typeof elementOrSelector === "string") {
|
|
3379
|
+
let root = document;
|
|
3380
|
+
if (scope) {
|
|
3381
|
+
root = scope.current;
|
|
3382
|
+
}
|
|
3383
|
+
const elements = selectorCache?.[elementOrSelector] ??
|
|
3384
|
+
root.querySelectorAll(elementOrSelector);
|
|
3385
|
+
return elements ? Array.from(elements) : [];
|
|
3386
|
+
}
|
|
3387
|
+
return Array.from(elementOrSelector);
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
function createSelectorEffect(subjectEffect) {
|
|
3391
|
+
return (subject, values) => {
|
|
3392
|
+
const elements = resolveElements(subject);
|
|
3393
|
+
const subscriptions = [];
|
|
3394
|
+
for (const element of elements) {
|
|
3395
|
+
const remove = subjectEffect(element, values);
|
|
3396
|
+
subscriptions.push(remove);
|
|
3397
|
+
}
|
|
3398
|
+
return () => {
|
|
3399
|
+
for (const remove of subscriptions)
|
|
3400
|
+
remove();
|
|
3401
|
+
};
|
|
3402
|
+
};
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3387
3405
|
/**
|
|
3388
3406
|
* Provided a value and a ValueType, returns the value as that value type.
|
|
3389
3407
|
*/
|
|
@@ -3398,13 +3416,19 @@
|
|
|
3398
3416
|
this.latest = {};
|
|
3399
3417
|
this.values = new Map();
|
|
3400
3418
|
}
|
|
3401
|
-
set(name, value, render, computed) {
|
|
3419
|
+
set(name, value, render, computed, useDefaultValueType = true) {
|
|
3402
3420
|
const existingValue = this.values.get(name);
|
|
3403
3421
|
if (existingValue) {
|
|
3404
3422
|
existingValue.onRemove();
|
|
3405
3423
|
}
|
|
3406
3424
|
const onChange = () => {
|
|
3407
|
-
|
|
3425
|
+
const v = value.get();
|
|
3426
|
+
if (useDefaultValueType) {
|
|
3427
|
+
this.latest[name] = getValueAsType(v, numberValueTypes[name]);
|
|
3428
|
+
}
|
|
3429
|
+
else {
|
|
3430
|
+
this.latest[name] = v;
|
|
3431
|
+
}
|
|
3408
3432
|
render && frame.render(render);
|
|
3409
3433
|
};
|
|
3410
3434
|
onChange();
|
|
@@ -3429,6 +3453,24 @@
|
|
|
3429
3453
|
}
|
|
3430
3454
|
}
|
|
3431
3455
|
|
|
3456
|
+
function createEffect(addValue) {
|
|
3457
|
+
const stateCache = new WeakMap();
|
|
3458
|
+
const subscriptions = [];
|
|
3459
|
+
return (subject, values) => {
|
|
3460
|
+
const state = stateCache.get(subject) ?? new MotionValueState();
|
|
3461
|
+
stateCache.set(subject, state);
|
|
3462
|
+
for (const key in values) {
|
|
3463
|
+
const value = values[key];
|
|
3464
|
+
const remove = addValue(subject, state, key, value);
|
|
3465
|
+
subscriptions.push(remove);
|
|
3466
|
+
}
|
|
3467
|
+
return () => {
|
|
3468
|
+
for (const cancel of subscriptions)
|
|
3469
|
+
cancel();
|
|
3470
|
+
};
|
|
3471
|
+
};
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3432
3474
|
const translateAlias = {
|
|
3433
3475
|
x: "translateX",
|
|
3434
3476
|
y: "translateY",
|
|
@@ -3464,26 +3506,7 @@
|
|
|
3464
3506
|
return transformIsDefault ? "none" : transform.trim();
|
|
3465
3507
|
}
|
|
3466
3508
|
|
|
3467
|
-
const
|
|
3468
|
-
function styleEffect(subject, values) {
|
|
3469
|
-
const elements = resolveElements(subject);
|
|
3470
|
-
const subscriptions = [];
|
|
3471
|
-
for (let i = 0; i < elements.length; i++) {
|
|
3472
|
-
const element = elements[i];
|
|
3473
|
-
const state = stateMap.get(element) ?? new MotionValueState();
|
|
3474
|
-
stateMap.set(element, state);
|
|
3475
|
-
for (const key in values) {
|
|
3476
|
-
const value = values[key];
|
|
3477
|
-
const remove = addValue(element, state, key, value);
|
|
3478
|
-
subscriptions.push(remove);
|
|
3479
|
-
}
|
|
3480
|
-
}
|
|
3481
|
-
return () => {
|
|
3482
|
-
for (const cancel of subscriptions)
|
|
3483
|
-
cancel();
|
|
3484
|
-
};
|
|
3485
|
-
}
|
|
3486
|
-
function addValue(element, state, key, value) {
|
|
3509
|
+
const addStyleValue = (element, state, key, value) => {
|
|
3487
3510
|
let render = undefined;
|
|
3488
3511
|
let computed = undefined;
|
|
3489
3512
|
if (transformProps.has(key)) {
|
|
@@ -3505,7 +3528,8 @@
|
|
|
3505
3528
|
};
|
|
3506
3529
|
}
|
|
3507
3530
|
return state.set(key, value, render, computed);
|
|
3508
|
-
}
|
|
3531
|
+
};
|
|
3532
|
+
const styleEffect = createSelectorEffect(createEffect(addStyleValue));
|
|
3509
3533
|
|
|
3510
3534
|
const { schedule: microtask, cancel: cancelMicrotask } =
|
|
3511
3535
|
/* @__PURE__ */ createRenderBatcher(queueMicrotask, false);
|
|
@@ -3735,7 +3759,7 @@
|
|
|
3735
3759
|
targets.forEach((target) => {
|
|
3736
3760
|
const pointerDownTarget = options.useGlobalTarget ? window : target;
|
|
3737
3761
|
pointerDownTarget.addEventListener("pointerdown", startPress, eventOptions);
|
|
3738
|
-
if (target
|
|
3762
|
+
if (isHTMLElement(target)) {
|
|
3739
3763
|
target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions));
|
|
3740
3764
|
if (!isElementKeyboardAccessible(target) &&
|
|
3741
3765
|
!target.hasAttribute("tabindex")) {
|
|
@@ -3880,6 +3904,22 @@
|
|
|
3880
3904
|
return reportStats;
|
|
3881
3905
|
}
|
|
3882
3906
|
|
|
3907
|
+
/**
|
|
3908
|
+
* Checks if an element is an SVG element in a way
|
|
3909
|
+
* that works across iframes
|
|
3910
|
+
*/
|
|
3911
|
+
function isSVGElement(element) {
|
|
3912
|
+
return motionUtils.isObject(element) && "ownerSVGElement" in element;
|
|
3913
|
+
}
|
|
3914
|
+
|
|
3915
|
+
/**
|
|
3916
|
+
* Checks if an element is specifically an SVGSVGElement (the root SVG element)
|
|
3917
|
+
* in a way that works across iframes
|
|
3918
|
+
*/
|
|
3919
|
+
function isSVGSVGElement(element) {
|
|
3920
|
+
return isSVGElement(element) && element.tagName === "svg";
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3883
3923
|
function transform(...args) {
|
|
3884
3924
|
const useImmediate = !Array.isArray(args[0]);
|
|
3885
3925
|
const argOffset = useImmediate ? 0 : -1;
|
|
@@ -4391,6 +4431,7 @@
|
|
|
4391
4431
|
exports.ViewTransitionBuilder = ViewTransitionBuilder;
|
|
4392
4432
|
exports.acceleratedValues = acceleratedValues;
|
|
4393
4433
|
exports.activeAnimations = activeAnimations;
|
|
4434
|
+
exports.addStyleValue = addStyleValue;
|
|
4394
4435
|
exports.alpha = alpha;
|
|
4395
4436
|
exports.analyseComplexValue = analyseComplexValue;
|
|
4396
4437
|
exports.animateValue = animateValue;
|
|
@@ -4444,9 +4485,12 @@
|
|
|
4444
4485
|
exports.isDragActive = isDragActive;
|
|
4445
4486
|
exports.isDragging = isDragging;
|
|
4446
4487
|
exports.isGenerator = isGenerator;
|
|
4488
|
+
exports.isHTMLElement = isHTMLElement;
|
|
4447
4489
|
exports.isMotionValue = isMotionValue;
|
|
4448
4490
|
exports.isNodeOrChild = isNodeOrChild;
|
|
4449
4491
|
exports.isPrimaryPointer = isPrimaryPointer;
|
|
4492
|
+
exports.isSVGElement = isSVGElement;
|
|
4493
|
+
exports.isSVGSVGElement = isSVGSVGElement;
|
|
4450
4494
|
exports.isWaapiSupportedEasing = isWaapiSupportedEasing;
|
|
4451
4495
|
exports.keyframes = keyframes;
|
|
4452
4496
|
exports.mapEasingToNativeEasing = mapEasingToNativeEasing;
|
package/dist/motion-dom.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("motion-utils")):"function"==typeof define&&define.amd?define(["exports","motion-utils"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).MotionDom={},t.MotionUtils)}(this,(function(t,e){"use strict";const n=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],s={value:null,addProjectionMetrics:null};function i(t,i){let r=!1,a=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>r=!0,u=n.reduce(((t,e)=>(t[e]=function(t,e){let n=new Set,i=new Set,r=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},u=0;function c(e){o.has(e)&&(h.schedule(e),t()),u++,e(l)}const h={schedule:(t,e=!1,s=!1)=>{const a=s&&r?n:i;return e&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),o.delete(t)},process:t=>{l=t,r?a=!0:(r=!0,[n,i]=[i,n],n.forEach(c),e&&s.value&&s.value.frameloop[e].push(u),u=0,n.clear(),r=!1,a&&(a=!1,h.process(t)))}};return h}(l,i?e:void 0),t)),{}),{setup:c,read:h,resolveKeyframes:d,preUpdate:m,update:p,preRender:f,render:y,postRender:g}=u,v=()=>{const n=e.MotionGlobalConfig.useManualTiming?o.timestamp:performance.now();r=!1,e.MotionGlobalConfig.useManualTiming||(o.delta=a?1e3/60:Math.max(Math.min(n-o.timestamp,40),1)),o.timestamp=n,o.isProcessing=!0,c.process(o),h.process(o),d.process(o),m.process(o),p.process(o),f.process(o),y.process(o),g.process(o),o.isProcessing=!1,r&&i&&(a=!1,t(v))};return{schedule:n.reduce(((e,n)=>{const s=u[n];return e[n]=(e,n=!1,i=!1)=>(r||(r=!0,a=!0,o.isProcessing||t(v)),s.schedule(e,n,i)),e}),{}),cancel:t=>{for(let e=0;e<n.length;e++)u[n[e]].cancel(t)},state:o,steps:u}}const{schedule:r,cancel:a,state:o,steps:l}=i("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:e.noop,!0);let u;function c(){u=void 0}const h={now:()=>(void 0===u&&h.set(o.isProcessing||e.MotionGlobalConfig.useManualTiming?o.timestamp:performance.now()),u),set:t=>{u=t,queueMicrotask(c)}},d={layout:0,mainThread:0,waapi:0},m=t=>e=>"string"==typeof e&&e.startsWith(t),p=m("--"),f=m("var(--"),y=t=>!!f(t)&&g.test(t.split("/*")[0].trim()),g=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,v={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},T={...v,transform:t=>e.clamp(0,1,t)},b={...v,default:1},w=t=>Math.round(1e5*t)/1e5,M=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const x=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,A=(t,e)=>n=>Boolean("string"==typeof n&&x.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),S=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,a,o]=s.match(M);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},k={...v,transform:t=>Math.round((t=>e.clamp(0,255,t))(t))},E={test:A("rgb","red"),parse:S("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+k.transform(t)+", "+k.transform(e)+", "+k.transform(n)+", "+w(T.transform(s))+")"};const V={test:A("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:E.transform},P=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),R=P("deg"),D=P("%"),F=P("px"),C=P("vh"),K=P("vw"),O=(()=>({...D,parse:t=>D.parse(t)/100,transform:t=>D.transform(100*t)}))(),L={test:A("hsl","hue"),parse:S("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+D.transform(w(e))+", "+D.transform(w(n))+", "+w(T.transform(s))+")"},W={test:t=>E.test(t)||V.test(t)||L.test(t),parse:t=>E.test(t)?E.parse(t):L.test(t)?L.parse(t):V.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?E.transform(t):L.transform(t)},$=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const B="number",N="color",j=/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 I(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(j,(t=>(W.test(t)?(s.color.push(r),i.push(N),n.push(W.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(B),n.push(parseFloat(t))),++r,"${}"))).split("${}");return{values:n,split:a,indexes:s,types:i}}function Y(t){return I(t).values}function X(t){const{split:e,types:n}=I(t),s=e.length;return t=>{let i="";for(let r=0;r<s;r++)if(i+=e[r],void 0!==t[r]){const e=n[r];i+=e===B?w(t[r]):e===N?W.transform(t[r]):t[r]}return i}}const U=t=>"number"==typeof t?0:t;const q={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(M)?.length||0)+(t.match($)?.length||0)>0},parse:Y,createTransformer:X,getAnimatableNone:function(t){const e=Y(t);return X(t)(e.map(U))}};function G(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function z({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,a=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,o=2*n-s;i=G(o,s,t+1/3),r=G(o,s,t),a=G(o,s,t-1/3)}else i=r=a=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*a),alpha:s}}function Z(t,e){return n=>n>0?e:t}const _=(t,e,n)=>t+(e-t)*n,H=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},J=[V,E,L];function Q(t){const n=(s=t,J.find((t=>t.test(s))));var s;if(e.warning(Boolean(n),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(n))return!1;let i=n.parse(t);return n===L&&(i=z(i)),i}const tt=(t,e)=>{const n=Q(t),s=Q(e);if(!n||!s)return Z(t,e);const i={...n};return t=>(i.red=H(n.red,s.red,t),i.green=H(n.green,s.green,t),i.blue=H(n.blue,s.blue,t),i.alpha=_(n.alpha,s.alpha,t),E.transform(i))},et=new Set(["none","hidden"]);function nt(t,e){return et.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function st(t,e){return n=>_(t,e,n)}function it(t){return"number"==typeof t?st:"string"==typeof t?y(t)?Z:W.test(t)?tt:ot:Array.isArray(t)?rt:"object"==typeof t?W.test(t)?tt:at:Z}function rt(t,e){const n=[...t],s=n.length,i=t.map(((t,n)=>it(t)(t,e[n])));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}}function at(t,e){const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=it(t[i])(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}}const ot=(t,n)=>{const s=q.createTransformer(n),i=I(t),r=I(n);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?et.has(t)&&!r.values.length||et.has(n)&&!i.values.length?nt(t,n):e.pipe(rt(function(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],a=t.indexes[r][s[r]],o=t.values[a]??0;n[i]=o,s[r]++}return n}(i,r),r.values),s):(e.warning(!0,`Complex values '${t}' and '${n}' 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.`),Z(t,n))};function lt(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return _(t,e,n);return it(t)(t,e)}const ut=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>r.update(e,t),stop:()=>a(e),now:()=>o.isProcessing?o.timestamp:h.now()}},ct=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)s+=t(e/(i-1))+", ";return`linear(${s.substring(0,s.length-2)})`},ht=2e4;function dt(t){let e=0;let n=t.next(e);for(;!n.done&&e<ht;)e+=50,n=t.next(e);return e>=ht?1/0:e}function mt(t,n=100,s){const i=s({...t,keyframes:[0,n]}),r=Math.min(dt(i),ht);return{type:"keyframes",ease:t=>i.next(r*t).value/n,duration:e.millisecondsToSeconds(r)}}function pt(t,n,s){const i=Math.max(n-5,0);return e.velocityPerSecond(s-t(i),n-i)}const ft=100,yt=10,gt=1,vt=0,Tt=800,bt=.3,wt=.3,Mt={granular:.01,default:2},xt={granular:.005,default:.5},At=.01,St=10,kt=.05,Et=1,Vt=.001;function Pt({duration:t=Tt,bounce:n=bt,velocity:s=vt,mass:i=gt}){let r,a;e.warning(t<=e.secondsToMilliseconds(St),"Spring duration must be 10 seconds or less");let o=1-n;o=e.clamp(kt,Et,o),t=e.clamp(At,St,e.millisecondsToSeconds(t)),o<1?(r=e=>{const n=e*o,i=n*t,r=n-s,a=Dt(e,o),l=Math.exp(-i);return Vt-r/a*l},a=e=>{const n=e*o*t,i=n*s+s,a=Math.pow(o,2)*Math.pow(e,2)*t,l=Math.exp(-n),u=Dt(Math.pow(e,2),o);return(-r(e)+Vt>0?-1:1)*((i-a)*l)/u}):(r=e=>Math.exp(-e*t)*((e-s)*t+1)-.001,a=e=>Math.exp(-e*t)*(t*t*(s-e)));const l=function(t,e,n){let s=n;for(let n=1;n<Rt;n++)s-=t(s)/e(s);return s}(r,a,5/t);if(t=e.secondsToMilliseconds(t),isNaN(l))return{stiffness:ft,damping:yt,duration:t};{const e=Math.pow(l,2)*i;return{stiffness:e,damping:2*o*Math.sqrt(i*e),duration:t}}}const Rt=12;function Dt(t,e){return t*Math.sqrt(1-e*e)}const Ft=["duration","bounce"],Ct=["stiffness","damping","mass"];function Kt(t,e){return e.some((e=>void 0!==t[e]))}function Ot(t=wt,n=bt){const s="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:n}:t;let{restSpeed:i,restDelta:r}=s;const a=s.keyframes[0],o=s.keyframes[s.keyframes.length-1],l={done:!1,value:a},{stiffness:u,damping:c,mass:h,duration:d,velocity:m,isResolvedFromDuration:p}=function(t){let n={velocity:vt,stiffness:ft,damping:yt,mass:gt,isResolvedFromDuration:!1,...t};if(!Kt(t,Ct)&&Kt(t,Ft))if(t.visualDuration){const s=t.visualDuration,i=2*Math.PI/(1.2*s),r=i*i,a=2*e.clamp(.05,1,1-(t.bounce||0))*Math.sqrt(r);n={...n,mass:gt,stiffness:r,damping:a}}else{const e=Pt(t);n={...n,...e,mass:gt},n.isResolvedFromDuration=!0}return n}({...s,velocity:-e.millisecondsToSeconds(s.velocity||0)}),f=m||0,y=c/(2*Math.sqrt(u*h)),g=o-a,v=e.millisecondsToSeconds(Math.sqrt(u/h)),T=Math.abs(g)<5;let b;if(i||(i=T?Mt.granular:Mt.default),r||(r=T?xt.granular:xt.default),y<1){const t=Dt(v,y);b=e=>{const n=Math.exp(-y*v*e);return o-n*((f+y*v*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===y)b=t=>o-Math.exp(-v*t)*(g+(f+v*g)*t);else{const t=v*Math.sqrt(y*y-1);b=e=>{const n=Math.exp(-y*v*e),s=Math.min(t*e,300);return o-n*((f+y*v*g)*Math.sinh(s)+t*g*Math.cosh(s))/t}}const w={calculatedDuration:p&&d||null,next:t=>{const n=b(t);if(p)l.done=t>=d;else{let s=0===t?f:0;y<1&&(s=0===t?e.secondsToMilliseconds(f):pt(b,t,n));const a=Math.abs(s)<=i,u=Math.abs(o-n)<=r;l.done=a&&u}return l.value=l.done?o:n,l},toString:()=>{const t=Math.min(dt(w),ht),e=ct((e=>w.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return w}function Lt({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},m=t=>void 0===o?l:void 0===l||Math.abs(o-t)<Math.abs(l-t)?o:l;let p=n*e;const f=h+p,y=void 0===a?f:a(f);y!==f&&(p=y-h);const g=t=>-p*Math.exp(-t/s),v=t=>y+g(t),T=t=>{const e=g(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?y:n};let b,w;const M=t=>{var e;(e=d.value,void 0!==o&&e<o||void 0!==l&&e>l)&&(b=t,w=Ot({keyframes:[d.value,m(d.value)],velocity:pt(v,t,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:c}))};return M(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==b||(e=!0,T(t),M(t)),void 0!==b&&t>=b?w.next(t-b):(!e&&T(t),d)}}}function Wt(t,n,{clamp:s=!0,ease:i,mixer:r}={}){const a=t.length;if(e.invariant(a===n.length,"Both input and output ranges must be the same length"),1===a)return()=>n[0];if(2===a&&n[0]===n[1])return()=>n[1];const o=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),n=[...n].reverse());const l=function(t,n,s){const i=[],r=s||e.MotionGlobalConfig.mix||lt,a=t.length-1;for(let s=0;s<a;s++){let a=r(t[s],t[s+1]);if(n){const t=Array.isArray(n)?n[s]||e.noop:n;a=e.pipe(t,a)}i.push(a)}return i}(n,i,r),u=l.length,c=s=>{if(o&&s<t[0])return n[0];let i=0;if(u>1)for(;i<t.length-2&&!(s<t[i+1]);i++);const r=e.progress(t[i],t[i+1],s);return l[i](r)};return s?n=>c(e.clamp(t[0],t[a-1],n)):c}function $t(t,n){const s=t[t.length-1];for(let i=1;i<=n;i++){const r=e.progress(0,n,i);t.push(_(s,1,r))}}function Bt(t){const e=[0];return $t(e,t.length-1),e}function Nt(t,e){return t.map((t=>t*e))}function jt(t,n){return t.map((()=>n||e.easeInOut)).splice(0,t.length-1)}function It({duration:t=300,keyframes:n,times:s,ease:i="easeInOut"}){const r=e.isEasingArray(i)?i.map(e.easingDefinitionToFunction):e.easingDefinitionToFunction(i),a={done:!1,value:n[0]},o=Wt(Nt(s&&s.length===n.length?s:Bt(n),t),n,{ease:Array.isArray(r)?r:jt(n,r)});return{calculatedDuration:t,next:e=>(a.value=o(e),a.done=e>=t,a)}}Ot.applyToOptions=t=>{const n=mt(t,100,Ot);return t.ease=n.ease,t.duration=e.secondsToMilliseconds(n.duration),t.type="keyframes",t};const Yt=t=>null!==t;function Xt(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(Yt),a=i<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return a&&void 0!==s?s:r[a]}const Ut={decay:Lt,inertia:Lt,tween:It,keyframes:It,spring:Ot};function qt(t){"string"==typeof t.type&&(t.type=Ut[t.type])}class Gt{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)}}const zt=t=>t/100;class Zt extends Gt{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=(t=!0)=>{if(t){const{motionValue:t}=this.options;t&&t.updatedAt!==h.now()&&this.tick(h.now())}this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},d.mainThread++,this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;qt(t);const{type:n=It,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=t;let{keyframes:o}=t;const l=n||It;l!==It&&"number"!=typeof o[0]&&(this.mixKeyframes=e.pipe(zt,lt(o[0],o[1])),o=[0,100]);const u=l({...t,keyframes:o});"mirror"===r&&(this.mirroredGenerator=l({...t,keyframes:[...o].reverse(),velocity:-a})),null===u.calculatedDuration&&(u.calculatedDuration=dt(u));const{calculatedDuration:c}=u;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=u}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(null===this.startTime)return s.next(0);const{delay:u=0,keyframes:c,repeat:h,repeatType:d,repeatDelay:m,type:p,onUpdate:f,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const g=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>i;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let T=this.currentTime,b=s;if(h){const t=Math.min(this.currentTime,i)/o;let n=Math.floor(t),s=t%1;!s&&t>=1&&(s=1),1===s&&n--,n=Math.min(n,h+1);Boolean(n%2)&&("reverse"===d?(s=1-s,m&&(s-=m/o)):"mirror"===d&&(b=a)),T=e.clamp(0,1,s)*o}const w=v?{done:!1,value:c[0]}:b.next(T);r&&(w.value=r(w.value));let{done:M}=w;v||null===l||(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const x=null===this.holdTime&&("finished"===this.state||"running"===this.state&&M);return x&&p!==Lt&&(w.value=Xt(c,this.options,y,this.speed)),f&&f(w.value),x&&this.finish(),w}then(t,e){return this.finished.then(t,e)}get duration(){return e.millisecondsToSeconds(this.calculatedDuration)}get time(){return e.millisecondsToSeconds(this.currentTime)}set time(t){t=e.secondsToMilliseconds(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(h.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=e.millisecondsToSeconds(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ut,startTime:e}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"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(h.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,d.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 _t(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ht=t=>180*t/Math.PI,Jt=t=>{const e=Ht(Math.atan2(t[1],t[0]));return te(e)},Qt={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Jt,rotateZ:Jt,skewX:t=>Ht(Math.atan(t[1])),skewY:t=>Ht(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},te=t=>((t%=360)<0&&(t+=360),t),ee=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ne=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),se={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ee,scaleY:ne,scale:t=>(ee(t)+ne(t))/2,rotateX:t=>te(Ht(Math.atan2(t[6],t[5]))),rotateY:t=>te(Ht(Math.atan2(-t[2],t[0]))),rotateZ:Jt,rotate:Jt,skewX:t=>Ht(Math.atan(t[4])),skewY:t=>Ht(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function ie(t){return t.includes("scale")?1:0}function re(t,e){if(!t||"none"===t)return ie(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=se,i=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Qt,i=e}if(!i)return ie(e);const r=s[e],a=i[1].split(",").map(ae);return"function"==typeof r?r(a):a[r]}function ae(t){return parseFloat(t.trim())}const oe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],le=(()=>new Set(oe))(),ue=t=>t===v||t===F,ce=new Set(["x","y","z"]),he=oe.filter((t=>!ce.has(t)));const de={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),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})=>re(e,"x"),y:(t,{transform:e})=>re(e,"y")};de.translateX=de.x,de.translateY=de.y;const me=new Set;let pe=!1,fe=!1,ye=!1;function ge(){if(fe){const t=Array.from(me).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return he.forEach((n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{t.getValue(e)?.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}fe=!1,pe=!1,me.forEach((t=>t.complete(ye))),me.clear()}function ve(){me.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(fe=!0)}))}function Te(){ye=!0,ve(),ge(),ye=!1}class be{constructor(t,e,n,s,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(me.add(this),pe||(pe=!0,r.read(ve),r.resolveKeyframes(ge))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;if(null===t[0]){const i=s?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const s=n.readValue(e,r);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=r),s&&void 0===i&&s.set(t[0])}_t(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),me.delete(this)}cancel(){"scheduled"===this.state&&(me.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const we=t=>t.startsWith("--");function Me(t,e,n){we(e)?t.style.setProperty(e,n):t.style[e]=n}const xe=e.memo((()=>void 0!==window.ScrollTimeline)),Ae={};function Se(t,n){const s=e.memo(t);return()=>Ae[n]??s()}const ke=Se((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Ee=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,Ve={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ee([0,.65,.55,1]),circOut:Ee([.55,0,1,.45]),backIn:Ee([.31,.01,.66,-.59]),backOut:Ee([.33,1.53,.69,.99])};function Pe(t,n){return t?"function"==typeof t?ke()?ct(t,n):"ease-out":e.isBezierDefinition(t)?Ee(t):Array.isArray(t)?t.map((t=>Pe(t,n)||Ve.easeOut)):Ve[t]:void 0}function Re(t,e,n,{delay:i=0,duration:r=300,repeat:a=0,repeatType:o="loop",ease:l="easeOut",times:u}={},c=void 0){const h={[e]:n};u&&(h.offset=u);const m=Pe(l,r);Array.isArray(m)&&(h.easing=m),s.value&&d.waapi++;const p={delay:i,duration:r,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:a+1,direction:"reverse"===o?"alternate":"normal"};c&&(p.pseudoElement=c);const f=t.animate(h,p);return s.value&&f.finished.finally((()=>{d.waapi--})),f}function De(t){return"function"==typeof t&&"applyToOptions"in t}function Fe({type:t,...e}){return De(t)&&ke()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Ce extends Gt{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:i,pseudoElement:r,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=a,this.options=t,e.invariant("string"!=typeof t.type,'animateMini doesn\'t support "type" as a string. Did you mean to import { spring } from "motion"?');const u=Fe(t);this.animation=Re(n,s,i,u,r),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=Xt(i,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(t):Me(n,s,t),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(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;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return e.millisecondsToSeconds(Number(t))}get time(){return e.millisecondsToSeconds(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=e.secondsToMilliseconds(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 Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&xe()?(this.animation.timeline=t,e.noop):n(this)}}const Ke={anticipate:e.anticipate,backInOut:e.backInOut,circInOut:e.circInOut};function Oe(t){"string"==typeof t.ease&&t.ease in Ke&&(t.ease=Ke[t.ease])}class Le extends Ce{constructor(t){Oe(t),qt(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...a}=this.options;if(!n)return;if(void 0!==t)return void n.set(t);const o=new Zt({...a,autoplay:!1}),l=e.secondsToMilliseconds(this.finishedTime??this.time);n.setWithVelocity(o.sample(l-10).value,o.sample(l).value,10),o.stop()}}const We=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!q.test(t)&&"0"!==t||t.startsWith("url(")));const $e=new Set(["opacity","clipPath","filter","transform"]),Be=e.memo((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));function Ne(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:a}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:o,transformTemplate:l}=e.owner.getProps();return Be()&&n&&$e.has(n)&&("transform"!==n||!l)&&!o&&!s&&"mirror"!==i&&0!==r&&"inertia"!==a}class je{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>e.attachTimeline(t)));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Ie extends Ce{constructor(t){super(),this.animation=t,t.onfinish=()=>{this.finishedTime=this.time,this.notifyFinished()}}}const Ye=new WeakMap;const Xe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ue(t){const e=Xe.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}function qe(t,n,s=1){e.invariant(s<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[i,r]=Ue(t);if(!i)return;const a=window.getComputedStyle(n).getPropertyValue(i);if(a){const t=a.trim();return e.isNumericalString(t)?parseFloat(t):t}return y(r)?qe(r,n,s+1):r}function Ge(t,e){return t?.[e]??t?.default??t}const ze=new Set(["width","height","top","left","right","bottom",...oe]),Ze=t=>e=>e.test(t),_e=[v,F,D,R,K,C,{test:t=>"auto"===t,parse:t=>t}],He=t=>_e.find(Ze(t));const Je=new Set(["brightness","contrast","saturate","opacity"]);function Qe(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(M)||[];if(!s)return t;const i=n.replace(s,"");let r=Je.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const tn=/\b([a-z-]*)\(.*?\)/gu,en={...q,getAnimatableNone:t=>{const e=t.match(tn);return e?e.map(Qe).join(" "):t}},nn={...v,transform:Math.round},sn={rotate:R,rotateX:R,rotateY:R,rotateZ:R,scale:b,scaleX:b,scaleY:b,scaleZ:b,skew:R,skewX:R,skewY:R,distance:F,translateX:F,translateY:F,translateZ:F,x:F,y:F,z:F,perspective:F,transformPerspective:F,opacity:T,originX:O,originY:O,originZ:F},rn={borderWidth:F,borderTopWidth:F,borderRightWidth:F,borderBottomWidth:F,borderLeftWidth:F,borderRadius:F,radius:F,borderTopLeftRadius:F,borderTopRightRadius:F,borderBottomRightRadius:F,borderBottomLeftRadius:F,width:F,maxWidth:F,height:F,maxHeight:F,top:F,right:F,bottom:F,left:F,padding:F,paddingTop:F,paddingRight:F,paddingBottom:F,paddingLeft:F,margin:F,marginTop:F,marginRight:F,marginBottom:F,marginLeft:F,backgroundPositionX:F,backgroundPositionY:F,...sn,zIndex:nn,fillOpacity:T,strokeOpacity:T,numOctaves:nn},an={...rn,color:W,backgroundColor:W,outlineColor:W,fill:W,stroke:W,borderColor:W,borderTopColor:W,borderRightColor:W,borderBottomColor:W,borderLeftColor:W,filter:en,WebkitFilter:en},on=t=>an[t];function ln(t,e){let n=on(t);return n!==en&&(n=q),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const un=new Set(["auto","none","0"]);const cn=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","radius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","backgroundPositionX","backgroundPositionY"]);const hn=e.memo((()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0})),dn=new Set(["opacity","clipPath","filter","transform"]);function mn(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let s=document;e&&(s=e.current);const i=n?.[t]??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}const pn={current:void 0};class fn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=h.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty();e&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=h.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new e.SubscriptionManager);const s=this.events[t].add(n);return"change"===t?()=>{s(),r.read((()=>{this.events.change.getSize()||this.stop()}))}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}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 pn.current&&pn.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=h.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e.velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}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 yn(t,e){return new fn(t,e)}const gn=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class vn{constructor(){this.latest={},this.values=new Map}set(t,e,n,s){const i=this.values.get(t);i&&i.onRemove();const o=()=>{this.latest[t]=gn(e.get(),rn[t]),n&&r.render(n)};o();const l=e.on("change",o);s&&e.addDependent(s);const u=()=>{l(),n&&a(n),this.values.delete(t),s&&e.removeDependent(s)};return this.values.set(t,{value:e,onRemove:u}),u}get(t){return this.values.get(t)?.value}destroy(){for(const t of this.values.values())t.onRemove()}}const Tn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const bn=new WeakMap;function wn(t,e,n,s){let i,r;return le.has(n)?(e.get("transform")||e.set("transform",new fn("none"),(()=>{t.style.transform=function(t){let e="",n=!0;for(let s=0;s<oe.length;s++){const i=oe[s],r=t.latest[i];if(void 0===r)continue;let a=!0;a="number"==typeof r?r===(i.startsWith("scale")?1:0):0===parseFloat(r),a||(n=!1,e+=`${Tn[i]||i}(${t.latest[i]}) `)}return n?"none":e.trim()}(e)})),r=e.get("transform")):i=we(n)?()=>{t.style.setProperty(n,e.latest[n])}:()=>{t.style[n]=e.latest[n]},e.set(n,s,i,r)}const{schedule:Mn,cancel:xn}=i(queueMicrotask,!1),An={x:!1,y:!1};function Sn(){return An.x||An.y}function kn(t,e){const n=mn(t),s=new AbortController;return[n,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function En(t){return!("touch"===t.pointerType||Sn())}const Vn=(t,e)=>!!e&&(t===e||Vn(t,e.parentElement)),Pn=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Rn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Dn=new WeakSet;function Fn(t){return e=>{"Enter"===e.key&&t(e)}}function Cn(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Kn(t){return Pn(t)&&!Sn()}function On(){const{value:t}=s;null!==t?(t.frameloop.rate.push(o.delta),t.animations.mainThread.push(d.mainThread),t.animations.waapi.push(d.waapi),t.animations.layout.push(d.layout)):a(On)}function Ln(t){return t.reduce(((t,e)=>t+e),0)/t.length}function Wn(t,e=Ln){return 0===t.length?{min:0,max:0,avg:0}:{min:Math.min(...t),max:Math.max(...t),avg:e(t)}}const $n=t=>Math.round(1e3/t);function Bn(){s.value=null,s.addProjectionMetrics=null}function Nn(){const{value:t}=s;if(!t)throw new Error("Stats are not being measured");Bn(),a(On);const e={frameloop:{setup:Wn(t.frameloop.setup),rate:Wn(t.frameloop.rate),read:Wn(t.frameloop.read),resolveKeyframes:Wn(t.frameloop.resolveKeyframes),preUpdate:Wn(t.frameloop.preUpdate),update:Wn(t.frameloop.update),preRender:Wn(t.frameloop.preRender),render:Wn(t.frameloop.render),postRender:Wn(t.frameloop.postRender)},animations:{mainThread:Wn(t.animations.mainThread),waapi:Wn(t.animations.waapi),layout:Wn(t.animations.layout)},layoutProjection:{nodes:Wn(t.layoutProjection.nodes),calculatedTargetDeltas:Wn(t.layoutProjection.calculatedTargetDeltas),calculatedProjections:Wn(t.layoutProjection.calculatedProjections)}},{rate:n}=e.frameloop;return n.min=$n(n.min),n.max=$n(n.max),n.avg=$n(n.avg),[n.min,n.max]=[n.max,n.min],e}function jn(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],i=Wt(t[1+n],t[2+n],t[3+n]);return e?i(s):i}function In(t){const e=[];pn.current=e;const n=t();pn.current=void 0;const s=yn(n);return function(t,e,n){const s=()=>e.set(n()),i=()=>r.preRender(s,!1,!0),o=t.map((t=>t.on("change",i)));e.on("destroy",(()=>{o.forEach((t=>t())),a(s)}))}(e,s,t),s}const Yn=t=>Boolean(t&&t.getVelocity);function Xn(t,e,n){const s=t.get();let i,a=null,o=s;const l="string"==typeof s?s.replace(/[\d.-]/g,""):void 0,u=()=>{a&&(a.stop(),a=null)},c=()=>{u(),a=new Zt({keyframes:[qn(t.get()),qn(o)],velocity:t.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:i})};let h;return t.attach(((e,n)=>(o=e,i=t=>n(Un(t,l)),r.postRender(c),t.get())),u),Yn(e)&&(h=e.on("change",(e=>t.set(Un(e,l)))),t.on("destroy",h)),h}function Un(t,e){return e?t+e:t}function qn(t){return"number"==typeof t?t:parseFloat(t)}const Gn=[..._e,W,q];function zn(t){return"layout"===t?"group":"enter"===t||"new"===t?"new":"exit"===t||"old"===t?"old":"group"}let Zn={},_n=null;const Hn=(t,e)=>{Zn[t]=e},Jn=()=>{_n||(_n=document.createElement("style"),_n.id="motion-view");let t="";for(const e in Zn){const n=Zn[e];t+=`${e} {\n`;for(const[e,s]of Object.entries(n))t+=` ${e}: ${s};\n`;t+="}\n"}_n.textContent=t,document.head.appendChild(_n),Zn={}},Qn=()=>{_n&&_n.parentElement&&_n.parentElement.removeChild(_n)};function ts(t){const e=t.match(/::view-transition-(old|new|group|image-pair)\((.*?)\)/);return e?{layer:e[2],type:e[1]}:null}function es(t){const{effect:e}=t;return!!e&&(e.target===document.documentElement&&e.pseudoElement?.startsWith("::view-transition"))}const ns=["layout","enter","exit","new","old"];function ss(t){const{update:n,targets:s,options:i}=t;if(!document.startViewTransition)return new Promise((async t=>{await n(),t(new je([]))}));(function(t,e){return e.has(t)&&Object.keys(e.get(t)).length>0})("root",s)||Hn(":root",{"view-transition-name":"none"}),Hn("::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)",{"animation-timing-function":"linear !important"}),Jn();const r=document.startViewTransition((async()=>{await n()}));return r.finished.finally((()=>{Qn()})),new Promise((t=>{r.ready.then((()=>{const n=document.getAnimations().filter(es),r=[];s.forEach(((t,n)=>{for(const s of ns){if(!t[s])continue;const{keyframes:a,options:o}=t[s];for(let[t,l]of Object.entries(a)){if(!l)continue;const a={...Ge(i,t),...Ge(o,t)},u=zn(s);if("opacity"===t&&!Array.isArray(l)){l=["new"===u?0:1,l]}"function"==typeof a.delay&&(a.delay=a.delay(0,1)),a.duration&&(a.duration=e.secondsToMilliseconds(a.duration)),a.delay&&(a.delay=e.secondsToMilliseconds(a.delay));const c=new Ce({...a,element:document.documentElement,name:t,pseudoElement:`::view-transition-${u}(${n})`,keyframes:l});r.push(c)}}}));for(const t of n){if("finished"===t.playState)continue;const{effect:n}=t;if(!(n&&n instanceof KeyframeEffect))continue;const{pseudoElement:a}=n;if(!a)continue;const o=ts(a);if(!o)continue;const l=s.get(o.layer);if(l)is(l,"enter")&&is(l,"exit")&&n.getKeyframes().some((t=>t.mixBlendMode))?r.push(new Ie(t)):t.cancel();else{const s="group"===o.type?"layout":"";let a={...Ge(i,s)};a.duration&&(a.duration=e.secondsToMilliseconds(a.duration)),a=Fe(a);const l=Pe(a.ease,a.duration);n.updateTiming({delay:e.secondsToMilliseconds(a.delay??0),duration:a.duration,easing:l}),r.push(new Ie(t))}}t(new je(r))}))}))}function is(t,e){return t?.[e]?.keyframes.opacity}let rs=[],as=null;function os(){as=null;const[t]=rs;var n;t&&(n=t,e.removeItem(rs,n),as=n,ss(n).then((t=>{n.notifyReady(t),t.finished.finally(os)})))}function ls(){for(let t=rs.length-1;t>=0;t--){const e=rs[t],{interrupt:n}=e.options;if("immediate"===n){const n=rs.slice(0,t+1).map((t=>t.update)),s=rs.slice(t+1);e.update=()=>{n.forEach((t=>t()))},rs=[e,...s];break}}as&&"immediate"!==rs[0]?.options.interrupt||os()}class us{constructor(t,n={}){var s;this.currentTarget="root",this.targets=new Map,this.notifyReady=e.noop,this.readyPromise=new Promise((t=>{this.notifyReady=t})),this.update=t,this.options={interrupt:"wait",...n},s=this,rs.push(s),Mn.render(ls)}get(t){return this.currentTarget=t,this}layout(t,e){return this.updateTarget("layout",t,e),this}new(t,e){return this.updateTarget("new",t,e),this}old(t,e){return this.updateTarget("old",t,e),this}enter(t,e){return this.updateTarget("enter",t,e),this}exit(t,e){return this.updateTarget("exit",t,e),this}crossfade(t){return this.updateTarget("enter",{opacity:1},t),this.updateTarget("exit",{opacity:0},t),this}updateTarget(t,e,n={}){const{currentTarget:s,targets:i}=this;i.has(s)||i.set(s,{});i.get(s)[t]={keyframes:e,options:n}}then(t,e){return this.readyPromise.then(t,e)}}const cs=r,hs=n.reduce(((t,e)=>(t[e]=t=>a(t),t)),{});t.AsyncMotionValueAnimation=class extends Gt{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",keyframes:a,name:o,motionValue:l,element:u,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=h.now();const d={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,name:o,motionValue:l,element:u,...c},m=u?.KeyframeResolver||be;this.keyframeResolver=new m(a,((t,e,n)=>this.onKeyframesResolved(t,e,d,!n)),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,s,i){this.keyframeResolver=void 0;const{name:r,type:a,velocity:o,delay:l,isHandoff:u,onUpdate:c}=s;this.resolvedAt=h.now(),function(t,n,s,i){const r=t[0];if(null===r)return!1;if("display"===n||"visibility"===n)return!0;const a=t[t.length-1],o=We(r,n),l=We(a,n);return e.warning(o===l,`You are trying to animate ${n} from "${r}" to "${a}". ${r} is not an animatable value - to enable this animation set ${r} to a value animatable to ${a} via the \`style\` property.`),!(!o||!l)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===s||De(s))&&i)}(t,r,a,o)||(!e.MotionGlobalConfig.instantAnimations&&l||c?.(Xt(t,s,n)),t[0]=t[t.length-1],s.duration=0,s.repeat=0);const d={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},m=!u&&Ne(d)?new Le({...d,element:d.motionValue.owner.current}):new Zt(d);m.finished.then((()=>this.notifyFinished())).catch(e.noop),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}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(),Te()),this._animation}get duration(){return this.animation.duration}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()}},t.DOMKeyframesResolver=class extends be{constructor(t,e,n,s,i){super(t,e,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let s=t[n];if("string"==typeof s&&(s=s.trim(),y(s))){const i=qe(s,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!ze.has(n)||2!==t.length)return;const[s,i]=t,r=He(s),a=He(i);if(r!==a)if(ue(r)&&ue(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else de[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let n=0;n<t.length;n++)(null===t[n]||("number"==typeof(i=t[n])?0===i:null===i||"none"===i||"0"===i||e.isZeroValueString(i)))&&s.push(n);var i;s.length&&function(t,e,n){let s,i=0;for(;i<t.length&&!s;){const e=t[i];"string"==typeof e&&!un.has(e)&&I(e).values.length&&(s=t[i]),i++}if(s&&n)for(const i of e)t[i]=ln(n,s)}(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=de[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(n,s).jump(s,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(e);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,r=n[i];n[i]=de[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach((([e,n])=>{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}},t.GroupAnimation=je,t.GroupAnimationWithThen=class extends je{then(t,e){return this.finished.finally(t).then((()=>{}))}},t.JSAnimation=Zt,t.KeyframeResolver=be,t.MotionValue=fn,t.NativeAnimation=Ce,t.NativeAnimationExtended=Le,t.NativeAnimationWrapper=Ie,t.ViewTransitionBuilder=us,t.acceleratedValues=dn,t.activeAnimations=d,t.alpha=T,t.analyseComplexValue=I,t.animateValue=function(t){return new Zt(t)},t.animateView=function(t,e={}){return new us(t,e)},t.animationMapKey=(t,e="")=>`${t}:${e}`,t.applyPxDefaults=function(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&cn.has(e)&&(t[n]=t[n]+"px")},t.attachSpring=Xn,t.calcGeneratorDuration=dt,t.cancelFrame=a,t.cancelMicrotask=xn,t.cancelSync=hs,t.collectMotionValues=pn,t.color=W,t.complex=q,t.convertOffsetToTimes=Nt,t.createGeneratorEasing=mt,t.createRenderBatcher=i,t.cubicBezierAsString=Ee,t.defaultEasing=jt,t.defaultOffset=Bt,t.defaultTransformValue=ie,t.defaultValueTypes=an,t.degrees=R,t.dimensionValueTypes=_e,t.fillOffset=$t,t.fillWildcards=_t,t.findDimensionValueType=He,t.findValueType=t=>Gn.find(Ze(t)),t.flushKeyframeResolvers=Te,t.frame=r,t.frameData=o,t.frameSteps=l,t.generateLinearEasing=ct,t.getAnimatableNone=ln,t.getAnimationMap=function(t){const e=Ye.get(t)||new Map;return Ye.set(t,e),e},t.getComputedStyle=function(t,e){const n=window.getComputedStyle(t);return we(e)?n.getPropertyValue(e):n[e]},t.getDefaultValueType=on,t.getMixer=it,t.getValueAsType=gn,t.getValueTransition=Ge,t.getVariableValue=qe,t.hex=V,t.hover=function(t,e,n={}){const[s,i,r]=kn(t,n),a=t=>{if(!En(t))return;const{target:n}=t,s=e(n,t);if("function"!=typeof s||!n)return;const r=t=>{En(t)&&(s(t),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,i)};return s.forEach((t=>{t.addEventListener("pointerenter",a,i)})),r},t.hsla=L,t.hslaToRgba=z,t.inertia=Lt,t.interpolate=Wt,t.invisibleValues=et,t.isCSSVariableName=p,t.isCSSVariableToken=y,t.isDragActive=Sn,t.isDragging=An,t.isGenerator=De,t.isMotionValue=Yn,t.isNodeOrChild=Vn,t.isPrimaryPointer=Pn,t.isWaapiSupportedEasing=function t(n){return Boolean("function"==typeof n&&ke()||!n||"string"==typeof n&&(n in Ve||ke())||e.isBezierDefinition(n)||Array.isArray(n)&&n.every(t))},t.keyframes=It,t.mapEasingToNativeEasing=Pe,t.mapValue=function(t,e,n,s){const i=jn(e,n,s);return In((()=>i(t.get())))},t.maxGeneratorDuration=ht,t.microtask=Mn,t.mix=lt,t.mixArray=rt,t.mixColor=tt,t.mixComplex=ot,t.mixImmediate=Z,t.mixLinearColor=H,t.mixNumber=_,t.mixObject=at,t.mixVisibility=nt,t.motionValue=yn,t.number=v,t.numberValueTypes=rn,t.observeTimeline=function(t,e){let n;const s=()=>{const{currentTime:s}=e,i=(null===s?0:s.value)/100;n!==i&&t(i),n=i};return r.preUpdate(s,!0),()=>a(s)},t.parseCSSVariable=Ue,t.parseValueFromTransform=re,t.percent=D,t.positionalKeys=ze,t.press=function(t,e,n={}){const[s,i,r]=kn(t,n),a=t=>{const s=t.currentTarget;if(!Kn(t))return;Dn.add(s);const r=e(s,t),a=(t,e)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),Dn.has(s)&&Dn.delete(s),Kn(t)&&"function"==typeof r&&r(t,{success:e})},o=t=>{a(t,s===window||s===document||n.useGlobalTarget||Vn(s,t.target))},l=t=>{a(t,!1)};window.addEventListener("pointerup",o,i),window.addEventListener("pointercancel",l,i)};return s.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",a,i),t instanceof HTMLElement&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const s=Fn((()=>{if(Dn.has(n))return;Cn(n,"down");const t=Fn((()=>{Cn(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>Cn(n,"cancel")),e)}));n.addEventListener("keydown",s,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",s)),e)})(t,i))),e=t,Rn.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),r},t.progressPercentage=O,t.px=F,t.readTransformValue=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return re(n,e)},t.recordStats=function(){if(s.value)throw Bn(),new Error("Stats are already being measured");const t=s;return t.value={frameloop:{setup:[],rate:[],read:[],resolveKeyframes:[],preUpdate:[],update:[],preRender:[],render:[],postRender:[]},animations:{mainThread:[],waapi:[],layout:[]},layoutProjection:{nodes:[],calculatedTargetDeltas:[],calculatedProjections:[]}},t.addProjectionMetrics=e=>{const{layoutProjection:n}=t.value;n.nodes.push(e.nodes),n.calculatedTargetDeltas.push(e.calculatedTargetDeltas),n.calculatedProjections.push(e.calculatedProjections)},r.postRender(On,!0),Nn},t.resolveElements=mn,t.rgbUnit=k,t.rgba=E,t.scale=b,t.setDragLock=function(t){return"x"===t||"y"===t?An[t]?null:(An[t]=!0,()=>{An[t]=!1}):An.x||An.y?null:(An.x=An.y=!0,()=>{An.x=An.y=!1})},t.setStyle=Me,t.spring=Ot,t.springValue=function(t,e){const n=yn(Yn(t)?t.get():t);return Xn(n,t,e),n},t.startWaapiAnimation=Re,t.statsBuffer=s,t.styleEffect=function(t,e){const n=mn(t),s=[];for(let t=0;t<n.length;t++){const i=n[t],r=bn.get(i)??new vn;bn.set(i,r);for(const t in e){const n=wn(i,r,t,e[t]);s.push(n)}}return()=>{for(const t of s)t()}},t.supportedWaapiEasing=Ve,t.supportsBrowserAnimation=Ne,t.supportsFlags=Ae,t.supportsLinearEasing=ke,t.supportsPartialKeyframes=hn,t.supportsScrollTimeline=xe,t.sync=cs,t.testValueType=Ze,t.time=h,t.transform=jn,t.transformPropOrder=oe,t.transformProps=le,t.transformValue=In,t.transformValueTypes=sn,t.vh=C,t.vw=K}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("motion-utils")):"function"==typeof define&&define.amd?define(["exports","motion-utils"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).MotionDom={},t.MotionUtils)}(this,(function(t,e){"use strict";const n=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],s={value:null,addProjectionMetrics:null};function i(t,i){let r=!1,a=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>r=!0,u=n.reduce(((t,e)=>(t[e]=function(t,e){let n=new Set,i=new Set,r=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},u=0;function c(e){o.has(e)&&(h.schedule(e),t()),u++,e(l)}const h={schedule:(t,e=!1,s=!1)=>{const a=s&&r?n:i;return e&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),o.delete(t)},process:t=>{l=t,r?a=!0:(r=!0,[n,i]=[i,n],n.forEach(c),e&&s.value&&s.value.frameloop[e].push(u),u=0,n.clear(),r=!1,a&&(a=!1,h.process(t)))}};return h}(l,i?e:void 0),t)),{}),{setup:c,read:h,resolveKeyframes:d,preUpdate:m,update:p,preRender:f,render:y,postRender:g}=u,v=()=>{const n=e.MotionGlobalConfig.useManualTiming?o.timestamp:performance.now();r=!1,e.MotionGlobalConfig.useManualTiming||(o.delta=a?1e3/60:Math.max(Math.min(n-o.timestamp,40),1)),o.timestamp=n,o.isProcessing=!0,c.process(o),h.process(o),d.process(o),m.process(o),p.process(o),f.process(o),y.process(o),g.process(o),o.isProcessing=!1,r&&i&&(a=!1,t(v))};return{schedule:n.reduce(((e,n)=>{const s=u[n];return e[n]=(e,n=!1,i=!1)=>(r||(r=!0,a=!0,o.isProcessing||t(v)),s.schedule(e,n,i)),e}),{}),cancel:t=>{for(let e=0;e<n.length;e++)u[n[e]].cancel(t)},state:o,steps:u}}const{schedule:r,cancel:a,state:o,steps:l}=i("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:e.noop,!0);let u;function c(){u=void 0}const h={now:()=>(void 0===u&&h.set(o.isProcessing||e.MotionGlobalConfig.useManualTiming?o.timestamp:performance.now()),u),set:t=>{u=t,queueMicrotask(c)}},d={layout:0,mainThread:0,waapi:0},m=t=>e=>"string"==typeof e&&e.startsWith(t),p=m("--"),f=m("var(--"),y=t=>!!f(t)&&g.test(t.split("/*")[0].trim()),g=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,v={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},T={...v,transform:t=>e.clamp(0,1,t)},b={...v,default:1},w=t=>Math.round(1e5*t)/1e5,M=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const x=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,S=(t,e)=>n=>Boolean("string"==typeof n&&x.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),A=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,a,o]=s.match(M);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},k={...v,transform:t=>Math.round((t=>e.clamp(0,255,t))(t))},E={test:S("rgb","red"),parse:A("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+k.transform(t)+", "+k.transform(e)+", "+k.transform(n)+", "+w(T.transform(s))+")"};const V={test:S("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:E.transform},P=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),R=P("deg"),D=P("%"),F=P("px"),C=P("vh"),K=P("vw"),O=(()=>({...D,parse:t=>D.parse(t)/100,transform:t=>D.transform(100*t)}))(),L={test:S("hsl","hue"),parse:A("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+D.transform(w(e))+", "+D.transform(w(n))+", "+w(T.transform(s))+")"},W={test:t=>E.test(t)||V.test(t)||L.test(t),parse:t=>E.test(t)?E.parse(t):L.test(t)?L.parse(t):V.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?E.transform(t):L.transform(t)},N=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const $="number",B="color",j=/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 I(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(j,(t=>(W.test(t)?(s.color.push(r),i.push(B),n.push(W.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push($),n.push(parseFloat(t))),++r,"${}"))).split("${}");return{values:n,split:a,indexes:s,types:i}}function Y(t){return I(t).values}function X(t){const{split:e,types:n}=I(t),s=e.length;return t=>{let i="";for(let r=0;r<s;r++)if(i+=e[r],void 0!==t[r]){const e=n[r];i+=e===$?w(t[r]):e===B?W.transform(t[r]):t[r]}return i}}const U=t=>"number"==typeof t?0:t;const G={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(M)?.length||0)+(t.match(N)?.length||0)>0},parse:Y,createTransformer:X,getAnimatableNone:function(t){const e=Y(t);return X(t)(e.map(U))}};function q(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function z({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,a=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,o=2*n-s;i=q(o,s,t+1/3),r=q(o,s,t),a=q(o,s,t-1/3)}else i=r=a=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*a),alpha:s}}function Z(t,e){return n=>n>0?e:t}const _=(t,e,n)=>t+(e-t)*n,H=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},J=[V,E,L];function Q(t){const n=(s=t,J.find((t=>t.test(s))));var s;if(e.warning(Boolean(n),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(n))return!1;let i=n.parse(t);return n===L&&(i=z(i)),i}const tt=(t,e)=>{const n=Q(t),s=Q(e);if(!n||!s)return Z(t,e);const i={...n};return t=>(i.red=H(n.red,s.red,t),i.green=H(n.green,s.green,t),i.blue=H(n.blue,s.blue,t),i.alpha=_(n.alpha,s.alpha,t),E.transform(i))},et=new Set(["none","hidden"]);function nt(t,e){return et.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function st(t,e){return n=>_(t,e,n)}function it(t){return"number"==typeof t?st:"string"==typeof t?y(t)?Z:W.test(t)?tt:ot:Array.isArray(t)?rt:"object"==typeof t?W.test(t)?tt:at:Z}function rt(t,e){const n=[...t],s=n.length,i=t.map(((t,n)=>it(t)(t,e[n])));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}}function at(t,e){const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=it(t[i])(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}}const ot=(t,n)=>{const s=G.createTransformer(n),i=I(t),r=I(n);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?et.has(t)&&!r.values.length||et.has(n)&&!i.values.length?nt(t,n):e.pipe(rt(function(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],a=t.indexes[r][s[r]],o=t.values[a]??0;n[i]=o,s[r]++}return n}(i,r),r.values),s):(e.warning(!0,`Complex values '${t}' and '${n}' 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.`),Z(t,n))};function lt(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return _(t,e,n);return it(t)(t,e)}const ut=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>r.update(e,t),stop:()=>a(e),now:()=>o.isProcessing?o.timestamp:h.now()}},ct=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)s+=t(e/(i-1))+", ";return`linear(${s.substring(0,s.length-2)})`},ht=2e4;function dt(t){let e=0;let n=t.next(e);for(;!n.done&&e<ht;)e+=50,n=t.next(e);return e>=ht?1/0:e}function mt(t,n=100,s){const i=s({...t,keyframes:[0,n]}),r=Math.min(dt(i),ht);return{type:"keyframes",ease:t=>i.next(r*t).value/n,duration:e.millisecondsToSeconds(r)}}function pt(t,n,s){const i=Math.max(n-5,0);return e.velocityPerSecond(s-t(i),n-i)}const ft=100,yt=10,gt=1,vt=0,Tt=800,bt=.3,wt=.3,Mt={granular:.01,default:2},xt={granular:.005,default:.5},St=.01,At=10,kt=.05,Et=1,Vt=.001;function Pt({duration:t=Tt,bounce:n=bt,velocity:s=vt,mass:i=gt}){let r,a;e.warning(t<=e.secondsToMilliseconds(At),"Spring duration must be 10 seconds or less");let o=1-n;o=e.clamp(kt,Et,o),t=e.clamp(St,At,e.millisecondsToSeconds(t)),o<1?(r=e=>{const n=e*o,i=n*t,r=n-s,a=Dt(e,o),l=Math.exp(-i);return Vt-r/a*l},a=e=>{const n=e*o*t,i=n*s+s,a=Math.pow(o,2)*Math.pow(e,2)*t,l=Math.exp(-n),u=Dt(Math.pow(e,2),o);return(-r(e)+Vt>0?-1:1)*((i-a)*l)/u}):(r=e=>Math.exp(-e*t)*((e-s)*t+1)-.001,a=e=>Math.exp(-e*t)*(t*t*(s-e)));const l=function(t,e,n){let s=n;for(let n=1;n<Rt;n++)s-=t(s)/e(s);return s}(r,a,5/t);if(t=e.secondsToMilliseconds(t),isNaN(l))return{stiffness:ft,damping:yt,duration:t};{const e=Math.pow(l,2)*i;return{stiffness:e,damping:2*o*Math.sqrt(i*e),duration:t}}}const Rt=12;function Dt(t,e){return t*Math.sqrt(1-e*e)}const Ft=["duration","bounce"],Ct=["stiffness","damping","mass"];function Kt(t,e){return e.some((e=>void 0!==t[e]))}function Ot(t=wt,n=bt){const s="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:n}:t;let{restSpeed:i,restDelta:r}=s;const a=s.keyframes[0],o=s.keyframes[s.keyframes.length-1],l={done:!1,value:a},{stiffness:u,damping:c,mass:h,duration:d,velocity:m,isResolvedFromDuration:p}=function(t){let n={velocity:vt,stiffness:ft,damping:yt,mass:gt,isResolvedFromDuration:!1,...t};if(!Kt(t,Ct)&&Kt(t,Ft))if(t.visualDuration){const s=t.visualDuration,i=2*Math.PI/(1.2*s),r=i*i,a=2*e.clamp(.05,1,1-(t.bounce||0))*Math.sqrt(r);n={...n,mass:gt,stiffness:r,damping:a}}else{const e=Pt(t);n={...n,...e,mass:gt},n.isResolvedFromDuration=!0}return n}({...s,velocity:-e.millisecondsToSeconds(s.velocity||0)}),f=m||0,y=c/(2*Math.sqrt(u*h)),g=o-a,v=e.millisecondsToSeconds(Math.sqrt(u/h)),T=Math.abs(g)<5;let b;if(i||(i=T?Mt.granular:Mt.default),r||(r=T?xt.granular:xt.default),y<1){const t=Dt(v,y);b=e=>{const n=Math.exp(-y*v*e);return o-n*((f+y*v*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===y)b=t=>o-Math.exp(-v*t)*(g+(f+v*g)*t);else{const t=v*Math.sqrt(y*y-1);b=e=>{const n=Math.exp(-y*v*e),s=Math.min(t*e,300);return o-n*((f+y*v*g)*Math.sinh(s)+t*g*Math.cosh(s))/t}}const w={calculatedDuration:p&&d||null,next:t=>{const n=b(t);if(p)l.done=t>=d;else{let s=0===t?f:0;y<1&&(s=0===t?e.secondsToMilliseconds(f):pt(b,t,n));const a=Math.abs(s)<=i,u=Math.abs(o-n)<=r;l.done=a&&u}return l.value=l.done?o:n,l},toString:()=>{const t=Math.min(dt(w),ht),e=ct((e=>w.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return w}function Lt({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},m=t=>void 0===o?l:void 0===l||Math.abs(o-t)<Math.abs(l-t)?o:l;let p=n*e;const f=h+p,y=void 0===a?f:a(f);y!==f&&(p=y-h);const g=t=>-p*Math.exp(-t/s),v=t=>y+g(t),T=t=>{const e=g(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?y:n};let b,w;const M=t=>{var e;(e=d.value,void 0!==o&&e<o||void 0!==l&&e>l)&&(b=t,w=Ot({keyframes:[d.value,m(d.value)],velocity:pt(v,t,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:c}))};return M(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==b||(e=!0,T(t),M(t)),void 0!==b&&t>=b?w.next(t-b):(!e&&T(t),d)}}}function Wt(t,n,{clamp:s=!0,ease:i,mixer:r}={}){const a=t.length;if(e.invariant(a===n.length,"Both input and output ranges must be the same length"),1===a)return()=>n[0];if(2===a&&n[0]===n[1])return()=>n[1];const o=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),n=[...n].reverse());const l=function(t,n,s){const i=[],r=s||e.MotionGlobalConfig.mix||lt,a=t.length-1;for(let s=0;s<a;s++){let a=r(t[s],t[s+1]);if(n){const t=Array.isArray(n)?n[s]||e.noop:n;a=e.pipe(t,a)}i.push(a)}return i}(n,i,r),u=l.length,c=s=>{if(o&&s<t[0])return n[0];let i=0;if(u>1)for(;i<t.length-2&&!(s<t[i+1]);i++);const r=e.progress(t[i],t[i+1],s);return l[i](r)};return s?n=>c(e.clamp(t[0],t[a-1],n)):c}function Nt(t,n){const s=t[t.length-1];for(let i=1;i<=n;i++){const r=e.progress(0,n,i);t.push(_(s,1,r))}}function $t(t){const e=[0];return Nt(e,t.length-1),e}function Bt(t,e){return t.map((t=>t*e))}function jt(t,n){return t.map((()=>n||e.easeInOut)).splice(0,t.length-1)}function It({duration:t=300,keyframes:n,times:s,ease:i="easeInOut"}){const r=e.isEasingArray(i)?i.map(e.easingDefinitionToFunction):e.easingDefinitionToFunction(i),a={done:!1,value:n[0]},o=Wt(Bt(s&&s.length===n.length?s:$t(n),t),n,{ease:Array.isArray(r)?r:jt(n,r)});return{calculatedDuration:t,next:e=>(a.value=o(e),a.done=e>=t,a)}}Ot.applyToOptions=t=>{const n=mt(t,100,Ot);return t.ease=n.ease,t.duration=e.secondsToMilliseconds(n.duration),t.type="keyframes",t};const Yt=t=>null!==t;function Xt(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(Yt),a=i<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return a&&void 0!==s?s:r[a]}const Ut={decay:Lt,inertia:Lt,tween:It,keyframes:It,spring:Ot};function Gt(t){"string"==typeof t.type&&(t.type=Ut[t.type])}class qt{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)}}const zt=t=>t/100;class Zt extends qt{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==h.now()&&this.tick(h.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},d.mainThread++,this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;Gt(t);const{type:n=It,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=t;let{keyframes:o}=t;const l=n||It;l!==It&&"number"!=typeof o[0]&&(this.mixKeyframes=e.pipe(zt,lt(o[0],o[1])),o=[0,100]);const u=l({...t,keyframes:o});"mirror"===r&&(this.mirroredGenerator=l({...t,keyframes:[...o].reverse(),velocity:-a})),null===u.calculatedDuration&&(u.calculatedDuration=dt(u));const{calculatedDuration:c}=u;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=u}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(null===this.startTime)return s.next(0);const{delay:u=0,keyframes:c,repeat:h,repeatType:d,repeatDelay:m,type:p,onUpdate:f,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const g=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?g<0:g>i;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let T=this.currentTime,b=s;if(h){const t=Math.min(this.currentTime,i)/o;let n=Math.floor(t),s=t%1;!s&&t>=1&&(s=1),1===s&&n--,n=Math.min(n,h+1);Boolean(n%2)&&("reverse"===d?(s=1-s,m&&(s-=m/o)):"mirror"===d&&(b=a)),T=e.clamp(0,1,s)*o}const w=v?{done:!1,value:c[0]}:b.next(T);r&&(w.value=r(w.value));let{done:M}=w;v||null===l||(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const x=null===this.holdTime&&("finished"===this.state||"running"===this.state&&M);return x&&p!==Lt&&(w.value=Xt(c,this.options,y,this.speed)),f&&f(w.value),x&&this.finish(),w}then(t,e){return this.finished.then(t,e)}get duration(){return e.millisecondsToSeconds(this.calculatedDuration)}get time(){return e.millisecondsToSeconds(this.currentTime)}set time(t){t=e.secondsToMilliseconds(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(h.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=e.millisecondsToSeconds(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ut,startTime:e}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"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(h.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,d.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 _t(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ht=t=>180*t/Math.PI,Jt=t=>{const e=Ht(Math.atan2(t[1],t[0]));return te(e)},Qt={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Jt,rotateZ:Jt,skewX:t=>Ht(Math.atan(t[1])),skewY:t=>Ht(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},te=t=>((t%=360)<0&&(t+=360),t),ee=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ne=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),se={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ee,scaleY:ne,scale:t=>(ee(t)+ne(t))/2,rotateX:t=>te(Ht(Math.atan2(t[6],t[5]))),rotateY:t=>te(Ht(Math.atan2(-t[2],t[0]))),rotateZ:Jt,rotate:Jt,skewX:t=>Ht(Math.atan(t[4])),skewY:t=>Ht(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function ie(t){return t.includes("scale")?1:0}function re(t,e){if(!t||"none"===t)return ie(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=se,i=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Qt,i=e}if(!i)return ie(e);const r=s[e],a=i[1].split(",").map(ae);return"function"==typeof r?r(a):a[r]}function ae(t){return parseFloat(t.trim())}const oe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],le=(()=>new Set(oe))(),ue=t=>t===v||t===F,ce=new Set(["x","y","z"]),he=oe.filter((t=>!ce.has(t)));const de={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),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})=>re(e,"x"),y:(t,{transform:e})=>re(e,"y")};de.translateX=de.x,de.translateY=de.y;const me=new Set;let pe=!1,fe=!1,ye=!1;function ge(){if(fe){const t=Array.from(me).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return he.forEach((n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{t.getValue(e)?.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}fe=!1,pe=!1,me.forEach((t=>t.complete(ye))),me.clear()}function ve(){me.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(fe=!0)}))}function Te(){ye=!0,ve(),ge(),ye=!1}class be{constructor(t,e,n,s,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(me.add(this),pe||(pe=!0,r.read(ve),r.resolveKeyframes(ge))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;if(null===t[0]){const i=s?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const s=n.readValue(e,r);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=r),s&&void 0===i&&s.set(t[0])}_t(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),me.delete(this)}cancel(){"scheduled"===this.state&&(me.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const we=t=>t.startsWith("--");function Me(t,e,n){we(e)?t.style.setProperty(e,n):t.style[e]=n}const xe=e.memo((()=>void 0!==window.ScrollTimeline)),Se={};function Ae(t,n){const s=e.memo(t);return()=>Se[n]??s()}const ke=Ae((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Ee=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,Ve={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ee([0,.65,.55,1]),circOut:Ee([.55,0,1,.45]),backIn:Ee([.31,.01,.66,-.59]),backOut:Ee([.33,1.53,.69,.99])};function Pe(t,n){return t?"function"==typeof t?ke()?ct(t,n):"ease-out":e.isBezierDefinition(t)?Ee(t):Array.isArray(t)?t.map((t=>Pe(t,n)||Ve.easeOut)):Ve[t]:void 0}function Re(t,e,n,{delay:i=0,duration:r=300,repeat:a=0,repeatType:o="loop",ease:l="easeOut",times:u}={},c=void 0){const h={[e]:n};u&&(h.offset=u);const m=Pe(l,r);Array.isArray(m)&&(h.easing=m),s.value&&d.waapi++;const p={delay:i,duration:r,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:a+1,direction:"reverse"===o?"alternate":"normal"};c&&(p.pseudoElement=c);const f=t.animate(h,p);return s.value&&f.finished.finally((()=>{d.waapi--})),f}function De(t){return"function"==typeof t&&"applyToOptions"in t}function Fe({type:t,...e}){return De(t)&&ke()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Ce extends qt{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:s,keyframes:i,pseudoElement:r,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=a,this.options=t,e.invariant("string"!=typeof t.type,'animateMini doesn\'t support "type" as a string. Did you mean to import { spring } from "motion"?');const u=Fe(t);this.animation=Re(n,s,i,u,r),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=Xt(i,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(t):Me(n,s,t),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(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;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return e.millisecondsToSeconds(Number(t))}get time(){return e.millisecondsToSeconds(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=e.secondsToMilliseconds(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 Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&xe()?(this.animation.timeline=t,e.noop):n(this)}}const Ke={anticipate:e.anticipate,backInOut:e.backInOut,circInOut:e.circInOut};function Oe(t){"string"==typeof t.ease&&t.ease in Ke&&(t.ease=Ke[t.ease])}class Le extends Ce{constructor(t){Oe(t),Gt(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...a}=this.options;if(!n)return;if(void 0!==t)return void n.set(t);const o=new Zt({...a,autoplay:!1}),l=e.secondsToMilliseconds(this.finishedTime??this.time);n.setWithVelocity(o.sample(l-10).value,o.sample(l).value,10),o.stop()}}const We=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!G.test(t)&&"0"!==t||t.startsWith("url(")));function Ne(t){return e.isObject(t)&&"offsetHeight"in t}const $e=new Set(["opacity","clipPath","filter","transform"]),Be=e.memo((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));function je(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:a}=t;if(!Ne(e?.owner?.current))return!1;const{onUpdate:o,transformTemplate:l}=e.owner.getProps();return Be()&&n&&$e.has(n)&&("transform"!==n||!l)&&!o&&!s&&"mirror"!==i&&0!==r&&"inertia"!==a}class Ie{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>e.attachTimeline(t)));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Ye extends Ce{constructor(t){super(),this.animation=t,t.onfinish=()=>{this.finishedTime=this.time,this.notifyFinished()}}}const Xe=new WeakMap;const Ue=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ge(t){const e=Ue.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}function qe(t,n,s=1){e.invariant(s<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[i,r]=Ge(t);if(!i)return;const a=window.getComputedStyle(n).getPropertyValue(i);if(a){const t=a.trim();return e.isNumericalString(t)?parseFloat(t):t}return y(r)?qe(r,n,s+1):r}function ze(t,e){return t?.[e]??t?.default??t}const Ze=new Set(["width","height","top","left","right","bottom",...oe]),_e=t=>e=>e.test(t),He=[v,F,D,R,K,C,{test:t=>"auto"===t,parse:t=>t}],Je=t=>He.find(_e(t));const Qe=new Set(["brightness","contrast","saturate","opacity"]);function tn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(M)||[];if(!s)return t;const i=n.replace(s,"");let r=Qe.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const en=/\b([a-z-]*)\(.*?\)/gu,nn={...G,getAnimatableNone:t=>{const e=t.match(en);return e?e.map(tn).join(" "):t}},sn={...v,transform:Math.round},rn={rotate:R,rotateX:R,rotateY:R,rotateZ:R,scale:b,scaleX:b,scaleY:b,scaleZ:b,skew:R,skewX:R,skewY:R,distance:F,translateX:F,translateY:F,translateZ:F,x:F,y:F,z:F,perspective:F,transformPerspective:F,opacity:T,originX:O,originY:O,originZ:F},an={borderWidth:F,borderTopWidth:F,borderRightWidth:F,borderBottomWidth:F,borderLeftWidth:F,borderRadius:F,radius:F,borderTopLeftRadius:F,borderTopRightRadius:F,borderBottomRightRadius:F,borderBottomLeftRadius:F,width:F,maxWidth:F,height:F,maxHeight:F,top:F,right:F,bottom:F,left:F,padding:F,paddingTop:F,paddingRight:F,paddingBottom:F,paddingLeft:F,margin:F,marginTop:F,marginRight:F,marginBottom:F,marginLeft:F,backgroundPositionX:F,backgroundPositionY:F,...rn,zIndex:sn,fillOpacity:T,strokeOpacity:T,numOctaves:sn},on={...an,color:W,backgroundColor:W,outlineColor:W,fill:W,stroke:W,borderColor:W,borderTopColor:W,borderRightColor:W,borderBottomColor:W,borderLeftColor:W,filter:nn,WebkitFilter:nn},ln=t=>on[t];function un(t,e){let n=ln(t);return n!==nn&&(n=G),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const cn=new Set(["auto","none","0"]);const hn=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","radius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","backgroundPositionX","backgroundPositionY"]);const dn=e.memo((()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0})),mn=new Set(["opacity","clipPath","filter","transform"]),pn={current:void 0};class fn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=h.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty();e&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=h.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new e.SubscriptionManager);const s=this.events[t].add(n);return"change"===t?()=>{s(),r.read((()=>{this.events.change.getSize()||this.stop()}))}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}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 pn.current&&pn.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=h.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e.velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}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 yn(t,e){return new fn(t,e)}function gn(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let s=document;e&&(s=e.current);const i=n?.[t]??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}const vn=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class Tn{constructor(){this.latest={},this.values=new Map}set(t,e,n,s,i=!0){const o=this.values.get(t);o&&o.onRemove();const l=()=>{const s=e.get();this.latest[t]=i?vn(s,an[t]):s,n&&r.render(n)};l();const u=e.on("change",l);s&&e.addDependent(s);const c=()=>{u(),n&&a(n),this.values.delete(t),s&&e.removeDependent(s)};return this.values.set(t,{value:e,onRemove:c}),c}get(t){return this.values.get(t)?.value}destroy(){for(const t of this.values.values())t.onRemove()}}const bn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const wn=(t,e,n,s)=>{let i,r;return le.has(n)?(e.get("transform")||e.set("transform",new fn("none"),(()=>{t.style.transform=function(t){let e="",n=!0;for(let s=0;s<oe.length;s++){const i=oe[s],r=t.latest[i];if(void 0===r)continue;let a=!0;a="number"==typeof r?r===(i.startsWith("scale")?1:0):0===parseFloat(r),a||(n=!1,e+=`${bn[i]||i}(${t.latest[i]}) `)}return n?"none":e.trim()}(e)})),r=e.get("transform")):i=we(n)?()=>{t.style.setProperty(n,e.latest[n])}:()=>{t.style[n]=e.latest[n]},e.set(n,s,i,r)},Mn=(xn=function(t){const e=new WeakMap,n=[];return(s,i)=>{const r=e.get(s)??new Tn;e.set(s,r);for(const e in i){const a=i[e],o=t(s,r,e,a);n.push(o)}return()=>{for(const t of n)t()}}}(wn),(t,e)=>{const n=gn(t),s=[];for(const t of n){const n=xn(t,e);s.push(n)}return()=>{for(const t of s)t()}});var xn;const{schedule:Sn,cancel:An}=i(queueMicrotask,!1),kn={x:!1,y:!1};function En(){return kn.x||kn.y}function Vn(t,e){const n=gn(t),s=new AbortController;return[n,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function Pn(t){return!("touch"===t.pointerType||En())}const Rn=(t,e)=>!!e&&(t===e||Rn(t,e.parentElement)),Dn=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Fn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Cn=new WeakSet;function Kn(t){return e=>{"Enter"===e.key&&t(e)}}function On(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Ln(t){return Dn(t)&&!En()}function Wn(){const{value:t}=s;null!==t?(t.frameloop.rate.push(o.delta),t.animations.mainThread.push(d.mainThread),t.animations.waapi.push(d.waapi),t.animations.layout.push(d.layout)):a(Wn)}function Nn(t){return t.reduce(((t,e)=>t+e),0)/t.length}function $n(t,e=Nn){return 0===t.length?{min:0,max:0,avg:0}:{min:Math.min(...t),max:Math.max(...t),avg:e(t)}}const Bn=t=>Math.round(1e3/t);function jn(){s.value=null,s.addProjectionMetrics=null}function In(){const{value:t}=s;if(!t)throw new Error("Stats are not being measured");jn(),a(Wn);const e={frameloop:{setup:$n(t.frameloop.setup),rate:$n(t.frameloop.rate),read:$n(t.frameloop.read),resolveKeyframes:$n(t.frameloop.resolveKeyframes),preUpdate:$n(t.frameloop.preUpdate),update:$n(t.frameloop.update),preRender:$n(t.frameloop.preRender),render:$n(t.frameloop.render),postRender:$n(t.frameloop.postRender)},animations:{mainThread:$n(t.animations.mainThread),waapi:$n(t.animations.waapi),layout:$n(t.animations.layout)},layoutProjection:{nodes:$n(t.layoutProjection.nodes),calculatedTargetDeltas:$n(t.layoutProjection.calculatedTargetDeltas),calculatedProjections:$n(t.layoutProjection.calculatedProjections)}},{rate:n}=e.frameloop;return n.min=Bn(n.min),n.max=Bn(n.max),n.avg=Bn(n.avg),[n.min,n.max]=[n.max,n.min],e}function Yn(t){return e.isObject(t)&&"ownerSVGElement"in t}function Xn(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],i=Wt(t[1+n],t[2+n],t[3+n]);return e?i(s):i}function Un(t){const e=[];pn.current=e;const n=t();pn.current=void 0;const s=yn(n);return function(t,e,n){const s=()=>e.set(n()),i=()=>r.preRender(s,!1,!0),o=t.map((t=>t.on("change",i)));e.on("destroy",(()=>{o.forEach((t=>t())),a(s)}))}(e,s,t),s}const Gn=t=>Boolean(t&&t.getVelocity);function qn(t,e,n){const s=t.get();let i,a=null,o=s;const l="string"==typeof s?s.replace(/[\d.-]/g,""):void 0,u=()=>{a&&(a.stop(),a=null)},c=()=>{u(),a=new Zt({keyframes:[Zn(t.get()),Zn(o)],velocity:t.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:i})};let h;return t.attach(((e,n)=>(o=e,i=t=>n(zn(t,l)),r.postRender(c),t.get())),u),Gn(e)&&(h=e.on("change",(e=>t.set(zn(e,l)))),t.on("destroy",h)),h}function zn(t,e){return e?t+e:t}function Zn(t){return"number"==typeof t?t:parseFloat(t)}const _n=[...He,W,G];function Hn(t){return"layout"===t?"group":"enter"===t||"new"===t?"new":"exit"===t||"old"===t?"old":"group"}let Jn={},Qn=null;const ts=(t,e)=>{Jn[t]=e},es=()=>{Qn||(Qn=document.createElement("style"),Qn.id="motion-view");let t="";for(const e in Jn){const n=Jn[e];t+=`${e} {\n`;for(const[e,s]of Object.entries(n))t+=` ${e}: ${s};\n`;t+="}\n"}Qn.textContent=t,document.head.appendChild(Qn),Jn={}},ns=()=>{Qn&&Qn.parentElement&&Qn.parentElement.removeChild(Qn)};function ss(t){const e=t.match(/::view-transition-(old|new|group|image-pair)\((.*?)\)/);return e?{layer:e[2],type:e[1]}:null}function is(t){const{effect:e}=t;return!!e&&(e.target===document.documentElement&&e.pseudoElement?.startsWith("::view-transition"))}const rs=["layout","enter","exit","new","old"];function as(t){const{update:n,targets:s,options:i}=t;if(!document.startViewTransition)return new Promise((async t=>{await n(),t(new Ie([]))}));(function(t,e){return e.has(t)&&Object.keys(e.get(t)).length>0})("root",s)||ts(":root",{"view-transition-name":"none"}),ts("::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)",{"animation-timing-function":"linear !important"}),es();const r=document.startViewTransition((async()=>{await n()}));return r.finished.finally((()=>{ns()})),new Promise((t=>{r.ready.then((()=>{const n=document.getAnimations().filter(is),r=[];s.forEach(((t,n)=>{for(const s of rs){if(!t[s])continue;const{keyframes:a,options:o}=t[s];for(let[t,l]of Object.entries(a)){if(!l)continue;const a={...ze(i,t),...ze(o,t)},u=Hn(s);if("opacity"===t&&!Array.isArray(l)){l=["new"===u?0:1,l]}"function"==typeof a.delay&&(a.delay=a.delay(0,1)),a.duration&&(a.duration=e.secondsToMilliseconds(a.duration)),a.delay&&(a.delay=e.secondsToMilliseconds(a.delay));const c=new Ce({...a,element:document.documentElement,name:t,pseudoElement:`::view-transition-${u}(${n})`,keyframes:l});r.push(c)}}}));for(const t of n){if("finished"===t.playState)continue;const{effect:n}=t;if(!(n&&n instanceof KeyframeEffect))continue;const{pseudoElement:a}=n;if(!a)continue;const o=ss(a);if(!o)continue;const l=s.get(o.layer);if(l)os(l,"enter")&&os(l,"exit")&&n.getKeyframes().some((t=>t.mixBlendMode))?r.push(new Ye(t)):t.cancel();else{const s="group"===o.type?"layout":"";let a={...ze(i,s)};a.duration&&(a.duration=e.secondsToMilliseconds(a.duration)),a=Fe(a);const l=Pe(a.ease,a.duration);n.updateTiming({delay:e.secondsToMilliseconds(a.delay??0),duration:a.duration,easing:l}),r.push(new Ye(t))}}t(new Ie(r))}))}))}function os(t,e){return t?.[e]?.keyframes.opacity}let ls=[],us=null;function cs(){us=null;const[t]=ls;var n;t&&(n=t,e.removeItem(ls,n),us=n,as(n).then((t=>{n.notifyReady(t),t.finished.finally(cs)})))}function hs(){for(let t=ls.length-1;t>=0;t--){const e=ls[t],{interrupt:n}=e.options;if("immediate"===n){const n=ls.slice(0,t+1).map((t=>t.update)),s=ls.slice(t+1);e.update=()=>{n.forEach((t=>t()))},ls=[e,...s];break}}us&&"immediate"!==ls[0]?.options.interrupt||cs()}class ds{constructor(t,n={}){var s;this.currentTarget="root",this.targets=new Map,this.notifyReady=e.noop,this.readyPromise=new Promise((t=>{this.notifyReady=t})),this.update=t,this.options={interrupt:"wait",...n},s=this,ls.push(s),Sn.render(hs)}get(t){return this.currentTarget=t,this}layout(t,e){return this.updateTarget("layout",t,e),this}new(t,e){return this.updateTarget("new",t,e),this}old(t,e){return this.updateTarget("old",t,e),this}enter(t,e){return this.updateTarget("enter",t,e),this}exit(t,e){return this.updateTarget("exit",t,e),this}crossfade(t){return this.updateTarget("enter",{opacity:1},t),this.updateTarget("exit",{opacity:0},t),this}updateTarget(t,e,n={}){const{currentTarget:s,targets:i}=this;i.has(s)||i.set(s,{});i.get(s)[t]={keyframes:e,options:n}}then(t,e){return this.readyPromise.then(t,e)}}const ms=r,ps=n.reduce(((t,e)=>(t[e]=t=>a(t),t)),{});t.AsyncMotionValueAnimation=class extends qt{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",keyframes:a,name:o,motionValue:l,element:u,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=h.now();const d={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,name:o,motionValue:l,element:u,...c},m=u?.KeyframeResolver||be;this.keyframeResolver=new m(a,((t,e,n)=>this.onKeyframesResolved(t,e,d,!n)),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,s,i){this.keyframeResolver=void 0;const{name:r,type:a,velocity:o,delay:l,isHandoff:u,onUpdate:c}=s;this.resolvedAt=h.now(),function(t,n,s,i){const r=t[0];if(null===r)return!1;if("display"===n||"visibility"===n)return!0;const a=t[t.length-1],o=We(r,n),l=We(a,n);return e.warning(o===l,`You are trying to animate ${n} from "${r}" to "${a}". ${r} is not an animatable value - to enable this animation set ${r} to a value animatable to ${a} via the \`style\` property.`),!(!o||!l)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===s||De(s))&&i)}(t,r,a,o)||(!e.MotionGlobalConfig.instantAnimations&&l||c?.(Xt(t,s,n)),t[0]=t[t.length-1],s.duration=0,s.repeat=0);const d={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},m=!u&&je(d)?new Le({...d,element:d.motionValue.owner.current}):new Zt(d);m.finished.then((()=>this.notifyFinished())).catch(e.noop),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}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(),Te()),this._animation}get duration(){return this.animation.duration}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()}},t.DOMKeyframesResolver=class extends be{constructor(t,e,n,s,i){super(t,e,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let s=t[n];if("string"==typeof s&&(s=s.trim(),y(s))){const i=qe(s,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!Ze.has(n)||2!==t.length)return;const[s,i]=t,r=Je(s),a=Je(i);if(r!==a)if(ue(r)&&ue(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else de[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let n=0;n<t.length;n++)(null===t[n]||("number"==typeof(i=t[n])?0===i:null===i||"none"===i||"0"===i||e.isZeroValueString(i)))&&s.push(n);var i;s.length&&function(t,e,n){let s,i=0;for(;i<t.length&&!s;){const e=t[i];"string"==typeof e&&!cn.has(e)&&I(e).values.length&&(s=t[i]),i++}if(s&&n)for(const i of e)t[i]=un(n,s)}(t,s,n)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=de[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(n,s).jump(s,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(e);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,r=n[i];n[i]=de[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach((([e,n])=>{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}},t.GroupAnimation=Ie,t.GroupAnimationWithThen=class extends Ie{then(t,e){return this.finished.finally(t).then((()=>{}))}},t.JSAnimation=Zt,t.KeyframeResolver=be,t.MotionValue=fn,t.NativeAnimation=Ce,t.NativeAnimationExtended=Le,t.NativeAnimationWrapper=Ye,t.ViewTransitionBuilder=ds,t.acceleratedValues=mn,t.activeAnimations=d,t.addStyleValue=wn,t.alpha=T,t.analyseComplexValue=I,t.animateValue=function(t){return new Zt(t)},t.animateView=function(t,e={}){return new ds(t,e)},t.animationMapKey=(t,e="")=>`${t}:${e}`,t.applyPxDefaults=function(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&hn.has(e)&&(t[n]=t[n]+"px")},t.attachSpring=qn,t.calcGeneratorDuration=dt,t.cancelFrame=a,t.cancelMicrotask=An,t.cancelSync=ps,t.collectMotionValues=pn,t.color=W,t.complex=G,t.convertOffsetToTimes=Bt,t.createGeneratorEasing=mt,t.createRenderBatcher=i,t.cubicBezierAsString=Ee,t.defaultEasing=jt,t.defaultOffset=$t,t.defaultTransformValue=ie,t.defaultValueTypes=on,t.degrees=R,t.dimensionValueTypes=He,t.fillOffset=Nt,t.fillWildcards=_t,t.findDimensionValueType=Je,t.findValueType=t=>_n.find(_e(t)),t.flushKeyframeResolvers=Te,t.frame=r,t.frameData=o,t.frameSteps=l,t.generateLinearEasing=ct,t.getAnimatableNone=un,t.getAnimationMap=function(t){const e=Xe.get(t)||new Map;return Xe.set(t,e),e},t.getComputedStyle=function(t,e){const n=window.getComputedStyle(t);return we(e)?n.getPropertyValue(e):n[e]},t.getDefaultValueType=ln,t.getMixer=it,t.getValueAsType=vn,t.getValueTransition=ze,t.getVariableValue=qe,t.hex=V,t.hover=function(t,e,n={}){const[s,i,r]=Vn(t,n),a=t=>{if(!Pn(t))return;const{target:n}=t,s=e(n,t);if("function"!=typeof s||!n)return;const r=t=>{Pn(t)&&(s(t),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,i)};return s.forEach((t=>{t.addEventListener("pointerenter",a,i)})),r},t.hsla=L,t.hslaToRgba=z,t.inertia=Lt,t.interpolate=Wt,t.invisibleValues=et,t.isCSSVariableName=p,t.isCSSVariableToken=y,t.isDragActive=En,t.isDragging=kn,t.isGenerator=De,t.isHTMLElement=Ne,t.isMotionValue=Gn,t.isNodeOrChild=Rn,t.isPrimaryPointer=Dn,t.isSVGElement=Yn,t.isSVGSVGElement=function(t){return Yn(t)&&"svg"===t.tagName},t.isWaapiSupportedEasing=function t(n){return Boolean("function"==typeof n&&ke()||!n||"string"==typeof n&&(n in Ve||ke())||e.isBezierDefinition(n)||Array.isArray(n)&&n.every(t))},t.keyframes=It,t.mapEasingToNativeEasing=Pe,t.mapValue=function(t,e,n,s){const i=Xn(e,n,s);return Un((()=>i(t.get())))},t.maxGeneratorDuration=ht,t.microtask=Sn,t.mix=lt,t.mixArray=rt,t.mixColor=tt,t.mixComplex=ot,t.mixImmediate=Z,t.mixLinearColor=H,t.mixNumber=_,t.mixObject=at,t.mixVisibility=nt,t.motionValue=yn,t.number=v,t.numberValueTypes=an,t.observeTimeline=function(t,e){let n;const s=()=>{const{currentTime:s}=e,i=(null===s?0:s.value)/100;n!==i&&t(i),n=i};return r.preUpdate(s,!0),()=>a(s)},t.parseCSSVariable=Ge,t.parseValueFromTransform=re,t.percent=D,t.positionalKeys=Ze,t.press=function(t,e,n={}){const[s,i,r]=Vn(t,n),a=t=>{const s=t.currentTarget;if(!Ln(t))return;Cn.add(s);const r=e(s,t),a=(t,e)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),Cn.has(s)&&Cn.delete(s),Ln(t)&&"function"==typeof r&&r(t,{success:e})},o=t=>{a(t,s===window||s===document||n.useGlobalTarget||Rn(s,t.target))},l=t=>{a(t,!1)};window.addEventListener("pointerup",o,i),window.addEventListener("pointercancel",l,i)};return s.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",a,i),Ne(t)&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const s=Kn((()=>{if(Cn.has(n))return;On(n,"down");const t=Kn((()=>{On(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>On(n,"cancel")),e)}));n.addEventListener("keydown",s,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",s)),e)})(t,i))),e=t,Fn.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),r},t.progressPercentage=O,t.px=F,t.readTransformValue=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return re(n,e)},t.recordStats=function(){if(s.value)throw jn(),new Error("Stats are already being measured");const t=s;return t.value={frameloop:{setup:[],rate:[],read:[],resolveKeyframes:[],preUpdate:[],update:[],preRender:[],render:[],postRender:[]},animations:{mainThread:[],waapi:[],layout:[]},layoutProjection:{nodes:[],calculatedTargetDeltas:[],calculatedProjections:[]}},t.addProjectionMetrics=e=>{const{layoutProjection:n}=t.value;n.nodes.push(e.nodes),n.calculatedTargetDeltas.push(e.calculatedTargetDeltas),n.calculatedProjections.push(e.calculatedProjections)},r.postRender(Wn,!0),In},t.resolveElements=gn,t.rgbUnit=k,t.rgba=E,t.scale=b,t.setDragLock=function(t){return"x"===t||"y"===t?kn[t]?null:(kn[t]=!0,()=>{kn[t]=!1}):kn.x||kn.y?null:(kn.x=kn.y=!0,()=>{kn.x=kn.y=!1})},t.setStyle=Me,t.spring=Ot,t.springValue=function(t,e){const n=yn(Gn(t)?t.get():t);return qn(n,t,e),n},t.startWaapiAnimation=Re,t.statsBuffer=s,t.styleEffect=Mn,t.supportedWaapiEasing=Ve,t.supportsBrowserAnimation=je,t.supportsFlags=Se,t.supportsLinearEasing=ke,t.supportsPartialKeyframes=dn,t.supportsScrollTimeline=xe,t.sync=ms,t.testValueType=_e,t.time=h,t.transform=Xn,t.transformPropOrder=oe,t.transformProps=le,t.transformValue=Un,t.transformValueTypes=rn,t.vh=C,t.vw=K}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],e=(()=>new Set(t))();const s={};class n{constructor(){this.subscriptions=[]}add(t){var e,s;return e=this.subscriptions,s=t,-1===e.indexOf(s)&&e.push(s),()=>function(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let r=0;r<n;r++){const n=this.subscriptions[r];n&&n(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const r=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],i={value:null,addProjectionMetrics:null};function a(t,e){let n=!1,a=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>n=!0,h=r.reduce(((t,s)=>(t[s]=function(t,e){let s=new Set,n=new Set,r=!1,a=!1;const o=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1},h=0;function d(e){o.has(e)&&(p.schedule(e),t()),h++,e(c)}const p={schedule:(t,e=!1,i=!1)=>{const a=i&&r?s:n;return e&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{c=t,r?a=!0:(r=!0,[s,n]=[n,s],s.forEach(d),e&&i.value&&i.value.frameloop[e].push(h),h=0,s.clear(),r=!1,a&&(a=!1,p.process(t)))}};return p}(c,e?s:void 0),t)),{}),{setup:d,read:p,resolveKeyframes:u,preUpdate:l,update:f,preRender:m,render:v,postRender:g}=h,y=()=>{const r=s.useManualTiming?o.timestamp:performance.now();n=!1,s.useManualTiming||(o.delta=a?1e3/60:Math.max(Math.min(r-o.timestamp,40),1)),o.timestamp=r,o.isProcessing=!0,d.process(o),p.process(o),u.process(o),l.process(o),f.process(o),m.process(o),v.process(o),g.process(o),o.isProcessing=!1,n&&e&&(a=!1,t(y))};return{schedule:r.reduce(((e,s)=>{const r=h[s];return e[s]=(e,s=!1,i=!1)=>(n||(n=!0,a=!0,o.isProcessing||t(y)),r.schedule(e,s,i)),e}),{}),cancel:t=>{for(let e=0;e<r.length;e++)h[r[e]].cancel(t)},state:o,steps:h}}const{schedule:o,cancel:c,state:h,steps:d}=a("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:t=>t,!0);let p;function u(){p=void 0}const l={now:()=>(void 0===p&&l.set(h.isProcessing||s.useManualTiming?h.timestamp:performance.now()),p),set:t=>{p=t,queueMicrotask(u)}};class f{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const s=l.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty();e&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=l.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}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 n);const s=this.events[t].add(e);return"change"===t?()=>{s(),o.read((()=>{this.events.change.getSize()||this.stop()}))}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}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 this.current}getPrevious(){return this.prev}getVelocity(){const t=l.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return s=parseFloat(this.current)-parseFloat(this.prevFrameValue),(n=e)?s*(1e3/n):0;var s,n}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()}}const m={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},v={...m,transform:t=>((t,e,s)=>s>e?e:s<t?t:s)(0,1,t)},g={...m,default:1},y={...m,transform:Math.round},w=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),A=w("deg"),b=w("%"),P=w("px"),R=(()=>({...b,parse:t=>b.parse(t)/100,transform:t=>b.transform(100*t)}))(),k={borderWidth:P,borderTopWidth:P,borderRightWidth:P,borderBottomWidth:P,borderLeftWidth:P,borderRadius:P,radius:P,borderTopLeftRadius:P,borderTopRightRadius:P,borderBottomRightRadius:P,borderBottomLeftRadius:P,width:P,maxWidth:P,height:P,maxHeight:P,top:P,right:P,bottom:P,left:P,padding:P,paddingTop:P,paddingRight:P,paddingBottom:P,paddingLeft:P,margin:P,marginTop:P,marginRight:P,marginBottom:P,marginLeft:P,backgroundPositionX:P,backgroundPositionY:P,...{rotate:A,rotateX:A,rotateY:A,rotateZ:A,scale:g,scaleX:g,scaleY:g,scaleZ:g,skew:A,skewX:A,skewY:A,distance:P,translateX:P,translateY:P,translateZ:P,x:P,y:P,z:P,perspective:P,transformPerspective:P,opacity:v,originX:R,originY:R,originZ:P},zIndex:y,fillOpacity:v,strokeOpacity:v,numOctaves:y};class F{constructor(){this.latest={},this.values=new Map}set(t,e,s,n){const
|
|
1
|
+
const t=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],e=(()=>new Set(t))();const s={};class n{constructor(){this.subscriptions=[]}add(t){var e,s;return e=this.subscriptions,s=t,-1===e.indexOf(s)&&e.push(s),()=>function(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let r=0;r<n;r++){const n=this.subscriptions[r];n&&n(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const r=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],i={value:null,addProjectionMetrics:null};function a(t,e){let n=!1,a=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>n=!0,h=r.reduce(((t,s)=>(t[s]=function(t,e){let s=new Set,n=new Set,r=!1,a=!1;const o=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1},h=0;function d(e){o.has(e)&&(p.schedule(e),t()),h++,e(c)}const p={schedule:(t,e=!1,i=!1)=>{const a=i&&r?s:n;return e&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{c=t,r?a=!0:(r=!0,[s,n]=[n,s],s.forEach(d),e&&i.value&&i.value.frameloop[e].push(h),h=0,s.clear(),r=!1,a&&(a=!1,p.process(t)))}};return p}(c,e?s:void 0),t)),{}),{setup:d,read:p,resolveKeyframes:u,preUpdate:l,update:f,preRender:m,render:v,postRender:g}=h,y=()=>{const r=s.useManualTiming?o.timestamp:performance.now();n=!1,s.useManualTiming||(o.delta=a?1e3/60:Math.max(Math.min(r-o.timestamp,40),1)),o.timestamp=r,o.isProcessing=!0,d.process(o),p.process(o),u.process(o),l.process(o),f.process(o),m.process(o),v.process(o),g.process(o),o.isProcessing=!1,n&&e&&(a=!1,t(y))};return{schedule:r.reduce(((e,s)=>{const r=h[s];return e[s]=(e,s=!1,i=!1)=>(n||(n=!0,a=!0,o.isProcessing||t(y)),r.schedule(e,s,i)),e}),{}),cancel:t=>{for(let e=0;e<r.length;e++)h[r[e]].cancel(t)},state:o,steps:h}}const{schedule:o,cancel:c,state:h,steps:d}=a("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:t=>t,!0);let p;function u(){p=void 0}const l={now:()=>(void 0===p&&l.set(h.isProcessing||s.useManualTiming?h.timestamp:performance.now()),p),set:t=>{p=t,queueMicrotask(u)}};class f{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const s=l.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty();e&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=l.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}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 n);const s=this.events[t].add(e);return"change"===t?()=>{s(),o.read((()=>{this.events.change.getSize()||this.stop()}))}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}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 this.current}getPrevious(){return this.prev}getVelocity(){const t=l.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return s=parseFloat(this.current)-parseFloat(this.prevFrameValue),(n=e)?s*(1e3/n):0;var s,n}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()}}const m={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},v={...m,transform:t=>((t,e,s)=>s>e?e:s<t?t:s)(0,1,t)},g={...m,default:1},y={...m,transform:Math.round},w=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),A=w("deg"),b=w("%"),P=w("px"),R=(()=>({...b,parse:t=>b.parse(t)/100,transform:t=>b.transform(100*t)}))(),k={borderWidth:P,borderTopWidth:P,borderRightWidth:P,borderBottomWidth:P,borderLeftWidth:P,borderRadius:P,radius:P,borderTopLeftRadius:P,borderTopRightRadius:P,borderBottomRightRadius:P,borderBottomLeftRadius:P,width:P,maxWidth:P,height:P,maxHeight:P,top:P,right:P,bottom:P,left:P,padding:P,paddingTop:P,paddingRight:P,paddingBottom:P,paddingLeft:P,margin:P,marginTop:P,marginRight:P,marginBottom:P,marginLeft:P,backgroundPositionX:P,backgroundPositionY:P,...{rotate:A,rotateX:A,rotateY:A,rotateZ:A,scale:g,scaleX:g,scaleY:g,scaleZ:g,skew:A,skewX:A,skewY:A,distance:P,translateX:P,translateY:P,translateZ:P,x:P,y:P,z:P,perspective:P,transformPerspective:P,opacity:v,originX:R,originY:R,originZ:P},zIndex:y,fillOpacity:v,strokeOpacity:v,numOctaves:y};class F{constructor(){this.latest={},this.values=new Map}set(t,e,s,n,r=!0){const i=this.values.get(t);i&&i.onRemove();const a=()=>{const n=e.get();this.latest[t]=r?((t,e)=>e&&"number"==typeof t?e.transform(t):t)(n,k[t]):n,s&&o.render(s)};a();const h=e.on("change",a);n&&e.addDependent(n);const d=()=>{h(),s&&c(s),this.values.delete(t),n&&e.removeDependent(n)};return this.values.set(t,{value:e,onRemove:d}),d}get(t){return this.values.get(t)?.value}destroy(){for(const t of this.values.values())t.onRemove()}}const T={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const V=(s,n,r,i)=>{let a,o;return e.has(r)?(n.get("transform")||n.set("transform",new f("none"),(()=>{s.style.transform=function(e){let s="",n=!0;for(let r=0;r<t.length;r++){const i=t[r],a=e.latest[i];if(void 0===a)continue;let o=!0;o="number"==typeof a?a===(i.startsWith("scale")?1:0):0===parseFloat(a),o||(n=!1,s+=`${T[i]||i}(${e.latest[i]}) `)}return n?"none":s.trim()}(n)})),o=n.get("transform")):a=r.startsWith("--")?()=>{s.style.setProperty(r,n.latest[r])}:()=>{s.style[r]=n.latest[r]},n.set(r,i,a,o)},W=(x=function(t){const e=new WeakMap,s=[];return(n,r)=>{const i=e.get(n)??new F;e.set(n,i);for(const e in r){const a=r[e],o=t(n,i,e,a);s.push(o)}return()=>{for(const t of s)t()}}}(V),(t,e)=>{const s=function(t,e,s){if(t instanceof EventTarget)return[t];if("string"==typeof t){let n=document;e&&(n=e.current);const r=s?.[t]??n.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}(t),n=[];for(const t of s){const s=x(t,e);n.push(s)}return()=>{for(const t of n)t()}});var x;export{V as addStyleValue,W as styleEffect};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-dom",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.13.0",
|
|
4
4
|
"author": "Matt Perry",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/motiondivision/motion",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"motion-utils": "^12.
|
|
20
|
+
"motion-utils": "^12.12.1"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"clean": "rm -rf types dist lib",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"maxSize": "1.8 kB"
|
|
37
37
|
}
|
|
38
38
|
],
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "6aa294fb70c656d50442d9c0bd98386eabf21ff4"
|
|
40
40
|
}
|