motion-dom 12.14.0 → 12.15.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 CHANGED
@@ -3050,6 +3050,152 @@ const acceleratedValues = new Set([
3050
3050
  // "background-color"
3051
3051
  ]);
3052
3052
 
3053
+ function camelToDash(str) {
3054
+ return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
3055
+ }
3056
+
3057
+ function resolveElements(elementOrSelector, scope, selectorCache) {
3058
+ if (elementOrSelector instanceof EventTarget) {
3059
+ return [elementOrSelector];
3060
+ }
3061
+ else if (typeof elementOrSelector === "string") {
3062
+ let root = document;
3063
+ if (scope) {
3064
+ root = scope.current;
3065
+ }
3066
+ const elements = selectorCache?.[elementOrSelector] ??
3067
+ root.querySelectorAll(elementOrSelector);
3068
+ return elements ? Array.from(elements) : [];
3069
+ }
3070
+ return Array.from(elementOrSelector);
3071
+ }
3072
+
3073
+ function createSelectorEffect(subjectEffect) {
3074
+ return (subject, values) => {
3075
+ const elements = resolveElements(subject);
3076
+ const subscriptions = [];
3077
+ for (const element of elements) {
3078
+ const remove = subjectEffect(element, values);
3079
+ subscriptions.push(remove);
3080
+ }
3081
+ return () => {
3082
+ for (const remove of subscriptions)
3083
+ remove();
3084
+ };
3085
+ };
3086
+ }
3087
+
3088
+ /**
3089
+ * Provided a value and a ValueType, returns the value as that value type.
3090
+ */
3091
+ const getValueAsType = (value, type) => {
3092
+ return type && typeof value === "number"
3093
+ ? type.transform(value)
3094
+ : value;
3095
+ };
3096
+
3097
+ class MotionValueState {
3098
+ constructor() {
3099
+ this.latest = {};
3100
+ this.values = new Map();
3101
+ }
3102
+ set(name, value, render, computed, useDefaultValueType = true) {
3103
+ const existingValue = this.values.get(name);
3104
+ if (existingValue) {
3105
+ existingValue.onRemove();
3106
+ }
3107
+ const onChange = () => {
3108
+ const v = value.get();
3109
+ if (useDefaultValueType) {
3110
+ this.latest[name] = getValueAsType(v, numberValueTypes[name]);
3111
+ }
3112
+ else {
3113
+ this.latest[name] = v;
3114
+ }
3115
+ render && frame.render(render);
3116
+ };
3117
+ onChange();
3118
+ const cancelOnChange = value.on("change", onChange);
3119
+ computed && value.addDependent(computed);
3120
+ const remove = () => {
3121
+ cancelOnChange();
3122
+ render && cancelFrame(render);
3123
+ this.values.delete(name);
3124
+ computed && value.removeDependent(computed);
3125
+ };
3126
+ this.values.set(name, { value, onRemove: remove });
3127
+ return remove;
3128
+ }
3129
+ get(name) {
3130
+ return this.values.get(name)?.value;
3131
+ }
3132
+ destroy() {
3133
+ for (const value of this.values.values()) {
3134
+ value.onRemove();
3135
+ }
3136
+ }
3137
+ }
3138
+
3139
+ function createEffect(addValue) {
3140
+ const stateCache = new WeakMap();
3141
+ const subscriptions = [];
3142
+ return (subject, values) => {
3143
+ const state = stateCache.get(subject) ?? new MotionValueState();
3144
+ stateCache.set(subject, state);
3145
+ for (const key in values) {
3146
+ const value = values[key];
3147
+ const remove = addValue(subject, state, key, value);
3148
+ subscriptions.push(remove);
3149
+ }
3150
+ return () => {
3151
+ for (const cancel of subscriptions)
3152
+ cancel();
3153
+ };
3154
+ };
3155
+ }
3156
+
3157
+ function canSetAsProperty(element, name) {
3158
+ if (!(name in element))
3159
+ return false;
3160
+ const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), name) ||
3161
+ Object.getOwnPropertyDescriptor(element, name);
3162
+ // Check if it has a setter
3163
+ return descriptor && typeof descriptor.set === "function";
3164
+ }
3165
+ const addAttrValue = (element, state, key, value) => {
3166
+ const isProp = canSetAsProperty(element, key);
3167
+ const name = isProp
3168
+ ? key
3169
+ : key.startsWith("data") || key.startsWith("aria")
3170
+ ? camelToDash(key)
3171
+ : key;
3172
+ /**
3173
+ * Set attribute directly via property if available
3174
+ */
3175
+ const render = isProp
3176
+ ? () => {
3177
+ element[name] = state.latest[key];
3178
+ }
3179
+ : () => {
3180
+ const v = state.latest[key];
3181
+ if (v === null || v === undefined) {
3182
+ element.removeAttribute(name);
3183
+ }
3184
+ else {
3185
+ element.setAttribute(name, String(v));
3186
+ }
3187
+ };
3188
+ return state.set(key, value, render);
3189
+ };
3190
+ const attrEffect = /*@__PURE__*/ createSelectorEffect(
3191
+ /*@__PURE__*/ createEffect(addAttrValue));
3192
+
3193
+ const propEffect = /*@__PURE__*/ createEffect((subject, state, key, value) => {
3194
+ return state.set(key, value, () => {
3195
+ subject[key] = state.latest[key];
3196
+ }, undefined, false);
3197
+ });
3198
+
3053
3199
  /**
3054
3200
  * Maximum time between the value of two frames, beyond which we
3055
3201
  * assume the velocity has since been 0.
@@ -3372,106 +3518,6 @@ function motionValue(init, options) {
3372
3518
  return new MotionValue(init, options);
3373
3519
  }
3374
3520
 
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
-
3406
- /**
3407
- * Provided a value and a ValueType, returns the value as that value type.
3408
- */
3409
- const getValueAsType = (value, type) => {
3410
- return type && typeof value === "number"
3411
- ? type.transform(value)
3412
- : value;
3413
- };
3414
-
3415
- class MotionValueState {
3416
- constructor() {
3417
- this.latest = {};
3418
- this.values = new Map();
3419
- }
3420
- set(name, value, render, computed, useDefaultValueType = true) {
3421
- const existingValue = this.values.get(name);
3422
- if (existingValue) {
3423
- existingValue.onRemove();
3424
- }
3425
- const onChange = () => {
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
- }
3433
- render && frame.render(render);
3434
- };
3435
- onChange();
3436
- const cancelOnChange = value.on("change", onChange);
3437
- computed && value.addDependent(computed);
3438
- const remove = () => {
3439
- cancelOnChange();
3440
- render && cancelFrame(render);
3441
- this.values.delete(name);
3442
- computed && value.removeDependent(computed);
3443
- };
3444
- this.values.set(name, { value, onRemove: remove });
3445
- return remove;
3446
- }
3447
- get(name) {
3448
- return this.values.get(name)?.value;
3449
- }
3450
- destroy() {
3451
- for (const value of this.values.values()) {
3452
- value.onRemove();
3453
- }
3454
- }
3455
- }
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
-
3475
3521
  const translateAlias = {
3476
3522
  x: "translateX",
3477
3523
  y: "translateY",
@@ -3513,6 +3559,11 @@ const addStyleValue = (element, state, key, value) => {
3513
3559
  let computed = undefined;
3514
3560
  if (transformProps.has(key)) {
3515
3561
  if (!state.get("transform")) {
3562
+ // If this is an HTML element, we need to set the transform-box to fill-box
3563
+ // to normalise the transform relative to the element's bounding box
3564
+ if (!isHTMLElement(element) && !state.get("transformBox")) {
3565
+ addStyleValue(element, state, "transformBox", new MotionValue("fill-box"));
3566
+ }
3516
3567
  state.set("transform", new MotionValue("none"), () => {
3517
3568
  element.style.transform = buildTransform(state);
3518
3569
  });
@@ -3545,6 +3596,38 @@ const addStyleValue = (element, state, key, value) => {
3545
3596
  const styleEffect = /*@__PURE__*/ createSelectorEffect(
3546
3597
  /*@__PURE__*/ createEffect(addStyleValue));
3547
3598
 
3599
+ const toPx = px.transform;
3600
+ function addSVGPathValue(element, state, key, value) {
3601
+ frame.render(() => element.setAttribute("pathLength", "1"));
3602
+ if (key === "pathOffset") {
3603
+ return state.set(key, value, () => element.setAttribute("stroke-dashoffset", toPx(-state.latest[key])));
3604
+ }
3605
+ else {
3606
+ if (!state.get("stroke-dasharray")) {
3607
+ state.set("stroke-dasharray", new MotionValue("1 1"), () => {
3608
+ const { pathLength = 1, pathSpacing } = state.latest;
3609
+ element.setAttribute("stroke-dasharray", `${toPx(pathLength)} ${toPx(pathSpacing ?? 1 - Number(pathLength))}`);
3610
+ });
3611
+ }
3612
+ return state.set(key, value, undefined, state.get("stroke-dasharray"));
3613
+ }
3614
+ }
3615
+ const addSVGValue = (element, state, key, value) => {
3616
+ if (key.startsWith("path")) {
3617
+ return addSVGPathValue(element, state, key, value);
3618
+ }
3619
+ else if (key.startsWith("attr")) {
3620
+ return addAttrValue(element, state, convertAttrKey(key), value);
3621
+ }
3622
+ const handler = key in element.style ? addStyleValue : addAttrValue;
3623
+ return handler(element, state, key, value);
3624
+ };
3625
+ const svgEffect = /*@__PURE__*/ createSelectorEffect(
3626
+ /*@__PURE__*/ createEffect(addSVGValue));
3627
+ function convertAttrKey(key) {
3628
+ return key.replace(/^attr([A-Z])/, (_, firstChar) => firstChar.toLowerCase());
3629
+ }
3630
+
3548
3631
  const { schedule: microtask, cancel: cancelMicrotask } =
3549
3632
  /* @__PURE__ */ createRenderBatcher(queueMicrotask, false);
3550
3633
 
@@ -4445,6 +4528,7 @@ exports.NativeAnimationWrapper = NativeAnimationWrapper;
4445
4528
  exports.ViewTransitionBuilder = ViewTransitionBuilder;
4446
4529
  exports.acceleratedValues = acceleratedValues;
4447
4530
  exports.activeAnimations = activeAnimations;
4531
+ exports.addAttrValue = addAttrValue;
4448
4532
  exports.addStyleValue = addStyleValue;
4449
4533
  exports.alpha = alpha;
4450
4534
  exports.analyseComplexValue = analyseComplexValue;
@@ -4453,6 +4537,7 @@ exports.animateView = animateView;
4453
4537
  exports.animationMapKey = animationMapKey;
4454
4538
  exports.applyPxDefaults = applyPxDefaults;
4455
4539
  exports.attachSpring = attachSpring;
4540
+ exports.attrEffect = attrEffect;
4456
4541
  exports.calcGeneratorDuration = calcGeneratorDuration;
4457
4542
  exports.cancelFrame = cancelFrame;
4458
4543
  exports.cancelMicrotask = cancelMicrotask;
@@ -4530,6 +4615,7 @@ exports.percent = percent;
4530
4615
  exports.positionalKeys = positionalKeys;
4531
4616
  exports.press = press;
4532
4617
  exports.progressPercentage = progressPercentage;
4618
+ exports.propEffect = propEffect;
4533
4619
  exports.px = px;
4534
4620
  exports.readTransformValue = readTransformValue;
4535
4621
  exports.recordStats = recordStats;
@@ -4550,6 +4636,7 @@ exports.supportsFlags = supportsFlags;
4550
4636
  exports.supportsLinearEasing = supportsLinearEasing;
4551
4637
  exports.supportsPartialKeyframes = supportsPartialKeyframes;
4552
4638
  exports.supportsScrollTimeline = supportsScrollTimeline;
4639
+ exports.svgEffect = svgEffect;
4553
4640
  exports.sync = sync;
4554
4641
  exports.testValueType = testValueType;
4555
4642
  exports.time = time;
@@ -0,0 +1,41 @@
1
+ import { camelToDash } from '../../render/dom/utils/camel-to-dash.mjs';
2
+ import { createSelectorEffect } from '../utils/create-dom-effect.mjs';
3
+ import { createEffect } from '../utils/create-effect.mjs';
4
+
5
+ function canSetAsProperty(element, name) {
6
+ if (!(name in element))
7
+ return false;
8
+ const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), name) ||
9
+ Object.getOwnPropertyDescriptor(element, name);
10
+ // Check if it has a setter
11
+ return descriptor && typeof descriptor.set === "function";
12
+ }
13
+ const addAttrValue = (element, state, key, value) => {
14
+ const isProp = canSetAsProperty(element, key);
15
+ const name = isProp
16
+ ? key
17
+ : key.startsWith("data") || key.startsWith("aria")
18
+ ? camelToDash(key)
19
+ : key;
20
+ /**
21
+ * Set attribute directly via property if available
22
+ */
23
+ const render = isProp
24
+ ? () => {
25
+ element[name] = state.latest[key];
26
+ }
27
+ : () => {
28
+ const v = state.latest[key];
29
+ if (v === null || v === undefined) {
30
+ element.removeAttribute(name);
31
+ }
32
+ else {
33
+ element.setAttribute(name, String(v));
34
+ }
35
+ };
36
+ return state.set(key, value, render);
37
+ };
38
+ const attrEffect = /*@__PURE__*/ createSelectorEffect(
39
+ /*@__PURE__*/ createEffect(addAttrValue));
40
+
41
+ export { addAttrValue, attrEffect };
@@ -0,0 +1,9 @@
1
+ import { createEffect } from '../utils/create-effect.mjs';
2
+
3
+ const propEffect = /*@__PURE__*/ createEffect((subject, state, key, value) => {
4
+ return state.set(key, value, () => {
5
+ subject[key] = state.latest[key];
6
+ }, undefined, false);
7
+ });
8
+
9
+ export { propEffect };
@@ -1,5 +1,6 @@
1
1
  import { isCSSVar } from '../../render/dom/is-css-var.mjs';
2
2
  import { transformProps } from '../../render/utils/keys-transform.mjs';
3
+ import { isHTMLElement } from '../../utils/is-html-element.mjs';
3
4
  import { MotionValue } from '../../value/index.mjs';
4
5
  import { createSelectorEffect } from '../utils/create-dom-effect.mjs';
5
6
  import { createEffect } from '../utils/create-effect.mjs';
@@ -11,6 +12,11 @@ const addStyleValue = (element, state, key, value) => {
11
12
  let computed = undefined;
12
13
  if (transformProps.has(key)) {
13
14
  if (!state.get("transform")) {
15
+ // If this is an HTML element, we need to set the transform-box to fill-box
16
+ // to normalise the transform relative to the element's bounding box
17
+ if (!isHTMLElement(element) && !state.get("transformBox")) {
18
+ addStyleValue(element, state, "transformBox", new MotionValue("fill-box"));
19
+ }
14
20
  state.set("transform", new MotionValue("none"), () => {
15
21
  element.style.transform = buildTransform(state);
16
22
  });
@@ -0,0 +1,41 @@
1
+ import { MotionValue } from '../../value/index.mjs';
2
+ import { px } from '../../value/types/numbers/units.mjs';
3
+ import { addAttrValue } from '../attr/index.mjs';
4
+ import { addStyleValue } from '../style/index.mjs';
5
+ import { createSelectorEffect } from '../utils/create-dom-effect.mjs';
6
+ import { createEffect } from '../utils/create-effect.mjs';
7
+ import { frame } from '../../frameloop/frame.mjs';
8
+
9
+ const toPx = px.transform;
10
+ function addSVGPathValue(element, state, key, value) {
11
+ frame.render(() => element.setAttribute("pathLength", "1"));
12
+ if (key === "pathOffset") {
13
+ return state.set(key, value, () => element.setAttribute("stroke-dashoffset", toPx(-state.latest[key])));
14
+ }
15
+ else {
16
+ if (!state.get("stroke-dasharray")) {
17
+ state.set("stroke-dasharray", new MotionValue("1 1"), () => {
18
+ const { pathLength = 1, pathSpacing } = state.latest;
19
+ element.setAttribute("stroke-dasharray", `${toPx(pathLength)} ${toPx(pathSpacing ?? 1 - Number(pathLength))}`);
20
+ });
21
+ }
22
+ return state.set(key, value, undefined, state.get("stroke-dasharray"));
23
+ }
24
+ }
25
+ const addSVGValue = (element, state, key, value) => {
26
+ if (key.startsWith("path")) {
27
+ return addSVGPathValue(element, state, key, value);
28
+ }
29
+ else if (key.startsWith("attr")) {
30
+ return addAttrValue(element, state, convertAttrKey(key), value);
31
+ }
32
+ const handler = key in element.style ? addStyleValue : addAttrValue;
33
+ return handler(element, state, key, value);
34
+ };
35
+ const svgEffect = /*@__PURE__*/ createSelectorEffect(
36
+ /*@__PURE__*/ createEffect(addSVGValue));
37
+ function convertAttrKey(key) {
38
+ return key.replace(/^attr([A-Z])/, (_, firstChar) => firstChar.toLowerCase());
39
+ }
40
+
41
+ export { svgEffect };
package/dist/es/index.mjs CHANGED
@@ -31,7 +31,10 @@ 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 { addAttrValue, attrEffect } from './effects/attr/index.mjs';
35
+ export { propEffect } from './effects/prop/index.mjs';
34
36
  export { addStyleValue, styleEffect } from './effects/style/index.mjs';
37
+ export { svgEffect } from './effects/svg/index.mjs';
35
38
  export { createRenderBatcher } from './frameloop/batcher.mjs';
36
39
  export { cancelMicrotask, microtask } from './frameloop/microtask.mjs';
37
40
  export { time } from './frameloop/sync-time.mjs';
@@ -0,0 +1,5 @@
1
+ function camelToDash(str) {
2
+ return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
3
+ }
4
+
5
+ export { camelToDash };
package/dist/index.d.ts CHANGED
@@ -1084,9 +1084,18 @@ declare class MotionValueState {
1084
1084
  destroy(): void;
1085
1085
  }
1086
1086
 
1087
+ declare const addAttrValue: (element: HTMLElement | SVGElement, state: MotionValueState, key: string, value: MotionValue) => () => void;
1088
+ declare const attrEffect: (subject: ElementOrSelector, values: Record<string, MotionValue<any>>) => () => void;
1089
+
1090
+ declare const propEffect: (subject: {
1091
+ [key: string]: any;
1092
+ }, values: Record<string, MotionValue<any>>) => VoidFunction;
1093
+
1087
1094
  declare const addStyleValue: (element: HTMLElement | SVGElement, state: MotionValueState, key: string, value: MotionValue) => () => void;
1088
1095
  declare const styleEffect: (subject: ElementOrSelector, values: Record<string, MotionValue<any>>) => () => void;
1089
1096
 
1097
+ declare const svgEffect: (subject: ElementOrSelector, values: Record<string, MotionValue<any>>) => () => void;
1098
+
1090
1099
  declare const frame: Batcher;
1091
1100
  declare const cancelFrame: (process: Process) => void;
1092
1101
  declare const frameData: FrameData;
@@ -1845,4 +1854,4 @@ declare const sync: Batcher;
1845
1854
  */
1846
1855
  declare const cancelSync: Record<string, (process: Process) => void>;
1847
1856
 
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 };
1857
+ 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, addAttrValue, addStyleValue, alpha, analyseComplexValue, animateValue, animateView, animationMapKey, applyPxDefaults, attachSpring, attrEffect, 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, propEffect, px, readTransformValue, recordStats, resolveElements, rgbUnit, rgba, scale, setDragLock, setStyle, spring, springValue, startWaapiAnimation, statsBuffer, styleEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, svgEffect, sync, testValueType, time, transform, transformPropOrder, transformProps, transformValue, transformValueTypes, vh, vw };
@@ -3049,6 +3049,152 @@
3049
3049
  // "background-color"
3050
3050
  ]);
3051
3051
 
3052
+ function camelToDash(str) {
3053
+ return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
3054
+ }
3055
+
3056
+ function resolveElements(elementOrSelector, scope, selectorCache) {
3057
+ if (elementOrSelector instanceof EventTarget) {
3058
+ return [elementOrSelector];
3059
+ }
3060
+ else if (typeof elementOrSelector === "string") {
3061
+ let root = document;
3062
+ if (scope) {
3063
+ root = scope.current;
3064
+ }
3065
+ const elements = selectorCache?.[elementOrSelector] ??
3066
+ root.querySelectorAll(elementOrSelector);
3067
+ return elements ? Array.from(elements) : [];
3068
+ }
3069
+ return Array.from(elementOrSelector);
3070
+ }
3071
+
3072
+ function createSelectorEffect(subjectEffect) {
3073
+ return (subject, values) => {
3074
+ const elements = resolveElements(subject);
3075
+ const subscriptions = [];
3076
+ for (const element of elements) {
3077
+ const remove = subjectEffect(element, values);
3078
+ subscriptions.push(remove);
3079
+ }
3080
+ return () => {
3081
+ for (const remove of subscriptions)
3082
+ remove();
3083
+ };
3084
+ };
3085
+ }
3086
+
3087
+ /**
3088
+ * Provided a value and a ValueType, returns the value as that value type.
3089
+ */
3090
+ const getValueAsType = (value, type) => {
3091
+ return type && typeof value === "number"
3092
+ ? type.transform(value)
3093
+ : value;
3094
+ };
3095
+
3096
+ class MotionValueState {
3097
+ constructor() {
3098
+ this.latest = {};
3099
+ this.values = new Map();
3100
+ }
3101
+ set(name, value, render, computed, useDefaultValueType = true) {
3102
+ const existingValue = this.values.get(name);
3103
+ if (existingValue) {
3104
+ existingValue.onRemove();
3105
+ }
3106
+ const onChange = () => {
3107
+ const v = value.get();
3108
+ if (useDefaultValueType) {
3109
+ this.latest[name] = getValueAsType(v, numberValueTypes[name]);
3110
+ }
3111
+ else {
3112
+ this.latest[name] = v;
3113
+ }
3114
+ render && frame.render(render);
3115
+ };
3116
+ onChange();
3117
+ const cancelOnChange = value.on("change", onChange);
3118
+ computed && value.addDependent(computed);
3119
+ const remove = () => {
3120
+ cancelOnChange();
3121
+ render && cancelFrame(render);
3122
+ this.values.delete(name);
3123
+ computed && value.removeDependent(computed);
3124
+ };
3125
+ this.values.set(name, { value, onRemove: remove });
3126
+ return remove;
3127
+ }
3128
+ get(name) {
3129
+ return this.values.get(name)?.value;
3130
+ }
3131
+ destroy() {
3132
+ for (const value of this.values.values()) {
3133
+ value.onRemove();
3134
+ }
3135
+ }
3136
+ }
3137
+
3138
+ function createEffect(addValue) {
3139
+ const stateCache = new WeakMap();
3140
+ const subscriptions = [];
3141
+ return (subject, values) => {
3142
+ const state = stateCache.get(subject) ?? new MotionValueState();
3143
+ stateCache.set(subject, state);
3144
+ for (const key in values) {
3145
+ const value = values[key];
3146
+ const remove = addValue(subject, state, key, value);
3147
+ subscriptions.push(remove);
3148
+ }
3149
+ return () => {
3150
+ for (const cancel of subscriptions)
3151
+ cancel();
3152
+ };
3153
+ };
3154
+ }
3155
+
3156
+ function canSetAsProperty(element, name) {
3157
+ if (!(name in element))
3158
+ return false;
3159
+ const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), name) ||
3160
+ Object.getOwnPropertyDescriptor(element, name);
3161
+ // Check if it has a setter
3162
+ return descriptor && typeof descriptor.set === "function";
3163
+ }
3164
+ const addAttrValue = (element, state, key, value) => {
3165
+ const isProp = canSetAsProperty(element, key);
3166
+ const name = isProp
3167
+ ? key
3168
+ : key.startsWith("data") || key.startsWith("aria")
3169
+ ? camelToDash(key)
3170
+ : key;
3171
+ /**
3172
+ * Set attribute directly via property if available
3173
+ */
3174
+ const render = isProp
3175
+ ? () => {
3176
+ element[name] = state.latest[key];
3177
+ }
3178
+ : () => {
3179
+ const v = state.latest[key];
3180
+ if (v === null || v === undefined) {
3181
+ element.removeAttribute(name);
3182
+ }
3183
+ else {
3184
+ element.setAttribute(name, String(v));
3185
+ }
3186
+ };
3187
+ return state.set(key, value, render);
3188
+ };
3189
+ const attrEffect = /*@__PURE__*/ createSelectorEffect(
3190
+ /*@__PURE__*/ createEffect(addAttrValue));
3191
+
3192
+ const propEffect = /*@__PURE__*/ createEffect((subject, state, key, value) => {
3193
+ return state.set(key, value, () => {
3194
+ subject[key] = state.latest[key];
3195
+ }, undefined, false);
3196
+ });
3197
+
3052
3198
  /**
3053
3199
  * Maximum time between the value of two frames, beyond which we
3054
3200
  * assume the velocity has since been 0.
@@ -3371,106 +3517,6 @@
3371
3517
  return new MotionValue(init, options);
3372
3518
  }
3373
3519
 
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
-
3405
- /**
3406
- * Provided a value and a ValueType, returns the value as that value type.
3407
- */
3408
- const getValueAsType = (value, type) => {
3409
- return type && typeof value === "number"
3410
- ? type.transform(value)
3411
- : value;
3412
- };
3413
-
3414
- class MotionValueState {
3415
- constructor() {
3416
- this.latest = {};
3417
- this.values = new Map();
3418
- }
3419
- set(name, value, render, computed, useDefaultValueType = true) {
3420
- const existingValue = this.values.get(name);
3421
- if (existingValue) {
3422
- existingValue.onRemove();
3423
- }
3424
- const onChange = () => {
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
- }
3432
- render && frame.render(render);
3433
- };
3434
- onChange();
3435
- const cancelOnChange = value.on("change", onChange);
3436
- computed && value.addDependent(computed);
3437
- const remove = () => {
3438
- cancelOnChange();
3439
- render && cancelFrame(render);
3440
- this.values.delete(name);
3441
- computed && value.removeDependent(computed);
3442
- };
3443
- this.values.set(name, { value, onRemove: remove });
3444
- return remove;
3445
- }
3446
- get(name) {
3447
- return this.values.get(name)?.value;
3448
- }
3449
- destroy() {
3450
- for (const value of this.values.values()) {
3451
- value.onRemove();
3452
- }
3453
- }
3454
- }
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
-
3474
3520
  const translateAlias = {
3475
3521
  x: "translateX",
3476
3522
  y: "translateY",
@@ -3512,6 +3558,11 @@
3512
3558
  let computed = undefined;
3513
3559
  if (transformProps.has(key)) {
3514
3560
  if (!state.get("transform")) {
3561
+ // If this is an HTML element, we need to set the transform-box to fill-box
3562
+ // to normalise the transform relative to the element's bounding box
3563
+ if (!isHTMLElement(element) && !state.get("transformBox")) {
3564
+ addStyleValue(element, state, "transformBox", new MotionValue("fill-box"));
3565
+ }
3515
3566
  state.set("transform", new MotionValue("none"), () => {
3516
3567
  element.style.transform = buildTransform(state);
3517
3568
  });
@@ -3544,6 +3595,38 @@
3544
3595
  const styleEffect = /*@__PURE__*/ createSelectorEffect(
3545
3596
  /*@__PURE__*/ createEffect(addStyleValue));
3546
3597
 
3598
+ const toPx = px.transform;
3599
+ function addSVGPathValue(element, state, key, value) {
3600
+ frame.render(() => element.setAttribute("pathLength", "1"));
3601
+ if (key === "pathOffset") {
3602
+ return state.set(key, value, () => element.setAttribute("stroke-dashoffset", toPx(-state.latest[key])));
3603
+ }
3604
+ else {
3605
+ if (!state.get("stroke-dasharray")) {
3606
+ state.set("stroke-dasharray", new MotionValue("1 1"), () => {
3607
+ const { pathLength = 1, pathSpacing } = state.latest;
3608
+ element.setAttribute("stroke-dasharray", `${toPx(pathLength)} ${toPx(pathSpacing ?? 1 - Number(pathLength))}`);
3609
+ });
3610
+ }
3611
+ return state.set(key, value, undefined, state.get("stroke-dasharray"));
3612
+ }
3613
+ }
3614
+ const addSVGValue = (element, state, key, value) => {
3615
+ if (key.startsWith("path")) {
3616
+ return addSVGPathValue(element, state, key, value);
3617
+ }
3618
+ else if (key.startsWith("attr")) {
3619
+ return addAttrValue(element, state, convertAttrKey(key), value);
3620
+ }
3621
+ const handler = key in element.style ? addStyleValue : addAttrValue;
3622
+ return handler(element, state, key, value);
3623
+ };
3624
+ const svgEffect = /*@__PURE__*/ createSelectorEffect(
3625
+ /*@__PURE__*/ createEffect(addSVGValue));
3626
+ function convertAttrKey(key) {
3627
+ return key.replace(/^attr([A-Z])/, (_, firstChar) => firstChar.toLowerCase());
3628
+ }
3629
+
3547
3630
  const { schedule: microtask, cancel: cancelMicrotask } =
3548
3631
  /* @__PURE__ */ createRenderBatcher(queueMicrotask, false);
3549
3632
 
@@ -4444,6 +4527,7 @@
4444
4527
  exports.ViewTransitionBuilder = ViewTransitionBuilder;
4445
4528
  exports.acceleratedValues = acceleratedValues;
4446
4529
  exports.activeAnimations = activeAnimations;
4530
+ exports.addAttrValue = addAttrValue;
4447
4531
  exports.addStyleValue = addStyleValue;
4448
4532
  exports.alpha = alpha;
4449
4533
  exports.analyseComplexValue = analyseComplexValue;
@@ -4452,6 +4536,7 @@
4452
4536
  exports.animationMapKey = animationMapKey;
4453
4537
  exports.applyPxDefaults = applyPxDefaults;
4454
4538
  exports.attachSpring = attachSpring;
4539
+ exports.attrEffect = attrEffect;
4455
4540
  exports.calcGeneratorDuration = calcGeneratorDuration;
4456
4541
  exports.cancelFrame = cancelFrame;
4457
4542
  exports.cancelMicrotask = cancelMicrotask;
@@ -4529,6 +4614,7 @@
4529
4614
  exports.positionalKeys = positionalKeys;
4530
4615
  exports.press = press;
4531
4616
  exports.progressPercentage = progressPercentage;
4617
+ exports.propEffect = propEffect;
4532
4618
  exports.px = px;
4533
4619
  exports.readTransformValue = readTransformValue;
4534
4620
  exports.recordStats = recordStats;
@@ -4549,6 +4635,7 @@
4549
4635
  exports.supportsLinearEasing = supportsLinearEasing;
4550
4636
  exports.supportsPartialKeyframes = supportsPartialKeyframes;
4551
4637
  exports.supportsScrollTimeline = supportsScrollTimeline;
4638
+ exports.svgEffect = svgEffect;
4552
4639
  exports.sync = sync;
4553
4640
  exports.testValueType = testValueType;
4554
4641
  exports.time = time;
@@ -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:g,postRender:y}=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),g.process(o),y.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(--"),g=t=>!!f(t)&&y.test(t.split("/*")[0].trim()),y=/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"),O=P("vw"),K=(()=>({...D,parse:t=>D.parse(t)/100,transform:t=>D.transform(100*t)}))(),$={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))+")"},L={test:t=>E.test(t)||V.test(t)||$.test(t),parse:t=>E.test(t)?E.parse(t):$.test(t)?$.parse(t):V.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?E.transform(t):$.transform(t)},W=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const N="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 Y(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(j,(t=>(L.test(t)?(s.color.push(r),i.push(B),n.push(L.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(N),n.push(parseFloat(t))),++r,"${}"))).split("${}");return{values:n,split:a,indexes:s,types:i}}function I(t){return Y(t).values}function X(t){const{split:e,types:n}=Y(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===N?w(t[r]):e===B?L.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(W)?.length||0)>0},parse:I,createTransformer:X,getAnimatableNone:function(t){const e=I(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,$];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===$&&(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?g(t)?Z:L.test(t)?tt:ot:Array.isArray(t)?rt:"object"==typeof t?L.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=Y(t),r=Y(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,gt=10,yt=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=yt}){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:gt,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 Ot(t,e){return e.some((e=>void 0!==t[e]))}function Kt(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:gt,mass:yt,isResolvedFromDuration:!1,...t};if(!Ot(t,Ct)&&Ot(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:yt,stiffness:r,damping:a}}else{const e=Pt(t);n={...n,...e,mass:yt},n.isResolvedFromDuration=!0}return n}({...s,velocity:-e.millisecondsToSeconds(s.velocity||0)}),f=m||0,g=c/(2*Math.sqrt(u*h)),y=o-a,v=e.millisecondsToSeconds(Math.sqrt(u/h)),T=Math.abs(y)<5;let b;if(i||(i=T?Mt.granular:Mt.default),r||(r=T?xt.granular:xt.default),g<1){const t=Dt(v,g);b=e=>{const n=Math.exp(-g*v*e);return o-n*((f+g*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===g)b=t=>o-Math.exp(-v*t)*(y+(f+v*y)*t);else{const t=v*Math.sqrt(g*g-1);b=e=>{const n=Math.exp(-g*v*e),s=Math.min(t*e,300);return o-n*((f+g*v*y)*Math.sinh(s)+t*y*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;g<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 $t({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,g=void 0===a?f:a(f);g!==f&&(p=g-h);const y=t=>-p*Math.exp(-t/s),v=t=>g+y(t),T=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g: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=Kt({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 Lt(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 Wt(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 Nt(t){const e=[0];return Wt(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 Yt({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=Lt(Bt(s&&s.length===n.length?s:Nt(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)}}Kt.applyToOptions=t=>{const n=mt(t,100,Kt);return t.ease=n.ease,t.duration=e.secondsToMilliseconds(n.duration),t.type="keyframes",t};const It=t=>null!==t;function Xt(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(It),a=i<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return a&&void 0!==s?s:r[a]}const Ut={decay:$t,inertia:$t,tween:Yt,keyframes:Yt,spring:Kt};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=Yt,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=t;let{keyframes:o}=t;const l=n||Yt;l!==Yt&&"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:g}=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 y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,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!==$t&&(w.value=Xt(c,this.options,g,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,ge=!1;function ye(){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(ge))),me.clear()}function ve(){me.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(fe=!0)}))}function Te(){ge=!0,ve(),ye(),ge=!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(ye))):(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 Oe={anticipate:e.anticipate,backInOut:e.backInOut,circInOut:e.circInOut};function Ke(t){"string"==typeof t.ease&&t.ease in Oe&&(t.ease=Oe[t.ease])}class $e extends Ce{constructor(t){Ke(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 Le=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!G.test(t)&&"0"!==t||t.startsWith("url(")));function We(t){return e.isObject(t)&&"offsetHeight"in t}const Ne=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(!We(e?.owner?.current))return!1;const{onUpdate:o,transformTemplate:l}=e.owner.getProps();return Be()&&n&&Ne.has(n)&&("transform"!==n||!l)&&!o&&!s&&"mirror"!==i&&0!==r&&"inertia"!==a}class Ye{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 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 g(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,O,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:K,originY:K,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:L,backgroundColor:L,outlineColor:L,fill:L,stroke:L,borderColor:L,borderTopColor:L,borderRightColor:L,borderBottomColor:L,borderLeftColor:L,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 gn(t,e){return new fn(t,e)}function yn(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)}function vn(t){return(e,n)=>{const s=yn(e),i=[];for(const e of s){const s=t(e,n);i.push(s)}return()=>{for(const t of i)t()}}}const Tn=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class bn{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?Tn(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()}}function wn(t){const e=new WeakMap,n=[];return(s,i)=>{const r=e.get(s)??new bn;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()}}}const Mn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const xn=new Set(["originX","originY","originZ"]),Sn=(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+=`${Mn[i]||i}(${t.latest[i]}) `)}return n?"none":e.trim()}(e)})),r=e.get("transform")):xn.has(n)?(e.get("transformOrigin")||e.set("transformOrigin",new fn(""),(()=>{const n=e.latest.originX??"50%",s=e.latest.originY??"50%",i=e.latest.originZ??0;t.style.transformOrigin=`${n} ${s} ${i}`})),r=e.get("transformOrigin")):i=we(n)?()=>{t.style.setProperty(n,e.latest[n])}:()=>{t.style[n]=e.latest[n]},e.set(n,s,i,r)},An=vn(wn(Sn)),{schedule:kn,cancel:En}=i(queueMicrotask,!1),Vn={x:!1,y:!1};function Pn(){return Vn.x||Vn.y}function Rn(t,e){const n=yn(t),s=new AbortController;return[n,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function Dn(t){return!("touch"===t.pointerType||Pn())}const Fn=(t,e)=>!!e&&(t===e||Fn(t,e.parentElement)),Cn=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,On=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Kn=new WeakSet;function $n(t){return e=>{"Enter"===e.key&&t(e)}}function Ln(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Wn(t){return Cn(t)&&!Pn()}function Nn(){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(Nn)}function Bn(t){return t.reduce(((t,e)=>t+e),0)/t.length}function jn(t,e=Bn){return 0===t.length?{min:0,max:0,avg:0}:{min:Math.min(...t),max:Math.max(...t),avg:e(t)}}const Yn=t=>Math.round(1e3/t);function In(){s.value=null,s.addProjectionMetrics=null}function Xn(){const{value:t}=s;if(!t)throw new Error("Stats are not being measured");In(),a(Nn);const e={frameloop:{setup:jn(t.frameloop.setup),rate:jn(t.frameloop.rate),read:jn(t.frameloop.read),resolveKeyframes:jn(t.frameloop.resolveKeyframes),preUpdate:jn(t.frameloop.preUpdate),update:jn(t.frameloop.update),preRender:jn(t.frameloop.preRender),render:jn(t.frameloop.render),postRender:jn(t.frameloop.postRender)},animations:{mainThread:jn(t.animations.mainThread),waapi:jn(t.animations.waapi),layout:jn(t.animations.layout)},layoutProjection:{nodes:jn(t.layoutProjection.nodes),calculatedTargetDeltas:jn(t.layoutProjection.calculatedTargetDeltas),calculatedProjections:jn(t.layoutProjection.calculatedProjections)}},{rate:n}=e.frameloop;return n.min=Yn(n.min),n.max=Yn(n.max),n.avg=Yn(n.avg),[n.min,n.max]=[n.max,n.min],e}function Un(t){return e.isObject(t)&&"ownerSVGElement"in t}function Gn(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],i=Lt(t[1+n],t[2+n],t[3+n]);return e?i(s):i}function qn(t){const e=[];pn.current=e;const n=t();pn.current=void 0;const s=gn(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 zn=t=>Boolean(t&&t.getVelocity);function Zn(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:[Hn(t.get()),Hn(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(_n(t,l)),r.postRender(c),t.get())),u),zn(e)&&(h=e.on("change",(e=>t.set(_n(e,l)))),t.on("destroy",h)),h}function _n(t,e){return e?t+e:t}function Hn(t){return"number"==typeof t?t:parseFloat(t)}const Jn=[...He,L,G];function Qn(t){return"layout"===t?"group":"enter"===t||"new"===t?"new":"exit"===t||"old"===t?"old":"group"}let ts={},es=null;const ns=(t,e)=>{ts[t]=e},ss=()=>{es||(es=document.createElement("style"),es.id="motion-view");let t="";for(const e in ts){const n=ts[e];t+=`${e} {\n`;for(const[e,s]of Object.entries(n))t+=` ${e}: ${s};\n`;t+="}\n"}es.textContent=t,document.head.appendChild(es),ts={}},is=()=>{es&&es.parentElement&&es.parentElement.removeChild(es)};function rs(t){const e=t.match(/::view-transition-(old|new|group|image-pair)\((.*?)\)/);return e?{layer:e[2],type:e[1]}:null}function as(t){const{effect:e}=t;return!!e&&(e.target===document.documentElement&&e.pseudoElement?.startsWith("::view-transition"))}const os=["layout","enter","exit","new","old"];function ls(t){const{update:n,targets:s,options:i}=t;if(!document.startViewTransition)return new Promise((async t=>{await n(),t(new Ye([]))}));(function(t,e){return e.has(t)&&Object.keys(e.get(t)).length>0})("root",s)||ns(":root",{"view-transition-name":"none"}),ns("::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)",{"animation-timing-function":"linear !important"}),ss();const r=document.startViewTransition((async()=>{await n()}));return r.finished.finally((()=>{is()})),new Promise((t=>{r.ready.then((()=>{const n=document.getAnimations().filter(as),r=[];s.forEach(((t,n)=>{for(const s of os){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=Qn(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=rs(a);if(!o)continue;const l=s.get(o.layer);if(l)us(l,"enter")&&us(l,"exit")&&n.getKeyframes().some((t=>t.mixBlendMode))?r.push(new Ie(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 Ie(t))}}t(new Ye(r))}))}))}function us(t,e){return t?.[e]?.keyframes.opacity}let cs=[],hs=null;function ds(){hs=null;const[t]=cs;var n;t&&(n=t,e.removeItem(cs,n),hs=n,ls(n).then((t=>{n.notifyReady(t),t.finished.finally(ds)})))}function ms(){for(let t=cs.length-1;t>=0;t--){const e=cs[t],{interrupt:n}=e.options;if("immediate"===n){const n=cs.slice(0,t+1).map((t=>t.update)),s=cs.slice(t+1);e.update=()=>{n.forEach((t=>t()))},cs=[e,...s];break}}hs&&"immediate"!==cs[0]?.options.interrupt||ds()}class ps{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,cs.push(s),kn.render(ms)}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 fs=r,gs=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=Le(r,n),l=Le(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 $e({...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(),g(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)&&Y(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=Ye,t.GroupAnimationWithThen=class extends Ye{then(t,e){return this.finished.finally(t).then((()=>{}))}},t.JSAnimation=Zt,t.KeyframeResolver=be,t.MotionValue=fn,t.NativeAnimation=Ce,t.NativeAnimationExtended=$e,t.NativeAnimationWrapper=Ie,t.ViewTransitionBuilder=ps,t.acceleratedValues=mn,t.activeAnimations=d,t.addStyleValue=Sn,t.alpha=T,t.analyseComplexValue=Y,t.animateValue=function(t){return new Zt(t)},t.animateView=function(t,e={}){return new ps(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=Zn,t.calcGeneratorDuration=dt,t.cancelFrame=a,t.cancelMicrotask=En,t.cancelSync=gs,t.collectMotionValues=pn,t.color=L,t.complex=G,t.convertOffsetToTimes=Bt,t.createGeneratorEasing=mt,t.createRenderBatcher=i,t.cubicBezierAsString=Ee,t.defaultEasing=jt,t.defaultOffset=Nt,t.defaultTransformValue=ie,t.defaultValueTypes=on,t.degrees=R,t.dimensionValueTypes=He,t.fillOffset=Wt,t.fillWildcards=_t,t.findDimensionValueType=Je,t.findValueType=t=>Jn.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=Tn,t.getValueTransition=ze,t.getVariableValue=qe,t.hex=V,t.hover=function(t,e,n={}){const[s,i,r]=Rn(t,n),a=t=>{if(!Dn(t))return;const{target:n}=t,s=e(n,t);if("function"!=typeof s||!n)return;const r=t=>{Dn(t)&&(s(t),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,i)};return s.forEach((t=>{t.addEventListener("pointerenter",a,i)})),r},t.hsla=$,t.hslaToRgba=z,t.inertia=$t,t.interpolate=Lt,t.invisibleValues=et,t.isCSSVariableName=p,t.isCSSVariableToken=g,t.isDragActive=Pn,t.isDragging=Vn,t.isGenerator=De,t.isHTMLElement=We,t.isMotionValue=zn,t.isNodeOrChild=Fn,t.isPrimaryPointer=Cn,t.isSVGElement=Un,t.isSVGSVGElement=function(t){return Un(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=Yt,t.mapEasingToNativeEasing=Pe,t.mapValue=function(t,e,n,s){const i=Gn(e,n,s);return qn((()=>i(t.get())))},t.maxGeneratorDuration=ht,t.microtask=kn,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=gn,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]=Rn(t,n),a=t=>{const s=t.currentTarget;if(!Wn(t))return;Kn.add(s);const r=e(s,t),a=(t,e)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),Kn.has(s)&&Kn.delete(s),Wn(t)&&"function"==typeof r&&r(t,{success:e})},o=t=>{a(t,s===window||s===document||n.useGlobalTarget||Fn(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),We(t)&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const s=$n((()=>{if(Kn.has(n))return;Ln(n,"down");const t=$n((()=>{Ln(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>Ln(n,"cancel")),e)}));n.addEventListener("keydown",s,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",s)),e)})(t,i))),e=t,On.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),r},t.progressPercentage=K,t.px=F,t.readTransformValue=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return re(n,e)},t.recordStats=function(){if(s.value)throw In(),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(Nn,!0),Xn},t.resolveElements=yn,t.rgbUnit=k,t.rgba=E,t.scale=b,t.setDragLock=function(t){return"x"===t||"y"===t?Vn[t]?null:(Vn[t]=!0,()=>{Vn[t]=!1}):Vn.x||Vn.y?null:(Vn.x=Vn.y=!0,()=>{Vn.x=Vn.y=!1})},t.setStyle=Me,t.spring=Kt,t.springValue=function(t,e){const n=gn(zn(t)?t.get():t);return Zn(n,t,e),n},t.startWaapiAnimation=Re,t.statsBuffer=s,t.styleEffect=An,t.supportedWaapiEasing=Ve,t.supportsBrowserAnimation=je,t.supportsFlags=Se,t.supportsLinearEasing=ke,t.supportsPartialKeyframes=dn,t.supportsScrollTimeline=xe,t.sync=fs,t.testValueType=_e,t.time=h,t.transform=Gn,t.transformPropOrder=oe,t.transformProps=le,t.transformValue=qn,t.transformValueTypes=rn,t.vh=C,t.vw=O}));
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:g,postRender:y}=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),g.process(o),y.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(--"),g=t=>!!f(t)&&y.test(t.split("/*")[0].trim()),y=/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"),O=P("vh"),C=P("vw"),K=(()=>({...D,parse:t=>D.parse(t)/100,transform:t=>D.transform(100*t)}))(),$={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))+")"},L={test:t=>E.test(t)||V.test(t)||$.test(t),parse:t=>E.test(t)?E.parse(t):$.test(t)?$.parse(t):V.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?E.transform(t):$.transform(t)},W=/(?:#[\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 Y(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(j,(t=>(L.test(t)?(s.color.push(r),i.push(N),n.push(L.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 I(t){return Y(t).values}function X(t){const{split:e,types:n}=Y(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?L.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(W)?.length||0)>0},parse:I,createTransformer:X,getAnimatableNone:function(t){const e=I(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,$];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===$&&(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?g(t)?z:L.test(t)?tt:ot:Array.isArray(t)?rt:"object"==typeof t?L.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=Y(t),r=Y(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,gt=10,yt=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=yt}){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:gt,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"],Ot=["stiffness","damping","mass"];function Ct(t,e){return e.some((e=>void 0!==t[e]))}function Kt(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:gt,mass:yt,isResolvedFromDuration:!1,...t};if(!Ct(t,Ot)&&Ct(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:yt,stiffness:r,damping:a}}else{const e=Pt(t);n={...n,...e,mass:yt},n.isResolvedFromDuration=!0}return n}({...s,velocity:-e.millisecondsToSeconds(s.velocity||0)}),f=m||0,g=c/(2*Math.sqrt(u*h)),y=o-a,v=e.millisecondsToSeconds(Math.sqrt(u/h)),T=Math.abs(y)<5;let b;if(i||(i=T?Mt.granular:Mt.default),r||(r=T?xt.granular:xt.default),g<1){const t=Dt(v,g);b=e=>{const n=Math.exp(-g*v*e);return o-n*((f+g*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===g)b=t=>o-Math.exp(-v*t)*(y+(f+v*y)*t);else{const t=v*Math.sqrt(g*g-1);b=e=>{const n=Math.exp(-g*v*e),s=Math.min(t*e,300);return o-n*((f+g*v*y)*Math.sinh(s)+t*y*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;g<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 $t({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,g=void 0===a?f:a(f);g!==f&&(p=g-h);const y=t=>-p*Math.exp(-t/s),v=t=>g+y(t),T=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g: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=Kt({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 Lt(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 Wt(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 Wt(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 Yt({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=Lt(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)}}Kt.applyToOptions=t=>{const n=mt(t,100,Kt);return t.ease=n.ease,t.duration=e.secondsToMilliseconds(n.duration),t.type="keyframes",t};const It=t=>null!==t;function Xt(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(It),a=i<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return a&&void 0!==s?s:r[a]}const Ut={decay:$t,inertia:$t,tween:Yt,keyframes:Yt,spring:Kt};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=Yt,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=t;let{keyframes:o}=t;const l=n||Yt;l!==Yt&&"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:g}=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 y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,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!==$t&&(w.value=Xt(c,this.options,g,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,ge=!1;function ye(){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(ge))),me.clear()}function ve(){me.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(fe=!0)}))}function Te(){ge=!0,ve(),ye(),ge=!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(ye))):(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 Oe 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 Ce={anticipate:e.anticipate,backInOut:e.backInOut,circInOut:e.circInOut};function Ke(t){"string"==typeof t.ease&&t.ease in Ce&&(t.ease=Ce[t.ease])}class $e extends Oe{constructor(t){Ke(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 Le=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!G.test(t)&&"0"!==t||t.startsWith("url(")));function We(t){return e.isObject(t)&&"offsetHeight"in t}const Be=new Set(["opacity","clipPath","filter","transform"]),Ne=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(!We(e?.owner?.current))return!1;const{onUpdate:o,transformTemplate:l}=e.owner.getProps();return Ne()&&n&&Be.has(n)&&("transform"!==n||!l)&&!o&&!s&&"mirror"!==i&&0!==r&&"inertia"!==a}class Ye{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 Oe{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 g(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,C,O,{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:K,originY:K,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:L,backgroundColor:L,outlineColor:L,fill:L,stroke:L,borderColor:L,borderTopColor:L,borderRightColor:L,borderBottomColor:L,borderLeftColor:L,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"]);function pn(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)}function fn(t){return(e,n)=>{const s=pn(e),i=[];for(const e of s){const s=t(e,n);i.push(s)}return()=>{for(const t of i)t()}}}const gn=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class yn{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?gn(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()}}function vn(t){const e=new WeakMap,n=[];return(s,i)=>{const r=e.get(s)??new yn;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()}}}const Tn=(t,e,n,s)=>{const i=function(t,e){if(!(e in t))return!1;const n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),e)||Object.getOwnPropertyDescriptor(t,e);return n&&"function"==typeof n.set}(t,n),r=i?n:n.startsWith("data")||n.startsWith("aria")?n.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`)):n;const a=i?()=>{t[r]=e.latest[n]}:()=>{const s=e.latest[n];null==s?t.removeAttribute(r):t.setAttribute(r,String(s))};return e.set(n,s,a)},bn=fn(vn(Tn)),wn=vn(((t,e,n,s)=>e.set(n,s,(()=>{t[n]=e.latest[n]}),void 0,!1))),Mn={current:void 0};class xn{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 Mn.current&&Mn.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 An(t,e){return new xn(t,e)}const Sn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const kn=new Set(["originX","originY","originZ"]),En=(t,e,n,s)=>{let i,r;return le.has(n)?(e.get("transform")||(We(t)||e.get("transformBox")||En(t,e,"transformBox",new xn("fill-box")),e.set("transform",new xn("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+=`${Sn[i]||i}(${t.latest[i]}) `)}return n?"none":e.trim()}(e)}))),r=e.get("transform")):kn.has(n)?(e.get("transformOrigin")||e.set("transformOrigin",new xn(""),(()=>{const n=e.latest.originX??"50%",s=e.latest.originY??"50%",i=e.latest.originZ??0;t.style.transformOrigin=`${n} ${s} ${i}`})),r=e.get("transformOrigin")):i=we(n)?()=>{t.style.setProperty(n,e.latest[n])}:()=>{t.style[n]=e.latest[n]},e.set(n,s,i,r)},Vn=fn(vn(En)),Pn=F.transform;const Rn=fn(vn(((t,e,n,s)=>{if(n.startsWith("path"))return function(t,e,n,s){return r.render((()=>t.setAttribute("pathLength","1"))),"pathOffset"===n?e.set(n,s,(()=>t.setAttribute("stroke-dashoffset",Pn(-e.latest[n])))):(e.get("stroke-dasharray")||e.set("stroke-dasharray",new xn("1 1"),(()=>{const{pathLength:n=1,pathSpacing:s}=e.latest;t.setAttribute("stroke-dasharray",`${Pn(n)} ${Pn(s??1-Number(n))}`)})),e.set(n,s,void 0,e.get("stroke-dasharray")))}(t,e,n,s);if(n.startsWith("attr"))return Tn(t,e,function(t){return t.replace(/^attr([A-Z])/,((t,e)=>e.toLowerCase()))}(n),s);return(n in t.style?En:Tn)(t,e,n,s)})));const{schedule:Dn,cancel:Fn}=i(queueMicrotask,!1),On={x:!1,y:!1};function Cn(){return On.x||On.y}function Kn(t,e){const n=pn(t),s=new AbortController;return[n,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function $n(t){return!("touch"===t.pointerType||Cn())}const Ln=(t,e)=>!!e&&(t===e||Ln(t,e.parentElement)),Wn=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Bn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Nn=new WeakSet;function jn(t){return e=>{"Enter"===e.key&&t(e)}}function Yn(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function In(t){return Wn(t)&&!Cn()}function Xn(){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(Xn)}function Un(t){return t.reduce(((t,e)=>t+e),0)/t.length}function Gn(t,e=Un){return 0===t.length?{min:0,max:0,avg:0}:{min:Math.min(...t),max:Math.max(...t),avg:e(t)}}const qn=t=>Math.round(1e3/t);function Zn(){s.value=null,s.addProjectionMetrics=null}function zn(){const{value:t}=s;if(!t)throw new Error("Stats are not being measured");Zn(),a(Xn);const e={frameloop:{setup:Gn(t.frameloop.setup),rate:Gn(t.frameloop.rate),read:Gn(t.frameloop.read),resolveKeyframes:Gn(t.frameloop.resolveKeyframes),preUpdate:Gn(t.frameloop.preUpdate),update:Gn(t.frameloop.update),preRender:Gn(t.frameloop.preRender),render:Gn(t.frameloop.render),postRender:Gn(t.frameloop.postRender)},animations:{mainThread:Gn(t.animations.mainThread),waapi:Gn(t.animations.waapi),layout:Gn(t.animations.layout)},layoutProjection:{nodes:Gn(t.layoutProjection.nodes),calculatedTargetDeltas:Gn(t.layoutProjection.calculatedTargetDeltas),calculatedProjections:Gn(t.layoutProjection.calculatedProjections)}},{rate:n}=e.frameloop;return n.min=qn(n.min),n.max=qn(n.max),n.avg=qn(n.avg),[n.min,n.max]=[n.max,n.min],e}function _n(t){return e.isObject(t)&&"ownerSVGElement"in t}function Hn(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],i=Lt(t[1+n],t[2+n],t[3+n]);return e?i(s):i}function Jn(t){const e=[];Mn.current=e;const n=t();Mn.current=void 0;const s=An(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 Qn=t=>Boolean(t&&t.getVelocity);function ts(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:[ns(t.get()),ns(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(es(t,l)),r.postRender(c),t.get())),u),Qn(e)&&(h=e.on("change",(e=>t.set(es(e,l)))),t.on("destroy",h)),h}function es(t,e){return e?t+e:t}function ns(t){return"number"==typeof t?t:parseFloat(t)}const ss=[...He,L,G];function is(t){return"layout"===t?"group":"enter"===t||"new"===t?"new":"exit"===t||"old"===t?"old":"group"}let rs={},as=null;const os=(t,e)=>{rs[t]=e},ls=()=>{as||(as=document.createElement("style"),as.id="motion-view");let t="";for(const e in rs){const n=rs[e];t+=`${e} {\n`;for(const[e,s]of Object.entries(n))t+=` ${e}: ${s};\n`;t+="}\n"}as.textContent=t,document.head.appendChild(as),rs={}},us=()=>{as&&as.parentElement&&as.parentElement.removeChild(as)};function cs(t){const e=t.match(/::view-transition-(old|new|group|image-pair)\((.*?)\)/);return e?{layer:e[2],type:e[1]}:null}function hs(t){const{effect:e}=t;return!!e&&(e.target===document.documentElement&&e.pseudoElement?.startsWith("::view-transition"))}const ds=["layout","enter","exit","new","old"];function ms(t){const{update:n,targets:s,options:i}=t;if(!document.startViewTransition)return new Promise((async t=>{await n(),t(new Ye([]))}));(function(t,e){return e.has(t)&&Object.keys(e.get(t)).length>0})("root",s)||os(":root",{"view-transition-name":"none"}),os("::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)",{"animation-timing-function":"linear !important"}),ls();const r=document.startViewTransition((async()=>{await n()}));return r.finished.finally((()=>{us()})),new Promise((t=>{r.ready.then((()=>{const n=document.getAnimations().filter(hs),r=[];s.forEach(((t,n)=>{for(const s of ds){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=is(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 Oe({...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=cs(a);if(!o)continue;const l=s.get(o.layer);if(l)ps(l,"enter")&&ps(l,"exit")&&n.getKeyframes().some((t=>t.mixBlendMode))?r.push(new Ie(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 Ie(t))}}t(new Ye(r))}))}))}function ps(t,e){return t?.[e]?.keyframes.opacity}let fs=[],gs=null;function ys(){gs=null;const[t]=fs;var n;t&&(n=t,e.removeItem(fs,n),gs=n,ms(n).then((t=>{n.notifyReady(t),t.finished.finally(ys)})))}function vs(){for(let t=fs.length-1;t>=0;t--){const e=fs[t],{interrupt:n}=e.options;if("immediate"===n){const n=fs.slice(0,t+1).map((t=>t.update)),s=fs.slice(t+1);e.update=()=>{n.forEach((t=>t()))},fs=[e,...s];break}}gs&&"immediate"!==fs[0]?.options.interrupt||ys()}class Ts{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,fs.push(s),Dn.render(vs)}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 bs=r,ws=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=Le(r,n),l=Le(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 $e({...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(),g(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)&&Y(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=Ye,t.GroupAnimationWithThen=class extends Ye{then(t,e){return this.finished.finally(t).then((()=>{}))}},t.JSAnimation=zt,t.KeyframeResolver=be,t.MotionValue=xn,t.NativeAnimation=Oe,t.NativeAnimationExtended=$e,t.NativeAnimationWrapper=Ie,t.ViewTransitionBuilder=Ts,t.acceleratedValues=mn,t.activeAnimations=d,t.addAttrValue=Tn,t.addStyleValue=En,t.alpha=T,t.analyseComplexValue=Y,t.animateValue=function(t){return new zt(t)},t.animateView=function(t,e={}){return new Ts(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=ts,t.attrEffect=bn,t.calcGeneratorDuration=dt,t.cancelFrame=a,t.cancelMicrotask=Fn,t.cancelSync=ws,t.collectMotionValues=Mn,t.color=L,t.complex=G,t.convertOffsetToTimes=Nt,t.createGeneratorEasing=mt,t.createRenderBatcher=i,t.cubicBezierAsString=Ee,t.defaultEasing=jt,t.defaultOffset=Bt,t.defaultTransformValue=ie,t.defaultValueTypes=on,t.degrees=R,t.dimensionValueTypes=He,t.fillOffset=Wt,t.fillWildcards=_t,t.findDimensionValueType=Je,t.findValueType=t=>ss.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=gn,t.getValueTransition=Ze,t.getVariableValue=qe,t.hex=V,t.hover=function(t,e,n={}){const[s,i,r]=Kn(t,n),a=t=>{if(!$n(t))return;const{target:n}=t,s=e(n,t);if("function"!=typeof s||!n)return;const r=t=>{$n(t)&&(s(t),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,i)};return s.forEach((t=>{t.addEventListener("pointerenter",a,i)})),r},t.hsla=$,t.hslaToRgba=Z,t.inertia=$t,t.interpolate=Lt,t.invisibleValues=et,t.isCSSVariableName=p,t.isCSSVariableToken=g,t.isDragActive=Cn,t.isDragging=On,t.isGenerator=De,t.isHTMLElement=We,t.isMotionValue=Qn,t.isNodeOrChild=Ln,t.isPrimaryPointer=Wn,t.isSVGElement=_n,t.isSVGSVGElement=function(t){return _n(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=Yt,t.mapEasingToNativeEasing=Pe,t.mapValue=function(t,e,n,s){const i=Hn(e,n,s);return Jn((()=>i(t.get())))},t.maxGeneratorDuration=ht,t.microtask=Dn,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=An,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]=Kn(t,n),a=t=>{const s=t.currentTarget;if(!In(t))return;Nn.add(s);const r=e(s,t),a=(t,e)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),Nn.has(s)&&Nn.delete(s),In(t)&&"function"==typeof r&&r(t,{success:e})},o=t=>{a(t,s===window||s===document||n.useGlobalTarget||Ln(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),We(t)&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const s=jn((()=>{if(Nn.has(n))return;Yn(n,"down");const t=jn((()=>{Yn(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>Yn(n,"cancel")),e)}));n.addEventListener("keydown",s,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",s)),e)})(t,i))),e=t,Bn.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),r},t.progressPercentage=K,t.propEffect=wn,t.px=F,t.readTransformValue=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return re(n,e)},t.recordStats=function(){if(s.value)throw Zn(),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(Xn,!0),zn},t.resolveElements=pn,t.rgbUnit=k,t.rgba=E,t.scale=b,t.setDragLock=function(t){return"x"===t||"y"===t?On[t]?null:(On[t]=!0,()=>{On[t]=!1}):On.x||On.y?null:(On.x=On.y=!0,()=>{On.x=On.y=!1})},t.setStyle=Me,t.spring=Kt,t.springValue=function(t,e){const n=An(Qn(t)?t.get():t);return ts(n,t,e),n},t.startWaapiAnimation=Re,t.statsBuffer=s,t.styleEffect=Vn,t.supportedWaapiEasing=Ve,t.supportsBrowserAnimation=je,t.supportsFlags=Ae,t.supportsLinearEasing=ke,t.supportsPartialKeyframes=dn,t.supportsScrollTimeline=xe,t.svgEffect=Rn,t.sync=bs,t.testValueType=_e,t.time=h,t.transform=Hn,t.transformPropOrder=oe,t.transformProps=le,t.transformValue=Jn,t.transformValueTypes=rn,t.vh=O,t.vw=C}));
@@ -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()}}function m(t){return(e,s)=>{const n=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)}(e),r=[];for(const e of n){const n=t(e,s);r.push(n)}return()=>{for(const t of r)t()}}}const v={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},g={...v,transform:t=>((t,e,s)=>s>e?e:s<t?t:s)(0,1,t)},y={...v,default:1},w={...v,transform:Math.round},A=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),b=A("deg"),P=A("%"),R=A("px"),k=(()=>({...P,parse:t=>P.parse(t)/100,transform:t=>P.transform(100*t)}))(),F={borderWidth:R,borderTopWidth:R,borderRightWidth:R,borderBottomWidth:R,borderLeftWidth:R,borderRadius:R,radius:R,borderTopLeftRadius:R,borderTopRightRadius:R,borderBottomRightRadius:R,borderBottomLeftRadius:R,width:R,maxWidth:R,height:R,maxHeight:R,top:R,right:R,bottom:R,left:R,padding:R,paddingTop:R,paddingRight:R,paddingBottom:R,paddingLeft:R,margin:R,marginTop:R,marginRight:R,marginBottom:R,marginLeft:R,backgroundPositionX:R,backgroundPositionY:R,...{rotate:b,rotateX:b,rotateY:b,rotateZ:b,scale:y,scaleX:y,scaleY:y,scaleZ:y,skew:b,skewX:b,skewY:b,distance:R,translateX:R,translateY:R,translateZ:R,x:R,y:R,z:R,perspective:R,transformPerspective:R,opacity:g,originX:k,originY:k,originZ:R},zIndex:w,fillOpacity:g,strokeOpacity:g,numOctaves:w};class T{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,F[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()}}function V(t){const e=new WeakMap,s=[];return(n,r)=>{const i=e.get(n)??new T;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()}}}const X={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const Y=new Set(["originX","originY","originZ"]),W=(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+=`${X[i]||i}(${e.latest[i]}) `)}return n?"none":s.trim()}(n)})),o=n.get("transform")):Y.has(r)?(n.get("transformOrigin")||n.set("transformOrigin",new f(""),(()=>{const t=n.latest.originX??"50%",e=n.latest.originY??"50%",r=n.latest.originZ??0;s.style.transformOrigin=`${t} ${e} ${r}`})),o=n.get("transformOrigin")):a=r.startsWith("--")?()=>{s.style.setProperty(r,n.latest[r])}:()=>{s.style[r]=n.latest[r]},n.set(r,i,a,o)},x=m(V(W));export{W as addStyleValue,x as styleEffect};
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 o(t,e){let n=!1,o=!0;const a={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,o=!1;const a=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1},h=0;function d(e){a.has(e)&&(p.schedule(e),t()),h++,e(c)}const p={schedule:(t,e=!1,i=!1)=>{const o=i&&r?s:n;return e&&a.add(t),o.has(t)||o.add(t),t},cancel:t=>{n.delete(t),a.delete(t)},process:t=>{c=t,r?o=!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,o&&(o=!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?a.timestamp:performance.now();n=!1,s.useManualTiming||(a.delta=o?1e3/60:Math.max(Math.min(r-a.timestamp,40),1)),a.timestamp=r,a.isProcessing=!0,d.process(a),p.process(a),u.process(a),l.process(a),f.process(a),m.process(a),v.process(a),g.process(a),a.isProcessing=!1,n&&e&&(o=!1,t(y))};return{schedule:r.reduce(((e,s)=>{const r=h[s];return e[s]=(e,s=!1,i=!1)=>(n||(n=!0,o=!0,a.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:a,steps:h}}const{schedule:a,cancel:c,state:h,steps:d}=o("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(),a.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()}}function m(t){return(e,s)=>{const n=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)}(e),r=[];for(const e of n){const n=t(e,s);r.push(n)}return()=>{for(const t of r)t()}}}const v={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},g={...v,transform:t=>((t,e,s)=>s>e?e:s<t?t:s)(0,1,t)},y={...v,default:1},w={...v,transform:Math.round},b=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),A=b("deg"),P=b("%"),R=b("px"),k=(()=>({...P,parse:t=>P.parse(t)/100,transform:t=>P.transform(100*t)}))(),F={borderWidth:R,borderTopWidth:R,borderRightWidth:R,borderBottomWidth:R,borderLeftWidth:R,borderRadius:R,radius:R,borderTopLeftRadius:R,borderTopRightRadius:R,borderBottomRightRadius:R,borderBottomLeftRadius:R,width:R,maxWidth:R,height:R,maxHeight:R,top:R,right:R,bottom:R,left:R,padding:R,paddingTop:R,paddingRight:R,paddingBottom:R,paddingLeft:R,margin:R,marginTop:R,marginRight:R,marginBottom:R,marginLeft:R,backgroundPositionX:R,backgroundPositionY:R,...{rotate:A,rotateX:A,rotateY:A,rotateZ:A,scale:y,scaleX:y,scaleY:y,scaleZ:y,skew:A,skewX:A,skewY:A,distance:R,translateX:R,translateY:R,translateZ:R,x:R,y:R,z:R,perspective:R,transformPerspective:R,opacity:g,originX:k,originY:k,originZ:R},zIndex:w,fillOpacity:g,strokeOpacity:g,numOctaves:w};class x{constructor(){this.latest={},this.values=new Map}set(t,e,s,n,r=!0){const i=this.values.get(t);i&&i.onRemove();const o=()=>{const n=e.get();this.latest[t]=r?((t,e)=>e&&"number"==typeof t?e.transform(t):t)(n,F[t]):n,s&&a.render(s)};o();const h=e.on("change",o);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()}}function T(t){const e=new WeakMap,s=[];return(n,r)=>{const i=e.get(n)??new x;e.set(n,i);for(const e in r){const o=r[e],a=t(n,i,e,o);s.push(a)}return()=>{for(const t of s)t()}}}const V={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const X=new Set(["originX","originY","originZ"]),Y=(s,n,r,i)=>{let o,a;return e.has(r)?(n.get("transform")||(function(t){return"object"==typeof(e=t)&&null!==e&&"offsetHeight"in t;var e}(s)||n.get("transformBox")||Y(s,n,"transformBox",new f("fill-box")),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],o=e.latest[i];if(void 0===o)continue;let a=!0;a="number"==typeof o?o===(i.startsWith("scale")?1:0):0===parseFloat(o),a||(n=!1,s+=`${V[i]||i}(${e.latest[i]}) `)}return n?"none":s.trim()}(n)}))),a=n.get("transform")):X.has(r)?(n.get("transformOrigin")||n.set("transformOrigin",new f(""),(()=>{const t=n.latest.originX??"50%",e=n.latest.originY??"50%",r=n.latest.originZ??0;s.style.transformOrigin=`${t} ${e} ${r}`})),a=n.get("transformOrigin")):o=r.startsWith("--")?()=>{s.style.setProperty(r,n.latest[r])}:()=>{s.style[r]=n.latest[r]},n.set(r,i,o,a)},W=m(T(Y));export{Y as addStyleValue,W as styleEffect};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-dom",
3
- "version": "12.14.0",
3
+ "version": "12.15.0",
4
4
  "author": "Matt Perry",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/motiondivision/motion",
@@ -36,5 +36,5 @@
36
36
  "maxSize": "1.8 kB"
37
37
  }
38
38
  ],
39
- "gitHead": "f0d5139625c13c6c534f46136dddff53f6e42186"
39
+ "gitHead": "2c37211a52bba07205db9d6e01dcc38f187f8307"
40
40
  }