Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

4.3.0

Julian Garnierec3c260f7fa8
diff --git a/dist/bundles/anime.esm.js b/dist/bundles/anime.esm.js
index 3b1e7b91..f767559c 100644
--- a/dist/bundles/anime.esm.js
+++ b/dist/bundles/anime.esm.js
@@ -1,8 +1,8 @@
/**
* Anime.js - ESM bundle
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
// Global types
@@ -22,7 +22,7 @@
* @property {Number|FunctionValue} [duration]
* @property {Number|FunctionValue} [delay]
* @property {Number} [loopDelay]
- * @property {EasingParam} [ease]
+ * @property {EasingParam|FunctionValue} [ease]
* @property {'none'|'replace'|'blend'|compositionTypes} [composition]
* @property {(v: any) => any} [modifier]
* @property {Callback<Tickable>} [onBegin]
@@ -187,7 +187,7 @@
* @param {Target} target - The animated target
* @param {Number} index - The target index
* @param {Number} length - The total number of animated targets
- * @return {Number|String|TweenObjectValue|Array.<Number|String|TweenObjectValue>}
+ * @return {Number|String|TweenObjectValue|EasingParam|Array.<Number|String|TweenObjectValue>}
*/
/**
@@ -255,7 +255,7 @@
// JSAnimation types
/**
- * @typedef {Number|String|FunctionValue} TweenParamValue
+ * @typedef {Number|String|FunctionValue|EasingParam} TweenParamValue
*/
/**
@@ -270,7 +270,7 @@
* @typedef {Object} TweenParamsOptions
* @property {TweenParamValue} [duration]
* @property {TweenParamValue} [delay]
- * @property {EasingParam} [ease]
+ * @property {EasingParam|FunctionValue} [ease]
* @property {TweenModifier} [modifier]
* @property {TweenComposition} [composition]
*/
@@ -379,7 +379,7 @@
* @param {DOMTarget} target - The animated target
* @param {Number} index - The target index
* @param {Number} length - The total number of animated targets
- * @return {WAAPITweenValue}
+ * @return {WAAPITweenValue|WAAPIEasingParam}
*/
/**
@@ -405,7 +405,7 @@
* @property {Number} [playbackRate]
* @property {Number|WAAPIFunctionValue} [duration]
* @property {Number|WAAPIFunctionValue} [delay]
- * @property {WAAPIEasingParam} [ease]
+ * @property {WAAPIEasingParam|WAAPIFunctionValue} [ease]
* @property {CompositeOperation} [composition]
* @property {Boolean} [persist]
* @property {Callback<WAAPIAnimation>} [onComplete]
@@ -801,7 +801,7 @@ const globals = {
const devTools = isBrowser && win.AnimeJSDevTools;
-const globalVersions = { version: '4.3.0-beta.2', engine: null };
+const globalVersions = { version: '4.3.0', engine: null };
if (isBrowser) {
if (!win.AnimeJS) win.AnimeJS = [];
@@ -849,9 +849,9 @@ const isSvg = a => isBrowser && a instanceof SVGElement;
/**@param {any} a @return {Boolean} */
const isHex = a => hexTestRgx.test(a);
/**@param {any} a @return {Boolean} */
-const isRgb = a => stringStartsWith(a, 'rgb');
+const isRgb = a => stringStartsWith(a, 'rgb') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
-const isHsl = a => stringStartsWith(a, 'hsl');
+const isHsl = a => stringStartsWith(a, 'hsl') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
const isCol = a => isHex(a) || isRgb(a) || isHsl(a);
/**@param {any} a @return {Boolean} */
@@ -2894,10 +2894,11 @@ class Timer extends Clock {
/**
* Imediatly completes the timer, cancels it and triggers the onComplete callback
+ * @param {Boolean|Number} [muteCallbacks]
* @return {this}
*/
- complete() {
- return this.seek(this.duration).cancel();
+ complete(muteCallbacks = 0) {
+ return this.seek(this.duration, muteCallbacks).cancel();
}
/**
@@ -3523,10 +3524,13 @@ class JSAnimation extends Timer {
tweenToValue = computedToValue;
}
const tweenFromValue = getFunctionValue(key.from, target, ti, tl);
- const keyEasing = key.ease;
+ const easeToParse = key.ease || tEasing;
+
+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
- // Easing are treated differently and don't accept function based value to prevent having to pass a function wrapper that returns an other function all the time
- const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing || tEasing;
+ const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
// Calculate default individual keyframe duration by dividing the tl of keyframes
const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);
// Default delay value should only be applied to the first tween
@@ -7469,8 +7473,6 @@ class WAAPIAnimation {
console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);
}
- const ease = setValue(params.ease, parseWAAPIEasing(globals.defaults.ease));
- const spring = /** @type {Spring} */(ease).ease && ease;
const autoplay = setValue(params.autoplay, globals.defaults.autoplay);
const scroll = autoplay && /** @type {ScrollObserver} */(autoplay).link ? autoplay : false;
const alternate = params.alternate && /** @type {Boolean} */(params.alternate) === true;
@@ -7481,8 +7483,6 @@ class WAAPIAnimation {
const direction = alternate ? reversed ? 'alternate-reverse' : 'alternate' : reversed ? 'reverse' : 'normal';
/** @type {FillMode} */
const fill = 'both'; // We use 'both' here because the animation can be reversed during playback
- /** @type {String} */
- const easing = parseWAAPIEasing(ease);
const timeScale = (globals.timeScale === 1 ? 1 : K);
/** @type {DOMTargetsArray}] */
@@ -7523,6 +7523,15 @@ class WAAPIAnimation {
const elStyle = $el.style;
const inlineStyles = this._inlineStyles[i] = {};
+ const easeToParse = setValue(params.ease, globals.defaults.ease);
+
+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
+ const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;
+ /** @type {String} */
+ const easing = parseWAAPIEasing(keyEasing);
+
/** @type {Number} */
const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;
/** @type {Number} */
@@ -7547,7 +7556,7 @@ class WAAPIAnimation {
let parsedPropertyValue;
if (isObj(propertyValue)) {
const tweenOptions = /** @type {WAAPITweenOptions} */(propertyValue);
- const tweenOptionsEase = setValue(tweenOptions.ease, ease);
+ const tweenOptionsEase = setValue(tweenOptions.ease, easing);
const tweenOptionsSpring = /** @type {Spring} */(tweenOptionsEase).ease && tweenOptionsEase;
const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;
const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;
@@ -7786,34 +7795,54 @@ const waapi = {
+
+
/**
* @typedef {DOMTargetSelector|Array<DOMTargetSelector>} LayoutChildrenParam
*/
/**
- * @typedef {Record<String, Number|String>} LayoutStateParams
+ * @typedef {Object} LayoutAnimationTimingsParams
+ * @property {Number|FunctionValue} [delay]
+ * @property {Number|FunctionValue} [duration]
+ * @property {EasingParam|FunctionValue} [ease]
*/
/**
- * @typedef {Object} LayoutAnimationParams
+ * @typedef {Record<String, Number|String|FunctionValue>} LayoutStateAnimationProperties
+ */
+
+/**
+ * @typedef {LayoutStateAnimationProperties & LayoutAnimationTimingsParams} LayoutStateParams
+ */
+
+/**
+ * @typedef {Object} LayoutSpecificAnimationParams
* @property {Number|FunctionValue} [delay]
* @property {Number|FunctionValue} [duration]
- * @property {EasingParam} [ease]
- * @property {LayoutStateParams} [frozen]
- * @property {LayoutStateParams} [added]
- * @property {LayoutStateParams} [removed]
- * @property {Callback<AutoLayout>} [onComplete]
+ * @property {EasingParam|FunctionValue} [ease]
+ * @property {EasingParam} [playbackEase]
+ * @property {LayoutStateParams} [swapAt]
+ * @property {LayoutStateParams} [enterFrom]
+ * @property {LayoutStateParams} [leaveTo]
+ */
+
+/**
+ * @typedef {LayoutSpecificAnimationParams & TimerParams & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} LayoutAnimationParams
+ */
+
+/**
+ * @typedef {Object} LayoutOptions
+ * @property {LayoutChildrenParam} [children]
+ * @property {Array<String>} [properties]
*/
/**
- * @typedef {LayoutAnimationParams & {
- * children?: LayoutChildrenParam,
- * properties?: Array<String>,
- * }} AutoLayoutParams
+ * @typedef {LayoutAnimationParams & LayoutOptions} AutoLayoutParams
*/
/**
- * @typedef {Record<String, Number|String> & {
+ * @typedef {Record<String, Number|String|FunctionValue> & {
* transform: String,
* x: Number,
* y: Number,
@@ -7834,13 +7863,15 @@ const waapi = {
* @property {Number} total
* @property {Number} delay
* @property {Number} duration
+ * @property {EasingParam} ease
* @property {DOMTarget} $measure
* @property {LayoutSnapshot} state
* @property {AutoLayout} layout
* @property {LayoutNode|null} parentNode
* @property {Boolean} isTarget
+ * @property {Boolean} isEntering
+ * @property {Boolean} isLeaving
* @property {Boolean} hasTransform
- * @property {Boolean} isAnimated
* @property {Array<String>} inlineStyles
* @property {String|null} inlineTransforms
* @property {String|null} inlineTransition
@@ -7981,7 +8012,7 @@ const detachNode = node => {
* @param {DOMTarget} $el
* @param {LayoutNode|null} parentNode
* @param {LayoutSnapshot} state
- * @param {LayoutNode} [recycledNode]
+ * @param {LayoutNode} recycledNode
* @return {LayoutNode}
*/
const createNode = ($el, parentNode, state, recycledNode) => {
@@ -7995,12 +8026,15 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.total = 1;
node.delay = 0;
node.duration = 0;
+ node.ease = null;
node.state = state;
node.layout = state.layout;
node.parentNode = parentNode || null;
node.isTarget = false;
+ node.isEntering = false;
+ node.isLeaving = false;
+ node.isInlined = false;
node.hasTransform = false;
- node.isAnimated = false;
node.inlineStyles = [];
node.inlineTransforms = null;
node.inlineTransition = null;
@@ -8008,7 +8042,6 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.branchRemoved = false;
node.branchNotRendered = false;
node.sizeChanged = false;
- node.isInlined = false;
node.hasVisibilitySwap = false;
node.hasDisplayNone = false;
node.hasVisibilityHidden = false;
@@ -8151,7 +8184,7 @@ const recordNodeState = (node, $measure, computedStyle, skipMeasurements) => {
/**
* @param {LayoutNode} node
- * @param {LayoutStateParams} [props]
+ * @param {LayoutStateAnimationProperties} [props]
*/
const updateNodeProperties = (node, props) => {
if (!props) return;
@@ -8160,6 +8193,19 @@ const updateNodeProperties = (node, props) => {
}
};
+/**
+ * @param {LayoutNode} node
+ * @param {LayoutAnimationTimingsParams} params
+ */
+const updateNodeTimingParams = (node, params) => {
+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);
+ const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;
+ const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
+ node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);
+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);
+};
+
/**
* @param {LayoutNode} node
*/
@@ -8234,9 +8280,9 @@ const restoreNodeVisualState = node => {
node.$measure.style.removeProperty('visibility');
}
}
- if (node.measuredIsRemoved) {
- node.layout.pendingRemoved.delete(node.$el);
- }
+ // if (node.measuredIsRemoved) {
+ node.layout.pendingRemoval.delete(node.$el);
+ // }
};
/**
@@ -8286,6 +8332,7 @@ class LayoutSnapshot {
*/
revert() {
this.forEachNode(node => {
+ this.layout.pendingRemoval.delete(node.$el);
node.$el.removeAttribute('data-layout-id');
node.$measure.removeAttribute('data-layout-id');
});
@@ -8297,34 +8344,22 @@ class LayoutSnapshot {
/**
* @param {DOMTarget} $el
- * @return {LayoutNodeProperties|undefined}
+ * @return {LayoutNode}
*/
- get($el) {
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- return node.properties;
+ getNode($el) {
+ if (!$el || !$el.dataset) return;
+ return this.nodes.get($el.dataset.layoutId);
}
/**
* @param {DOMTarget} $el
* @param {String} prop
- * @return {Number|String|undefined}
+ * @return {Number|String}
*/
- getValue($el, prop) {
- if (!$el || !$el.dataset) {
- console.warn(`No element found on state (${$el})`);
- return;
- }
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- const value = node.properties[prop];
- if (!isUnd(value)) return getFunctionValue(value, $el, node.index, node.total);
+ getComputedValue($el, prop) {
+ const node = this.getNode($el);
+ if (!node) return;
+ return /** @type {Number|String} */(node.properties[prop]);
}
/**
@@ -8385,10 +8420,10 @@ class LayoutSnapshot {
const $parent = /** @type {LayoutNode|null} */(stack.pop());
/** @type {DOMTarget|null} */
const $current = /** @type {DOMTarget|null} */(stack.pop());
+
if (!$current || $current.nodeType !== 1 || isSvg($current)) continue;
const skipMeasurements = $parent ? $parent.measuredIsRemoved : false;
-
const computedStyle = skipMeasurements ? hiddenComputedStyle : getComputedStyle($current);
const hasDisplayNone = skipMeasurements ? true : computedStyle.display === 'none';
const hasVisibilityHidden = skipMeasurements ? true : computedStyle.visibility === 'hidden';
@@ -8435,11 +8470,10 @@ class LayoutSnapshot {
node.branchRemoved = false;
node.branchNotRendered = false;
node.isTarget = false;
- node.isAnimated = false;
+ node.sizeChanged = false;
node.hasVisibilityHidden = hasVisibilityHidden;
node.hasDisplayNone = hasDisplayNone;
node.hasVisibilitySwap = (hasVisibilityHidden && !node.measuredHasVisibilityHidden) || (hasDisplayNone && !node.measuredHasDisplayNone);
- // node.hasVisibilitySwap = (hasVisibilityHidden !== node.measuredHasVisibilityHidden) || (hasDisplayNone !== node.measuredHasDisplayNone);
this.nodes.set(node.id, node);
@@ -8458,6 +8492,7 @@ class LayoutSnapshot {
$parent._tail = node;
}
} else {
+ // Each disconnected subtree becomes its own root in the snapshot graph
this.rootNodes.add(node);
}
@@ -8501,11 +8536,29 @@ class LayoutSnapshot {
* @return {this}
*/
record() {
- const { children, root } = this.layout;
+ const layout = this.layout;
+ const children = layout.children;
+ const root = layout.root;
const toParse = isArr(children) ? children : [children];
const scoped = [];
const scopeRoot = children === '*' ? root : scope.root;
+ // Mute transition and transforms of root ancestors before recording the state
+
+ /** @type {Array<DOMTarget|String|null>} */
+ const rootAncestorTransformStore = [];
+ let $ancestor = root.parentElement;
+ while ($ancestor && $ancestor.nodeType === 1) {
+ const computedStyle = getComputedStyle($ancestor);
+ if (computedStyle.transform && computedStyle.transform !== 'none') {
+ const inlineTransform = $ancestor.style.transform || '';
+ const inlineTransition = muteElementTransition($ancestor);
+ rootAncestorTransformStore.push($ancestor, inlineTransform, inlineTransition);
+ $ancestor.style.transform = 'none';
+ }
+ $ancestor = $ancestor.parentElement;
+ }
+
for (let i = 0, l = toParse.length; i < l; i++) {
const child = toParse[i];
scoped[i] = isStr(child) ? scopeRoot.querySelectorAll(child) : child;
@@ -8521,9 +8574,13 @@ class LayoutSnapshot {
rootNode.isTarget = true;
this.rootNode = rootNode;
- // Track ids of nodes that belong to the current root to filter detached matches
const inRootNodeIds = new Set();
+ // Update index and total for inital timing calculation
+ let index = 0, total = this.nodes.size;
this.nodes.forEach((node, id) => {
+ node.index = index++;
+ node.total = total;
+ // Track ids of nodes that belong to the current root to filter detached matches
if (node && node.measuredIsInsideRoot) {
inRootNodeIds.add(id);
}
@@ -8553,7 +8610,7 @@ class LayoutSnapshot {
for (let i = 0, l = parsedChildren.length; i < l; i++) {
const $el = parsedChildren[i];
- const node = this.nodes.get($el.dataset.layoutId);
+ const node = this.getNode($el);
if (node) {
let cur = node;
while (cur) {
@@ -8567,18 +8624,52 @@ class LayoutSnapshot {
this.scrollX = window.scrollX;
this.scrollY = window.scrollY;
- const total = this.nodes.size;
-
this.forEachNode(restoreNodeTransform);
- this.forEachNode((node, i) => {
- node.index = i;
- node.total = total;
- });
+
+ // Restore transition and transforms of root ancestors
+
+ for (let i = 0, l = rootAncestorTransformStore.length; i < l; i += 3) {
+ const $el = /** @type {DOMTarget} */(rootAncestorTransformStore[i]);
+ const inlineTransform = /** @type {String} */(rootAncestorTransformStore[i + 1]);
+ const inlineTransition = /** @type {String|null} */(rootAncestorTransformStore[i + 2]);
+ if (inlineTransform && inlineTransform !== '') {
+ $el.style.transform = inlineTransform;
+ } else {
+ $el.style.removeProperty('transform');
+ }
+ restoreElementTransition($el, inlineTransition);
+ }
return this;
}
}
+/**
+ * @param {LayoutStateParams} params
+ * @return {[LayoutStateAnimationProperties, LayoutAnimationTimingsParams]}
+ */
+function splitPropertiesFromParams(params) {
+ /** @type {LayoutStateAnimationProperties} */
+ const properties = {};
+ /** @type {LayoutAnimationTimingsParams} */
+ const parameters = {};
+ for (let name in params) {
+ const value = params[name];
+ const isEase = name === 'ease';
+ const isTiming = name === 'duration' || name === 'delay';
+ if (isTiming || isEase) {
+ if (isEase) {
+ parameters[name] = /** @type {EasingParam} */(value);
+ } else {
+ parameters[name] = /** @type {Number|FunctionValue} */(value);
+ }
+ } else {
+ properties[name] = /** @type {Number|String} */(value);
+ }
+ }
+ return [properties, parameters];
+}
+
class AutoLayout {
/**
* @param {DOMTargetSelector} root
@@ -8586,10 +8677,16 @@ class AutoLayout {
*/
constructor(root, params = {}) {
if (scope.current) scope.current.register(this);
- const frozenParams = params.frozen;
- const addedParams = params.added;
- const removedParams = params.removed;
- const propsParams = params.properties;
+ const swapAtSplitParams = splitPropertiesFromParams(params.swapAt);
+ const enterFromSplitParams = splitPropertiesFromParams(params.enterFrom);
+ const leaveToSplitParams = splitPropertiesFromParams(params.leaveTo);
+ const transitionProperties = params.properties;
+ /** @type {Number|FunctionValue} */
+ params.duration = setValue(params.duration, 350);
+ /** @type {Number|FunctionValue} */
+ params.delay = setValue(params.delay, 0);
+ /** @type {EasingParam|FunctionValue} */
+ params.ease = setValue(params.ease, 'inOut(3.5)');
/** @type {AutoLayoutParams} */
this.params = params;
/** @type {DOMTarget} */
@@ -8600,29 +8697,27 @@ class AutoLayout {
this.children = params.children || '*';
/** @type {Boolean} */
this.absoluteCoords = false;
- /** @type {Number|FunctionValue} */
- this.duration = setValue(params.duration, 500);
- /** @type {Number|FunctionValue} */
- this.delay = setValue(params.delay, 0);
- /** @type {EasingParam} */
- this.ease = setValue(params.ease, 'inOut(3.5)');
- /** @type {Callback<this>} */
- this.onComplete = setValue(params.onComplete, /** @type {Callback<this>} */(noop));
/** @type {LayoutStateParams} */
- this.frozenParams = frozenParams || { opacity: 0 };
+ this.swapAtParams = mergeObjects(params.swapAt || { opacity: 0 }, { ease: 'inOut(1.75)' });
/** @type {LayoutStateParams} */
- this.addedParams = addedParams || { opacity: 0 };
+ this.enterFromParams = params.enterFrom || { opacity: 0 };
/** @type {LayoutStateParams} */
- this.removedParams = removedParams || { opacity: 0 };
+ this.leaveToParams = params.leaveTo || { opacity: 0 };
/** @type {Set<String>} */
this.properties = new Set([
'opacity',
+ 'fontSize',
+ 'color',
+ 'backgroundColor',
'borderRadius',
+ 'border',
+ 'filter',
+ 'clipPath',
]);
- if (frozenParams) for (let name in frozenParams) this.properties.add(name);
- if (addedParams) for (let name in addedParams) this.properties.add(name);
- if (removedParams) for (let name in removedParams) this.properties.add(name);
- if (propsParams) for (let i = 0, l = propsParams.length; i < l; i++) this.properties.add(propsParams[i]);
+ if (swapAtSplitParams[0]) for (let name in swapAtSplitParams[0]) this.properties.add(name);
+ if (enterFromSplitParams[0]) for (let name in enterFromSplitParams[0]) this.properties.add(name);
+ if (leaveToSplitParams[0]) for (let name in leaveToSplitParams[0]) this.properties.add(name);
+ if (transitionProperties) for (let i = 0, l = transitionProperties.length; i < l; i++) this.properties.add(transitionProperties[i]);
/** @type {Set<String>} */
this.recordedProperties = new Set([
'display',
@@ -8642,24 +8737,26 @@ class AutoLayout {
]);
this.properties.forEach(prop => this.recordedProperties.add(prop));
/** @type {WeakSet<DOMTarget>} */
- this.pendingRemoved = new WeakSet();
+ this.pendingRemoval = new WeakSet();
/** @type {Map<DOMTarget, String|null>} */
this.transitionMuteStore = new Map();
/** @type {LayoutSnapshot} */
this.oldState = new LayoutSnapshot(this);
/** @type {LayoutSnapshot} */
this.newState = new LayoutSnapshot(this);
- /** @type {Timeline|null} */
+ /** @type {Timeline} */
this.timeline = null;
- /** @type {WAAPIAnimation|null} */
+ /** @type {WAAPIAnimation} */
this.transformAnimation = null;
/** @type {Array<DOMTarget>} */
- this.frozen = [];
+ this.animating = [];
+ /** @type {Array<DOMTarget>} */
+ this.swapping = [];
/** @type {Array<DOMTarget>} */
- this.removed = [];
+ this.leaving = [];
/** @type {Array<DOMTarget>} */
- this.added = [];
- // Record the current state as the old state to init the data attributes
+ this.entering = [];
+ // Record the current state as the old state to init the data attributes and allow imediate .animate()
this.oldState.record();
// And all layout transition muted during the record
restoreLayoutTransition(this.transitionMuteStore);
@@ -8669,6 +8766,7 @@ class AutoLayout {
* @return {this}
*/
revert() {
+ this.root.classList.remove('is-animated');
if (this.timeline) {
this.timeline.complete();
this.timeline = null;
@@ -8677,8 +8775,7 @@ class AutoLayout {
this.transformAnimation.complete();
this.transformAnimation = null;
}
- this.root.classList.remove('is-animated');
- this.frozen.length = this.removed.length = this.added.length = 0;
+ this.animating.length = this.swapping.length = this.leaving.length = this.entering.length = 0;
this.oldState.revert();
this.newState.revert();
requestAnimationFrame(() => restoreLayoutTransition(this.transitionMuteStore));
@@ -8711,20 +8808,72 @@ class AutoLayout {
* @return {Timeline}
*/
animate(params = {}) {
- const delay = setValue(params.delay, this.delay);
- const duration = setValue(params.duration, this.duration);
- const onComplete = setValue(params.onComplete, this.onComplete);
- const frozenParams = params.frozen ? mergeObjects(params.frozen, this.frozenParams) : this.frozenParams;
- const addedParams = params.added ? mergeObjects(params.added, this.addedParams) : this.addedParams;
- const removedParams = params.removed ? mergeObjects(params.removed, this.removedParams) : this.removedParams;
+ /** @type { LayoutAnimationTimingsParams } */
+ const animationTimings = {
+ ease: setValue(params.ease, this.params.ease),
+ delay: setValue(params.delay, this.params.delay),
+ duration: setValue(params.duration, this.params.duration),
+ };
+ /** @type {TimelineParams} */
+ const tlParams = {};
+ const onComplete = setValue(params.onComplete, this.params.onComplete);
+ const onPause = setValue(params.onPause, this.params.onPause);
+ for (let name in defaults) {
+ if (name !== 'ease' && name !== 'duration' && name !== 'delay') {
+ if (!isUnd(params[name])) {
+ tlParams[name] = params[name];
+ } else if (!isUnd(this.params[name])) {
+ tlParams[name] = this.params[name];
+ }
+ }
+ }
+ tlParams.onComplete = () => {
+ // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(node => {
+ restoreNodeVisualState(node);
+ restoreNodeInlineStyles(node);
+ });
+ for (let i = 0, l = transformed.length; i < l; i++) {
+ const $el = transformed[i];
+ $el.style.transform = newState.getComputedValue($el, 'transform');
+ }
+ if (this.root.classList.contains('is-animated')) {
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ }
+ // Avoid CSS transitions at the end of the animation by restoring them on the next frame
+ requestAnimationFrame(() => {
+ if (this.root.classList.contains('is-animated')) return;
+ restoreLayoutTransition(this.transitionMuteStore);
+ });
+ };
+ tlParams.onPause = () => {
+ if (!this.root.classList.contains('is-animated')) return;
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(restoreNodeVisualState);
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ if (onPause) onPause(this.timeline);
+ };
+ tlParams.composition = false;
+
+ const swapAtParams = mergeObjects(mergeObjects(params.swapAt || {}, this.swapAtParams), animationTimings);
+ const enterFromParams = mergeObjects(mergeObjects(params.enterFrom || {}, this.enterFromParams), animationTimings);
+ const leaveToParams = mergeObjects(mergeObjects(params.leaveTo || {}, this.leaveToParams), animationTimings);
+ const [ swapAtProps, swapAtTimings ] = splitPropertiesFromParams(swapAtParams);
+ const [ enterFromProps, enterFromTimings ] = splitPropertiesFromParams(enterFromParams);
+ const [ leaveToProps, leaveToTimings ] = splitPropertiesFromParams(leaveToParams);
+
const oldState = this.oldState;
const newState = this.newState;
- const added = this.added;
- const removed = this.removed;
- const frozen = this.frozen;
- const pendingRemoved = this.pendingRemoved;
+ const animating = this.animating;
+ const swapping = this.swapping;
+ const entering = this.entering;
+ const leaving = this.leaving;
+ const pendingRemoval = this.pendingRemoval;
- added.length = removed.length = frozen.length = 0;
+ animating.length = swapping.length = entering.length = leaving.length = 0;
// Mute old state CSS transitions to prevent wrong properties calculation
oldState.forEachRootNode(muteNodeTransition);
@@ -8735,10 +8884,12 @@ class AutoLayout {
const targets = [];
const animated = [];
const transformed = [];
- const animatedFrozen = [];
- const root = newState.rootNode.$el;
+ const animatedSwap = [];
+ const rootNode = newState.rootNode;
+ const $root = rootNode.$el;
newState.forEachRootNode(node => {
+
const $el = node.$el;
const id = node.id;
const parent = node.parentNode;
@@ -8746,10 +8897,6 @@ class AutoLayout {
const parentRemoved = parent ? parent.branchRemoved : false;
const parentNotRendered = parent ? parent.branchNotRendered : false;
- // Delay and duration must be calculated in the animate() call to support delay override
- node.delay = +(isFnc(delay) ? delay($el, node.index, node.total) : delay);
- node.duration = +(isFnc(duration) ? duration($el, node.index, node.total) : duration);
-
let oldStateNode = oldState.nodes.get(id);
const hasNoOldState = !oldStateNode;
@@ -8799,7 +8946,7 @@ class AutoLayout {
}
}
- const wasPendingRemoval = pendingRemoved.has($el);
+ const wasPendingRemoval = pendingRemoval.has($el);
const wasVisibleBefore = oldStateNode.measuredIsVisible;
const isVisibleNow = node.measuredIsVisible;
const becomeVisible = !wasVisibleBefore && isVisibleNow && !parentNotRendered;
@@ -8807,113 +8954,156 @@ class AutoLayout {
const newlyRemoved = isRemovedNow && !wasRemovedBefore && !parentRemoved;
const topLevelRemoved = newlyRemoved || isRemovedNow && wasPendingRemoval && !parentRemoved;
- if (node.measuredIsRemoved && wasVisibleBefore) {
+ node.branchAdded = parentAdded || topLevelAdded;
+ node.branchRemoved = parentRemoved || topLevelRemoved;
+ node.branchNotRendered = parentNotRendered || isRemovedNow;
+
+ if (isRemovedNow && wasVisibleBefore) {
node.$el.style.display = oldStateNode.measuredDisplay;
node.$el.style.visibility = 'visible';
cloneNodeProperties(oldStateNode, node, newState);
}
+ // Node is leaving
if (newlyRemoved) {
- removed.push($el);
- pendingRemoved.add($el);
+ if (node.isTarget) {
+ leaving.push($el);
+ node.isLeaving = true;
+ }
+ pendingRemoval.add($el);
} else if (!isRemovedNow && wasPendingRemoval) {
- pendingRemoved.delete($el);
+ pendingRemoval.delete($el);
}
- // Node is added
+ // Node is entering
if ((topLevelAdded && !parentNotRendered) || becomeVisible) {
- updateNodeProperties(oldStateNode, addedParams);
- added.push($el);
- // Node is removed
+ updateNodeProperties(oldStateNode, enterFromProps);
+ if (node.isTarget) {
+ entering.push($el);
+ node.isEntering = true;
+ }
+ // Node is leaving
} else if (topLevelRemoved && !parentNotRendered) {
- updateNodeProperties(node, removedParams);
+ updateNodeProperties(node, leaveToProps);
}
- // Compute function based propety values before cheking for changes
- for (let name in node.properties) {
- node.properties[name] = newState.getValue(node.$el, name);
- // NOTE: I'm using node.$el to get the value of old state, make sure this is valid instead of oldStateNode.$el
- oldStateNode.properties[name] = oldState.getValue(node.$el, name);
+ // Node is animating
+ // The animating array is used only to calculate delays and duration on root children
+ if (node !== rootNode && node.isTarget && !node.isEntering && !node.isLeaving) {
+ animating.push($el);
}
- const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
- let propertyChanged = false;
+ targets.push($el);
+ });
- if (node.isTarget && (!node.measuredIsRemoved && wasVisibleBefore || node.measuredIsRemoved && isVisibleNow)) {
- if (!node.isInlined && (node.properties.transform !== 'none' || oldStateNode.properties.transform !== 'none')) {
- node.hasTransform = true;
- propertyChanged = true;
- transformed.push($el);
- }
- for (let name in node.properties) {
- if (name !== 'transform' && (node.properties[name] !== oldStateNode.properties[name] || hiddenStateChanged)) {
- propertyChanged = true;
- animated.push($el);
- break;
- }
- }
+ let enteringIndex = 0;
+ let leavingIndex = 0;
+ let animatingIndex = 0;
+
+ newState.forEachRootNode(node => {
+
+ const $el = node.$el;
+ const parent = node.parentNode;
+ const oldStateNode = oldState.nodes.get(node.id);
+ const nodeProperties = node.properties;
+ const oldStateNodeProperties = oldStateNode.properties;
+
+ // Use closest animated parent index and total values so that children staggered delays are in sync with their parent
+ let animatedParent = parent !== rootNode && parent;
+ while (animatedParent && !animatedParent.isTarget && animatedParent !== rootNode) {
+ animatedParent = animatedParent.parentNode;
+ }
+
+ const animatingTotal = animating.length;
+
+ // Root is always animated first in sync with the first child (animating.length is the total of children)
+ if (node === rootNode) {
+ node.index = 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else if (node.isEntering) {
+ node.index = animatedParent ? animatedParent.index : enteringIndex;
+ node.total = animatedParent ? animatingTotal : entering.length;
+ updateNodeTimingParams(node, enterFromTimings);
+ enteringIndex++;
+ } else if (node.isLeaving) {
+ node.index = animatedParent ? animatedParent.index : leavingIndex;
+ node.total = animatedParent ? animatingTotal : leaving.length;
+ leavingIndex++;
+ updateNodeTimingParams(node, leaveToTimings);
+ } else if (node.isTarget) {
+ node.index = animatingIndex++;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else {
+ node.index = animatedParent ? animatedParent.index : 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, swapAtTimings);
}
- const nodeHasChanged = (propertyChanged || topLevelAdded || topLevelRemoved || becomeVisible);
- const nodeIsAnimated = node.isTarget && nodeHasChanged;
+ // Make sure the old state node has its inex and total values up to date for valid "from" function values calculation
+ oldStateNode.index = node.index;
+ oldStateNode.total = node.total;
- node.isAnimated = nodeIsAnimated;
- node.branchAdded = parentAdded || topLevelAdded;
- node.branchRemoved = parentRemoved || topLevelRemoved;
- node.branchNotRendered = parentNotRendered || node.measuredIsRemoved;
+ // Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation props
+ for (let prop in nodeProperties) {
+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);
+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);
+ }
+ // Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements
const sizeTolerance = 1;
- const widthChanged = Math.abs(node.properties.width - oldStateNode.properties.width) > sizeTolerance;
- const heightChanged = Math.abs(node.properties.height - oldStateNode.properties.height) > sizeTolerance;
+ const widthChanged = Math.abs(nodeProperties.width - oldStateNodeProperties.width) > sizeTolerance;
+ const heightChanged = Math.abs(nodeProperties.height - oldStateNodeProperties.height) > sizeTolerance;
node.sizeChanged = (widthChanged || heightChanged);
- targets.push($el);
+ // const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
+
+ if (node.isTarget && (!node.measuredIsRemoved && oldStateNode.measuredIsVisible || node.measuredIsRemoved && node.measuredIsVisible)) {
+ if (!node.isInlined && (nodeProperties.transform !== 'none' || oldStateNodeProperties.transform !== 'none')) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ for (let prop in nodeProperties) {
+ // if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop] || hiddenStateChanged)) {
+ if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop])) {
+ animated.push($el);
+ break;
+ }
+ }
+ }
if (!node.isTarget) {
- frozen.push($el);
- if ((nodeHasChanged || node.sizeChanged) && parent && parent.isTarget && parent.isAnimated && parent.sizeChanged) {
- animatedFrozen.push($el);
+ swapping.push($el);
+ if (node.sizeChanged && parent && parent.isTarget && parent.sizeChanged) {
+ if (!node.isInlined && swapAtProps.transform) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ animatedSwap.push($el);
}
}
+
});
- const defaults = {
- ease: setValue(params.ease, this.ease),
- duration: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).duration,
- delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
+ const timingParams = {
+ delay: (/** @type {HTMLElement} */$el) => newState.getNode($el).delay,
+ duration: (/** @type {HTMLElement} */$el) => newState.getNode($el).duration,
+ ease: (/** @type {HTMLElement} */$el) => newState.getNode($el).ease,
};
- this.timeline = createTimeline({
- onComplete: () => {
- // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(node => {
- restoreNodeVisualState(node);
- restoreNodeInlineStyles(node);
- });
- for (let i = 0, l = transformed.length; i < l; i++) {
- const $el = transformed[i];
- $el.style.transform = newState.getValue($el, 'transform');
- }
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- // Avoid CSS transitions at the end of the animation by restoring them on the next frame
- requestAnimationFrame(() => {
- if (this.root.classList.contains('is-animated')) return;
- restoreLayoutTransition(this.transitionMuteStore);
- });
- },
- onPause: () => {
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(restoreNodeVisualState);
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- },
- composition: false,
- defaults,
- });
+ tlParams.defaults = timingParams;
+
+ this.timeline = createTimeline(tlParams);
+
+ // Imediatly return the timeline if no layout changes detected
+ if (!animated.length && !transformed.length && !swapping.length) {
+ // Make sure to restore all CSS transition if no animation
+ restoreLayoutTransition(this.transitionMuteStore);
+ return this.timeline.complete();
+ }
if (targets.length) {
@@ -8926,15 +9116,14 @@ class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
- // Make sure to mute all CSS transition before applying the oldState styles back
- muteNodeTransition(newNode);
+ // muteNodeTransition(newNode);
// Don't animate dimensions and positions of inlined elements
if (!newNode.isInlined) {
// Display grid can mess with the absolute positioning, so set it to block during transition
- if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.display = 'block';
- // All children must be in position absolue
- if ($el !== root || this.absoluteCoords) {
+ if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.setProperty('display', 'block', 'important');
+ // All children must be in position absolute or fixed
+ if ($el !== $root || this.absoluteCoords) {
$el.style.position = this.absoluteCoords ? 'fixed' : 'absolute';
$el.style.left = '0px';
$el.style.top = '0px';
@@ -8942,7 +9131,7 @@ class AutoLayout {
$el.style.marginTop = '0px';
$el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
}
- if ($el === root && newNode.measuredPosition === 'static') {
+ if ($el === $root && newNode.measuredPosition === 'static') {
$el.style.position = 'relative';
// Cancel left / trop in case the static element had muted values now activated by potision relative
$el.style.left = '0px';
@@ -8961,9 +9150,7 @@ class AutoLayout {
// Restore the scroll position if the oldState differs from the current state
if (oldState.scrollX !== window.scrollX || oldState.scrollY !== window.scrollY) {
// Restoring in the next frame avoids race conditions if for example a waapi animation commit styles that affect the root height
- requestAnimationFrame(() => {
- window.scrollTo(oldState.scrollX, oldState.scrollY);
- });
+ requestAnimationFrame(() => window.scrollTo(oldState.scrollX, oldState.scrollY));
}
for (let i = 0, l = animated.length; i < l; i++) {
@@ -8973,25 +9160,25 @@ class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
const newNodeState = newNode.properties;
- let hasChanged = false;
+ let nodeHasChanged = false;
+ /** @type {AnimationParams} */
const animatedProps = {
composition: 'none',
- // delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
};
if (!newNode.isInlined) {
if (oldNodeState.width !== newNodeState.width) {
animatedProps.width = [oldNodeState.width, newNodeState.width];
- hasChanged = true;
+ nodeHasChanged = true;
}
if (oldNodeState.height !== newNodeState.height) {
animatedProps.height = [oldNodeState.height, newNodeState.height];
- hasChanged = true;
+ nodeHasChanged = true;
}
// If the node has transforms we handle the translate animation in wappi otherwise translate and other transforms can be out of sync
// Always animate translate
if (!newNode.hasTransform) {
animatedProps.translate = [`${oldNodeState.x}px ${oldNodeState.y}px`, `${newNodeState.x}px ${newNodeState.y}px`];
- hasChanged = true;
+ nodeHasChanged = true;
}
}
this.properties.forEach(prop => {
@@ -8999,73 +9186,77 @@ class AutoLayout {
const newVal = newNodeState[prop];
if (prop !== 'transform' && oldVal !== newVal) {
animatedProps[prop] = [oldVal, newVal];
- hasChanged = true;
+ nodeHasChanged = true;
}
});
- if (hasChanged) {
+ if (nodeHasChanged) {
this.timeline.add($el, animatedProps, 0);
}
}
}
- if (frozen.length) {
+ if (swapping.length) {
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const oldNode = oldState.nodes.get($el.dataset.layoutId);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const oldNode = oldState.getNode($el);
if (!oldNode.isInlined) {
- const oldNodeState = oldState.get($el);
- $el.style.width = `${oldNodeState.width}px`;
- $el.style.height = `${oldNodeState.height}px`;
+ const oldNodeProps = oldNode.properties;
+ $el.style.width = `${oldNodeProps.width}px`;
+ $el.style.height = `${oldNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
+ $el.style.translate = `${oldNodeProps.x}px ${oldNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${oldState.getValue($el, prop)}`;
+ $el.style[prop] = `${oldState.getComputedValue($el, prop)}`;
}
});
}
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const newNode = newState.nodes.get($el.dataset.layoutId);
- const newNodeState = newState.get($el);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const newNode = newState.getNode($el);
+ const newNodeProps = newNode.properties;
this.timeline.call(() => {
if (!newNode.isInlined) {
- $el.style.width = `${newNodeState.width}px`;
- $el.style.height = `${newNodeState.height}px`;
+ $el.style.width = `${newNodeProps.width}px`;
+ $el.style.height = `${newNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${newNodeState.x}px ${newNodeState.y}px`;
+ $el.style.translate = `${newNodeProps.x}px ${newNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${newState.getValue($el, prop)}`;
+ $el.style[prop] = `${newState.getComputedValue($el, prop)}`;
}
});
}, newNode.delay + newNode.duration / 2);
}
- if (animatedFrozen.length) {
- const animatedFrozenParams = /** @type {AnimationParams} */({});
- if (frozenParams) {
- for (let prop in frozenParams) {
- animatedFrozenParams[prop] = [
- { from: (/** @type {HTMLElement} */$el) => oldState.getValue($el, prop), ease: 'in(1.75)', to: frozenParams[prop] },
- { from: frozenParams[prop], to: (/** @type {HTMLElement} */$el) => newState.getValue($el, prop), ease: 'out(1.75)' }
- ];
+ if (animatedSwap.length) {
+ const ease = parseEase(newState.nodes.get(animatedSwap[0].dataset.layoutId).ease);
+ const inverseEased = t => 1 - ease(1 - t);
+ const animatedSwapParams = /** @type {AnimationParams} */({});
+ if (swapAtProps) {
+ for (let prop in swapAtProps) {
+ if (prop !== 'transform') {
+ animatedSwapParams[prop] = [
+ { from: (/** @type {HTMLElement} */$el) => oldState.getComputedValue($el, prop), to: swapAtProps[prop] },
+ { from: swapAtProps[prop], to: (/** @type {HTMLElement} */$el) => newState.getComputedValue($el, prop), ease: inverseEased }
+ ];
+ }
}
}
- this.timeline.add(animatedFrozen, animatedFrozenParams, 0);
+ this.timeline.add(animatedSwap, animatedSwapParams, 0);
}
}
@@ -9073,18 +9264,29 @@ class AutoLayout {
const transformedLength = transformed.length;
if (transformedLength) {
- // We only need to set the transform property here since translate is alread defined the targets loop
+ // We only need to set the transform property here since translate is alread defined in the targets loop
for (let i = 0; i < transformedLength; i++) {
const $el = transformed[i];
- $el.style.translate = `${oldState.get($el).x}px ${oldState.get($el).y}px`,
- $el.style.transform = oldState.getValue($el, 'transform');
+ $el.style.translate = `${oldState.getComputedValue($el, 'x')}px ${oldState.getComputedValue($el, 'y')}px`,
+ $el.style.transform = oldState.getComputedValue($el, 'transform');
+ if (animatedSwap.includes($el)) {
+ const node = newState.getNode($el);
+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);
+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);
+ }
}
this.transformAnimation = waapi.animate(transformed, {
- translate: (/** @type {HTMLElement} */$el) => `${newState.get($el).x}px ${newState.get($el).y}px`,
- transform: (/** @type {HTMLElement} */$el) => newState.getValue($el, 'transform'),
+ translate: (/** @type {HTMLElement} */$el) => `${newState.getComputedValue($el, 'x')}px ${newState.getComputedValue($el, 'y')}px`,
+ transform: (/** @type {HTMLElement} */$el) => {
+ const newValue = newState.getComputedValue($el, 'transform');
+ if (!animatedSwap.includes($el)) return newValue;
+ const oldValue = oldState.getComputedValue($el, 'transform');
+ const node = newState.getNode($el);
+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]
+ },
autoplay: false,
persist: true,
- ...defaults,
+ ...timingParams,
});
this.timeline.sync(this.transformAnimation, 0);
}
@@ -9095,13 +9297,12 @@ class AutoLayout {
/**
* @param {(layout: this) => void} callback
* @param {LayoutAnimationParams} [params]
- * @return {this}
+ * @return {Timeline}
*/
update(callback, params = {}) {
this.record();
callback(this);
- this.animate(params);
- return this;
+ return this.animate(params);
}
}
diff --git a/dist/bundles/anime.esm.min.js b/dist/bundles/anime.esm.min.js
index 1b3525d2..b33e4028 100644
--- a/dist/bundles/anime.esm.min.js
+++ b/dist/bundles/anime.esm.min.js
@@ -1,7 +1,7 @@
/**
* Anime.js - ESM minified bundle
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
-const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},r={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},n={NONE:0,AUTO:1,FORCE:2},o={replace:0,none:1,blend:2},a=Symbol(),h=Symbol(),l=Symbol(),d=Symbol(),c=Symbol(),u=Symbol(),p=1e-11,m=1e12,f=1e3,g=240,y="",v="var(",_=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),b=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","matrix","matrix3d","perspective"],T=b.reduce((t,e)=>({...t,[e]:e+"("}),{}),S=()=>{},x=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,w=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,$=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,E=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,C=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,k=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,N=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,R=/([a-z])([A-Z])/g,I=/(\w+)(\([^)]+\)+)/g,D=/(\*=|\+=|-=)/,A=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,O={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:g,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:f,delay:0,loopDelay:0,ease:"out(2)",composition:o.replace,modifier:t=>t,onBegin:S,onBeforeUpdate:S,onUpdate:S,onLoop:S,onPause:S,onComplete:S,onRender:S},B={current:null,root:s},L={defaults:O,precision:4,timeScale:1,tickThreshold:200},P=t&&e.AnimeJSDevTools,M={version:"4.3.0-beta.2",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(M));const F=t=>t.replace(R,"$1-$2").toLowerCase(),V=(t,e)=>0===t.indexOf(e),z=Date.now,X=Array.isArray,H=t=>t&&t.constructor===Object,U=t=>"number"==typeof t&&!isNaN(t),Y=t=>"string"==typeof t,W=t=>"function"==typeof t,q=t=>void 0===t,j=t=>q(t)||null===t,G=e=>t&&e instanceof SVGElement,Q=t=>x.test(t),J=t=>V(t,"rgb"),Z=t=>V(t,"hsl"),K=t=>Q(t)||J(t)||Z(t),tt=t=>!L.defaults.hasOwnProperty(t),et=["opacity","rotate","overflow","color"],st=(t,e)=>{if(et.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}},it=t=>Y(t)?parseFloat(t):t,rt=Math.pow,nt=Math.sqrt,ot=Math.sin,at=Math.cos,ht=Math.abs,lt=Math.exp,dt=Math.ceil,ct=Math.floor,ut=Math.asin,pt=Math.max,mt=Math.atan2,ft=Math.PI,gt=Math.round,yt=(t,e,s)=>t<e?e:t>s?s:t,vt={},_t=(t,e)=>{if(e<0)return t;if(!e)return gt(t);let s=vt[e];return s||(s=vt[e]=10**e),gt(t*s)/s},bt=(t,e)=>X(e)?e.reduce((e,s)=>ht(s-t)<ht(e-t)?s:e):e?gt(t/e)*e:t,Tt=(t,e,s)=>t+(e-t)*s,St=t=>t===1/0?m:t===-1/0?-m:t,xt=t=>t<=p?p:St(_t(t,11)),wt=t=>X(t)?[...t]:t,$t=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=q(r)?e[i]:r}return s},Et=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},Ct=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},kt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},Nt=(t,e,s)=>{const i=t.style.transform;let r;if(i){const n=t[d];let o;for(;o=I.exec(i);){const t=o[1],i=o[2].slice(1,-1);n[t]=i,t===e&&(r=i,s&&(s[e]=i))}}return i&&!q(r)?r:V(e,"scale")?"1":V(e,"rotate")||V(e,"skew")?"0deg":"0px"},Rt=t=>{const e=w.exec(t)||$.exec(t),s=q(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]},It=t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]},Dt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),At=t=>{const e=E.exec(t)||C.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=q(e[4])?1:+e[4];let o,a,h;if(0===i)o=a=h=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=_t(255*Dt(e,t,s+1/3),0),a=_t(255*Dt(e,t,s),0),h=_t(255*Dt(e,t,s-1/3),0)}return[o,a,h,n]},Ot=t=>J(t)?Rt(t):Q(t)?It(t):Z(t)?At(t):[0,0,0,1],Bt=(t,e)=>q(t)?e:t,Lt=(t,e,s,i,r)=>{let n;if(W(t))n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};else{if(!Y(t)||!V(t,v))return t;n=()=>{const s=t.match(A),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==y||!r||(n=r.trim()),n||0}}return r&&(r.func=n),n()},Pt=(t,e)=>t[h]?t[l]&&st(t,e)?i.ATTRIBUTE:b.includes(e)||_.get(e)?i.TRANSFORM:V(e,"--")?i.CSS_VAR:e in t.style?i.CSS:e in t?i.OBJECT:i.ATTRIBUTE:i.OBJECT,Mt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[u]||t).getPropertyValue(e);return"auto"===r?"0":r},Ft=(t,e,s,r)=>{const n=q(s)?Pt(t,e):s;return n===i.OBJECT?t[e]||0:n===i.ATTRIBUTE?t.getAttribute(e):n===i.TRANSFORM?Nt(t,e,r):n===i.CSS_VAR?Mt(t,e,r).trimStart():Mt(t,e,r)},Vt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,zt=()=>({t:r.NUMBER,n:0,u:null,o:null,d:null,s:null}),Xt=(t,e)=>{if(e.t=r.NUMBER,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const i=!s.includes(" ")&&N.exec(s);if(i)return e.t=r.UNIT,e.n=+i[1],e.u=i[2],e;if(e.o)return e.n=+s,e;if(K(s))return e.t=r.COLOR,e.d=Ot(s),e;{const t=s.match(k);return e.t=r.COMPLEX,e.d=t?t.map(Number):[],e.s=s.split(k)||[],e}}return e.n=s,e},Ht=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=wt(t._toNumbers),e.s=wt(t._strings),e),Ut=zt(),Yt=(t,e,s,a,h)=>{const l=t.parent,c=t.duration,u=t.completed,m=t.iterationDuration,f=t.iterationCount,g=t._currentIteration,v=t._loopDelay,_=t._reversed,b=t._alternate,S=t._hasChildren,x=t._delay,w=t._currentTime,$=x+m,E=e-x,C=yt(w,-x,c),k=yt(E,-x,c),N=E-w,R=k>0,I=k>=c,D=c<=p,A=h===n.FORCE;let O=0,B=E,P=0;if(f>1){const e=~~(k/(m+(I?0:v)));t._currentIteration=yt(e,0,f),I&&t._currentIteration--,O=t._currentIteration%2,B=k%(m+v)||0}const M=_^(b&&O),F=t._ease;let V=I?M?0:c:M?m-B:B;F&&(V=m*F(V/m)||0);const z=(l?l.backwards:E<w)?!M:!!M;if(t._currentTime=E,t._iterationTime=V,t.backwards=z,R&&!t.began?(t.began=!0,s||l&&(z||!l.began)||t.onBegin(t)):E<=0&&(t.began=!1),s||S||!R||t._currentIteration===g||t.onLoop(t),A||h===n.AUTO&&(e>=x&&e<=$||e<=x&&C>x||e>=$&&C!==c)||V>=$&&C!==c||V<=x&&C>0||e<=C&&C===c&&u||I&&!u&&D){if(R&&(t.computeDeltaTime(C),s||t.onBeforeUpdate(t)),!S){const e=A||(z?-1*N:N)>=L.tickThreshold,n=t._offset+(l?l._offset:0)+x+V;let h,c,u,p,m=t._head,f=0;for(;m;){const t=m._composition,s=m._currentTime,l=m._changeDuration,g=m._absoluteStartTime+m._changeDuration,v=m._nextRep,_=m._prevRep,b=t!==o.none;if((e||(s!==l||n<=g+(v?v._delay:0))&&(0!==s||n>=m._absoluteStartTime))&&(!b||!m._isOverridden&&(!m._isOverlapped||n<=g)&&(!v||v._isOverridden||n<=v._absoluteStartTime)&&(!_||_._isOverridden||n>=_._absoluteStartTime+_._changeDuration+m._delay))){const e=m._currentTime=yt(V-m._startTime,0,l),s=m._ease(e/m._updateDuration),n=m._modifier,g=m._valueType,y=m._tweenType,v=y===i.OBJECT,_=g===r.NUMBER,T=_&&v||0===s||1===s?-1:L.precision;let S,x;if(_)S=x=n(_t(Tt(m._fromNumber,m._toNumber,s),T));else if(g===r.UNIT)x=n(_t(Tt(m._fromNumber,m._toNumber,s),T)),S=`${x}${m._unit}`;else if(g===r.COLOR){const t=m._fromNumbers,e=m._toNumbers,i=_t(yt(n(Tt(t[0],e[0],s)),0,255),0),r=_t(yt(n(Tt(t[1],e[1],s)),0,255),0),o=_t(yt(n(Tt(t[2],e[2],s)),0,255),0),a=yt(n(_t(Tt(t[3],e[3],s),T)),0,1);if(S=`rgba(${i},${r},${o},${a})`,b){const t=m._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(g===r.COMPLEX){S=m._strings[0];for(let t=0,e=m._toNumbers.length;t<e;t++){const e=n(_t(Tt(m._fromNumbers[t],m._toNumbers[t],s),T)),i=m._strings[t+1];S+=`${i?e+i:e}`,b&&(m._numbers[t]=e)}}if(b&&(m._number=x),a||t===o.blend)m._value=S;else{const t=m.property;h=m.target,v?h[t]=S:y===i.ATTRIBUTE?h.setAttribute(t,S):(c=h.style,y===i.TRANSFORM?(h!==u&&(u=h,p=h[d]),p[t]=S,f=1):y===i.CSS?c[t]=S:y===i.CSS_VAR&&c.setProperty(t,S)),R&&(P=1)}}if(f&&m._renderTransforms){let t=y;for(let e in p)t+=`${T[e]}${p[e]}) `;c.transform=t,f=0}m=m._next}!s&&P&&t.onRender(t)}!s&&R&&t.onUpdate(t)}return l&&D?!s&&(l.began&&!z&&E>0&&!u||z&&E<=p&&u)&&(t.onComplete(t),t.completed=!z):R&&I?f===1/0?t._startTime+=t.duration:t._currentIteration>=f-1&&(t.paused=!0,u||S||(t.completed=!0,s||l&&(z||!l.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,P},Wt=(t,e,s,i,r)=>{const o=t._currentIteration;if(Yt(t,e,s,i,r),t._hasChildren){const a=t,h=a.backwards,l=i?e:a._iterationTime,d=z();let c=0,u=!0;if(!i&&a._currentIteration!==o){const t=a.iterationDuration;Et(a,e=>{if(h){const i=e.duration,r=e._offset+e._delay;s||!(i<=p)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&Yt(e,t,s,1,n.FORCE),e.began=!1,e.completed=!1}),s||a.onLoop(a)}Et(a,t=>{const e=_t((l-t._offset)*t._speed,12),n=t._fps<a._fps?t.requestTick(d):r;c+=Yt(t,e,s,i,n),!t.completed&&u&&(u=!1)},h),!s&&c&&a.onRender(a),(u||h)&&a._currentTime>=a.duration&&(a.paused=!0,a.completed||(a.completed=!0,s||(a.onComplete(a),a._resolve(a))))}},qt={},jt=(t,e,s)=>{if(s===i.TRANSFORM)return _.get(t)||t;if(s===i.CSS||s===i.ATTRIBUTE&&G(e)&&t in e.style){const e=qt[t];if(e)return e;{const e=t?F(t):t;return qt[t]=e,e}}return t},Gt=t=>{if(t._hasChildren)Et(t,Gt,!0);else{const e=t;e.pause(),Et(e,t=>{const s=t.property,r=t.target;if(r[h]){const n=r.style,o=t._inlineValue,a=j(o)||o===y;if(t._tweenType===i.TRANSFORM){const e=r[d];if(a?delete e[s]:e[s]=o,t._renderTransforms)if(Object.keys(e).length){let t=y;for(let s in e)t+=T[s]+e[s]+") ";n.transform=t}else n.removeProperty("transform")}else a?n.removeProperty(F(s)):n[s]=o;e._tail===t&&e.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===y&&t.removeAttribute("style")})}})}return t};class Qt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=f/g,this._fps=g,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<p?p:s,r=f/i;i>O.frameRate&&(O.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<p?p:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return n.NONE;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,n.AUTO}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Jt={animation:null,update:S},Zt=t=>{let e=Jt.animation;return e||(e={duration:p,computeDeltaTime:S,_offset:0,_delay:0,_head:null,_tail:null},Jt.animation=e,Jt.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=t===r.COMPLEX||t===r.COLOR?wt(i._fromNumbers):null;let n=i._fromNumber,o=s._tail;for(;o&&o!==i;){if(e)for(let t=0,s=o._numbers.length;t<s;t++)e[t]+=o._numbers[t];else n+=o._number;o=o._prevAdd}i._toNumber=n,i._toNumbers=e}}}),Yt(e,1,1,0,n.FORCE)}),e},Kt=(()=>t?requestAnimationFrame:setImmediate)(),te=(()=>t?cancelAnimationFrame:clearImmediate)();class ee extends Qt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=O,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=z();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(Ct(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):Wt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):n.AUTO),i=r}Jt.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(z()),this.reqId=Kt(ie)),this}pause(){if(this.reqId)return this.paused=!0,re()}resume(){if(this.paused)return this.paused=!1,Et(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===L.timeScale?1:f)}set speed(t){this._speed=t*L.timeScale,Et(this,t=>t.speed=t._speed)}get timeUnit(){return 1===L.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(L.timeScale!==s){L.timeScale=s,L.tickThreshold=200*s;const t=e?.001:f;this.defaults.duration*=t,this._speed*=t}}get precision(){return L.precision}set precision(t){L.precision=t}}const se=(()=>{const e=new ee(z());return t&&(M.engine=e,s.addEventListener("visibilitychange",()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())})),e})(),ie=()=>{se._head?(se.reqId=Kt(ie),se.update()):se.reqId=0},re=()=>(te(se.reqId),se.reqId=0,se),ne={_rep:new WeakMap,_add:new Map},oe=(t,e,s="_rep")=>{const i=ne[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},ae=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,he=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=p,t._currentTime=p},le=(t,e)=>{const s=t._composition;if(s===o.replace){const s=t._absoluteStartTime;kt(e,t,ae,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){he(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)he(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=_t(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<p&&he(i)}let o=!0;if(Et(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;Et(t,t=>{t!==e&&Et(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===o.blend){const e=oe(t.target,t.property,"_add"),s=Zt(ne._add);let i=e._head;i||(i={...t},i._composition=o.replace,i._updateDuration=p,i._startTime=0,i._numbers=wt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,kt(e,i),kt(s,i));const r=t._toNumber;if(t._fromNumber=i._fromNumber-r,t._toNumber=0,t._numbers=wt(t._fromNumbers),t._number=0,i._fromNumber=r,t._toNumbers){const e=wt(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}kt(e,t,null,"_prevAdd","_nextAdd")}return t},de=t=>{const e=t._composition;if(e!==o.none){const s=t.target,i=t.property,r=ne._rep.get(s)[i];if(Ct(r,t,"_prevRep","_nextRep"),e===o.blend){const e=ne._add,r=e.get(s);if(!r)return;const n=r[i],o=Jt.animation;Ct(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){Ct(n,a,"_prevAdd","_nextAdd"),Ct(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},ce=(t,e,s)=>{let r=!1;return Et(e,n=>{const o=n.target;if(t.includes(o)){const t=n.property,a=n._tweenType,h=jt(s,o,a);(!h||h&&h===t)&&(n.parent._tail===n&&n._tweenType===i.TRANSFORM&&n._prev&&n._prev._tweenType===i.TRANSFORM&&(n._prev._renderTransforms=1),Ct(e,n),de(n),r=!0)}},!0),r},ue=(t,e,s)=>{const i=e||se;let r;if(i._hasChildren){let e=0;Et(i,n=>{if(!n._hasChildren)if(r=ce(t,n,s),r&&!n._head)n.cancel(),Ct(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?ue(t,n,s):n._hasChildren=!1},!0),q(i.iterationDuration)||(i.iterationDuration=e)}else r=ce(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},pe=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),me=t=>t._cancelled?(t._hasChildren?Et(t,me):Et(t,t=>{t._composition!==o.none&&le(t,oe(t.target,t.property))}),t._cancelled=0,t):t;let fe=0;class ge extends Qt{constructor(t={},e=null,s=0){super(0),++fe;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:h,loopDelay:l,autoplay:d,frameRate:c,playbackRate:u,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:_}=t;B.current&&B.current.register(this);const b=e?0:se._lastTickTime,T=e?e.defaults:L.defaults,x=W(r)||q(r)?T.delay:+r,w=W(n)||q(n)?1/0:+n,$=Bt(h,T.loop),E=Bt(l,T.loopDelay);let C=!0===$||$===1/0||$<0?1/0:$+1;if(P){const s=C===1/0;if(P.register(this,t,s)&&s){const t=a?2:1,s=e?P.maxNestedInfiniteLoops:P.maxInfiniteLoops;C=Math.max(s,t)}}let k=0;e?k=s:(se.reqId||se.requestTick(z()),k=(se._lastTickTime-se._startTime)*L.timeScale),this.id=q(i)?fe:i,this.parent=e,this.duration=St((w+E)*C-E)||p,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||T.onBegin,this.onBeforeUpdate=v||T.onBeforeUpdate,this.onUpdate=_||T.onUpdate,this.onLoop=f||T.onLoop,this.onPause=g||T.onPause,this.onComplete=m||T.onComplete,this.iterationDuration=w,this.iterationCount=C,this._autoplay=!e&&Bt(d,T.autoplay),this._offset=k,this._delay=x,this._loopDelay=E,this._iterationTime=0,this._currentIteration=0,this._resolve=S,this._running=!1,this._reversed=+Bt(o,T.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Bt(a,T.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=Bt(c,T.frameRate),this._speed=Bt(u,T.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return yt(_t(this._currentTime,L.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return yt(_t(this._iterationTime,L.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return yt(_t(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return yt(_t(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*yt(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return me(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Wt(this,0,1,~~t,n.FORCE),pe(this),this._hasChildren&&Et(this,pe),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&Wt(this,this.duration,1,~~t,n.FORCE),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!q(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*se._speed);return this._startTime=z()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=p&&!this._hasChildren?Wt(this,p,0,0,n.FORCE):(this._running||(kt(se,this),se._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,se.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){me(this),this.completed=!1;const i=this.paused;return this.paused=!0,Wt(this,t+this._delay,~~e,~~s,n.AUTO),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?ct(m/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?Et(this,t=>t.cancel(),!0):Et(this,de),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=xt(t);if(e===s)return this;const i=t/e,r=t<=p;return this.duration=r?p:s,this.iterationDuration=r?p:xt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){Wt(this,0,1,0,n.AUTO);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(){return this.seek(this.duration).cancel()}then(t=S){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=S};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const ye=t=>new ge(t,null,0).init();function ve(t){const e=Y(t)?B.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function _e(e){if(j(e))return[];if(!t)return X(e)&&e.flat(1/0)||[e];if(X(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!j(i)){const t=ve(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!j(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=ve(e);return s?Array.from(s):[e]}function be(t){const e=_e(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[a]){s[a]=!0;const t=G(s);(s.nodeType||t)&&(s[h]=!0,s[l]=t,s[d]={})}}return e}const Te={deg:1,rad:180/ft,turn:360},Se={},xe=(t,e,i,n=!1)=>{const o=e.u,a=e.n;if(e.t===r.UNIT&&o===i)return e;const h=a+o+i,l=Se[h];if(q(l)||n){let r;if(o in Te)r=a*Te[o]/Te[i];else{const e=100,n=t.cloneNode(),h=t.parentNode,l=h&&h!==s?h:s.body;l.appendChild(n);const d=n.style;d.width=e+o;const c=n.offsetWidth||e;d.width=e+i;const u=c/(n.offsetWidth||e);l.removeChild(n),r=u*a}e.n=r,Se[h]=r}else e.n=l;return e.t,e.u=i,e},we=t=>t,$e=(t=1.68)=>e=>rt(e,+t),Ee={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},Ce=ft/2,ke=2*ft,Ne={[y]:$e,Quad:$e(2),Cubic:$e(3),Quart:$e(4),Quint:$e(5),Sine:t=>1-at(t*Ce),Circ:t=>1-nt(1-t*t),Expo:t=>t?rt(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=rt(2,--s))-1)/11;);return 1/rt(4,3-s)-7.5625*rt((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=yt(+t,1,10),i=yt(+e,p,2),r=i/ke*ut(1/s),n=ke/i;return t=>0===t||1===t?t:-s*rt(2,-10*(1-t))*ot((1-t-r)*n)}},Re=(()=>{const t={linear:we,none:we};for(let e in Ee)for(let s in Ne){const i=Ne[s],r=Ee[e];t[e+s]=s===y||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),Ie={linear:we,none:we},De=t=>{if(Ie[t])return Ie[t];if(t.indexOf("(")<=-1){const e=Ee[t]||t.includes("Back")||t.includes("Elastic")?Re[t]():Re[t];return e?Ie[t]=e:we}{const e=t.slice(0,-1).split("("),s=Re[e[0]];return s?Ie[t]=s(...e[1].split(",")):we}},Ae=["steps(","irregular(","linear(","cubicBezier("],Oe=t=>{if(Y(t))for(let e=0,s=Ae.length;e<s;e++)if(V(t,Ae[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),we;return W(t)?t:Y(t)?De(t):we},Be=zt(),Le=zt(),Pe={},Me={func:null},Fe=[null],Ve=[null,null],ze={to:null};let Xe,He,Ue=0,Ye=0;const We=(t,e)=>{const s={};if(X(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(tt);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];tt(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=Bt(e.duration,L.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(tt(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,h=n[a-1];const l={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(l.from=h.to),r.ease&&(l.ease=r.ease),l.duration=o-(a?d:0),n.push(l)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s};class qe extends ge{constructor(t,e,s,n,a=!1,h=0,l=0){super(e,s,n),++Ye;const d=be(t),c=d.length,u=e.keyframes,m=u?$t(We(u,e),e):e,{id:g,delay:y,duration:v,ease:_,playbackEase:b,modifier:T,composition:S,onRender:x}=m,w=s?s.defaults:L.defaults,$=Bt(_,w.ease),E=Bt(b,w.playbackEase),C=E?Oe(E):null,k=!q($.ease),N=k?$.ease:Bt(_,C?"linear":w.ease),R=k?$.settlingDuration:Bt(v,w.duration),I=Bt(y,w.delay),D=T||w.modifier,A=q(S)&&c>=f?o.none:q(S)?w.composition:S,O=this._offset+(s?s._offset:0);k&&($.parent=this);let B=NaN,P=NaN,M=0,F=0;for(let t=0;t<c;t++){const e=d[t],n=h||t,u=l||c;let f=NaN,g=NaN;for(let t in m)if(tt(t)){const h=Pt(e,t),l=jt(t,e,h);let d=m[t];const c=X(d);if(a&&!c&&(Ve[0]=d,Ve[1]=d,d=Ve),c){const t=d.length,e=!H(d[0]);2===t&&e?(ze.to=d,Fe[0]=ze,Xe=Fe):t>2&&e?(Xe=[],d.forEach((t,e)=>{e?1===e?(Ve[1]=t,Xe.push(Ve)):Xe.push(t):Ve[0]=t})):Xe=d}else Fe[0]=d,Xe=Fe;let y=null,v=null,_=NaN,b=0,T=0;for(let t=Xe.length;T<t;T++){const i=Xe[T];H(i)?He=i:(ze.to=i,He=ze),Me.func=null;const a=Lt(He.to,e,n,u,Me);let d;H(a)&&!q(a.to)?(He=a,d=a.to):d=a;const c=Lt(He.from,e,n,u),m=He.ease,f=!q(m)&&!q(m.ease),g=f?m.ease:m||N,S=f?m.settlingDuration:Lt(Bt(He.duration,t>1?Lt(R,e,n,u)/t:R),e,n,u),x=Lt(Bt(He.delay,T?0:I),e,n,u),w=Lt(Bt(He.composition,A),e,n,u),$=U(w)?w:o[w],E=He.modifier||D,C=!q(c),k=!q(d),B=X(d),L=B||C&&k,P=v?b+x:x,V=_t(O+P,12);F||!C&&!B||(F=1);let z=v;if($!==o.none){y||(y=oe(e,l));let t=y._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(z=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)he(t),t=t._nextRep}if(L){Xt(B?Lt(d[0],e,n,u):c,Be),Xt(B?Lt(d[1],e,n,u,Me):d,Le);const t=Ft(e,l,h,Pe);Be.t===r.NUMBER&&(z?z._valueType===r.UNIT&&(Be.t=r.UNIT,Be.u=z._unit):(Xt(t,Ut),Ut.t===r.UNIT&&(Be.t=r.UNIT,Be.u=Ut.u)))}else k?Xt(d,Le):v?Ht(v,Le):Xt(s&&z&&z.parent.parent===s?z._value:Ft(e,l,h,Pe),Le),C?Xt(c,Be):v?Ht(v,Be):Xt(s&&z&&z.parent.parent===s?z._value:Ft(e,l,h,Pe),Be);if(Be.o&&(Be.n=Vt(z?z._toNumber:Xt(Ft(e,l,h,Pe),Ut).n,Be.n,Be.o)),Le.o&&(Le.n=Vt(Be.n,Le.n,Le.o)),Be.t!==Le.t)if(Be.t===r.COMPLEX||Le.t===r.COMPLEX){const t=Be.t===r.COMPLEX?Be:Le,e=Be.t===r.COMPLEX?Le:Be;e.t=r.COMPLEX,e.s=wt(t.s),e.d=t.d.map(()=>e.n)}else if(Be.t===r.UNIT||Le.t===r.UNIT){const t=Be.t===r.UNIT?Be:Le,e=Be.t===r.UNIT?Le:Be;e.t=r.UNIT,e.u=t.u}else if(Be.t===r.COLOR||Le.t===r.COLOR){const t=Be.t===r.COLOR?Be:Le,e=Be.t===r.COLOR?Le:Be;e.t=r.COLOR,e.s=t.s,e.d=[0,0,0,1]}if(Be.u!==Le.u){let t=Le.u?Be:Le;t=xe(e,t,Le.u?Le.u:Be.u,!1)}if(Le.d&&Be.d&&Le.d.length!==Be.d.length){const t=Be.d.length>Le.d.length?Be:Le,e=t===Be?Le:Be;e.d=t.d.map((t,s)=>q(e.d[s])?0:e.d[s]),e.s=wt(t.s)}const Y=_t(+S||p,12);let W=Pe[l];j(W)||(Pe[l]=null);const G={parent:this,id:Ue++,property:l,target:e,_value:null,_func:Me.func,_ease:Oe(g),_fromNumbers:wt(Be.d),_toNumbers:wt(Le.d),_strings:wt(Le.s),_fromNumber:Be.n,_toNumber:Le.n,_numbers:wt(Be.d),_number:Be.n,_unit:Le.u,_modifier:E,_currentTime:0,_startTime:P,_delay:+x,_updateDuration:Y,_changeDuration:Y,_absoluteStartTime:V,_tweenType:h,_valueType:Le.t,_composition:$,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:W,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};$!==o.none&&le(G,y),isNaN(_)&&(_=G._startTime),b=_t(P+Y,12),v=G,M++,kt(this,G)}(isNaN(P)||_<P)&&(P=_),(isNaN(B)||b>B)&&(B=b),h===i.TRANSFORM&&(f=M-T,g=M)}if(!isNaN(f)){let t=0;Et(this,e=>{t>=f&&t<g&&(e._renderTransforms=1,e._composition===o.blend&&Et(Jt.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}c||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),P?(Et(this,t=>{t._startTime-t._delay||(t._delay-=P),t._startTime-=P}),B-=P):P=0,B||(B=p,this.iterationCount=0),this.targets=d,this.id=q(g)?Ye:g,this.duration=B===p?p:St((B+this._loopDelay)*this.iterationCount-this._loopDelay)||p,this.onRender=x||w.onRender,this._ease=C,this._delay=P,this.iterationDuration=B,!this._autoplay&&F&&this.onRender(this)}stretch(t){const e=this.duration;if(e===xt(t))return this;const s=t/e;return Et(this,t=>{t._updateDuration=xt(t._updateDuration*s),t._changeDuration=xt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return Et(this,t=>{const e=t._func;if(e){const s=Ft(t.target,t.property,t._tweenType);Xt(s,Ut),Xt(e(),Le),t._fromNumbers=wt(Ut.d),t._fromNumber=Ut.n,t._toNumbers=wt(Le.d),t._strings=wt(Le.s),t._toNumber=Le.o?Vt(Ut.n,Le.n,Le.o):Le.n}}),this.duration===p&&this.restart(),this}revert(){return super.revert(),Gt(this)}then(t){return super.then(t)}}const je=(t,e)=>new qe(t,e,null,0,!1).init(),Ge={_head:null,_tail:null},Qe=(t,e,s)=>{let i,r=Ge._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,h=!s||r.parent===s;if(o&&a&&h){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),Ct(Ge,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Je=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Qe(e,s),kt(Ge,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{Qe(e,s,t)};return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function Ze(t,e,s){const i=be(t);if(!i.length)return;const[n]=i,o=Pt(n,e),a=jt(e,n,o);let h=Ft(n,a);if(q(s))return h;if(Xt(h,Ut),Ut.t===r.NUMBER||Ut.t===r.UNIT){if(!1===s)return Ut.n;{const t=xe(n,Ut,s,!1);return`${_t(t.n,L.precision)}${t.u}`}}}const Ke=(t,e)=>{if(!q(e))return e.duration=p,e.composition=Bt(e.composition,o.none),new qe(t,e,null,0,!0).resume()},ts=(t,e,s)=>{const i=_e(t);for(let t=0,r=i.length;t<r;t++)Qe(i[t],s,e&&e.controlAnimation&&e);return ue(i,e,s),i},es=(t,e)=>{if(V(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}},ss=(t,e)=>{let s=t.iterationDuration;if(s===p&&(s=0),q(e))return s;if(U(+e))return+e;const i=e,r=t?t.labels:null,n=!j(r),o=es(t,i),a=!q(o),h=D.exec(i);if(h){const t=h[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,d=a?o:n?l:s,c=+e[1];return Vt(d,c,t[0])}return a?o:n?q(r[i])?s:r[i]:s};function is(t){return St((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||p}function rs(t,e,s,i,r,o){const a=U(t.duration)&&t.duration<=p?s-p:s;e.composition&&Wt(e,a,1,1,n.AUTO);const h=i?new qe(i,t,e,a,!1,r,o):new ge(t,e,a);return e.composition&&h.init(!0),kt(e,h),Et(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=is(e),e}let ns=0;class os extends ge{constructor(t={}){super(t,null,0),++ns,this.id=q(t.id)?ns:t.id,this.duration=0,this.labels={};const e=t.defaults,s=L.defaults;this.defaults=e?$t(e,s):s,this.composition=Bt(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=Bt(t.playbackEase,s.playbackEase);this._ease=i?Oe(i):null,this.iterationDuration=0}add(t,e,s){const i=H(e),r=H(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(W(s)){const e=s,r=_e(t),n=this.duration,o=this.iterationDuration,a=i.id;let h=0;const l=r.length;r.forEach(t=>{const s={...i};this.duration=n,this.iterationDuration=o,q(a)||(s.id=a+"-"+h),rs(s,this,ss(this,e(t,h,l,this)),t,h,l),h++})}else rs(i,this,ss(this,s),t)}else rs(t,this,ss(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(q(t)||t&&q(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return q(e)?this:(e.duration=p,e.composition=o.replace,this.add(t,e,s))}call(t,e){return q(t)||t&&!W(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return q(t)||t&&!Y(t)||(this.labels[t]=ss(this,e)),this}remove(t,e){return ue(_e(t),this,e),this}stretch(t){const e=this.duration;if(e===xt(t))return this;const s=t/e,i=this.labels;Et(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return Et(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),Et(this,t=>t.revert,!0),Gt(this)}then(t){return super.then(t)}}const as=t=>new os(t).init();class hs{constructor(t,e){B.current&&B.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},r={v:1,autoplay:!1},n={};if(this.targets=[],this.animations={},this.callbacks=null,!q(t)&&!q(e)){for(let t in e){const s=e[t];tt(t)?n[t]=s:V(t,"on")?r[t]=s:i[t]=s}this.callbacks=new qe({v:0},r);for(let e in n){const s=n[e],r=H(s);let a={},h="+=0";if(r){const t=s.unit;Y(t)&&(h+=t)}else a.duration=s;a[e]=r?$t({to:h},s):h;const l=$t(i,a);l.composition=o.replace,l.autoplay=!1;const d=this.animations[e]=new qe(t,l,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(q(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return Et(d,e=>{if(X(t))for(let s=0,i=t.length;s<i;s++)q(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;q(s)||(e._ease=Oe(s)),e._currentTime=0}),q(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=S,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const ls=(t,e)=>new hs(t,e),ds=(t,e)=>(+t).toFixed(e),cs=(t,e,s)=>`${t}`.padStart(e,s),us=(t,e,s)=>`${t}`.padEnd(e,s),ps=(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e,ms=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),fs=t=>t*Math.PI/180,gs=t=>180*t/Math.PI,ys=(t,e,s,i)=>i?1===i?e:Tt(t,e,1-Math.exp(-i*s*.1)):t;var vs=Object.freeze({__proto__:null,clamp:yt,damp:ys,degToRad:fs,lerp:Tt,mapRange:ms,padEnd:us,padStart:cs,radToDeg:gs,round:_t,roundPad:ds,snap:bt,wrap:ps});const _s=10*f;class bs{constructor(t={}){const e=!q(t.bounce)||!q(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/f,this.maxIterations=this.maxDuration/this.timeStep/f,this.bn=yt(Bt(t.bounce,.5),-1,1),this.pd=yt(Bt(t.duration,628),10*L.timeScale,_s*L.timeScale),this.m=yt(Bt(t.mass,1),1,_s),this.s=yt(Bt(t.stiffness,100),p,_s),this.d=yt(Bt(t.damping,10),p,_s),this.v=yt(Bt(t.velocity,0),-1e4,_s),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||S,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?lt(-n*e*s)*(1*at(i*n)+r*ot(i*n)):1===e?(1+r*n)*lt(-n*s):((1+r)*lt((-e*s+i)*n)+(1-r)*lt((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===L.timeScale?this.pd/f:this.pd;this.m=1,this.v=0,this.s=rt(2*ft/t,2),this.bn>=0?this.d=4*(1-this.bn)*ft/t:this.d=4*ft/(t*(1+this.bn)),this.s=_t(yt(this.s,p,_s),3),this.d=_t(yt(this.d,p,300),3)}calculateBDFromSD(){const t=2*ft/nt(this.s);this.pd=t*(1===L.timeScale?f:1);const e=this.d/(2*nt(this.s));this.bn=e<=1?1-this.d*t/(4*ft):4*ft/(this.d*t)-1,this.bn=_t(yt(this.bn,-1,1),3),this.pd=_t(yt(this.pd,10*L.timeScale,_s*L.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,h=this.w0=yt(nt(o/r),p,f),l=this.zeta=n/(2*nt(o*r));l<1?(this.wd=h*nt(1-l*l),this.b=(l*h-a)/this.wd):1===l?(this.wd=0,this.b=-a+h):(this.wd=h*nt(l*l-1),this.b=(l*h-a)/this.wd);let d=0,c=0,u=0;for(;c<=t&&u<=e;)ht(1-this.solve(d))<s?c++:c=0,this.solverDuration=d,d+=i,u++;this.settlingDuration=_t(this.solverDuration*f,0)*L.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=yt(Bt(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=yt(Bt(t,1),10*L.timeScale,_s*L.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=yt(Bt(t,100),p,_s),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=yt(Bt(t,10),p,_s),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=yt(Bt(t,1),1,_s),this.compute()}get velocity(){return this.v}set velocity(t){this.v=yt(Bt(t,0),-1e4,_s),this.compute()}}const Ts=t=>new bs(t),Ss=t=>(console.warn("createSpring() is deprecated use spring() instead"),new bs(t)),xs=t=>{t.cancelable&&t.preventDefault()};class ws{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:S,remove:S}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class $s{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,i=0;for(;e&&e!==s;)t(e,i),e=e.parentElement,i++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const Es=(t,e)=>t&&W(t)?t(e):t;let Cs=0;class ks{constructor(t,i={}){if(!t)return;B.current&&B.current.register(this);const r=i.x,n=i.y,o=i.trigger,a=i.modifier,h=i.releaseEase,l=h&&Oe(h),d=!q(h)&&!q(h.ease),c=H(r)&&!q(r.mapTo)?r.mapTo:"translateX",u=H(n)&&!q(n.mapTo)?n.mapTo:"translateY",p=Es(i.container,this);this.containerArray=X(p)?p:null,this.$container=p&&!this.containerArray?_e(p)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=H(t)?new ws(t):_e(t)[0],this.$trigger=_e(o||t)[0],this.fixed="fixed"===Ze(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?h:Ts({mass:Bt(i.releaseMass,1),stiffness:Bt(i.releaseStiffness,80),damping:Bt(i.releaseDamping,20)}),this.releaseYSpring=d?h:Ts({mass:Bt(i.releaseMass,1),stiffness:Bt(i.releaseStiffness,80),damping:Bt(i.releaseDamping,20)}),this.releaseEase=l||Re.outQuint,this.hasReleaseSpring=d,this.onGrab=i.onGrab||S,this.onDrag=i.onDrag||S,this.onRelease=i.onRelease||S,this.onUpdate=i.onUpdate||S,this.onSettle=i.onSettle||S,this.onSnap=i.onSnap||S,this.onResize=i.onResize||S,this.onAfterResize=i.onAfterResize||S,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),q(r)||!0===r)f[c]=0;else if(H(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[c]=e}else!1===r&&(f[c]=0,this.disabled[0]=1);if(q(n)||!0===n)f[u]=0;else if(H(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===n&&(f[u]=0,this.disabled[1]=1);this.animate=new hs(this.$target,f),this.xProp=c,this.yProp=u,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-m,m,m,-m],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=z(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new $s(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new ge({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new ge({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!q(p),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?c:u,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=mt(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new ge({autoplay:!1,duration:150*L.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=i,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),H(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=z(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,h=this.maxVelocity,l=this.velocityStackIndex;n[l]=_t(yt(nt(t*t+e*e)/r*o,a,h),5);const d=pt(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(l+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=_t(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=bt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=_t(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=bt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return _t(this.animate[this.xProp](),L.precision)}set x(t){this.setX(t,!1)}get y(){return _t(this.animate[this.yProp](),L.precision)}set y(t){this.setY(t,!1)}get progressX(){return ms(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(ms(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return ms(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(ms(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=_t(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=_t(this.useWin?e.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=s,this.scrollBounds[0]=s-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=s-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const i=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=e.innerWidth,h=this.window[1]=e.innerHeight,l=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?yt(d,a,d):d,this.scrollView[1]=l?yt(c,h,c):c,this.updateScrollCoords();const{width:v,height:_,left:b,top:T,right:S,bottom:x}=t.getBoundingClientRect();this.dragArea[2]=_t(l?yt(v,a,a):v,0),this.dragArea[3]=_t(l?yt(_,h,h):_,0);const w=Ze(t,"overflow"),$="visible"===w,E="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===s.body&&$||!E&&!$)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!X(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?l?0:t.scrollLeft:0,o=i?l?0:t.scrollTop:0,d=i?this.scrollView[0]-n-v:0,c=i?this.scrollView[1]-o-_:0;this.targetBounds[0]=_t(r.top+s-(l?0:T),0),this.targetBounds[1]=_t(r.right+e-(l?a:S),0),this.targetBounds[2]=_t(r.bottom+s-(l?h:x),0),this.targetBounds[3]=_t(r.left+e-(l?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-_t(r.top-(u?yt(T,0,h):T)+o-m,0),this.containerBounds[1]=-_t(r.right-(u?yt(S,0,a):S)-d+f,0),this.containerBounds[2]=-_t(r.bottom-(u?yt(x,0,h):x)-c+g,0),this.containerBounds[3]=-_t(r.left-(u?yt(b,0,a):b)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(i,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,h]=this.disabled,l=!a&&e<o||!a&&e>r,d=!h&&s<i||!h&&s>n;return l&&!d?1:!l&&d?2:l&&d?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=Es(t.container,this),o=Es(t.containerPadding,this)||0,a=X(o)?o:[o,o,o,o],h=this.x,l=this.y,d=Es(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=Es(t.dragThreshold,this),p={mouse:3,touch:7};if(U(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;q(t)||(p.mouse=t),q(e)||(p.touch=e)}this.containerArray=X(n)?n:null,this.$container=n&&!this.containerArray?_e(n)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=Bt(a,[0,0,0,0]),this.containerFriction=yt(Bt(Es(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=yt(Bt(Es(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=Es(H(i)&&!q(i.snap)?i.snap:t.snap,this),this.snapY=Es(H(r)&&!q(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Bt(Es(t.scrollSpeed,this),1.5),this.scrollThreshold=Bt(Es(t.scrollThreshold,this),20),this.dragSpeed=Bt(Es(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=Bt(Es(t.minVelocity,this),0),this.maxVelocity=Bt(Es(t.maxVelocity,this),50),this.velocityMultiplier=Bt(Es(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(yt(h,y,f),!0),this.setY(yt(l,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],h=this.scroll.x,l=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?yt(d,this.window[0],d):d,p=this.useWin?yt(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[v,_]=this.coords,[b,T,S,x]=this.scrollBounds,w=_t(yt((_-b+t)/y,-1,0)*g,0),$=_t(yt((v-T-e)/y,0,1)*g,0),E=_t(yt((_-S-s)/y,0,1)*g,0),C=_t(yt((v-x+i)/y,-1,0)*g,0);if(w||E||C||$){const[t,e]=this.disabled;let s=h,i=l;t||(s=_t(yt(h+(C||$),0,r-o),0),this.coords[0]-=h-s),e||(i=_t(yt(l+(w||E),0,n-a),0),this.coords[1]-=l-i),this.useWin?this.$scrollContainer.scrollBy(-(h-s),-(l-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,h,l]=this.pointer;this.coords[0]+=(r-h)*this.dragSpeed,this.coords[1]+=(n-l)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-h,n-l),this.angle=mt(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return ue([this],null,"x"),ue([this],null,"y"),ue([this],null,"progressX"),ue([this],null,"progressY"),ue([this.scroll]),ue([this.overshootCoords]),this}scrollInView(t,e=0,s=Re.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[h,l,d,c]=o,u=_t(yt(r-h,-m,0),0),p=_t(yt(i-l,0,m),0),f=_t(yt(r-d,0,m),0),g=_t(yt(i-c,-m,0),0);new qe(n,{x:_t(n.x+(g?g-e:p?p+e:0),0),y:_t(n.y+(u?u-e:f?f+e:0),0),duration:q(t)?350*L.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=Ke(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=Re.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,h]=this.containerPadding,l=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+h+e,p=this.isOutOfBounds([l,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=yt(bt(i,this.snapX),u,d),a=yt(bt(r,this.snapY),l,c),h=q(t)?350*L.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,h,s),n||2!==p&&3!==p||this.animate[this.yProp](a,h,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const i=t.changedTouches,r=i?i[0].clientX:t.clientX,n=i?i[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[h,l,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>l?l+(p-l)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<h?h+(m-h)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=Ze(this.$target,"zIndex",!1);Cs=(f>Cs?f:Cs)+1,this.targetStyles=Ke(this.$target,{zIndex:Cs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Ke(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,Re.out(3)),this.onGrab(this),s.addEventListener("touchmove",this),s.addEventListener("touchend",this),s.addEventListener("touchcancel",this),s.addEventListener("mousemove",this),s.addEventListener("mouseup",this),s.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let h=t.target,l=!1,d=!1,c=!1;for(;e&&h&&h!==this.$trigger;){const t=Ze(h,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=h;if(e>s){c=!0,l=t<=3,d=t>=e-s-3;break}}h=h.parentElement}c&&(!l&&!d||l&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(xs(t),this.triggerStyles||(this.triggerStyles=Ke(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",xs,{passive:!1}),this.$trigger.addEventListener("touchmove",xs,{passive:!1}),this.$trigger.addEventListener("touchend",xs),(this.dragged||!this.disabled[0]&&ht(o)>this.dragThreshold||!this.disabled[1]&&ht(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[i,r,n,a,h,l]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,v=this.releaseEase,_=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,S=this.y,x=this.computeVelocity(i-h,r-l),w=this.angle=mt(r-a,i-n),$=150*x,E=(1-this.releaseContainerFriction)*this.dragSpeed,C=T+at(w)*$,k=S+ot(w)*$,N=C>c?c+(C-c)*E:C<p?p+(C-p)*E:C,R=k>u?u+(k-u)*E:k<d?d+(k-d)*E:k,I=this.destX=yt(_t(bt(N,this.snapX),5),p,c),D=this.destY=yt(_t(bt(R,this.snapY),5),d,u),A=this.isOutOfBounds(this.containerBounds,C,k);let O=0,B=0,P=v,M=v,F=0;if(b.x=T,b.y=S,!t){const t=I===c?T>c?-1:1:T<p?-1:1,s=_t(T-I,0);g.velocity=e&&_?s?$*t/ht(s):0:x;const{ease:i,settlingDuration:r,restDuration:n}=g;O=T===I?0:_?r:r-n*L.timeScale,_&&(P=i),O>F&&(F=O)}if(!e){const e=D===u?S>u?-1:1:S<d?-1:1,s=_t(S-D,0);y.velocity=t&&_?s?$*e/ht(s):0:x;const{ease:i,settlingDuration:r,restDuration:n}=y;B=S===D?0:_?r:r-n*L.timeScale,_&&(M=i),B>F&&(F=B)}if(!_&&A&&E&&(O||B)){const t=o.blend;new qe(b,{x:{to:N,duration:.65*O},y:{to:R,duration:.65*B},ease:v,composition:t}).init(),new qe(b,{x:{to:I,duration:O},y:{to:D,duration:B},ease:v,composition:t}).init(),this.overshootTicker.stretch(pt(O,B)).restart()}else t||this.animate[this.xProp](I,O,P),e||this.animate[this.yProp](D,B,M);this.scrollInView(F,this.scrollThreshold,v);let V=!1;I!==m&&(this.snapped[0]=I,this.snapX&&(V=!0)),D!==f&&this.snapY&&(this.snapped[1]=D,this.snapY&&(V=!0)),V&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",xs),this.$trigger.removeEventListener("touchmove",xs),this.$trigger.removeEventListener("touchend",xs),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=Ke(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":xs(t)}}}const Ns=(t,e)=>new ks(t,e),Rs=(t=S)=>new ge({duration:1*L.timeScale,onComplete:t},null,0).resume(),Is=t=>{let e;return(...s)=>{let i,r,n,o;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,e.revert());const a=t(...s);return a&&!W(a)&&a.revert&&(e=a),q(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),a||S}};class Ds{constructor(t={}){B.current&&B.current.register(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||_e(i)[0]||s);const n=t.defaults,o=L.defaults,a=t.mediaQueries;if(this.defaults=n?$t(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const s=e.matchMedia(a[t]);this.mediaQueryLists[t]=s,s.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=B.current,s=B.root,i=L.defaults;B.current=this,B.root=this.root,L.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return B.current=e,B.root=s,L.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);W(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,W(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);W(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,W(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);W(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(W(s))return s(this);const i=Is(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,h=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;h--;)i[h](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const As=t=>new Ds(t),Os=()=>{const t=s.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.body.removeChild(t),e},Bs=(t,e)=>t&&W(t)?t(e):t,Ls=new Map;class Ps{constructor(t){this.element=t,this.useWin=this.element===s.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new ge({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;Et(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ge({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=_t(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ge({autoplay:!1,duration:250*L.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ge({autoplay:!1,duration:500*L.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?e:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,s=this.element;this.scrollX=_t(t?e.scrollX:s.scrollLeft,0),this.scrollY=_t(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=Os()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){Et(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),Et(this,t=>{t.refresh(),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?e:this.element).removeEventListener("scroll",this),Ls.delete(this.element)}}const Ms=t=>{const e=t&&_e(t)[0]||s.body;let i=Ls.get(e);return i||(i=new Ps(e),Ls.set(e,i)),i},Fs=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:h,u:l}=Xt(a,Ut);let d=h;return"%"===l?d=h/100*s:l&&(d=xe(t,Ut,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},Vs=(t,e,s,i,r)=>{let n;if(Y(e)){const o=D.exec(e);if(o){const a=o[0],h=a[0],l=e.split(a),d="min"===l[0],c="max"===l[0],u=Fs(t,l[0],s,i,r),p=Fs(t,l[1],s,i,r);if(d){const e=Vt(Fs(t,"min",s),p,h);n=e<u?u:e}else if(c){const e=Vt(Fs(t,"max",s),p,h);n=e>u?u:e}else n=Vt(u,p,h)}else n=Fs(t,e,s,i,r)}else n=e;return _t(n,0)},zs=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[h]){e=i;break}}return e};let Xs=0;const Hs=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Us{constructor(t={}){B.current&&B.current.register(this);const e=Bt(t.sync,"play pause"),i=e?Oe(e):null,r=e&&("linear"===e||e===we),n=e&&!(i===we&&!r),o=e&&(U(e)||!0===e||r),a=e&&Y(e)&&!n&&!o,h=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,l=a&&h.length>2;this.index=Xs++,this.id=q(t.id)?this.index:t.id,this.container=Ms(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!h,this.syncEase=n?i:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=h&&!l&&h[0]?h[0]:S,this.onSyncLeave=h&&!l&&h[1]?h[1]:S,this.onSyncEnterForward=h&&l&&h[0]?h[0]:S,this.onSyncLeaveForward=h&&l&&h[1]?h[1]:S,this.onSyncEnterBackward=h&&l&&h[2]?h[2]:S,this.onSyncLeaveBackward=h&&l&&h[3]?h[3]:S,this.onEnter=t.onEnter||S,this.onLeave=t.onLeave||S,this.onEnterForward=t.onEnterForward||S,this.onLeaveForward=t.onLeaveForward||S,this.onEnterBackward=t.onEnterBackward||S,this.onLeaveBackward=t.onLeaveBackward||S,this.onUpdate=t.onUpdate||S,this.onSyncComplete=t.onSyncComplete||S,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=Bt(t.debug,!1),this._next=null,this._prev=null,kt(this.container,this),Rs(()=>{if(!this.reverted){if(!this.target){const e=_e(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,q(t)||(t.persist=!0),!this._params.target)){let e;q(t.targets)?Et(t,t=>{t.targets&&!e&&(e=zs(t))}):e=zs(t),this.target=e||s.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:_t(yt(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=Bt(Bs(t.repeat,this),!0),this.horizontal="x"===Bt(Bs(t.axis,this),"y"),this.enter=Bt(Bs(t.enter,this),"end start"),this.leave=Bt(Bs(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,i=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=s.createElement("div"),n=s.createElement("div"),o=s.createElement("div"),a=Hs[this.index%Hs.length],h=t.useWin,l=h?t.winWidth:t.width,d=h?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,v=e?60:g,_=e?v:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",S=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,x=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${x("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${x("sticky",0,0,e?l:g,e?g:d)}`,i||(n.style.cssText+=`background:\n ${S("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${S("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${x("relative",0,0,e?c:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${S("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${S("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const w=[" enter: "," leave: "];this.coords.forEach((t,i)=>{const r=i>1,h=(r?0:this.offset)+t,m=i%2,f=h<_,g=h>(r?e?l:d:e?c:u)-_,b=(r?m&&!f:!m&&!f)||g,T=s.createElement("div"),S=s.createElement("div"),$=e?b?"right":"left":b?"bottom":"top",E=b?(e?v:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;S.innerHTML=`${this.id}${w[m]}${this.thresholds[i]}`,T.style.cssText=`${x("absolute",0,0,v,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${b?"end":"start"};\n border-${$}: 2px solid ${a};\n `,S.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?b?"right":"left":b?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&b||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?b?"top-left":"top-right":b?"top-left":"bottom-left"}-radius: 5px;\n border-${e?b?"bottom-left":"bottom-right":b?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(S);let C=h-E+(e?1:0);T.style[e?"left":"top"]=`${C}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),i||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Ze(t.element,"position")&&(this.debugStyles=Ke(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,i=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0)),a.parentElement;a&&a!==i.element&&a!==s.body;){const e="sticky"===Ze(a,"position")&&Ke(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const h=e.getBoundingClientRect(),l=i.scale,d=(r?h.left+i.scrollX-i.left:h.top+i.scrollY-i.top)*l,c=(r?h.width:h.height)*l,u=r?i.width:i.height,p=(r?i.scrollWidth:i.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",v="end",_="start";if(Y(m)){const t=m.split(" ");v=t[0],g=t.length>1?t[1]:g}else if(H(m)){const t=m;q(t.container)||(v=t.container),q(t.target)||(g=t.target)}else U(m)&&(v=m);if(Y(f)){const t=f.split(" ");_=t[0],y=t.length>1?t[1]:y}else if(H(f)){const t=f;q(t.container)||(_=t.container),q(t.target)||(y=t.target)}else U(f)&&(_=f);const b=Vs(e,g,c),T=Vs(e,y,c),S=b+d-u,x=T+d-p,w=Vs(e,v,u,S,x),$=Vs(e,_,u,S,x),E=b+d-w,C=T+d-$,k=C-E;this.offset=d,this.offsetStart=E,this.offsetEnd=C,this.distance=k<=0?0:k,this.thresholds=[g,y,v,_],this.coords=[b,T,w,$],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,h=a<=this.offsetStart,l=a>=this.offsetEnd,d=!h&&!l,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(h&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&U(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=_t(Tt(e,g,Tt(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return Ct(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const Ys=(t={})=>new Us(t),Ws=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,qs=(t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=Ws(r,e,s)-t,i>0?o=r:n=r}while(ht(i)>1e-7&&++a<100);return r},js=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?we:r=>0===r||1===r?r:Ws(qs(r,t,s),e,i),Gs=(t=10,e)=>{const s=e?dt:ct;return e=>s(yt(e,0,1)*t)*(1/t)},Qs=(...t)=>{const e=t.length;if(!e)return we;const s=e-1,i=t[0],r=t[s],n=[0],o=[it(i)];for(let e=1;e<s;e++){const i=t[e],r=Y(i)?i.trim().split(" "):[i],a=r[0],h=r[1];n.push(q(h)?e/s:it(h)/100),o.push(it(a))}return o.push(it(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},Js=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(yt(o,r,1))}return s.push(1),Qs(...s)};var Zs=Object.freeze({__proto__:null,Spring:bs,createSpring:Ss,cubicBezier:js,eases:Re,irregular:Js,linear:Qs,spring:Ts,steps:Gs});const Ks=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(_t(t(i/e),4));return`linear(${s.join(", ")})`},ti={},ei=t=>{let e=ti[t];if(e)return e;if(e="linear",Y(t)){if(V(t,"linear")||V(t,"cubic-")||V(t,"steps")||V(t,"ease"))e=t;else if(V(t,"cubicB"))e=F(t);else{const s=De(t);W(s)&&(e=s===we?"linear":Ks(s))}ti[t]=e}else if(W(t)){const s=Ks(t);s&&(e=s)}else t.ease&&(e=Ks(t.ease));return e},si=["x","y","z"],ii=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...si],ri=(()=>[...si,...b.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let ni=null;const oi=(t,e,s,i,r)=>{let n=Y(e)?e:Lt(e,s,i,r);return U(n)?ii.includes(t)||V(t,"translate")?`${n}px`:V(t,"rotate")||V(t,"skew")?`${n}deg`:`${n}`:n},ai=(t,e,s,i,r,n)=>{let o="0";const a=q(i)?getComputedStyle(t)[e]:oi(e,i,t,r,n);return o=q(s)?X(i)?i.map(s=>oi(e,s,t,r,n)):a:[oi(e,s,t,r,n),a],o};class hi{constructor(e,s){B.current&&B.current.register(this),j(ni)&&(!t||!q(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(b.forEach(t=>{const e=V(t,"skew"),s=V(t,"scale"),i=V(t,"rotate"),r=V(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),ni=!0):ni=!1);const i=be(e),r=i.length;r||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const n=Bt(s.ease,ei(L.defaults.ease)),o=n.ease&&n,a=Bt(s.autoplay,L.defaults.autoplay),h=!(!a||!a.link)&&a,l=s.alternate&&!0===s.alternate,c=s.reversed&&!0===s.reversed,u=Bt(s.loop,L.defaults.loop),p=!0===u||u===1/0?1/0:U(u)?u+1:1,m=l?c?"alternate-reverse":"alternate":c?"reverse":"normal",g=ei(n),v=1===L.timeScale?1:f;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||L.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!a||!1!==h,this.reversed=c,this.persist=Bt(s.persist,L.defaults.persist),this.autoplay=a,this._speed=Bt(s.playbackRate,L.defaults.playbackRate),this._resolve=S,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const i=t[d],a=ri.some(t=>s.hasOwnProperty(t)),h=t.style,l=this._inlineStyles[e]={},c=(o?o.settlingDuration:Lt(Bt(s.duration,L.defaults.duration),t,e,r))*v,u=Lt(Bt(s.delay,L.defaults.delay),t,e,r)*v,f=Bt(s.composition,"replace");for(let o in s){if(!tt(o))continue;const d={},y={iterations:p,direction:m,fill:"both",easing:g,duration:c,delay:u,composite:f},T=s[o],S=!!a&&(b.includes(o)?o:_.get(o)),x=S?"transform":o;let w;if(l[x]||(l[x]=h[x]),H(T)){const s=T,a=Bt(s.ease,n),l=a.ease&&a,p=s.to,m=s.from;if(y.duration=(l?l.settlingDuration:Lt(Bt(s.duration,c),t,e,r))*v,y.delay=Lt(Bt(s.delay,u),t,e,r)*v,y.composite=Bt(s.composition,f),y.easing=ei(a),w=ai(t,o,m,p,e,r),S?(d[`--${S}`]=w,i[S]=w):d[o]=ai(t,o,m,p,e,r),Je(this,t,o,d,y),!q(m))if(S){const t=`--${S}`;h.setProperty(t,d[t][0])}else h[o]=d[o][0]}else w=X(T)?T.map(s=>oi(o,s,t,e,r)):oi(o,T,t,e,r),S?(d[`--${S}`]=w,i[S]=w):d[o]=w,Je(this,t,o,d,y)}if(a){let t=y;for(let e in i)t+=`${T[e]}var(--${e})) `;h.transform=t}}),h&&this.autoplay.link(this)}forEach(t){try{const e=Y(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=L.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===L.timeScale?1:f);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];q(r)||r===y?s.removeProperty(F(e)):t.style[e]=r}t.getAttribute("style")===y&&t.removeAttribute("style")}),this}then(t=S){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=S};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const li={animate:(t,e)=>new hi(t,e),convertEase:Ks};let di=0,ci=0;const ui=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),pi=(t,e)=>{let s=t[e];for(;s&&s.nodeType===Node.TEXT_NODE&&!s.textContent.trim();)s=s[e];return s&&s.nodeType===Node.TEXT_NODE},mi=t=>pi(t,"previousSibling")||pi(t,"nextSibling"),fi=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},gi=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},yi=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,fi(s)),i&&!e.has(i)&&e.set(i,fi(i))},vi=t=>{t.forEach((t,e)=>gi(e,t)),t.clear()},_i={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},bi=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},Ti=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+ci++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.total=1,n.delay=0,n.duration=0,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.hasTransform=!1,n.isAnimated=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.isInlined=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},Si=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,h=t.state.rootNode,l=t.parentNode,d=s.transform,c=r.style.transform,u=!!l&&l.measuredIsRemoved,p=s.position;if(o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=ui(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u,t.isInlined=t.measuredDisplay.includes("inline")&&mi(r),t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=fi(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=fi(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let m,f,g=0,y=0,v=0,_=0;if(!i){const t=e.getBoundingClientRect();g=t.left,y=t.top,v=t.width,_=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);q(e)||(a[t]=e)}if(a.left=g,a.top=y,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(m=g,f=y):(m=0,f=0);else{const e=l||h,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)m=g-s-r,f=y-i-n;else if(e===h){const t=h.properties.left,e=h.properties.top;m=g-t-h.properties.clientLeft,f=y-e-h.properties.clientTop}else m=g-s-r,f=y-i-n}return a.x=m,a.y=f,a.width=v,a.height=_,t},xi=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},wi=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},$i=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},Ei=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(gi(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(gi(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},Ci=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.measuredIsRemoved&&t.layout.pendingRemoved.delete(t.$el)},ki=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class Ni{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}get(t){const e=this.nodes.get(t.dataset.layoutId);if(e)return e.properties;console.warn("No node found on state")}getValue(t,e){if(!t||!t.dataset)return void console.warn(`No element found on state (${t})`);const s=this.nodes.get(t.dataset.layoutId);if(!s)return void console.warn("No node found on state");const i=s.properties[e];return q(i)?void 0:Lt(i,t,s.index,s.total)}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,fi(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||G(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?_i:getComputedStyle(e),a=!!n||"none"===o.display,h=!!n||"hidden"===o.visibility,l=!a&&!h,d=e.dataset.layoutId,c=ui(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=ui(i,u.$el),h=u.measuredIsVisible;if(a||!c&&(c||h||!l)){if(a&&!h&&l){Si(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}bi(u),u=Ti(e,t,this,u)}else u=Ti(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.isAnimated=!1,u.hasVisibilityHidden=h,u.hasDisplayNone=a,u.hasVisibilitySwap=h&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),Si(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const{children:t,root:e}=this.layout,s=X(t)?t:[t],i=[],r="*"===t?e:B.root;for(let t=0,e=s.length;t<e;t++){const e=s[t];i[t]=Y(e)?r.querySelectorAll(e):e}const n=be(i);this.nodes.clear(),this.rootNodes.clear();const o=this.registerElement(e,null);o.isTarget=!0,this.rootNode=o;const a=new Set;this.nodes.forEach((t,e)=>{t&&t.measuredIsInsideRoot&&a.add(e)});const h=new Set,l=[];for(let t=0,s=n.length;t<s;t++){const s=n[t];if(s&&1===s.nodeType&&s!==e){if(!ui(e,s)){const t=s.dataset.layoutId;if(!t||!a.has(t))continue}h.has(s)||(h.add(s),l.push(s))}}for(let t=0,e=l.length;t<e;t++)this.ensureDetachedNode(l[t],h);for(let t=0,e=n.length;t<e;t++){const e=n[t],s=this.nodes.get(e.dataset.layoutId);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY;const d=this.nodes.size;return this.forEachNode(Ei),this.forEachNode((t,e)=>{t.index=e,t.total=d}),this}}class Ri{constructor(t,e={}){B.current&&B.current.register(this);const s=e.frozen,i=e.added,r=e.removed,n=e.properties;if(this.params=e,this.root=be(t)[0],this.id=di++,this.children=e.children||"*",this.absoluteCoords=!1,this.duration=Bt(e.duration,500),this.delay=Bt(e.delay,0),this.ease=Bt(e.ease,"inOut(3.5)"),this.onComplete=Bt(e.onComplete,S),this.frozenParams=s||{opacity:0},this.addedParams=i||{opacity:0},this.removedParams=r||{opacity:0},this.properties=new Set(["opacity","borderRadius"]),s)for(let t in s)this.properties.add(t);if(i)for(let t in i)this.properties.add(t);if(r)for(let t in r)this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoved=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new Ni(this),this.newState=new Ni(this),this.timeline=null,this.transformAnimation=null,this.frozen=[],this.removed=[],this.added=[],this.oldState.record(),vi(this.transitionMuteStore)}revert(){return this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.root.classList.remove("is-animated"),this.frozen.length=this.removed.length=this.added.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>vi(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode($i),this}animate(t={}){const e=Bt(t.delay,this.delay),s=Bt(t.duration,this.duration),i=Bt(t.onComplete,this.onComplete),r=t.frozen?$t(t.frozen,this.frozenParams):this.frozenParams,n=t.added?$t(t.added,this.addedParams):this.addedParams,o=t.removed?$t(t.removed,this.removedParams):this.removedParams,a=this.oldState,h=this.newState,l=this.added,d=this.removed,c=this.frozen,u=this.pendingRemoved;l.length=d.length=c.length=0,a.forEachRootNode(yi),h.record(),h.forEachRootNode(wi);const p=[],m=[],f=[],g=[],y=h.rootNode.$el;h.forEachRootNode(t=>{const i=t.$el,r=t.id,y=t.parentNode,v=!!y&&y.branchAdded,_=!!y&&y.branchRemoved,b=!!y&&y.branchNotRendered;t.delay=+(W(e)?e(i,t.index,t.total):e),t.duration=+(W(s)?s(i,t.index,t.total):s);let T=a.nodes.get(r);const S=!T;S?(T=ki(t,{},a),a.nodes.set(r,T),T.measuredIsRemoved=!0):T.measuredIsRemoved&&!t.measuredIsRemoved&&(ki(t,T,a),T.measuredIsRemoved=!0);const x=T.parentNode,w=(x?x.id:null)!==(y?y.id:null),$=T.$el!==t.$el,E=T.measuredIsRemoved,C=t.measuredIsRemoved;if(!T.measuredIsRemoved&&!C&&!S&&(w||$)){const t=T.properties.left,e=T.properties.top,s=y||h.rootNode,i=s.id?a.nodes.get(s.id):null,r=i?i.properties.left:s.properties.left,n=i?i.properties.top:s.properties.top,o=i?i.properties.clientLeft:s.properties.clientLeft,l=i?i.properties.clientTop:s.properties.clientTop;T.properties.x=t-r-o,T.properties.y=e-n-l}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=T.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const k=u.has(i),N=T.measuredIsVisible,R=t.measuredIsVisible,I=!N&&R&&!b,D=!C&&(E||k)&&!v,A=C&&!E&&!_,O=A||C&&k&&!_;t.measuredIsRemoved&&N&&(t.$el.style.display=T.measuredDisplay,t.$el.style.visibility="visible",ki(T,t,h)),A?(d.push(i),u.add(i)):!C&&k&&u.delete(i),D&&!b||I?(xi(T,n),l.push(i)):O&&!b&&xi(t,o);for(let e in t.properties)t.properties[e]=h.getValue(t.$el,e),T.properties[e]=a.getValue(t.$el,e);const B=(D||A)&&E!==C;let L=!1;if(t.isTarget&&(!t.measuredIsRemoved&&N||t.measuredIsRemoved&&R)){t.isInlined||"none"===t.properties.transform&&"none"===T.properties.transform||(t.hasTransform=!0,L=!0,f.push(i));for(let e in t.properties)if("transform"!==e&&(t.properties[e]!==T.properties[e]||B)){L=!0,m.push(i);break}}const P=L||D||O||I,M=t.isTarget&&P;t.isAnimated=M,t.branchAdded=v||D,t.branchRemoved=_||O,t.branchNotRendered=b||t.measuredIsRemoved;const F=Math.abs(t.properties.width-T.properties.width)>1,V=Math.abs(t.properties.height-T.properties.height)>1;t.sizeChanged=F||V,p.push(i),t.isTarget||(c.push(i),(P||t.sizeChanged)&&y&&y.isTarget&&y.isAnimated&&y.sizeChanged&&g.push(i))});const v={ease:Bt(t.ease,this.ease),duration:t=>h.nodes.get(t.dataset.layoutId).duration,delay:t=>h.nodes.get(t.dataset.layoutId).delay};if(this.timeline=as({onComplete:()=>{this.transformAnimation&&this.transformAnimation.cancel(),h.forEachRootNode(t=>{Ci(t),$i(t)});for(let t=0,e=f.length;t<e;t++){const e=f[t];e.style.transform=h.getValue(e,"transform")}this.root.classList.remove("is-animated"),i&&i(this),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||vi(this.transitionMuteStore)})},onPause:()=>{this.transformAnimation&&this.transformAnimation.cancel(),h.forEachRootNode(Ci),this.root.classList.remove("is-animated"),i&&i(this)},composition:!1,defaults:v}),p.length){this.root.classList.add("is-animated");for(let t=0,e=p.length;t<e;t++){const e=p[t],s=e.dataset.layoutId,i=a.nodes.get(s),r=h.nodes.get(s),n=i.properties;yi(r),r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||(e.style.display="block"),(e!==y||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===y&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px"),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none")}a.scrollX===window.scrollX&&a.scrollY===window.scrollY||requestAnimationFrame(()=>{window.scrollTo(a.scrollX,a.scrollY)});for(let t=0,e=m.length;t<e;t++){const e=m[t],s=e.dataset.layoutId,i=a.nodes.get(s),r=h.nodes.get(s),n=i.properties,o=r.properties;let l=!1;const d={composition:"none"};r.isInlined||(n.width!==o.width&&(d.width=[n.width,o.width],l=!0),n.height!==o.height&&(d.height=[n.height,o.height],l=!0),r.hasTransform||(d.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],l=!0)),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(d[t]=[e,s],l=!0)}),l&&this.timeline.add(e,d,0)}}if(c.length){for(let t=0,e=c.length;t<e;t++){const e=c[t];if(!a.nodes.get(e.dataset.layoutId).isInlined){const t=a.get(e);e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${t.x}px ${t.y}px`}this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${a.getValue(e,t)}`)})}for(let t=0,e=c.length;t<e;t++){const e=c[t],s=h.nodes.get(e.dataset.layoutId),i=h.get(e);this.timeline.call(()=>{s.isInlined||(e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${h.getValue(e,t)}`)})},s.delay+s.duration/2)}if(g.length){const t={};if(r)for(let e in r)t[e]=[{from:t=>a.getValue(t,e),ease:"in(1.75)",to:r[e]},{from:r[e],to:t=>h.getValue(t,e),ease:"out(1.75)"}];this.timeline.add(g,t,0)}}const _=f.length;if(_){for(let t=0;t<_;t++){const e=f[t];e.style.translate=`${a.get(e).x}px ${a.get(e).y}px`,e.style.transform=a.getValue(e,"transform")}this.transformAnimation=li.animate(f,{translate:t=>`${h.get(t).x}px ${h.get(t).y}px`,transform:t=>h.getValue(t,"transform"),autoplay:!1,persist:!0,...v}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e),this}}const Ii=(t,e)=>new Ri(t,e),Di=vs,Ai={},Oi=(t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s),Bi=t=>(...e)=>{const s=t(...e);return new Proxy(S,{apply:(t,e,[i])=>s(i),get:(t,e)=>Bi((...t)=>{const i=Ai[e](...t);return t=>i(s(t))})})},Li=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?Bi(Oi(e,s)):e)(...t);return Ai[t]||(Ai[t]=i),i},Pi=Li("roundPad",Di.roundPad),Mi=Li("padStart",Di.padStart),Fi=Li("padEnd",Di.padEnd),Vi=Li("wrap",Di.wrap),zi=Li("mapRange",Di.mapRange),Xi=Li("degToRad",Di.degToRad),Hi=Li("radToDeg",Di.radToDeg),Ui=Li("snap",Di.snap),Yi=Li("clamp",Di.clamp),Wi=Li("round",Di.round),qi=Li("lerp",Di.lerp,1),ji=Li("damp",Di.damp,1),Gi=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let Qi=0;const Ji=(t,e=0,s=1,i=0)=>{let r=void 0===t?Qi++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},Zi=t=>t[Gi(0,t.length-1)],Ki=t=>{let e,s,i=t.length;for(;i;)s=Gi(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},tr=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!q(o),h=a&&!q(o.ease)?o.ease:a?Oe(o):null,l=e.grid,d=e.axis,c=e.total,u=q(r)||0===r||"first"===r,p="center"===r,m="last"===r,f="random"===r,g=X(t),v=e.use,_=it(g?t[0]:t),b=g?it(t[1]):0,T=N.exec((g?t[1]:t)+y),S=e.start||0+(g?_:0);let x=u?0:U(r)?r:0;return(t,r,o,a)=>{const[u]=be(t),y=q(c)?o:c,w=!q(v)&&(W(v)?v(u,r,y):Ft(u,v)),$=U(w)||Y(w)&&U(+w)?+w:r;if(p&&(x=(y-1)/2),m&&(x=y-1),!s.length){for(let t=0;t<y;t++){if(l){const e=p?(l[0]-1)/2:x%l[0],i=p?(l[1]-1)/2:ct(x/l[0]),r=e-t%l[0],n=i-ct(t/l[0]);let o=nt(r*r+n*n);"x"===d&&(o=-r),"y"===d&&(o=-n),s.push(o)}else s.push(ht(x-t));i=pt(...s)}h&&(s=s.map(t=>h(t/i)*i)),n&&(s=s.map(t=>d?t<0?-1*t:-t:ht(i-t))),f&&(s=Ki(s))}const E=g?(b-_)/i:_;let C=(a?ss(a,q(e.start)?a.iterationDuration:S):S)+(E*_t(s[$],2)||0);return e.modifier&&(C=e.modifier(C)),T&&(C=`${C}${T[2]}`),C}};var er=Object.freeze({__proto__:null,$:be,clamp:Yi,cleanInlineStyles:Gt,createSeededRandom:Ji,damp:ji,degToRad:Xi,get:Ze,keepTime:Is,lerp:qi,mapRange:zi,padEnd:Fi,padStart:Mi,radToDeg:Hi,random:Gi,randomPick:Zi,remove:ts,round:Wi,roundPad:Pi,set:Ke,shuffle:Ki,snap:Ui,stagger:tr,sync:Rs,wrap:Vi});const sr=t=>{const e=_e(t)[0];return e&&G(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},ir=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},rr=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[l],o=t.getCTM(),a=0===s;return{from:0,to:r,modifier:i=>{const h=i+s*r;if("a"===e){const e=ir(t,r,h,-1,a),s=ir(t,r,h,1,a);return 180*mt(s.y-e.y,s.x-e.x)/ft}{const s=ir(t,r,h,0,a);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},nr=(t,e=0)=>{const s=sr(t);if(s)return{translateX:rr(s,"x",e),translateY:rr(s,"y",e),rotate:rr(s,"a",e)}},or=t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(nt(s.a*s.a+s.b*s.b)+nt(s.c*s.c+s.d*s.d))/2)}return e},ar=(t,e,s)=>{const i=f,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const h=new Proxy(t,{get(t,e){const s=t[e];return e===u?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],h=+s[1],l=or(o),d=-1e3*r*l,c=h*i*l+d,u=i*l+(0===r&&1===h||1===r&&0===h?0:10*l)-c;if("butt"!==n){const e=r===h?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:W(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),h.setAttribute("draw",`${e} ${s}`)),h},hr=(t,e=0,s=0)=>_e(t).map(t=>ar(t,e,s)),lr=(t,e=.33)=>s=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const i=sr(t);if(!i)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(i.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${i.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const r="path"===s.tagName,n=r?" ":",",o=s[c];o&&s.setAttribute(r?"d":"points",o);let a="",h="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),l=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<l;e++){const d=e/(l-1),c=s.getPointAtLength(t*d),u=i.getPointAtLength(o*d),p=r?0===e?"M":"L":"";a+=p+_t(c.x,3)+n+c.y+" ",h+=p+_t(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),h=i.getAttribute(r?"d":"points");return s[c]=h,[a,h]};var dr=Object.freeze({__proto__:null,createDrawable:hr,createMotionPath:nr,morphTo:lr});const cr="undefined"!=typeof Intl&&Intl.Segmenter,ur=/\{value\}/g,pr=/\{i\}/g,mr=/(\s+)/,fr=/^\s+$/,gr="line",yr="word",vr="char",_r="data-line";let br=null,Tr=null,Sr=null;const xr=t=>t.isWordLike||" "===t.segment||U(+t.segment),wr=t=>t.setAttribute("aria-hidden","true"),$r=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Er={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},Cr=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&Cr(e)}},kr=(t,e,s)=>{const i=t.getAttribute(_r);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&fr.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&fr.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)kr(t.children[r],e,s);return s},Nr=(t,e={})=>{let s="";const i=Y(e.class)?` class="${e.class}"`:"",r=Bt(e.clone,!1),n=Bt(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},Rr=(t,e,s,i,r,n,o,a,h)=>{const l=r===gr,d=r===vr,c=`_${r}_`,u=W(t)?t(s):t,p=l?"block":"inline-block";Sr.innerHTML=u.replace(ur,`<i class="${c}"></i>`).replace(pr,`${d?h:l?o:a}`);const m=Sr.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),v=y.length;if(v){f.style.display=p,g.style.display=p,g.setAttribute(_r,`${o}`),l||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${h}`));let t=v;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,l?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${Er[r]}`),f};class Ir{constructor(e,i={}){br||(br=cr?new cr([],{granularity:yr}):{segment:t=>{const e=[],s=t.split(mr);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!fr.test(i)})}return e}}),Tr||(Tr=cr?new cr([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!Sr&&t&&(Sr=s.createElement("template")),B.current&&B.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:h,debug:l}=i,d=(e=X(e)?e[0]:e)&&e.nodeType?e:(ve(e)||[])[0],c=!0===o?{}:o,u=!0===r||q(r)?{}:r,p=!0===n?{}:n;this.debug=Bt(l,!1),this.includeSpaces=Bt(h,!1),this.accessible=Bt(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=H(c)?Nr(gr,c):c,this.wordTemplate=H(u)||this.linesOnly?Nr(yr,u):u,this.charTemplate=H(p)?Nr(vr,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?s.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!W(t))return console.warn("Effect must return a function.");const e=Is(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>W(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,i=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],h=this.words,l=this.chars,d=br.segment(o),c=s.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=xr(t);if(!u||s&&u&&xr(u))a.push(e);else{const t=a.length-1,s=a[t];mr.test(s)||mr.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=i?Tr.segment(p):null,f=i?s.createDocumentFragment():s.createTextNode(u?o+" ":o);if(i){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=s.createTextNode(a);Rr(i,l,d,f,vr,n,-1,h.length,l.length)}}e?Rr(e,h,f,c,yr,n,-1,h.length,l.length):i?c.appendChild(f):c.appendChild(s.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(s.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,i=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==s.fonts.status,h=r&&a;this.ready=!r||a,(h||t)&&this.effectsCleanups.forEach(t=>W(t)&&t(this)),i||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),h&&(i&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=$r(e,yr))),o&&(h||n)&&(this.chars=$r(e,vr));const l=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=l.length;t<e;t++){const e=l[t],{top:s,height:i}=e.getBoundingClientRect();!q(d)&&s-d>.5*i&&c++,e.setAttribute(_r,`${c}`);const r=e.querySelectorAll(`[${_r}]`);let n=r.length;for(;n--;)r[n].setAttribute(_r,`${c}`);d=s}if(h){const t=s.createDocumentFragment(),i=new Set,a=[];for(let t=0;t<c+1;t++){const s=e.cloneNode(!0);kr(s,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&i.add(e),e.removeChild(t))}),a.push(s)}i.forEach(Cr);for(let e=0,s=a.length;e<s;e++)Rr(r,this.lines,a[e],t,gr,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=$r(e,yr)),o&&(this.chars=$r(e,vr))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(h||!i)){const t=s.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach(wr),this.words.forEach(wr),this.chars.forEach(wr)}return this.width=e.offsetWidth,(h||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const Dr=(t,e)=>new Ir(t,e),Ar=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new Ir(t,e));var Or=Object.freeze({__proto__:null,TextSplitter:Ir,split:Ar,splitText:Dr});export{be as $,hs as Animatable,Ri as AutoLayout,ks as Draggable,qe as JSAnimation,Ds as Scope,Us as ScrollObserver,bs as Spring,Ir as TextSplitter,os as Timeline,ge as Timer,hi as WAAPIAnimation,je as animate,Yi as clamp,Gt as cleanInlineStyles,ls as createAnimatable,Ns as createDraggable,hr as createDrawable,Ii as createLayout,nr as createMotionPath,As as createScope,Ji as createSeededRandom,Ss as createSpring,as as createTimeline,ye as createTimer,js as cubicBezier,ji as damp,Xi as degToRad,Re as eases,Zs as easings,se as engine,Ze as get,Js as irregular,Is as keepTime,qi as lerp,Qs as linear,zi as mapRange,lr as morphTo,Ys as onScroll,Fi as padEnd,Mi as padStart,Hi as radToDeg,Gi as random,Zi as randomPick,ts as remove,Wi as round,Pi as roundPad,Ls as scrollContainers,Ke as set,Ki as shuffle,Ui as snap,Ar as split,Dr as splitText,Ts as spring,tr as stagger,Gs as steps,dr as svg,Rs as sync,Or as text,er as utils,li as waapi,Vi as wrap};
+const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},r={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},n={NONE:0,AUTO:1,FORCE:2},o={replace:0,none:1,blend:2},a=Symbol(),l=Symbol(),h=Symbol(),d=Symbol(),c=Symbol(),u=Symbol(),p=1e-11,m=1e12,f=1e3,g=240,y="",v="var(",_=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),b=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","matrix","matrix3d","perspective"],T=b.reduce((t,e)=>({...t,[e]:e+"("}),{}),x=()=>{},S=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,w=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,$=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,E=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,C=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,N=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,k=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,R=/([a-z])([A-Z])/g,D=/(\w+)(\([^)]+\)+)/g,I=/(\*=|\+=|-=)/,A=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,L={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:g,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:f,delay:0,loopDelay:0,ease:"out(2)",composition:o.replace,modifier:t=>t,onBegin:x,onBeforeUpdate:x,onUpdate:x,onLoop:x,onPause:x,onComplete:x,onRender:x},O={current:null,root:s},B={defaults:L,precision:4,timeScale:1,tickThreshold:200},P=t&&e.AnimeJSDevTools,F={version:"4.3.0",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(F));const M=t=>t.replace(R,"$1-$2").toLowerCase(),V=(t,e)=>0===t.indexOf(e),z=Date.now,X=Array.isArray,H=t=>t&&t.constructor===Object,U=t=>"number"==typeof t&&!isNaN(t),Y=t=>"string"==typeof t,W=t=>"function"==typeof t,q=t=>void 0===t,j=t=>q(t)||null===t,G=e=>t&&e instanceof SVGElement,Q=t=>S.test(t),J=t=>V(t,"rgb")&&")"===t[t.length-1],Z=t=>V(t,"hsl")&&")"===t[t.length-1],K=t=>Q(t)||J(t)||Z(t),tt=t=>!B.defaults.hasOwnProperty(t),et=["opacity","rotate","overflow","color"],st=(t,e)=>{if(et.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}},it=t=>Y(t)?parseFloat(t):t,rt=Math.pow,nt=Math.sqrt,ot=Math.sin,at=Math.cos,lt=Math.abs,ht=Math.exp,dt=Math.ceil,ct=Math.floor,ut=Math.asin,pt=Math.max,mt=Math.atan2,ft=Math.PI,gt=Math.round,yt=(t,e,s)=>t<e?e:t>s?s:t,vt={},_t=(t,e)=>{if(e<0)return t;if(!e)return gt(t);let s=vt[e];return s||(s=vt[e]=10**e),gt(t*s)/s},bt=(t,e)=>X(e)?e.reduce((e,s)=>lt(s-t)<lt(e-t)?s:e):e?gt(t/e)*e:t,Tt=(t,e,s)=>t+(e-t)*s,xt=t=>t===1/0?m:t===-1/0?-m:t,St=t=>t<=p?p:xt(_t(t,11)),wt=t=>X(t)?[...t]:t,$t=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=q(r)?e[i]:r}return s},Et=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},Ct=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},Nt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},kt=(t,e,s)=>{const i=t.style.transform;let r;if(i){const n=t[d];let o;for(;o=D.exec(i);){const t=o[1],i=o[2].slice(1,-1);n[t]=i,t===e&&(r=i,s&&(s[e]=i))}}return i&&!q(r)?r:V(e,"scale")?"1":V(e,"rotate")||V(e,"skew")?"0deg":"0px"},Rt=t=>{const e=w.exec(t)||$.exec(t),s=q(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]},Dt=t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]},It=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),At=t=>{const e=E.exec(t)||C.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=q(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=_t(255*It(e,t,s+1/3),0),a=_t(255*It(e,t,s),0),l=_t(255*It(e,t,s-1/3),0)}return[o,a,l,n]},Lt=t=>J(t)?Rt(t):Q(t)?Dt(t):Z(t)?At(t):[0,0,0,1],Ot=(t,e)=>q(t)?e:t,Bt=(t,e,s,i,r)=>{let n;if(W(t))n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};else{if(!Y(t)||!V(t,v))return t;n=()=>{const s=t.match(A),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==y||!r||(n=r.trim()),n||0}}return r&&(r.func=n),n()},Pt=(t,e)=>t[l]?t[h]&&st(t,e)?i.ATTRIBUTE:b.includes(e)||_.get(e)?i.TRANSFORM:V(e,"--")?i.CSS_VAR:e in t.style?i.CSS:e in t?i.OBJECT:i.ATTRIBUTE:i.OBJECT,Ft=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[u]||t).getPropertyValue(e);return"auto"===r?"0":r},Mt=(t,e,s,r)=>{const n=q(s)?Pt(t,e):s;return n===i.OBJECT?t[e]||0:n===i.ATTRIBUTE?t.getAttribute(e):n===i.TRANSFORM?kt(t,e,r):n===i.CSS_VAR?Ft(t,e,r).trimStart():Ft(t,e,r)},Vt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,zt=()=>({t:r.NUMBER,n:0,u:null,o:null,d:null,s:null}),Xt=(t,e)=>{if(e.t=r.NUMBER,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const i=!s.includes(" ")&&k.exec(s);if(i)return e.t=r.UNIT,e.n=+i[1],e.u=i[2],e;if(e.o)return e.n=+s,e;if(K(s))return e.t=r.COLOR,e.d=Lt(s),e;{const t=s.match(N);return e.t=r.COMPLEX,e.d=t?t.map(Number):[],e.s=s.split(N)||[],e}}return e.n=s,e},Ht=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=wt(t._toNumbers),e.s=wt(t._strings),e),Ut=zt(),Yt=(t,e,s,a,l)=>{const h=t.parent,c=t.duration,u=t.completed,m=t.iterationDuration,f=t.iterationCount,g=t._currentIteration,v=t._loopDelay,_=t._reversed,b=t._alternate,x=t._hasChildren,S=t._delay,w=t._currentTime,$=S+m,E=e-S,C=yt(w,-S,c),N=yt(E,-S,c),k=E-w,R=N>0,D=N>=c,I=c<=p,A=l===n.FORCE;let L=0,O=E,P=0;if(f>1){const e=~~(N/(m+(D?0:v)));t._currentIteration=yt(e,0,f),D&&t._currentIteration--,L=t._currentIteration%2,O=N%(m+v)||0}const F=_^(b&&L),M=t._ease;let V=D?F?0:c:F?m-O:O;M&&(V=m*M(V/m)||0);const z=(h?h.backwards:E<w)?!F:!!F;if(t._currentTime=E,t._iterationTime=V,t.backwards=z,R&&!t.began?(t.began=!0,s||h&&(z||!h.began)||t.onBegin(t)):E<=0&&(t.began=!1),s||x||!R||t._currentIteration===g||t.onLoop(t),A||l===n.AUTO&&(e>=S&&e<=$||e<=S&&C>S||e>=$&&C!==c)||V>=$&&C!==c||V<=S&&C>0||e<=C&&C===c&&u||D&&!u&&I){if(R&&(t.computeDeltaTime(C),s||t.onBeforeUpdate(t)),!x){const e=A||(z?-1*k:k)>=B.tickThreshold,n=t._offset+(h?h._offset:0)+S+V;let l,c,u,p,m=t._head,f=0;for(;m;){const t=m._composition,s=m._currentTime,h=m._changeDuration,g=m._absoluteStartTime+m._changeDuration,v=m._nextRep,_=m._prevRep,b=t!==o.none;if((e||(s!==h||n<=g+(v?v._delay:0))&&(0!==s||n>=m._absoluteStartTime))&&(!b||!m._isOverridden&&(!m._isOverlapped||n<=g)&&(!v||v._isOverridden||n<=v._absoluteStartTime)&&(!_||_._isOverridden||n>=_._absoluteStartTime+_._changeDuration+m._delay))){const e=m._currentTime=yt(V-m._startTime,0,h),s=m._ease(e/m._updateDuration),n=m._modifier,g=m._valueType,y=m._tweenType,v=y===i.OBJECT,_=g===r.NUMBER,T=_&&v||0===s||1===s?-1:B.precision;let x,S;if(_)x=S=n(_t(Tt(m._fromNumber,m._toNumber,s),T));else if(g===r.UNIT)S=n(_t(Tt(m._fromNumber,m._toNumber,s),T)),x=`${S}${m._unit}`;else if(g===r.COLOR){const t=m._fromNumbers,e=m._toNumbers,i=_t(yt(n(Tt(t[0],e[0],s)),0,255),0),r=_t(yt(n(Tt(t[1],e[1],s)),0,255),0),o=_t(yt(n(Tt(t[2],e[2],s)),0,255),0),a=yt(n(_t(Tt(t[3],e[3],s),T)),0,1);if(x=`rgba(${i},${r},${o},${a})`,b){const t=m._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(g===r.COMPLEX){x=m._strings[0];for(let t=0,e=m._toNumbers.length;t<e;t++){const e=n(_t(Tt(m._fromNumbers[t],m._toNumbers[t],s),T)),i=m._strings[t+1];x+=`${i?e+i:e}`,b&&(m._numbers[t]=e)}}if(b&&(m._number=S),a||t===o.blend)m._value=x;else{const t=m.property;l=m.target,v?l[t]=x:y===i.ATTRIBUTE?l.setAttribute(t,x):(c=l.style,y===i.TRANSFORM?(l!==u&&(u=l,p=l[d]),p[t]=x,f=1):y===i.CSS?c[t]=x:y===i.CSS_VAR&&c.setProperty(t,x)),R&&(P=1)}}if(f&&m._renderTransforms){let t=y;for(let e in p)t+=`${T[e]}${p[e]}) `;c.transform=t,f=0}m=m._next}!s&&P&&t.onRender(t)}!s&&R&&t.onUpdate(t)}return h&&I?!s&&(h.began&&!z&&E>0&&!u||z&&E<=p&&u)&&(t.onComplete(t),t.completed=!z):R&&D?f===1/0?t._startTime+=t.duration:t._currentIteration>=f-1&&(t.paused=!0,u||x||(t.completed=!0,s||h&&(z||!h.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,P},Wt=(t,e,s,i,r)=>{const o=t._currentIteration;if(Yt(t,e,s,i,r),t._hasChildren){const a=t,l=a.backwards,h=i?e:a._iterationTime,d=z();let c=0,u=!0;if(!i&&a._currentIteration!==o){const t=a.iterationDuration;Et(a,e=>{if(l){const i=e.duration,r=e._offset+e._delay;s||!(i<=p)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&Yt(e,t,s,1,n.FORCE),e.began=!1,e.completed=!1}),s||a.onLoop(a)}Et(a,t=>{const e=_t((h-t._offset)*t._speed,12),n=t._fps<a._fps?t.requestTick(d):r;c+=Yt(t,e,s,i,n),!t.completed&&u&&(u=!1)},l),!s&&c&&a.onRender(a),(u||l)&&a._currentTime>=a.duration&&(a.paused=!0,a.completed||(a.completed=!0,s||(a.onComplete(a),a._resolve(a))))}},qt={},jt=(t,e,s)=>{if(s===i.TRANSFORM)return _.get(t)||t;if(s===i.CSS||s===i.ATTRIBUTE&&G(e)&&t in e.style){const e=qt[t];if(e)return e;{const e=t?M(t):t;return qt[t]=e,e}}return t},Gt=t=>{if(t._hasChildren)Et(t,Gt,!0);else{const e=t;e.pause(),Et(e,t=>{const s=t.property,r=t.target;if(r[l]){const n=r.style,o=t._inlineValue,a=j(o)||o===y;if(t._tweenType===i.TRANSFORM){const e=r[d];if(a?delete e[s]:e[s]=o,t._renderTransforms)if(Object.keys(e).length){let t=y;for(let s in e)t+=T[s]+e[s]+") ";n.transform=t}else n.removeProperty("transform")}else a?n.removeProperty(M(s)):n[s]=o;e._tail===t&&e.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===y&&t.removeAttribute("style")})}})}return t};class Qt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=f/g,this._fps=g,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<p?p:s,r=f/i;i>L.frameRate&&(L.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<p?p:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return n.NONE;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,n.AUTO}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Jt={animation:null,update:x},Zt=t=>{let e=Jt.animation;return e||(e={duration:p,computeDeltaTime:x,_offset:0,_delay:0,_head:null,_tail:null},Jt.animation=e,Jt.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=t===r.COMPLEX||t===r.COLOR?wt(i._fromNumbers):null;let n=i._fromNumber,o=s._tail;for(;o&&o!==i;){if(e)for(let t=0,s=o._numbers.length;t<s;t++)e[t]+=o._numbers[t];else n+=o._number;o=o._prevAdd}i._toNumber=n,i._toNumbers=e}}}),Yt(e,1,1,0,n.FORCE)}),e},Kt=(()=>t?requestAnimationFrame:setImmediate)(),te=(()=>t?cancelAnimationFrame:clearImmediate)();class ee extends Qt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=L,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=z();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(Ct(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):Wt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):n.AUTO),i=r}Jt.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(z()),this.reqId=Kt(ie)),this}pause(){if(this.reqId)return this.paused=!0,re()}resume(){if(this.paused)return this.paused=!1,Et(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===B.timeScale?1:f)}set speed(t){this._speed=t*B.timeScale,Et(this,t=>t.speed=t._speed)}get timeUnit(){return 1===B.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(B.timeScale!==s){B.timeScale=s,B.tickThreshold=200*s;const t=e?.001:f;this.defaults.duration*=t,this._speed*=t}}get precision(){return B.precision}set precision(t){B.precision=t}}const se=(()=>{const e=new ee(z());return t&&(F.engine=e,s.addEventListener("visibilitychange",()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())})),e})(),ie=()=>{se._head?(se.reqId=Kt(ie),se.update()):se.reqId=0},re=()=>(te(se.reqId),se.reqId=0,se),ne={_rep:new WeakMap,_add:new Map},oe=(t,e,s="_rep")=>{const i=ne[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},ae=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,le=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=p,t._currentTime=p},he=(t,e)=>{const s=t._composition;if(s===o.replace){const s=t._absoluteStartTime;Nt(e,t,ae,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){le(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)le(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=_t(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<p&&le(i)}let o=!0;if(Et(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;Et(t,t=>{t!==e&&Et(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===o.blend){const e=oe(t.target,t.property,"_add"),s=Zt(ne._add);let i=e._head;i||(i={...t},i._composition=o.replace,i._updateDuration=p,i._startTime=0,i._numbers=wt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,Nt(e,i),Nt(s,i));const r=t._toNumber;if(t._fromNumber=i._fromNumber-r,t._toNumber=0,t._numbers=wt(t._fromNumbers),t._number=0,i._fromNumber=r,t._toNumbers){const e=wt(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}Nt(e,t,null,"_prevAdd","_nextAdd")}return t},de=t=>{const e=t._composition;if(e!==o.none){const s=t.target,i=t.property,r=ne._rep.get(s)[i];if(Ct(r,t,"_prevRep","_nextRep"),e===o.blend){const e=ne._add,r=e.get(s);if(!r)return;const n=r[i],o=Jt.animation;Ct(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){Ct(n,a,"_prevAdd","_nextAdd"),Ct(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},ce=(t,e,s)=>{let r=!1;return Et(e,n=>{const o=n.target;if(t.includes(o)){const t=n.property,a=n._tweenType,l=jt(s,o,a);(!l||l&&l===t)&&(n.parent._tail===n&&n._tweenType===i.TRANSFORM&&n._prev&&n._prev._tweenType===i.TRANSFORM&&(n._prev._renderTransforms=1),Ct(e,n),de(n),r=!0)}},!0),r},ue=(t,e,s)=>{const i=e||se;let r;if(i._hasChildren){let e=0;Et(i,n=>{if(!n._hasChildren)if(r=ce(t,n,s),r&&!n._head)n.cancel(),Ct(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?ue(t,n,s):n._hasChildren=!1},!0),q(i.iterationDuration)||(i.iterationDuration=e)}else r=ce(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},pe=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),me=t=>t._cancelled?(t._hasChildren?Et(t,me):Et(t,t=>{t._composition!==o.none&&he(t,oe(t.target,t.property))}),t._cancelled=0,t):t;let fe=0;class ge extends Qt{constructor(t={},e=null,s=0){super(0),++fe;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:d,frameRate:c,playbackRate:u,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:_}=t;O.current&&O.current.register(this);const b=e?0:se._lastTickTime,T=e?e.defaults:B.defaults,S=W(r)||q(r)?T.delay:+r,w=W(n)||q(n)?1/0:+n,$=Ot(l,T.loop),E=Ot(h,T.loopDelay);let C=!0===$||$===1/0||$<0?1/0:$+1;if(P){const s=C===1/0;if(P.register(this,t,s)&&s){const t=a?2:1,s=e?P.maxNestedInfiniteLoops:P.maxInfiniteLoops;C=Math.max(s,t)}}let N=0;e?N=s:(se.reqId||se.requestTick(z()),N=(se._lastTickTime-se._startTime)*B.timeScale),this.id=q(i)?fe:i,this.parent=e,this.duration=xt((w+E)*C-E)||p,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||T.onBegin,this.onBeforeUpdate=v||T.onBeforeUpdate,this.onUpdate=_||T.onUpdate,this.onLoop=f||T.onLoop,this.onPause=g||T.onPause,this.onComplete=m||T.onComplete,this.iterationDuration=w,this.iterationCount=C,this._autoplay=!e&&Ot(d,T.autoplay),this._offset=N,this._delay=S,this._loopDelay=E,this._iterationTime=0,this._currentIteration=0,this._resolve=x,this._running=!1,this._reversed=+Ot(o,T.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Ot(a,T.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=Ot(c,T.frameRate),this._speed=Ot(u,T.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return yt(_t(this._currentTime,B.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return yt(_t(this._iterationTime,B.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return yt(_t(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return yt(_t(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*yt(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return me(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Wt(this,0,1,~~t,n.FORCE),pe(this),this._hasChildren&&Et(this,pe),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&Wt(this,this.duration,1,~~t,n.FORCE),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!q(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*se._speed);return this._startTime=z()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=p&&!this._hasChildren?Wt(this,p,0,0,n.FORCE):(this._running||(Nt(se,this),se._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,se.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){me(this),this.completed=!1;const i=this.paused;return this.paused=!0,Wt(this,t+this._delay,~~e,~~s,n.AUTO),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?ct(m/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?Et(this,t=>t.cancel(),!0):Et(this,de),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=St(t);if(e===s)return this;const i=t/e,r=t<=p;return this.duration=r?p:s,this.iterationDuration=r?p:St(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){Wt(this,0,1,0,n.AUTO);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(t=0){return this.seek(this.duration,t).cancel()}then(t=x){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=x};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const ye=t=>new ge(t,null,0).init();function ve(t){const e=Y(t)?O.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function _e(e){if(j(e))return[];if(!t)return X(e)&&e.flat(1/0)||[e];if(X(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!j(i)){const t=ve(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!j(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=ve(e);return s?Array.from(s):[e]}function be(t){const e=_e(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[a]){s[a]=!0;const t=G(s);(s.nodeType||t)&&(s[l]=!0,s[h]=t,s[d]={})}}return e}const Te={deg:1,rad:180/ft,turn:360},xe={},Se=(t,e,i,n=!1)=>{const o=e.u,a=e.n;if(e.t===r.UNIT&&o===i)return e;const l=a+o+i,h=xe[l];if(q(h)||n){let r;if(o in Te)r=a*Te[o]/Te[i];else{const e=100,n=t.cloneNode(),l=t.parentNode,h=l&&l!==s?l:s.body;h.appendChild(n);const d=n.style;d.width=e+o;const c=n.offsetWidth||e;d.width=e+i;const u=c/(n.offsetWidth||e);h.removeChild(n),r=u*a}e.n=r,xe[l]=r}else e.n=h;return e.t,e.u=i,e},we=t=>t,$e=(t=1.68)=>e=>rt(e,+t),Ee={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},Ce=ft/2,Ne=2*ft,ke={[y]:$e,Quad:$e(2),Cubic:$e(3),Quart:$e(4),Quint:$e(5),Sine:t=>1-at(t*Ce),Circ:t=>1-nt(1-t*t),Expo:t=>t?rt(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=rt(2,--s))-1)/11;);return 1/rt(4,3-s)-7.5625*rt((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=yt(+t,1,10),i=yt(+e,p,2),r=i/Ne*ut(1/s),n=Ne/i;return t=>0===t||1===t?t:-s*rt(2,-10*(1-t))*ot((1-t-r)*n)}},Re=(()=>{const t={linear:we,none:we};for(let e in Ee)for(let s in ke){const i=ke[s],r=Ee[e];t[e+s]=s===y||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),De={linear:we,none:we},Ie=t=>{if(De[t])return De[t];if(t.indexOf("(")<=-1){const e=Ee[t]||t.includes("Back")||t.includes("Elastic")?Re[t]():Re[t];return e?De[t]=e:we}{const e=t.slice(0,-1).split("("),s=Re[e[0]];return s?De[t]=s(...e[1].split(",")):we}},Ae=["steps(","irregular(","linear(","cubicBezier("],Le=t=>{if(Y(t))for(let e=0,s=Ae.length;e<s;e++)if(V(t,Ae[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),we;return W(t)?t:Y(t)?Ie(t):we},Oe=zt(),Be=zt(),Pe={},Fe={func:null},Me=[null],Ve=[null,null],ze={to:null};let Xe,He,Ue=0,Ye=0;const We=(t,e)=>{const s={};if(X(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(tt);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];tt(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=Ot(e.duration,B.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(tt(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s};class qe extends ge{constructor(t,e,s,n,a=!1,l=0,h=0){super(e,s,n),++Ye;const d=be(t),c=d.length,u=e.keyframes,m=u?$t(We(u,e),e):e,{id:g,delay:y,duration:v,ease:_,playbackEase:b,modifier:T,composition:x,onRender:S}=m,w=s?s.defaults:B.defaults,$=Ot(_,w.ease),E=Ot(b,w.playbackEase),C=E?Le(E):null,N=!q($.ease),k=N?$.ease:Ot(_,C?"linear":w.ease),R=N?$.settlingDuration:Ot(v,w.duration),D=Ot(y,w.delay),I=T||w.modifier,A=q(x)&&c>=f?o.none:q(x)?w.composition:x,L=this._offset+(s?s._offset:0);N&&($.parent=this);let O=NaN,P=NaN,F=0,M=0;for(let t=0;t<c;t++){const e=d[t],n=l||t,u=h||c;let f=NaN,g=NaN;for(let t in m)if(tt(t)){const l=Pt(e,t),h=jt(t,e,l);let d=m[t];const c=X(d);if(a&&!c&&(Ve[0]=d,Ve[1]=d,d=Ve),c){const t=d.length,e=!H(d[0]);2===t&&e?(ze.to=d,Me[0]=ze,Xe=Me):t>2&&e?(Xe=[],d.forEach((t,e)=>{e?1===e?(Ve[1]=t,Xe.push(Ve)):Xe.push(t):Ve[0]=t})):Xe=d}else Me[0]=d,Xe=Me;let y=null,v=null,_=NaN,b=0,T=0;for(let t=Xe.length;T<t;T++){const i=Xe[T];H(i)?He=i:(ze.to=i,He=ze),Fe.func=null;const a=Bt(He.to,e,n,u,Fe);let d;H(a)&&!q(a.to)?(He=a,d=a.to):d=a;const c=Bt(He.from,e,n,u),m=He.ease||k,f=Bt(m,e,n,u),g=W(f)||Y(f)?f:m,x=!q(g)&&!q(g.ease),S=x?g.ease:g,w=x?g.settlingDuration:Bt(Ot(He.duration,t>1?Bt(R,e,n,u)/t:R),e,n,u),$=Bt(Ot(He.delay,T?0:D),e,n,u),E=Bt(Ot(He.composition,A),e,n,u),C=U(E)?E:o[E],N=He.modifier||I,O=!q(c),B=!q(d),P=X(d),V=P||O&&B,z=v?b+$:$,G=_t(L+z,12);M||!O&&!P||(M=1);let Q=v;if(C!==o.none){y||(y=oe(e,h));let t=y._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=G;)if(Q=t,t=t._nextRep,t&&t._absoluteStartTime>=G)for(;t;)le(t),t=t._nextRep}if(V){Xt(P?Bt(d[0],e,n,u):c,Oe),Xt(P?Bt(d[1],e,n,u,Fe):d,Be);const t=Mt(e,h,l,Pe);Oe.t===r.NUMBER&&(Q?Q._valueType===r.UNIT&&(Oe.t=r.UNIT,Oe.u=Q._unit):(Xt(t,Ut),Ut.t===r.UNIT&&(Oe.t=r.UNIT,Oe.u=Ut.u)))}else B?Xt(d,Be):v?Ht(v,Be):Xt(s&&Q&&Q.parent.parent===s?Q._value:Mt(e,h,l,Pe),Be),O?Xt(c,Oe):v?Ht(v,Oe):Xt(s&&Q&&Q.parent.parent===s?Q._value:Mt(e,h,l,Pe),Oe);if(Oe.o&&(Oe.n=Vt(Q?Q._toNumber:Xt(Mt(e,h,l,Pe),Ut).n,Oe.n,Oe.o)),Be.o&&(Be.n=Vt(Oe.n,Be.n,Be.o)),Oe.t!==Be.t)if(Oe.t===r.COMPLEX||Be.t===r.COMPLEX){const t=Oe.t===r.COMPLEX?Oe:Be,e=Oe.t===r.COMPLEX?Be:Oe;e.t=r.COMPLEX,e.s=wt(t.s),e.d=t.d.map(()=>e.n)}else if(Oe.t===r.UNIT||Be.t===r.UNIT){const t=Oe.t===r.UNIT?Oe:Be,e=Oe.t===r.UNIT?Be:Oe;e.t=r.UNIT,e.u=t.u}else if(Oe.t===r.COLOR||Be.t===r.COLOR){const t=Oe.t===r.COLOR?Oe:Be,e=Oe.t===r.COLOR?Be:Oe;e.t=r.COLOR,e.s=t.s,e.d=[0,0,0,1]}if(Oe.u!==Be.u){let t=Be.u?Oe:Be;t=Se(e,t,Be.u?Be.u:Oe.u,!1)}if(Be.d&&Oe.d&&Be.d.length!==Oe.d.length){const t=Oe.d.length>Be.d.length?Oe:Be,e=t===Oe?Be:Oe;e.d=t.d.map((t,s)=>q(e.d[s])?0:e.d[s]),e.s=wt(t.s)}const J=_t(+w||p,12);let Z=Pe[h];j(Z)||(Pe[h]=null);const K={parent:this,id:Ue++,property:h,target:e,_value:null,_func:Fe.func,_ease:Le(S),_fromNumbers:wt(Oe.d),_toNumbers:wt(Be.d),_strings:wt(Be.s),_fromNumber:Oe.n,_toNumber:Be.n,_numbers:wt(Oe.d),_number:Oe.n,_unit:Be.u,_modifier:N,_currentTime:0,_startTime:z,_delay:+$,_updateDuration:J,_changeDuration:J,_absoluteStartTime:G,_tweenType:l,_valueType:Be.t,_composition:C,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:Z,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};C!==o.none&&he(K,y),isNaN(_)&&(_=K._startTime),b=_t(z+J,12),v=K,F++,Nt(this,K)}(isNaN(P)||_<P)&&(P=_),(isNaN(O)||b>O)&&(O=b),l===i.TRANSFORM&&(f=F-T,g=F)}if(!isNaN(f)){let t=0;Et(this,e=>{t>=f&&t<g&&(e._renderTransforms=1,e._composition===o.blend&&Et(Jt.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}c||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),P?(Et(this,t=>{t._startTime-t._delay||(t._delay-=P),t._startTime-=P}),O-=P):P=0,O||(O=p,this.iterationCount=0),this.targets=d,this.id=q(g)?Ye:g,this.duration=O===p?p:xt((O+this._loopDelay)*this.iterationCount-this._loopDelay)||p,this.onRender=S||w.onRender,this._ease=C,this._delay=P,this.iterationDuration=O,!this._autoplay&&M&&this.onRender(this)}stretch(t){const e=this.duration;if(e===St(t))return this;const s=t/e;return Et(this,t=>{t._updateDuration=St(t._updateDuration*s),t._changeDuration=St(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return Et(this,t=>{const e=t._func;if(e){const s=Mt(t.target,t.property,t._tweenType);Xt(s,Ut),Xt(e(),Be),t._fromNumbers=wt(Ut.d),t._fromNumber=Ut.n,t._toNumbers=wt(Be.d),t._strings=wt(Be.s),t._toNumber=Be.o?Vt(Ut.n,Be.n,Be.o):Be.n}}),this.duration===p&&this.restart(),this}revert(){return super.revert(),Gt(this)}then(t){return super.then(t)}}const je=(t,e)=>new qe(t,e,null,0,!1).init(),Ge={_head:null,_tail:null},Qe=(t,e,s)=>{let i,r=Ge._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),Ct(Ge,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Je=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Qe(e,s),Nt(Ge,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{Qe(e,s,t)};return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function Ze(t,e,s){const i=be(t);if(!i.length)return;const[n]=i,o=Pt(n,e),a=jt(e,n,o);let l=Mt(n,a);if(q(s))return l;if(Xt(l,Ut),Ut.t===r.NUMBER||Ut.t===r.UNIT){if(!1===s)return Ut.n;{const t=Se(n,Ut,s,!1);return`${_t(t.n,B.precision)}${t.u}`}}}const Ke=(t,e)=>{if(!q(e))return e.duration=p,e.composition=Ot(e.composition,o.none),new qe(t,e,null,0,!0).resume()},ts=(t,e,s)=>{const i=_e(t);for(let t=0,r=i.length;t<r;t++)Qe(i[t],s,e&&e.controlAnimation&&e);return ue(i,e,s),i},es=(t,e)=>{if(V(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}},ss=(t,e)=>{let s=t.iterationDuration;if(s===p&&(s=0),q(e))return s;if(U(+e))return+e;const i=e,r=t?t.labels:null,n=!j(r),o=es(t,i),a=!q(o),l=I.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return Vt(d,c,t[0])}return a?o:n?q(r[i])?s:r[i]:s};function is(t){return xt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||p}function rs(t,e,s,i,r,o){const a=U(t.duration)&&t.duration<=p?s-p:s;e.composition&&Wt(e,a,1,1,n.AUTO);const l=i?new qe(i,t,e,a,!1,r,o):new ge(t,e,a);return e.composition&&l.init(!0),Nt(e,l),Et(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=is(e),e}let ns=0;class os extends ge{constructor(t={}){super(t,null,0),++ns,this.id=q(t.id)?ns:t.id,this.duration=0,this.labels={};const e=t.defaults,s=B.defaults;this.defaults=e?$t(e,s):s,this.composition=Ot(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=Ot(t.playbackEase,s.playbackEase);this._ease=i?Le(i):null,this.iterationDuration=0}add(t,e,s){const i=H(e),r=H(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(W(s)){const e=s,r=_e(t),n=this.duration,o=this.iterationDuration,a=i.id;let l=0;const h=r.length;r.forEach(t=>{const s={...i};this.duration=n,this.iterationDuration=o,q(a)||(s.id=a+"-"+l),rs(s,this,ss(this,e(t,l,h,this)),t,l,h),l++})}else rs(i,this,ss(this,s),t)}else rs(t,this,ss(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(q(t)||t&&q(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return q(e)?this:(e.duration=p,e.composition=o.replace,this.add(t,e,s))}call(t,e){return q(t)||t&&!W(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return q(t)||t&&!Y(t)||(this.labels[t]=ss(this,e)),this}remove(t,e){return ue(_e(t),this,e),this}stretch(t){const e=this.duration;if(e===St(t))return this;const s=t/e,i=this.labels;Et(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return Et(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),Et(this,t=>t.revert,!0),Gt(this)}then(t){return super.then(t)}}const as=t=>new os(t).init();class ls{constructor(t,e){O.current&&O.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},r={v:1,autoplay:!1},n={};if(this.targets=[],this.animations={},this.callbacks=null,!q(t)&&!q(e)){for(let t in e){const s=e[t];tt(t)?n[t]=s:V(t,"on")?r[t]=s:i[t]=s}this.callbacks=new qe({v:0},r);for(let e in n){const s=n[e],r=H(s);let a={},l="+=0";if(r){const t=s.unit;Y(t)&&(l+=t)}else a.duration=s;a[e]=r?$t({to:l},s):l;const h=$t(i,a);h.composition=o.replace,h.autoplay=!1;const d=this.animations[e]=new qe(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(q(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return Et(d,e=>{if(X(t))for(let s=0,i=t.length;s<i;s++)q(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;q(s)||(e._ease=Le(s)),e._currentTime=0}),q(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=x,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const hs=(t,e)=>new ls(t,e),ds=(t,e)=>(+t).toFixed(e),cs=(t,e,s)=>`${t}`.padStart(e,s),us=(t,e,s)=>`${t}`.padEnd(e,s),ps=(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e,ms=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),fs=t=>t*Math.PI/180,gs=t=>180*t/Math.PI,ys=(t,e,s,i)=>i?1===i?e:Tt(t,e,1-Math.exp(-i*s*.1)):t;var vs=Object.freeze({__proto__:null,clamp:yt,damp:ys,degToRad:fs,lerp:Tt,mapRange:ms,padEnd:us,padStart:cs,radToDeg:gs,round:_t,roundPad:ds,snap:bt,wrap:ps});const _s=10*f;class bs{constructor(t={}){const e=!q(t.bounce)||!q(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/f,this.maxIterations=this.maxDuration/this.timeStep/f,this.bn=yt(Ot(t.bounce,.5),-1,1),this.pd=yt(Ot(t.duration,628),10*B.timeScale,_s*B.timeScale),this.m=yt(Ot(t.mass,1),1,_s),this.s=yt(Ot(t.stiffness,100),p,_s),this.d=yt(Ot(t.damping,10),p,_s),this.v=yt(Ot(t.velocity,0),-1e4,_s),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||x,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?ht(-n*e*s)*(1*at(i*n)+r*ot(i*n)):1===e?(1+r*n)*ht(-n*s):((1+r)*ht((-e*s+i)*n)+(1-r)*ht((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===B.timeScale?this.pd/f:this.pd;this.m=1,this.v=0,this.s=rt(2*ft/t,2),this.bn>=0?this.d=4*(1-this.bn)*ft/t:this.d=4*ft/(t*(1+this.bn)),this.s=_t(yt(this.s,p,_s),3),this.d=_t(yt(this.d,p,300),3)}calculateBDFromSD(){const t=2*ft/nt(this.s);this.pd=t*(1===B.timeScale?f:1);const e=this.d/(2*nt(this.s));this.bn=e<=1?1-this.d*t/(4*ft):4*ft/(this.d*t)-1,this.bn=_t(yt(this.bn,-1,1),3),this.pd=_t(yt(this.pd,10*B.timeScale,_s*B.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=yt(nt(o/r),p,f),h=this.zeta=n/(2*nt(o*r));h<1?(this.wd=l*nt(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*nt(h*h-1),this.b=(h*l-a)/this.wd);let d=0,c=0,u=0;for(;c<=t&&u<=e;)lt(1-this.solve(d))<s?c++:c=0,this.solverDuration=d,d+=i,u++;this.settlingDuration=_t(this.solverDuration*f,0)*B.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=yt(Ot(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=yt(Ot(t,1),10*B.timeScale,_s*B.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=yt(Ot(t,100),p,_s),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=yt(Ot(t,10),p,_s),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=yt(Ot(t,1),1,_s),this.compute()}get velocity(){return this.v}set velocity(t){this.v=yt(Ot(t,0),-1e4,_s),this.compute()}}const Ts=t=>new bs(t),xs=t=>(console.warn("createSpring() is deprecated use spring() instead"),new bs(t)),Ss=t=>{t.cancelable&&t.preventDefault()};class ws{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:x,remove:x}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class $s{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,i=0;for(;e&&e!==s;)t(e,i),e=e.parentElement,i++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const Es=(t,e)=>t&&W(t)?t(e):t;let Cs=0;class Ns{constructor(t,i={}){if(!t)return;O.current&&O.current.register(this);const r=i.x,n=i.y,o=i.trigger,a=i.modifier,l=i.releaseEase,h=l&&Le(l),d=!q(l)&&!q(l.ease),c=H(r)&&!q(r.mapTo)?r.mapTo:"translateX",u=H(n)&&!q(n.mapTo)?n.mapTo:"translateY",p=Es(i.container,this);this.containerArray=X(p)?p:null,this.$container=p&&!this.containerArray?_e(p)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=H(t)?new ws(t):_e(t)[0],this.$trigger=_e(o||t)[0],this.fixed="fixed"===Ze(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:Ts({mass:Ot(i.releaseMass,1),stiffness:Ot(i.releaseStiffness,80),damping:Ot(i.releaseDamping,20)}),this.releaseYSpring=d?l:Ts({mass:Ot(i.releaseMass,1),stiffness:Ot(i.releaseStiffness,80),damping:Ot(i.releaseDamping,20)}),this.releaseEase=h||Re.outQuint,this.hasReleaseSpring=d,this.onGrab=i.onGrab||x,this.onDrag=i.onDrag||x,this.onRelease=i.onRelease||x,this.onUpdate=i.onUpdate||x,this.onSettle=i.onSettle||x,this.onSnap=i.onSnap||x,this.onResize=i.onResize||x,this.onAfterResize=i.onAfterResize||x,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),q(r)||!0===r)f[c]=0;else if(H(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[c]=e}else!1===r&&(f[c]=0,this.disabled[0]=1);if(q(n)||!0===n)f[u]=0;else if(H(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===n&&(f[u]=0,this.disabled[1]=1);this.animate=new ls(this.$target,f),this.xProp=c,this.yProp=u,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-m,m,m,-m],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=z(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new $s(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new ge({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new ge({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!q(p),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?c:u,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=mt(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new ge({autoplay:!1,duration:150*B.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=i,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),H(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=z(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=_t(yt(nt(t*t+e*e)/r*o,a,l),5);const d=pt(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=_t(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=bt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=_t(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=bt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return _t(this.animate[this.xProp](),B.precision)}set x(t){this.setX(t,!1)}get y(){return _t(this.animate[this.yProp](),B.precision)}set y(t){this.setY(t,!1)}get progressX(){return ms(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(ms(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return ms(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(ms(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=_t(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=_t(this.useWin?e.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=s,this.scrollBounds[0]=s-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=s-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const i=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=e.innerWidth,l=this.window[1]=e.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?yt(d,a,d):d,this.scrollView[1]=h?yt(c,l,c):c,this.updateScrollCoords();const{width:v,height:_,left:b,top:T,right:x,bottom:S}=t.getBoundingClientRect();this.dragArea[2]=_t(h?yt(v,a,a):v,0),this.dragArea[3]=_t(h?yt(_,l,l):_,0);const w=Ze(t,"overflow"),$="visible"===w,E="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===s.body&&$||!E&&!$)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!X(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-v:0,c=i?this.scrollView[1]-o-_:0;this.targetBounds[0]=_t(r.top+s-(h?0:T),0),this.targetBounds[1]=_t(r.right+e-(h?a:x),0),this.targetBounds[2]=_t(r.bottom+s-(h?l:S),0),this.targetBounds[3]=_t(r.left+e-(h?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-_t(r.top-(u?yt(T,0,l):T)+o-m,0),this.containerBounds[1]=-_t(r.right-(u?yt(x,0,a):x)-d+f,0),this.containerBounds[2]=-_t(r.bottom-(u?yt(S,0,l):S)-c+g,0),this.containerBounds[3]=-_t(r.left-(u?yt(b,0,a):b)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(i,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=Es(t.container,this),o=Es(t.containerPadding,this)||0,a=X(o)?o:[o,o,o,o],l=this.x,h=this.y,d=Es(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=Es(t.dragThreshold,this),p={mouse:3,touch:7};if(U(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;q(t)||(p.mouse=t),q(e)||(p.touch=e)}this.containerArray=X(n)?n:null,this.$container=n&&!this.containerArray?_e(n)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=Ot(a,[0,0,0,0]),this.containerFriction=yt(Ot(Es(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=yt(Ot(Es(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=Es(H(i)&&!q(i.snap)?i.snap:t.snap,this),this.snapY=Es(H(r)&&!q(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Ot(Es(t.scrollSpeed,this),1.5),this.scrollThreshold=Ot(Es(t.scrollThreshold,this),20),this.dragSpeed=Ot(Es(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=Ot(Es(t.minVelocity,this),0),this.maxVelocity=Ot(Es(t.maxVelocity,this),50),this.velocityMultiplier=Ot(Es(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(yt(l,y,f),!0),this.setY(yt(h,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],l=this.scroll.x,h=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?yt(d,this.window[0],d):d,p=this.useWin?yt(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[v,_]=this.coords,[b,T,x,S]=this.scrollBounds,w=_t(yt((_-b+t)/y,-1,0)*g,0),$=_t(yt((v-T-e)/y,0,1)*g,0),E=_t(yt((_-x-s)/y,0,1)*g,0),C=_t(yt((v-S+i)/y,-1,0)*g,0);if(w||E||C||$){const[t,e]=this.disabled;let s=l,i=h;t||(s=_t(yt(l+(C||$),0,r-o),0),this.coords[0]-=l-s),e||(i=_t(yt(h+(w||E),0,n-a),0),this.coords[1]-=h-i),this.useWin?this.$scrollContainer.scrollBy(-(l-s),-(h-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,l,h]=this.pointer;this.coords[0]+=(r-l)*this.dragSpeed,this.coords[1]+=(n-h)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-l,n-h),this.angle=mt(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return ue([this],null,"x"),ue([this],null,"y"),ue([this],null,"progressX"),ue([this],null,"progressY"),ue([this.scroll]),ue([this.overshootCoords]),this}scrollInView(t,e=0,s=Re.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[l,h,d,c]=o,u=_t(yt(r-l,-m,0),0),p=_t(yt(i-h,0,m),0),f=_t(yt(r-d,0,m),0),g=_t(yt(i-c,-m,0),0);new qe(n,{x:_t(n.x+(g?g-e:p?p+e:0),0),y:_t(n.y+(u?u-e:f?f+e:0),0),duration:q(t)?350*B.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=Ke(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=Re.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,l]=this.containerPadding,h=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+l+e,p=this.isOutOfBounds([h,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=yt(bt(i,this.snapX),u,d),a=yt(bt(r,this.snapY),h,c),l=q(t)?350*B.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,l,s),n||2!==p&&3!==p||this.animate[this.yProp](a,l,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const i=t.changedTouches,r=i?i[0].clientX:t.clientX,n=i?i[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[l,h,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>h?h+(p-h)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<l?l+(m-l)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=Ze(this.$target,"zIndex",!1);Cs=(f>Cs?f:Cs)+1,this.targetStyles=Ke(this.$target,{zIndex:Cs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Ke(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,Re.out(3)),this.onGrab(this),s.addEventListener("touchmove",this),s.addEventListener("touchend",this),s.addEventListener("touchcancel",this),s.addEventListener("mousemove",this),s.addEventListener("mouseup",this),s.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let l=t.target,h=!1,d=!1,c=!1;for(;e&&l&&l!==this.$trigger;){const t=Ze(l,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=l;if(e>s){c=!0,h=t<=3,d=t>=e-s-3;break}}l=l.parentElement}c&&(!h&&!d||h&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(Ss(t),this.triggerStyles||(this.triggerStyles=Ke(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",Ss,{passive:!1}),this.$trigger.addEventListener("touchmove",Ss,{passive:!1}),this.$trigger.addEventListener("touchend",Ss),(this.dragged||!this.disabled[0]&&lt(o)>this.dragThreshold||!this.disabled[1]&&lt(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[i,r,n,a,l,h]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,v=this.releaseEase,_=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,x=this.y,S=this.computeVelocity(i-l,r-h),w=this.angle=mt(r-a,i-n),$=150*S,E=(1-this.releaseContainerFriction)*this.dragSpeed,C=T+at(w)*$,N=x+ot(w)*$,k=C>c?c+(C-c)*E:C<p?p+(C-p)*E:C,R=N>u?u+(N-u)*E:N<d?d+(N-d)*E:N,D=this.destX=yt(_t(bt(k,this.snapX),5),p,c),I=this.destY=yt(_t(bt(R,this.snapY),5),d,u),A=this.isOutOfBounds(this.containerBounds,C,N);let L=0,O=0,P=v,F=v,M=0;if(b.x=T,b.y=x,!t){const t=D===c?T>c?-1:1:T<p?-1:1,s=_t(T-D,0);g.velocity=e&&_?s?$*t/lt(s):0:S;const{ease:i,settlingDuration:r,restDuration:n}=g;L=T===D?0:_?r:r-n*B.timeScale,_&&(P=i),L>M&&(M=L)}if(!e){const e=I===u?x>u?-1:1:x<d?-1:1,s=_t(x-I,0);y.velocity=t&&_?s?$*e/lt(s):0:S;const{ease:i,settlingDuration:r,restDuration:n}=y;O=x===I?0:_?r:r-n*B.timeScale,_&&(F=i),O>M&&(M=O)}if(!_&&A&&E&&(L||O)){const t=o.blend;new qe(b,{x:{to:k,duration:.65*L},y:{to:R,duration:.65*O},ease:v,composition:t}).init(),new qe(b,{x:{to:D,duration:L},y:{to:I,duration:O},ease:v,composition:t}).init(),this.overshootTicker.stretch(pt(L,O)).restart()}else t||this.animate[this.xProp](D,L,P),e||this.animate[this.yProp](I,O,F);this.scrollInView(M,this.scrollThreshold,v);let V=!1;D!==m&&(this.snapped[0]=D,this.snapX&&(V=!0)),I!==f&&this.snapY&&(this.snapped[1]=I,this.snapY&&(V=!0)),V&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",Ss),this.$trigger.removeEventListener("touchmove",Ss),this.$trigger.removeEventListener("touchend",Ss),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=Ke(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),s.removeEventListener("touchmove",this),s.removeEventListener("touchend",this),s.removeEventListener("touchcancel",this),s.removeEventListener("mousemove",this),s.removeEventListener("mouseup",this),s.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":Ss(t)}}}const ks=(t,e)=>new Ns(t,e),Rs=(t=x)=>new ge({duration:1*B.timeScale,onComplete:t},null,0).resume(),Ds=t=>{let e;return(...s)=>{let i,r,n,o;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,e.revert());const a=t(...s);return a&&!W(a)&&a.revert&&(e=a),q(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),a||x}};class Is{constructor(t={}){O.current&&O.current.register(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||_e(i)[0]||s);const n=t.defaults,o=B.defaults,a=t.mediaQueries;if(this.defaults=n?$t(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const s=e.matchMedia(a[t]);this.mediaQueryLists[t]=s,s.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=O.current,s=O.root,i=B.defaults;O.current=this,O.root=this.root,B.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return O.current=e,O.root=s,B.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);W(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,W(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);W(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,W(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);W(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(W(s))return s(this);const i=Ds(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,l=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;l--;)i[l](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const As=t=>new Is(t),Ls=()=>{const t=s.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.body.removeChild(t),e},Os=(t,e)=>t&&W(t)?t(e):t,Bs=new Map;class Ps{constructor(t){this.element=t,this.useWin=this.element===s.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new ge({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;Et(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ge({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=_t(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ge({autoplay:!1,duration:250*B.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ge({autoplay:!1,duration:500*B.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?e:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,s=this.element;this.scrollX=_t(t?e.scrollX:s.scrollLeft,0),this.scrollY=_t(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=Ls()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){Et(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),Et(this,t=>{t.refresh(),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?e:this.element).removeEventListener("scroll",this),Bs.delete(this.element)}}const Fs=t=>{const e=t&&_e(t)[0]||s.body;let i=Bs.get(e);return i||(i=new Ps(e),Bs.set(e,i)),i},Ms=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:l,u:h}=Xt(a,Ut);let d=l;return"%"===h?d=l/100*s:h&&(d=Se(t,Ut,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},Vs=(t,e,s,i,r)=>{let n;if(Y(e)){const o=I.exec(e);if(o){const a=o[0],l=a[0],h=e.split(a),d="min"===h[0],c="max"===h[0],u=Ms(t,h[0],s,i,r),p=Ms(t,h[1],s,i,r);if(d){const e=Vt(Ms(t,"min",s),p,l);n=e<u?u:e}else if(c){const e=Vt(Ms(t,"max",s),p,l);n=e>u?u:e}else n=Vt(u,p,l)}else n=Ms(t,e,s,i,r)}else n=e;return _t(n,0)},zs=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[l]){e=i;break}}return e};let Xs=0;const Hs=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Us{constructor(t={}){O.current&&O.current.register(this);const e=Ot(t.sync,"play pause"),i=e?Le(e):null,r=e&&("linear"===e||e===we),n=e&&!(i===we&&!r),o=e&&(U(e)||!0===e||r),a=e&&Y(e)&&!n&&!o,l=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,h=a&&l.length>2;this.index=Xs++,this.id=q(t.id)?this.index:t.id,this.container=Fs(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!l,this.syncEase=n?i:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=l&&!h&&l[0]?l[0]:x,this.onSyncLeave=l&&!h&&l[1]?l[1]:x,this.onSyncEnterForward=l&&h&&l[0]?l[0]:x,this.onSyncLeaveForward=l&&h&&l[1]?l[1]:x,this.onSyncEnterBackward=l&&h&&l[2]?l[2]:x,this.onSyncLeaveBackward=l&&h&&l[3]?l[3]:x,this.onEnter=t.onEnter||x,this.onLeave=t.onLeave||x,this.onEnterForward=t.onEnterForward||x,this.onLeaveForward=t.onLeaveForward||x,this.onEnterBackward=t.onEnterBackward||x,this.onLeaveBackward=t.onLeaveBackward||x,this.onUpdate=t.onUpdate||x,this.onSyncComplete=t.onSyncComplete||x,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=Ot(t.debug,!1),this._next=null,this._prev=null,Nt(this.container,this),Rs(()=>{if(!this.reverted){if(!this.target){const e=_e(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,q(t)||(t.persist=!0),!this._params.target)){let e;q(t.targets)?Et(t,t=>{t.targets&&!e&&(e=zs(t))}):e=zs(t),this.target=e||s.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:_t(yt(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=Ot(Os(t.repeat,this),!0),this.horizontal="x"===Ot(Os(t.axis,this),"y"),this.enter=Ot(Os(t.enter,this),"end start"),this.leave=Ot(Os(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,i=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=s.createElement("div"),n=s.createElement("div"),o=s.createElement("div"),a=Hs[this.index%Hs.length],l=t.useWin,h=l?t.winWidth:t.width,d=l?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,v=e?60:g,_=e?v:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,S=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${S("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${S("sticky",0,0,e?h:g,e?g:d)}`,i||(n.style.cssText+=`background:\n ${x("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${S("relative",0,0,e?c:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${x("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const w=[" enter: "," leave: "];this.coords.forEach((t,i)=>{const r=i>1,l=(r?0:this.offset)+t,m=i%2,f=l<_,g=l>(r?e?h:d:e?c:u)-_,b=(r?m&&!f:!m&&!f)||g,T=s.createElement("div"),x=s.createElement("div"),$=e?b?"right":"left":b?"bottom":"top",E=b?(e?v:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${w[m]}${this.thresholds[i]}`,T.style.cssText=`${S("absolute",0,0,v,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${b?"end":"start"};\n border-${$}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?b?"right":"left":b?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&b||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?b?"top-left":"top-right":b?"top-left":"bottom-left"}-radius: 5px;\n border-${e?b?"bottom-left":"bottom-right":b?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(x);let C=l-E+(e?1:0);T.style[e?"left":"top"]=`${C}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),i||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Ze(t.element,"position")&&(this.debugStyles=Ke(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,i=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0)),a.parentElement;a&&a!==i.element&&a!==s.body;){const e="sticky"===Ze(a,"position")&&Ke(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const l=e.getBoundingClientRect(),h=i.scale,d=(r?l.left+i.scrollX-i.left:l.top+i.scrollY-i.top)*h,c=(r?l.width:l.height)*h,u=r?i.width:i.height,p=(r?i.scrollWidth:i.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",v="end",_="start";if(Y(m)){const t=m.split(" ");v=t[0],g=t.length>1?t[1]:g}else if(H(m)){const t=m;q(t.container)||(v=t.container),q(t.target)||(g=t.target)}else U(m)&&(v=m);if(Y(f)){const t=f.split(" ");_=t[0],y=t.length>1?t[1]:y}else if(H(f)){const t=f;q(t.container)||(_=t.container),q(t.target)||(y=t.target)}else U(f)&&(_=f);const b=Vs(e,g,c),T=Vs(e,y,c),x=b+d-u,S=T+d-p,w=Vs(e,v,u,x,S),$=Vs(e,_,u,x,S),E=b+d-w,C=T+d-$,N=C-E;this.offset=d,this.offsetStart=E,this.offsetEnd=C,this.distance=N<=0?0:N,this.thresholds=[g,y,v,_],this.coords=[b,T,w,$],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,l=a<=this.offsetStart,h=a>=this.offsetEnd,d=!l&&!h,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(l&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&U(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=_t(Tt(e,g,Tt(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return Ct(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const Ys=(t={})=>new Us(t),Ws=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,qs=(t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=Ws(r,e,s)-t,i>0?o=r:n=r}while(lt(i)>1e-7&&++a<100);return r},js=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?we:r=>0===r||1===r?r:Ws(qs(r,t,s),e,i),Gs=(t=10,e)=>{const s=e?dt:ct;return e=>s(yt(e,0,1)*t)*(1/t)},Qs=(...t)=>{const e=t.length;if(!e)return we;const s=e-1,i=t[0],r=t[s],n=[0],o=[it(i)];for(let e=1;e<s;e++){const i=t[e],r=Y(i)?i.trim().split(" "):[i],a=r[0],l=r[1];n.push(q(l)?e/s:it(l)/100),o.push(it(a))}return o.push(it(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},Js=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(yt(o,r,1))}return s.push(1),Qs(...s)};var Zs=Object.freeze({__proto__:null,Spring:bs,createSpring:xs,cubicBezier:js,eases:Re,irregular:Js,linear:Qs,spring:Ts,steps:Gs});const Ks=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(_t(t(i/e),4));return`linear(${s.join(", ")})`},ti={},ei=t=>{let e=ti[t];if(e)return e;if(e="linear",Y(t)){if(V(t,"linear")||V(t,"cubic-")||V(t,"steps")||V(t,"ease"))e=t;else if(V(t,"cubicB"))e=M(t);else{const s=Ie(t);W(s)&&(e=s===we?"linear":Ks(s))}ti[t]=e}else if(W(t)){const s=Ks(t);s&&(e=s)}else t.ease&&(e=Ks(t.ease));return e},si=["x","y","z"],ii=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...si],ri=(()=>[...si,...b.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let ni=null;const oi=(t,e,s,i,r)=>{let n=Y(e)?e:Bt(e,s,i,r);return U(n)?ii.includes(t)||V(t,"translate")?`${n}px`:V(t,"rotate")||V(t,"skew")?`${n}deg`:`${n}`:n},ai=(t,e,s,i,r,n)=>{let o="0";const a=q(i)?getComputedStyle(t)[e]:oi(e,i,t,r,n);return o=q(s)?X(i)?i.map(s=>oi(e,s,t,r,n)):a:[oi(e,s,t,r,n),a],o};class li{constructor(e,s){O.current&&O.current.register(this),j(ni)&&(!t||!q(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(b.forEach(t=>{const e=V(t,"skew"),s=V(t,"scale"),i=V(t,"rotate"),r=V(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),ni=!0):ni=!1);const i=be(e),r=i.length;r||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const n=Ot(s.autoplay,B.defaults.autoplay),o=!(!n||!n.link)&&n,a=s.alternate&&!0===s.alternate,l=s.reversed&&!0===s.reversed,h=Ot(s.loop,B.defaults.loop),c=!0===h||h===1/0?1/0:U(h)?h+1:1,u=a?l?"alternate-reverse":"alternate":l?"reverse":"normal",p=1===B.timeScale?1:f;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||B.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!n||!1!==o,this.reversed=l,this.persist=Ot(s.persist,B.defaults.persist),this.autoplay=n,this._speed=Ot(s.playbackRate,B.defaults.playbackRate),this._resolve=x,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const i=t[d],n=ri.some(t=>s.hasOwnProperty(t)),o=t.style,a=this._inlineStyles[e]={},l=Ot(s.ease,B.defaults.ease),h=Bt(l,t,e,r),m=W(h)||Y(h)?h:l,f=l.ease&&l,g=ei(m),v=(f?f.settlingDuration:Bt(Ot(s.duration,B.defaults.duration),t,e,r))*p,x=Bt(Ot(s.delay,B.defaults.delay),t,e,r)*p,S=Ot(s.composition,"replace");for(let l in s){if(!tt(l))continue;const h={},d={iterations:c,direction:u,fill:"both",easing:g,duration:v,delay:x,composite:S},m=s[l],f=!!n&&(b.includes(l)?l:_.get(l)),y=f?"transform":l;let T;if(a[y]||(a[y]=o[y]),H(m)){const s=m,n=Ot(s.ease,g),a=n.ease&&n,c=s.to,u=s.from;if(d.duration=(a?a.settlingDuration:Bt(Ot(s.duration,v),t,e,r))*p,d.delay=Bt(Ot(s.delay,x),t,e,r)*p,d.composite=Ot(s.composition,S),d.easing=ei(n),T=ai(t,l,u,c,e,r),f?(h[`--${f}`]=T,i[f]=T):h[l]=ai(t,l,u,c,e,r),Je(this,t,l,h,d),!q(u))if(f){const t=`--${f}`;o.setProperty(t,h[t][0])}else o[l]=h[l][0]}else T=X(m)?m.map(s=>oi(l,s,t,e,r)):oi(l,m,t,e,r),f?(h[`--${f}`]=T,i[f]=T):h[l]=T,Je(this,t,l,h,d)}if(n){let t=y;for(let e in i)t+=`${T[e]}var(--${e})) `;o.transform=t}}),o&&this.autoplay.link(this)}forEach(t){try{const e=Y(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=B.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===B.timeScale?1:f);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];q(r)||r===y?s.removeProperty(M(e)):t.style[e]=r}t.getAttribute("style")===y&&t.removeAttribute("style")}),this}then(t=x){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=x};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const hi={animate:(t,e)=>new li(t,e),convertEase:Ks};let di=0,ci=0;const ui=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),pi=(t,e)=>{let s=t[e];for(;s&&s.nodeType===Node.TEXT_NODE&&!s.textContent.trim();)s=s[e];return s&&s.nodeType===Node.TEXT_NODE},mi=t=>pi(t,"previousSibling")||pi(t,"nextSibling"),fi=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},gi=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},yi=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,fi(s)),i&&!e.has(i)&&e.set(i,fi(i))},vi=t=>{t.forEach((t,e)=>gi(e,t)),t.clear()},_i={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},bi=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},Ti=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+ci++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.total=1,n.delay=0,n.duration=0,n.ease=null,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.isEntering=!1,n.isLeaving=!1,n.isInlined=!1,n.hasTransform=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},xi=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,l=t.state.rootNode,h=t.parentNode,d=s.transform,c=r.style.transform,u=!!h&&h.measuredIsRemoved,p=s.position;if(o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=ui(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u,t.isInlined=t.measuredDisplay.includes("inline")&&mi(r),t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=fi(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=fi(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let m,f,g=0,y=0,v=0,_=0;if(!i){const t=e.getBoundingClientRect();g=t.left,y=t.top,v=t.width,_=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);q(e)||(a[t]=e)}if(a.left=g,a.top=y,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(m=g,f=y):(m=0,f=0);else{const e=h||l,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)m=g-s-r,f=y-i-n;else if(e===l){const t=l.properties.left,e=l.properties.top;m=g-t-l.properties.clientLeft,f=y-e-l.properties.clientTop}else m=g-s-r,f=y-i-n}return a.x=m,a.y=f,a.width=v,a.height=_,t},Si=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},wi=(t,e)=>{const s=Bt(e.ease,t.$el,t.index,t.total),i=W(s)?s:e.ease,r=!q(i)&&!q(i.ease);t.ease=r?i.ease:i,t.duration=r?i.settlingDuration:Bt(e.duration,t.$el,t.index,t.total),t.delay=Bt(e.delay,t.$el,t.index,t.total)},$i=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},Ei=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},Ci=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(gi(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(gi(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},Ni=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.layout.pendingRemoval.delete(t.$el)},ki=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class Ri{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{this.layout.pendingRemoval.delete(t.$el),t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}getNode(t){if(t&&t.dataset)return this.nodes.get(t.dataset.layoutId)}getComputedValue(t,e){const s=this.getNode(t);if(s)return s.properties[e]}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,fi(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||G(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?_i:getComputedStyle(e),a=!!n||"none"===o.display,l=!!n||"hidden"===o.visibility,h=!a&&!l,d=e.dataset.layoutId,c=ui(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=ui(i,u.$el),l=u.measuredIsVisible;if(a||!c&&(c||l||!h)){if(a&&!l&&h){xi(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}bi(u),u=Ti(e,t,this,u)}else u=Ti(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.sizeChanged=!1,u.hasVisibilityHidden=l,u.hasDisplayNone=a,u.hasVisibilitySwap=l&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),xi(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const t=this.layout,e=t.children,s=t.root,i=X(e)?e:[e],r=[],n="*"===e?s:O.root,o=[];let a=s.parentElement;for(;a&&1===a.nodeType;){const t=getComputedStyle(a);if(t.transform&&"none"!==t.transform){const t=a.style.transform||"",e=fi(a);o.push(a,t,e),a.style.transform="none"}a=a.parentElement}for(let t=0,e=i.length;t<e;t++){const e=i[t];r[t]=Y(e)?n.querySelectorAll(e):e}const l=be(r);this.nodes.clear(),this.rootNodes.clear();const h=this.registerElement(s,null);h.isTarget=!0,this.rootNode=h;const d=new Set;let c=0,u=this.nodes.size;this.nodes.forEach((t,e)=>{t.index=c++,t.total=u,t&&t.measuredIsInsideRoot&&d.add(e)});const p=new Set,m=[];for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e&&1===e.nodeType&&e!==s){if(!ui(s,e)){const t=e.dataset.layoutId;if(!t||!d.has(t))continue}p.has(e)||(p.add(e),m.push(e))}}for(let t=0,e=m.length;t<e;t++)this.ensureDetachedNode(m[t],p);for(let t=0,e=l.length;t<e;t++){const e=l[t],s=this.getNode(e);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY,this.forEachNode(Ci);for(let t=0,e=o.length;t<e;t+=3){const e=o[t],s=o[t+1],i=o[t+2];s&&""!==s?e.style.transform=s:e.style.removeProperty("transform"),gi(e,i)}return this}}function Di(t){const e={},s={};for(let i in t){const r=t[i];"duration"===i||"delay"===i||"ease"===i?s[i]=r:e[i]=r}return[e,s]}class Ii{constructor(t,e={}){O.current&&O.current.register(this);const s=Di(e.swapAt),i=Di(e.enterFrom),r=Di(e.leaveTo),n=e.properties;if(e.duration=Ot(e.duration,350),e.delay=Ot(e.delay,0),e.ease=Ot(e.ease,"inOut(3.5)"),this.params=e,this.root=be(t)[0],this.id=di++,this.children=e.children||"*",this.absoluteCoords=!1,this.swapAtParams=$t(e.swapAt||{opacity:0},{ease:"inOut(1.75)"}),this.enterFromParams=e.enterFrom||{opacity:0},this.leaveToParams=e.leaveTo||{opacity:0},this.properties=new Set(["opacity","fontSize","color","backgroundColor","borderRadius","border","filter","clipPath"]),s[0])for(let t in s[0])this.properties.add(t);if(i[0])for(let t in i[0])this.properties.add(t);if(r[0])for(let t in r[0])this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoval=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new Ri(this),this.newState=new Ri(this),this.timeline=null,this.transformAnimation=null,this.animating=[],this.swapping=[],this.leaving=[],this.entering=[],this.oldState.record(),vi(this.transitionMuteStore)}revert(){return this.root.classList.remove("is-animated"),this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.animating.length=this.swapping.length=this.leaving.length=this.entering.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>vi(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode(Ei),this}animate(t={}){const e={ease:Ot(t.ease,this.params.ease),delay:Ot(t.delay,this.params.delay),duration:Ot(t.duration,this.params.duration)},s={},i=Ot(t.onComplete,this.params.onComplete),r=Ot(t.onPause,this.params.onPause);for(let e in L)"ease"!==e&&"duration"!==e&&"delay"!==e&&(q(t[e])?q(this.params[e])||(s[e]=this.params[e]):s[e]=t[e]);s.onComplete=()=>{this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(t=>{Ni(t),Ei(t)});for(let t=0,e=S.length;t<e;t++){const e=S[t];e.style.transform=f.getComputedValue(e,"transform")}this.root.classList.contains("is-animated")&&(this.root.classList.remove("is-animated"),i&&i(this.timeline)),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||vi(this.transitionMuteStore)})},s.onPause=()=>{this.root.classList.contains("is-animated")&&(this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(Ni),this.root.classList.remove("is-animated"),i&&i(this.timeline),r&&r(this.timeline))},s.composition=!1;const n=$t($t(t.swapAt||{},this.swapAtParams),e),o=$t($t(t.enterFrom||{},this.enterFromParams),e),a=$t($t(t.leaveTo||{},this.leaveToParams),e),[l,h]=Di(n),[d,c]=Di(o),[u,p]=Di(a),m=this.oldState,f=this.newState,g=this.animating,y=this.swapping,v=this.entering,_=this.leaving,b=this.pendingRemoval;g.length=y.length=v.length=_.length=0,m.forEachRootNode(yi),f.record(),f.forEachRootNode($i);const T=[],x=[],S=[],w=[],$=f.rootNode,E=$.$el;f.forEachRootNode(t=>{const e=t.$el,s=t.id,i=t.parentNode,r=!!i&&i.branchAdded,n=!!i&&i.branchRemoved,o=!!i&&i.branchNotRendered;let a=m.nodes.get(s);const l=!a;l?(a=ki(t,{},m),m.nodes.set(s,a),a.measuredIsRemoved=!0):a.measuredIsRemoved&&!t.measuredIsRemoved&&(ki(t,a,m),a.measuredIsRemoved=!0);const h=a.parentNode,c=(h?h.id:null)!==(i?i.id:null),p=a.$el!==t.$el,y=a.measuredIsRemoved,x=t.measuredIsRemoved;if(!a.measuredIsRemoved&&!x&&!l&&(c||p)){const t=a.properties.left,e=a.properties.top,s=i||f.rootNode,r=s.id?m.nodes.get(s.id):null,n=r?r.properties.left:s.properties.left,o=r?r.properties.top:s.properties.top,l=r?r.properties.clientLeft:s.properties.clientLeft,h=r?r.properties.clientTop:s.properties.clientTop;a.properties.x=t-n-l,a.properties.y=e-o-h}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=a.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const S=b.has(e),w=a.measuredIsVisible,E=t.measuredIsVisible,C=!w&&E&&!o,N=!x&&(y||S)&&!r,k=x&&!y&&!n,R=k||x&&S&&!n;t.branchAdded=r||N,t.branchRemoved=n||R,t.branchNotRendered=o||x,x&&w&&(t.$el.style.display=a.measuredDisplay,t.$el.style.visibility="visible",ki(a,t,f)),k?(t.isTarget&&(_.push(e),t.isLeaving=!0),b.add(e)):!x&&S&&b.delete(e),N&&!o||C?(Si(a,d),t.isTarget&&(v.push(e),t.isEntering=!0)):R&&!o&&Si(t,u),t===$||!t.isTarget||t.isEntering||t.isLeaving||g.push(e),T.push(e)});let C=0,N=0,k=0;f.forEachRootNode(t=>{const s=t.$el,i=t.parentNode,r=m.nodes.get(t.id),n=t.properties,o=r.properties;let a=i!==$&&i;for(;a&&!a.isTarget&&a!==$;)a=a.parentNode;const d=g.length;t===$?(t.index=0,t.total=d,wi(t,e)):t.isEntering?(t.index=a?a.index:C,t.total=a?d:v.length,wi(t,c),C++):t.isLeaving?(t.index=a?a.index:N,t.total=a?d:_.length,N++,wi(t,p)):t.isTarget?(t.index=k++,t.total=d,wi(t,e)):(t.index=a?a.index:0,t.total=d,wi(t,h)),r.index=t.index,r.total=t.total;for(let e in n)n[e]=Bt(n[e],s,t.index,t.total),o[e]=Bt(o[e],s,r.index,r.total);const u=Math.abs(n.width-o.width)>1,f=Math.abs(n.height-o.height)>1;if(t.sizeChanged=u||f,t.isTarget&&(!t.measuredIsRemoved&&r.measuredIsVisible||t.measuredIsRemoved&&t.measuredIsVisible)){t.isInlined||"none"===n.transform&&"none"===o.transform||(t.hasTransform=!0,S.push(s));for(let t in n)if("transform"!==t&&n[t]!==o[t]){x.push(s);break}}t.isTarget||(y.push(s),t.sizeChanged&&i&&i.isTarget&&i.sizeChanged&&(!t.isInlined&&l.transform&&(t.hasTransform=!0,S.push(s)),w.push(s)))});const R={delay:t=>f.getNode(t).delay,duration:t=>f.getNode(t).duration,ease:t=>f.getNode(t).ease};if(s.defaults=R,this.timeline=as(s),!x.length&&!S.length&&!y.length)return vi(this.transitionMuteStore),this.timeline.complete();if(T.length){this.root.classList.add("is-animated");for(let t=0,e=T.length;t<e;t++){const e=T[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties;r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||e.style.setProperty("display","block","important"),(e!==E||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===E&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px"),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none")}m.scrollX===window.scrollX&&m.scrollY===window.scrollY||requestAnimationFrame(()=>window.scrollTo(m.scrollX,m.scrollY));for(let t=0,e=x.length;t<e;t++){const e=x[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties,o=r.properties;let a=!1;const l={composition:"none"};r.isInlined||(n.width!==o.width&&(l.width=[n.width,o.width],a=!0),n.height!==o.height&&(l.height=[n.height,o.height],a=!0),r.hasTransform||(l.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],a=!0)),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(l[t]=[e,s],a=!0)}),a&&this.timeline.add(e,l,0)}}if(y.length){for(let t=0,e=y.length;t<e;t++){const e=y[t],s=m.getNode(e);if(!s.isInlined){const t=s.properties;e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${t.x}px ${t.y}px`}this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${m.getComputedValue(e,t)}`)})}for(let t=0,e=y.length;t<e;t++){const e=y[t],s=f.getNode(e),i=s.properties;this.timeline.call(()=>{s.isInlined||(e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${f.getComputedValue(e,t)}`)})},s.delay+s.duration/2)}if(w.length){const t=Le(f.nodes.get(w[0].dataset.layoutId).ease),e=e=>1-t(1-e),s={};if(l)for(let t in l)"transform"!==t&&(s[t]=[{from:e=>m.getComputedValue(e,t),to:l[t]},{from:l[t],to:e=>f.getComputedValue(e,t),ease:e}]);this.timeline.add(w,s,0)}}const D=S.length;if(D){for(let t=0;t<D;t++){const e=S[t];if(e.style.translate=`${m.getComputedValue(e,"x")}px ${m.getComputedValue(e,"y")}px`,e.style.transform=m.getComputedValue(e,"transform"),w.includes(e)){const t=f.getNode(e);t.ease=Bt(n.ease,e,t.index,t.total),t.duration=Bt(n.duration,e,t.index,t.total)}}this.transformAnimation=hi.animate(S,{translate:t=>`${f.getComputedValue(t,"x")}px ${f.getComputedValue(t,"y")}px`,transform:t=>{const e=f.getComputedValue(t,"transform");if(!w.includes(t))return e;const s=m.getComputedValue(t,"transform"),i=f.getNode(t);return[s,Bt(l.transform,t,i.index,i.total),e]},autoplay:!1,persist:!0,...R}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e)}}const Ai=(t,e)=>new Ii(t,e),Li=vs,Oi={},Bi=(t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s),Pi=t=>(...e)=>{const s=t(...e);return new Proxy(x,{apply:(t,e,[i])=>s(i),get:(t,e)=>Pi((...t)=>{const i=Oi[e](...t);return t=>i(s(t))})})},Fi=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?Pi(Bi(e,s)):e)(...t);return Oi[t]||(Oi[t]=i),i},Mi=Fi("roundPad",Li.roundPad),Vi=Fi("padStart",Li.padStart),zi=Fi("padEnd",Li.padEnd),Xi=Fi("wrap",Li.wrap),Hi=Fi("mapRange",Li.mapRange),Ui=Fi("degToRad",Li.degToRad),Yi=Fi("radToDeg",Li.radToDeg),Wi=Fi("snap",Li.snap),qi=Fi("clamp",Li.clamp),ji=Fi("round",Li.round),Gi=Fi("lerp",Li.lerp,1),Qi=Fi("damp",Li.damp,1),Ji=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let Zi=0;const Ki=(t,e=0,s=1,i=0)=>{let r=void 0===t?Zi++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},tr=t=>t[Ji(0,t.length-1)],er=t=>{let e,s,i=t.length;for(;i;)s=Ji(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},sr=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!q(o),l=a&&!q(o.ease)?o.ease:a?Le(o):null,h=e.grid,d=e.axis,c=e.total,u=q(r)||0===r||"first"===r,p="center"===r,m="last"===r,f="random"===r,g=X(t),v=e.use,_=it(g?t[0]:t),b=g?it(t[1]):0,T=k.exec((g?t[1]:t)+y),x=e.start||0+(g?_:0);let S=u?0:U(r)?r:0;return(t,r,o,a)=>{const[u]=be(t),y=q(c)?o:c,w=!q(v)&&(W(v)?v(u,r,y):Mt(u,v)),$=U(w)||Y(w)&&U(+w)?+w:r;if(p&&(S=(y-1)/2),m&&(S=y-1),!s.length){for(let t=0;t<y;t++){if(h){const e=p?(h[0]-1)/2:S%h[0],i=p?(h[1]-1)/2:ct(S/h[0]),r=e-t%h[0],n=i-ct(t/h[0]);let o=nt(r*r+n*n);"x"===d&&(o=-r),"y"===d&&(o=-n),s.push(o)}else s.push(lt(S-t));i=pt(...s)}l&&(s=s.map(t=>l(t/i)*i)),n&&(s=s.map(t=>d?t<0?-1*t:-t:lt(i-t))),f&&(s=er(s))}const E=g?(b-_)/i:_;let C=(a?ss(a,q(e.start)?a.iterationDuration:x):x)+(E*_t(s[$],2)||0);return e.modifier&&(C=e.modifier(C)),T&&(C=`${C}${T[2]}`),C}};var ir=Object.freeze({__proto__:null,$:be,clamp:qi,cleanInlineStyles:Gt,createSeededRandom:Ki,damp:Qi,degToRad:Ui,get:Ze,keepTime:Ds,lerp:Gi,mapRange:Hi,padEnd:zi,padStart:Vi,radToDeg:Yi,random:Ji,randomPick:tr,remove:ts,round:ji,roundPad:Mi,set:Ke,shuffle:er,snap:Wi,stagger:sr,sync:Rs,wrap:Xi});const rr=t=>{const e=_e(t)[0];return e&&G(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},nr=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},or=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[h],o=t.getCTM(),a=0===s;return{from:0,to:r,modifier:i=>{const l=i+s*r;if("a"===e){const e=nr(t,r,l,-1,a),s=nr(t,r,l,1,a);return 180*mt(s.y-e.y,s.x-e.x)/ft}{const s=nr(t,r,l,0,a);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},ar=(t,e=0)=>{const s=rr(t);if(s)return{translateX:or(s,"x",e),translateY:or(s,"y",e),rotate:or(s,"a",e)}},lr=t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(nt(s.a*s.a+s.b*s.b)+nt(s.c*s.c+s.d*s.d))/2)}return e},hr=(t,e,s)=>{const i=f,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const l=new Proxy(t,{get(t,e){const s=t[e];return e===u?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],l=+s[1],h=lr(o),d=-1e3*r*h,c=l*i*h+d,u=i*h+(0===r&&1===l||1===r&&0===l?0:10*h)-c;if("butt"!==n){const e=r===l?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:W(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),l.setAttribute("draw",`${e} ${s}`)),l},dr=(t,e=0,s=0)=>_e(t).map(t=>hr(t,e,s)),cr=(t,e=.33)=>s=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const i=rr(t);if(!i)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(i.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${i.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const r="path"===s.tagName,n=r?" ":",",o=s[c];o&&s.setAttribute(r?"d":"points",o);let a="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),h=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<h;e++){const d=e/(h-1),c=s.getPointAtLength(t*d),u=i.getPointAtLength(o*d),p=r?0===e?"M":"L":"";a+=p+_t(c.x,3)+n+c.y+" ",l+=p+_t(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[c]=l,[a,l]};var ur=Object.freeze({__proto__:null,createDrawable:dr,createMotionPath:ar,morphTo:cr});const pr="undefined"!=typeof Intl&&Intl.Segmenter,mr=/\{value\}/g,fr=/\{i\}/g,gr=/(\s+)/,yr=/^\s+$/,vr="line",_r="word",br="char",Tr="data-line";let xr=null,Sr=null,wr=null;const $r=t=>t.isWordLike||" "===t.segment||U(+t.segment),Er=t=>t.setAttribute("aria-hidden","true"),Cr=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Nr={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},kr=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&kr(e)}},Rr=(t,e,s)=>{const i=t.getAttribute(Tr);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&yr.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&yr.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)Rr(t.children[r],e,s);return s},Dr=(t,e={})=>{let s="";const i=Y(e.class)?` class="${e.class}"`:"",r=Ot(e.clone,!1),n=Ot(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},Ir=(t,e,s,i,r,n,o,a,l)=>{const h=r===vr,d=r===br,c=`_${r}_`,u=W(t)?t(s):t,p=h?"block":"inline-block";wr.innerHTML=u.replace(mr,`<i class="${c}"></i>`).replace(fr,`${d?l:h?o:a}`);const m=wr.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),v=y.length;if(v){f.style.display=p,g.style.display=p,g.setAttribute(Tr,`${o}`),h||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${l}`));let t=v;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,h?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${Nr[r]}`),f};class Ar{constructor(e,i={}){xr||(xr=pr?new pr([],{granularity:_r}):{segment:t=>{const e=[],s=t.split(gr);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!yr.test(i)})}return e}}),Sr||(Sr=pr?new pr([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!wr&&t&&(wr=s.createElement("template")),O.current&&O.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:l,debug:h}=i,d=(e=X(e)?e[0]:e)&&e.nodeType?e:(ve(e)||[])[0],c=!0===o?{}:o,u=!0===r||q(r)?{}:r,p=!0===n?{}:n;this.debug=Ot(h,!1),this.includeSpaces=Ot(l,!1),this.accessible=Ot(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=H(c)?Dr(vr,c):c,this.wordTemplate=H(u)||this.linesOnly?Dr(_r,u):u,this.charTemplate=H(p)?Dr(br,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?s.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!W(t))return console.warn("Effect must return a function.");const e=Ds(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>W(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,i=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],l=this.words,h=this.chars,d=xr.segment(o),c=s.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=$r(t);if(!u||s&&u&&$r(u))a.push(e);else{const t=a.length-1,s=a[t];gr.test(s)||gr.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=i?Sr.segment(p):null,f=i?s.createDocumentFragment():s.createTextNode(u?o+" ":o);if(i){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=s.createTextNode(a);Ir(i,h,d,f,br,n,-1,l.length,h.length)}}e?Ir(e,l,f,c,_r,n,-1,l.length,h.length):i?c.appendChild(f):c.appendChild(s.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(s.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,i=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==s.fonts.status,l=r&&a;this.ready=!r||a,(l||t)&&this.effectsCleanups.forEach(t=>W(t)&&t(this)),i||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),l&&(i&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Cr(e,_r))),o&&(l||n)&&(this.chars=Cr(e,br));const h=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=h.length;t<e;t++){const e=h[t],{top:s,height:i}=e.getBoundingClientRect();!q(d)&&s-d>.5*i&&c++,e.setAttribute(Tr,`${c}`);const r=e.querySelectorAll(`[${Tr}]`);let n=r.length;for(;n--;)r[n].setAttribute(Tr,`${c}`);d=s}if(l){const t=s.createDocumentFragment(),i=new Set,a=[];for(let t=0;t<c+1;t++){const s=e.cloneNode(!0);Rr(s,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&i.add(e),e.removeChild(t))}),a.push(s)}i.forEach(kr);for(let e=0,s=a.length;e<s;e++)Ir(r,this.lines,a[e],t,vr,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Cr(e,_r)),o&&(this.chars=Cr(e,br))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(l||!i)){const t=s.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach(Er),this.words.forEach(Er),this.chars.forEach(Er)}return this.width=e.offsetWidth,(l||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const Lr=(t,e)=>new Ar(t,e),Or=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new Ar(t,e));var Br=Object.freeze({__proto__:null,TextSplitter:Ar,split:Or,splitText:Lr});export{be as $,ls as Animatable,Ii as AutoLayout,Ns as Draggable,qe as JSAnimation,Is as Scope,Us as ScrollObserver,bs as Spring,Ar as TextSplitter,os as Timeline,ge as Timer,li as WAAPIAnimation,je as animate,qi as clamp,Gt as cleanInlineStyles,hs as createAnimatable,ks as createDraggable,dr as createDrawable,Ai as createLayout,ar as createMotionPath,As as createScope,Ki as createSeededRandom,xs as createSpring,as as createTimeline,ye as createTimer,js as cubicBezier,Qi as damp,Ui as degToRad,Re as eases,Zs as easings,se as engine,Ze as get,Js as irregular,Ds as keepTime,Gi as lerp,Qs as linear,Hi as mapRange,cr as morphTo,Ys as onScroll,zi as padEnd,Vi as padStart,Yi as radToDeg,Ji as random,tr as randomPick,ts as remove,ji as round,Mi as roundPad,Bs as scrollContainers,Ke as set,er as shuffle,Wi as snap,Or as split,Lr as splitText,Ts as spring,sr as stagger,Gs as steps,ur as svg,Rs as sync,Br as text,ir as utils,hi as waapi,Xi as wrap};
diff --git a/dist/bundles/anime.umd.js b/dist/bundles/anime.umd.js
index b3c67078..418d934a 100644
--- a/dist/bundles/anime.umd.js
+++ b/dist/bundles/anime.umd.js
@@ -1,8 +1,8 @@
/**
* Anime.js - UMD bundle
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
// Global types
@@ -22,7 +22,7 @@
* @property {Number|FunctionValue} [duration]
* @property {Number|FunctionValue} [delay]
* @property {Number} [loopDelay]
- * @property {EasingParam} [ease]
+ * @property {EasingParam|FunctionValue} [ease]
* @property {'none'|'replace'|'blend'|compositionTypes} [composition]
* @property {(v: any) => any} [modifier]
* @property {Callback<Tickable>} [onBegin]
@@ -187,7 +187,7 @@
* @param {Target} target - The animated target
* @param {Number} index - The target index
* @param {Number} length - The total number of animated targets
- * @return {Number|String|TweenObjectValue|Array.<Number|String|TweenObjectValue>}
+ * @return {Number|String|TweenObjectValue|EasingParam|Array.<Number|String|TweenObjectValue>}
*/
/**
@@ -255,7 +255,7 @@
// JSAnimation types
/**
- * @typedef {Number|String|FunctionValue} TweenParamValue
+ * @typedef {Number|String|FunctionValue|EasingParam} TweenParamValue
*/
/**
@@ -270,7 +270,7 @@
* @typedef {Object} TweenParamsOptions
* @property {TweenParamValue} [duration]
* @property {TweenParamValue} [delay]
- * @property {EasingParam} [ease]
+ * @property {EasingParam|FunctionValue} [ease]
* @property {TweenModifier} [modifier]
* @property {TweenComposition} [composition]
*/
@@ -379,7 +379,7 @@
* @param {DOMTarget} target - The animated target
* @param {Number} index - The target index
* @param {Number} length - The total number of animated targets
- * @return {WAAPITweenValue}
+ * @return {WAAPITweenValue|WAAPIEasingParam}
*/
/**
@@ -405,7 +405,7 @@
* @property {Number} [playbackRate]
* @property {Number|WAAPIFunctionValue} [duration]
* @property {Number|WAAPIFunctionValue} [delay]
- * @property {WAAPIEasingParam} [ease]
+ * @property {WAAPIEasingParam|WAAPIFunctionValue} [ease]
* @property {CompositeOperation} [composition]
* @property {Boolean} [persist]
* @property {Callback<WAAPIAnimation>} [onComplete]
@@ -807,7 +807,7 @@
const devTools = isBrowser && win.AnimeJSDevTools;
- const globalVersions = { version: '4.3.0-beta.2', engine: null };
+ const globalVersions = { version: '4.3.0', engine: null };
if (isBrowser) {
if (!win.AnimeJS) win.AnimeJS = [];
@@ -855,9 +855,9 @@
/**@param {any} a @return {Boolean} */
const isHex = a => hexTestRgx.test(a);
/**@param {any} a @return {Boolean} */
- const isRgb = a => stringStartsWith(a, 'rgb');
+ const isRgb = a => stringStartsWith(a, 'rgb') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
- const isHsl = a => stringStartsWith(a, 'hsl');
+ const isHsl = a => stringStartsWith(a, 'hsl') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
const isCol = a => isHex(a) || isRgb(a) || isHsl(a);
/**@param {any} a @return {Boolean} */
@@ -2900,10 +2900,11 @@
/**
* Imediatly completes the timer, cancels it and triggers the onComplete callback
+ * @param {Boolean|Number} [muteCallbacks]
* @return {this}
*/
- complete() {
- return this.seek(this.duration).cancel();
+ complete(muteCallbacks = 0) {
+ return this.seek(this.duration, muteCallbacks).cancel();
}
/**
@@ -3529,10 +3530,13 @@
tweenToValue = computedToValue;
}
const tweenFromValue = getFunctionValue(key.from, target, ti, tl);
- const keyEasing = key.ease;
+ const easeToParse = key.ease || tEasing;
+
+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
- // Easing are treated differently and don't accept function based value to prevent having to pass a function wrapper that returns an other function all the time
- const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing || tEasing;
+ const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
// Calculate default individual keyframe duration by dividing the tl of keyframes
const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);
// Default delay value should only be applied to the first tween
@@ -7475,8 +7479,6 @@
console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);
}
- const ease = setValue(params.ease, parseWAAPIEasing(globals.defaults.ease));
- const spring = /** @type {Spring} */(ease).ease && ease;
const autoplay = setValue(params.autoplay, globals.defaults.autoplay);
const scroll = autoplay && /** @type {ScrollObserver} */(autoplay).link ? autoplay : false;
const alternate = params.alternate && /** @type {Boolean} */(params.alternate) === true;
@@ -7487,8 +7489,6 @@
const direction = alternate ? reversed ? 'alternate-reverse' : 'alternate' : reversed ? 'reverse' : 'normal';
/** @type {FillMode} */
const fill = 'both'; // We use 'both' here because the animation can be reversed during playback
- /** @type {String} */
- const easing = parseWAAPIEasing(ease);
const timeScale = (globals.timeScale === 1 ? 1 : K);
/** @type {DOMTargetsArray}] */
@@ -7529,6 +7529,15 @@
const elStyle = $el.style;
const inlineStyles = this._inlineStyles[i] = {};
+ const easeToParse = setValue(params.ease, globals.defaults.ease);
+
+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
+ const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;
+ /** @type {String} */
+ const easing = parseWAAPIEasing(keyEasing);
+
/** @type {Number} */
const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;
/** @type {Number} */
@@ -7553,7 +7562,7 @@
let parsedPropertyValue;
if (isObj(propertyValue)) {
const tweenOptions = /** @type {WAAPITweenOptions} */(propertyValue);
- const tweenOptionsEase = setValue(tweenOptions.ease, ease);
+ const tweenOptionsEase = setValue(tweenOptions.ease, easing);
const tweenOptionsSpring = /** @type {Spring} */(tweenOptionsEase).ease && tweenOptionsEase;
const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;
const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;
@@ -7792,34 +7801,54 @@
+
+
/**
* @typedef {DOMTargetSelector|Array<DOMTargetSelector>} LayoutChildrenParam
*/
/**
- * @typedef {Record<String, Number|String>} LayoutStateParams
+ * @typedef {Object} LayoutAnimationTimingsParams
+ * @property {Number|FunctionValue} [delay]
+ * @property {Number|FunctionValue} [duration]
+ * @property {EasingParam|FunctionValue} [ease]
*/
/**
- * @typedef {Object} LayoutAnimationParams
+ * @typedef {Record<String, Number|String|FunctionValue>} LayoutStateAnimationProperties
+ */
+
+ /**
+ * @typedef {LayoutStateAnimationProperties & LayoutAnimationTimingsParams} LayoutStateParams
+ */
+
+ /**
+ * @typedef {Object} LayoutSpecificAnimationParams
* @property {Number|FunctionValue} [delay]
* @property {Number|FunctionValue} [duration]
- * @property {EasingParam} [ease]
- * @property {LayoutStateParams} [frozen]
- * @property {LayoutStateParams} [added]
- * @property {LayoutStateParams} [removed]
- * @property {Callback<AutoLayout>} [onComplete]
+ * @property {EasingParam|FunctionValue} [ease]
+ * @property {EasingParam} [playbackEase]
+ * @property {LayoutStateParams} [swapAt]
+ * @property {LayoutStateParams} [enterFrom]
+ * @property {LayoutStateParams} [leaveTo]
*/
/**
- * @typedef {LayoutAnimationParams & {
- * children?: LayoutChildrenParam,
- * properties?: Array<String>,
- * }} AutoLayoutParams
+ * @typedef {LayoutSpecificAnimationParams & TimerParams & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} LayoutAnimationParams
*/
/**
- * @typedef {Record<String, Number|String> & {
+ * @typedef {Object} LayoutOptions
+ * @property {LayoutChildrenParam} [children]
+ * @property {Array<String>} [properties]
+ */
+
+ /**
+ * @typedef {LayoutAnimationParams & LayoutOptions} AutoLayoutParams
+ */
+
+ /**
+ * @typedef {Record<String, Number|String|FunctionValue> & {
* transform: String,
* x: Number,
* y: Number,
@@ -7840,13 +7869,15 @@
* @property {Number} total
* @property {Number} delay
* @property {Number} duration
+ * @property {EasingParam} ease
* @property {DOMTarget} $measure
* @property {LayoutSnapshot} state
* @property {AutoLayout} layout
* @property {LayoutNode|null} parentNode
* @property {Boolean} isTarget
+ * @property {Boolean} isEntering
+ * @property {Boolean} isLeaving
* @property {Boolean} hasTransform
- * @property {Boolean} isAnimated
* @property {Array<String>} inlineStyles
* @property {String|null} inlineTransforms
* @property {String|null} inlineTransition
@@ -7987,7 +8018,7 @@
* @param {DOMTarget} $el
* @param {LayoutNode|null} parentNode
* @param {LayoutSnapshot} state
- * @param {LayoutNode} [recycledNode]
+ * @param {LayoutNode} recycledNode
* @return {LayoutNode}
*/
const createNode = ($el, parentNode, state, recycledNode) => {
@@ -8001,12 +8032,15 @@
node.total = 1;
node.delay = 0;
node.duration = 0;
+ node.ease = null;
node.state = state;
node.layout = state.layout;
node.parentNode = parentNode || null;
node.isTarget = false;
+ node.isEntering = false;
+ node.isLeaving = false;
+ node.isInlined = false;
node.hasTransform = false;
- node.isAnimated = false;
node.inlineStyles = [];
node.inlineTransforms = null;
node.inlineTransition = null;
@@ -8014,7 +8048,6 @@
node.branchRemoved = false;
node.branchNotRendered = false;
node.sizeChanged = false;
- node.isInlined = false;
node.hasVisibilitySwap = false;
node.hasDisplayNone = false;
node.hasVisibilityHidden = false;
@@ -8157,7 +8190,7 @@
/**
* @param {LayoutNode} node
- * @param {LayoutStateParams} [props]
+ * @param {LayoutStateAnimationProperties} [props]
*/
const updateNodeProperties = (node, props) => {
if (!props) return;
@@ -8166,6 +8199,19 @@
}
};
+ /**
+ * @param {LayoutNode} node
+ * @param {LayoutAnimationTimingsParams} params
+ */
+ const updateNodeTimingParams = (node, params) => {
+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);
+ const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;
+ const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
+ node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);
+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);
+ };
+
/**
* @param {LayoutNode} node
*/
@@ -8240,9 +8286,9 @@
node.$measure.style.removeProperty('visibility');
}
}
- if (node.measuredIsRemoved) {
- node.layout.pendingRemoved.delete(node.$el);
- }
+ // if (node.measuredIsRemoved) {
+ node.layout.pendingRemoval.delete(node.$el);
+ // }
};
/**
@@ -8292,6 +8338,7 @@
*/
revert() {
this.forEachNode(node => {
+ this.layout.pendingRemoval.delete(node.$el);
node.$el.removeAttribute('data-layout-id');
node.$measure.removeAttribute('data-layout-id');
});
@@ -8303,34 +8350,22 @@
/**
* @param {DOMTarget} $el
- * @return {LayoutNodeProperties|undefined}
+ * @return {LayoutNode}
*/
- get($el) {
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- return node.properties;
+ getNode($el) {
+ if (!$el || !$el.dataset) return;
+ return this.nodes.get($el.dataset.layoutId);
}
/**
* @param {DOMTarget} $el
* @param {String} prop
- * @return {Number|String|undefined}
+ * @return {Number|String}
*/
- getValue($el, prop) {
- if (!$el || !$el.dataset) {
- console.warn(`No element found on state (${$el})`);
- return;
- }
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- const value = node.properties[prop];
- if (!isUnd(value)) return getFunctionValue(value, $el, node.index, node.total);
+ getComputedValue($el, prop) {
+ const node = this.getNode($el);
+ if (!node) return;
+ return /** @type {Number|String} */(node.properties[prop]);
}
/**
@@ -8391,10 +8426,10 @@
const $parent = /** @type {LayoutNode|null} */(stack.pop());
/** @type {DOMTarget|null} */
const $current = /** @type {DOMTarget|null} */(stack.pop());
+
if (!$current || $current.nodeType !== 1 || isSvg($current)) continue;
const skipMeasurements = $parent ? $parent.measuredIsRemoved : false;
-
const computedStyle = skipMeasurements ? hiddenComputedStyle : getComputedStyle($current);
const hasDisplayNone = skipMeasurements ? true : computedStyle.display === 'none';
const hasVisibilityHidden = skipMeasurements ? true : computedStyle.visibility === 'hidden';
@@ -8441,11 +8476,10 @@
node.branchRemoved = false;
node.branchNotRendered = false;
node.isTarget = false;
- node.isAnimated = false;
+ node.sizeChanged = false;
node.hasVisibilityHidden = hasVisibilityHidden;
node.hasDisplayNone = hasDisplayNone;
node.hasVisibilitySwap = (hasVisibilityHidden && !node.measuredHasVisibilityHidden) || (hasDisplayNone && !node.measuredHasDisplayNone);
- // node.hasVisibilitySwap = (hasVisibilityHidden !== node.measuredHasVisibilityHidden) || (hasDisplayNone !== node.measuredHasDisplayNone);
this.nodes.set(node.id, node);
@@ -8464,6 +8498,7 @@
$parent._tail = node;
}
} else {
+ // Each disconnected subtree becomes its own root in the snapshot graph
this.rootNodes.add(node);
}
@@ -8507,11 +8542,29 @@
* @return {this}
*/
record() {
- const { children, root } = this.layout;
+ const layout = this.layout;
+ const children = layout.children;
+ const root = layout.root;
const toParse = isArr(children) ? children : [children];
const scoped = [];
const scopeRoot = children === '*' ? root : scope.root;
+ // Mute transition and transforms of root ancestors before recording the state
+
+ /** @type {Array<DOMTarget|String|null>} */
+ const rootAncestorTransformStore = [];
+ let $ancestor = root.parentElement;
+ while ($ancestor && $ancestor.nodeType === 1) {
+ const computedStyle = getComputedStyle($ancestor);
+ if (computedStyle.transform && computedStyle.transform !== 'none') {
+ const inlineTransform = $ancestor.style.transform || '';
+ const inlineTransition = muteElementTransition($ancestor);
+ rootAncestorTransformStore.push($ancestor, inlineTransform, inlineTransition);
+ $ancestor.style.transform = 'none';
+ }
+ $ancestor = $ancestor.parentElement;
+ }
+
for (let i = 0, l = toParse.length; i < l; i++) {
const child = toParse[i];
scoped[i] = isStr(child) ? scopeRoot.querySelectorAll(child) : child;
@@ -8527,9 +8580,13 @@
rootNode.isTarget = true;
this.rootNode = rootNode;
- // Track ids of nodes that belong to the current root to filter detached matches
const inRootNodeIds = new Set();
+ // Update index and total for inital timing calculation
+ let index = 0, total = this.nodes.size;
this.nodes.forEach((node, id) => {
+ node.index = index++;
+ node.total = total;
+ // Track ids of nodes that belong to the current root to filter detached matches
if (node && node.measuredIsInsideRoot) {
inRootNodeIds.add(id);
}
@@ -8559,7 +8616,7 @@
for (let i = 0, l = parsedChildren.length; i < l; i++) {
const $el = parsedChildren[i];
- const node = this.nodes.get($el.dataset.layoutId);
+ const node = this.getNode($el);
if (node) {
let cur = node;
while (cur) {
@@ -8573,18 +8630,52 @@
this.scrollX = window.scrollX;
this.scrollY = window.scrollY;
- const total = this.nodes.size;
-
this.forEachNode(restoreNodeTransform);
- this.forEachNode((node, i) => {
- node.index = i;
- node.total = total;
- });
+
+ // Restore transition and transforms of root ancestors
+
+ for (let i = 0, l = rootAncestorTransformStore.length; i < l; i += 3) {
+ const $el = /** @type {DOMTarget} */(rootAncestorTransformStore[i]);
+ const inlineTransform = /** @type {String} */(rootAncestorTransformStore[i + 1]);
+ const inlineTransition = /** @type {String|null} */(rootAncestorTransformStore[i + 2]);
+ if (inlineTransform && inlineTransform !== '') {
+ $el.style.transform = inlineTransform;
+ } else {
+ $el.style.removeProperty('transform');
+ }
+ restoreElementTransition($el, inlineTransition);
+ }
return this;
}
}
+ /**
+ * @param {LayoutStateParams} params
+ * @return {[LayoutStateAnimationProperties, LayoutAnimationTimingsParams]}
+ */
+ function splitPropertiesFromParams(params) {
+ /** @type {LayoutStateAnimationProperties} */
+ const properties = {};
+ /** @type {LayoutAnimationTimingsParams} */
+ const parameters = {};
+ for (let name in params) {
+ const value = params[name];
+ const isEase = name === 'ease';
+ const isTiming = name === 'duration' || name === 'delay';
+ if (isTiming || isEase) {
+ if (isEase) {
+ parameters[name] = /** @type {EasingParam} */(value);
+ } else {
+ parameters[name] = /** @type {Number|FunctionValue} */(value);
+ }
+ } else {
+ properties[name] = /** @type {Number|String} */(value);
+ }
+ }
+ return [properties, parameters];
+ }
+
class AutoLayout {
/**
* @param {DOMTargetSelector} root
@@ -8592,10 +8683,16 @@
*/
constructor(root, params = {}) {
if (scope.current) scope.current.register(this);
- const frozenParams = params.frozen;
- const addedParams = params.added;
- const removedParams = params.removed;
- const propsParams = params.properties;
+ const swapAtSplitParams = splitPropertiesFromParams(params.swapAt);
+ const enterFromSplitParams = splitPropertiesFromParams(params.enterFrom);
+ const leaveToSplitParams = splitPropertiesFromParams(params.leaveTo);
+ const transitionProperties = params.properties;
+ /** @type {Number|FunctionValue} */
+ params.duration = setValue(params.duration, 350);
+ /** @type {Number|FunctionValue} */
+ params.delay = setValue(params.delay, 0);
+ /** @type {EasingParam|FunctionValue} */
+ params.ease = setValue(params.ease, 'inOut(3.5)');
/** @type {AutoLayoutParams} */
this.params = params;
/** @type {DOMTarget} */
@@ -8606,29 +8703,27 @@
this.children = params.children || '*';
/** @type {Boolean} */
this.absoluteCoords = false;
- /** @type {Number|FunctionValue} */
- this.duration = setValue(params.duration, 500);
- /** @type {Number|FunctionValue} */
- this.delay = setValue(params.delay, 0);
- /** @type {EasingParam} */
- this.ease = setValue(params.ease, 'inOut(3.5)');
- /** @type {Callback<this>} */
- this.onComplete = setValue(params.onComplete, /** @type {Callback<this>} */(noop));
/** @type {LayoutStateParams} */
- this.frozenParams = frozenParams || { opacity: 0 };
+ this.swapAtParams = mergeObjects(params.swapAt || { opacity: 0 }, { ease: 'inOut(1.75)' });
/** @type {LayoutStateParams} */
- this.addedParams = addedParams || { opacity: 0 };
+ this.enterFromParams = params.enterFrom || { opacity: 0 };
/** @type {LayoutStateParams} */
- this.removedParams = removedParams || { opacity: 0 };
+ this.leaveToParams = params.leaveTo || { opacity: 0 };
/** @type {Set<String>} */
this.properties = new Set([
'opacity',
+ 'fontSize',
+ 'color',
+ 'backgroundColor',
'borderRadius',
+ 'border',
+ 'filter',
+ 'clipPath',
]);
- if (frozenParams) for (let name in frozenParams) this.properties.add(name);
- if (addedParams) for (let name in addedParams) this.properties.add(name);
- if (removedParams) for (let name in removedParams) this.properties.add(name);
- if (propsParams) for (let i = 0, l = propsParams.length; i < l; i++) this.properties.add(propsParams[i]);
+ if (swapAtSplitParams[0]) for (let name in swapAtSplitParams[0]) this.properties.add(name);
+ if (enterFromSplitParams[0]) for (let name in enterFromSplitParams[0]) this.properties.add(name);
+ if (leaveToSplitParams[0]) for (let name in leaveToSplitParams[0]) this.properties.add(name);
+ if (transitionProperties) for (let i = 0, l = transitionProperties.length; i < l; i++) this.properties.add(transitionProperties[i]);
/** @type {Set<String>} */
this.recordedProperties = new Set([
'display',
@@ -8648,24 +8743,26 @@
]);
this.properties.forEach(prop => this.recordedProperties.add(prop));
/** @type {WeakSet<DOMTarget>} */
- this.pendingRemoved = new WeakSet();
+ this.pendingRemoval = new WeakSet();
/** @type {Map<DOMTarget, String|null>} */
this.transitionMuteStore = new Map();
/** @type {LayoutSnapshot} */
this.oldState = new LayoutSnapshot(this);
/** @type {LayoutSnapshot} */
this.newState = new LayoutSnapshot(this);
- /** @type {Timeline|null} */
+ /** @type {Timeline} */
this.timeline = null;
- /** @type {WAAPIAnimation|null} */
+ /** @type {WAAPIAnimation} */
this.transformAnimation = null;
/** @type {Array<DOMTarget>} */
- this.frozen = [];
+ this.animating = [];
+ /** @type {Array<DOMTarget>} */
+ this.swapping = [];
/** @type {Array<DOMTarget>} */
- this.removed = [];
+ this.leaving = [];
/** @type {Array<DOMTarget>} */
- this.added = [];
- // Record the current state as the old state to init the data attributes
+ this.entering = [];
+ // Record the current state as the old state to init the data attributes and allow imediate .animate()
this.oldState.record();
// And all layout transition muted during the record
restoreLayoutTransition(this.transitionMuteStore);
@@ -8675,6 +8772,7 @@
* @return {this}
*/
revert() {
+ this.root.classList.remove('is-animated');
if (this.timeline) {
this.timeline.complete();
this.timeline = null;
@@ -8683,8 +8781,7 @@
this.transformAnimation.complete();
this.transformAnimation = null;
}
- this.root.classList.remove('is-animated');
- this.frozen.length = this.removed.length = this.added.length = 0;
+ this.animating.length = this.swapping.length = this.leaving.length = this.entering.length = 0;
this.oldState.revert();
this.newState.revert();
requestAnimationFrame(() => restoreLayoutTransition(this.transitionMuteStore));
@@ -8717,20 +8814,72 @@
* @return {Timeline}
*/
animate(params = {}) {
- const delay = setValue(params.delay, this.delay);
- const duration = setValue(params.duration, this.duration);
- const onComplete = setValue(params.onComplete, this.onComplete);
- const frozenParams = params.frozen ? mergeObjects(params.frozen, this.frozenParams) : this.frozenParams;
- const addedParams = params.added ? mergeObjects(params.added, this.addedParams) : this.addedParams;
- const removedParams = params.removed ? mergeObjects(params.removed, this.removedParams) : this.removedParams;
+ /** @type { LayoutAnimationTimingsParams } */
+ const animationTimings = {
+ ease: setValue(params.ease, this.params.ease),
+ delay: setValue(params.delay, this.params.delay),
+ duration: setValue(params.duration, this.params.duration),
+ };
+ /** @type {TimelineParams} */
+ const tlParams = {};
+ const onComplete = setValue(params.onComplete, this.params.onComplete);
+ const onPause = setValue(params.onPause, this.params.onPause);
+ for (let name in defaults) {
+ if (name !== 'ease' && name !== 'duration' && name !== 'delay') {
+ if (!isUnd(params[name])) {
+ tlParams[name] = params[name];
+ } else if (!isUnd(this.params[name])) {
+ tlParams[name] = this.params[name];
+ }
+ }
+ }
+ tlParams.onComplete = () => {
+ // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(node => {
+ restoreNodeVisualState(node);
+ restoreNodeInlineStyles(node);
+ });
+ for (let i = 0, l = transformed.length; i < l; i++) {
+ const $el = transformed[i];
+ $el.style.transform = newState.getComputedValue($el, 'transform');
+ }
+ if (this.root.classList.contains('is-animated')) {
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ }
+ // Avoid CSS transitions at the end of the animation by restoring them on the next frame
+ requestAnimationFrame(() => {
+ if (this.root.classList.contains('is-animated')) return;
+ restoreLayoutTransition(this.transitionMuteStore);
+ });
+ };
+ tlParams.onPause = () => {
+ if (!this.root.classList.contains('is-animated')) return;
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(restoreNodeVisualState);
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ if (onPause) onPause(this.timeline);
+ };
+ tlParams.composition = false;
+
+ const swapAtParams = mergeObjects(mergeObjects(params.swapAt || {}, this.swapAtParams), animationTimings);
+ const enterFromParams = mergeObjects(mergeObjects(params.enterFrom || {}, this.enterFromParams), animationTimings);
+ const leaveToParams = mergeObjects(mergeObjects(params.leaveTo || {}, this.leaveToParams), animationTimings);
+ const [ swapAtProps, swapAtTimings ] = splitPropertiesFromParams(swapAtParams);
+ const [ enterFromProps, enterFromTimings ] = splitPropertiesFromParams(enterFromParams);
+ const [ leaveToProps, leaveToTimings ] = splitPropertiesFromParams(leaveToParams);
+
const oldState = this.oldState;
const newState = this.newState;
- const added = this.added;
- const removed = this.removed;
- const frozen = this.frozen;
- const pendingRemoved = this.pendingRemoved;
+ const animating = this.animating;
+ const swapping = this.swapping;
+ const entering = this.entering;
+ const leaving = this.leaving;
+ const pendingRemoval = this.pendingRemoval;
- added.length = removed.length = frozen.length = 0;
+ animating.length = swapping.length = entering.length = leaving.length = 0;
// Mute old state CSS transitions to prevent wrong properties calculation
oldState.forEachRootNode(muteNodeTransition);
@@ -8741,10 +8890,12 @@
const targets = [];
const animated = [];
const transformed = [];
- const animatedFrozen = [];
- const root = newState.rootNode.$el;
+ const animatedSwap = [];
+ const rootNode = newState.rootNode;
+ const $root = rootNode.$el;
newState.forEachRootNode(node => {
+
const $el = node.$el;
const id = node.id;
const parent = node.parentNode;
@@ -8752,10 +8903,6 @@
const parentRemoved = parent ? parent.branchRemoved : false;
const parentNotRendered = parent ? parent.branchNotRendered : false;
- // Delay and duration must be calculated in the animate() call to support delay override
- node.delay = +(isFnc(delay) ? delay($el, node.index, node.total) : delay);
- node.duration = +(isFnc(duration) ? duration($el, node.index, node.total) : duration);
-
let oldStateNode = oldState.nodes.get(id);
const hasNoOldState = !oldStateNode;
@@ -8805,7 +8952,7 @@
}
}
- const wasPendingRemoval = pendingRemoved.has($el);
+ const wasPendingRemoval = pendingRemoval.has($el);
const wasVisibleBefore = oldStateNode.measuredIsVisible;
const isVisibleNow = node.measuredIsVisible;
const becomeVisible = !wasVisibleBefore && isVisibleNow && !parentNotRendered;
@@ -8813,113 +8960,156 @@
const newlyRemoved = isRemovedNow && !wasRemovedBefore && !parentRemoved;
const topLevelRemoved = newlyRemoved || isRemovedNow && wasPendingRemoval && !parentRemoved;
- if (node.measuredIsRemoved && wasVisibleBefore) {
+ node.branchAdded = parentAdded || topLevelAdded;
+ node.branchRemoved = parentRemoved || topLevelRemoved;
+ node.branchNotRendered = parentNotRendered || isRemovedNow;
+
+ if (isRemovedNow && wasVisibleBefore) {
node.$el.style.display = oldStateNode.measuredDisplay;
node.$el.style.visibility = 'visible';
cloneNodeProperties(oldStateNode, node, newState);
}
+ // Node is leaving
if (newlyRemoved) {
- removed.push($el);
- pendingRemoved.add($el);
+ if (node.isTarget) {
+ leaving.push($el);
+ node.isLeaving = true;
+ }
+ pendingRemoval.add($el);
} else if (!isRemovedNow && wasPendingRemoval) {
- pendingRemoved.delete($el);
+ pendingRemoval.delete($el);
}
- // Node is added
+ // Node is entering
if ((topLevelAdded && !parentNotRendered) || becomeVisible) {
- updateNodeProperties(oldStateNode, addedParams);
- added.push($el);
- // Node is removed
+ updateNodeProperties(oldStateNode, enterFromProps);
+ if (node.isTarget) {
+ entering.push($el);
+ node.isEntering = true;
+ }
+ // Node is leaving
} else if (topLevelRemoved && !parentNotRendered) {
- updateNodeProperties(node, removedParams);
+ updateNodeProperties(node, leaveToProps);
}
- // Compute function based propety values before cheking for changes
- for (let name in node.properties) {
- node.properties[name] = newState.getValue(node.$el, name);
- // NOTE: I'm using node.$el to get the value of old state, make sure this is valid instead of oldStateNode.$el
- oldStateNode.properties[name] = oldState.getValue(node.$el, name);
+ // Node is animating
+ // The animating array is used only to calculate delays and duration on root children
+ if (node !== rootNode && node.isTarget && !node.isEntering && !node.isLeaving) {
+ animating.push($el);
}
- const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
- let propertyChanged = false;
+ targets.push($el);
+ });
- if (node.isTarget && (!node.measuredIsRemoved && wasVisibleBefore || node.measuredIsRemoved && isVisibleNow)) {
- if (!node.isInlined && (node.properties.transform !== 'none' || oldStateNode.properties.transform !== 'none')) {
- node.hasTransform = true;
- propertyChanged = true;
- transformed.push($el);
- }
- for (let name in node.properties) {
- if (name !== 'transform' && (node.properties[name] !== oldStateNode.properties[name] || hiddenStateChanged)) {
- propertyChanged = true;
- animated.push($el);
- break;
- }
- }
+ let enteringIndex = 0;
+ let leavingIndex = 0;
+ let animatingIndex = 0;
+
+ newState.forEachRootNode(node => {
+
+ const $el = node.$el;
+ const parent = node.parentNode;
+ const oldStateNode = oldState.nodes.get(node.id);
+ const nodeProperties = node.properties;
+ const oldStateNodeProperties = oldStateNode.properties;
+
+ // Use closest animated parent index and total values so that children staggered delays are in sync with their parent
+ let animatedParent = parent !== rootNode && parent;
+ while (animatedParent && !animatedParent.isTarget && animatedParent !== rootNode) {
+ animatedParent = animatedParent.parentNode;
}
- const nodeHasChanged = (propertyChanged || topLevelAdded || topLevelRemoved || becomeVisible);
- const nodeIsAnimated = node.isTarget && nodeHasChanged;
+ const animatingTotal = animating.length;
+
+ // Root is always animated first in sync with the first child (animating.length is the total of children)
+ if (node === rootNode) {
+ node.index = 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else if (node.isEntering) {
+ node.index = animatedParent ? animatedParent.index : enteringIndex;
+ node.total = animatedParent ? animatingTotal : entering.length;
+ updateNodeTimingParams(node, enterFromTimings);
+ enteringIndex++;
+ } else if (node.isLeaving) {
+ node.index = animatedParent ? animatedParent.index : leavingIndex;
+ node.total = animatedParent ? animatingTotal : leaving.length;
+ leavingIndex++;
+ updateNodeTimingParams(node, leaveToTimings);
+ } else if (node.isTarget) {
+ node.index = animatingIndex++;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else {
+ node.index = animatedParent ? animatedParent.index : 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, swapAtTimings);
+ }
- node.isAnimated = nodeIsAnimated;
- node.branchAdded = parentAdded || topLevelAdded;
- node.branchRemoved = parentRemoved || topLevelRemoved;
- node.branchNotRendered = parentNotRendered || node.measuredIsRemoved;
+ // Make sure the old state node has its inex and total values up to date for valid "from" function values calculation
+ oldStateNode.index = node.index;
+ oldStateNode.total = node.total;
+
+ // Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation props
+ for (let prop in nodeProperties) {
+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);
+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);
+ }
+ // Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements
const sizeTolerance = 1;
- const widthChanged = Math.abs(node.properties.width - oldStateNode.properties.width) > sizeTolerance;
- const heightChanged = Math.abs(node.properties.height - oldStateNode.properties.height) > sizeTolerance;
+ const widthChanged = Math.abs(nodeProperties.width - oldStateNodeProperties.width) > sizeTolerance;
+ const heightChanged = Math.abs(nodeProperties.height - oldStateNodeProperties.height) > sizeTolerance;
node.sizeChanged = (widthChanged || heightChanged);
- targets.push($el);
+ // const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
+
+ if (node.isTarget && (!node.measuredIsRemoved && oldStateNode.measuredIsVisible || node.measuredIsRemoved && node.measuredIsVisible)) {
+ if (!node.isInlined && (nodeProperties.transform !== 'none' || oldStateNodeProperties.transform !== 'none')) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ for (let prop in nodeProperties) {
+ // if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop] || hiddenStateChanged)) {
+ if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop])) {
+ animated.push($el);
+ break;
+ }
+ }
+ }
if (!node.isTarget) {
- frozen.push($el);
- if ((nodeHasChanged || node.sizeChanged) && parent && parent.isTarget && parent.isAnimated && parent.sizeChanged) {
- animatedFrozen.push($el);
+ swapping.push($el);
+ if (node.sizeChanged && parent && parent.isTarget && parent.sizeChanged) {
+ if (!node.isInlined && swapAtProps.transform) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ animatedSwap.push($el);
}
}
+
});
- const defaults = {
- ease: setValue(params.ease, this.ease),
- duration: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).duration,
- delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
+ const timingParams = {
+ delay: (/** @type {HTMLElement} */$el) => newState.getNode($el).delay,
+ duration: (/** @type {HTMLElement} */$el) => newState.getNode($el).duration,
+ ease: (/** @type {HTMLElement} */$el) => newState.getNode($el).ease,
};
- this.timeline = createTimeline({
- onComplete: () => {
- // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(node => {
- restoreNodeVisualState(node);
- restoreNodeInlineStyles(node);
- });
- for (let i = 0, l = transformed.length; i < l; i++) {
- const $el = transformed[i];
- $el.style.transform = newState.getValue($el, 'transform');
- }
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- // Avoid CSS transitions at the end of the animation by restoring them on the next frame
- requestAnimationFrame(() => {
- if (this.root.classList.contains('is-animated')) return;
- restoreLayoutTransition(this.transitionMuteStore);
- });
- },
- onPause: () => {
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(restoreNodeVisualState);
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- },
- composition: false,
- defaults,
- });
+ tlParams.defaults = timingParams;
+
+ this.timeline = createTimeline(tlParams);
+
+ // Imediatly return the timeline if no layout changes detected
+ if (!animated.length && !transformed.length && !swapping.length) {
+ // Make sure to restore all CSS transition if no animation
+ restoreLayoutTransition(this.transitionMuteStore);
+ return this.timeline.complete();
+ }
if (targets.length) {
@@ -8932,15 +9122,14 @@
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
- // Make sure to mute all CSS transition before applying the oldState styles back
- muteNodeTransition(newNode);
+ // muteNodeTransition(newNode);
// Don't animate dimensions and positions of inlined elements
if (!newNode.isInlined) {
// Display grid can mess with the absolute positioning, so set it to block during transition
- if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.display = 'block';
- // All children must be in position absolue
- if ($el !== root || this.absoluteCoords) {
+ if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.setProperty('display', 'block', 'important');
+ // All children must be in position absolute or fixed
+ if ($el !== $root || this.absoluteCoords) {
$el.style.position = this.absoluteCoords ? 'fixed' : 'absolute';
$el.style.left = '0px';
$el.style.top = '0px';
@@ -8948,7 +9137,7 @@
$el.style.marginTop = '0px';
$el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
}
- if ($el === root && newNode.measuredPosition === 'static') {
+ if ($el === $root && newNode.measuredPosition === 'static') {
$el.style.position = 'relative';
// Cancel left / trop in case the static element had muted values now activated by potision relative
$el.style.left = '0px';
@@ -8967,9 +9156,7 @@
// Restore the scroll position if the oldState differs from the current state
if (oldState.scrollX !== window.scrollX || oldState.scrollY !== window.scrollY) {
// Restoring in the next frame avoids race conditions if for example a waapi animation commit styles that affect the root height
- requestAnimationFrame(() => {
- window.scrollTo(oldState.scrollX, oldState.scrollY);
- });
+ requestAnimationFrame(() => window.scrollTo(oldState.scrollX, oldState.scrollY));
}
for (let i = 0, l = animated.length; i < l; i++) {
@@ -8979,25 +9166,25 @@
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
const newNodeState = newNode.properties;
- let hasChanged = false;
+ let nodeHasChanged = false;
+ /** @type {AnimationParams} */
const animatedProps = {
composition: 'none',
- // delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
};
if (!newNode.isInlined) {
if (oldNodeState.width !== newNodeState.width) {
animatedProps.width = [oldNodeState.width, newNodeState.width];
- hasChanged = true;
+ nodeHasChanged = true;
}
if (oldNodeState.height !== newNodeState.height) {
animatedProps.height = [oldNodeState.height, newNodeState.height];
- hasChanged = true;
+ nodeHasChanged = true;
}
// If the node has transforms we handle the translate animation in wappi otherwise translate and other transforms can be out of sync
// Always animate translate
if (!newNode.hasTransform) {
animatedProps.translate = [`${oldNodeState.x}px ${oldNodeState.y}px`, `${newNodeState.x}px ${newNodeState.y}px`];
- hasChanged = true;
+ nodeHasChanged = true;
}
}
this.properties.forEach(prop => {
@@ -9005,73 +9192,77 @@
const newVal = newNodeState[prop];
if (prop !== 'transform' && oldVal !== newVal) {
animatedProps[prop] = [oldVal, newVal];
- hasChanged = true;
+ nodeHasChanged = true;
}
});
- if (hasChanged) {
+ if (nodeHasChanged) {
this.timeline.add($el, animatedProps, 0);
}
}
}
- if (frozen.length) {
+ if (swapping.length) {
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const oldNode = oldState.nodes.get($el.dataset.layoutId);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const oldNode = oldState.getNode($el);
if (!oldNode.isInlined) {
- const oldNodeState = oldState.get($el);
- $el.style.width = `${oldNodeState.width}px`;
- $el.style.height = `${oldNodeState.height}px`;
+ const oldNodeProps = oldNode.properties;
+ $el.style.width = `${oldNodeProps.width}px`;
+ $el.style.height = `${oldNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
+ $el.style.translate = `${oldNodeProps.x}px ${oldNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${oldState.getValue($el, prop)}`;
+ $el.style[prop] = `${oldState.getComputedValue($el, prop)}`;
}
});
}
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const newNode = newState.nodes.get($el.dataset.layoutId);
- const newNodeState = newState.get($el);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const newNode = newState.getNode($el);
+ const newNodeProps = newNode.properties;
this.timeline.call(() => {
if (!newNode.isInlined) {
- $el.style.width = `${newNodeState.width}px`;
- $el.style.height = `${newNodeState.height}px`;
+ $el.style.width = `${newNodeProps.width}px`;
+ $el.style.height = `${newNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${newNodeState.x}px ${newNodeState.y}px`;
+ $el.style.translate = `${newNodeProps.x}px ${newNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${newState.getValue($el, prop)}`;
+ $el.style[prop] = `${newState.getComputedValue($el, prop)}`;
}
});
}, newNode.delay + newNode.duration / 2);
}
- if (animatedFrozen.length) {
- const animatedFrozenParams = /** @type {AnimationParams} */({});
- if (frozenParams) {
- for (let prop in frozenParams) {
- animatedFrozenParams[prop] = [
- { from: (/** @type {HTMLElement} */$el) => oldState.getValue($el, prop), ease: 'in(1.75)', to: frozenParams[prop] },
- { from: frozenParams[prop], to: (/** @type {HTMLElement} */$el) => newState.getValue($el, prop), ease: 'out(1.75)' }
- ];
+ if (animatedSwap.length) {
+ const ease = parseEase(newState.nodes.get(animatedSwap[0].dataset.layoutId).ease);
+ const inverseEased = t => 1 - ease(1 - t);
+ const animatedSwapParams = /** @type {AnimationParams} */({});
+ if (swapAtProps) {
+ for (let prop in swapAtProps) {
+ if (prop !== 'transform') {
+ animatedSwapParams[prop] = [
+ { from: (/** @type {HTMLElement} */$el) => oldState.getComputedValue($el, prop), to: swapAtProps[prop] },
+ { from: swapAtProps[prop], to: (/** @type {HTMLElement} */$el) => newState.getComputedValue($el, prop), ease: inverseEased }
+ ];
+ }
}
}
- this.timeline.add(animatedFrozen, animatedFrozenParams, 0);
+ this.timeline.add(animatedSwap, animatedSwapParams, 0);
}
}
@@ -9079,18 +9270,29 @@
const transformedLength = transformed.length;
if (transformedLength) {
- // We only need to set the transform property here since translate is alread defined the targets loop
+ // We only need to set the transform property here since translate is alread defined in the targets loop
for (let i = 0; i < transformedLength; i++) {
const $el = transformed[i];
- $el.style.translate = `${oldState.get($el).x}px ${oldState.get($el).y}px`,
- $el.style.transform = oldState.getValue($el, 'transform');
+ $el.style.translate = `${oldState.getComputedValue($el, 'x')}px ${oldState.getComputedValue($el, 'y')}px`,
+ $el.style.transform = oldState.getComputedValue($el, 'transform');
+ if (animatedSwap.includes($el)) {
+ const node = newState.getNode($el);
+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);
+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);
+ }
}
this.transformAnimation = waapi.animate(transformed, {
- translate: (/** @type {HTMLElement} */$el) => `${newState.get($el).x}px ${newState.get($el).y}px`,
- transform: (/** @type {HTMLElement} */$el) => newState.getValue($el, 'transform'),
+ translate: (/** @type {HTMLElement} */$el) => `${newState.getComputedValue($el, 'x')}px ${newState.getComputedValue($el, 'y')}px`,
+ transform: (/** @type {HTMLElement} */$el) => {
+ const newValue = newState.getComputedValue($el, 'transform');
+ if (!animatedSwap.includes($el)) return newValue;
+ const oldValue = oldState.getComputedValue($el, 'transform');
+ const node = newState.getNode($el);
+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]
+ },
autoplay: false,
persist: true,
- ...defaults,
+ ...timingParams,
});
this.timeline.sync(this.transformAnimation, 0);
}
@@ -9101,13 +9303,12 @@
/**
* @param {(layout: this) => void} callback
* @param {LayoutAnimationParams} [params]
- * @return {this}
+ * @return {Timeline}
*/
update(callback, params = {}) {
this.record();
callback(this);
- this.animate(params);
- return this;
+ return this.animate(params);
}
}
diff --git a/dist/bundles/anime.umd.min.js b/dist/bundles/anime.umd.min.js
index c7a92c52..0b0d247c 100644
--- a/dist/bundles/anime.umd.min.js
+++ b/dist/bundles/anime.umd.min.js
@@ -1,7 +1,7 @@
/**
* Anime.js - UMD minified bundle
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).anime={})}(this,function(t){"use strict";const e="undefined"!=typeof window,s=e?window:null,i=e?document:null,r={replace:0,none:1,blend:2},n=Symbol(),o=Symbol(),a=Symbol(),l=Symbol(),h=Symbol(),d=Symbol(),c=1e-11,u=1e12,p=1e3,m="",f=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),g=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","matrix","matrix3d","perspective"],y=g.reduce((t,e)=>({...t,[e]:e+"("}),{}),v=()=>{},_=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,b=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,T=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,x=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,w=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,S=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,$=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,k=/([a-z])([A-Z])/g,E=/(\w+)(\([^)]+\)+)/g,C=/(\*=|\+=|-=)/,N=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,D={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:p,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:v,onBeforeUpdate:v,onUpdate:v,onLoop:v,onPause:v,onComplete:v,onRender:v},I={current:null,root:i},A={defaults:D,precision:4,timeScale:1,tickThreshold:200},B=e&&s.AnimeJSDevTools,L={version:"4.3.0-beta.2",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(L));const R=t=>t.replace(k,"$1-$2").toLowerCase(),P=(t,e)=>0===t.indexOf(e),F=Date.now,M=Array.isArray,V=t=>t&&t.constructor===Object,z=t=>"number"==typeof t&&!isNaN(t),O=t=>"string"==typeof t,H=t=>"function"==typeof t,X=t=>void 0===t,Y=t=>X(t)||null===t,W=t=>e&&t instanceof SVGElement,U=t=>_.test(t),q=t=>P(t,"rgb"),j=t=>P(t,"hsl"),G=t=>!A.defaults.hasOwnProperty(t),Q=["opacity","rotate","overflow","color"],Z=t=>O(t)?parseFloat(t):t,J=Math.pow,K=Math.sqrt,tt=Math.sin,et=Math.cos,st=Math.abs,it=Math.exp,rt=Math.ceil,nt=Math.floor,ot=Math.asin,at=Math.max,lt=Math.atan2,ht=Math.PI,dt=Math.round,ct=(t,e,s)=>t<e?e:t>s?s:t,ut={},pt=(t,e)=>{if(e<0)return t;if(!e)return dt(t);let s=ut[e];return s||(s=ut[e]=10**e),dt(t*s)/s},mt=(t,e)=>M(e)?e.reduce((e,s)=>st(s-t)<st(e-t)?s:e):e?dt(t/e)*e:t,ft=(t,e,s)=>t+(e-t)*s,gt=t=>t===1/0?u:t===-1/0?-u:t,yt=t=>t<=c?c:gt(pt(t,11)),vt=t=>M(t)?[...t]:t,_t=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=X(r)?e[i]:r}return s},bt=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},Tt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},xt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},wt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),St=(t,e)=>X(t)?e:t,$t=(t,e,s,i,r)=>{let n;if(H(t))n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};else{if(!O(t)||!P(t,"var("))return t;n=()=>{const s=t.match(N),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==m||!r||(n=r.trim()),n||0}}return r&&(r.func=n),n()},kt=(t,e)=>t[o]?t[a]&&((t,e)=>{if(Q.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}})(t,e)?1:g.includes(e)||f.get(e)?3:P(e,"--")?4:e in t.style?2:e in t?0:1:0,Et=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[d]||t).getPropertyValue(e);return"auto"===r?"0":r},Ct=(t,e,s,i)=>{const r=X(s)?kt(t,e):s;return 0===r?t[e]||0:1===r?t.getAttribute(e):3===r?((t,e,s)=>{const i=t.style.transform;let r;if(i){const n=t[l];let o;for(;o=E.exec(i);){const t=o[1],i=o[2].slice(1,-1);n[t]=i,t===e&&(r=i,s&&(s[e]=i))}}return i&&!X(r)?r:P(e,"scale")?"1":P(e,"rotate")||P(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Et(t,e,i).trimStart():Et(t,e,i)},Nt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Dt=(t,e)=>{if(e.t=0,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const n=!s.includes(" ")&&$.exec(s);if(n)return e.t=1,e.n=+n[1],e.u=n[2],e;if(e.o)return e.n=+s,e;if(U(r=s)||q(r)||j(r))return e.t=2,e.d=q(i=s)?(t=>{const e=b.exec(t)||T.exec(t),s=X(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):U(i)?(t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]})(i):j(i)?(t=>{const e=x.exec(t)||w.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=X(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=pt(255*wt(e,t,s+1/3),0),a=pt(255*wt(e,t,s),0),l=pt(255*wt(e,t,s-1/3),0)}return[o,a,l,n]})(i):[0,0,0,1],e;{const t=s.match(S);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(S)||[],e}}var i,r;return e.n=s,e},It=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=vt(t._toNumbers),e.s=vt(t._strings),e),At={t:0,n:0,u:null,o:null,d:null,s:null},Bt=(t,e,s,i,n)=>{const o=t.parent,a=t.duration,h=t.completed,d=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,f=t._loopDelay,g=t._reversed,v=t._alternate,_=t._hasChildren,b=t._delay,T=t._currentTime,x=b+d,w=e-b,S=ct(T,-b,a),$=ct(w,-b,a),k=w-T,E=$>0,C=$>=a,N=a<=c,D=2===n;let I=0,B=w,L=0;if(u>1){const e=~~($/(d+(C?0:f)));t._currentIteration=ct(e,0,u),C&&t._currentIteration--,I=t._currentIteration%2,B=$%(d+f)||0}const R=g^(v&&I),P=t._ease;let F=C?R?0:a:R?d-B:B;P&&(F=d*P(F/d)||0);const M=(o?o.backwards:w<T)?!R:!!R;if(t._currentTime=w,t._iterationTime=F,t.backwards=M,E&&!t.began?(t.began=!0,s||o&&(M||!o.began)||t.onBegin(t)):w<=0&&(t.began=!1),s||_||!E||t._currentIteration===p||t.onLoop(t),D||1===n&&(e>=b&&e<=x||e<=b&&S>b||e>=x&&S!==a)||F>=x&&S!==a||F<=b&&S>0||e<=S&&S===a&&h||C&&!h&&N){if(E&&(t.computeDeltaTime(S),s||t.onBeforeUpdate(t)),!_){const e=D||(M?-1*k:k)>=A.tickThreshold,n=t._offset+(o?o._offset:0)+b+F;let a,h,d,c,u=t._head,p=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,g=u._nextRep,v=u._prevRep,_=t!==r.none;if((e||(s!==o||n<=f+(g?g._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!_||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!g||g._isOverridden||n<=g._absoluteStartTime)&&(!v||v._isOverridden||n>=v._absoluteStartTime+v._changeDuration+u._delay))){const e=u._currentTime=ct(F-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,y=0===m,v=y&&g||0===s||1===s?-1:A.precision;let b,T;if(y)b=T=n(pt(ft(u._fromNumber,u._toNumber,s),v));else if(1===m)T=n(pt(ft(u._fromNumber,u._toNumber,s),v)),b=`${T}${u._unit}`;else if(2===m){const t=u._fromNumbers,e=u._toNumbers,i=pt(ct(n(ft(t[0],e[0],s)),0,255),0),r=pt(ct(n(ft(t[1],e[1],s)),0,255),0),o=pt(ct(n(ft(t[2],e[2],s)),0,255),0),a=ct(n(pt(ft(t[3],e[3],s),v)),0,1);if(b=`rgba(${i},${r},${o},${a})`,_){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(3===m){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(pt(ft(u._fromNumbers[t],u._toNumbers[t],s),v)),i=u._strings[t+1];b+=`${i?e+i:e}`,_&&(u._numbers[t]=e)}}if(_&&(u._number=T),i||t===r.blend)u._value=b;else{const t=u.property;a=u.target,g?a[t]=b:1===f?a.setAttribute(t,b):(h=a.style,3===f?(a!==d&&(d=a,c=a[l]),c[t]=b,p=1):2===f?h[t]=b:4===f&&h.setProperty(t,b)),E&&(L=1)}}if(p&&u._renderTransforms){let t=m;for(let e in c)t+=`${y[e]}${c[e]}) `;h.transform=t,p=0}u=u._next}!s&&L&&t.onRender(t)}!s&&E&&t.onUpdate(t)}return o&&N?!s&&(o.began&&!M&&w>0&&!h||M&&w<=c&&h)&&(t.onComplete(t),t.completed=!M):E&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,h||_||(t.completed=!0,s||o&&(M||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,L},Lt=(t,e,s,i,r)=>{const n=t._currentIteration;if(Bt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,l=i?e:o._iterationTime,h=F();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;bt(o,e=>{if(a){const i=e.duration,r=e._offset+e._delay;s||!(i<=c)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&Bt(e,t,s,1,2),e.began=!1,e.completed=!1}),s||o.onLoop(o)}bt(o,t=>{const e=pt((l-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(h):r;d+=Bt(t,e,s,i,n),!t.completed&&u&&(u=!1)},a),!s&&d&&o.onRender(o),(u||a)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},Rt={},Pt=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&W(e)&&t in e.style){const e=Rt[t];if(e)return e;{const e=t?R(t):t;return Rt[t]=e,e}}return t},Ft=t=>{if(t._hasChildren)bt(t,Ft,!0);else{const e=t;e.pause(),bt(e,t=>{const s=t.property,i=t.target;if(i[o]){const r=i.style,n=t._inlineValue,o=Y(n)||n===m;if(3===t._tweenType){const e=i[l];if(o?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=m;for(let s in e)t+=y[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else o?r.removeProperty(R(s)):r[s]=n;e._tail===t&&e.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===m&&t.removeAttribute("style")})}})}return t};class Mt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=p/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<c?c:s,r=p/i;i>D.frameRate&&(D.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<c?c:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return 0;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Vt={animation:null,update:v},zt=(()=>e?requestAnimationFrame:setImmediate)(),Ot=(()=>e?cancelAnimationFrame:clearImmediate)();class Ht extends Mt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=D,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=F();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(Tt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):Lt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}Vt.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(F()),this.reqId=zt(Yt)),this}pause(){if(this.reqId)return this.paused=!0,Wt()}resume(){if(this.paused)return this.paused=!1,bt(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===A.timeScale?1:p)}set speed(t){this._speed=t*A.timeScale,bt(this,t=>t.speed=t._speed)}get timeUnit(){return 1===A.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(A.timeScale!==s){A.timeScale=s,A.tickThreshold=200*s;const t=e?.001:p;this.defaults.duration*=t,this._speed*=t}}get precision(){return A.precision}set precision(t){A.precision=t}}const Xt=(()=>{const t=new Ht(F());return e&&(L.engine=t,i.addEventListener("visibilitychange",()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())})),t})(),Yt=()=>{Xt._head?(Xt.reqId=zt(Yt),Xt.update()):Xt.reqId=0},Wt=()=>(Ot(Xt.reqId),Xt.reqId=0,Xt),Ut={_rep:new WeakMap,_add:new Map},qt=(t,e,s="_rep")=>{const i=Ut[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},jt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,Gt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},Qt=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;xt(e,t,jt,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){Gt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)Gt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=pt(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<c&&Gt(i)}let o=!0;if(bt(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;bt(t,t=>{t!==e&&bt(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===r.blend){const e=qt(t.target,t.property,"_add"),s=(t=>{let e=Vt.animation;return e||(e={duration:c,computeDeltaTime:v,_offset:0,_delay:0,_head:null,_tail:null},Vt.animation=e,Vt.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=3===t||2===t?vt(i._fromNumbers):null;let r=i._fromNumber,n=s._tail;for(;n&&n!==i;){if(e)for(let t=0,s=n._numbers.length;t<s;t++)e[t]+=n._numbers[t];else r+=n._number;n=n._prevAdd}i._toNumber=r,i._toNumbers=e}}}),Bt(e,1,1,0,2)}),e})(Ut._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=c,i._startTime=0,i._numbers=vt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,xt(e,i),xt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=vt(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=vt(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}xt(e,t,null,"_prevAdd","_nextAdd")}return t},Zt=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=Ut._rep.get(s)[i];if(Tt(n,t,"_prevRep","_nextRep"),e===r.blend){const e=Ut._add,r=e.get(s);if(!r)return;const n=r[i],o=Vt.animation;Tt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){Tt(n,a,"_prevAdd","_nextAdd"),Tt(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Jt=(t,e,s)=>{let i=!1;return bt(e,r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=Pt(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),Tt(e,r),Zt(r),i=!0)}},!0),i},Kt=(t,e,s)=>{const i=e||Xt;let r;if(i._hasChildren){let e=0;bt(i,n=>{if(!n._hasChildren)if(r=Jt(t,n,s),r&&!n._head)n.cancel(),Tt(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?Kt(t,n,s):n._hasChildren=!1},!0),X(i.iterationDuration)||(i.iterationDuration=e)}else r=Jt(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},te=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),ee=t=>t._cancelled?(t._hasChildren?bt(t,ee):bt(t,t=>{t._composition!==r.none&&Qt(t,qt(t.target,t.property))}),t._cancelled=0,t):t;let se=0;class ie extends Mt{constructor(t={},e=null,s=0){super(0),++se;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:_,onUpdate:b}=t;I.current&&I.current.register(this);const T=e?0:Xt._lastTickTime,x=e?e.defaults:A.defaults,w=H(r)||X(r)?x.delay:+r,S=H(n)||X(n)?1/0:+n,$=St(l,x.loop),k=St(h,x.loopDelay);let E=!0===$||$===1/0||$<0?1/0:$+1;if(B){const s=E===1/0;if(B.register(this,t,s)&&s){const t=a?2:1,s=e?B.maxNestedInfiniteLoops:B.maxInfiniteLoops;E=Math.max(s,t)}}let C=0;e?C=s:(Xt.reqId||Xt.requestTick(F()),C=(Xt._lastTickTime-Xt._startTime)*A.timeScale),this.id=X(i)?se:i,this.parent=e,this.duration=gt((S+k)*E-k)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||x.onBegin,this.onBeforeUpdate=_||x.onBeforeUpdate,this.onUpdate=b||x.onUpdate,this.onLoop=f||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=S,this.iterationCount=E,this._autoplay=!e&&St(d,x.autoplay),this._offset=C,this._delay=w,this._loopDelay=k,this._iterationTime=0,this._currentIteration=0,this._resolve=v,this._running=!1,this._reversed=+St(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=St(a,x.alternate),this._prev=null,this._next=null,this._lastTickTime=T,this._startTime=T,this._lastTime=T,this._fps=St(u,x.frameRate),this._speed=St(p,x.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return ct(pt(this._currentTime,A.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ct(pt(this._iterationTime,A.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ct(pt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ct(pt(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*ct(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return ee(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Lt(this,0,1,~~t,2),te(this),this._hasChildren&&bt(this,te),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&Lt(this,this.duration,1,~~t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!X(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*Xt._speed);return this._startTime=F()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=c&&!this._hasChildren?Lt(this,c,0,0,2):(this._running||(xt(Xt,this),Xt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,Xt.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){ee(this),this.completed=!1;const i=this.paused;return this.paused=!0,Lt(this,t+this._delay,~~e,~~s,1),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?nt(u/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?bt(this,t=>t.cancel(),!0):bt(this,Zt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=yt(t);if(e===s)return this;const i=t/e,r=t<=c;return this.duration=r?c:s,this.iterationDuration=r?c:yt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){Lt(this,0,1,0,1);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(){return this.seek(this.duration).cancel()}then(t=v){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=v};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}function re(t){const e=O(t)?I.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function ne(t){if(Y(t))return[];if(!e)return M(t)&&t.flat(1/0)||[t];if(M(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!Y(i)){const t=re(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!Y(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=re(t);return s?Array.from(s):[t]}function oe(t){const e=ne(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[n]){s[n]=!0;const t=W(s);(s.nodeType||t)&&(s[o]=!0,s[a]=t,s[l]={})}}return e}const ae={deg:1,rad:180/ht,turn:360},le={},he=(t,e,s,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===s)return e;const a=o+n+s,l=le[a];if(X(l)||r){let r;if(n in ae)r=o*ae[n]/ae[s];else{const e=100,a=t.cloneNode(),l=t.parentNode,h=l&&l!==i?l:i.body;h.appendChild(a);const d=a.style;d.width=e+n;const c=a.offsetWidth||e;d.width=e+s;const u=c/(a.offsetWidth||e);h.removeChild(a),r=u*o}e.n=r,le[a]=r}else e.n=l;return e.t,e.u=s,e},de=t=>t,ce=(t=1.68)=>e=>J(e,+t),ue={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},pe=ht/2,me=2*ht,fe={[m]:ce,Quad:ce(2),Cubic:ce(3),Quart:ce(4),Quint:ce(5),Sine:t=>1-et(t*pe),Circ:t=>1-K(1-t*t),Expo:t=>t?J(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=J(2,--s))-1)/11;);return 1/J(4,3-s)-7.5625*J((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ct(+t,1,10),i=ct(+e,c,2),r=i/me*ot(1/s),n=me/i;return t=>0===t||1===t?t:-s*J(2,-10*(1-t))*tt((1-t-r)*n)}},ge=(()=>{const t={linear:de,none:de};for(let e in ue)for(let s in fe){const i=fe[s],r=ue[e];t[e+s]=s===m||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ye={linear:de,none:de},ve=t=>{if(ye[t])return ye[t];if(t.indexOf("(")<=-1){const e=ue[t]||t.includes("Back")||t.includes("Elastic")?ge[t]():ge[t];return e?ye[t]=e:de}{const e=t.slice(0,-1).split("("),s=ge[e[0]];return s?ye[t]=s(...e[1].split(",")):de}},_e=["steps(","irregular(","linear(","cubicBezier("],be=t=>{if(O(t))for(let e=0,s=_e.length;e<s;e++)if(P(t,_e[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),de;return H(t)?t:O(t)?ve(t):de},Te={t:0,n:0,u:null,o:null,d:null,s:null},xe={t:0,n:0,u:null,o:null,d:null,s:null},we={},Se={func:null},$e=[null],ke=[null,null],Ee={to:null};let Ce,Ne,De=0,Ie=0;class Ae extends ie{constructor(t,e,s,i,n=!1,o=0,a=0){super(e,s,i),++Ie;const l=oe(t),h=l.length,d=e.keyframes,u=d?_t(((t,e)=>{const s={};if(M(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(G);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];G(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=St(e.duration,A.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(G(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s})(d,e),e):e,{id:m,delay:f,duration:g,ease:y,playbackEase:v,modifier:_,composition:b,onRender:T}=u,x=s?s.defaults:A.defaults,w=St(y,x.ease),S=St(v,x.playbackEase),$=S?be(S):null,k=!X(w.ease),E=k?w.ease:St(y,$?"linear":x.ease),C=k?w.settlingDuration:St(g,x.duration),N=St(f,x.delay),D=_||x.modifier,I=X(b)&&h>=p?r.none:X(b)?x.composition:b,B=this._offset+(s?s._offset:0);k&&(w.parent=this);let L=NaN,R=NaN,P=0,F=0;for(let t=0;t<h;t++){const e=l[t],i=o||t,d=a||h;let p=NaN,m=NaN;for(let t in u)if(G(t)){const o=kt(e,t),a=Pt(t,e,o);let l=u[t];const h=M(l);if(n&&!h&&(ke[0]=l,ke[1]=l,l=ke),h){const t=l.length,e=!V(l[0]);2===t&&e?(Ee.to=l,$e[0]=Ee,Ce=$e):t>2&&e?(Ce=[],l.forEach((t,e)=>{e?1===e?(ke[1]=t,Ce.push(ke)):Ce.push(t):ke[0]=t})):Ce=l}else $e[0]=l,Ce=$e;let f=null,g=null,y=NaN,v=0,_=0;for(let t=Ce.length;_<t;_++){const n=Ce[_];V(n)?Ne=n:(Ee.to=n,Ne=Ee),Se.func=null;const l=$t(Ne.to,e,i,d,Se);let h;V(l)&&!X(l.to)?(Ne=l,h=l.to):h=l;const u=$t(Ne.from,e,i,d),p=Ne.ease,m=!X(p)&&!X(p.ease),b=m?p.ease:p||E,T=m?p.settlingDuration:$t(St(Ne.duration,t>1?$t(C,e,i,d)/t:C),e,i,d),x=$t(St(Ne.delay,_?0:N),e,i,d),w=$t(St(Ne.composition,I),e,i,d),S=z(w)?w:r[w],$=Ne.modifier||D,k=!X(u),A=!X(h),L=M(h),R=L||k&&A,O=g?v+x:x,H=pt(B+O,12);F||!k&&!L||(F=1);let W=g;if(S!==r.none){f||(f=qt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=H;)if(W=t,t=t._nextRep,t&&t._absoluteStartTime>=H)for(;t;)Gt(t),t=t._nextRep}if(R){Dt(L?$t(h[0],e,i,d):u,Te),Dt(L?$t(h[1],e,i,d,Se):h,xe);const t=Ct(e,a,o,we);0===Te.t&&(W?1===W._valueType&&(Te.t=1,Te.u=W._unit):(Dt(t,At),1===At.t&&(Te.t=1,Te.u=At.u)))}else A?Dt(h,xe):g?It(g,xe):Dt(s&&W&&W.parent.parent===s?W._value:Ct(e,a,o,we),xe),k?Dt(u,Te):g?It(g,Te):Dt(s&&W&&W.parent.parent===s?W._value:Ct(e,a,o,we),Te);if(Te.o&&(Te.n=Nt(W?W._toNumber:Dt(Ct(e,a,o,we),At).n,Te.n,Te.o)),xe.o&&(xe.n=Nt(Te.n,xe.n,xe.o)),Te.t!==xe.t)if(3===Te.t||3===xe.t){const t=3===Te.t?Te:xe,e=3===Te.t?xe:Te;e.t=3,e.s=vt(t.s),e.d=t.d.map(()=>e.n)}else if(1===Te.t||1===xe.t){const t=1===Te.t?Te:xe,e=1===Te.t?xe:Te;e.t=1,e.u=t.u}else if(2===Te.t||2===xe.t){const t=2===Te.t?Te:xe,e=2===Te.t?xe:Te;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Te.u!==xe.u){let t=xe.u?Te:xe;t=he(e,t,xe.u?xe.u:Te.u,!1)}if(xe.d&&Te.d&&xe.d.length!==Te.d.length){const t=Te.d.length>xe.d.length?Te:xe,e=t===Te?xe:Te;e.d=t.d.map((t,s)=>X(e.d[s])?0:e.d[s]),e.s=vt(t.s)}const U=pt(+T||c,12);let q=we[a];Y(q)||(we[a]=null);const j={parent:this,id:De++,property:a,target:e,_value:null,_func:Se.func,_ease:be(b),_fromNumbers:vt(Te.d),_toNumbers:vt(xe.d),_strings:vt(xe.s),_fromNumber:Te.n,_toNumber:xe.n,_numbers:vt(Te.d),_number:Te.n,_unit:xe.u,_modifier:$,_currentTime:0,_startTime:O,_delay:+x,_updateDuration:U,_changeDuration:U,_absoluteStartTime:H,_tweenType:o,_valueType:xe.t,_composition:S,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:q,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};S!==r.none&&Qt(j,f),isNaN(y)&&(y=j._startTime),v=pt(O+U,12),g=j,P++,xt(this,j)}(isNaN(R)||y<R)&&(R=y),(isNaN(L)||v>L)&&(L=v),3===o&&(p=P-_,m=P)}if(!isNaN(p)){let t=0;bt(this,e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===r.blend&&bt(Vt.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}h||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),R?(bt(this,t=>{t._startTime-t._delay||(t._delay-=R),t._startTime-=R}),L-=R):R=0,L||(L=c,this.iterationCount=0),this.targets=l,this.id=X(m)?Ie:m,this.duration=L===c?c:gt((L+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=T||x.onRender,this._ease=$,this._delay=R,this.iterationDuration=L,!this._autoplay&&F&&this.onRender(this)}stretch(t){const e=this.duration;if(e===yt(t))return this;const s=t/e;return bt(this,t=>{t._updateDuration=yt(t._updateDuration*s),t._changeDuration=yt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return bt(this,t=>{const e=t._func;if(e){const s=Ct(t.target,t.property,t._tweenType);Dt(s,At),Dt(e(),xe),t._fromNumbers=vt(At.d),t._fromNumber=At.n,t._toNumbers=vt(xe.d),t._strings=vt(xe.s),t._toNumber=xe.o?Nt(At.n,xe.n,xe.o):xe.n}}),this.duration===c&&this.restart(),this}revert(){return super.revert(),Ft(this)}then(t){return super.then(t)}}const Be={_head:null,_tail:null},Le=(t,e,s)=>{let i,r=Be._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),Tt(Be,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Re=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Le(e,s),xt(Be,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{Le(e,s,t)};return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function Pe(t,e,s){const i=oe(t);if(!i.length)return;const[r]=i,n=kt(r,e),o=Pt(e,r,n);let a=Ct(r,o);if(X(s))return a;if(Dt(a,At),0===At.t||1===At.t){if(!1===s)return At.n;{const t=he(r,At,s,!1);return`${pt(t.n,A.precision)}${t.u}`}}}const Fe=(t,e)=>{if(!X(e))return e.duration=c,e.composition=St(e.composition,r.none),new Ae(t,e,null,0,!0).resume()},Me=(t,e,s)=>{const i=ne(t);for(let t=0,r=i.length;t<r;t++)Le(i[t],s,e&&e.controlAnimation&&e);return Kt(i,e,s),i},Ve=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),X(e))return s;if(z(+e))return+e;const i=e,r=t?t.labels:null,n=!Y(r),o=((t,e)=>{if(P(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!X(o),l=C.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return Nt(d,c,t[0])}return a?o:n?X(r[i])?s:r[i]:s};function ze(t,e,s,i,r,n){const o=z(t.duration)&&t.duration<=c?s-c:s;e.composition&&Lt(e,o,1,1,1);const a=i?new Ae(i,t,e,o,!1,r,n):new ie(t,e,o);return e.composition&&a.init(!0),xt(e,a),bt(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=function(t){return gt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}let Oe=0;class He extends ie{constructor(t={}){super(t,null,0),++Oe,this.id=X(t.id)?Oe:t.id,this.duration=0,this.labels={};const e=t.defaults,s=A.defaults;this.defaults=e?_t(e,s):s,this.composition=St(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=St(t.playbackEase,s.playbackEase);this._ease=i?be(i):null,this.iterationDuration=0}add(t,e,s){const i=V(e),r=V(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(H(s)){const e=s,r=ne(t),n=this.duration,o=this.iterationDuration,a=i.id;let l=0;const h=r.length;r.forEach(t=>{const s={...i};this.duration=n,this.iterationDuration=o,X(a)||(s.id=a+"-"+l),ze(s,this,Ve(this,e(t,l,h,this)),t,l,h),l++})}else ze(i,this,Ve(this,s),t)}else ze(t,this,Ve(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(X(t)||t&&X(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return X(e)?this:(e.duration=c,e.composition=r.replace,this.add(t,e,s))}call(t,e){return X(t)||t&&!H(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return X(t)||t&&!O(t)||(this.labels[t]=Ve(this,e)),this}remove(t,e){return Kt(ne(t),this,e),this}stretch(t){const e=this.duration;if(e===yt(t))return this;const s=t/e,i=this.labels;bt(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return bt(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),bt(this,t=>t.revert,!0),Ft(this)}then(t){return super.then(t)}}const Xe=t=>new He(t).init();class Ye{constructor(t,e){I.current&&I.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},n={v:1,autoplay:!1},o={};if(this.targets=[],this.animations={},this.callbacks=null,!X(t)&&!X(e)){for(let t in e){const s=e[t];G(t)?o[t]=s:P(t,"on")?n[t]=s:i[t]=s}this.callbacks=new Ae({v:0},n);for(let e in o){const s=o[e],n=V(s);let a={},l="+=0";if(n){const t=s.unit;O(t)&&(l+=t)}else a.duration=s;a[e]=n?_t({to:l},s):l;const h=_t(i,a);h.composition=r.replace,h.autoplay=!1;const d=this.animations[e]=new Ae(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(X(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return bt(d,e=>{if(M(t))for(let s=0,i=t.length;s<i;s++)X(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;X(s)||(e._ease=be(s)),e._currentTime=0}),X(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=v,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const We=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i);var Ue=Object.freeze({__proto__:null,clamp:ct,damp:(t,e,s,i)=>i?1===i?e:ft(t,e,1-Math.exp(-i*s*.1)):t,degToRad:t=>t*Math.PI/180,lerp:ft,mapRange:We,padEnd:(t,e,s)=>`${t}`.padEnd(e,s),padStart:(t,e,s)=>`${t}`.padStart(e,s),radToDeg:t=>180*t/Math.PI,round:pt,roundPad:(t,e)=>(+t).toFixed(e),snap:mt,wrap:(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e});const qe=10*p;class je{constructor(t={}){const e=!X(t.bounce)||!X(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/p,this.maxIterations=this.maxDuration/this.timeStep/p,this.bn=ct(St(t.bounce,.5),-1,1),this.pd=ct(St(t.duration,628),10*A.timeScale,qe*A.timeScale),this.m=ct(St(t.mass,1),1,qe),this.s=ct(St(t.stiffness,100),c,qe),this.d=ct(St(t.damping,10),c,qe),this.v=ct(St(t.velocity,0),-1e4,qe),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||v,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?it(-n*e*s)*(1*et(i*n)+r*tt(i*n)):1===e?(1+r*n)*it(-n*s):((1+r)*it((-e*s+i)*n)+(1-r)*it((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===A.timeScale?this.pd/p:this.pd;this.m=1,this.v=0,this.s=J(2*ht/t,2),this.bn>=0?this.d=4*(1-this.bn)*ht/t:this.d=4*ht/(t*(1+this.bn)),this.s=pt(ct(this.s,c,qe),3),this.d=pt(ct(this.d,c,300),3)}calculateBDFromSD(){const t=2*ht/K(this.s);this.pd=t*(1===A.timeScale?p:1);const e=this.d/(2*K(this.s));this.bn=e<=1?1-this.d*t/(4*ht):4*ht/(this.d*t)-1,this.bn=pt(ct(this.bn,-1,1),3),this.pd=pt(ct(this.pd,10*A.timeScale,qe*A.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=ct(K(o/r),c,p),h=this.zeta=n/(2*K(o*r));h<1?(this.wd=l*K(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*K(h*h-1),this.b=(h*l-a)/this.wd);let d=0,u=0,m=0;for(;u<=t&&m<=e;)st(1-this.solve(d))<s?u++:u=0,this.solverDuration=d,d+=i,m++;this.settlingDuration=pt(this.solverDuration*p,0)*A.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=ct(St(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=ct(St(t,1),10*A.timeScale,qe*A.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ct(St(t,100),c,qe),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=ct(St(t,10),c,qe),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=ct(St(t,1),1,qe),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ct(St(t,0),-1e4,qe),this.compute()}}const Ge=t=>new je(t),Qe=t=>(console.warn("createSpring() is deprecated use spring() instead"),new je(t)),Ze=t=>{t.cancelable&&t.preventDefault()};class Je{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:v,remove:v}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Ke{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,s=0;for(;e&&e!==i;)t(e,s),e=e.parentElement,s++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const ts=(t,e)=>t&&H(t)?t(e):t;let es=0;class ss{constructor(t,e={}){if(!t)return;I.current&&I.current.register(this);const r=e.x,n=e.y,o=e.trigger,a=e.modifier,l=e.releaseEase,h=l&&be(l),d=!X(l)&&!X(l.ease),c=V(r)&&!X(r.mapTo)?r.mapTo:"translateX",p=V(n)&&!X(n.mapTo)?n.mapTo:"translateY",m=ts(e.container,this);this.containerArray=M(m)?m:null,this.$container=m&&!this.containerArray?ne(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=V(t)?new Je(t):ne(t)[0],this.$trigger=ne(o||t)[0],this.fixed="fixed"===Pe(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:Ge({mass:St(e.releaseMass,1),stiffness:St(e.releaseStiffness,80),damping:St(e.releaseDamping,20)}),this.releaseYSpring=d?l:Ge({mass:St(e.releaseMass,1),stiffness:St(e.releaseStiffness,80),damping:St(e.releaseDamping,20)}),this.releaseEase=h||ge.outQuint,this.hasReleaseSpring=d,this.onGrab=e.onGrab||v,this.onDrag=e.onDrag||v,this.onRelease=e.onRelease||v,this.onUpdate=e.onUpdate||v,this.onSettle=e.onSettle||v,this.onSnap=e.onSnap||v,this.onResize=e.onResize||v,this.onAfterResize=e.onAfterResize||v,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),X(r)||!0===r)f[c]=0;else if(V(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[c]=e}else!1===r&&(f[c]=0,this.disabled[0]=1);if(X(n)||!0===n)f[p]=0;else if(V(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[p]=e}else!1===n&&(f[p]=0,this.disabled[1]=1);this.animate=new Ye(this.$target,f),this.xProp=c,this.yProp=p,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-u,u,u,-u],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=F(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new Ke(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new ie({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new ie({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!X(m),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?c:p,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=lt(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new ie({autoplay:!1,duration:150*A.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=e,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),V(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=F(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=pt(ct(K(t*t+e*e)/r*o,a,l),5);const d=at(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=pt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=mt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=pt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=mt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return pt(this.animate[this.xProp](),A.precision)}set x(t){this.setX(t,!1)}get y(){return pt(this.animate[this.yProp](),A.precision)}set y(t){this.setY(t,!1)}get progressX(){return We(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(We(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return We(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(We(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=pt(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=pt(this.useWin?s.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=e,this.scrollBounds[0]=e-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=e-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const e=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=s.innerWidth,l=this.window[1]=s.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?ct(d,a,d):d,this.scrollView[1]=h?ct(c,l,c):c,this.updateScrollCoords();const{width:v,height:_,left:b,top:T,right:x,bottom:w}=t.getBoundingClientRect();this.dragArea[2]=pt(h?ct(v,a,a):v,0),this.dragArea[3]=pt(h?ct(_,l,l):_,0);const S=Pe(t,"overflow"),$="visible"===S,k="hidden"===S;if(this.canScroll=!u&&this.contained&&(t===i.body&&$||!k&&!$)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!M(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-v:0,c=i?this.scrollView[1]-o-_:0;this.targetBounds[0]=pt(r.top+s-(h?0:T),0),this.targetBounds[1]=pt(r.right+e-(h?a:x),0),this.targetBounds[2]=pt(r.bottom+s-(h?l:w),0),this.targetBounds[3]=pt(r.left+e-(h?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-pt(r.top-(u?ct(T,0,l):T)+o-m,0),this.containerBounds[1]=-pt(r.right-(u?ct(x,0,a):x)-d+f,0),this.containerBounds[2]=-pt(r.bottom-(u?ct(w,0,l):w)-c+g,0),this.containerBounds[3]=-pt(r.left-(u?ct(b,0,a):b)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(e,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=ts(t.container,this),o=ts(t.containerPadding,this)||0,a=M(o)?o:[o,o,o,o],l=this.x,h=this.y,d=ts(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=ts(t.dragThreshold,this),p={mouse:3,touch:7};if(z(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;X(t)||(p.mouse=t),X(e)||(p.touch=e)}this.containerArray=M(n)?n:null,this.$container=n&&!this.containerArray?ne(n)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=St(a,[0,0,0,0]),this.containerFriction=ct(St(ts(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ct(St(ts(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=ts(V(e)&&!X(e.snap)?e.snap:t.snap,this),this.snapY=ts(V(r)&&!X(r.snap)?r.snap:t.snap,this),this.scrollSpeed=St(ts(t.scrollSpeed,this),1.5),this.scrollThreshold=St(ts(t.scrollThreshold,this),20),this.dragSpeed=St(ts(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=St(ts(t.minVelocity,this),0),this.maxVelocity=St(ts(t.maxVelocity,this),50),this.velocityMultiplier=St(ts(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(ct(l,y,f),!0),this.setY(ct(h,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],l=this.scroll.x,h=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?ct(d,this.window[0],d):d,p=this.useWin?ct(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[v,_]=this.coords,[b,T,x,w]=this.scrollBounds,S=pt(ct((_-b+t)/y,-1,0)*g,0),$=pt(ct((v-T-e)/y,0,1)*g,0),k=pt(ct((_-x-s)/y,0,1)*g,0),E=pt(ct((v-w+i)/y,-1,0)*g,0);if(S||k||E||$){const[t,e]=this.disabled;let s=l,i=h;t||(s=pt(ct(l+(E||$),0,r-o),0),this.coords[0]-=l-s),e||(i=pt(ct(h+(S||k),0,n-a),0),this.coords[1]-=h-i),this.useWin?this.$scrollContainer.scrollBy(-(l-s),-(h-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,l,h]=this.pointer;this.coords[0]+=(r-l)*this.dragSpeed,this.coords[1]+=(n-h)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-l,n-h),this.angle=lt(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return Kt([this],null,"x"),Kt([this],null,"y"),Kt([this],null,"progressX"),Kt([this],null,"progressY"),Kt([this.scroll]),Kt([this.overshootCoords]),this}scrollInView(t,e=0,s=ge.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[l,h,d,c]=o,p=pt(ct(r-l,-u,0),0),m=pt(ct(i-h,0,u),0),f=pt(ct(r-d,0,u),0),g=pt(ct(i-c,-u,0),0);new Ae(n,{x:pt(n.x+(g?g-e:m?m+e:0),0),y:pt(n.y+(p?p-e:f?f+e:0),0),duration:X(t)?350*A.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=Fe(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=ge.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,l]=this.containerPadding,h=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+l+e,p=this.isOutOfBounds([h,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=ct(mt(i,this.snapX),u,d),a=ct(mt(r,this.snapY),h,c),l=X(t)?350*A.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,l,s),n||2!==p&&3!==p||this.animate[this.yProp](a,l,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const s=t.changedTouches,r=s?s[0].clientX:t.clientX,n=s?s[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[l,h,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>h?h+(p-h)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<l?l+(m-l)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=Pe(this.$target,"zIndex",!1);es=(f>es?f:es)+1,this.targetStyles=Fe(this.$target,{zIndex:es}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Fe(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,ge.out(3)),this.onGrab(this),i.addEventListener("touchmove",this),i.addEventListener("touchend",this),i.addEventListener("touchcancel",this),i.addEventListener("mousemove",this),i.addEventListener("mouseup",this),i.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let l=t.target,h=!1,d=!1,c=!1;for(;e&&l&&l!==this.$trigger;){const t=Pe(l,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=l;if(e>s){c=!0,h=t<=3,d=t>=e-s-3;break}}l=l.parentElement}c&&(!h&&!d||h&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(Ze(t),this.triggerStyles||(this.triggerStyles=Fe(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",Ze,{passive:!1}),this.$trigger.addEventListener("touchmove",Ze,{passive:!1}),this.$trigger.addEventListener("touchend",Ze),(this.dragged||!this.disabled[0]&&st(o)>this.dragThreshold||!this.disabled[1]&&st(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[s,n,o,a,l,h]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,v=this.releaseEase,_=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,x=this.y,w=this.computeVelocity(s-l,n-h),S=this.angle=lt(n-a,s-o),$=150*w,k=(1-this.releaseContainerFriction)*this.dragSpeed,E=T+et(S)*$,C=x+tt(S)*$,N=E>c?c+(E-c)*k:E<p?p+(E-p)*k:E,D=C>u?u+(C-u)*k:C<d?d+(C-d)*k:C,I=this.destX=ct(pt(mt(N,this.snapX),5),p,c),B=this.destY=ct(pt(mt(D,this.snapY),5),d,u),L=this.isOutOfBounds(this.containerBounds,E,C);let R=0,P=0,F=v,M=v,V=0;if(b.x=T,b.y=x,!t){const t=I===c?T>c?-1:1:T<p?-1:1,s=pt(T-I,0);g.velocity=e&&_?s?$*t/st(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=g;R=T===I?0:_?r:r-n*A.timeScale,_&&(F=i),R>V&&(V=R)}if(!e){const e=B===u?x>u?-1:1:x<d?-1:1,s=pt(x-B,0);y.velocity=t&&_?s?$*e/st(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=y;P=x===B?0:_?r:r-n*A.timeScale,_&&(M=i),P>V&&(V=P)}if(!_&&L&&k&&(R||P)){const t=r.blend;new Ae(b,{x:{to:N,duration:.65*R},y:{to:D,duration:.65*P},ease:v,composition:t}).init(),new Ae(b,{x:{to:I,duration:R},y:{to:B,duration:P},ease:v,composition:t}).init(),this.overshootTicker.stretch(at(R,P)).restart()}else t||this.animate[this.xProp](I,R,F),e||this.animate[this.yProp](B,P,M);this.scrollInView(V,this.scrollThreshold,v);let z=!1;I!==m&&(this.snapped[0]=I,this.snapX&&(z=!0)),B!==f&&this.snapY&&(this.snapped[1]=B,this.snapY&&(z=!0)),z&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",Ze),this.$trigger.removeEventListener("touchmove",Ze),this.$trigger.removeEventListener("touchend",Ze),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=Fe(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":Ze(t)}}}const is=(t=v)=>new ie({duration:1*A.timeScale,onComplete:t},null,0).resume(),rs=t=>{let e;return(...s)=>{let i,r,n,o;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,e.revert());const a=t(...s);return a&&!H(a)&&a.revert&&(e=a),X(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),a||v}};class ns{constructor(t={}){I.current&&I.current.register(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||ne(e)[0]||i);const n=t.defaults,o=A.defaults,a=t.mediaQueries;if(this.defaults=n?_t(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const e=s.matchMedia(a[t]);this.mediaQueryLists[t]=e,e.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=I.current,s=I.root,i=A.defaults;I.current=this,I.root=this.root,A.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return I.current=e,I.root=s,A.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);H(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,H(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);H(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,H(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);H(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(H(s))return s(this);const i=rs(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,l=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;l--;)i[l](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const os=(t,e)=>t&&H(t)?t(e):t,as=new Map;class ls{constructor(t){this.element=t,this.useWin=this.element===i.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new ie({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;bt(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ie({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=pt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ie({autoplay:!1,duration:250*A.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ie({autoplay:!1,duration:500*A.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?s:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,e=this.element;this.scrollX=pt(t?s.scrollX:e.scrollLeft,0),this.scrollY=pt(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=i.createElement("div");i.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return i.body.removeChild(t),e})()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){bt(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),bt(this,t=>{t.refresh(),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?s:this.element).removeEventListener("scroll",this),as.delete(this.element)}}const hs=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:l,u:h}=Dt(a,At);let d=l;return"%"===h?d=l/100*s:h&&(d=he(t,At,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},ds=(t,e,s,i,r)=>{let n;if(O(e)){const o=C.exec(e);if(o){const a=o[0],l=a[0],h=e.split(a),d="min"===h[0],c="max"===h[0],u=hs(t,h[0],s,i,r),p=hs(t,h[1],s,i,r);if(d){const e=Nt(hs(t,"min",s),p,l);n=e<u?u:e}else if(c){const e=Nt(hs(t,"max",s),p,l);n=e>u?u:e}else n=Nt(u,p,l)}else n=hs(t,e,s,i,r)}else n=e;return pt(n,0)},cs=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[o]){e=i;break}}return e};let us=0;const ps=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ms{constructor(t={}){I.current&&I.current.register(this);const e=St(t.sync,"play pause"),s=e?be(e):null,r=e&&("linear"===e||e===de),n=e&&!(s===de&&!r),o=e&&(z(e)||!0===e||r),a=e&&O(e)&&!n&&!o,l=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,h=a&&l.length>2;this.index=us++,this.id=X(t.id)?this.index:t.id,this.container=(t=>{const e=t&&ne(t)[0]||i.body;let s=as.get(e);return s||(s=new ls(e),as.set(e,s)),s})(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!l,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=l&&!h&&l[0]?l[0]:v,this.onSyncLeave=l&&!h&&l[1]?l[1]:v,this.onSyncEnterForward=l&&h&&l[0]?l[0]:v,this.onSyncLeaveForward=l&&h&&l[1]?l[1]:v,this.onSyncEnterBackward=l&&h&&l[2]?l[2]:v,this.onSyncLeaveBackward=l&&h&&l[3]?l[3]:v,this.onEnter=t.onEnter||v,this.onLeave=t.onLeave||v,this.onEnterForward=t.onEnterForward||v,this.onLeaveForward=t.onLeaveForward||v,this.onEnterBackward=t.onEnterBackward||v,this.onLeaveBackward=t.onLeaveBackward||v,this.onUpdate=t.onUpdate||v,this.onSyncComplete=t.onSyncComplete||v,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=St(t.debug,!1),this._next=null,this._prev=null,xt(this.container,this),is(()=>{if(!this.reverted){if(!this.target){const e=ne(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,X(t)||(t.persist=!0),!this._params.target)){let e;X(t.targets)?bt(t,t=>{t.targets&&!e&&(e=cs(t))}):e=cs(t),this.target=e||i.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:pt(ct(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=St(os(t.repeat,this),!0),this.horizontal="x"===St(os(t.axis,this),"y"),this.enter=St(os(t.enter,this),"end start"),this.leave=St(os(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,s=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=i.createElement("div"),n=i.createElement("div"),o=i.createElement("div"),a=ps[this.index%ps.length],l=t.useWin,h=l?t.winWidth:t.width,d=l?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,v=e?60:g,_=e?v:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,w=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${w("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${w("sticky",0,0,e?h:g,e?g:d)}`,s||(n.style.cssText+=`background:\n ${x("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${w("relative",0,0,e?c:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${x("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const S=[" enter: "," leave: "];this.coords.forEach((t,s)=>{const r=s>1,l=(r?0:this.offset)+t,m=s%2,f=l<_,g=l>(r?e?h:d:e?c:u)-_,b=(r?m&&!f:!m&&!f)||g,T=i.createElement("div"),x=i.createElement("div"),$=e?b?"right":"left":b?"bottom":"top",k=b?(e?v:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${S[m]}${this.thresholds[s]}`,T.style.cssText=`${w("absolute",0,0,v,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${b?"end":"start"};\n border-${$}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?b?"right":"left":b?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&b||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?b?"top-left":"top-right":b?"top-left":"bottom-left"}-radius: 5px;\n border-${e?b?"bottom-left":"bottom-right":b?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(x);let E=l-k+(e?1:0);T.style[e?"left":"top"]=`${E}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Pe(t.element,"position")&&(this.debugStyles=Fe(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,s=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0)),a.parentElement;a&&a!==s.element&&a!==i.body;){const e="sticky"===Pe(a,"position")&&Fe(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const l=e.getBoundingClientRect(),h=s.scale,d=(r?l.left+s.scrollX-s.left:l.top+s.scrollY-s.top)*h,c=(r?l.width:l.height)*h,u=r?s.width:s.height,p=(r?s.scrollWidth:s.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",v="end",_="start";if(O(m)){const t=m.split(" ");v=t[0],g=t.length>1?t[1]:g}else if(V(m)){const t=m;X(t.container)||(v=t.container),X(t.target)||(g=t.target)}else z(m)&&(v=m);if(O(f)){const t=f.split(" ");_=t[0],y=t.length>1?t[1]:y}else if(V(f)){const t=f;X(t.container)||(_=t.container),X(t.target)||(y=t.target)}else z(f)&&(_=f);const b=ds(e,g,c),T=ds(e,y,c),x=b+d-u,w=T+d-p,S=ds(e,v,u,x,w),$=ds(e,_,u,x,w),k=b+d-S,E=T+d-$,C=E-k;this.offset=d,this.offsetStart=k,this.offsetEnd=E,this.distance=C<=0?0:C,this.thresholds=[g,y,v,_],this.coords=[b,T,S,$],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,l=a<=this.offsetStart,h=a>=this.offsetEnd,d=!l&&!h,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(l&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&z(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=pt(ft(e,g,ft(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return Tt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const fs=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,gs=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?de:r=>0===r||1===r?r:fs(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=fs(r,e,s)-t,i>0?o=r:n=r}while(st(i)>1e-7&&++a<100);return r})(r,t,s),e,i),ys=(t=10,e)=>{const s=e?rt:nt;return e=>s(ct(e,0,1)*t)*(1/t)},vs=(...t)=>{const e=t.length;if(!e)return de;const s=e-1,i=t[0],r=t[s],n=[0],o=[Z(i)];for(let e=1;e<s;e++){const i=t[e],r=O(i)?i.trim().split(" "):[i],a=r[0],l=r[1];n.push(X(l)?e/s:Z(l)/100),o.push(Z(a))}return o.push(Z(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},_s=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(ct(o,r,1))}return s.push(1),vs(...s)};var bs=Object.freeze({__proto__:null,Spring:je,createSpring:Qe,cubicBezier:gs,eases:ge,irregular:_s,linear:vs,spring:Ge,steps:ys});const Ts=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(pt(t(i/e),4));return`linear(${s.join(", ")})`},xs={},ws=t=>{let e=xs[t];if(e)return e;if(e="linear",O(t)){if(P(t,"linear")||P(t,"cubic-")||P(t,"steps")||P(t,"ease"))e=t;else if(P(t,"cubicB"))e=R(t);else{const s=ve(t);H(s)&&(e=s===de?"linear":Ts(s))}xs[t]=e}else if(H(t)){const s=Ts(t);s&&(e=s)}else t.ease&&(e=Ts(t.ease));return e},Ss=["x","y","z"],$s=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Ss],ks=(()=>[...Ss,...g.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let Es=null;const Cs=(t,e,s,i,r)=>{let n=O(e)?e:$t(e,s,i,r);return z(n)?$s.includes(t)||P(t,"translate")?`${n}px`:P(t,"rotate")||P(t,"skew")?`${n}deg`:`${n}`:n},Ns=(t,e,s,i,r,n)=>{let o="0";const a=X(i)?getComputedStyle(t)[e]:Cs(e,i,t,r,n);return o=X(s)?M(i)?i.map(s=>Cs(e,s,t,r,n)):a:[Cs(e,s,t,r,n),a],o};class Ds{constructor(t,s){I.current&&I.current.register(this),Y(Es)&&(!e||!X(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(g.forEach(t=>{const e=P(t,"skew"),s=P(t,"scale"),i=P(t,"rotate"),r=P(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),Es=!0):Es=!1);const i=oe(t),r=i.length;r||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const n=St(s.ease,ws(A.defaults.ease)),o=n.ease&&n,a=St(s.autoplay,A.defaults.autoplay),h=!(!a||!a.link)&&a,d=s.alternate&&!0===s.alternate,c=s.reversed&&!0===s.reversed,u=St(s.loop,A.defaults.loop),_=!0===u||u===1/0?1/0:z(u)?u+1:1,b=d?c?"alternate-reverse":"alternate":c?"reverse":"normal",T=ws(n),x=1===A.timeScale?1:p;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||A.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!a||!1!==h,this.reversed=c,this.persist=St(s.persist,A.defaults.persist),this.autoplay=a,this._speed=St(s.playbackRate,A.defaults.playbackRate),this._resolve=v,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const i=t[l],a=ks.some(t=>s.hasOwnProperty(t)),h=t.style,d=this._inlineStyles[e]={},c=(o?o.settlingDuration:$t(St(s.duration,A.defaults.duration),t,e,r))*x,u=$t(St(s.delay,A.defaults.delay),t,e,r)*x,p=St(s.composition,"replace");for(let o in s){if(!G(o))continue;const l={},m={iterations:_,direction:b,fill:"both",easing:T,duration:c,delay:u,composite:p},y=s[o],v=!!a&&(g.includes(o)?o:f.get(o)),w=v?"transform":o;let S;if(d[w]||(d[w]=h[w]),V(y)){const s=y,a=St(s.ease,n),d=a.ease&&a,f=s.to,g=s.from;if(m.duration=(d?d.settlingDuration:$t(St(s.duration,c),t,e,r))*x,m.delay=$t(St(s.delay,u),t,e,r)*x,m.composite=St(s.composition,p),m.easing=ws(a),S=Ns(t,o,g,f,e,r),v?(l[`--${v}`]=S,i[v]=S):l[o]=Ns(t,o,g,f,e,r),Re(this,t,o,l,m),!X(g))if(v){const t=`--${v}`;h.setProperty(t,l[t][0])}else h[o]=l[o][0]}else S=M(y)?y.map(s=>Cs(o,s,t,e,r)):Cs(o,y,t,e,r),v?(l[`--${v}`]=S,i[v]=S):l[o]=S,Re(this,t,o,l,m)}if(a){let t=m;for(let e in i)t+=`${y[e]}var(--${e})) `;h.transform=t}}),h&&this.autoplay.link(this)}forEach(t){try{const e=O(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=A.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===A.timeScale?1:p);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];X(r)||r===m?s.removeProperty(R(e)):t.style[e]=r}t.getAttribute("style")===m&&t.removeAttribute("style")}),this}then(t=v){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=v};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const Is={animate:(t,e)=>new Ds(t,e),convertEase:Ts};let As=0,Bs=0;const Ls=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),Rs=(t,e)=>{let s=t[e];for(;s&&s.nodeType===Node.TEXT_NODE&&!s.textContent.trim();)s=s[e];return s&&s.nodeType===Node.TEXT_NODE},Ps=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},Fs=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},Ms=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,Ps(s)),i&&!e.has(i)&&e.set(i,Ps(i))},Vs=t=>{t.forEach((t,e)=>Fs(e,t)),t.clear()},zs={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},Os=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},Hs=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+Bs++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.total=1,n.delay=0,n.duration=0,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.hasTransform=!1,n.isAnimated=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.isInlined=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},Xs=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,l=t.state.rootNode,h=t.parentNode,d=s.transform,c=r.style.transform,u=!!h&&h.measuredIsRemoved,p=s.position;if(o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=Ls(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u,t.isInlined=t.measuredDisplay.includes("inline")&&(t=>Rs(t,"previousSibling")||Rs(t,"nextSibling"))(r),t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=Ps(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=Ps(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let m,f,g=0,y=0,v=0,_=0;if(!i){const t=e.getBoundingClientRect();g=t.left,y=t.top,v=t.width,_=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);X(e)||(a[t]=e)}if(a.left=g,a.top=y,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(m=g,f=y):(m=0,f=0);else{const e=h||l,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)m=g-s-r,f=y-i-n;else if(e===l){const t=l.properties.left,e=l.properties.top;m=g-t-l.properties.clientLeft,f=y-e-l.properties.clientTop}else m=g-s-r,f=y-i-n}return a.x=m,a.y=f,a.width=v,a.height=_,t},Ys=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},Ws=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},Us=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},qs=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(Fs(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(Fs(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},js=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.measuredIsRemoved&&t.layout.pendingRemoved.delete(t.$el)},Gs=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class Qs{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}get(t){const e=this.nodes.get(t.dataset.layoutId);if(e)return e.properties;console.warn("No node found on state")}getValue(t,e){if(!t||!t.dataset)return void console.warn(`No element found on state (${t})`);const s=this.nodes.get(t.dataset.layoutId);if(!s)return void console.warn("No node found on state");const i=s.properties[e];return X(i)?void 0:$t(i,t,s.index,s.total)}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,Ps(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||W(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?zs:getComputedStyle(e),a=!!n||"none"===o.display,l=!!n||"hidden"===o.visibility,h=!a&&!l,d=e.dataset.layoutId,c=Ls(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=Ls(i,u.$el),l=u.measuredIsVisible;if(a||!c&&(c||l||!h)){if(a&&!l&&h){Xs(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}Os(u),u=Hs(e,t,this,u)}else u=Hs(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.isAnimated=!1,u.hasVisibilityHidden=l,u.hasDisplayNone=a,u.hasVisibilitySwap=l&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),Xs(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const{children:t,root:e}=this.layout,s=M(t)?t:[t],i=[],r="*"===t?e:I.root;for(let t=0,e=s.length;t<e;t++){const e=s[t];i[t]=O(e)?r.querySelectorAll(e):e}const n=oe(i);this.nodes.clear(),this.rootNodes.clear();const o=this.registerElement(e,null);o.isTarget=!0,this.rootNode=o;const a=new Set;this.nodes.forEach((t,e)=>{t&&t.measuredIsInsideRoot&&a.add(e)});const l=new Set,h=[];for(let t=0,s=n.length;t<s;t++){const s=n[t];if(s&&1===s.nodeType&&s!==e){if(!Ls(e,s)){const t=s.dataset.layoutId;if(!t||!a.has(t))continue}l.has(s)||(l.add(s),h.push(s))}}for(let t=0,e=h.length;t<e;t++)this.ensureDetachedNode(h[t],l);for(let t=0,e=n.length;t<e;t++){const e=n[t],s=this.nodes.get(e.dataset.layoutId);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY;const d=this.nodes.size;return this.forEachNode(qs),this.forEachNode((t,e)=>{t.index=e,t.total=d}),this}}class Zs{constructor(t,e={}){I.current&&I.current.register(this);const s=e.frozen,i=e.added,r=e.removed,n=e.properties;if(this.params=e,this.root=oe(t)[0],this.id=As++,this.children=e.children||"*",this.absoluteCoords=!1,this.duration=St(e.duration,500),this.delay=St(e.delay,0),this.ease=St(e.ease,"inOut(3.5)"),this.onComplete=St(e.onComplete,v),this.frozenParams=s||{opacity:0},this.addedParams=i||{opacity:0},this.removedParams=r||{opacity:0},this.properties=new Set(["opacity","borderRadius"]),s)for(let t in s)this.properties.add(t);if(i)for(let t in i)this.properties.add(t);if(r)for(let t in r)this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoved=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new Qs(this),this.newState=new Qs(this),this.timeline=null,this.transformAnimation=null,this.frozen=[],this.removed=[],this.added=[],this.oldState.record(),Vs(this.transitionMuteStore)}revert(){return this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.root.classList.remove("is-animated"),this.frozen.length=this.removed.length=this.added.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>Vs(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode(Us),this}animate(t={}){const e=St(t.delay,this.delay),s=St(t.duration,this.duration),i=St(t.onComplete,this.onComplete),r=t.frozen?_t(t.frozen,this.frozenParams):this.frozenParams,n=t.added?_t(t.added,this.addedParams):this.addedParams,o=t.removed?_t(t.removed,this.removedParams):this.removedParams,a=this.oldState,l=this.newState,h=this.added,d=this.removed,c=this.frozen,u=this.pendingRemoved;h.length=d.length=c.length=0,a.forEachRootNode(Ms),l.record(),l.forEachRootNode(Ws);const p=[],m=[],f=[],g=[],y=l.rootNode.$el;l.forEachRootNode(t=>{const i=t.$el,r=t.id,y=t.parentNode,v=!!y&&y.branchAdded,_=!!y&&y.branchRemoved,b=!!y&&y.branchNotRendered;t.delay=+(H(e)?e(i,t.index,t.total):e),t.duration=+(H(s)?s(i,t.index,t.total):s);let T=a.nodes.get(r);const x=!T;x?(T=Gs(t,{},a),a.nodes.set(r,T),T.measuredIsRemoved=!0):T.measuredIsRemoved&&!t.measuredIsRemoved&&(Gs(t,T,a),T.measuredIsRemoved=!0);const w=T.parentNode,S=(w?w.id:null)!==(y?y.id:null),$=T.$el!==t.$el,k=T.measuredIsRemoved,E=t.measuredIsRemoved;if(!T.measuredIsRemoved&&!E&&!x&&(S||$)){const t=T.properties.left,e=T.properties.top,s=y||l.rootNode,i=s.id?a.nodes.get(s.id):null,r=i?i.properties.left:s.properties.left,n=i?i.properties.top:s.properties.top,o=i?i.properties.clientLeft:s.properties.clientLeft,h=i?i.properties.clientTop:s.properties.clientTop;T.properties.x=t-r-o,T.properties.y=e-n-h}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=T.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const C=u.has(i),N=T.measuredIsVisible,D=t.measuredIsVisible,I=!N&&D&&!b,A=!E&&(k||C)&&!v,B=E&&!k&&!_,L=B||E&&C&&!_;t.measuredIsRemoved&&N&&(t.$el.style.display=T.measuredDisplay,t.$el.style.visibility="visible",Gs(T,t,l)),B?(d.push(i),u.add(i)):!E&&C&&u.delete(i),A&&!b||I?(Ys(T,n),h.push(i)):L&&!b&&Ys(t,o);for(let e in t.properties)t.properties[e]=l.getValue(t.$el,e),T.properties[e]=a.getValue(t.$el,e);const R=(A||B)&&k!==E;let P=!1;if(t.isTarget&&(!t.measuredIsRemoved&&N||t.measuredIsRemoved&&D)){t.isInlined||"none"===t.properties.transform&&"none"===T.properties.transform||(t.hasTransform=!0,P=!0,f.push(i));for(let e in t.properties)if("transform"!==e&&(t.properties[e]!==T.properties[e]||R)){P=!0,m.push(i);break}}const F=P||A||L||I,M=t.isTarget&&F;t.isAnimated=M,t.branchAdded=v||A,t.branchRemoved=_||L,t.branchNotRendered=b||t.measuredIsRemoved;const V=Math.abs(t.properties.width-T.properties.width)>1,z=Math.abs(t.properties.height-T.properties.height)>1;t.sizeChanged=V||z,p.push(i),t.isTarget||(c.push(i),(F||t.sizeChanged)&&y&&y.isTarget&&y.isAnimated&&y.sizeChanged&&g.push(i))});const v={ease:St(t.ease,this.ease),duration:t=>l.nodes.get(t.dataset.layoutId).duration,delay:t=>l.nodes.get(t.dataset.layoutId).delay};if(this.timeline=Xe({onComplete:()=>{this.transformAnimation&&this.transformAnimation.cancel(),l.forEachRootNode(t=>{js(t),Us(t)});for(let t=0,e=f.length;t<e;t++){const e=f[t];e.style.transform=l.getValue(e,"transform")}this.root.classList.remove("is-animated"),i&&i(this),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||Vs(this.transitionMuteStore)})},onPause:()=>{this.transformAnimation&&this.transformAnimation.cancel(),l.forEachRootNode(js),this.root.classList.remove("is-animated"),i&&i(this)},composition:!1,defaults:v}),p.length){this.root.classList.add("is-animated");for(let t=0,e=p.length;t<e;t++){const e=p[t],s=e.dataset.layoutId,i=a.nodes.get(s),r=l.nodes.get(s),n=i.properties;Ms(r),r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||(e.style.display="block"),(e!==y||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===y&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px"),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none")}a.scrollX===window.scrollX&&a.scrollY===window.scrollY||requestAnimationFrame(()=>{window.scrollTo(a.scrollX,a.scrollY)});for(let t=0,e=m.length;t<e;t++){const e=m[t],s=e.dataset.layoutId,i=a.nodes.get(s),r=l.nodes.get(s),n=i.properties,o=r.properties;let h=!1;const d={composition:"none"};r.isInlined||(n.width!==o.width&&(d.width=[n.width,o.width],h=!0),n.height!==o.height&&(d.height=[n.height,o.height],h=!0),r.hasTransform||(d.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],h=!0)),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(d[t]=[e,s],h=!0)}),h&&this.timeline.add(e,d,0)}}if(c.length){for(let t=0,e=c.length;t<e;t++){const e=c[t];if(!a.nodes.get(e.dataset.layoutId).isInlined){const t=a.get(e);e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${t.x}px ${t.y}px`}this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${a.getValue(e,t)}`)})}for(let t=0,e=c.length;t<e;t++){const e=c[t],s=l.nodes.get(e.dataset.layoutId),i=l.get(e);this.timeline.call(()=>{s.isInlined||(e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${l.getValue(e,t)}`)})},s.delay+s.duration/2)}if(g.length){const t={};if(r)for(let e in r)t[e]=[{from:t=>a.getValue(t,e),ease:"in(1.75)",to:r[e]},{from:r[e],to:t=>l.getValue(t,e),ease:"out(1.75)"}];this.timeline.add(g,t,0)}}const _=f.length;if(_){for(let t=0;t<_;t++){const e=f[t];e.style.translate=`${a.get(e).x}px ${a.get(e).y}px`,e.style.transform=a.getValue(e,"transform")}this.transformAnimation=Is.animate(f,{translate:t=>`${l.get(t).x}px ${l.get(t).y}px`,transform:t=>l.getValue(t,"transform"),autoplay:!1,persist:!0,...v}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e),this}}const Js=Ue,Ks={},ti=t=>(...e)=>{const s=t(...e);return new Proxy(v,{apply:(t,e,[i])=>s(i),get:(t,e)=>ti((...t)=>{const i=Ks[e](...t);return t=>i(s(t))})})},ei=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?ti(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(e,s)):e)(...t);return Ks[t]||(Ks[t]=i),i},si=ei("roundPad",Js.roundPad),ii=ei("padStart",Js.padStart),ri=ei("padEnd",Js.padEnd),ni=ei("wrap",Js.wrap),oi=ei("mapRange",Js.mapRange),ai=ei("degToRad",Js.degToRad),li=ei("radToDeg",Js.radToDeg),hi=ei("snap",Js.snap),di=ei("clamp",Js.clamp),ci=ei("round",Js.round),ui=ei("lerp",Js.lerp,1),pi=ei("damp",Js.damp,1),mi=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let fi=0;const gi=(t,e=0,s=1,i=0)=>{let r=void 0===t?fi++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},yi=t=>t[mi(0,t.length-1)],vi=t=>{let e,s,i=t.length;for(;i;)s=mi(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},_i=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!X(o),l=a&&!X(o.ease)?o.ease:a?be(o):null,h=e.grid,d=e.axis,c=e.total,u=X(r)||0===r||"first"===r,p="center"===r,f="last"===r,g="random"===r,y=M(t),v=e.use,_=Z(y?t[0]:t),b=y?Z(t[1]):0,T=$.exec((y?t[1]:t)+m),x=e.start||0+(y?_:0);let w=u?0:z(r)?r:0;return(t,r,o,a)=>{const[u]=oe(t),m=X(c)?o:c,S=!X(v)&&(H(v)?v(u,r,m):Ct(u,v)),$=z(S)||O(S)&&z(+S)?+S:r;if(p&&(w=(m-1)/2),f&&(w=m-1),!s.length){for(let t=0;t<m;t++){if(h){const e=p?(h[0]-1)/2:w%h[0],i=p?(h[1]-1)/2:nt(w/h[0]),r=e-t%h[0],n=i-nt(t/h[0]);let o=K(r*r+n*n);"x"===d&&(o=-r),"y"===d&&(o=-n),s.push(o)}else s.push(st(w-t));i=at(...s)}l&&(s=s.map(t=>l(t/i)*i)),n&&(s=s.map(t=>d?t<0?-1*t:-t:st(i-t))),g&&(s=vi(s))}const k=y?(b-_)/i:_;let E=(a?Ve(a,X(e.start)?a.iterationDuration:x):x)+(k*pt(s[$],2)||0);return e.modifier&&(E=e.modifier(E)),T&&(E=`${E}${T[2]}`),E}};var bi=Object.freeze({__proto__:null,$:oe,clamp:di,cleanInlineStyles:Ft,createSeededRandom:gi,damp:pi,degToRad:ai,get:Pe,keepTime:rs,lerp:ui,mapRange:oi,padEnd:ri,padStart:ii,radToDeg:li,random:mi,randomPick:yi,remove:Me,round:ci,roundPad:si,set:Fe,shuffle:vi,snap:hi,stagger:_i,sync:is,wrap:ni});const Ti=t=>{const e=ne(t)[0];return e&&W(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},xi=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},wi=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[a],o=t.getCTM(),l=0===s;return{from:0,to:r,modifier:i=>{const a=i+s*r;if("a"===e){const e=xi(t,r,a,-1,l),s=xi(t,r,a,1,l);return 180*lt(s.y-e.y,s.x-e.x)/ht}{const s=xi(t,r,a,0,l);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},Si=(t,e=0)=>{const s=Ti(t);if(s)return{translateX:wi(s,"x",e),translateY:wi(s,"y",e),rotate:wi(s,"a",e)}},$i=(t,e=0,s=0)=>ne(t).map(t=>((t,e,s)=>{const i=p,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const l=new Proxy(t,{get(t,e){const s=t[e];return e===d?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],l=+s[1],h=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(K(s.a*s.a+s.b*s.b)+K(s.c*s.c+s.d*s.d))/2)}return e})(o),d=-1e3*r*h,c=l*i*h+d,u=i*h+(0===r&&1===l||1===r&&0===l?0:10*h)-c;if("butt"!==n){const e=r===l?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:H(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),l.setAttribute("draw",`${e} ${s}`)),l})(t,e,s)),ki=(t,e=.33)=>s=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const i=Ti(t);if(!i)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(i.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${i.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const r="path"===s.tagName,n=r?" ":",",o=s[h];o&&s.setAttribute(r?"d":"points",o);let a="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),h=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<h;e++){const d=e/(h-1),c=s.getPointAtLength(t*d),u=i.getPointAtLength(o*d),p=r?0===e?"M":"L":"";a+=p+pt(c.x,3)+n+c.y+" ",l+=p+pt(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[h]=l,[a,l]};var Ei=Object.freeze({__proto__:null,createDrawable:$i,createMotionPath:Si,morphTo:ki});const Ci="undefined"!=typeof Intl&&Intl.Segmenter,Ni=/\{value\}/g,Di=/\{i\}/g,Ii=/(\s+)/,Ai=/^\s+$/,Bi="line",Li="word",Ri="char",Pi="data-line";let Fi=null,Mi=null,Vi=null;const zi=t=>t.isWordLike||" "===t.segment||z(+t.segment),Oi=t=>t.setAttribute("aria-hidden","true"),Hi=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Xi={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},Yi=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&Yi(e)}},Wi=(t,e,s)=>{const i=t.getAttribute(Pi);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&Ai.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&Ai.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)Wi(t.children[r],e,s);return s},Ui=(t,e={})=>{let s="";const i=O(e.class)?` class="${e.class}"`:"",r=St(e.clone,!1),n=St(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},qi=(t,e,s,i,r,n,o,a,l)=>{const h=r===Bi,d=r===Ri,c=`_${r}_`,u=H(t)?t(s):t,p=h?"block":"inline-block";Vi.innerHTML=u.replace(Ni,`<i class="${c}"></i>`).replace(Di,`${d?l:h?o:a}`);const m=Vi.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),v=y.length;if(v){f.style.display=p,g.style.display=p,g.setAttribute(Pi,`${o}`),h||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${l}`));let t=v;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,h?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${Xi[r]}`),f};class ji{constructor(t,s={}){Fi||(Fi=Ci?new Ci([],{granularity:Li}):{segment:t=>{const e=[],s=t.split(Ii);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Ai.test(i)})}return e}}),Mi||(Mi=Ci?new Ci([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!Vi&&e&&(Vi=i.createElement("template")),I.current&&I.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:l,debug:h}=s,d=(t=M(t)?t[0]:t)&&t.nodeType?t:(re(t)||[])[0],c=!0===o?{}:o,u=!0===r||X(r)?{}:r,p=!0===n?{}:n;this.debug=St(h,!1),this.includeSpaces=St(l,!1),this.accessible=St(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=V(c)?Ui(Bi,c):c,this.wordTemplate=V(u)||this.linesOnly?Ui(Li,u):u,this.charTemplate=V(p)?Ui(Ri,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?i.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!H(t))return console.warn("Effect must return a function.");const e=rs(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>H(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,s=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],l=this.words,h=this.chars,d=Fi.segment(o),c=i.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=zi(t);if(!u||s&&u&&zi(u))a.push(e);else{const t=a.length-1,s=a[t];Ii.test(s)||Ii.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=s?Mi.segment(p):null,f=s?i.createDocumentFragment():i.createTextNode(u?o+" ":o);if(s){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=i.createTextNode(a);qi(s,h,d,f,Ri,n,-1,l.length,h.length)}}e?qi(e,l,f,c,Li,n,-1,l.length,h.length):s?c.appendChild(f):c.appendChild(i.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(i.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,s=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==i.fonts.status,l=r&&a;this.ready=!r||a,(l||t)&&this.effectsCleanups.forEach(t=>H(t)&&t(this)),s||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),l&&(s&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Hi(e,Li))),o&&(l||n)&&(this.chars=Hi(e,Ri));const h=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=h.length;t<e;t++){const e=h[t],{top:s,height:i}=e.getBoundingClientRect();!X(d)&&s-d>.5*i&&c++,e.setAttribute(Pi,`${c}`);const r=e.querySelectorAll(`[${Pi}]`);let n=r.length;for(;n--;)r[n].setAttribute(Pi,`${c}`);d=s}if(l){const t=i.createDocumentFragment(),s=new Set,a=[];for(let t=0;t<c+1;t++){const i=e.cloneNode(!0);Wi(i,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&s.add(e),e.removeChild(t))}),a.push(i)}s.forEach(Yi);for(let e=0,s=a.length;e<s;e++)qi(r,this.lines,a[e],t,Bi,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Hi(e,Li)),o&&(this.chars=Hi(e,Ri))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(l||!s)){const t=i.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach(Oi),this.words.forEach(Oi),this.chars.forEach(Oi)}return this.width=e.offsetWidth,(l||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const Gi=(t,e)=>new ji(t,e),Qi=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new ji(t,e));var Zi=Object.freeze({__proto__:null,TextSplitter:ji,split:Qi,splitText:Gi});t.$=oe,t.Animatable=Ye,t.AutoLayout=Zs,t.Draggable=ss,t.JSAnimation=Ae,t.Scope=ns,t.ScrollObserver=ms,t.Spring=je,t.TextSplitter=ji,t.Timeline=He,t.Timer=ie,t.WAAPIAnimation=Ds,t.animate=(t,e)=>new Ae(t,e,null,0,!1).init(),t.clamp=di,t.cleanInlineStyles=Ft,t.createAnimatable=(t,e)=>new Ye(t,e),t.createDraggable=(t,e)=>new ss(t,e),t.createDrawable=$i,t.createLayout=(t,e)=>new Zs(t,e),t.createMotionPath=Si,t.createScope=t=>new ns(t),t.createSeededRandom=gi,t.createSpring=Qe,t.createTimeline=Xe,t.createTimer=t=>new ie(t,null,0).init(),t.cubicBezier=gs,t.damp=pi,t.degToRad=ai,t.eases=ge,t.easings=bs,t.engine=Xt,t.get=Pe,t.irregular=_s,t.keepTime=rs,t.lerp=ui,t.linear=vs,t.mapRange=oi,t.morphTo=ki,t.onScroll=(t={})=>new ms(t),t.padEnd=ri,t.padStart=ii,t.radToDeg=li,t.random=mi,t.randomPick=yi,t.remove=Me,t.round=ci,t.roundPad=si,t.scrollContainers=as,t.set=Fe,t.shuffle=vi,t.snap=hi,t.split=Qi,t.splitText=Gi,t.spring=Ge,t.stagger=_i,t.steps=ys,t.svg=Ei,t.sync=is,t.text=Zi,t.utils=bi,t.waapi=Is,t.wrap=ni});
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).anime={})}(this,function(t){"use strict";const e="undefined"!=typeof window,s=e?window:null,i=e?document:null,r={replace:0,none:1,blend:2},n=Symbol(),o=Symbol(),a=Symbol(),l=Symbol(),h=Symbol(),d=Symbol(),c=1e-11,u=1e12,p=1e3,m="",f=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),g=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","matrix","matrix3d","perspective"],y=g.reduce((t,e)=>({...t,[e]:e+"("}),{}),v=()=>{},_=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,b=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,T=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,x=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,w=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,S=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,$=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,E=/([a-z])([A-Z])/g,k=/(\w+)(\([^)]+\)+)/g,C=/(\*=|\+=|-=)/,N=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,D={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:p,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:v,onBeforeUpdate:v,onUpdate:v,onLoop:v,onPause:v,onComplete:v,onRender:v},I={current:null,root:i},L={defaults:D,precision:4,timeScale:1,tickThreshold:200},A=e&&s.AnimeJSDevTools,B={version:"4.3.0",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(B));const R=t=>t.replace(E,"$1-$2").toLowerCase(),P=(t,e)=>0===t.indexOf(e),F=Date.now,V=Array.isArray,M=t=>t&&t.constructor===Object,O=t=>"number"==typeof t&&!isNaN(t),z=t=>"string"==typeof t,H=t=>"function"==typeof t,X=t=>void 0===t,Y=t=>X(t)||null===t,W=t=>e&&t instanceof SVGElement,U=t=>_.test(t),q=t=>P(t,"rgb")&&")"===t[t.length-1],j=t=>P(t,"hsl")&&")"===t[t.length-1],G=t=>!L.defaults.hasOwnProperty(t),Q=["opacity","rotate","overflow","color"],Z=t=>z(t)?parseFloat(t):t,J=Math.pow,K=Math.sqrt,tt=Math.sin,et=Math.cos,st=Math.abs,it=Math.exp,rt=Math.ceil,nt=Math.floor,ot=Math.asin,at=Math.max,lt=Math.atan2,ht=Math.PI,dt=Math.round,ct=(t,e,s)=>t<e?e:t>s?s:t,ut={},pt=(t,e)=>{if(e<0)return t;if(!e)return dt(t);let s=ut[e];return s||(s=ut[e]=10**e),dt(t*s)/s},mt=(t,e)=>V(e)?e.reduce((e,s)=>st(s-t)<st(e-t)?s:e):e?dt(t/e)*e:t,ft=(t,e,s)=>t+(e-t)*s,gt=t=>t===1/0?u:t===-1/0?-u:t,yt=t=>t<=c?c:gt(pt(t,11)),vt=t=>V(t)?[...t]:t,_t=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=X(r)?e[i]:r}return s},bt=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},Tt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},xt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},wt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),St=(t,e)=>X(t)?e:t,$t=(t,e,s,i,r)=>{let n;if(H(t))n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};else{if(!z(t)||!P(t,"var("))return t;n=()=>{const s=t.match(N),i=s[1],r=s[2];let n=getComputedStyle(e)?.getPropertyValue(i);return n&&n.trim()!==m||!r||(n=r.trim()),n||0}}return r&&(r.func=n),n()},Et=(t,e)=>t[o]?t[a]&&((t,e)=>{if(Q.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}})(t,e)?1:g.includes(e)||f.get(e)?3:P(e,"--")?4:e in t.style?2:e in t?0:1:0,kt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[d]||t).getPropertyValue(e);return"auto"===r?"0":r},Ct=(t,e,s,i)=>{const r=X(s)?Et(t,e):s;return 0===r?t[e]||0:1===r?t.getAttribute(e):3===r?((t,e,s)=>{const i=t.style.transform;let r;if(i){const n=t[l];let o;for(;o=k.exec(i);){const t=o[1],i=o[2].slice(1,-1);n[t]=i,t===e&&(r=i,s&&(s[e]=i))}}return i&&!X(r)?r:P(e,"scale")?"1":P(e,"rotate")||P(e,"skew")?"0deg":"0px"})(t,e,i):4===r?kt(t,e,i).trimStart():kt(t,e,i)},Nt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Dt=(t,e)=>{if(e.t=0,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(isNaN(s)){let s=t;"="===s[1]&&(e.o=s[0],s=s.slice(2));const n=!s.includes(" ")&&$.exec(s);if(n)return e.t=1,e.n=+n[1],e.u=n[2],e;if(e.o)return e.n=+s,e;if(U(r=s)||q(r)||j(r))return e.t=2,e.d=q(i=s)?(t=>{const e=b.exec(t)||T.exec(t),s=X(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):U(i)?(t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]})(i):j(i)?(t=>{const e=x.exec(t)||w.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=X(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=pt(255*wt(e,t,s+1/3),0),a=pt(255*wt(e,t,s),0),l=pt(255*wt(e,t,s-1/3),0)}return[o,a,l,n]})(i):[0,0,0,1],e;{const t=s.match(S);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(S)||[],e}}var i,r;return e.n=s,e},It=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=vt(t._toNumbers),e.s=vt(t._strings),e),Lt={t:0,n:0,u:null,o:null,d:null,s:null},At=(t,e,s,i,n)=>{const o=t.parent,a=t.duration,h=t.completed,d=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,f=t._loopDelay,g=t._reversed,v=t._alternate,_=t._hasChildren,b=t._delay,T=t._currentTime,x=b+d,w=e-b,S=ct(T,-b,a),$=ct(w,-b,a),E=w-T,k=$>0,C=$>=a,N=a<=c,D=2===n;let I=0,A=w,B=0;if(u>1){const e=~~($/(d+(C?0:f)));t._currentIteration=ct(e,0,u),C&&t._currentIteration--,I=t._currentIteration%2,A=$%(d+f)||0}const R=g^(v&&I),P=t._ease;let F=C?R?0:a:R?d-A:A;P&&(F=d*P(F/d)||0);const V=(o?o.backwards:w<T)?!R:!!R;if(t._currentTime=w,t._iterationTime=F,t.backwards=V,k&&!t.began?(t.began=!0,s||o&&(V||!o.began)||t.onBegin(t)):w<=0&&(t.began=!1),s||_||!k||t._currentIteration===p||t.onLoop(t),D||1===n&&(e>=b&&e<=x||e<=b&&S>b||e>=x&&S!==a)||F>=x&&S!==a||F<=b&&S>0||e<=S&&S===a&&h||C&&!h&&N){if(k&&(t.computeDeltaTime(S),s||t.onBeforeUpdate(t)),!_){const e=D||(V?-1*E:E)>=L.tickThreshold,n=t._offset+(o?o._offset:0)+b+F;let a,h,d,c,u=t._head,p=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,g=u._nextRep,v=u._prevRep,_=t!==r.none;if((e||(s!==o||n<=f+(g?g._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!_||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!g||g._isOverridden||n<=g._absoluteStartTime)&&(!v||v._isOverridden||n>=v._absoluteStartTime+v._changeDuration+u._delay))){const e=u._currentTime=ct(F-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,y=0===m,v=y&&g||0===s||1===s?-1:L.precision;let b,T;if(y)b=T=n(pt(ft(u._fromNumber,u._toNumber,s),v));else if(1===m)T=n(pt(ft(u._fromNumber,u._toNumber,s),v)),b=`${T}${u._unit}`;else if(2===m){const t=u._fromNumbers,e=u._toNumbers,i=pt(ct(n(ft(t[0],e[0],s)),0,255),0),r=pt(ct(n(ft(t[1],e[1],s)),0,255),0),o=pt(ct(n(ft(t[2],e[2],s)),0,255),0),a=ct(n(pt(ft(t[3],e[3],s),v)),0,1);if(b=`rgba(${i},${r},${o},${a})`,_){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(3===m){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(pt(ft(u._fromNumbers[t],u._toNumbers[t],s),v)),i=u._strings[t+1];b+=`${i?e+i:e}`,_&&(u._numbers[t]=e)}}if(_&&(u._number=T),i||t===r.blend)u._value=b;else{const t=u.property;a=u.target,g?a[t]=b:1===f?a.setAttribute(t,b):(h=a.style,3===f?(a!==d&&(d=a,c=a[l]),c[t]=b,p=1):2===f?h[t]=b:4===f&&h.setProperty(t,b)),k&&(B=1)}}if(p&&u._renderTransforms){let t=m;for(let e in c)t+=`${y[e]}${c[e]}) `;h.transform=t,p=0}u=u._next}!s&&B&&t.onRender(t)}!s&&k&&t.onUpdate(t)}return o&&N?!s&&(o.began&&!V&&w>0&&!h||V&&w<=c&&h)&&(t.onComplete(t),t.completed=!V):k&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,h||_||(t.completed=!0,s||o&&(V||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,B},Bt=(t,e,s,i,r)=>{const n=t._currentIteration;if(At(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,l=i?e:o._iterationTime,h=F();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;bt(o,e=>{if(a){const i=e.duration,r=e._offset+e._delay;s||!(i<=c)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&At(e,t,s,1,2),e.began=!1,e.completed=!1}),s||o.onLoop(o)}bt(o,t=>{const e=pt((l-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(h):r;d+=At(t,e,s,i,n),!t.completed&&u&&(u=!1)},a),!s&&d&&o.onRender(o),(u||a)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},Rt={},Pt=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&W(e)&&t in e.style){const e=Rt[t];if(e)return e;{const e=t?R(t):t;return Rt[t]=e,e}}return t},Ft=t=>{if(t._hasChildren)bt(t,Ft,!0);else{const e=t;e.pause(),bt(e,t=>{const s=t.property,i=t.target;if(i[o]){const r=i.style,n=t._inlineValue,o=Y(n)||n===m;if(3===t._tweenType){const e=i[l];if(o?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=m;for(let s in e)t+=y[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else o?r.removeProperty(R(s)):r[s]=n;e._tail===t&&e.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===m&&t.removeAttribute("style")})}})}return t};class Vt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=p/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=this._frameDuration,s=+t,i=s<c?c:s,r=p/i;i>D.frameRate&&(D.frameRate=i),this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<c?c:e}requestTick(t){const e=this._scheduledTime;if(this._lastTickTime=t,t<e)return 0;const s=this._frameDuration,i=t-e;return this._scheduledTime+=i<s?s:i,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Mt={animation:null,update:v},Ot=(()=>e?requestAnimationFrame:setImmediate)(),zt=(()=>e?cancelAnimationFrame:clearImmediate)();class Ht extends Vt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=D,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=F();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(Tt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):Bt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}Mt.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(F()),this.reqId=Ot(Yt)),this}pause(){if(this.reqId)return this.paused=!0,Wt()}resume(){if(this.paused)return this.paused=!1,bt(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===L.timeScale?1:p)}set speed(t){this._speed=t*L.timeScale,bt(this,t=>t.speed=t._speed)}get timeUnit(){return 1===L.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(L.timeScale!==s){L.timeScale=s,L.tickThreshold=200*s;const t=e?.001:p;this.defaults.duration*=t,this._speed*=t}}get precision(){return L.precision}set precision(t){L.precision=t}}const Xt=(()=>{const t=new Ht(F());return e&&(B.engine=t,i.addEventListener("visibilitychange",()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())})),t})(),Yt=()=>{Xt._head?(Xt.reqId=Ot(Yt),Xt.update()):Xt.reqId=0},Wt=()=>(zt(Xt.reqId),Xt.reqId=0,Xt),Ut={_rep:new WeakMap,_add:new Map},qt=(t,e,s="_rep")=>{const i=Ut[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},jt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,Gt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},Qt=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;xt(e,t,jt,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteStartTime+i._changeDuration;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){Gt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)Gt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=pt(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<c&&Gt(i)}let o=!0;if(bt(e,t=>{t._isOverlapped||(o=!1)}),o){const t=e.parent;if(t){let s=!0;bt(t,t=>{t!==e&&bt(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}else if(s===r.blend){const e=qt(t.target,t.property,"_add"),s=(t=>{let e=Mt.animation;return e||(e={duration:c,computeDeltaTime:v,_offset:0,_delay:0,_head:null,_tail:null},Mt.animation=e,Mt.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=3===t||2===t?vt(i._fromNumbers):null;let r=i._fromNumber,n=s._tail;for(;n&&n!==i;){if(e)for(let t=0,s=n._numbers.length;t<s;t++)e[t]+=n._numbers[t];else r+=n._number;n=n._prevAdd}i._toNumber=r,i._toNumbers=e}}}),At(e,1,1,0,2)}),e})(Ut._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=c,i._startTime=0,i._numbers=vt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,xt(e,i),xt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=vt(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=vt(t._toNumbers);e&&e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}xt(e,t,null,"_prevAdd","_nextAdd")}return t},Zt=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=Ut._rep.get(s)[i];if(Tt(n,t,"_prevRep","_nextRep"),e===r.blend){const e=Ut._add,r=e.get(s);if(!r)return;const n=r[i],o=Mt.animation;Tt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){Tt(n,a,"_prevAdd","_nextAdd"),Tt(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Jt=(t,e,s)=>{let i=!1;return bt(e,r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=Pt(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),Tt(e,r),Zt(r),i=!0)}},!0),i},Kt=(t,e,s)=>{const i=e||Xt;let r;if(i._hasChildren){let e=0;bt(i,n=>{if(!n._hasChildren)if(r=Jt(t,n,s),r&&!n._head)n.cancel(),Tt(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?Kt(t,n,s):n._hasChildren=!1},!0),X(i.iterationDuration)||(i.iterationDuration=e)}else r=Jt(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},te=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),ee=t=>t._cancelled?(t._hasChildren?bt(t,ee):bt(t,t=>{t._composition!==r.none&&Qt(t,qt(t.target,t.property))}),t._cancelled=0,t):t;let se=0;class ie extends Vt{constructor(t={},e=null,s=0){super(0),++se;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:_,onUpdate:b}=t;I.current&&I.current.register(this);const T=e?0:Xt._lastTickTime,x=e?e.defaults:L.defaults,w=H(r)||X(r)?x.delay:+r,S=H(n)||X(n)?1/0:+n,$=St(l,x.loop),E=St(h,x.loopDelay);let k=!0===$||$===1/0||$<0?1/0:$+1;if(A){const s=k===1/0;if(A.register(this,t,s)&&s){const t=a?2:1,s=e?A.maxNestedInfiniteLoops:A.maxInfiniteLoops;k=Math.max(s,t)}}let C=0;e?C=s:(Xt.reqId||Xt.requestTick(F()),C=(Xt._lastTickTime-Xt._startTime)*L.timeScale),this.id=X(i)?se:i,this.parent=e,this.duration=gt((S+E)*k-E)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||x.onBegin,this.onBeforeUpdate=_||x.onBeforeUpdate,this.onUpdate=b||x.onUpdate,this.onLoop=f||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=S,this.iterationCount=k,this._autoplay=!e&&St(d,x.autoplay),this._offset=C,this._delay=w,this._loopDelay=E,this._iterationTime=0,this._currentIteration=0,this._resolve=v,this._running=!1,this._reversed=+St(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=St(a,x.alternate),this._prev=null,this._next=null,this._lastTickTime=T,this._startTime=T,this._lastTime=T,this._fps=St(u,x.frameRate),this._speed=St(p,x.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return ct(pt(this._currentTime,L.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ct(pt(this._iterationTime,L.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ct(pt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ct(pt(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*ct(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return ee(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Bt(this,0,1,~~t,2),te(this),this._hasChildren&&bt(this,te),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&Bt(this,this.duration,1,~~t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!X(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*Xt._speed);return this._startTime=F()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=c&&!this._hasChildren?Bt(this,c,0,0,2):(this._running||(xt(Xt,this),Xt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,Xt.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){ee(this),this.completed=!1;const i=this.paused;return this.paused=!0,Bt(this,t+this._delay,~~e,~~s,1),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?nt(u/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?bt(this,t=>t.cancel(),!0):bt(this,Zt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=yt(t);if(e===s)return this;const i=t/e,r=t<=c;return this.duration=r?c:s,this.iterationDuration=r?c:yt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){Bt(this,0,1,0,1);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(t=0){return this.seek(this.duration,t).cancel()}then(t=v){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=v};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}function re(t){const e=z(t)?I.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function ne(t){if(Y(t))return[];if(!e)return V(t)&&t.flat(1/0)||[t];if(V(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!Y(i)){const t=re(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!Y(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=re(t);return s?Array.from(s):[t]}function oe(t){const e=ne(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[n]){s[n]=!0;const t=W(s);(s.nodeType||t)&&(s[o]=!0,s[a]=t,s[l]={})}}return e}const ae={deg:1,rad:180/ht,turn:360},le={},he=(t,e,s,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===s)return e;const a=o+n+s,l=le[a];if(X(l)||r){let r;if(n in ae)r=o*ae[n]/ae[s];else{const e=100,a=t.cloneNode(),l=t.parentNode,h=l&&l!==i?l:i.body;h.appendChild(a);const d=a.style;d.width=e+n;const c=a.offsetWidth||e;d.width=e+s;const u=c/(a.offsetWidth||e);h.removeChild(a),r=u*o}e.n=r,le[a]=r}else e.n=l;return e.t,e.u=s,e},de=t=>t,ce=(t=1.68)=>e=>J(e,+t),ue={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},pe=ht/2,me=2*ht,fe={[m]:ce,Quad:ce(2),Cubic:ce(3),Quart:ce(4),Quint:ce(5),Sine:t=>1-et(t*pe),Circ:t=>1-K(1-t*t),Expo:t=>t?J(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=J(2,--s))-1)/11;);return 1/J(4,3-s)-7.5625*J((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ct(+t,1,10),i=ct(+e,c,2),r=i/me*ot(1/s),n=me/i;return t=>0===t||1===t?t:-s*J(2,-10*(1-t))*tt((1-t-r)*n)}},ge=(()=>{const t={linear:de,none:de};for(let e in ue)for(let s in fe){const i=fe[s],r=ue[e];t[e+s]=s===m||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ye={linear:de,none:de},ve=t=>{if(ye[t])return ye[t];if(t.indexOf("(")<=-1){const e=ue[t]||t.includes("Back")||t.includes("Elastic")?ge[t]():ge[t];return e?ye[t]=e:de}{const e=t.slice(0,-1).split("("),s=ge[e[0]];return s?ye[t]=s(...e[1].split(",")):de}},_e=["steps(","irregular(","linear(","cubicBezier("],be=t=>{if(z(t))for(let e=0,s=_e.length;e<s;e++)if(P(t,_e[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),de;return H(t)?t:z(t)?ve(t):de},Te={t:0,n:0,u:null,o:null,d:null,s:null},xe={t:0,n:0,u:null,o:null,d:null,s:null},we={},Se={func:null},$e=[null],Ee=[null,null],ke={to:null};let Ce,Ne,De=0,Ie=0;class Le extends ie{constructor(t,e,s,i,n=!1,o=0,a=0){super(e,s,i),++Ie;const l=oe(t),h=l.length,d=e.keyframes,u=d?_t(((t,e)=>{const s={};if(V(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(G);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];G(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=St(e.duration,L.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(G(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s})(d,e),e):e,{id:m,delay:f,duration:g,ease:y,playbackEase:v,modifier:_,composition:b,onRender:T}=u,x=s?s.defaults:L.defaults,w=St(y,x.ease),S=St(v,x.playbackEase),$=S?be(S):null,E=!X(w.ease),k=E?w.ease:St(y,$?"linear":x.ease),C=E?w.settlingDuration:St(g,x.duration),N=St(f,x.delay),D=_||x.modifier,I=X(b)&&h>=p?r.none:X(b)?x.composition:b,A=this._offset+(s?s._offset:0);E&&(w.parent=this);let B=NaN,R=NaN,P=0,F=0;for(let t=0;t<h;t++){const e=l[t],i=o||t,d=a||h;let p=NaN,m=NaN;for(let t in u)if(G(t)){const o=Et(e,t),a=Pt(t,e,o);let l=u[t];const h=V(l);if(n&&!h&&(Ee[0]=l,Ee[1]=l,l=Ee),h){const t=l.length,e=!M(l[0]);2===t&&e?(ke.to=l,$e[0]=ke,Ce=$e):t>2&&e?(Ce=[],l.forEach((t,e)=>{e?1===e?(Ee[1]=t,Ce.push(Ee)):Ce.push(t):Ee[0]=t})):Ce=l}else $e[0]=l,Ce=$e;let f=null,g=null,y=NaN,v=0,_=0;for(let t=Ce.length;_<t;_++){const n=Ce[_];M(n)?Ne=n:(ke.to=n,Ne=ke),Se.func=null;const l=$t(Ne.to,e,i,d,Se);let h;M(l)&&!X(l.to)?(Ne=l,h=l.to):h=l;const u=$t(Ne.from,e,i,d),p=Ne.ease||k,m=$t(p,e,i,d),b=H(m)||z(m)?m:p,T=!X(b)&&!X(b.ease),x=T?b.ease:b,w=T?b.settlingDuration:$t(St(Ne.duration,t>1?$t(C,e,i,d)/t:C),e,i,d),S=$t(St(Ne.delay,_?0:N),e,i,d),$=$t(St(Ne.composition,I),e,i,d),E=O($)?$:r[$],L=Ne.modifier||D,B=!X(u),R=!X(h),W=V(h),U=W||B&&R,q=g?v+S:S,j=pt(A+q,12);F||!B&&!W||(F=1);let G=g;if(E!==r.none){f||(f=qt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=j;)if(G=t,t=t._nextRep,t&&t._absoluteStartTime>=j)for(;t;)Gt(t),t=t._nextRep}if(U){Dt(W?$t(h[0],e,i,d):u,Te),Dt(W?$t(h[1],e,i,d,Se):h,xe);const t=Ct(e,a,o,we);0===Te.t&&(G?1===G._valueType&&(Te.t=1,Te.u=G._unit):(Dt(t,Lt),1===Lt.t&&(Te.t=1,Te.u=Lt.u)))}else R?Dt(h,xe):g?It(g,xe):Dt(s&&G&&G.parent.parent===s?G._value:Ct(e,a,o,we),xe),B?Dt(u,Te):g?It(g,Te):Dt(s&&G&&G.parent.parent===s?G._value:Ct(e,a,o,we),Te);if(Te.o&&(Te.n=Nt(G?G._toNumber:Dt(Ct(e,a,o,we),Lt).n,Te.n,Te.o)),xe.o&&(xe.n=Nt(Te.n,xe.n,xe.o)),Te.t!==xe.t)if(3===Te.t||3===xe.t){const t=3===Te.t?Te:xe,e=3===Te.t?xe:Te;e.t=3,e.s=vt(t.s),e.d=t.d.map(()=>e.n)}else if(1===Te.t||1===xe.t){const t=1===Te.t?Te:xe,e=1===Te.t?xe:Te;e.t=1,e.u=t.u}else if(2===Te.t||2===xe.t){const t=2===Te.t?Te:xe,e=2===Te.t?xe:Te;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Te.u!==xe.u){let t=xe.u?Te:xe;t=he(e,t,xe.u?xe.u:Te.u,!1)}if(xe.d&&Te.d&&xe.d.length!==Te.d.length){const t=Te.d.length>xe.d.length?Te:xe,e=t===Te?xe:Te;e.d=t.d.map((t,s)=>X(e.d[s])?0:e.d[s]),e.s=vt(t.s)}const Q=pt(+w||c,12);let Z=we[a];Y(Z)||(we[a]=null);const J={parent:this,id:De++,property:a,target:e,_value:null,_func:Se.func,_ease:be(x),_fromNumbers:vt(Te.d),_toNumbers:vt(xe.d),_strings:vt(xe.s),_fromNumber:Te.n,_toNumber:xe.n,_numbers:vt(Te.d),_number:Te.n,_unit:xe.u,_modifier:L,_currentTime:0,_startTime:q,_delay:+S,_updateDuration:Q,_changeDuration:Q,_absoluteStartTime:j,_tweenType:o,_valueType:xe.t,_composition:E,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:Z,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};E!==r.none&&Qt(J,f),isNaN(y)&&(y=J._startTime),v=pt(q+Q,12),g=J,P++,xt(this,J)}(isNaN(R)||y<R)&&(R=y),(isNaN(B)||v>B)&&(B=v),3===o&&(p=P-_,m=P)}if(!isNaN(p)){let t=0;bt(this,e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===r.blend&&bt(Mt.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}h||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),R?(bt(this,t=>{t._startTime-t._delay||(t._delay-=R),t._startTime-=R}),B-=R):R=0,B||(B=c,this.iterationCount=0),this.targets=l,this.id=X(m)?Ie:m,this.duration=B===c?c:gt((B+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=T||x.onRender,this._ease=$,this._delay=R,this.iterationDuration=B,!this._autoplay&&F&&this.onRender(this)}stretch(t){const e=this.duration;if(e===yt(t))return this;const s=t/e;return bt(this,t=>{t._updateDuration=yt(t._updateDuration*s),t._changeDuration=yt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s}),super.stretch(t)}refresh(){return bt(this,t=>{const e=t._func;if(e){const s=Ct(t.target,t.property,t._tweenType);Dt(s,Lt),Dt(e(),xe),t._fromNumbers=vt(Lt.d),t._fromNumber=Lt.n,t._toNumbers=vt(xe.d),t._strings=vt(xe.s),t._toNumber=xe.o?Nt(Lt.n,xe.n,xe.o):xe.n}}),this.duration===c&&this.restart(),this}revert(){return super.revert(),Ft(this)}then(t){return super.then(t)}}const Ae={_head:null,_tail:null},Be=(t,e,s)=>{let i,r=Ae._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),Tt(Ae,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Re=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Be(e,s),xt(Ae,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{Be(e,s,t)};return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function Pe(t,e,s){const i=oe(t);if(!i.length)return;const[r]=i,n=Et(r,e),o=Pt(e,r,n);let a=Ct(r,o);if(X(s))return a;if(Dt(a,Lt),0===Lt.t||1===Lt.t){if(!1===s)return Lt.n;{const t=he(r,Lt,s,!1);return`${pt(t.n,L.precision)}${t.u}`}}}const Fe=(t,e)=>{if(!X(e))return e.duration=c,e.composition=St(e.composition,r.none),new Le(t,e,null,0,!0).resume()},Ve=(t,e,s)=>{const i=ne(t);for(let t=0,r=i.length;t<r;t++)Be(i[t],s,e&&e.controlAnimation&&e);return Kt(i,e,s),i},Me=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),X(e))return s;if(O(+e))return+e;const i=e,r=t?t.labels:null,n=!Y(r),o=((t,e)=>{if(P(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!X(o),l=C.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return Nt(d,c,t[0])}return a?o:n?X(r[i])?s:r[i]:s};function Oe(t,e,s,i,r,n){const o=O(t.duration)&&t.duration<=c?s-c:s;e.composition&&Bt(e,o,1,1,1);const a=i?new Le(i,t,e,o,!1,r,n):new ie(t,e,o);return e.composition&&a.init(!0),xt(e,a),bt(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=function(t){return gt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}let ze=0;class He extends ie{constructor(t={}){super(t,null,0),++ze,this.id=X(t.id)?ze:t.id,this.duration=0,this.labels={};const e=t.defaults,s=L.defaults;this.defaults=e?_t(e,s):s,this.composition=St(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=St(t.playbackEase,s.playbackEase);this._ease=i?be(i):null,this.iterationDuration=0}add(t,e,s){const i=M(e),r=M(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(H(s)){const e=s,r=ne(t),n=this.duration,o=this.iterationDuration,a=i.id;let l=0;const h=r.length;r.forEach(t=>{const s={...i};this.duration=n,this.iterationDuration=o,X(a)||(s.id=a+"-"+l),Oe(s,this,Me(this,e(t,l,h,this)),t,l,h),l++})}else Oe(i,this,Me(this,s),t)}else Oe(t,this,Me(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(X(t)||t&&X(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);return this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e)}set(t,e,s){return X(e)?this:(e.duration=c,e.composition=r.replace,this.add(t,e,s))}call(t,e){return X(t)||t&&!H(t)?this:this.add({duration:0,delay:0,onComplete:()=>t(this)},e)}label(t,e){return X(t)||t&&!z(t)||(this.labels[t]=Me(this,e)),this}remove(t,e){return Kt(ne(t),this,e),this}stretch(t){const e=this.duration;if(e===yt(t))return this;const s=t/e,i=this.labels;bt(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return bt(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),bt(this,t=>t.revert,!0),Ft(this)}then(t){return super.then(t)}}const Xe=t=>new He(t).init();class Ye{constructor(t,e){I.current&&I.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},n={v:1,autoplay:!1},o={};if(this.targets=[],this.animations={},this.callbacks=null,!X(t)&&!X(e)){for(let t in e){const s=e[t];G(t)?o[t]=s:P(t,"on")?n[t]=s:i[t]=s}this.callbacks=new Le({v:0},n);for(let e in o){const s=o[e],n=M(s);let a={},l="+=0";if(n){const t=s.unit;z(t)&&(l+=t)}else a.duration=s;a[e]=n?_t({to:l},s):l;const h=_t(i,a);h.composition=r.replace,h.autoplay=!1;const d=this.animations[e]=new Le(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(X(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return bt(d,e=>{if(V(t))for(let s=0,i=t.length;s<i;s++)X(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;X(s)||(e._ease=be(s)),e._currentTime=0}),X(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=v,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const We=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i);var Ue=Object.freeze({__proto__:null,clamp:ct,damp:(t,e,s,i)=>i?1===i?e:ft(t,e,1-Math.exp(-i*s*.1)):t,degToRad:t=>t*Math.PI/180,lerp:ft,mapRange:We,padEnd:(t,e,s)=>`${t}`.padEnd(e,s),padStart:(t,e,s)=>`${t}`.padStart(e,s),radToDeg:t=>180*t/Math.PI,round:pt,roundPad:(t,e)=>(+t).toFixed(e),snap:mt,wrap:(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e});const qe=10*p;class je{constructor(t={}){const e=!X(t.bounce)||!X(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/p,this.maxIterations=this.maxDuration/this.timeStep/p,this.bn=ct(St(t.bounce,.5),-1,1),this.pd=ct(St(t.duration,628),10*L.timeScale,qe*L.timeScale),this.m=ct(St(t.mass,1),1,qe),this.s=ct(St(t.stiffness,100),c,qe),this.d=ct(St(t.damping,10),c,qe),this.v=ct(St(t.velocity,0),-1e4,qe),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||v,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?it(-n*e*s)*(1*et(i*n)+r*tt(i*n)):1===e?(1+r*n)*it(-n*s):((1+r)*it((-e*s+i)*n)+(1-r)*it((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===L.timeScale?this.pd/p:this.pd;this.m=1,this.v=0,this.s=J(2*ht/t,2),this.bn>=0?this.d=4*(1-this.bn)*ht/t:this.d=4*ht/(t*(1+this.bn)),this.s=pt(ct(this.s,c,qe),3),this.d=pt(ct(this.d,c,300),3)}calculateBDFromSD(){const t=2*ht/K(this.s);this.pd=t*(1===L.timeScale?p:1);const e=this.d/(2*K(this.s));this.bn=e<=1?1-this.d*t/(4*ht):4*ht/(this.d*t)-1,this.bn=pt(ct(this.bn,-1,1),3),this.pd=pt(ct(this.pd,10*L.timeScale,qe*L.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=ct(K(o/r),c,p),h=this.zeta=n/(2*K(o*r));h<1?(this.wd=l*K(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*K(h*h-1),this.b=(h*l-a)/this.wd);let d=0,u=0,m=0;for(;u<=t&&m<=e;)st(1-this.solve(d))<s?u++:u=0,this.solverDuration=d,d+=i,m++;this.settlingDuration=pt(this.solverDuration*p,0)*L.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=ct(St(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=ct(St(t,1),10*L.timeScale,qe*L.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ct(St(t,100),c,qe),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=ct(St(t,10),c,qe),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=ct(St(t,1),1,qe),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ct(St(t,0),-1e4,qe),this.compute()}}const Ge=t=>new je(t),Qe=t=>(console.warn("createSpring() is deprecated use spring() instead"),new je(t)),Ze=t=>{t.cancelable&&t.preventDefault()};class Je{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:v,remove:v}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Ke{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,s=0;for(;e&&e!==i;)t(e,s),e=e.parentElement,s++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const ts=(t,e)=>t&&H(t)?t(e):t;let es=0;class ss{constructor(t,e={}){if(!t)return;I.current&&I.current.register(this);const r=e.x,n=e.y,o=e.trigger,a=e.modifier,l=e.releaseEase,h=l&&be(l),d=!X(l)&&!X(l.ease),c=M(r)&&!X(r.mapTo)?r.mapTo:"translateX",p=M(n)&&!X(n.mapTo)?n.mapTo:"translateY",m=ts(e.container,this);this.containerArray=V(m)?m:null,this.$container=m&&!this.containerArray?ne(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=M(t)?new Je(t):ne(t)[0],this.$trigger=ne(o||t)[0],this.fixed="fixed"===Pe(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:Ge({mass:St(e.releaseMass,1),stiffness:St(e.releaseStiffness,80),damping:St(e.releaseDamping,20)}),this.releaseYSpring=d?l:Ge({mass:St(e.releaseMass,1),stiffness:St(e.releaseStiffness,80),damping:St(e.releaseDamping,20)}),this.releaseEase=h||ge.outQuint,this.hasReleaseSpring=d,this.onGrab=e.onGrab||v,this.onDrag=e.onDrag||v,this.onRelease=e.onRelease||v,this.onUpdate=e.onUpdate||v,this.onSettle=e.onSettle||v,this.onSnap=e.onSnap||v,this.onResize=e.onResize||v,this.onAfterResize=e.onAfterResize||v,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),X(r)||!0===r)f[c]=0;else if(M(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[c]=e}else!1===r&&(f[c]=0,this.disabled[0]=1);if(X(n)||!0===n)f[p]=0;else if(M(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[p]=e}else!1===n&&(f[p]=0,this.disabled[1]=1);this.animate=new Ye(this.$target,f),this.xProp=c,this.yProp=p,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-u,u,u,-u],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=F(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new Ke(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new ie({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new ie({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!X(m),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?c:p,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=lt(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new ie({autoplay:!1,duration:150*L.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=e,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),M(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=F(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=pt(ct(K(t*t+e*e)/r*o,a,l),5);const d=at(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=pt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=mt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=pt(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=mt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return pt(this.animate[this.xProp](),L.precision)}set x(t){this.setX(t,!1)}get y(){return pt(this.animate[this.yProp](),L.precision)}set y(t){this.setY(t,!1)}get progressX(){return We(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(We(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return We(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(We(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=pt(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=pt(this.useWin?s.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=e,this.scrollBounds[0]=e-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=e-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const e=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=s.innerWidth,l=this.window[1]=s.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?ct(d,a,d):d,this.scrollView[1]=h?ct(c,l,c):c,this.updateScrollCoords();const{width:v,height:_,left:b,top:T,right:x,bottom:w}=t.getBoundingClientRect();this.dragArea[2]=pt(h?ct(v,a,a):v,0),this.dragArea[3]=pt(h?ct(_,l,l):_,0);const S=Pe(t,"overflow"),$="visible"===S,E="hidden"===S;if(this.canScroll=!u&&this.contained&&(t===i.body&&$||!E&&!$)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!V(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-v:0,c=i?this.scrollView[1]-o-_:0;this.targetBounds[0]=pt(r.top+s-(h?0:T),0),this.targetBounds[1]=pt(r.right+e-(h?a:x),0),this.targetBounds[2]=pt(r.bottom+s-(h?l:w),0),this.targetBounds[3]=pt(r.left+e-(h?0:b),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-pt(r.top-(u?ct(T,0,l):T)+o-m,0),this.containerBounds[1]=-pt(r.right-(u?ct(x,0,a):x)-d+f,0),this.containerBounds[2]=-pt(r.bottom-(u?ct(w,0,l):w)-c+g,0),this.containerBounds[3]=-pt(r.left-(u?ct(b,0,a):b)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(e,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=ts(t.container,this),o=ts(t.containerPadding,this)||0,a=V(o)?o:[o,o,o,o],l=this.x,h=this.y,d=ts(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=ts(t.dragThreshold,this),p={mouse:3,touch:7};if(O(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;X(t)||(p.mouse=t),X(e)||(p.touch=e)}this.containerArray=V(n)?n:null,this.$container=n&&!this.containerArray?ne(n)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=St(a,[0,0,0,0]),this.containerFriction=ct(St(ts(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ct(St(ts(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=ts(M(e)&&!X(e.snap)?e.snap:t.snap,this),this.snapY=ts(M(r)&&!X(r.snap)?r.snap:t.snap,this),this.scrollSpeed=St(ts(t.scrollSpeed,this),1.5),this.scrollThreshold=St(ts(t.scrollThreshold,this),20),this.dragSpeed=St(ts(t.dragSpeed,this),1),this.dragThreshold=this.isFinePointer?p.mouse:p.touch,this.minVelocity=St(ts(t.minVelocity,this),0),this.maxVelocity=St(ts(t.maxVelocity,this),50),this.velocityMultiplier=St(ts(t.velocityMultiplier,this),1),this.cursor=!1!==d&&c,this.updateBoundingValues();const[m,f,g,y]=this.containerBounds;this.setX(ct(l,y,f),!0),this.setY(ct(h,m,g),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],a=this.dragArea[3],l=this.scroll.x,h=this.scroll.y,d=this.$container.scrollWidth,c=this.$container.scrollHeight,u=this.useWin?ct(d,this.window[0],d):d,p=this.useWin?ct(c,this.window[1],c):c,m=r-u,f=n-p;this.dragged&&m>0&&(this.coords[0]-=m,this.scrollView[0]=u),this.dragged&&f>0&&(this.coords[1]-=f,this.scrollView[1]=p);const g=10*this.scrollSpeed,y=this.scrollThreshold,[v,_]=this.coords,[b,T,x,w]=this.scrollBounds,S=pt(ct((_-b+t)/y,-1,0)*g,0),$=pt(ct((v-T-e)/y,0,1)*g,0),E=pt(ct((_-x-s)/y,0,1)*g,0),k=pt(ct((v-w+i)/y,-1,0)*g,0);if(S||E||k||$){const[t,e]=this.disabled;let s=l,i=h;t||(s=pt(ct(l+(k||$),0,r-o),0),this.coords[0]-=l-s),e||(i=pt(ct(h+(S||E),0,n-a),0),this.coords[1]-=h-i),this.useWin?this.$scrollContainer.scrollBy(-(l-s),-(h-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,a,l,h]=this.pointer;this.coords[0]+=(r-l)*this.dragSpeed,this.coords[1]+=(n-h)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[d,c]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(d>e?e+(d-e)*m:d<i?i+(d-i)*m:d,!1),this.setY(c>s?s+(c-s)*m:c<t?t+(c-t)*m:c,!1),this.computeVelocity(r-l,n-h),this.angle=lt(n-a,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return Kt([this],null,"x"),Kt([this],null,"y"),Kt([this],null,"progressX"),Kt([this],null,"progressY"),Kt([this.scroll]),Kt([this.overshootCoords]),this}scrollInView(t,e=0,s=ge.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,a=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[l,h,d,c]=o,p=pt(ct(r-l,-u,0),0),m=pt(ct(i-h,0,u),0),f=pt(ct(r-d,0,u),0),g=pt(ct(i-c,-u,0),0);new Le(n,{x:pt(n.x+(g?g-e:m?m+e:0),0),y:pt(n.y+(p?p-e:f?f+e:0),0),duration:X(t)?350*L.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then(()=>{this.canScroll=a})}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=Fe(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=ge.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,a,l]=this.containerPadding,h=this.scroll.y-this.targetBounds[0]+n+e,d=this.scroll.x-this.targetBounds[1]-o-e,c=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+l+e,p=this.isOutOfBounds([h,d,c,u],i,r);if(p){const[e,n]=this.disabled,o=ct(mt(i,this.snapX),u,d),a=ct(mt(r,this.snapY),h,c),l=X(t)?350*L.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,l,s),n||2!==p&&3!==p||this.animate[this.yProp](a,l,s)}return this}handleDown(t){const e=t.target;if(this.grabbed||"range"===e.type)return;t.stopPropagation(),this.grabbed=!0,this.released=!1,this.stop(),this.updateBoundingValues();const s=t.changedTouches,r=s?s[0].clientX:t.clientX,n=s?s[0].clientY:t.clientY,{x:o,y:a}=this.transforms.normalizePoint(r,n),[l,h,d,c]=this.containerBounds,u=(1-this.containerFriction)*this.dragSpeed,p=this.x,m=this.y;this.coords[0]=this.coords[2]=u?p>h?h+(p-h)/u:p<c?c+(p-c)/u:p:p,this.coords[1]=this.coords[3]=u?m>d?d+(m-d)/u:m<l?l+(m-l)/u:m:m,this.pointer[0]=o,this.pointer[1]=a,this.pointer[2]=o,this.pointer[3]=a,this.pointer[4]=o,this.pointer[5]=a,this.pointer[6]=o,this.pointer[7]=a,this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null);const f=Pe(this.$target,"zIndex",!1);es=(f>es?f:es)+1,this.targetStyles=Fe(this.$target,{zIndex:es}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Fe(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,ge.out(3)),this.onGrab(this),i.addEventListener("touchmove",this),i.addEventListener("touchend",this),i.addEventListener("touchcancel",this),i.addEventListener("mousemove",this),i.addEventListener("mouseup",this),i.addEventListener("selectstart",this)}handleMove(t){if(!this.grabbed)return;const e=t.changedTouches,s=e?e[0].clientX:t.clientX,i=e?e[0].clientY:t.clientY,{x:r,y:n}=this.transforms.normalizePoint(s,i),o=r-this.pointer[6],a=n-this.pointer[7];let l=t.target,h=!1,d=!1,c=!1;for(;e&&l&&l!==this.$trigger;){const t=Pe(l,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=l;if(e>s){c=!0,h=t<=3,d=t>=e-s-3;break}}l=l.parentElement}c&&(!h&&!d||h&&a<0||d&&a>0)?(this.pointer[0]=r,this.pointer[1]=n,this.pointer[2]=r,this.pointer[3]=n,this.pointer[4]=r,this.pointer[5]=n,this.pointer[6]=r,this.pointer[7]=n):(Ze(t),this.triggerStyles||(this.triggerStyles=Fe(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",Ze,{passive:!1}),this.$trigger.addEventListener("touchmove",Ze,{passive:!1}),this.$trigger.addEventListener("touchend",Ze),(this.dragged||!this.disabled[0]&&st(o)>this.dragThreshold||!this.disabled[1]&&st(a)>this.dragThreshold)&&(this.updateTicker.resume(),this.pointer[2]=this.pointer[0],this.pointer[3]=this.pointer[1],this.pointer[0]=r,this.pointer[1]=n,this.dragged=!0,this.released=!1,this.onDrag(this)))}handleUp(){if(!this.grabbed)return;this.updateTicker.pause(),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null);const[t,e]=this.disabled,[s,n,o,a,l,h]=this.pointer,[d,c,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,v=this.releaseEase,_=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,x=this.y,w=this.computeVelocity(s-l,n-h),S=this.angle=lt(n-a,s-o),$=150*w,E=(1-this.releaseContainerFriction)*this.dragSpeed,k=T+et(S)*$,C=x+tt(S)*$,N=k>c?c+(k-c)*E:k<p?p+(k-p)*E:k,D=C>u?u+(C-u)*E:C<d?d+(C-d)*E:C,I=this.destX=ct(pt(mt(N,this.snapX),5),p,c),A=this.destY=ct(pt(mt(D,this.snapY),5),d,u),B=this.isOutOfBounds(this.containerBounds,k,C);let R=0,P=0,F=v,V=v,M=0;if(b.x=T,b.y=x,!t){const t=I===c?T>c?-1:1:T<p?-1:1,s=pt(T-I,0);g.velocity=e&&_?s?$*t/st(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=g;R=T===I?0:_?r:r-n*L.timeScale,_&&(F=i),R>M&&(M=R)}if(!e){const e=A===u?x>u?-1:1:x<d?-1:1,s=pt(x-A,0);y.velocity=t&&_?s?$*e/st(s):0:w;const{ease:i,settlingDuration:r,restDuration:n}=y;P=x===A?0:_?r:r-n*L.timeScale,_&&(V=i),P>M&&(M=P)}if(!_&&B&&E&&(R||P)){const t=r.blend;new Le(b,{x:{to:N,duration:.65*R},y:{to:D,duration:.65*P},ease:v,composition:t}).init(),new Le(b,{x:{to:I,duration:R},y:{to:A,duration:P},ease:v,composition:t}).init(),this.overshootTicker.stretch(at(R,P)).restart()}else t||this.animate[this.xProp](I,R,F),e||this.animate[this.yProp](A,P,V);this.scrollInView(M,this.scrollThreshold,v);let O=!1;I!==m&&(this.snapped[0]=I,this.snapX&&(O=!0)),A!==f&&this.snapY&&(this.snapped[1]=A,this.snapY&&(O=!0)),O&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",Ze),this.$trigger.removeEventListener("touchmove",Ze),this.$trigger.removeEventListener("touchend",Ze),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this)}reset(){return this.stop(),this.resizeTicker.pause(),this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.setX(0,!0),this.setY(0,!0),this.coords[0]=0,this.coords[1]=0,this.pointer[0]=0,this.pointer[1]=0,this.pointer[2]=0,this.pointer[3]=0,this.pointer[4]=0,this.pointer[5]=0,this.pointer[6]=0,this.pointer[7]=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.angle=0,this}enable(){return this.enabled||(this.enabled=!0,this.$target.classList.remove("is-disabled"),this.touchActionStyles=Fe(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"}),this.$trigger.addEventListener("touchstart",this,{passive:!0}),this.$trigger.addEventListener("mousedown",this,{passive:!0}),this.$trigger.addEventListener("mouseenter",this)),this}disable(){return this.enabled=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.touchActionStyles.revert(),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.bodyStyles&&(this.bodyStyles.revert(),this.bodyStyles=null),this.targetStyles&&(this.targetStyles.revert(),this.targetStyles=null),this.$target.classList.add("is-disabled"),this.$trigger.removeEventListener("touchstart",this),this.$trigger.removeEventListener("mousedown",this),this.$trigger.removeEventListener("mouseenter",this),i.removeEventListener("touchmove",this),i.removeEventListener("touchend",this),i.removeEventListener("touchcancel",this),i.removeEventListener("mousemove",this),i.removeEventListener("mouseup",this),i.removeEventListener("selectstart",this),this}revert(){return this.reset(),this.disable(),this.$target.classList.remove("is-disabled"),this.updateTicker.revert(),this.overshootTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),this.resizeObserver.disconnect(),this}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":this.handleDown(t);break;case"mousemove":case"touchmove":this.handleMove(t);break;case"mouseup":case"touchend":case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":Ze(t)}}}const is=(t=v)=>new ie({duration:1*L.timeScale,onComplete:t},null,0).resume(),rs=t=>{let e;return(...s)=>{let i,r,n,o;e&&(i=e.currentIteration,r=e.iterationProgress,n=e.reversed,o=e._alternate,e.revert());const a=t(...s);return a&&!H(a)&&a.revert&&(e=a),X(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),a||v}};class ns{constructor(t={}){I.current&&I.current.register(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||ne(e)[0]||i);const n=t.defaults,o=L.defaults,a=t.mediaQueries;if(this.defaults=n?_t(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],this.constructorsOnce=[],this.revertConstructorsOnce=[],this.revertiblesOnce=[],this.once=!1,this.onceIndex=0,this.methods={},this.matches={},this.mediaQueryLists={},this.data={},a)for(let t in a){const e=s.matchMedia(a[t]);this.mediaQueryLists[t]=e,e.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=I.current,s=I.root,i=L.defaults;I.current=this,I.root=this.root,L.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return I.current=e,I.root=s,L.defaults=i,n}refresh(){return this.onceIndex=0,this.execute(()=>{let t=this.revertibles.length,e=this.revertConstructors.length;for(;t--;)this.revertibles[t].revert();for(;e--;)this.revertConstructors[e](this);this.revertibles.length=0,this.revertConstructors.length=0,this.constructors.forEach(t=>{const e=t(this);H(e)&&this.revertConstructors.push(e)})}),this}add(t,e){if(this.once=!1,H(t)){const e=t;this.constructors.push(e),this.execute(()=>{const t=e(this);H(t)&&this.revertConstructors.push(t)})}else this.methods[t]=(...t)=>this.execute(()=>e(...t));return this}addOnce(t){if(this.once=!0,H(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute(()=>{const t=s(this);H(t)&&this.revertConstructorsOnce.push(t)})}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(H(s))return s(this);const i=rs(t);let r;return this.constructorsOnce[e]=i,this.execute(()=>{r=i(this)}),r}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.revertiblesOnce,i=this.revertConstructorsOnce,r=this.mediaQueryLists;let n=t.length,o=e.length,a=s.length,l=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;a--;)s[a].revert();for(;l--;)i[l](this);for(let t in r)r[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,s.length=0,i.length=0,this.constructorsOnce.length=0,this.onceIndex=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const os=(t,e)=>t&&H(t)?t(e):t,as=new Map;class ls{constructor(t){this.element=t,this.useWin=this.element===i.body,this.winWidth=0,this.winHeight=0,this.width=0,this.height=0,this.left=0,this.top=0,this.scale=1,this.zIndex=0,this.scrollX=0,this.scrollY=0,this.prevScrollX=0,this.prevScrollY=0,this.scrollWidth=0,this.scrollHeight=0,this.velocity=0,this.backwardX=!1,this.backwardY=!1,this.scrollTicker=new ie({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;bt(this,t=>t.handleScroll(),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ie({autoplay:!1,frameRate:30,onUpdate:t=>{const e=t.deltaTime,s=this.prevScrollX,i=this.prevScrollY,r=this.scrollX,n=this.scrollY,o=s-r,a=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),a&&(this.backwardY=i>n),this.velocity=pt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ie({autoplay:!1,duration:250*L.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ie({autoplay:!1,duration:500*L.timeScale,onBegin:()=>{this.scrollTicker.resume()},onComplete:()=>{this.scrollTicker.pause()}}).init(),this._head=null,this._tail=null,this.updateScrollCoords(),this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll(),this.resizeObserver=new ResizeObserver(()=>this.resizeTicker.restart()),this.resizeObserver.observe(this.element),(this.useWin?s:this.element).addEventListener("scroll",this,!1)}updateScrollCoords(){const t=this.useWin,e=this.element;this.scrollX=pt(t?s.scrollX:e.scrollLeft,0),this.scrollY=pt(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=i.createElement("div");i.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return i.body.removeChild(t),e})()}updateBounds(){const t=getComputedStyle(this.element),e=this.element;let s,i;if(this.scrollWidth=e.scrollWidth+parseFloat(t.marginLeft)+parseFloat(t.marginRight),this.scrollHeight=e.scrollHeight+parseFloat(t.marginTop)+parseFloat(t.marginBottom),this.updateWindowBounds(),this.useWin)s=this.winWidth,i=this.winHeight;else{const t=e.getBoundingClientRect();s=e.clientWidth,i=e.clientHeight,this.top=t.top,this.left=t.left,this.scale=t.width?s/t.width:t.height?i/t.height:1}this.width=s,this.height=i}refreshScrollObservers(){bt(this,t=>{t._debug&&t.removeDebug()}),this.updateBounds(),bt(this,t=>{t.refresh(),t._debug&&t.debug()})}refresh(){this.updateWindowBounds(),this.updateBounds(),this.refreshScrollObservers(),this.handleScroll()}handleScroll(){this.updateScrollCoords(),this.wakeTicker.restart()}handleEvent(t){"scroll"===t.type&&this.handleScroll()}revert(){this.scrollTicker.cancel(),this.dataTimer.cancel(),this.resizeTicker.cancel(),this.wakeTicker.cancel(),this.resizeObserver.disconnect(),(this.useWin?s:this.element).removeEventListener("scroll",this),as.delete(this.element)}}const hs=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,a="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:l,u:h}=Dt(a,Lt);let d=l;return"%"===h?d=l/100*s:h&&(d=he(t,Lt,"px",!0).n),o&&i<0&&(d+=i),n&&r>0&&(d+=r),d},ds=(t,e,s,i,r)=>{let n;if(z(e)){const o=C.exec(e);if(o){const a=o[0],l=a[0],h=e.split(a),d="min"===h[0],c="max"===h[0],u=hs(t,h[0],s,i,r),p=hs(t,h[1],s,i,r);if(d){const e=Nt(hs(t,"min",s),p,l);n=e<u?u:e}else if(c){const e=Nt(hs(t,"max",s),p,l);n=e>u?u:e}else n=Nt(u,p,l)}else n=hs(t,e,s,i,r)}else n=e;return pt(n,0)},cs=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[o]){e=i;break}}return e};let us=0;const ps=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ms{constructor(t={}){I.current&&I.current.register(this);const e=St(t.sync,"play pause"),s=e?be(e):null,r=e&&("linear"===e||e===de),n=e&&!(s===de&&!r),o=e&&(O(e)||!0===e||r),a=e&&z(e)&&!n&&!o,l=a?e.split(" ").map(t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null}):null,h=a&&l.length>2;this.index=us++,this.id=X(t.id)?this.index:t.id,this.container=(t=>{const e=t&&ne(t)[0]||i.body;let s=as.get(e);return s||(s=new ls(e),as.set(e,s)),s})(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!l,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=l&&!h&&l[0]?l[0]:v,this.onSyncLeave=l&&!h&&l[1]?l[1]:v,this.onSyncEnterForward=l&&h&&l[0]?l[0]:v,this.onSyncLeaveForward=l&&h&&l[1]?l[1]:v,this.onSyncEnterBackward=l&&h&&l[2]?l[2]:v,this.onSyncLeaveBackward=l&&h&&l[3]?l[3]:v,this.onEnter=t.onEnter||v,this.onLeave=t.onLeave||v,this.onEnterForward=t.onEnterForward||v,this.onLeaveForward=t.onLeaveForward||v,this.onEnterBackward=t.onEnterBackward||v,this.onLeaveBackward=t.onLeaveBackward||v,this.onUpdate=t.onUpdate||v,this.onSyncComplete=t.onSyncComplete||v,this.reverted=!1,this.ready=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offset=0,this.offsetStart=0,this.offsetEnd=0,this.distance=0,this.prevProgress=0,this.thresholds=["start","end","end","start"],this.coords=[0,0,0,0],this.debugStyles=null,this.$debug=null,this._params=t,this._debug=St(t.debug,!1),this._next=null,this._prev=null,xt(this.container,this),is(()=>{if(!this.reverted){if(!this.target){const e=ne(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}})}link(t){if(t&&(t.pause(),this.linked=t,X(t)||(t.persist=!0),!this._params.target)){let e;X(t.targets)?bt(t,t=>{t.targets&&!e&&(e=cs(t))}):e=cs(t),this.target=e||i.body,this.refresh()}return this}get velocity(){return this.container.velocity}get backward(){return this.horizontal?this.container.backwardX:this.container.backwardY}get scroll(){return this.horizontal?this.container.scrollX:this.container.scrollY}get progress(){const t=(this.scroll-this.offsetStart)/this.distance;return t===1/0||isNaN(t)?0:pt(ct(t,0,1),6)}refresh(){this.ready=!0,this.reverted=!1;const t=this._params;return this.repeat=St(os(t.repeat,this),!0),this.horizontal="x"===St(os(t.axis,this),"y"),this.enter=St(os(t.enter,this),"end start"),this.leave=St(os(t.leave,this),"start end"),this.updateBounds(),this.handleScroll(),this}removeDebug(){return this.$debug&&(this.$debug.parentNode.removeChild(this.$debug),this.$debug=null),this.debugStyles&&(this.debugStyles.revert(),this.$debug=null),this}debug(){this.removeDebug();const t=this.container,e=this.horizontal,s=t.element.querySelector(":scope > .animejs-onscroll-debug"),r=i.createElement("div"),n=i.createElement("div"),o=i.createElement("div"),a=ps[this.index%ps.length],l=t.useWin,h=l?t.winWidth:t.width,d=l?t.winHeight:t.height,c=t.scrollWidth,u=t.scrollHeight,p=this.container.width>360?320:260,m=e?0:10,f=e?10:0,g=e?24:p/2,y=e?g:15,v=e?60:g,_=e?v:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,w=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${w("absolute",m,f,e?c:p,e?p:u)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${e?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `,n.style.cssText=`${w("sticky",0,0,e?h:g,e?g:d)}`,s||(n.style.cssText+=`background:\n ${x("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${w("relative",0,0,e?c:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${x("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const S=[" enter: "," leave: "];this.coords.forEach((t,s)=>{const r=s>1,l=(r?0:this.offset)+t,m=s%2,f=l<_,g=l>(r?e?h:d:e?c:u)-_,b=(r?m&&!f:!m&&!f)||g,T=i.createElement("div"),x=i.createElement("div"),$=e?b?"right":"left":b?"bottom":"top",E=b?(e?v:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${S[m]}${this.thresholds[s]}`,T.style.cssText=`${w("absolute",0,0,v,y)}\n display: flex;\n flex-direction: ${e?"column":"row"};\n justify-content: flex-${r?"start":"end"};\n align-items: flex-${b?"end":"start"};\n border-${$}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${y};\n margin-${e?b?"right":"left":b?"bottom":"top"}: -2px;\n padding: 1px;\n font-family: ui-monospace, monospace;\n font-size: 10px;\n letter-spacing: -.025em;\n line-height: 9px;\n font-weight: 600;\n text-align: ${e&&b||!e&&!r?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${m?a:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":a};\n border: 2px solid ${m?a:"transparent"};\n border-${e?b?"top-left":"top-right":b?"top-left":"bottom-left"}-radius: 5px;\n border-${e?b?"bottom-left":"bottom-right":b?"top-right":"bottom-right"}-radius: 5px;\n `,T.appendChild(x);let k=l-E+(e?1:0);T.style[e?"left":"top"]=`${k}px`,(r?n:o).appendChild(T)}),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Pe(t.element,"position")&&(this.debugStyles=Fe(t.element,{position:"relative "}))}updateBounds(){let t;this._debug&&this.removeDebug();const e=this.target,s=this.container,r=this.horizontal,n=this.linked;let o,a=e;for(n&&(o=n.currentTime,n.seek(0,!0)),a.parentElement;a&&a!==s.element&&a!==i.body;){const e="sticky"===Pe(a,"position")&&Fe(a,{position:"static"});a=a.parentElement,e&&(t||(t=[]),t.push(e))}const l=e.getBoundingClientRect(),h=s.scale,d=(r?l.left+s.scrollX-s.left:l.top+s.scrollY-s.top)*h,c=(r?l.width:l.height)*h,u=r?s.width:s.height,p=(r?s.scrollWidth:s.scrollHeight)-u,m=this.enter,f=this.leave;let g="start",y="end",v="end",_="start";if(z(m)){const t=m.split(" ");v=t[0],g=t.length>1?t[1]:g}else if(M(m)){const t=m;X(t.container)||(v=t.container),X(t.target)||(g=t.target)}else O(m)&&(v=m);if(z(f)){const t=f.split(" ");_=t[0],y=t.length>1?t[1]:y}else if(M(f)){const t=f;X(t.container)||(_=t.container),X(t.target)||(y=t.target)}else O(f)&&(_=f);const b=ds(e,g,c),T=ds(e,y,c),x=b+d-u,w=T+d-p,S=ds(e,v,u,x,w),$=ds(e,_,u,x,w),E=b+d-S,k=T+d-$,C=k-E;this.offset=d,this.offsetStart=E,this.offsetEnd=k,this.distance=C<=0?0:C,this.thresholds=[g,y,v,_],this.coords=[b,T,S,$],t&&t.forEach(t=>t.revert()),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){if(!this.ready)return;const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,a=this.scroll,l=a<=this.offsetStart,h=a>=this.offsetEnd,d=!l&&!h,c=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&c,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(l&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&O(i)){if(i<1){const t=1e-4,s=e<g&&1===g?t:e>g&&!g?-t:0;g=pt(ft(e,g,ft(.01,.2,i))+s,6)}}else s&&(g=s(g));m=g!==this.prevProgress,f=1===e,m&&!f&&i&&e&&o.wakeTicker.restart()}if(p){const t=n?o.scrollY:o.scrollX;p.style[n?"top":"left"]=t+10+"px"}(d&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(d&&(this.isInView=!0),this.forceEnter&&this.hasEntered?d&&(this.forceEnter=!1):(p&&d&&(p.style.zIndex=""+this.container.zIndex++),this.onSyncEnter(this),this.onEnter(this),this.backward?(this.onSyncEnterBackward(this),this.onEnterBackward(this)):(this.onSyncEnterForward(this),this.onEnterForward(this)),this.hasEntered=!0,u&&(this.forceEnter=!0))),(d||!d&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!d&&this.isInView&&(this.isInView=!1,this.onSyncLeave(this),this.onLeave(this),this.backward?(this.onSyncLeaveBackward(this),this.onLeaveBackward(this)):(this.onSyncLeaveForward(this),this.onLeaveForward(this)),e&&!i&&(f=!0)),g>=1&&this.began&&!this.completed&&(e&&f||!e)&&(e&&this.onSyncComplete(this),this.completed=!0,(!this.repeat&&!t||!this.repeat&&t&&t.completed)&&this.revert()),g<1&&this.completed&&(this.completed=!1),this.prevProgress=g}revert(){if(this.reverted)return;const t=this.container;return Tt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this.ready=!1,this}}const fs=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,gs=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?de:r=>0===r||1===r?r:fs(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=fs(r,e,s)-t,i>0?o=r:n=r}while(st(i)>1e-7&&++a<100);return r})(r,t,s),e,i),ys=(t=10,e)=>{const s=e?rt:nt;return e=>s(ct(e,0,1)*t)*(1/t)},vs=(...t)=>{const e=t.length;if(!e)return de;const s=e-1,i=t[0],r=t[s],n=[0],o=[Z(i)];for(let e=1;e<s;e++){const i=t[e],r=z(i)?i.trim().split(" "):[i],a=r[0],l=r[1];n.push(X(l)?e/s:Z(l)/100),o.push(Z(a))}return o.push(Z(r)),n.push(1),function(t){for(let e=1,s=n.length;e<s;e++){const s=n[e];if(t<=s){const i=n[e-1],r=o[e-1];return r+(o[e]-r)*(t-i)/(s-i)}}return o[o.length-1]}},_s=(t=10,e=1)=>{const s=[0],i=t-1;for(let t=1;t<i;t++){const r=s[t-1],n=t/i,o=n*(1-e)+(n+((t+1)/i-n)*Math.random())*e;s.push(ct(o,r,1))}return s.push(1),vs(...s)};var bs=Object.freeze({__proto__:null,Spring:je,createSpring:Qe,cubicBezier:gs,eases:ge,irregular:_s,linear:vs,spring:Ge,steps:ys});const Ts=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(pt(t(i/e),4));return`linear(${s.join(", ")})`},xs={},ws=t=>{let e=xs[t];if(e)return e;if(e="linear",z(t)){if(P(t,"linear")||P(t,"cubic-")||P(t,"steps")||P(t,"ease"))e=t;else if(P(t,"cubicB"))e=R(t);else{const s=ve(t);H(s)&&(e=s===de?"linear":Ts(s))}xs[t]=e}else if(H(t)){const s=Ts(t);s&&(e=s)}else t.ease&&(e=Ts(t.ease));return e},Ss=["x","y","z"],$s=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Ss],Es=(()=>[...Ss,...g.filter(t=>["X","Y","Z"].some(e=>t.endsWith(e)))])();let ks=null;const Cs=(t,e,s,i,r)=>{let n=z(e)?e:$t(e,s,i,r);return O(n)?$s.includes(t)||P(t,"translate")?`${n}px`:P(t,"rotate")||P(t,"skew")?`${n}deg`:`${n}`:n},Ns=(t,e,s,i,r,n)=>{let o="0";const a=X(i)?getComputedStyle(t)[e]:Cs(e,i,t,r,n);return o=X(s)?V(i)?i.map(s=>Cs(e,s,t,r,n)):a:[Cs(e,s,t,r,n),a],o};class Ds{constructor(t,s){I.current&&I.current.register(this),Y(ks)&&(!e||!X(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(g.forEach(t=>{const e=P(t,"skew"),s=P(t,"scale"),i=P(t,"rotate"),r=P(t,"translate"),n=i||e,o=n?"<angle>":s?"<number>":r?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:o,inherits:!1,initialValue:r?"0px":n?"0deg":s?"1":"0"})}catch{}}),ks=!0):ks=!1);const i=oe(t),r=i.length;r||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const n=St(s.autoplay,L.defaults.autoplay),o=!(!n||!n.link)&&n,a=s.alternate&&!0===s.alternate,h=s.reversed&&!0===s.reversed,d=St(s.loop,L.defaults.loop),c=!0===d||d===1/0?1/0:O(d)?d+1:1,u=a?h?"alternate-reverse":"alternate":h?"reverse":"normal",_=1===L.timeScale?1:p;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||L.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!n||!1!==o,this.reversed=h,this.persist=St(s.persist,L.defaults.persist),this.autoplay=n,this._speed=St(s.playbackRate,L.defaults.playbackRate),this._resolve=v,this._completed=0,this._inlineStyles=[],i.forEach((t,e)=>{const i=t[l],n=Es.some(t=>s.hasOwnProperty(t)),o=t.style,a=this._inlineStyles[e]={},h=St(s.ease,L.defaults.ease),d=$t(h,t,e,r),p=H(d)||z(d)?d:h,v=h.ease&&h,b=ws(p),T=(v?v.settlingDuration:$t(St(s.duration,L.defaults.duration),t,e,r))*_,x=$t(St(s.delay,L.defaults.delay),t,e,r)*_,w=St(s.composition,"replace");for(let l in s){if(!G(l))continue;const h={},d={iterations:c,direction:u,fill:"both",easing:b,duration:T,delay:x,composite:w},p=s[l],m=!!n&&(g.includes(l)?l:f.get(l)),y=m?"transform":l;let v;if(a[y]||(a[y]=o[y]),M(p)){const s=p,n=St(s.ease,b),a=n.ease&&n,c=s.to,u=s.from;if(d.duration=(a?a.settlingDuration:$t(St(s.duration,T),t,e,r))*_,d.delay=$t(St(s.delay,x),t,e,r)*_,d.composite=St(s.composition,w),d.easing=ws(n),v=Ns(t,l,u,c,e,r),m?(h[`--${m}`]=v,i[m]=v):h[l]=Ns(t,l,u,c,e,r),Re(this,t,l,h,d),!X(u))if(m){const t=`--${m}`;o.setProperty(t,h[t][0])}else o[l]=h[l][0]}else v=V(p)?p.map(s=>Cs(l,s,t,e,r)):Cs(l,p,t,e,r),m?(h[`--${m}`]=v,i[m]=v):h[l]=v,Re(this,t,l,h,d)}if(n){let t=m;for(let e in i)t+=`${y[e]}var(--${e})) `;o.transform=t}}),o&&this.autoplay.link(this)}forEach(t){try{const e=z(t)?e=>e[t]():t;this.animations.forEach(e)}catch{}return this}get speed(){return this._speed}set speed(t){this._speed=+t,this.forEach(e=>e.playbackRate=t)}get currentTime(){const t=this.controlAnimation,e=L.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===L.timeScale?1:p);this.forEach(t=>{!this.persist&&e>=this.duration&&t.play(),t.currentTime=e})}get progress(){return this.currentTime/this.duration}set progress(t){this.forEach(e=>e.currentTime=t*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach("play")):this}pause(){return this.paused?this:(this.paused=!0,this.forEach("pause"))}alternate(){return this.reversed=!this.reversed,this.forEach("reverse"),this.paused&&this.forEach("pause"),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(t,e=!1){return e&&(this.muteCallbacks=!0),t<this.duration&&(this.completed=!1),this.currentTime=t,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach("cancel"),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(t=>{"none"===t.style.transform&&t.style.removeProperty("transform")})}),this}revert(){return this.cancel().targets.forEach((t,e)=>{const s=t.style,i=this._inlineStyles[e];for(let e in i){const r=i[e];X(r)||r===m?s.removeProperty(R(e)):t.style[e]=r}t.getAttribute("style")===m&&t.removeAttribute("style")}),this}then(t=v){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=v};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}const Is={animate:(t,e)=>new Ds(t,e),convertEase:Ts};let Ls=0,As=0;const Bs=(t,e)=>!(!t||!e)&&(t===e||t.contains(e)),Rs=(t,e)=>{let s=t[e];for(;s&&s.nodeType===Node.TEXT_NODE&&!s.textContent.trim();)s=s[e];return s&&s.nodeType===Node.TEXT_NODE},Ps=t=>{if(!t)return null;const e=t.style,s=e.transition||"";return e.setProperty("transition","none","important"),s},Fs=(t,e)=>{if(!t)return;const s=t.style;e?s.transition=e:s.removeProperty("transition")},Vs=t=>{const e=t.layout.transitionMuteStore,s=t.$el,i=t.$measure;s&&!e.has(s)&&e.set(s,Ps(s)),i&&!e.has(i)&&e.set(i,Ps(i))},Ms=t=>{t.forEach((t,e)=>Fs(e,t)),t.clear()},Os={display:"none",visibility:"hidden",opacity:"0",transform:"none",position:"static"},zs=t=>{if(!t)return;const e=t.parentNode;e&&(e._head===t&&(e._head=t._next),e._tail===t&&(e._tail=t._prev),t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t._prev=null,t._next=null,t.parentNode=null)},Hs=(t,e,s,i)=>{let r=t.dataset.layoutId;r||(r=t.dataset.layoutId="node-"+As++);const n=i||{};return n.$el=t,n.$measure=t,n.id=r,n.index=0,n.total=1,n.delay=0,n.duration=0,n.ease=null,n.state=s,n.layout=s.layout,n.parentNode=e||null,n.isTarget=!1,n.isEntering=!1,n.isLeaving=!1,n.isInlined=!1,n.hasTransform=!1,n.inlineStyles=[],n.inlineTransforms=null,n.inlineTransition=null,n.branchAdded=!1,n.branchRemoved=!1,n.branchNotRendered=!1,n.sizeChanged=!1,n.hasVisibilitySwap=!1,n.hasDisplayNone=!1,n.hasVisibilityHidden=!1,n.measuredInlineTransform=null,n.measuredInlineTransition=null,n.measuredDisplay=null,n.measuredVisibility=null,n.measuredPosition=null,n.measuredHasDisplayNone=!1,n.measuredHasVisibilityHidden=!1,n.measuredIsVisible=!1,n.measuredIsRemoved=!1,n.measuredIsInsideRoot=!1,n.properties={transform:"none",x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},n.layout.properties.forEach(t=>n.properties[t]=0),n._head=null,n._tail=null,n._prev=null,n._next=null,n},Xs=(t,e,s,i)=>{const r=t.$el,n=t.layout.root,o=n===r,a=t.properties,l=t.state.rootNode,h=t.parentNode,d=s.transform,c=r.style.transform,u=!!h&&h.measuredIsRemoved,p=s.position;if(o&&(t.layout.absoluteCoords="fixed"===p||"absolute"===p),t.$measure=e,t.inlineTransforms=c,t.hasTransform=d&&"none"!==d,t.measuredIsInsideRoot=Bs(n,e),t.measuredInlineTransform=null,t.measuredDisplay=s.display,t.measuredVisibility=s.visibility,t.measuredPosition=p,t.measuredHasDisplayNone="none"===s.display,t.measuredHasVisibilityHidden="hidden"===s.visibility,t.measuredIsVisible=!(t.measuredHasDisplayNone||t.measuredHasVisibilityHidden),t.measuredIsRemoved=t.measuredHasDisplayNone||t.measuredHasVisibilityHidden||u,t.isInlined=t.measuredDisplay.includes("inline")&&(t=>Rs(t,"previousSibling")||Rs(t,"nextSibling"))(r),t.hasTransform&&!i){const s=t.layout.transitionMuteStore;s.get(r)||(t.inlineTransition=Ps(r)),e===r?r.style.transform="none":(s.get(e)||(t.measuredInlineTransition=Ps(e)),t.measuredInlineTransform=e.style.transform,e.style.transform="none")}let m,f,g=0,y=0,v=0,_=0;if(!i){const t=e.getBoundingClientRect();g=t.left,y=t.top,v=t.width,_=t.height}for(let t in a){const e="transform"===t?d:s[t]||s.getPropertyValue&&s.getPropertyValue(t);X(e)||(a[t]=e)}if(a.left=g,a.top=y,a.clientLeft=i?0:e.clientLeft,a.clientTop=i?0:e.clientTop,o)t.layout.absoluteCoords?(m=g,f=y):(m=0,f=0);else{const e=h||l,s=e.properties.left,i=e.properties.top,r=e.properties.clientLeft,n=e.properties.clientTop;if(t.layout.absoluteCoords)m=g-s-r,f=y-i-n;else if(e===l){const t=l.properties.left,e=l.properties.top;m=g-t-l.properties.clientLeft,f=y-e-l.properties.clientTop}else m=g-s-r,f=y-i-n}return a.x=m,a.y=f,a.width=v,a.height=_,t},Ys=(t,e)=>{if(e)for(let s in e)t.properties[s]=e[s]},Ws=(t,e)=>{const s=$t(e.ease,t.$el,t.index,t.total),i=H(s)?s:e.ease,r=!X(i)&&!X(i.ease);t.ease=r?i.ease:i,t.duration=r?i.settlingDuration:$t(e.duration,t.$el,t.index,t.total),t.delay=$t(e.delay,t.$el,t.index,t.total)},Us=t=>{const e=t.$el.style,s=t.inlineStyles;s.length=0,t.layout.recordedProperties.forEach(t=>{s.push(t,e[t]||"")})},qs=t=>{const e=t.$el.style,s=t.inlineStyles;for(let t=0,i=s.length;t<i;t+=2){const i=s[t],r=s[t+1];r&&""!==r?e[i]=r:(e[i]="",e.removeProperty(i))}},js=t=>{const e=t.inlineTransforms,s=t.$el.style;!t.hasTransform||!e||t.hasTransform&&"none"===s.transform||e&&"none"===e?s.removeProperty("transform"):e&&(s.transform=e);const i=t.$measure;if(t.hasTransform&&i!==t.$el){const e=i.style,s=t.measuredInlineTransform;s&&""!==s?e.transform=s:e.removeProperty("transform")}t.measuredInlineTransform=null,null!==t.inlineTransition&&(Fs(t.$el,t.inlineTransition),t.inlineTransition=null),i!==t.$el&&null!==t.measuredInlineTransition&&(Fs(i,t.measuredInlineTransition),t.measuredInlineTransition=null)},Gs=t=>{(t.measuredIsRemoved||t.hasVisibilitySwap)&&(t.$el.style.removeProperty("display"),t.$el.style.removeProperty("visibility"),t.hasVisibilitySwap&&(t.$measure.style.removeProperty("display"),t.$measure.style.removeProperty("visibility"))),t.layout.pendingRemoval.delete(t.$el)},Qs=(t,e,s)=>(e.properties={...t.properties},e.state=s,e.isTarget=t.isTarget,e.hasTransform=t.hasTransform,e.inlineTransforms=t.inlineTransforms,e.measuredIsVisible=t.measuredIsVisible,e.measuredDisplay=t.measuredDisplay,e.measuredIsRemoved=t.measuredIsRemoved,e.measuredHasDisplayNone=t.measuredHasDisplayNone,e.measuredHasVisibilityHidden=t.measuredHasVisibilityHidden,e.hasDisplayNone=t.hasDisplayNone,e.isInlined=t.isInlined,e.hasVisibilityHidden=t.hasVisibilityHidden,e);class Zs{constructor(t){this.layout=t,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(t=>{this.layout.pendingRemoval.delete(t.$el),t.$el.removeAttribute("data-layout-id"),t.$measure.removeAttribute("data-layout-id")}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}getNode(t){if(t&&t.dataset)return this.nodes.get(t.dataset.layoutId)}getComputedValue(t,e){const s=this.getNode(t);if(s)return s.properties[e]}forEach(t,e){let s=t,i=0;for(;s;)if(e(s,i++),s._head)s=s._head;else if(s._next)s=s._next;else{for(;s&&!s._next;)s=s.parentNode;s&&(s=s._next)}}forEachRootNode(t){this.forEach(this.rootNode,t)}forEachNode(t){for(const e of this.rootNodes)this.forEach(e,t)}registerElement(t,e){if(!t||1!==t.nodeType)return null;this.layout.transitionMuteStore.has(t)||this.layout.transitionMuteStore.set(t,Ps(t));const s=[t,e],i=this.layout.root;let r=null;for(;s.length;){const t=s.pop(),e=s.pop();if(!e||1!==e.nodeType||W(e))continue;const n=!!t&&t.measuredIsRemoved,o=n?Os:getComputedStyle(e),a=!!n||"none"===o.display,l=!!n||"hidden"===o.visibility,h=!a&&!l,d=e.dataset.layoutId,c=Bs(i,e);let u=d?this.nodes.get(d):null;if(u&&u.$el!==e){const a=Bs(i,u.$el),l=u.measuredIsVisible;if(a||!c&&(c||l||!h)){if(a&&!l&&h){Xs(u,e,o,n);let t=e.lastElementChild;for(;t;)s.push(t,u),t=t.previousElementSibling;r||(r=u);continue}{let i=e.lastElementChild;for(;i;)s.push(i,t),i=i.previousElementSibling;r||(r=u);continue}}zs(u),u=Hs(e,t,this,u)}else u=Hs(e,t,this,u);u.branchAdded=!1,u.branchRemoved=!1,u.branchNotRendered=!1,u.isTarget=!1,u.sizeChanged=!1,u.hasVisibilityHidden=l,u.hasDisplayNone=a,u.hasVisibilitySwap=l&&!u.measuredHasVisibilityHidden||a&&!u.measuredHasDisplayNone,this.nodes.set(u.id,u),u.parentNode=t||null,u._prev=null,u._next=null,t?(this.rootNodes.delete(u),t._head?(t._tail._next=u,u._prev=t._tail,t._tail=u):(t._head=u,t._tail=u)):this.rootNodes.add(u),Xs(u,u.$el,o,n);let p=e.lastElementChild;for(;p;)s.push(p,u),p=p.previousElementSibling;r||(r=u)}return r}ensureDetachedNode(t,e){if(!t||t===this.layout.root)return null;const s=t.dataset.layoutId,i=s?this.nodes.get(s):null;if(i&&i.$el===t)return i;let r=null,n=t.parentElement;for(;n&&n!==this.layout.root;){if(e.has(n)){r=this.ensureDetachedNode(n,e);break}n=n.parentElement}return this.registerElement(t,r)}record(){const t=this.layout,e=t.children,s=t.root,i=V(e)?e:[e],r=[],n="*"===e?s:I.root,o=[];let a=s.parentElement;for(;a&&1===a.nodeType;){const t=getComputedStyle(a);if(t.transform&&"none"!==t.transform){const t=a.style.transform||"",e=Ps(a);o.push(a,t,e),a.style.transform="none"}a=a.parentElement}for(let t=0,e=i.length;t<e;t++){const e=i[t];r[t]=z(e)?n.querySelectorAll(e):e}const l=oe(r);this.nodes.clear(),this.rootNodes.clear();const h=this.registerElement(s,null);h.isTarget=!0,this.rootNode=h;const d=new Set;let c=0,u=this.nodes.size;this.nodes.forEach((t,e)=>{t.index=c++,t.total=u,t&&t.measuredIsInsideRoot&&d.add(e)});const p=new Set,m=[];for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e&&1===e.nodeType&&e!==s){if(!Bs(s,e)){const t=e.dataset.layoutId;if(!t||!d.has(t))continue}p.has(e)||(p.add(e),m.push(e))}}for(let t=0,e=m.length;t<e;t++)this.ensureDetachedNode(m[t],p);for(let t=0,e=l.length;t<e;t++){const e=l[t],s=this.getNode(e);if(s){let t=s;for(;t&&!t.isTarget;)t.isTarget=!0,t=t.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY,this.forEachNode(js);for(let t=0,e=o.length;t<e;t+=3){const e=o[t],s=o[t+1],i=o[t+2];s&&""!==s?e.style.transform=s:e.style.removeProperty("transform"),Fs(e,i)}return this}}function Js(t){const e={},s={};for(let i in t){const r=t[i];"duration"===i||"delay"===i||"ease"===i?s[i]=r:e[i]=r}return[e,s]}class Ks{constructor(t,e={}){I.current&&I.current.register(this);const s=Js(e.swapAt),i=Js(e.enterFrom),r=Js(e.leaveTo),n=e.properties;if(e.duration=St(e.duration,350),e.delay=St(e.delay,0),e.ease=St(e.ease,"inOut(3.5)"),this.params=e,this.root=oe(t)[0],this.id=Ls++,this.children=e.children||"*",this.absoluteCoords=!1,this.swapAtParams=_t(e.swapAt||{opacity:0},{ease:"inOut(1.75)"}),this.enterFromParams=e.enterFrom||{opacity:0},this.leaveToParams=e.leaveTo||{opacity:0},this.properties=new Set(["opacity","fontSize","color","backgroundColor","borderRadius","border","filter","clipPath"]),s[0])for(let t in s[0])this.properties.add(t);if(i[0])for(let t in i[0])this.properties.add(t);if(r[0])for(let t in r[0])this.properties.add(t);if(n)for(let t=0,e=n.length;t<e;t++)this.properties.add(n[t]);this.recordedProperties=new Set(["display","visibility","translate","position","left","top","marginLeft","marginTop","width","height","maxWidth","maxHeight","minWidth","minHeight"]),this.properties.forEach(t=>this.recordedProperties.add(t)),this.pendingRemoval=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new Zs(this),this.newState=new Zs(this),this.timeline=null,this.transformAnimation=null,this.animating=[],this.swapping=[],this.leaving=[],this.entering=[],this.oldState.record(),Ms(this.transitionMuteStore)}revert(){return this.root.classList.remove("is-animated"),this.timeline&&(this.timeline.complete(),this.timeline=null),this.transformAnimation&&(this.transformAnimation.complete(),this.transformAnimation=null),this.animating.length=this.swapping.length=this.leaving.length=this.entering.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>Ms(this.transitionMuteStore)),this}record(){return this.transformAnimation&&(this.transformAnimation.cancel(),this.transformAnimation=null),this.oldState.record(),this.timeline&&(this.timeline.cancel(),this.timeline=null),this.newState.forEachRootNode(qs),this}animate(t={}){const e={ease:St(t.ease,this.params.ease),delay:St(t.delay,this.params.delay),duration:St(t.duration,this.params.duration)},s={},i=St(t.onComplete,this.params.onComplete),r=St(t.onPause,this.params.onPause);for(let e in D)"ease"!==e&&"duration"!==e&&"delay"!==e&&(X(t[e])?X(this.params[e])||(s[e]=this.params[e]):s[e]=t[e]);s.onComplete=()=>{this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(t=>{Gs(t),qs(t)});for(let t=0,e=w.length;t<e;t++){const e=w[t];e.style.transform=f.getComputedValue(e,"transform")}this.root.classList.contains("is-animated")&&(this.root.classList.remove("is-animated"),i&&i(this.timeline)),requestAnimationFrame(()=>{this.root.classList.contains("is-animated")||Ms(this.transitionMuteStore)})},s.onPause=()=>{this.root.classList.contains("is-animated")&&(this.transformAnimation&&this.transformAnimation.cancel(),f.forEachRootNode(Gs),this.root.classList.remove("is-animated"),i&&i(this.timeline),r&&r(this.timeline))},s.composition=!1;const n=_t(_t(t.swapAt||{},this.swapAtParams),e),o=_t(_t(t.enterFrom||{},this.enterFromParams),e),a=_t(_t(t.leaveTo||{},this.leaveToParams),e),[l,h]=Js(n),[d,c]=Js(o),[u,p]=Js(a),m=this.oldState,f=this.newState,g=this.animating,y=this.swapping,v=this.entering,_=this.leaving,b=this.pendingRemoval;g.length=y.length=v.length=_.length=0,m.forEachRootNode(Vs),f.record(),f.forEachRootNode(Us);const T=[],x=[],w=[],S=[],$=f.rootNode,E=$.$el;f.forEachRootNode(t=>{const e=t.$el,s=t.id,i=t.parentNode,r=!!i&&i.branchAdded,n=!!i&&i.branchRemoved,o=!!i&&i.branchNotRendered;let a=m.nodes.get(s);const l=!a;l?(a=Qs(t,{},m),m.nodes.set(s,a),a.measuredIsRemoved=!0):a.measuredIsRemoved&&!t.measuredIsRemoved&&(Qs(t,a,m),a.measuredIsRemoved=!0);const h=a.parentNode,c=(h?h.id:null)!==(i?i.id:null),p=a.$el!==t.$el,y=a.measuredIsRemoved,x=t.measuredIsRemoved;if(!a.measuredIsRemoved&&!x&&!l&&(c||p)){const t=a.properties.left,e=a.properties.top,s=i||f.rootNode,r=s.id?m.nodes.get(s.id):null,n=r?r.properties.left:s.properties.left,o=r?r.properties.top:s.properties.top,l=r?r.properties.clientLeft:s.properties.clientLeft,h=r?r.properties.clientTop:s.properties.clientTop;a.properties.x=t-n-l,a.properties.y=e-o-h}t.hasVisibilitySwap&&(t.hasVisibilityHidden&&(t.$el.style.visibility="visible",t.$measure.style.visibility="hidden"),t.hasDisplayNone&&(t.$el.style.display=a.measuredDisplay||t.measuredDisplay||"",t.$measure.style.visibility="hidden"));const w=b.has(e),S=a.measuredIsVisible,E=t.measuredIsVisible,k=!S&&E&&!o,C=!x&&(y||w)&&!r,N=x&&!y&&!n,D=N||x&&w&&!n;t.branchAdded=r||C,t.branchRemoved=n||D,t.branchNotRendered=o||x,x&&S&&(t.$el.style.display=a.measuredDisplay,t.$el.style.visibility="visible",Qs(a,t,f)),N?(t.isTarget&&(_.push(e),t.isLeaving=!0),b.add(e)):!x&&w&&b.delete(e),C&&!o||k?(Ys(a,d),t.isTarget&&(v.push(e),t.isEntering=!0)):D&&!o&&Ys(t,u),t===$||!t.isTarget||t.isEntering||t.isLeaving||g.push(e),T.push(e)});let k=0,C=0,N=0;f.forEachRootNode(t=>{const s=t.$el,i=t.parentNode,r=m.nodes.get(t.id),n=t.properties,o=r.properties;let a=i!==$&&i;for(;a&&!a.isTarget&&a!==$;)a=a.parentNode;const d=g.length;t===$?(t.index=0,t.total=d,Ws(t,e)):t.isEntering?(t.index=a?a.index:k,t.total=a?d:v.length,Ws(t,c),k++):t.isLeaving?(t.index=a?a.index:C,t.total=a?d:_.length,C++,Ws(t,p)):t.isTarget?(t.index=N++,t.total=d,Ws(t,e)):(t.index=a?a.index:0,t.total=d,Ws(t,h)),r.index=t.index,r.total=t.total;for(let e in n)n[e]=$t(n[e],s,t.index,t.total),o[e]=$t(o[e],s,r.index,r.total);const u=Math.abs(n.width-o.width)>1,f=Math.abs(n.height-o.height)>1;if(t.sizeChanged=u||f,t.isTarget&&(!t.measuredIsRemoved&&r.measuredIsVisible||t.measuredIsRemoved&&t.measuredIsVisible)){t.isInlined||"none"===n.transform&&"none"===o.transform||(t.hasTransform=!0,w.push(s));for(let t in n)if("transform"!==t&&n[t]!==o[t]){x.push(s);break}}t.isTarget||(y.push(s),t.sizeChanged&&i&&i.isTarget&&i.sizeChanged&&(!t.isInlined&&l.transform&&(t.hasTransform=!0,w.push(s)),S.push(s)))});const I={delay:t=>f.getNode(t).delay,duration:t=>f.getNode(t).duration,ease:t=>f.getNode(t).ease};if(s.defaults=I,this.timeline=Xe(s),!x.length&&!w.length&&!y.length)return Ms(this.transitionMuteStore),this.timeline.complete();if(T.length){this.root.classList.add("is-animated");for(let t=0,e=T.length;t<e;t++){const e=T[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties;r.isInlined||("grid"!==i.measuredDisplay&&"grid"!==r.measuredDisplay||e.style.setProperty("display","block","important"),(e!==E||this.absoluteCoords)&&(e.style.position=this.absoluteCoords?"fixed":"absolute",e.style.left="0px",e.style.top="0px",e.style.marginLeft="0px",e.style.marginTop="0px",e.style.translate=`${n.x}px ${n.y}px`),e===E&&"static"===r.measuredPosition&&(e.style.position="relative",e.style.left="0px",e.style.top="0px"),e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none")}m.scrollX===window.scrollX&&m.scrollY===window.scrollY||requestAnimationFrame(()=>window.scrollTo(m.scrollX,m.scrollY));for(let t=0,e=x.length;t<e;t++){const e=x[t],s=e.dataset.layoutId,i=m.nodes.get(s),r=f.nodes.get(s),n=i.properties,o=r.properties;let a=!1;const l={composition:"none"};r.isInlined||(n.width!==o.width&&(l.width=[n.width,o.width],a=!0),n.height!==o.height&&(l.height=[n.height,o.height],a=!0),r.hasTransform||(l.translate=[`${n.x}px ${n.y}px`,`${o.x}px ${o.y}px`],a=!0)),this.properties.forEach(t=>{const e=n[t],s=o[t];"transform"!==t&&e!==s&&(l[t]=[e,s],a=!0)}),a&&this.timeline.add(e,l,0)}}if(y.length){for(let t=0,e=y.length;t<e;t++){const e=y[t],s=m.getNode(e);if(!s.isInlined){const t=s.properties;e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${t.x}px ${t.y}px`}this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${m.getComputedValue(e,t)}`)})}for(let t=0,e=y.length;t<e;t++){const e=y[t],s=f.getNode(e),i=s.properties;this.timeline.call(()=>{s.isInlined||(e.style.width=`${i.width}px`,e.style.height=`${i.height}px`,e.style.minWidth="auto",e.style.minHeight="auto",e.style.maxWidth="none",e.style.maxHeight="none",e.style.translate=`${i.x}px ${i.y}px`),this.properties.forEach(t=>{"transform"!==t&&(e.style[t]=`${f.getComputedValue(e,t)}`)})},s.delay+s.duration/2)}if(S.length){const t=be(f.nodes.get(S[0].dataset.layoutId).ease),e=e=>1-t(1-e),s={};if(l)for(let t in l)"transform"!==t&&(s[t]=[{from:e=>m.getComputedValue(e,t),to:l[t]},{from:l[t],to:e=>f.getComputedValue(e,t),ease:e}]);this.timeline.add(S,s,0)}}const L=w.length;if(L){for(let t=0;t<L;t++){const e=w[t];if(e.style.translate=`${m.getComputedValue(e,"x")}px ${m.getComputedValue(e,"y")}px`,e.style.transform=m.getComputedValue(e,"transform"),S.includes(e)){const t=f.getNode(e);t.ease=$t(n.ease,e,t.index,t.total),t.duration=$t(n.duration,e,t.index,t.total)}}this.transformAnimation=Is.animate(w,{translate:t=>`${f.getComputedValue(t,"x")}px ${f.getComputedValue(t,"y")}px`,transform:t=>{const e=f.getComputedValue(t,"transform");if(!S.includes(t))return e;const s=m.getComputedValue(t,"transform"),i=f.getNode(t);return[s,$t(l.transform,t,i.index,i.total),e]},autoplay:!1,persist:!0,...I}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(t,e={}){return this.record(),t(this),this.animate(e)}}const ti=Ue,ei={},si=t=>(...e)=>{const s=t(...e);return new Proxy(v,{apply:(t,e,[i])=>s(i),get:(t,e)=>si((...t)=>{const i=ei[e](...t);return t=>i(s(t))})})},ii=(t,e,s=0)=>{const i=(...t)=>(t.length<e.length?si(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(e,s)):e)(...t);return ei[t]||(ei[t]=i),i},ri=ii("roundPad",ti.roundPad),ni=ii("padStart",ti.padStart),oi=ii("padEnd",ti.padEnd),ai=ii("wrap",ti.wrap),li=ii("mapRange",ti.mapRange),hi=ii("degToRad",ti.degToRad),di=ii("radToDeg",ti.radToDeg),ci=ii("snap",ti.snap),ui=ii("clamp",ti.clamp),pi=ii("round",ti.round),mi=ii("lerp",ti.lerp,1),fi=ii("damp",ti.damp,1),gi=(t=0,e=1,s=0)=>{const i=10**s;return Math.floor((Math.random()*(e-t+1/i)+t)*i)/i};let yi=0;const vi=(t,e=0,s=1,i=0)=>{let r=void 0===t?yi++:t;return(t=e,n=s,o=i)=>{r+=1831565813,r=Math.imul(r^r>>>15,1|r),r^=r+Math.imul(r^r>>>7,61|r);const a=10**o;return Math.floor((((r^r>>>14)>>>0)/4294967296*(n-t+1/a)+t)*a)/a}},_i=t=>t[gi(0,t.length-1)],bi=t=>{let e,s,i=t.length;for(;i;)s=gi(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},Ti=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!X(o),l=a&&!X(o.ease)?o.ease:a?be(o):null,h=e.grid,d=e.axis,c=e.total,u=X(r)||0===r||"first"===r,p="center"===r,f="last"===r,g="random"===r,y=V(t),v=e.use,_=Z(y?t[0]:t),b=y?Z(t[1]):0,T=$.exec((y?t[1]:t)+m),x=e.start||0+(y?_:0);let w=u?0:O(r)?r:0;return(t,r,o,a)=>{const[u]=oe(t),m=X(c)?o:c,S=!X(v)&&(H(v)?v(u,r,m):Ct(u,v)),$=O(S)||z(S)&&O(+S)?+S:r;if(p&&(w=(m-1)/2),f&&(w=m-1),!s.length){for(let t=0;t<m;t++){if(h){const e=p?(h[0]-1)/2:w%h[0],i=p?(h[1]-1)/2:nt(w/h[0]),r=e-t%h[0],n=i-nt(t/h[0]);let o=K(r*r+n*n);"x"===d&&(o=-r),"y"===d&&(o=-n),s.push(o)}else s.push(st(w-t));i=at(...s)}l&&(s=s.map(t=>l(t/i)*i)),n&&(s=s.map(t=>d?t<0?-1*t:-t:st(i-t))),g&&(s=bi(s))}const E=y?(b-_)/i:_;let k=(a?Me(a,X(e.start)?a.iterationDuration:x):x)+(E*pt(s[$],2)||0);return e.modifier&&(k=e.modifier(k)),T&&(k=`${k}${T[2]}`),k}};var xi=Object.freeze({__proto__:null,$:oe,clamp:ui,cleanInlineStyles:Ft,createSeededRandom:vi,damp:fi,degToRad:hi,get:Pe,keepTime:rs,lerp:mi,mapRange:li,padEnd:oi,padStart:ni,radToDeg:di,random:gi,randomPick:_i,remove:Ve,round:pi,roundPad:ri,set:Fe,shuffle:bi,snap:ci,stagger:Ti,sync:is,wrap:ai});const wi=t=>{const e=ne(t)[0];return e&&W(e)?e:console.warn(`${t} is not a valid SVGGeometryElement`)},Si=(t,e,s,i,r)=>{const n=s+i,o=r?Math.max(0,Math.min(n,e)):(n%e+e)%e;return t.getPointAtLength(o)},$i=(t,e,s=0)=>i=>{const r=+t.getTotalLength(),n=i[a],o=t.getCTM(),l=0===s;return{from:0,to:r,modifier:i=>{const a=i+s*r;if("a"===e){const e=Si(t,r,a,-1,l),s=Si(t,r,a,1,l);return 180*lt(s.y-e.y,s.x-e.x)/ht}{const s=Si(t,r,a,0,l);return"x"===e?n||!o?s.x:s.x*o.a+s.y*o.c+o.e:n||!o?s.y:s.x*o.b+s.y*o.d+o.f}}}},Ei=(t,e=0)=>{const s=wi(t);if(s)return{translateX:$i(s,"x",e),translateY:$i(s,"y",e),rotate:$i(s,"a",e)}},ki=(t,e=0,s=0)=>ne(t).map(t=>((t,e,s)=>{const i=p,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let a=n;const l=new Proxy(t,{get(t,e){const s=t[e];return e===d?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],l=+s[1],h=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(K(s.a*s.a+s.b*s.b)+K(s.c*s.c+s.d*s.d))/2)}return e})(o),d=-1e3*r*h,c=l*i*h+d,u=i*h+(0===r&&1===l||1===r&&0===l?0:10*h)-c;if("butt"!==n){const e=r===l?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${d}`),t.setAttribute("stroke-dasharray",`${c} ${u}`)}return Reflect.apply(s,t,e)}:H(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),l.setAttribute("draw",`${e} ${s}`)),l})(t,e,s)),Ci=(t,e=.33)=>s=>{if(!(s.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${s.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const i=wi(t);if(!i)throw new Error("Can't morph to an invalid target. 'path2' must resolve to an existing <path>, <polygon> or <polyline> SVG element.");if(!(i.tagName||"").toLowerCase().match(/^(path|polygon|polyline)$/))throw new Error(`Can't morph a <${i.tagName}> SVG element. Use <path>, <polygon> or <polyline>.`);const r="path"===s.tagName,n=r?" ":",",o=s[h];o&&s.setAttribute(r?"d":"points",o);let a="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),h=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<h;e++){const d=e/(h-1),c=s.getPointAtLength(t*d),u=i.getPointAtLength(o*d),p=r?0===e?"M":"L":"";a+=p+pt(c.x,3)+n+c.y+" ",l+=p+pt(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[h]=l,[a,l]};var Ni=Object.freeze({__proto__:null,createDrawable:ki,createMotionPath:Ei,morphTo:Ci});const Di="undefined"!=typeof Intl&&Intl.Segmenter,Ii=/\{value\}/g,Li=/\{i\}/g,Ai=/(\s+)/,Bi=/^\s+$/,Ri="line",Pi="word",Fi="char",Vi="data-line";let Mi=null,Oi=null,zi=null;const Hi=t=>t.isWordLike||" "===t.segment||O(+t.segment),Xi=t=>t.setAttribute("aria-hidden","true"),Yi=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Wi={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},Ui=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&Ui(e)}},qi=(t,e,s)=>{const i=t.getAttribute(Vi);if(null!==i&&+i!==e||"BR"===t.tagName){s.add(t);const e=t.previousSibling,i=t.nextSibling;e&&3===e.nodeType&&Bi.test(e.textContent)&&s.add(e),i&&3===i.nodeType&&Bi.test(i.textContent)&&s.add(i)}let r=t.childElementCount;for(;r--;)qi(t.children[r],e,s);return s},ji=(t,e={})=>{let s="";const i=z(e.class)?` class="${e.class}"`:"",r=St(e.clone,!1),n=St(e.wrap,!1),o=n?!0===n?"clip":n:!!r&&"clip";return n&&(s+=`<span${o?` style="overflow:${o};"`:""}>`),s+=`<span${i}${r?' style="position:relative;"':""} data-${t}="{i}">`,r?(s+="<span>{value}</span>",s+=`<span inert style="position:absolute;top:${"top"===r?"-100%":"bottom"===r?"100%":"0"};left:${"left"===r?"-100%":"right"===r?"100%":"0"};white-space:nowrap;">{value}</span>`):s+="{value}",s+="</span>",n&&(s+="</span>"),s},Gi=(t,e,s,i,r,n,o,a,l)=>{const h=r===Ri,d=r===Fi,c=`_${r}_`,u=H(t)?t(s):t,p=h?"block":"inline-block";zi.innerHTML=u.replace(Ii,`<i class="${c}"></i>`).replace(Li,`${d?l:h?o:a}`);const m=zi.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${c}`),v=y.length;if(v){f.style.display=p,g.style.display=p,g.setAttribute(Vi,`${o}`),h||(g.setAttribute("data-word",`${a}`),d&&g.setAttribute("data-char",`${l}`));let t=v;for(;t--;){const e=y[t],i=e.parentElement;i.style.display=p,h?i.innerHTML=s.innerHTML:i.replaceChild(s.cloneNode(!0),e)}e.push(g),i.appendChild(m)}else console.warn('The expression "{value}" is missing from the provided template.');return n&&(f.style.outline=`1px dotted ${Wi[r]}`),f};class Qi{constructor(t,s={}){Mi||(Mi=Di?new Di([],{granularity:Pi}):{segment:t=>{const e=[],s=t.split(Ai);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Bi.test(i)})}return e}}),Oi||(Oi=Di?new Di([],{granularity:"grapheme"}):{segment:t=>[...t].map(t=>({segment:t}))}),!zi&&e&&(zi=i.createElement("template")),I.current&&I.current.register(this);const{words:r,chars:n,lines:o,accessible:a,includeSpaces:l,debug:h}=s,d=(t=V(t)?t[0]:t)&&t.nodeType?t:(re(t)||[])[0],c=!0===o?{}:o,u=!0===r||X(r)?{}:r,p=!0===n?{}:n;this.debug=St(h,!1),this.includeSpaces=St(l,!1),this.accessible=St(a,!0),this.linesOnly=c&&!u&&!p,this.lineTemplate=M(c)?ji(Ri,c):c,this.wordTemplate=M(u)||this.linesOnly?ji(Pi,u):u,this.charTemplate=M(p)?ji(Fi,p):p,this.$target=d,this.html=d&&d.innerHTML,this.lines=[],this.words=[],this.chars=[],this.effects=[],this.effectsCleanups=[],this.cache=null,this.ready=!1,this.width=0,this.resizeTimeout=null;const m=()=>this.html&&(c||u||p)&&this.split();this.resizeObserver=new ResizeObserver(()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{const t=d.offsetWidth;t!==this.width&&(this.width=t,m())},150)}),this.lineTemplate&&!this.ready?i.fonts.ready.then(m):m(),d?this.resizeObserver.observe(d):console.warn("No Text Splitter target found.")}addEffect(t){if(!H(t))return console.warn("Effect must return a function.");const e=rs(t);return this.effects.push(e),this.ready&&(this.effectsCleanups[this.effects.length-1]=e(this)),this}revert(){return clearTimeout(this.resizeTimeout),this.lines.length=this.words.length=this.chars.length=0,this.resizeObserver.disconnect(),this.effectsCleanups.forEach(t=>H(t)?t(this):t.revert&&t.revert()),this.$target.innerHTML=this.html,this}splitNode(t){const e=this.wordTemplate,s=this.charTemplate,r=this.includeSpaces,n=this.debug,o=t.nodeType;if(3===o){const o=t.nodeValue;if(o.trim()){const a=[],l=this.words,h=this.chars,d=Mi.segment(o),c=i.createDocumentFragment();let u=null;for(const t of d){const e=t.segment,s=Hi(t);if(!u||s&&u&&Hi(u))a.push(e);else{const t=a.length-1,s=a[t];Ai.test(s)||Ai.test(e)?a.push(e):a[t]+=e}u=t}for(let t=0,o=a.length;t<o;t++){const o=a[t];if(o.trim()){const d=a[t+1],u=r&&d&&!d.trim(),p=o,m=s?Oi.segment(p):null,f=s?i.createDocumentFragment():i.createTextNode(u?o+" ":o);if(s){const t=[...m];for(let e=0,r=t.length;e<r;e++){const o=t[e],a=e===r-1&&u?o.segment+" ":o.segment,d=i.createTextNode(a);Gi(s,h,d,f,Fi,n,-1,l.length,h.length)}}e?Gi(e,l,f,c,Pi,n,-1,l.length,h.length):s?c.appendChild(f):c.appendChild(i.createTextNode(o)),u&&t++}else{if(t&&r)continue;c.appendChild(i.createTextNode(o))}}t.parentNode.replaceChild(c,t)}}else if(1===o){const e=[...t.childNodes];for(let t=0,s=e.length;t<s;t++)this.splitNode(e[t])}}split(t=!1){const e=this.$target,s=!!this.cache&&!t,r=this.lineTemplate,n=this.wordTemplate,o=this.charTemplate,a="loading"!==i.fonts.status,l=r&&a;this.ready=!r||a,(l||t)&&this.effectsCleanups.forEach(t=>H(t)&&t(this)),s||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),l&&(s&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Yi(e,Pi))),o&&(l||n)&&(this.chars=Yi(e,Fi));const h=this.words.length?this.words:this.chars;let d,c=0;for(let t=0,e=h.length;t<e;t++){const e=h[t],{top:s,height:i}=e.getBoundingClientRect();!X(d)&&s-d>.5*i&&c++,e.setAttribute(Vi,`${c}`);const r=e.querySelectorAll(`[${Vi}]`);let n=r.length;for(;n--;)r[n].setAttribute(Vi,`${c}`);d=s}if(l){const t=i.createDocumentFragment(),s=new Set,a=[];for(let t=0;t<c+1;t++){const i=e.cloneNode(!0);qi(i,t,new Set).forEach(t=>{const e=t.parentNode;e&&(1===t.nodeType&&s.add(e),e.removeChild(t))}),a.push(i)}s.forEach(Ui);for(let e=0,s=a.length;e<s;e++)Gi(r,this.lines,a[e],t,Ri,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Yi(e,Pi)),o&&(this.chars=Yi(e,Fi))}if(this.linesOnly){const t=this.words;let e=t.length;for(;e--;){const s=t[e];s.replaceWith(s.textContent)}t.length=0}if(this.accessible&&(l||!s)){const t=i.createElement("span");t.style.cssText="position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;",t.innerHTML=this.html,e.insertBefore(t,e.firstChild),this.lines.forEach(Xi),this.words.forEach(Xi),this.chars.forEach(Xi)}return this.width=e.offsetWidth,(l||t)&&this.effects.forEach((t,e)=>this.effectsCleanups[e]=t(this)),this}refresh(){this.split(!0)}}const Zi=(t,e)=>new Qi(t,e),Ji=(t,e)=>(console.warn("text.split() is deprecated, import splitText() directly, or text.splitText()"),new Qi(t,e));var Ki=Object.freeze({__proto__:null,TextSplitter:Qi,split:Ji,splitText:Zi});t.$=oe,t.Animatable=Ye,t.AutoLayout=Ks,t.Draggable=ss,t.JSAnimation=Le,t.Scope=ns,t.ScrollObserver=ms,t.Spring=je,t.TextSplitter=Qi,t.Timeline=He,t.Timer=ie,t.WAAPIAnimation=Ds,t.animate=(t,e)=>new Le(t,e,null,0,!1).init(),t.clamp=ui,t.cleanInlineStyles=Ft,t.createAnimatable=(t,e)=>new Ye(t,e),t.createDraggable=(t,e)=>new ss(t,e),t.createDrawable=ki,t.createLayout=(t,e)=>new Ks(t,e),t.createMotionPath=Ei,t.createScope=t=>new ns(t),t.createSeededRandom=vi,t.createSpring=Qe,t.createTimeline=Xe,t.createTimer=t=>new ie(t,null,0).init(),t.cubicBezier=gs,t.damp=fi,t.degToRad=hi,t.eases=ge,t.easings=bs,t.engine=Xt,t.get=Pe,t.irregular=_s,t.keepTime=rs,t.lerp=mi,t.linear=vs,t.mapRange=li,t.morphTo=Ci,t.onScroll=(t={})=>new ms(t),t.padEnd=oi,t.padStart=ni,t.radToDeg=di,t.random=gi,t.randomPick=_i,t.remove=Ve,t.round=pi,t.roundPad=ri,t.scrollContainers=as,t.set=Fe,t.shuffle=bi,t.snap=ci,t.split=Ji,t.splitText=Zi,t.spring=Ge,t.stagger=Ti,t.steps=ys,t.svg=Ni,t.sync=is,t.text=Ki,t.utils=xi,t.waapi=Is,t.wrap=ai});
diff --git a/dist/modules/animatable/animatable.cjs b/dist/modules/animatable/animatable.cjs
index fbdccfea..2f574b00 100644
--- a/dist/modules/animatable/animatable.cjs
+++ b/dist/modules/animatable/animatable.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - animatable - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/animatable/animatable.js b/dist/modules/animatable/animatable.js
index a6fdfea8..9dea5653 100644
--- a/dist/modules/animatable/animatable.js
+++ b/dist/modules/animatable/animatable.js
@@ -1,8 +1,8 @@
/**
* Anime.js - animatable - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { compositionTypes, noop } from '../core/consts.js';
diff --git a/dist/modules/animatable/index.cjs b/dist/modules/animatable/index.cjs
index c2cd2b6b..3b9759b5 100644
--- a/dist/modules/animatable/index.cjs
+++ b/dist/modules/animatable/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - animatable - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/animatable/index.js b/dist/modules/animatable/index.js
index 828f7af4..b2354c48 100644
--- a/dist/modules/animatable/index.js
+++ b/dist/modules/animatable/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - animatable - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { Animatable, createAnimatable } from './animatable.js';
diff --git a/dist/modules/animation/additive.cjs b/dist/modules/animation/additive.cjs
index f8aae2da..67c83046 100644
--- a/dist/modules/animation/additive.cjs
+++ b/dist/modules/animation/additive.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - animation - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/animation/additive.js b/dist/modules/animation/additive.js
index 763fe3fc..0dc397d6 100644
--- a/dist/modules/animation/additive.js
+++ b/dist/modules/animation/additive.js
@@ -1,8 +1,8 @@
/**
* Anime.js - animation - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { noop, minValue, valueTypes, tickModes } from '../core/consts.js';
diff --git a/dist/modules/animation/animation.cjs b/dist/modules/animation/animation.cjs
index 6a8840d3..8fb2a267 100644
--- a/dist/modules/animation/animation.cjs
+++ b/dist/modules/animation/animation.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - animation - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
@@ -307,10 +307,13 @@ class JSAnimation extends timer.Timer {
tweenToValue = computedToValue;
}
const tweenFromValue = values.getFunctionValue(key.from, target, ti, tl);
- const keyEasing = key.ease;
+ const easeToParse = key.ease || tEasing;
+
+ const easeFunctionResult = values.getFunctionValue(easeToParse, target, ti, tl);
+ const keyEasing = helpers.isFnc(easeFunctionResult) || helpers.isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
const hasSpring = !helpers.isUnd(keyEasing) && !helpers.isUnd(/** @type {Spring} */(keyEasing).ease);
- // Easing are treated differently and don't accept function based value to prevent having to pass a function wrapper that returns an other function all the time
- const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing || tEasing;
+ const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
// Calculate default individual keyframe duration by dividing the tl of keyframes
const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : values.getFunctionValue(values.setValue(key.duration, (l > 1 ? values.getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);
// Default delay value should only be applied to the first tween
diff --git a/dist/modules/animation/animation.js b/dist/modules/animation/animation.js
index ec9cad48..cb42163d 100644
--- a/dist/modules/animation/animation.js
+++ b/dist/modules/animation/animation.js
@@ -1,12 +1,12 @@
/**
* Anime.js - animation - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { K, compositionTypes, valueTypes, minValue, tweenTypes } from '../core/consts.js';
-import { mergeObjects, isUnd, isKey, isObj, round, cloneArray, isNil, addChild, forEachChildren, clampInfinity, normalizeTime, isArr, isNum } from '../core/helpers.js';
+import { mergeObjects, isUnd, isKey, isObj, round, cloneArray, isNil, addChild, forEachChildren, clampInfinity, normalizeTime, isArr, isFnc, isStr, isNum } from '../core/helpers.js';
import { globals } from '../core/globals.js';
import { registerTargets } from '../core/targets.js';
import { setValue, getTweenType, getFunctionValue, decomposeRawValue, getOriginalAnimatableValue, createDecomposedValueTargetObject, decomposedOriginalValue, getRelativeValue, decomposeTweenValue } from '../core/values.js';
@@ -305,10 +305,13 @@ class JSAnimation extends Timer {
tweenToValue = computedToValue;
}
const tweenFromValue = getFunctionValue(key.from, target, ti, tl);
- const keyEasing = key.ease;
+ const easeToParse = key.ease || tEasing;
+
+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
- // Easing are treated differently and don't accept function based value to prevent having to pass a function wrapper that returns an other function all the time
- const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing || tEasing;
+ const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
// Calculate default individual keyframe duration by dividing the tl of keyframes
const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);
// Default delay value should only be applied to the first tween
diff --git a/dist/modules/animation/composition.cjs b/dist/modules/animation/composition.cjs
index 0eee083b..2b11bc51 100644
--- a/dist/modules/animation/composition.cjs
+++ b/dist/modules/animation/composition.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - animation - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/animation/composition.js b/dist/modules/animation/composition.js
index 3d9b4040..e6c9dc05 100644
--- a/dist/modules/animation/composition.js
+++ b/dist/modules/animation/composition.js
@@ -1,8 +1,8 @@
/**
* Anime.js - animation - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { minValue, compositionTypes, tweenTypes } from '../core/consts.js';
diff --git a/dist/modules/animation/index.cjs b/dist/modules/animation/index.cjs
index 13485c9a..3b7bbffa 100644
--- a/dist/modules/animation/index.cjs
+++ b/dist/modules/animation/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - animation - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/animation/index.js b/dist/modules/animation/index.js
index 0dbbece8..843264c1 100644
--- a/dist/modules/animation/index.js
+++ b/dist/modules/animation/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - animation - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { JSAnimation, animate } from './animation.js';
diff --git a/dist/modules/core/clock.cjs b/dist/modules/core/clock.cjs
index 583b5268..3e5801b7 100644
--- a/dist/modules/core/clock.cjs
+++ b/dist/modules/core/clock.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/clock.js b/dist/modules/core/clock.js
index e91a8dde..7c32a577 100644
--- a/dist/modules/core/clock.js
+++ b/dist/modules/core/clock.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { K, maxFps, minValue, tickModes } from './consts.js';
diff --git a/dist/modules/core/colors.cjs b/dist/modules/core/colors.cjs
index 7f031744..036e7f73 100644
--- a/dist/modules/core/colors.cjs
+++ b/dist/modules/core/colors.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/colors.js b/dist/modules/core/colors.js
index bc16e085..7f3d7b97 100644
--- a/dist/modules/core/colors.js
+++ b/dist/modules/core/colors.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { rgbExecRgx, rgbaExecRgx, hslExecRgx, hslaExecRgx } from './consts.js';
diff --git a/dist/modules/core/consts.cjs b/dist/modules/core/consts.cjs
index 43ebb04e..5788a5e2 100644
--- a/dist/modules/core/consts.cjs
+++ b/dist/modules/core/consts.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/consts.js b/dist/modules/core/consts.js
index a02e8f5e..610777e1 100644
--- a/dist/modules/core/consts.js
+++ b/dist/modules/core/consts.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
// Environments
diff --git a/dist/modules/core/globals.cjs b/dist/modules/core/globals.cjs
index 26a7afbb..162a8d16 100644
--- a/dist/modules/core/globals.cjs
+++ b/dist/modules/core/globals.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
@@ -67,7 +67,7 @@ const globals = {
const devTools = consts.isBrowser && consts.win.AnimeJSDevTools;
-const globalVersions = { version: '4.3.0-beta.2', engine: null };
+const globalVersions = { version: '4.3.0', engine: null };
if (consts.isBrowser) {
if (!consts.win.AnimeJS) consts.win.AnimeJS = [];
diff --git a/dist/modules/core/globals.js b/dist/modules/core/globals.js
index f3be9a0f..121811b2 100644
--- a/dist/modules/core/globals.js
+++ b/dist/modules/core/globals.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { isBrowser, win, noop, maxFps, K, compositionTypes, doc } from './consts.js';
@@ -65,7 +65,7 @@ const globals = {
const devTools = isBrowser && win.AnimeJSDevTools;
-const globalVersions = { version: '4.3.0-beta.2', engine: null };
+const globalVersions = { version: '4.3.0', engine: null };
if (isBrowser) {
if (!win.AnimeJS) win.AnimeJS = [];
diff --git a/dist/modules/core/helpers.cjs b/dist/modules/core/helpers.cjs
index eae467ac..d5dae179 100644
--- a/dist/modules/core/helpers.cjs
+++ b/dist/modules/core/helpers.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
@@ -56,9 +56,9 @@ const isSvg = a => consts.isBrowser && a instanceof SVGElement;
/**@param {any} a @return {Boolean} */
const isHex = a => consts.hexTestRgx.test(a);
/**@param {any} a @return {Boolean} */
-const isRgb = a => stringStartsWith(a, 'rgb');
+const isRgb = a => stringStartsWith(a, 'rgb') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
-const isHsl = a => stringStartsWith(a, 'hsl');
+const isHsl = a => stringStartsWith(a, 'hsl') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
const isCol = a => isHex(a) || isRgb(a) || isHsl(a);
/**@param {any} a @return {Boolean} */
diff --git a/dist/modules/core/helpers.js b/dist/modules/core/helpers.js
index ab3a569a..737bf81c 100644
--- a/dist/modules/core/helpers.js
+++ b/dist/modules/core/helpers.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { isBrowser, maxValue, minValue, hexTestRgx, lowerCaseRgx } from './consts.js';
@@ -54,9 +54,9 @@ const isSvg = a => isBrowser && a instanceof SVGElement;
/**@param {any} a @return {Boolean} */
const isHex = a => hexTestRgx.test(a);
/**@param {any} a @return {Boolean} */
-const isRgb = a => stringStartsWith(a, 'rgb');
+const isRgb = a => stringStartsWith(a, 'rgb') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
-const isHsl = a => stringStartsWith(a, 'hsl');
+const isHsl = a => stringStartsWith(a, 'hsl') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
const isCol = a => isHex(a) || isRgb(a) || isHsl(a);
/**@param {any} a @return {Boolean} */
diff --git a/dist/modules/core/render.cjs b/dist/modules/core/render.cjs
index 36563668..1f74f2ce 100644
--- a/dist/modules/core/render.cjs
+++ b/dist/modules/core/render.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/render.js b/dist/modules/core/render.js
index 339d6b78..66d1e14c 100644
--- a/dist/modules/core/render.js
+++ b/dist/modules/core/render.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { globals } from './globals.js';
diff --git a/dist/modules/core/styles.cjs b/dist/modules/core/styles.cjs
index 4be8d520..14b3be4c 100644
--- a/dist/modules/core/styles.cjs
+++ b/dist/modules/core/styles.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/styles.js b/dist/modules/core/styles.js
index d934479e..7bc6c1db 100644
--- a/dist/modules/core/styles.js
+++ b/dist/modules/core/styles.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { tweenTypes, shortTransforms, isDomSymbol, transformsSymbol, transformsFragmentStrings, emptyString } from './consts.js';
diff --git a/dist/modules/core/targets.cjs b/dist/modules/core/targets.cjs
index 6b1d1116..ea0e9cc1 100644
--- a/dist/modules/core/targets.cjs
+++ b/dist/modules/core/targets.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/targets.js b/dist/modules/core/targets.js
index 8b29f653..33f02aa1 100644
--- a/dist/modules/core/targets.js
+++ b/dist/modules/core/targets.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { scope } from './globals.js';
diff --git a/dist/modules/core/transforms.cjs b/dist/modules/core/transforms.cjs
index 87e831d1..b06cb767 100644
--- a/dist/modules/core/transforms.cjs
+++ b/dist/modules/core/transforms.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/transforms.js b/dist/modules/core/transforms.js
index 4a1a9190..115e1d73 100644
--- a/dist/modules/core/transforms.js
+++ b/dist/modules/core/transforms.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { transformsSymbol, transformsExecRgx } from './consts.js';
diff --git a/dist/modules/core/units.cjs b/dist/modules/core/units.cjs
index 7b9f7eaf..087f38a8 100644
--- a/dist/modules/core/units.cjs
+++ b/dist/modules/core/units.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/units.js b/dist/modules/core/units.js
index 139dacdf..590ab7b3 100644
--- a/dist/modules/core/units.js
+++ b/dist/modules/core/units.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { valueTypes, doc } from './consts.js';
diff --git a/dist/modules/core/values.cjs b/dist/modules/core/values.cjs
index acec921f..d9682a92 100644
--- a/dist/modules/core/values.cjs
+++ b/dist/modules/core/values.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - core - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/core/values.js b/dist/modules/core/values.js
index 60478f31..fdcd2e50 100644
--- a/dist/modules/core/values.js
+++ b/dist/modules/core/values.js
@@ -1,8 +1,8 @@
/**
* Anime.js - core - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { tweenTypes, isDomSymbol, isSvgSymbol, validTransforms, shortTransforms, valueTypes, unitsExecRgx, digitWithExponentRgx, proxyTargetSymbol, cssVarPrefix, cssVariableMatchRgx, emptyString } from './consts.js';
diff --git a/dist/modules/draggable/draggable.cjs b/dist/modules/draggable/draggable.cjs
index 878505f5..b9b494b4 100644
--- a/dist/modules/draggable/draggable.cjs
+++ b/dist/modules/draggable/draggable.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - draggable - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/draggable/draggable.js b/dist/modules/draggable/draggable.js
index 20748e9a..6cc37c8b 100644
--- a/dist/modules/draggable/draggable.js
+++ b/dist/modules/draggable/draggable.js
@@ -1,8 +1,8 @@
/**
* Anime.js - draggable - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { globals, scope } from '../core/globals.js';
diff --git a/dist/modules/draggable/index.cjs b/dist/modules/draggable/index.cjs
index a8184480..246c033d 100644
--- a/dist/modules/draggable/index.cjs
+++ b/dist/modules/draggable/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - draggable - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/draggable/index.js b/dist/modules/draggable/index.js
index 5243b211..ea33de70 100644
--- a/dist/modules/draggable/index.js
+++ b/dist/modules/draggable/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - draggable - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { Draggable, createDraggable } from './draggable.js';
diff --git a/dist/modules/easings/cubic-bezier/index.cjs b/dist/modules/easings/cubic-bezier/index.cjs
index 75864e2b..c54589b1 100644
--- a/dist/modules/easings/cubic-bezier/index.cjs
+++ b/dist/modules/easings/cubic-bezier/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/cubic-bezier/index.js b/dist/modules/easings/cubic-bezier/index.js
index 541bc8ec..e8ae35bf 100644
--- a/dist/modules/easings/cubic-bezier/index.js
+++ b/dist/modules/easings/cubic-bezier/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { abs } from '../../core/helpers.js';
diff --git a/dist/modules/easings/eases/index.cjs b/dist/modules/easings/eases/index.cjs
index 18fbbd3f..fae8ae5b 100644
--- a/dist/modules/easings/eases/index.cjs
+++ b/dist/modules/easings/eases/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/eases/index.js b/dist/modules/easings/eases/index.js
index a7cdb2ff..ec152417 100644
--- a/dist/modules/easings/eases/index.js
+++ b/dist/modules/easings/eases/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { eases } from './parser.js';
diff --git a/dist/modules/easings/eases/parser.cjs b/dist/modules/easings/eases/parser.cjs
index ea780390..b3569d4f 100644
--- a/dist/modules/easings/eases/parser.cjs
+++ b/dist/modules/easings/eases/parser.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/eases/parser.js b/dist/modules/easings/eases/parser.js
index 89751e83..8d3cba04 100644
--- a/dist/modules/easings/eases/parser.js
+++ b/dist/modules/easings/eases/parser.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { emptyString, minValue } from '../../core/consts.js';
diff --git a/dist/modules/easings/index.cjs b/dist/modules/easings/index.cjs
index f8ea93d5..83373412 100644
--- a/dist/modules/easings/index.cjs
+++ b/dist/modules/easings/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/index.js b/dist/modules/easings/index.js
index 396f5a48..e0e54ed7 100644
--- a/dist/modules/easings/index.js
+++ b/dist/modules/easings/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { cubicBezier } from './cubic-bezier/index.js';
diff --git a/dist/modules/easings/irregular/index.cjs b/dist/modules/easings/irregular/index.cjs
index 4374943d..8be8dc3d 100644
--- a/dist/modules/easings/irregular/index.cjs
+++ b/dist/modules/easings/irregular/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/irregular/index.js b/dist/modules/easings/irregular/index.js
index 6d5d5eb1..109c8a58 100644
--- a/dist/modules/easings/irregular/index.js
+++ b/dist/modules/easings/irregular/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { clamp } from '../../core/helpers.js';
diff --git a/dist/modules/easings/linear/index.cjs b/dist/modules/easings/linear/index.cjs
index 047af7a8..eb11b9b0 100644
--- a/dist/modules/easings/linear/index.cjs
+++ b/dist/modules/easings/linear/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/linear/index.js b/dist/modules/easings/linear/index.js
index 6d8de53f..d1c75076 100644
--- a/dist/modules/easings/linear/index.js
+++ b/dist/modules/easings/linear/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { isStr, parseNumber, isUnd } from '../../core/helpers.js';
diff --git a/dist/modules/easings/none.cjs b/dist/modules/easings/none.cjs
index 763398f1..b42f396d 100644
--- a/dist/modules/easings/none.cjs
+++ b/dist/modules/easings/none.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/none.js b/dist/modules/easings/none.js
index a48aab2c..da31e261 100644
--- a/dist/modules/easings/none.js
+++ b/dist/modules/easings/none.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
/**
diff --git a/dist/modules/easings/spring/index.cjs b/dist/modules/easings/spring/index.cjs
index ab17061f..01765936 100644
--- a/dist/modules/easings/spring/index.cjs
+++ b/dist/modules/easings/spring/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/spring/index.js b/dist/modules/easings/spring/index.js
index 0d3646a4..20c312c7 100644
--- a/dist/modules/easings/spring/index.js
+++ b/dist/modules/easings/spring/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { K, minValue, noop } from '../../core/consts.js';
diff --git a/dist/modules/easings/steps/index.cjs b/dist/modules/easings/steps/index.cjs
index 707fb371..f856a41b 100644
--- a/dist/modules/easings/steps/index.cjs
+++ b/dist/modules/easings/steps/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/easings/steps/index.js b/dist/modules/easings/steps/index.js
index 13169c80..c814072c 100644
--- a/dist/modules/easings/steps/index.js
+++ b/dist/modules/easings/steps/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - easings - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { ceil, floor, clamp } from '../../core/helpers.js';
diff --git a/dist/modules/engine/engine.cjs b/dist/modules/engine/engine.cjs
index 92cc43d5..1abb933a 100644
--- a/dist/modules/engine/engine.cjs
+++ b/dist/modules/engine/engine.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - engine - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/engine/engine.js b/dist/modules/engine/engine.js
index 6f10e959..24286edf 100644
--- a/dist/modules/engine/engine.js
+++ b/dist/modules/engine/engine.js
@@ -1,8 +1,8 @@
/**
* Anime.js - engine - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { globalVersions, defaults, globals } from '../core/globals.js';
diff --git a/dist/modules/engine/index.cjs b/dist/modules/engine/index.cjs
index efe4b69e..55d18202 100644
--- a/dist/modules/engine/index.cjs
+++ b/dist/modules/engine/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - engine - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/engine/index.js b/dist/modules/engine/index.js
index fa2e7533..a619c75b 100644
--- a/dist/modules/engine/index.js
+++ b/dist/modules/engine/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - engine - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { engine } from './engine.js';
diff --git a/dist/modules/events/index.cjs b/dist/modules/events/index.cjs
index 5c8af7d7..aaea0ef7 100644
--- a/dist/modules/events/index.cjs
+++ b/dist/modules/events/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - events - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/events/index.js b/dist/modules/events/index.js
index 1c75f174..fe36d84a 100644
--- a/dist/modules/events/index.js
+++ b/dist/modules/events/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - events - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { ScrollObserver, onScroll, scrollContainers } from './scroll.js';
diff --git a/dist/modules/events/scroll.cjs b/dist/modules/events/scroll.cjs
index 3dda7cea..660b4727 100644
--- a/dist/modules/events/scroll.cjs
+++ b/dist/modules/events/scroll.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - events - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/events/scroll.js b/dist/modules/events/scroll.js
index c147281f..318b5e4f 100644
--- a/dist/modules/events/scroll.js
+++ b/dist/modules/events/scroll.js
@@ -1,8 +1,8 @@
/**
* Anime.js - events - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { noop, doc, isDomSymbol, relativeValuesExecRgx, win } from '../core/consts.js';
diff --git a/dist/modules/index.cjs b/dist/modules/index.cjs
index 71c86057..4c78ba76 100644
--- a/dist/modules/index.cjs
+++ b/dist/modules/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/index.js b/dist/modules/index.js
index 168b826c..4b312f8f 100644
--- a/dist/modules/index.js
+++ b/dist/modules/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { Timer, createTimer } from './timer/timer.js';
diff --git a/dist/modules/layout/index.cjs b/dist/modules/layout/index.cjs
index 91ddea96..821d4e5e 100644
--- a/dist/modules/layout/index.cjs
+++ b/dist/modules/layout/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - layout - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/layout/index.js b/dist/modules/layout/index.js
index bac56296..f5f32c66 100644
--- a/dist/modules/layout/index.js
+++ b/dist/modules/layout/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - layout - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { AutoLayout, createLayout } from './layout.js';
diff --git a/dist/modules/layout/layout.cjs b/dist/modules/layout/layout.cjs
index de84ecef..db63916a 100644
--- a/dist/modules/layout/layout.cjs
+++ b/dist/modules/layout/layout.cjs
@@ -1,16 +1,16 @@
/**
* Anime.js - layout - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
var helpers = require('../core/helpers.cjs');
var targets = require('../core/targets.cjs');
+var parser = require('../easings/eases/parser.cjs');
var values = require('../core/values.cjs');
-var consts = require('../core/consts.cjs');
var timeline = require('../timeline/timeline.cjs');
var waapi = require('../waapi/waapi.cjs');
var globals = require('../core/globals.cjs');
@@ -18,6 +18,10 @@ var globals = require('../core/globals.cjs');
/**
* @import {
* AnimationParams,
+ * RenderableCallbacks,
+ * TickableCallbacks,
+ * TimelineParams,
+ * TimerParams,
* } from '../types/index.js'
*/
@@ -33,13 +37,18 @@ var globals = require('../core/globals.cjs');
* } from '../waapi/waapi.js'
*/
+/**
+ * @import {
+ * Spring,
+ } from '../easings/spring/index.js'
+*/
+
/**
* @import {
* DOMTarget,
* DOMTargetSelector,
* FunctionValue,
* EasingParam,
- * Callback,
} from '../types/index.js'
*/
@@ -48,29 +57,47 @@ var globals = require('../core/globals.cjs');
*/
/**
- * @typedef {Record<String, Number|String>} LayoutStateParams
+ * @typedef {Object} LayoutAnimationTimingsParams
+ * @property {Number|FunctionValue} [delay]
+ * @property {Number|FunctionValue} [duration]
+ * @property {EasingParam|FunctionValue} [ease]
+ */
+
+/**
+ * @typedef {Record<String, Number|String|FunctionValue>} LayoutStateAnimationProperties
*/
/**
- * @typedef {Object} LayoutAnimationParams
+ * @typedef {LayoutStateAnimationProperties & LayoutAnimationTimingsParams} LayoutStateParams
+ */
+
+/**
+ * @typedef {Object} LayoutSpecificAnimationParams
* @property {Number|FunctionValue} [delay]
* @property {Number|FunctionValue} [duration]
- * @property {EasingParam} [ease]
- * @property {LayoutStateParams} [frozen]
- * @property {LayoutStateParams} [added]
- * @property {LayoutStateParams} [removed]
- * @property {Callback<AutoLayout>} [onComplete]
+ * @property {EasingParam|FunctionValue} [ease]
+ * @property {EasingParam} [playbackEase]
+ * @property {LayoutStateParams} [swapAt]
+ * @property {LayoutStateParams} [enterFrom]
+ * @property {LayoutStateParams} [leaveTo]
+ */
+
+/**
+ * @typedef {LayoutSpecificAnimationParams & TimerParams & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} LayoutAnimationParams
*/
/**
- * @typedef {LayoutAnimationParams & {
- * children?: LayoutChildrenParam,
- * properties?: Array<String>,
- * }} AutoLayoutParams
+ * @typedef {Object} LayoutOptions
+ * @property {LayoutChildrenParam} [children]
+ * @property {Array<String>} [properties]
*/
/**
- * @typedef {Record<String, Number|String> & {
+ * @typedef {LayoutAnimationParams & LayoutOptions} AutoLayoutParams
+ */
+
+/**
+ * @typedef {Record<String, Number|String|FunctionValue> & {
* transform: String,
* x: Number,
* y: Number,
@@ -91,13 +118,15 @@ var globals = require('../core/globals.cjs');
* @property {Number} total
* @property {Number} delay
* @property {Number} duration
+ * @property {EasingParam} ease
* @property {DOMTarget} $measure
* @property {LayoutSnapshot} state
* @property {AutoLayout} layout
* @property {LayoutNode|null} parentNode
* @property {Boolean} isTarget
+ * @property {Boolean} isEntering
+ * @property {Boolean} isLeaving
* @property {Boolean} hasTransform
- * @property {Boolean} isAnimated
* @property {Array<String>} inlineStyles
* @property {String|null} inlineTransforms
* @property {String|null} inlineTransition
@@ -238,7 +267,7 @@ const detachNode = node => {
* @param {DOMTarget} $el
* @param {LayoutNode|null} parentNode
* @param {LayoutSnapshot} state
- * @param {LayoutNode} [recycledNode]
+ * @param {LayoutNode} recycledNode
* @return {LayoutNode}
*/
const createNode = ($el, parentNode, state, recycledNode) => {
@@ -252,12 +281,15 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.total = 1;
node.delay = 0;
node.duration = 0;
+ node.ease = null;
node.state = state;
node.layout = state.layout;
node.parentNode = parentNode || null;
node.isTarget = false;
+ node.isEntering = false;
+ node.isLeaving = false;
+ node.isInlined = false;
node.hasTransform = false;
- node.isAnimated = false;
node.inlineStyles = [];
node.inlineTransforms = null;
node.inlineTransition = null;
@@ -265,7 +297,6 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.branchRemoved = false;
node.branchNotRendered = false;
node.sizeChanged = false;
- node.isInlined = false;
node.hasVisibilitySwap = false;
node.hasDisplayNone = false;
node.hasVisibilityHidden = false;
@@ -408,7 +439,7 @@ const recordNodeState = (node, $measure, computedStyle, skipMeasurements) => {
/**
* @param {LayoutNode} node
- * @param {LayoutStateParams} [props]
+ * @param {LayoutStateAnimationProperties} [props]
*/
const updateNodeProperties = (node, props) => {
if (!props) return;
@@ -417,6 +448,19 @@ const updateNodeProperties = (node, props) => {
}
};
+/**
+ * @param {LayoutNode} node
+ * @param {LayoutAnimationTimingsParams} params
+ */
+const updateNodeTimingParams = (node, params) => {
+ const easeFunctionResult = values.getFunctionValue(params.ease, node.$el, node.index, node.total);
+ const keyEasing = helpers.isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;
+ const hasSpring = !helpers.isUnd(keyEasing) && !helpers.isUnd(/** @type {Spring} */(keyEasing).ease);
+ node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : values.getFunctionValue(params.duration, node.$el, node.index, node.total);
+ node.delay = values.getFunctionValue(params.delay, node.$el, node.index, node.total);
+};
+
/**
* @param {LayoutNode} node
*/
@@ -491,9 +535,9 @@ const restoreNodeVisualState = node => {
node.$measure.style.removeProperty('visibility');
}
}
- if (node.measuredIsRemoved) {
- node.layout.pendingRemoved.delete(node.$el);
- }
+ // if (node.measuredIsRemoved) {
+ node.layout.pendingRemoval.delete(node.$el);
+ // }
};
/**
@@ -543,6 +587,7 @@ class LayoutSnapshot {
*/
revert() {
this.forEachNode(node => {
+ this.layout.pendingRemoval.delete(node.$el);
node.$el.removeAttribute('data-layout-id');
node.$measure.removeAttribute('data-layout-id');
});
@@ -554,34 +599,22 @@ class LayoutSnapshot {
/**
* @param {DOMTarget} $el
- * @return {LayoutNodeProperties|undefined}
+ * @return {LayoutNode}
*/
- get($el) {
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- return node.properties;
+ getNode($el) {
+ if (!$el || !$el.dataset) return;
+ return this.nodes.get($el.dataset.layoutId);
}
/**
* @param {DOMTarget} $el
* @param {String} prop
- * @return {Number|String|undefined}
+ * @return {Number|String}
*/
- getValue($el, prop) {
- if (!$el || !$el.dataset) {
- console.warn(`No element found on state (${$el})`);
- return;
- }
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- const value = node.properties[prop];
- if (!helpers.isUnd(value)) return values.getFunctionValue(value, $el, node.index, node.total);
+ getComputedValue($el, prop) {
+ const node = this.getNode($el);
+ if (!node) return;
+ return /** @type {Number|String} */(node.properties[prop]);
}
/**
@@ -642,10 +675,10 @@ class LayoutSnapshot {
const $parent = /** @type {LayoutNode|null} */(stack.pop());
/** @type {DOMTarget|null} */
const $current = /** @type {DOMTarget|null} */(stack.pop());
+
if (!$current || $current.nodeType !== 1 || helpers.isSvg($current)) continue;
const skipMeasurements = $parent ? $parent.measuredIsRemoved : false;
-
const computedStyle = skipMeasurements ? hiddenComputedStyle : getComputedStyle($current);
const hasDisplayNone = skipMeasurements ? true : computedStyle.display === 'none';
const hasVisibilityHidden = skipMeasurements ? true : computedStyle.visibility === 'hidden';
@@ -692,11 +725,10 @@ class LayoutSnapshot {
node.branchRemoved = false;
node.branchNotRendered = false;
node.isTarget = false;
- node.isAnimated = false;
+ node.sizeChanged = false;
node.hasVisibilityHidden = hasVisibilityHidden;
node.hasDisplayNone = hasDisplayNone;
node.hasVisibilitySwap = (hasVisibilityHidden && !node.measuredHasVisibilityHidden) || (hasDisplayNone && !node.measuredHasDisplayNone);
- // node.hasVisibilitySwap = (hasVisibilityHidden !== node.measuredHasVisibilityHidden) || (hasDisplayNone !== node.measuredHasDisplayNone);
this.nodes.set(node.id, node);
@@ -715,6 +747,7 @@ class LayoutSnapshot {
$parent._tail = node;
}
} else {
+ // Each disconnected subtree becomes its own root in the snapshot graph
this.rootNodes.add(node);
}
@@ -758,11 +791,29 @@ class LayoutSnapshot {
* @return {this}
*/
record() {
- const { children, root } = this.layout;
+ const layout = this.layout;
+ const children = layout.children;
+ const root = layout.root;
const toParse = helpers.isArr(children) ? children : [children];
const scoped = [];
const scopeRoot = children === '*' ? root : globals.scope.root;
+ // Mute transition and transforms of root ancestors before recording the state
+
+ /** @type {Array<DOMTarget|String|null>} */
+ const rootAncestorTransformStore = [];
+ let $ancestor = root.parentElement;
+ while ($ancestor && $ancestor.nodeType === 1) {
+ const computedStyle = getComputedStyle($ancestor);
+ if (computedStyle.transform && computedStyle.transform !== 'none') {
+ const inlineTransform = $ancestor.style.transform || '';
+ const inlineTransition = muteElementTransition($ancestor);
+ rootAncestorTransformStore.push($ancestor, inlineTransform, inlineTransition);
+ $ancestor.style.transform = 'none';
+ }
+ $ancestor = $ancestor.parentElement;
+ }
+
for (let i = 0, l = toParse.length; i < l; i++) {
const child = toParse[i];
scoped[i] = helpers.isStr(child) ? scopeRoot.querySelectorAll(child) : child;
@@ -778,9 +829,13 @@ class LayoutSnapshot {
rootNode.isTarget = true;
this.rootNode = rootNode;
- // Track ids of nodes that belong to the current root to filter detached matches
const inRootNodeIds = new Set();
+ // Update index and total for inital timing calculation
+ let index = 0, total = this.nodes.size;
this.nodes.forEach((node, id) => {
+ node.index = index++;
+ node.total = total;
+ // Track ids of nodes that belong to the current root to filter detached matches
if (node && node.measuredIsInsideRoot) {
inRootNodeIds.add(id);
}
@@ -810,7 +865,7 @@ class LayoutSnapshot {
for (let i = 0, l = parsedChildren.length; i < l; i++) {
const $el = parsedChildren[i];
- const node = this.nodes.get($el.dataset.layoutId);
+ const node = this.getNode($el);
if (node) {
let cur = node;
while (cur) {
@@ -824,18 +879,52 @@ class LayoutSnapshot {
this.scrollX = window.scrollX;
this.scrollY = window.scrollY;
- const total = this.nodes.size;
-
this.forEachNode(restoreNodeTransform);
- this.forEachNode((node, i) => {
- node.index = i;
- node.total = total;
- });
+
+ // Restore transition and transforms of root ancestors
+
+ for (let i = 0, l = rootAncestorTransformStore.length; i < l; i += 3) {
+ const $el = /** @type {DOMTarget} */(rootAncestorTransformStore[i]);
+ const inlineTransform = /** @type {String} */(rootAncestorTransformStore[i + 1]);
+ const inlineTransition = /** @type {String|null} */(rootAncestorTransformStore[i + 2]);
+ if (inlineTransform && inlineTransform !== '') {
+ $el.style.transform = inlineTransform;
+ } else {
+ $el.style.removeProperty('transform');
+ }
+ restoreElementTransition($el, inlineTransition);
+ }
return this;
}
}
+/**
+ * @param {LayoutStateParams} params
+ * @return {[LayoutStateAnimationProperties, LayoutAnimationTimingsParams]}
+ */
+function splitPropertiesFromParams(params) {
+ /** @type {LayoutStateAnimationProperties} */
+ const properties = {};
+ /** @type {LayoutAnimationTimingsParams} */
+ const parameters = {};
+ for (let name in params) {
+ const value = params[name];
+ const isEase = name === 'ease';
+ const isTiming = name === 'duration' || name === 'delay';
+ if (isTiming || isEase) {
+ if (isEase) {
+ parameters[name] = /** @type {EasingParam} */(value);
+ } else {
+ parameters[name] = /** @type {Number|FunctionValue} */(value);
+ }
+ } else {
+ properties[name] = /** @type {Number|String} */(value);
+ }
+ }
+ return [properties, parameters];
+}
+
class AutoLayout {
/**
* @param {DOMTargetSelector} root
@@ -843,10 +932,16 @@ class AutoLayout {
*/
constructor(root, params = {}) {
if (globals.scope.current) globals.scope.current.register(this);
- const frozenParams = params.frozen;
- const addedParams = params.added;
- const removedParams = params.removed;
- const propsParams = params.properties;
+ const swapAtSplitParams = splitPropertiesFromParams(params.swapAt);
+ const enterFromSplitParams = splitPropertiesFromParams(params.enterFrom);
+ const leaveToSplitParams = splitPropertiesFromParams(params.leaveTo);
+ const transitionProperties = params.properties;
+ /** @type {Number|FunctionValue} */
+ params.duration = values.setValue(params.duration, 350);
+ /** @type {Number|FunctionValue} */
+ params.delay = values.setValue(params.delay, 0);
+ /** @type {EasingParam|FunctionValue} */
+ params.ease = values.setValue(params.ease, 'inOut(3.5)');
/** @type {AutoLayoutParams} */
this.params = params;
/** @type {DOMTarget} */
@@ -857,29 +952,27 @@ class AutoLayout {
this.children = params.children || '*';
/** @type {Boolean} */
this.absoluteCoords = false;
- /** @type {Number|FunctionValue} */
- this.duration = values.setValue(params.duration, 500);
- /** @type {Number|FunctionValue} */
- this.delay = values.setValue(params.delay, 0);
- /** @type {EasingParam} */
- this.ease = values.setValue(params.ease, 'inOut(3.5)');
- /** @type {Callback<this>} */
- this.onComplete = values.setValue(params.onComplete, /** @type {Callback<this>} */(consts.noop));
/** @type {LayoutStateParams} */
- this.frozenParams = frozenParams || { opacity: 0 };
+ this.swapAtParams = helpers.mergeObjects(params.swapAt || { opacity: 0 }, { ease: 'inOut(1.75)' });
/** @type {LayoutStateParams} */
- this.addedParams = addedParams || { opacity: 0 };
+ this.enterFromParams = params.enterFrom || { opacity: 0 };
/** @type {LayoutStateParams} */
- this.removedParams = removedParams || { opacity: 0 };
+ this.leaveToParams = params.leaveTo || { opacity: 0 };
/** @type {Set<String>} */
this.properties = new Set([
'opacity',
+ 'fontSize',
+ 'color',
+ 'backgroundColor',
'borderRadius',
+ 'border',
+ 'filter',
+ 'clipPath',
]);
- if (frozenParams) for (let name in frozenParams) this.properties.add(name);
- if (addedParams) for (let name in addedParams) this.properties.add(name);
- if (removedParams) for (let name in removedParams) this.properties.add(name);
- if (propsParams) for (let i = 0, l = propsParams.length; i < l; i++) this.properties.add(propsParams[i]);
+ if (swapAtSplitParams[0]) for (let name in swapAtSplitParams[0]) this.properties.add(name);
+ if (enterFromSplitParams[0]) for (let name in enterFromSplitParams[0]) this.properties.add(name);
+ if (leaveToSplitParams[0]) for (let name in leaveToSplitParams[0]) this.properties.add(name);
+ if (transitionProperties) for (let i = 0, l = transitionProperties.length; i < l; i++) this.properties.add(transitionProperties[i]);
/** @type {Set<String>} */
this.recordedProperties = new Set([
'display',
@@ -899,24 +992,26 @@ class AutoLayout {
]);
this.properties.forEach(prop => this.recordedProperties.add(prop));
/** @type {WeakSet<DOMTarget>} */
- this.pendingRemoved = new WeakSet();
+ this.pendingRemoval = new WeakSet();
/** @type {Map<DOMTarget, String|null>} */
this.transitionMuteStore = new Map();
/** @type {LayoutSnapshot} */
this.oldState = new LayoutSnapshot(this);
/** @type {LayoutSnapshot} */
this.newState = new LayoutSnapshot(this);
- /** @type {Timeline|null} */
+ /** @type {Timeline} */
this.timeline = null;
- /** @type {WAAPIAnimation|null} */
+ /** @type {WAAPIAnimation} */
this.transformAnimation = null;
/** @type {Array<DOMTarget>} */
- this.frozen = [];
+ this.animating = [];
+ /** @type {Array<DOMTarget>} */
+ this.swapping = [];
/** @type {Array<DOMTarget>} */
- this.removed = [];
+ this.leaving = [];
/** @type {Array<DOMTarget>} */
- this.added = [];
- // Record the current state as the old state to init the data attributes
+ this.entering = [];
+ // Record the current state as the old state to init the data attributes and allow imediate .animate()
this.oldState.record();
// And all layout transition muted during the record
restoreLayoutTransition(this.transitionMuteStore);
@@ -926,6 +1021,7 @@ class AutoLayout {
* @return {this}
*/
revert() {
+ this.root.classList.remove('is-animated');
if (this.timeline) {
this.timeline.complete();
this.timeline = null;
@@ -934,8 +1030,7 @@ class AutoLayout {
this.transformAnimation.complete();
this.transformAnimation = null;
}
- this.root.classList.remove('is-animated');
- this.frozen.length = this.removed.length = this.added.length = 0;
+ this.animating.length = this.swapping.length = this.leaving.length = this.entering.length = 0;
this.oldState.revert();
this.newState.revert();
requestAnimationFrame(() => restoreLayoutTransition(this.transitionMuteStore));
@@ -968,20 +1063,72 @@ class AutoLayout {
* @return {Timeline}
*/
animate(params = {}) {
- const delay = values.setValue(params.delay, this.delay);
- const duration = values.setValue(params.duration, this.duration);
- const onComplete = values.setValue(params.onComplete, this.onComplete);
- const frozenParams = params.frozen ? helpers.mergeObjects(params.frozen, this.frozenParams) : this.frozenParams;
- const addedParams = params.added ? helpers.mergeObjects(params.added, this.addedParams) : this.addedParams;
- const removedParams = params.removed ? helpers.mergeObjects(params.removed, this.removedParams) : this.removedParams;
+ /** @type { LayoutAnimationTimingsParams } */
+ const animationTimings = {
+ ease: values.setValue(params.ease, this.params.ease),
+ delay: values.setValue(params.delay, this.params.delay),
+ duration: values.setValue(params.duration, this.params.duration),
+ };
+ /** @type {TimelineParams} */
+ const tlParams = {};
+ const onComplete = values.setValue(params.onComplete, this.params.onComplete);
+ const onPause = values.setValue(params.onPause, this.params.onPause);
+ for (let name in globals.defaults) {
+ if (name !== 'ease' && name !== 'duration' && name !== 'delay') {
+ if (!helpers.isUnd(params[name])) {
+ tlParams[name] = params[name];
+ } else if (!helpers.isUnd(this.params[name])) {
+ tlParams[name] = this.params[name];
+ }
+ }
+ }
+ tlParams.onComplete = () => {
+ // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(node => {
+ restoreNodeVisualState(node);
+ restoreNodeInlineStyles(node);
+ });
+ for (let i = 0, l = transformed.length; i < l; i++) {
+ const $el = transformed[i];
+ $el.style.transform = newState.getComputedValue($el, 'transform');
+ }
+ if (this.root.classList.contains('is-animated')) {
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ }
+ // Avoid CSS transitions at the end of the animation by restoring them on the next frame
+ requestAnimationFrame(() => {
+ if (this.root.classList.contains('is-animated')) return;
+ restoreLayoutTransition(this.transitionMuteStore);
+ });
+ };
+ tlParams.onPause = () => {
+ if (!this.root.classList.contains('is-animated')) return;
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(restoreNodeVisualState);
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ if (onPause) onPause(this.timeline);
+ };
+ tlParams.composition = false;
+
+ const swapAtParams = helpers.mergeObjects(helpers.mergeObjects(params.swapAt || {}, this.swapAtParams), animationTimings);
+ const enterFromParams = helpers.mergeObjects(helpers.mergeObjects(params.enterFrom || {}, this.enterFromParams), animationTimings);
+ const leaveToParams = helpers.mergeObjects(helpers.mergeObjects(params.leaveTo || {}, this.leaveToParams), animationTimings);
+ const [ swapAtProps, swapAtTimings ] = splitPropertiesFromParams(swapAtParams);
+ const [ enterFromProps, enterFromTimings ] = splitPropertiesFromParams(enterFromParams);
+ const [ leaveToProps, leaveToTimings ] = splitPropertiesFromParams(leaveToParams);
+
const oldState = this.oldState;
const newState = this.newState;
- const added = this.added;
- const removed = this.removed;
- const frozen = this.frozen;
- const pendingRemoved = this.pendingRemoved;
+ const animating = this.animating;
+ const swapping = this.swapping;
+ const entering = this.entering;
+ const leaving = this.leaving;
+ const pendingRemoval = this.pendingRemoval;
- added.length = removed.length = frozen.length = 0;
+ animating.length = swapping.length = entering.length = leaving.length = 0;
// Mute old state CSS transitions to prevent wrong properties calculation
oldState.forEachRootNode(muteNodeTransition);
@@ -992,10 +1139,12 @@ class AutoLayout {
const targets = [];
const animated = [];
const transformed = [];
- const animatedFrozen = [];
- const root = newState.rootNode.$el;
+ const animatedSwap = [];
+ const rootNode = newState.rootNode;
+ const $root = rootNode.$el;
newState.forEachRootNode(node => {
+
const $el = node.$el;
const id = node.id;
const parent = node.parentNode;
@@ -1003,10 +1152,6 @@ class AutoLayout {
const parentRemoved = parent ? parent.branchRemoved : false;
const parentNotRendered = parent ? parent.branchNotRendered : false;
- // Delay and duration must be calculated in the animate() call to support delay override
- node.delay = +(helpers.isFnc(delay) ? delay($el, node.index, node.total) : delay);
- node.duration = +(helpers.isFnc(duration) ? duration($el, node.index, node.total) : duration);
-
let oldStateNode = oldState.nodes.get(id);
const hasNoOldState = !oldStateNode;
@@ -1056,7 +1201,7 @@ class AutoLayout {
}
}
- const wasPendingRemoval = pendingRemoved.has($el);
+ const wasPendingRemoval = pendingRemoval.has($el);
const wasVisibleBefore = oldStateNode.measuredIsVisible;
const isVisibleNow = node.measuredIsVisible;
const becomeVisible = !wasVisibleBefore && isVisibleNow && !parentNotRendered;
@@ -1064,113 +1209,156 @@ class AutoLayout {
const newlyRemoved = isRemovedNow && !wasRemovedBefore && !parentRemoved;
const topLevelRemoved = newlyRemoved || isRemovedNow && wasPendingRemoval && !parentRemoved;
- if (node.measuredIsRemoved && wasVisibleBefore) {
+ node.branchAdded = parentAdded || topLevelAdded;
+ node.branchRemoved = parentRemoved || topLevelRemoved;
+ node.branchNotRendered = parentNotRendered || isRemovedNow;
+
+ if (isRemovedNow && wasVisibleBefore) {
node.$el.style.display = oldStateNode.measuredDisplay;
node.$el.style.visibility = 'visible';
cloneNodeProperties(oldStateNode, node, newState);
}
+ // Node is leaving
if (newlyRemoved) {
- removed.push($el);
- pendingRemoved.add($el);
+ if (node.isTarget) {
+ leaving.push($el);
+ node.isLeaving = true;
+ }
+ pendingRemoval.add($el);
} else if (!isRemovedNow && wasPendingRemoval) {
- pendingRemoved.delete($el);
+ pendingRemoval.delete($el);
}
- // Node is added
+ // Node is entering
if ((topLevelAdded && !parentNotRendered) || becomeVisible) {
- updateNodeProperties(oldStateNode, addedParams);
- added.push($el);
- // Node is removed
+ updateNodeProperties(oldStateNode, enterFromProps);
+ if (node.isTarget) {
+ entering.push($el);
+ node.isEntering = true;
+ }
+ // Node is leaving
} else if (topLevelRemoved && !parentNotRendered) {
- updateNodeProperties(node, removedParams);
+ updateNodeProperties(node, leaveToProps);
}
- // Compute function based propety values before cheking for changes
- for (let name in node.properties) {
- node.properties[name] = newState.getValue(node.$el, name);
- // NOTE: I'm using node.$el to get the value of old state, make sure this is valid instead of oldStateNode.$el
- oldStateNode.properties[name] = oldState.getValue(node.$el, name);
+ // Node is animating
+ // The animating array is used only to calculate delays and duration on root children
+ if (node !== rootNode && node.isTarget && !node.isEntering && !node.isLeaving) {
+ animating.push($el);
}
- const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
- let propertyChanged = false;
+ targets.push($el);
+ });
- if (node.isTarget && (!node.measuredIsRemoved && wasVisibleBefore || node.measuredIsRemoved && isVisibleNow)) {
- if (!node.isInlined && (node.properties.transform !== 'none' || oldStateNode.properties.transform !== 'none')) {
- node.hasTransform = true;
- propertyChanged = true;
- transformed.push($el);
- }
- for (let name in node.properties) {
- if (name !== 'transform' && (node.properties[name] !== oldStateNode.properties[name] || hiddenStateChanged)) {
- propertyChanged = true;
- animated.push($el);
- break;
- }
- }
+ let enteringIndex = 0;
+ let leavingIndex = 0;
+ let animatingIndex = 0;
+
+ newState.forEachRootNode(node => {
+
+ const $el = node.$el;
+ const parent = node.parentNode;
+ const oldStateNode = oldState.nodes.get(node.id);
+ const nodeProperties = node.properties;
+ const oldStateNodeProperties = oldStateNode.properties;
+
+ // Use closest animated parent index and total values so that children staggered delays are in sync with their parent
+ let animatedParent = parent !== rootNode && parent;
+ while (animatedParent && !animatedParent.isTarget && animatedParent !== rootNode) {
+ animatedParent = animatedParent.parentNode;
}
- const nodeHasChanged = (propertyChanged || topLevelAdded || topLevelRemoved || becomeVisible);
- const nodeIsAnimated = node.isTarget && nodeHasChanged;
+ const animatingTotal = animating.length;
+
+ // Root is always animated first in sync with the first child (animating.length is the total of children)
+ if (node === rootNode) {
+ node.index = 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else if (node.isEntering) {
+ node.index = animatedParent ? animatedParent.index : enteringIndex;
+ node.total = animatedParent ? animatingTotal : entering.length;
+ updateNodeTimingParams(node, enterFromTimings);
+ enteringIndex++;
+ } else if (node.isLeaving) {
+ node.index = animatedParent ? animatedParent.index : leavingIndex;
+ node.total = animatedParent ? animatingTotal : leaving.length;
+ leavingIndex++;
+ updateNodeTimingParams(node, leaveToTimings);
+ } else if (node.isTarget) {
+ node.index = animatingIndex++;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else {
+ node.index = animatedParent ? animatedParent.index : 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, swapAtTimings);
+ }
- node.isAnimated = nodeIsAnimated;
- node.branchAdded = parentAdded || topLevelAdded;
- node.branchRemoved = parentRemoved || topLevelRemoved;
- node.branchNotRendered = parentNotRendered || node.measuredIsRemoved;
+ // Make sure the old state node has its inex and total values up to date for valid "from" function values calculation
+ oldStateNode.index = node.index;
+ oldStateNode.total = node.total;
+ // Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation props
+ for (let prop in nodeProperties) {
+ nodeProperties[prop] = values.getFunctionValue(nodeProperties[prop], $el, node.index, node.total);
+ oldStateNodeProperties[prop] = values.getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);
+ }
+
+ // Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements
const sizeTolerance = 1;
- const widthChanged = Math.abs(node.properties.width - oldStateNode.properties.width) > sizeTolerance;
- const heightChanged = Math.abs(node.properties.height - oldStateNode.properties.height) > sizeTolerance;
+ const widthChanged = Math.abs(nodeProperties.width - oldStateNodeProperties.width) > sizeTolerance;
+ const heightChanged = Math.abs(nodeProperties.height - oldStateNodeProperties.height) > sizeTolerance;
node.sizeChanged = (widthChanged || heightChanged);
- targets.push($el);
+ // const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
+
+ if (node.isTarget && (!node.measuredIsRemoved && oldStateNode.measuredIsVisible || node.measuredIsRemoved && node.measuredIsVisible)) {
+ if (!node.isInlined && (nodeProperties.transform !== 'none' || oldStateNodeProperties.transform !== 'none')) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ for (let prop in nodeProperties) {
+ // if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop] || hiddenStateChanged)) {
+ if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop])) {
+ animated.push($el);
+ break;
+ }
+ }
+ }
if (!node.isTarget) {
- frozen.push($el);
- if ((nodeHasChanged || node.sizeChanged) && parent && parent.isTarget && parent.isAnimated && parent.sizeChanged) {
- animatedFrozen.push($el);
+ swapping.push($el);
+ if (node.sizeChanged && parent && parent.isTarget && parent.sizeChanged) {
+ if (!node.isInlined && swapAtProps.transform) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ animatedSwap.push($el);
}
}
+
});
- const defaults = {
- ease: values.setValue(params.ease, this.ease),
- duration: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).duration,
- delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
+ const timingParams = {
+ delay: (/** @type {HTMLElement} */$el) => newState.getNode($el).delay,
+ duration: (/** @type {HTMLElement} */$el) => newState.getNode($el).duration,
+ ease: (/** @type {HTMLElement} */$el) => newState.getNode($el).ease,
};
- this.timeline = timeline.createTimeline({
- onComplete: () => {
- // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(node => {
- restoreNodeVisualState(node);
- restoreNodeInlineStyles(node);
- });
- for (let i = 0, l = transformed.length; i < l; i++) {
- const $el = transformed[i];
- $el.style.transform = newState.getValue($el, 'transform');
- }
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- // Avoid CSS transitions at the end of the animation by restoring them on the next frame
- requestAnimationFrame(() => {
- if (this.root.classList.contains('is-animated')) return;
- restoreLayoutTransition(this.transitionMuteStore);
- });
- },
- onPause: () => {
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(restoreNodeVisualState);
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- },
- composition: false,
- defaults,
- });
+ tlParams.defaults = timingParams;
+
+ this.timeline = timeline.createTimeline(tlParams);
+
+ // Imediatly return the timeline if no layout changes detected
+ if (!animated.length && !transformed.length && !swapping.length) {
+ // Make sure to restore all CSS transition if no animation
+ restoreLayoutTransition(this.transitionMuteStore);
+ return this.timeline.complete();
+ }
if (targets.length) {
@@ -1183,15 +1371,14 @@ class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
- // Make sure to mute all CSS transition before applying the oldState styles back
- muteNodeTransition(newNode);
+ // muteNodeTransition(newNode);
// Don't animate dimensions and positions of inlined elements
if (!newNode.isInlined) {
// Display grid can mess with the absolute positioning, so set it to block during transition
- if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.display = 'block';
- // All children must be in position absolue
- if ($el !== root || this.absoluteCoords) {
+ if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.setProperty('display', 'block', 'important');
+ // All children must be in position absolute or fixed
+ if ($el !== $root || this.absoluteCoords) {
$el.style.position = this.absoluteCoords ? 'fixed' : 'absolute';
$el.style.left = '0px';
$el.style.top = '0px';
@@ -1199,7 +1386,7 @@ class AutoLayout {
$el.style.marginTop = '0px';
$el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
}
- if ($el === root && newNode.measuredPosition === 'static') {
+ if ($el === $root && newNode.measuredPosition === 'static') {
$el.style.position = 'relative';
// Cancel left / trop in case the static element had muted values now activated by potision relative
$el.style.left = '0px';
@@ -1218,9 +1405,7 @@ class AutoLayout {
// Restore the scroll position if the oldState differs from the current state
if (oldState.scrollX !== window.scrollX || oldState.scrollY !== window.scrollY) {
// Restoring in the next frame avoids race conditions if for example a waapi animation commit styles that affect the root height
- requestAnimationFrame(() => {
- window.scrollTo(oldState.scrollX, oldState.scrollY);
- });
+ requestAnimationFrame(() => window.scrollTo(oldState.scrollX, oldState.scrollY));
}
for (let i = 0, l = animated.length; i < l; i++) {
@@ -1230,25 +1415,25 @@ class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
const newNodeState = newNode.properties;
- let hasChanged = false;
+ let nodeHasChanged = false;
+ /** @type {AnimationParams} */
const animatedProps = {
composition: 'none',
- // delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
};
if (!newNode.isInlined) {
if (oldNodeState.width !== newNodeState.width) {
animatedProps.width = [oldNodeState.width, newNodeState.width];
- hasChanged = true;
+ nodeHasChanged = true;
}
if (oldNodeState.height !== newNodeState.height) {
animatedProps.height = [oldNodeState.height, newNodeState.height];
- hasChanged = true;
+ nodeHasChanged = true;
}
// If the node has transforms we handle the translate animation in wappi otherwise translate and other transforms can be out of sync
// Always animate translate
if (!newNode.hasTransform) {
animatedProps.translate = [`${oldNodeState.x}px ${oldNodeState.y}px`, `${newNodeState.x}px ${newNodeState.y}px`];
- hasChanged = true;
+ nodeHasChanged = true;
}
}
this.properties.forEach(prop => {
@@ -1256,73 +1441,77 @@ class AutoLayout {
const newVal = newNodeState[prop];
if (prop !== 'transform' && oldVal !== newVal) {
animatedProps[prop] = [oldVal, newVal];
- hasChanged = true;
+ nodeHasChanged = true;
}
});
- if (hasChanged) {
+ if (nodeHasChanged) {
this.timeline.add($el, animatedProps, 0);
}
}
}
- if (frozen.length) {
+ if (swapping.length) {
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const oldNode = oldState.nodes.get($el.dataset.layoutId);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const oldNode = oldState.getNode($el);
if (!oldNode.isInlined) {
- const oldNodeState = oldState.get($el);
- $el.style.width = `${oldNodeState.width}px`;
- $el.style.height = `${oldNodeState.height}px`;
+ const oldNodeProps = oldNode.properties;
+ $el.style.width = `${oldNodeProps.width}px`;
+ $el.style.height = `${oldNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
+ $el.style.translate = `${oldNodeProps.x}px ${oldNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${oldState.getValue($el, prop)}`;
+ $el.style[prop] = `${oldState.getComputedValue($el, prop)}`;
}
});
}
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const newNode = newState.nodes.get($el.dataset.layoutId);
- const newNodeState = newState.get($el);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const newNode = newState.getNode($el);
+ const newNodeProps = newNode.properties;
this.timeline.call(() => {
if (!newNode.isInlined) {
- $el.style.width = `${newNodeState.width}px`;
- $el.style.height = `${newNodeState.height}px`;
+ $el.style.width = `${newNodeProps.width}px`;
+ $el.style.height = `${newNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${newNodeState.x}px ${newNodeState.y}px`;
+ $el.style.translate = `${newNodeProps.x}px ${newNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${newState.getValue($el, prop)}`;
+ $el.style[prop] = `${newState.getComputedValue($el, prop)}`;
}
});
}, newNode.delay + newNode.duration / 2);
}
- if (animatedFrozen.length) {
- const animatedFrozenParams = /** @type {AnimationParams} */({});
- if (frozenParams) {
- for (let prop in frozenParams) {
- animatedFrozenParams[prop] = [
- { from: (/** @type {HTMLElement} */$el) => oldState.getValue($el, prop), ease: 'in(1.75)', to: frozenParams[prop] },
- { from: frozenParams[prop], to: (/** @type {HTMLElement} */$el) => newState.getValue($el, prop), ease: 'out(1.75)' }
- ];
+ if (animatedSwap.length) {
+ const ease = parser.parseEase(newState.nodes.get(animatedSwap[0].dataset.layoutId).ease);
+ const inverseEased = t => 1 - ease(1 - t);
+ const animatedSwapParams = /** @type {AnimationParams} */({});
+ if (swapAtProps) {
+ for (let prop in swapAtProps) {
+ if (prop !== 'transform') {
+ animatedSwapParams[prop] = [
+ { from: (/** @type {HTMLElement} */$el) => oldState.getComputedValue($el, prop), to: swapAtProps[prop] },
+ { from: swapAtProps[prop], to: (/** @type {HTMLElement} */$el) => newState.getComputedValue($el, prop), ease: inverseEased }
+ ];
+ }
}
}
- this.timeline.add(animatedFrozen, animatedFrozenParams, 0);
+ this.timeline.add(animatedSwap, animatedSwapParams, 0);
}
}
@@ -1330,18 +1519,29 @@ class AutoLayout {
const transformedLength = transformed.length;
if (transformedLength) {
- // We only need to set the transform property here since translate is alread defined the targets loop
+ // We only need to set the transform property here since translate is alread defined in the targets loop
for (let i = 0; i < transformedLength; i++) {
const $el = transformed[i];
- $el.style.translate = `${oldState.get($el).x}px ${oldState.get($el).y}px`,
- $el.style.transform = oldState.getValue($el, 'transform');
+ $el.style.translate = `${oldState.getComputedValue($el, 'x')}px ${oldState.getComputedValue($el, 'y')}px`,
+ $el.style.transform = oldState.getComputedValue($el, 'transform');
+ if (animatedSwap.includes($el)) {
+ const node = newState.getNode($el);
+ node.ease = values.getFunctionValue(swapAtParams.ease, $el, node.index, node.total);
+ node.duration = values.getFunctionValue(swapAtParams.duration, $el, node.index, node.total);
+ }
}
this.transformAnimation = waapi.waapi.animate(transformed, {
- translate: (/** @type {HTMLElement} */$el) => `${newState.get($el).x}px ${newState.get($el).y}px`,
- transform: (/** @type {HTMLElement} */$el) => newState.getValue($el, 'transform'),
+ translate: (/** @type {HTMLElement} */$el) => `${newState.getComputedValue($el, 'x')}px ${newState.getComputedValue($el, 'y')}px`,
+ transform: (/** @type {HTMLElement} */$el) => {
+ const newValue = newState.getComputedValue($el, 'transform');
+ if (!animatedSwap.includes($el)) return newValue;
+ const oldValue = oldState.getComputedValue($el, 'transform');
+ const node = newState.getNode($el);
+ return [oldValue, values.getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]
+ },
autoplay: false,
persist: true,
- ...defaults,
+ ...timingParams,
});
this.timeline.sync(this.transformAnimation, 0);
}
@@ -1352,13 +1552,12 @@ class AutoLayout {
/**
* @param {(layout: this) => void} callback
* @param {LayoutAnimationParams} [params]
- * @return {this}
+ * @return {Timeline}
*/
update(callback, params = {}) {
this.record();
callback(this);
- this.animate(params);
- return this;
+ return this.animate(params);
}
}
diff --git a/dist/modules/layout/layout.d.ts b/dist/modules/layout/layout.d.ts
index cbb7c05d..7ced17bd 100644
--- a/dist/modules/layout/layout.d.ts
+++ b/dist/modules/layout/layout.d.ts
@@ -14,42 +14,36 @@ export class AutoLayout {
children: LayoutChildrenParam;
/** @type {Boolean} */
absoluteCoords: boolean;
- /** @type {Number|FunctionValue} */
- duration: number | FunctionValue;
- /** @type {Number|FunctionValue} */
- delay: number | FunctionValue;
- /** @type {EasingParam} */
- ease: EasingParam;
- /** @type {Callback<this>} */
- onComplete: Callback<this>;
/** @type {LayoutStateParams} */
- frozenParams: LayoutStateParams;
+ swapAtParams: LayoutStateParams;
/** @type {LayoutStateParams} */
- addedParams: LayoutStateParams;
+ enterFromParams: LayoutStateParams;
/** @type {LayoutStateParams} */
- removedParams: LayoutStateParams;
+ leaveToParams: LayoutStateParams;
/** @type {Set<String>} */
properties: Set<string>;
/** @type {Set<String>} */
recordedProperties: Set<string>;
/** @type {WeakSet<DOMTarget>} */
- pendingRemoved: WeakSet<DOMTarget>;
+ pendingRemoval: WeakSet<DOMTarget>;
/** @type {Map<DOMTarget, String|null>} */
transitionMuteStore: Map<DOMTarget, string | null>;
/** @type {LayoutSnapshot} */
oldState: LayoutSnapshot;
/** @type {LayoutSnapshot} */
newState: LayoutSnapshot;
- /** @type {Timeline|null} */
- timeline: Timeline | null;
- /** @type {WAAPIAnimation|null} */
- transformAnimation: WAAPIAnimation | null;
+ /** @type {Timeline} */
+ timeline: Timeline;
+ /** @type {WAAPIAnimation} */
+ transformAnimation: WAAPIAnimation;
+ /** @type {Array<DOMTarget>} */
+ animating: Array<DOMTarget>;
/** @type {Array<DOMTarget>} */
- frozen: Array<DOMTarget>;
+ swapping: Array<DOMTarget>;
/** @type {Array<DOMTarget>} */
- removed: Array<DOMTarget>;
+ leaving: Array<DOMTarget>;
/** @type {Array<DOMTarget>} */
- added: Array<DOMTarget>;
+ entering: Array<DOMTarget>;
/**
* @return {this}
*/
@@ -66,27 +60,35 @@ export class AutoLayout {
/**
* @param {(layout: this) => void} callback
* @param {LayoutAnimationParams} [params]
- * @return {this}
+ * @return {Timeline}
*/
- update(callback: (layout: this) => void, params?: LayoutAnimationParams): this;
+ update(callback: (layout: this) => void, params?: LayoutAnimationParams): Timeline;
}
export function createLayout(root: DOMTargetSelector, params?: AutoLayoutParams): AutoLayout;
export type LayoutChildrenParam = DOMTargetSelector | Array<DOMTargetSelector>;
-export type LayoutStateParams = Record<string, number | string>;
-export type LayoutAnimationParams = {
+export type LayoutAnimationTimingsParams = {
+ delay?: number | FunctionValue;
+ duration?: number | FunctionValue;
+ ease?: EasingParam | FunctionValue;
+};
+export type LayoutStateAnimationProperties = Record<string, number | string | FunctionValue>;
+export type LayoutStateParams = LayoutStateAnimationProperties & LayoutAnimationTimingsParams;
+export type LayoutSpecificAnimationParams = {
delay?: number | FunctionValue;
duration?: number | FunctionValue;
- ease?: EasingParam;
- frozen?: LayoutStateParams;
- added?: LayoutStateParams;
- removed?: LayoutStateParams;
- onComplete?: Callback<AutoLayout>;
+ ease?: EasingParam | FunctionValue;
+ playbackEase?: EasingParam;
+ swapAt?: LayoutStateParams;
+ enterFrom?: LayoutStateParams;
+ leaveTo?: LayoutStateParams;
};
-export type AutoLayoutParams = LayoutAnimationParams & {
+export type LayoutAnimationParams = LayoutSpecificAnimationParams & TimerParams & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>;
+export type LayoutOptions = {
children?: LayoutChildrenParam;
properties?: Array<string>;
};
-export type LayoutNodeProperties = Record<string, number | string> & {
+export type AutoLayoutParams = LayoutAnimationParams & LayoutOptions;
+export type LayoutNodeProperties = Record<string, number | string | FunctionValue> & {
transform: string;
x: number;
y: number;
@@ -104,13 +106,15 @@ export type LayoutNode = {
total: number;
delay: number;
duration: number;
+ ease: EasingParam;
$measure: DOMTarget;
state: LayoutSnapshot;
layout: AutoLayout;
parentNode: LayoutNode | null;
isTarget: boolean;
+ isEntering: boolean;
+ isLeaving: boolean;
hasTransform: boolean;
- isAnimated: boolean;
inlineStyles: Array<string>;
inlineTransforms: string | null;
inlineTransition: string | null;
@@ -140,9 +144,6 @@ export type LayoutNode = {
};
export type LayoutNodeIterator = (node: LayoutNode, index: number) => void;
import type { DOMTarget } from '../types/index.js';
-import type { FunctionValue } from '../types/index.js';
-import type { EasingParam } from '../types/index.js';
-import type { Callback } from '../types/index.js';
declare class LayoutSnapshot {
/**
* @param {AutoLayout} layout
@@ -166,15 +167,15 @@ declare class LayoutSnapshot {
revert(): this;
/**
* @param {DOMTarget} $el
- * @return {LayoutNodeProperties|undefined}
+ * @return {LayoutNode}
*/
- get($el: DOMTarget): LayoutNodeProperties | undefined;
+ getNode($el: DOMTarget): LayoutNode;
/**
* @param {DOMTarget} $el
* @param {String} prop
- * @return {Number|String|undefined}
+ * @return {Number|String}
*/
- getValue($el: DOMTarget, prop: string): number | string | undefined;
+ getComputedValue($el: DOMTarget, prop: string): number | string;
/**
* @param {LayoutNode|null} rootNode
* @param {LayoutNodeIterator} cb
@@ -208,4 +209,9 @@ declare class LayoutSnapshot {
import type { Timeline } from '../timeline/timeline.js';
import type { WAAPIAnimation } from '../waapi/waapi.js';
import type { DOMTargetSelector } from '../types/index.js';
+import type { FunctionValue } from '../types/index.js';
+import type { EasingParam } from '../types/index.js';
+import type { TimerParams } from '../types/index.js';
+import type { TickableCallbacks } from '../types/index.js';
+import type { RenderableCallbacks } from '../types/index.js';
export {};
diff --git a/dist/modules/layout/layout.js b/dist/modules/layout/layout.js
index 4b63c61f..ee2db4c4 100644
--- a/dist/modules/layout/layout.js
+++ b/dist/modules/layout/layout.js
@@ -1,21 +1,25 @@
/**
* Anime.js - layout - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
-import { mergeObjects, isFnc, isUnd, isSvg, isStr, isArr } from '../core/helpers.js';
+import { mergeObjects, isUnd, isSvg, isStr, isFnc, isArr } from '../core/helpers.js';
import { registerTargets } from '../core/targets.js';
+import { parseEase } from '../easings/eases/parser.js';
import { setValue, getFunctionValue } from '../core/values.js';
-import { noop } from '../core/consts.js';
import { createTimeline } from '../timeline/timeline.js';
import { waapi } from '../waapi/waapi.js';
-import { scope } from '../core/globals.js';
+import { scope, defaults } from '../core/globals.js';
/**
* @import {
* AnimationParams,
+ * RenderableCallbacks,
+ * TickableCallbacks,
+ * TimelineParams,
+ * TimerParams,
* } from '../types/index.js'
*/
@@ -31,13 +35,18 @@ import { scope } from '../core/globals.js';
* } from '../waapi/waapi.js'
*/
+/**
+ * @import {
+ * Spring,
+ } from '../easings/spring/index.js'
+*/
+
/**
* @import {
* DOMTarget,
* DOMTargetSelector,
* FunctionValue,
* EasingParam,
- * Callback,
} from '../types/index.js'
*/
@@ -46,29 +55,47 @@ import { scope } from '../core/globals.js';
*/
/**
- * @typedef {Record<String, Number|String>} LayoutStateParams
+ * @typedef {Object} LayoutAnimationTimingsParams
+ * @property {Number|FunctionValue} [delay]
+ * @property {Number|FunctionValue} [duration]
+ * @property {EasingParam|FunctionValue} [ease]
+ */
+
+/**
+ * @typedef {Record<String, Number|String|FunctionValue>} LayoutStateAnimationProperties
*/
/**
- * @typedef {Object} LayoutAnimationParams
+ * @typedef {LayoutStateAnimationProperties & LayoutAnimationTimingsParams} LayoutStateParams
+ */
+
+/**
+ * @typedef {Object} LayoutSpecificAnimationParams
* @property {Number|FunctionValue} [delay]
* @property {Number|FunctionValue} [duration]
- * @property {EasingParam} [ease]
- * @property {LayoutStateParams} [frozen]
- * @property {LayoutStateParams} [added]
- * @property {LayoutStateParams} [removed]
- * @property {Callback<AutoLayout>} [onComplete]
+ * @property {EasingParam|FunctionValue} [ease]
+ * @property {EasingParam} [playbackEase]
+ * @property {LayoutStateParams} [swapAt]
+ * @property {LayoutStateParams} [enterFrom]
+ * @property {LayoutStateParams} [leaveTo]
+ */
+
+/**
+ * @typedef {LayoutSpecificAnimationParams & TimerParams & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} LayoutAnimationParams
*/
/**
- * @typedef {LayoutAnimationParams & {
- * children?: LayoutChildrenParam,
- * properties?: Array<String>,
- * }} AutoLayoutParams
+ * @typedef {Object} LayoutOptions
+ * @property {LayoutChildrenParam} [children]
+ * @property {Array<String>} [properties]
*/
/**
- * @typedef {Record<String, Number|String> & {
+ * @typedef {LayoutAnimationParams & LayoutOptions} AutoLayoutParams
+ */
+
+/**
+ * @typedef {Record<String, Number|String|FunctionValue> & {
* transform: String,
* x: Number,
* y: Number,
@@ -89,13 +116,15 @@ import { scope } from '../core/globals.js';
* @property {Number} total
* @property {Number} delay
* @property {Number} duration
+ * @property {EasingParam} ease
* @property {DOMTarget} $measure
* @property {LayoutSnapshot} state
* @property {AutoLayout} layout
* @property {LayoutNode|null} parentNode
* @property {Boolean} isTarget
+ * @property {Boolean} isEntering
+ * @property {Boolean} isLeaving
* @property {Boolean} hasTransform
- * @property {Boolean} isAnimated
* @property {Array<String>} inlineStyles
* @property {String|null} inlineTransforms
* @property {String|null} inlineTransition
@@ -236,7 +265,7 @@ const detachNode = node => {
* @param {DOMTarget} $el
* @param {LayoutNode|null} parentNode
* @param {LayoutSnapshot} state
- * @param {LayoutNode} [recycledNode]
+ * @param {LayoutNode} recycledNode
* @return {LayoutNode}
*/
const createNode = ($el, parentNode, state, recycledNode) => {
@@ -250,12 +279,15 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.total = 1;
node.delay = 0;
node.duration = 0;
+ node.ease = null;
node.state = state;
node.layout = state.layout;
node.parentNode = parentNode || null;
node.isTarget = false;
+ node.isEntering = false;
+ node.isLeaving = false;
+ node.isInlined = false;
node.hasTransform = false;
- node.isAnimated = false;
node.inlineStyles = [];
node.inlineTransforms = null;
node.inlineTransition = null;
@@ -263,7 +295,6 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.branchRemoved = false;
node.branchNotRendered = false;
node.sizeChanged = false;
- node.isInlined = false;
node.hasVisibilitySwap = false;
node.hasDisplayNone = false;
node.hasVisibilityHidden = false;
@@ -406,7 +437,7 @@ const recordNodeState = (node, $measure, computedStyle, skipMeasurements) => {
/**
* @param {LayoutNode} node
- * @param {LayoutStateParams} [props]
+ * @param {LayoutStateAnimationProperties} [props]
*/
const updateNodeProperties = (node, props) => {
if (!props) return;
@@ -415,6 +446,19 @@ const updateNodeProperties = (node, props) => {
}
};
+/**
+ * @param {LayoutNode} node
+ * @param {LayoutAnimationTimingsParams} params
+ */
+const updateNodeTimingParams = (node, params) => {
+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);
+ const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;
+ const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
+ node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);
+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);
+};
+
/**
* @param {LayoutNode} node
*/
@@ -489,9 +533,9 @@ const restoreNodeVisualState = node => {
node.$measure.style.removeProperty('visibility');
}
}
- if (node.measuredIsRemoved) {
- node.layout.pendingRemoved.delete(node.$el);
- }
+ // if (node.measuredIsRemoved) {
+ node.layout.pendingRemoval.delete(node.$el);
+ // }
};
/**
@@ -541,6 +585,7 @@ class LayoutSnapshot {
*/
revert() {
this.forEachNode(node => {
+ this.layout.pendingRemoval.delete(node.$el);
node.$el.removeAttribute('data-layout-id');
node.$measure.removeAttribute('data-layout-id');
});
@@ -552,34 +597,22 @@ class LayoutSnapshot {
/**
* @param {DOMTarget} $el
- * @return {LayoutNodeProperties|undefined}
+ * @return {LayoutNode}
*/
- get($el) {
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- return node.properties;
+ getNode($el) {
+ if (!$el || !$el.dataset) return;
+ return this.nodes.get($el.dataset.layoutId);
}
/**
* @param {DOMTarget} $el
* @param {String} prop
- * @return {Number|String|undefined}
+ * @return {Number|String}
*/
- getValue($el, prop) {
- if (!$el || !$el.dataset) {
- console.warn(`No element found on state (${$el})`);
- return;
- }
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- const value = node.properties[prop];
- if (!isUnd(value)) return getFunctionValue(value, $el, node.index, node.total);
+ getComputedValue($el, prop) {
+ const node = this.getNode($el);
+ if (!node) return;
+ return /** @type {Number|String} */(node.properties[prop]);
}
/**
@@ -640,10 +673,10 @@ class LayoutSnapshot {
const $parent = /** @type {LayoutNode|null} */(stack.pop());
/** @type {DOMTarget|null} */
const $current = /** @type {DOMTarget|null} */(stack.pop());
+
if (!$current || $current.nodeType !== 1 || isSvg($current)) continue;
const skipMeasurements = $parent ? $parent.measuredIsRemoved : false;
-
const computedStyle = skipMeasurements ? hiddenComputedStyle : getComputedStyle($current);
const hasDisplayNone = skipMeasurements ? true : computedStyle.display === 'none';
const hasVisibilityHidden = skipMeasurements ? true : computedStyle.visibility === 'hidden';
@@ -690,11 +723,10 @@ class LayoutSnapshot {
node.branchRemoved = false;
node.branchNotRendered = false;
node.isTarget = false;
- node.isAnimated = false;
+ node.sizeChanged = false;
node.hasVisibilityHidden = hasVisibilityHidden;
node.hasDisplayNone = hasDisplayNone;
node.hasVisibilitySwap = (hasVisibilityHidden && !node.measuredHasVisibilityHidden) || (hasDisplayNone && !node.measuredHasDisplayNone);
- // node.hasVisibilitySwap = (hasVisibilityHidden !== node.measuredHasVisibilityHidden) || (hasDisplayNone !== node.measuredHasDisplayNone);
this.nodes.set(node.id, node);
@@ -713,6 +745,7 @@ class LayoutSnapshot {
$parent._tail = node;
}
} else {
+ // Each disconnected subtree becomes its own root in the snapshot graph
this.rootNodes.add(node);
}
@@ -756,11 +789,29 @@ class LayoutSnapshot {
* @return {this}
*/
record() {
- const { children, root } = this.layout;
+ const layout = this.layout;
+ const children = layout.children;
+ const root = layout.root;
const toParse = isArr(children) ? children : [children];
const scoped = [];
const scopeRoot = children === '*' ? root : scope.root;
+ // Mute transition and transforms of root ancestors before recording the state
+
+ /** @type {Array<DOMTarget|String|null>} */
+ const rootAncestorTransformStore = [];
+ let $ancestor = root.parentElement;
+ while ($ancestor && $ancestor.nodeType === 1) {
+ const computedStyle = getComputedStyle($ancestor);
+ if (computedStyle.transform && computedStyle.transform !== 'none') {
+ const inlineTransform = $ancestor.style.transform || '';
+ const inlineTransition = muteElementTransition($ancestor);
+ rootAncestorTransformStore.push($ancestor, inlineTransform, inlineTransition);
+ $ancestor.style.transform = 'none';
+ }
+ $ancestor = $ancestor.parentElement;
+ }
+
for (let i = 0, l = toParse.length; i < l; i++) {
const child = toParse[i];
scoped[i] = isStr(child) ? scopeRoot.querySelectorAll(child) : child;
@@ -776,9 +827,13 @@ class LayoutSnapshot {
rootNode.isTarget = true;
this.rootNode = rootNode;
- // Track ids of nodes that belong to the current root to filter detached matches
const inRootNodeIds = new Set();
+ // Update index and total for inital timing calculation
+ let index = 0, total = this.nodes.size;
this.nodes.forEach((node, id) => {
+ node.index = index++;
+ node.total = total;
+ // Track ids of nodes that belong to the current root to filter detached matches
if (node && node.measuredIsInsideRoot) {
inRootNodeIds.add(id);
}
@@ -808,7 +863,7 @@ class LayoutSnapshot {
for (let i = 0, l = parsedChildren.length; i < l; i++) {
const $el = parsedChildren[i];
- const node = this.nodes.get($el.dataset.layoutId);
+ const node = this.getNode($el);
if (node) {
let cur = node;
while (cur) {
@@ -822,18 +877,52 @@ class LayoutSnapshot {
this.scrollX = window.scrollX;
this.scrollY = window.scrollY;
- const total = this.nodes.size;
-
this.forEachNode(restoreNodeTransform);
- this.forEachNode((node, i) => {
- node.index = i;
- node.total = total;
- });
+
+ // Restore transition and transforms of root ancestors
+
+ for (let i = 0, l = rootAncestorTransformStore.length; i < l; i += 3) {
+ const $el = /** @type {DOMTarget} */(rootAncestorTransformStore[i]);
+ const inlineTransform = /** @type {String} */(rootAncestorTransformStore[i + 1]);
+ const inlineTransition = /** @type {String|null} */(rootAncestorTransformStore[i + 2]);
+ if (inlineTransform && inlineTransform !== '') {
+ $el.style.transform = inlineTransform;
+ } else {
+ $el.style.removeProperty('transform');
+ }
+ restoreElementTransition($el, inlineTransition);
+ }
return this;
}
}
+/**
+ * @param {LayoutStateParams} params
+ * @return {[LayoutStateAnimationProperties, LayoutAnimationTimingsParams]}
+ */
+function splitPropertiesFromParams(params) {
+ /** @type {LayoutStateAnimationProperties} */
+ const properties = {};
+ /** @type {LayoutAnimationTimingsParams} */
+ const parameters = {};
+ for (let name in params) {
+ const value = params[name];
+ const isEase = name === 'ease';
+ const isTiming = name === 'duration' || name === 'delay';
+ if (isTiming || isEase) {
+ if (isEase) {
+ parameters[name] = /** @type {EasingParam} */(value);
+ } else {
+ parameters[name] = /** @type {Number|FunctionValue} */(value);
+ }
+ } else {
+ properties[name] = /** @type {Number|String} */(value);
+ }
+ }
+ return [properties, parameters];
+}
+
class AutoLayout {
/**
* @param {DOMTargetSelector} root
@@ -841,10 +930,16 @@ class AutoLayout {
*/
constructor(root, params = {}) {
if (scope.current) scope.current.register(this);
- const frozenParams = params.frozen;
- const addedParams = params.added;
- const removedParams = params.removed;
- const propsParams = params.properties;
+ const swapAtSplitParams = splitPropertiesFromParams(params.swapAt);
+ const enterFromSplitParams = splitPropertiesFromParams(params.enterFrom);
+ const leaveToSplitParams = splitPropertiesFromParams(params.leaveTo);
+ const transitionProperties = params.properties;
+ /** @type {Number|FunctionValue} */
+ params.duration = setValue(params.duration, 350);
+ /** @type {Number|FunctionValue} */
+ params.delay = setValue(params.delay, 0);
+ /** @type {EasingParam|FunctionValue} */
+ params.ease = setValue(params.ease, 'inOut(3.5)');
/** @type {AutoLayoutParams} */
this.params = params;
/** @type {DOMTarget} */
@@ -855,29 +950,27 @@ class AutoLayout {
this.children = params.children || '*';
/** @type {Boolean} */
this.absoluteCoords = false;
- /** @type {Number|FunctionValue} */
- this.duration = setValue(params.duration, 500);
- /** @type {Number|FunctionValue} */
- this.delay = setValue(params.delay, 0);
- /** @type {EasingParam} */
- this.ease = setValue(params.ease, 'inOut(3.5)');
- /** @type {Callback<this>} */
- this.onComplete = setValue(params.onComplete, /** @type {Callback<this>} */(noop));
/** @type {LayoutStateParams} */
- this.frozenParams = frozenParams || { opacity: 0 };
+ this.swapAtParams = mergeObjects(params.swapAt || { opacity: 0 }, { ease: 'inOut(1.75)' });
/** @type {LayoutStateParams} */
- this.addedParams = addedParams || { opacity: 0 };
+ this.enterFromParams = params.enterFrom || { opacity: 0 };
/** @type {LayoutStateParams} */
- this.removedParams = removedParams || { opacity: 0 };
+ this.leaveToParams = params.leaveTo || { opacity: 0 };
/** @type {Set<String>} */
this.properties = new Set([
'opacity',
+ 'fontSize',
+ 'color',
+ 'backgroundColor',
'borderRadius',
+ 'border',
+ 'filter',
+ 'clipPath',
]);
- if (frozenParams) for (let name in frozenParams) this.properties.add(name);
- if (addedParams) for (let name in addedParams) this.properties.add(name);
- if (removedParams) for (let name in removedParams) this.properties.add(name);
- if (propsParams) for (let i = 0, l = propsParams.length; i < l; i++) this.properties.add(propsParams[i]);
+ if (swapAtSplitParams[0]) for (let name in swapAtSplitParams[0]) this.properties.add(name);
+ if (enterFromSplitParams[0]) for (let name in enterFromSplitParams[0]) this.properties.add(name);
+ if (leaveToSplitParams[0]) for (let name in leaveToSplitParams[0]) this.properties.add(name);
+ if (transitionProperties) for (let i = 0, l = transitionProperties.length; i < l; i++) this.properties.add(transitionProperties[i]);
/** @type {Set<String>} */
this.recordedProperties = new Set([
'display',
@@ -897,24 +990,26 @@ class AutoLayout {
]);
this.properties.forEach(prop => this.recordedProperties.add(prop));
/** @type {WeakSet<DOMTarget>} */
- this.pendingRemoved = new WeakSet();
+ this.pendingRemoval = new WeakSet();
/** @type {Map<DOMTarget, String|null>} */
this.transitionMuteStore = new Map();
/** @type {LayoutSnapshot} */
this.oldState = new LayoutSnapshot(this);
/** @type {LayoutSnapshot} */
this.newState = new LayoutSnapshot(this);
- /** @type {Timeline|null} */
+ /** @type {Timeline} */
this.timeline = null;
- /** @type {WAAPIAnimation|null} */
+ /** @type {WAAPIAnimation} */
this.transformAnimation = null;
/** @type {Array<DOMTarget>} */
- this.frozen = [];
+ this.animating = [];
+ /** @type {Array<DOMTarget>} */
+ this.swapping = [];
/** @type {Array<DOMTarget>} */
- this.removed = [];
+ this.leaving = [];
/** @type {Array<DOMTarget>} */
- this.added = [];
- // Record the current state as the old state to init the data attributes
+ this.entering = [];
+ // Record the current state as the old state to init the data attributes and allow imediate .animate()
this.oldState.record();
// And all layout transition muted during the record
restoreLayoutTransition(this.transitionMuteStore);
@@ -924,6 +1019,7 @@ class AutoLayout {
* @return {this}
*/
revert() {
+ this.root.classList.remove('is-animated');
if (this.timeline) {
this.timeline.complete();
this.timeline = null;
@@ -932,8 +1028,7 @@ class AutoLayout {
this.transformAnimation.complete();
this.transformAnimation = null;
}
- this.root.classList.remove('is-animated');
- this.frozen.length = this.removed.length = this.added.length = 0;
+ this.animating.length = this.swapping.length = this.leaving.length = this.entering.length = 0;
this.oldState.revert();
this.newState.revert();
requestAnimationFrame(() => restoreLayoutTransition(this.transitionMuteStore));
@@ -966,20 +1061,72 @@ class AutoLayout {
* @return {Timeline}
*/
animate(params = {}) {
- const delay = setValue(params.delay, this.delay);
- const duration = setValue(params.duration, this.duration);
- const onComplete = setValue(params.onComplete, this.onComplete);
- const frozenParams = params.frozen ? mergeObjects(params.frozen, this.frozenParams) : this.frozenParams;
- const addedParams = params.added ? mergeObjects(params.added, this.addedParams) : this.addedParams;
- const removedParams = params.removed ? mergeObjects(params.removed, this.removedParams) : this.removedParams;
+ /** @type { LayoutAnimationTimingsParams } */
+ const animationTimings = {
+ ease: setValue(params.ease, this.params.ease),
+ delay: setValue(params.delay, this.params.delay),
+ duration: setValue(params.duration, this.params.duration),
+ };
+ /** @type {TimelineParams} */
+ const tlParams = {};
+ const onComplete = setValue(params.onComplete, this.params.onComplete);
+ const onPause = setValue(params.onPause, this.params.onPause);
+ for (let name in defaults) {
+ if (name !== 'ease' && name !== 'duration' && name !== 'delay') {
+ if (!isUnd(params[name])) {
+ tlParams[name] = params[name];
+ } else if (!isUnd(this.params[name])) {
+ tlParams[name] = this.params[name];
+ }
+ }
+ }
+ tlParams.onComplete = () => {
+ // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(node => {
+ restoreNodeVisualState(node);
+ restoreNodeInlineStyles(node);
+ });
+ for (let i = 0, l = transformed.length; i < l; i++) {
+ const $el = transformed[i];
+ $el.style.transform = newState.getComputedValue($el, 'transform');
+ }
+ if (this.root.classList.contains('is-animated')) {
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ }
+ // Avoid CSS transitions at the end of the animation by restoring them on the next frame
+ requestAnimationFrame(() => {
+ if (this.root.classList.contains('is-animated')) return;
+ restoreLayoutTransition(this.transitionMuteStore);
+ });
+ };
+ tlParams.onPause = () => {
+ if (!this.root.classList.contains('is-animated')) return;
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(restoreNodeVisualState);
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ if (onPause) onPause(this.timeline);
+ };
+ tlParams.composition = false;
+
+ const swapAtParams = mergeObjects(mergeObjects(params.swapAt || {}, this.swapAtParams), animationTimings);
+ const enterFromParams = mergeObjects(mergeObjects(params.enterFrom || {}, this.enterFromParams), animationTimings);
+ const leaveToParams = mergeObjects(mergeObjects(params.leaveTo || {}, this.leaveToParams), animationTimings);
+ const [ swapAtProps, swapAtTimings ] = splitPropertiesFromParams(swapAtParams);
+ const [ enterFromProps, enterFromTimings ] = splitPropertiesFromParams(enterFromParams);
+ const [ leaveToProps, leaveToTimings ] = splitPropertiesFromParams(leaveToParams);
+
const oldState = this.oldState;
const newState = this.newState;
- const added = this.added;
- const removed = this.removed;
- const frozen = this.frozen;
- const pendingRemoved = this.pendingRemoved;
+ const animating = this.animating;
+ const swapping = this.swapping;
+ const entering = this.entering;
+ const leaving = this.leaving;
+ const pendingRemoval = this.pendingRemoval;
- added.length = removed.length = frozen.length = 0;
+ animating.length = swapping.length = entering.length = leaving.length = 0;
// Mute old state CSS transitions to prevent wrong properties calculation
oldState.forEachRootNode(muteNodeTransition);
@@ -990,10 +1137,12 @@ class AutoLayout {
const targets = [];
const animated = [];
const transformed = [];
- const animatedFrozen = [];
- const root = newState.rootNode.$el;
+ const animatedSwap = [];
+ const rootNode = newState.rootNode;
+ const $root = rootNode.$el;
newState.forEachRootNode(node => {
+
const $el = node.$el;
const id = node.id;
const parent = node.parentNode;
@@ -1001,10 +1150,6 @@ class AutoLayout {
const parentRemoved = parent ? parent.branchRemoved : false;
const parentNotRendered = parent ? parent.branchNotRendered : false;
- // Delay and duration must be calculated in the animate() call to support delay override
- node.delay = +(isFnc(delay) ? delay($el, node.index, node.total) : delay);
- node.duration = +(isFnc(duration) ? duration($el, node.index, node.total) : duration);
-
let oldStateNode = oldState.nodes.get(id);
const hasNoOldState = !oldStateNode;
@@ -1054,7 +1199,7 @@ class AutoLayout {
}
}
- const wasPendingRemoval = pendingRemoved.has($el);
+ const wasPendingRemoval = pendingRemoval.has($el);
const wasVisibleBefore = oldStateNode.measuredIsVisible;
const isVisibleNow = node.measuredIsVisible;
const becomeVisible = !wasVisibleBefore && isVisibleNow && !parentNotRendered;
@@ -1062,113 +1207,156 @@ class AutoLayout {
const newlyRemoved = isRemovedNow && !wasRemovedBefore && !parentRemoved;
const topLevelRemoved = newlyRemoved || isRemovedNow && wasPendingRemoval && !parentRemoved;
- if (node.measuredIsRemoved && wasVisibleBefore) {
+ node.branchAdded = parentAdded || topLevelAdded;
+ node.branchRemoved = parentRemoved || topLevelRemoved;
+ node.branchNotRendered = parentNotRendered || isRemovedNow;
+
+ if (isRemovedNow && wasVisibleBefore) {
node.$el.style.display = oldStateNode.measuredDisplay;
node.$el.style.visibility = 'visible';
cloneNodeProperties(oldStateNode, node, newState);
}
+ // Node is leaving
if (newlyRemoved) {
- removed.push($el);
- pendingRemoved.add($el);
+ if (node.isTarget) {
+ leaving.push($el);
+ node.isLeaving = true;
+ }
+ pendingRemoval.add($el);
} else if (!isRemovedNow && wasPendingRemoval) {
- pendingRemoved.delete($el);
+ pendingRemoval.delete($el);
}
- // Node is added
+ // Node is entering
if ((topLevelAdded && !parentNotRendered) || becomeVisible) {
- updateNodeProperties(oldStateNode, addedParams);
- added.push($el);
- // Node is removed
+ updateNodeProperties(oldStateNode, enterFromProps);
+ if (node.isTarget) {
+ entering.push($el);
+ node.isEntering = true;
+ }
+ // Node is leaving
} else if (topLevelRemoved && !parentNotRendered) {
- updateNodeProperties(node, removedParams);
+ updateNodeProperties(node, leaveToProps);
}
- // Compute function based propety values before cheking for changes
- for (let name in node.properties) {
- node.properties[name] = newState.getValue(node.$el, name);
- // NOTE: I'm using node.$el to get the value of old state, make sure this is valid instead of oldStateNode.$el
- oldStateNode.properties[name] = oldState.getValue(node.$el, name);
+ // Node is animating
+ // The animating array is used only to calculate delays and duration on root children
+ if (node !== rootNode && node.isTarget && !node.isEntering && !node.isLeaving) {
+ animating.push($el);
}
- const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
- let propertyChanged = false;
+ targets.push($el);
+ });
- if (node.isTarget && (!node.measuredIsRemoved && wasVisibleBefore || node.measuredIsRemoved && isVisibleNow)) {
- if (!node.isInlined && (node.properties.transform !== 'none' || oldStateNode.properties.transform !== 'none')) {
- node.hasTransform = true;
- propertyChanged = true;
- transformed.push($el);
- }
- for (let name in node.properties) {
- if (name !== 'transform' && (node.properties[name] !== oldStateNode.properties[name] || hiddenStateChanged)) {
- propertyChanged = true;
- animated.push($el);
- break;
- }
- }
+ let enteringIndex = 0;
+ let leavingIndex = 0;
+ let animatingIndex = 0;
+
+ newState.forEachRootNode(node => {
+
+ const $el = node.$el;
+ const parent = node.parentNode;
+ const oldStateNode = oldState.nodes.get(node.id);
+ const nodeProperties = node.properties;
+ const oldStateNodeProperties = oldStateNode.properties;
+
+ // Use closest animated parent index and total values so that children staggered delays are in sync with their parent
+ let animatedParent = parent !== rootNode && parent;
+ while (animatedParent && !animatedParent.isTarget && animatedParent !== rootNode) {
+ animatedParent = animatedParent.parentNode;
}
- const nodeHasChanged = (propertyChanged || topLevelAdded || topLevelRemoved || becomeVisible);
- const nodeIsAnimated = node.isTarget && nodeHasChanged;
+ const animatingTotal = animating.length;
+
+ // Root is always animated first in sync with the first child (animating.length is the total of children)
+ if (node === rootNode) {
+ node.index = 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else if (node.isEntering) {
+ node.index = animatedParent ? animatedParent.index : enteringIndex;
+ node.total = animatedParent ? animatingTotal : entering.length;
+ updateNodeTimingParams(node, enterFromTimings);
+ enteringIndex++;
+ } else if (node.isLeaving) {
+ node.index = animatedParent ? animatedParent.index : leavingIndex;
+ node.total = animatedParent ? animatingTotal : leaving.length;
+ leavingIndex++;
+ updateNodeTimingParams(node, leaveToTimings);
+ } else if (node.isTarget) {
+ node.index = animatingIndex++;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else {
+ node.index = animatedParent ? animatedParent.index : 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, swapAtTimings);
+ }
- node.isAnimated = nodeIsAnimated;
- node.branchAdded = parentAdded || topLevelAdded;
- node.branchRemoved = parentRemoved || topLevelRemoved;
- node.branchNotRendered = parentNotRendered || node.measuredIsRemoved;
+ // Make sure the old state node has its inex and total values up to date for valid "from" function values calculation
+ oldStateNode.index = node.index;
+ oldStateNode.total = node.total;
+ // Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation props
+ for (let prop in nodeProperties) {
+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);
+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);
+ }
+
+ // Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements
const sizeTolerance = 1;
- const widthChanged = Math.abs(node.properties.width - oldStateNode.properties.width) > sizeTolerance;
- const heightChanged = Math.abs(node.properties.height - oldStateNode.properties.height) > sizeTolerance;
+ const widthChanged = Math.abs(nodeProperties.width - oldStateNodeProperties.width) > sizeTolerance;
+ const heightChanged = Math.abs(nodeProperties.height - oldStateNodeProperties.height) > sizeTolerance;
node.sizeChanged = (widthChanged || heightChanged);
- targets.push($el);
+ // const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
+
+ if (node.isTarget && (!node.measuredIsRemoved && oldStateNode.measuredIsVisible || node.measuredIsRemoved && node.measuredIsVisible)) {
+ if (!node.isInlined && (nodeProperties.transform !== 'none' || oldStateNodeProperties.transform !== 'none')) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ for (let prop in nodeProperties) {
+ // if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop] || hiddenStateChanged)) {
+ if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop])) {
+ animated.push($el);
+ break;
+ }
+ }
+ }
if (!node.isTarget) {
- frozen.push($el);
- if ((nodeHasChanged || node.sizeChanged) && parent && parent.isTarget && parent.isAnimated && parent.sizeChanged) {
- animatedFrozen.push($el);
+ swapping.push($el);
+ if (node.sizeChanged && parent && parent.isTarget && parent.sizeChanged) {
+ if (!node.isInlined && swapAtProps.transform) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ animatedSwap.push($el);
}
}
+
});
- const defaults = {
- ease: setValue(params.ease, this.ease),
- duration: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).duration,
- delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
+ const timingParams = {
+ delay: (/** @type {HTMLElement} */$el) => newState.getNode($el).delay,
+ duration: (/** @type {HTMLElement} */$el) => newState.getNode($el).duration,
+ ease: (/** @type {HTMLElement} */$el) => newState.getNode($el).ease,
};
- this.timeline = createTimeline({
- onComplete: () => {
- // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(node => {
- restoreNodeVisualState(node);
- restoreNodeInlineStyles(node);
- });
- for (let i = 0, l = transformed.length; i < l; i++) {
- const $el = transformed[i];
- $el.style.transform = newState.getValue($el, 'transform');
- }
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- // Avoid CSS transitions at the end of the animation by restoring them on the next frame
- requestAnimationFrame(() => {
- if (this.root.classList.contains('is-animated')) return;
- restoreLayoutTransition(this.transitionMuteStore);
- });
- },
- onPause: () => {
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(restoreNodeVisualState);
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- },
- composition: false,
- defaults,
- });
+ tlParams.defaults = timingParams;
+
+ this.timeline = createTimeline(tlParams);
+
+ // Imediatly return the timeline if no layout changes detected
+ if (!animated.length && !transformed.length && !swapping.length) {
+ // Make sure to restore all CSS transition if no animation
+ restoreLayoutTransition(this.transitionMuteStore);
+ return this.timeline.complete();
+ }
if (targets.length) {
@@ -1181,15 +1369,14 @@ class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
- // Make sure to mute all CSS transition before applying the oldState styles back
- muteNodeTransition(newNode);
+ // muteNodeTransition(newNode);
// Don't animate dimensions and positions of inlined elements
if (!newNode.isInlined) {
// Display grid can mess with the absolute positioning, so set it to block during transition
- if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.display = 'block';
- // All children must be in position absolue
- if ($el !== root || this.absoluteCoords) {
+ if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.setProperty('display', 'block', 'important');
+ // All children must be in position absolute or fixed
+ if ($el !== $root || this.absoluteCoords) {
$el.style.position = this.absoluteCoords ? 'fixed' : 'absolute';
$el.style.left = '0px';
$el.style.top = '0px';
@@ -1197,7 +1384,7 @@ class AutoLayout {
$el.style.marginTop = '0px';
$el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
}
- if ($el === root && newNode.measuredPosition === 'static') {
+ if ($el === $root && newNode.measuredPosition === 'static') {
$el.style.position = 'relative';
// Cancel left / trop in case the static element had muted values now activated by potision relative
$el.style.left = '0px';
@@ -1216,9 +1403,7 @@ class AutoLayout {
// Restore the scroll position if the oldState differs from the current state
if (oldState.scrollX !== window.scrollX || oldState.scrollY !== window.scrollY) {
// Restoring in the next frame avoids race conditions if for example a waapi animation commit styles that affect the root height
- requestAnimationFrame(() => {
- window.scrollTo(oldState.scrollX, oldState.scrollY);
- });
+ requestAnimationFrame(() => window.scrollTo(oldState.scrollX, oldState.scrollY));
}
for (let i = 0, l = animated.length; i < l; i++) {
@@ -1228,25 +1413,25 @@ class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
const newNodeState = newNode.properties;
- let hasChanged = false;
+ let nodeHasChanged = false;
+ /** @type {AnimationParams} */
const animatedProps = {
composition: 'none',
- // delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
};
if (!newNode.isInlined) {
if (oldNodeState.width !== newNodeState.width) {
animatedProps.width = [oldNodeState.width, newNodeState.width];
- hasChanged = true;
+ nodeHasChanged = true;
}
if (oldNodeState.height !== newNodeState.height) {
animatedProps.height = [oldNodeState.height, newNodeState.height];
- hasChanged = true;
+ nodeHasChanged = true;
}
// If the node has transforms we handle the translate animation in wappi otherwise translate and other transforms can be out of sync
// Always animate translate
if (!newNode.hasTransform) {
animatedProps.translate = [`${oldNodeState.x}px ${oldNodeState.y}px`, `${newNodeState.x}px ${newNodeState.y}px`];
- hasChanged = true;
+ nodeHasChanged = true;
}
}
this.properties.forEach(prop => {
@@ -1254,73 +1439,77 @@ class AutoLayout {
const newVal = newNodeState[prop];
if (prop !== 'transform' && oldVal !== newVal) {
animatedProps[prop] = [oldVal, newVal];
- hasChanged = true;
+ nodeHasChanged = true;
}
});
- if (hasChanged) {
+ if (nodeHasChanged) {
this.timeline.add($el, animatedProps, 0);
}
}
}
- if (frozen.length) {
+ if (swapping.length) {
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const oldNode = oldState.nodes.get($el.dataset.layoutId);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const oldNode = oldState.getNode($el);
if (!oldNode.isInlined) {
- const oldNodeState = oldState.get($el);
- $el.style.width = `${oldNodeState.width}px`;
- $el.style.height = `${oldNodeState.height}px`;
+ const oldNodeProps = oldNode.properties;
+ $el.style.width = `${oldNodeProps.width}px`;
+ $el.style.height = `${oldNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
+ $el.style.translate = `${oldNodeProps.x}px ${oldNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${oldState.getValue($el, prop)}`;
+ $el.style[prop] = `${oldState.getComputedValue($el, prop)}`;
}
});
}
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const newNode = newState.nodes.get($el.dataset.layoutId);
- const newNodeState = newState.get($el);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const newNode = newState.getNode($el);
+ const newNodeProps = newNode.properties;
this.timeline.call(() => {
if (!newNode.isInlined) {
- $el.style.width = `${newNodeState.width}px`;
- $el.style.height = `${newNodeState.height}px`;
+ $el.style.width = `${newNodeProps.width}px`;
+ $el.style.height = `${newNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${newNodeState.x}px ${newNodeState.y}px`;
+ $el.style.translate = `${newNodeProps.x}px ${newNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${newState.getValue($el, prop)}`;
+ $el.style[prop] = `${newState.getComputedValue($el, prop)}`;
}
});
}, newNode.delay + newNode.duration / 2);
}
- if (animatedFrozen.length) {
- const animatedFrozenParams = /** @type {AnimationParams} */({});
- if (frozenParams) {
- for (let prop in frozenParams) {
- animatedFrozenParams[prop] = [
- { from: (/** @type {HTMLElement} */$el) => oldState.getValue($el, prop), ease: 'in(1.75)', to: frozenParams[prop] },
- { from: frozenParams[prop], to: (/** @type {HTMLElement} */$el) => newState.getValue($el, prop), ease: 'out(1.75)' }
- ];
+ if (animatedSwap.length) {
+ const ease = parseEase(newState.nodes.get(animatedSwap[0].dataset.layoutId).ease);
+ const inverseEased = t => 1 - ease(1 - t);
+ const animatedSwapParams = /** @type {AnimationParams} */({});
+ if (swapAtProps) {
+ for (let prop in swapAtProps) {
+ if (prop !== 'transform') {
+ animatedSwapParams[prop] = [
+ { from: (/** @type {HTMLElement} */$el) => oldState.getComputedValue($el, prop), to: swapAtProps[prop] },
+ { from: swapAtProps[prop], to: (/** @type {HTMLElement} */$el) => newState.getComputedValue($el, prop), ease: inverseEased }
+ ];
+ }
}
}
- this.timeline.add(animatedFrozen, animatedFrozenParams, 0);
+ this.timeline.add(animatedSwap, animatedSwapParams, 0);
}
}
@@ -1328,18 +1517,29 @@ class AutoLayout {
const transformedLength = transformed.length;
if (transformedLength) {
- // We only need to set the transform property here since translate is alread defined the targets loop
+ // We only need to set the transform property here since translate is alread defined in the targets loop
for (let i = 0; i < transformedLength; i++) {
const $el = transformed[i];
- $el.style.translate = `${oldState.get($el).x}px ${oldState.get($el).y}px`,
- $el.style.transform = oldState.getValue($el, 'transform');
+ $el.style.translate = `${oldState.getComputedValue($el, 'x')}px ${oldState.getComputedValue($el, 'y')}px`,
+ $el.style.transform = oldState.getComputedValue($el, 'transform');
+ if (animatedSwap.includes($el)) {
+ const node = newState.getNode($el);
+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);
+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);
+ }
}
this.transformAnimation = waapi.animate(transformed, {
- translate: (/** @type {HTMLElement} */$el) => `${newState.get($el).x}px ${newState.get($el).y}px`,
- transform: (/** @type {HTMLElement} */$el) => newState.getValue($el, 'transform'),
+ translate: (/** @type {HTMLElement} */$el) => `${newState.getComputedValue($el, 'x')}px ${newState.getComputedValue($el, 'y')}px`,
+ transform: (/** @type {HTMLElement} */$el) => {
+ const newValue = newState.getComputedValue($el, 'transform');
+ if (!animatedSwap.includes($el)) return newValue;
+ const oldValue = oldState.getComputedValue($el, 'transform');
+ const node = newState.getNode($el);
+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]
+ },
autoplay: false,
persist: true,
- ...defaults,
+ ...timingParams,
});
this.timeline.sync(this.transformAnimation, 0);
}
@@ -1350,13 +1550,12 @@ class AutoLayout {
/**
* @param {(layout: this) => void} callback
* @param {LayoutAnimationParams} [params]
- * @return {this}
+ * @return {Timeline}
*/
update(callback, params = {}) {
this.record();
callback(this);
- this.animate(params);
- return this;
+ return this.animate(params);
}
}
diff --git a/dist/modules/scope/index.cjs b/dist/modules/scope/index.cjs
index abd9662f..e57af7f3 100644
--- a/dist/modules/scope/index.cjs
+++ b/dist/modules/scope/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - scope - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/scope/index.js b/dist/modules/scope/index.js
index e46ee757..9af7f113 100644
--- a/dist/modules/scope/index.js
+++ b/dist/modules/scope/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - scope - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { Scope, createScope } from './scope.js';
diff --git a/dist/modules/scope/scope.cjs b/dist/modules/scope/scope.cjs
index 354b73db..e1d270f4 100644
--- a/dist/modules/scope/scope.cjs
+++ b/dist/modules/scope/scope.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - scope - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/scope/scope.js b/dist/modules/scope/scope.js
index 64e1b9aa..145671cf 100644
--- a/dist/modules/scope/scope.js
+++ b/dist/modules/scope/scope.js
@@ -1,8 +1,8 @@
/**
* Anime.js - scope - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { doc, win } from '../core/consts.js';
diff --git a/dist/modules/svg/drawable.cjs b/dist/modules/svg/drawable.cjs
index 496dfa35..e82c0802 100644
--- a/dist/modules/svg/drawable.cjs
+++ b/dist/modules/svg/drawable.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/svg/drawable.js b/dist/modules/svg/drawable.js
index f19bd4da..b12d5fc8 100644
--- a/dist/modules/svg/drawable.js
+++ b/dist/modules/svg/drawable.js
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { proxyTargetSymbol, K } from '../core/consts.js';
diff --git a/dist/modules/svg/helpers.cjs b/dist/modules/svg/helpers.cjs
index 692f9cf7..0b352ede 100644
--- a/dist/modules/svg/helpers.cjs
+++ b/dist/modules/svg/helpers.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/svg/helpers.js b/dist/modules/svg/helpers.js
index dfafa23d..8334108c 100644
--- a/dist/modules/svg/helpers.js
+++ b/dist/modules/svg/helpers.js
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { isSvg } from '../core/helpers.js';
diff --git a/dist/modules/svg/index.cjs b/dist/modules/svg/index.cjs
index d3ebd0f7..e1446c14 100644
--- a/dist/modules/svg/index.cjs
+++ b/dist/modules/svg/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/svg/index.js b/dist/modules/svg/index.js
index bbd3f969..1d9a55d1 100644
--- a/dist/modules/svg/index.js
+++ b/dist/modules/svg/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { createMotionPath } from './motionpath.js';
diff --git a/dist/modules/svg/morphto.cjs b/dist/modules/svg/morphto.cjs
index 5b96d91d..6de0eb8d 100644
--- a/dist/modules/svg/morphto.cjs
+++ b/dist/modules/svg/morphto.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/svg/morphto.js b/dist/modules/svg/morphto.js
index 9ea758e5..478b696e 100644
--- a/dist/modules/svg/morphto.js
+++ b/dist/modules/svg/morphto.js
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { morphPointsSymbol } from '../core/consts.js';
diff --git a/dist/modules/svg/motionpath.cjs b/dist/modules/svg/motionpath.cjs
index dd4a7695..1002ba1e 100644
--- a/dist/modules/svg/motionpath.cjs
+++ b/dist/modules/svg/motionpath.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/svg/motionpath.js b/dist/modules/svg/motionpath.js
index 6859815e..58c67f18 100644
--- a/dist/modules/svg/motionpath.js
+++ b/dist/modules/svg/motionpath.js
@@ -1,8 +1,8 @@
/**
* Anime.js - svg - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { isSvgSymbol } from '../core/consts.js';
diff --git a/dist/modules/text/index.cjs b/dist/modules/text/index.cjs
index 7d39e2f1..1c5cd913 100644
--- a/dist/modules/text/index.cjs
+++ b/dist/modules/text/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - text - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/text/index.js b/dist/modules/text/index.js
index 7203d6c3..a10b4685 100644
--- a/dist/modules/text/index.js
+++ b/dist/modules/text/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - text - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { TextSplitter, split, splitText } from './split.js';
diff --git a/dist/modules/text/split.cjs b/dist/modules/text/split.cjs
index 5bb65ae1..9afe4063 100644
--- a/dist/modules/text/split.cjs
+++ b/dist/modules/text/split.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - text - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/text/split.js b/dist/modules/text/split.js
index 13809756..b80a0c76 100644
--- a/dist/modules/text/split.js
+++ b/dist/modules/text/split.js
@@ -1,8 +1,8 @@
/**
* Anime.js - text - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { isBrowser, doc } from '../core/consts.js';
diff --git a/dist/modules/timeline/index.cjs b/dist/modules/timeline/index.cjs
index d20f820e..931fc1a9 100644
--- a/dist/modules/timeline/index.cjs
+++ b/dist/modules/timeline/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - timeline - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/timeline/index.js b/dist/modules/timeline/index.js
index 7838821d..42706ffd 100644
--- a/dist/modules/timeline/index.js
+++ b/dist/modules/timeline/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - timeline - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { Timeline, createTimeline } from './timeline.js';
diff --git a/dist/modules/timeline/position.cjs b/dist/modules/timeline/position.cjs
index fa3d47b5..8c4931a6 100644
--- a/dist/modules/timeline/position.cjs
+++ b/dist/modules/timeline/position.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - timeline - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/timeline/position.js b/dist/modules/timeline/position.js
index 7cb5165d..b4ed28d7 100644
--- a/dist/modules/timeline/position.js
+++ b/dist/modules/timeline/position.js
@@ -1,8 +1,8 @@
/**
* Anime.js - timeline - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { relativeValuesExecRgx, minValue } from '../core/consts.js';
diff --git a/dist/modules/timeline/timeline.cjs b/dist/modules/timeline/timeline.cjs
index f5993045..2a8d82e4 100644
--- a/dist/modules/timeline/timeline.cjs
+++ b/dist/modules/timeline/timeline.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - timeline - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/timeline/timeline.js b/dist/modules/timeline/timeline.js
index 8e761040..0e05e106 100644
--- a/dist/modules/timeline/timeline.js
+++ b/dist/modules/timeline/timeline.js
@@ -1,8 +1,8 @@
/**
* Anime.js - timeline - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { globals } from '../core/globals.js';
diff --git a/dist/modules/timer/index.cjs b/dist/modules/timer/index.cjs
index 7fb867cb..73f92263 100644
--- a/dist/modules/timer/index.cjs
+++ b/dist/modules/timer/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - timer - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/timer/index.js b/dist/modules/timer/index.js
index 0fad7d0f..0a65a42f 100644
--- a/dist/modules/timer/index.js
+++ b/dist/modules/timer/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - timer - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { Timer, createTimer } from './timer.js';
diff --git a/dist/modules/timer/timer.cjs b/dist/modules/timer/timer.cjs
index ad8f173b..5c2176b3 100644
--- a/dist/modules/timer/timer.cjs
+++ b/dist/modules/timer/timer.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - timer - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
@@ -463,10 +463,11 @@ class Timer extends clock.Clock {
/**
* Imediatly completes the timer, cancels it and triggers the onComplete callback
+ * @param {Boolean|Number} [muteCallbacks]
* @return {this}
*/
- complete() {
- return this.seek(this.duration).cancel();
+ complete(muteCallbacks = 0) {
+ return this.seek(this.duration, muteCallbacks).cancel();
}
/**
diff --git a/dist/modules/timer/timer.d.ts b/dist/modules/timer/timer.d.ts
index aabd636f..257f8b14 100644
--- a/dist/modules/timer/timer.d.ts
+++ b/dist/modules/timer/timer.d.ts
@@ -124,9 +124,10 @@ export class Timer extends Clock {
revert(): this;
/**
* Imediatly completes the timer, cancels it and triggers the onComplete callback
+ * @param {Boolean|Number} [muteCallbacks]
* @return {this}
*/
- complete(): this;
+ complete(muteCallbacks?: boolean | number): this;
/**
* @typedef {this & {then: null}} ResolvedTimer
*/
diff --git a/dist/modules/timer/timer.js b/dist/modules/timer/timer.js
index f8378bc4..da9e4ae3 100644
--- a/dist/modules/timer/timer.js
+++ b/dist/modules/timer/timer.js
@@ -1,8 +1,8 @@
/**
* Anime.js - timer - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { minValue, noop, maxValue, compositionTypes, tickModes } from '../core/consts.js';
@@ -461,10 +461,11 @@ class Timer extends Clock {
/**
* Imediatly completes the timer, cancels it and triggers the onComplete callback
+ * @param {Boolean|Number} [muteCallbacks]
* @return {this}
*/
- complete() {
- return this.seek(this.duration).cancel();
+ complete(muteCallbacks = 0) {
+ return this.seek(this.duration, muteCallbacks).cancel();
}
/**
diff --git a/dist/modules/types/index.d.ts b/dist/modules/types/index.d.ts
index 753dbf3f..42d925a6 100644
--- a/dist/modules/types/index.d.ts
+++ b/dist/modules/types/index.d.ts
@@ -12,7 +12,7 @@ export type DefaultsParams = {
duration?: number | FunctionValue;
delay?: number | FunctionValue;
loopDelay?: number;
- ease?: EasingParam;
+ ease?: EasingParam | FunctionValue;
composition?: "none" | "replace" | "blend" | compositionTypes;
modifier?: (v: any) => any;
onBegin?: Callback<Tickable>;
@@ -114,7 +114,7 @@ export type TimerOptions = {
playbackRate?: number;
};
export type TimerParams = TimerOptions & TickableCallbacks<Timer>;
-export type FunctionValue = (target: Target, index: number, length: number) => number | string | TweenObjectValue | Array<number | string | TweenObjectValue>;
+export type FunctionValue = (target: Target, index: number, length: number) => number | string | TweenObjectValue | EasingParam | Array<number | string | TweenObjectValue>;
export type TweenModifier = (value: number) => number | string;
export type ColorArray = [number, number, number, number];
export type Tween = {
@@ -187,13 +187,13 @@ export type TweenPropertySiblings = {
export type TweenLookups = Record<string, TweenPropertySiblings>;
export type TweenReplaceLookups = WeakMap<Target, TweenLookups>;
export type TweenAdditiveLookups = Map<Target, TweenLookups>;
-export type TweenParamValue = number | string | FunctionValue;
+export type TweenParamValue = number | string | FunctionValue | EasingParam;
export type TweenPropValue = TweenParamValue | [TweenParamValue, TweenParamValue];
export type TweenComposition = (string & {}) | "none" | "replace" | "blend" | compositionTypes;
export type TweenParamsOptions = {
duration?: TweenParamValue;
delay?: TweenParamValue;
- ease?: EasingParam;
+ ease?: EasingParam | FunctionValue;
modifier?: TweenModifier;
composition?: TweenComposition;
};
@@ -253,7 +253,7 @@ export type TimelineOptions = {
};
export type TimelineParams = TimerOptions & TimelineOptions & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>;
export type WAAPITweenValue = string | number | Array<string> | Array<number>;
-export type WAAPIFunctionValue = (target: DOMTarget, index: number, length: number) => WAAPITweenValue;
+export type WAAPIFunctionValue = (target: DOMTarget, index: number, length: number) => WAAPITweenValue | WAAPIEasingParam;
export type WAAPIKeyframeValue = WAAPITweenValue | WAAPIFunctionValue | Array<string | number | WAAPIFunctionValue>;
export type WAAPITweenOptions = {
to?: WAAPIKeyframeValue;
@@ -271,7 +271,7 @@ export type WAAPIAnimationOptions = {
playbackRate?: number;
duration?: number | WAAPIFunctionValue;
delay?: number | WAAPIFunctionValue;
- ease?: WAAPIEasingParam;
+ ease?: WAAPIEasingParam | WAAPIFunctionValue;
composition?: CompositeOperation;
persist?: boolean;
onComplete?: Callback<WAAPIAnimation>;
diff --git a/dist/modules/utils/chainable.cjs b/dist/modules/utils/chainable.cjs
index e37cce8f..efc3acc1 100644
--- a/dist/modules/utils/chainable.cjs
+++ b/dist/modules/utils/chainable.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/utils/chainable.js b/dist/modules/utils/chainable.js
index 6b118f1a..cb6c6fbc 100644
--- a/dist/modules/utils/chainable.js
+++ b/dist/modules/utils/chainable.js
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { noop } from '../core/consts.js';
diff --git a/dist/modules/utils/index.cjs b/dist/modules/utils/index.cjs
index 23d2d5c3..fabf1431 100644
--- a/dist/modules/utils/index.cjs
+++ b/dist/modules/utils/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/utils/index.js b/dist/modules/utils/index.js
index 585582d7..3cda1453 100644
--- a/dist/modules/utils/index.js
+++ b/dist/modules/utils/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { clamp, damp, degToRad, lerp, mapRange, padEnd, padStart, radToDeg, round, roundPad, snap, wrap } from './chainable.js';
diff --git a/dist/modules/utils/number.cjs b/dist/modules/utils/number.cjs
index bd59beab..529745d6 100644
--- a/dist/modules/utils/number.cjs
+++ b/dist/modules/utils/number.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/utils/number.js b/dist/modules/utils/number.js
index e1fcb981..fa31f4df 100644
--- a/dist/modules/utils/number.js
+++ b/dist/modules/utils/number.js
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { lerp } from '../core/helpers.js';
diff --git a/dist/modules/utils/random.cjs b/dist/modules/utils/random.cjs
index 8816030c..7476086d 100644
--- a/dist/modules/utils/random.cjs
+++ b/dist/modules/utils/random.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/utils/random.js b/dist/modules/utils/random.js
index 098fd539..e4192b1c 100644
--- a/dist/modules/utils/random.js
+++ b/dist/modules/utils/random.js
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
/**
diff --git a/dist/modules/utils/stagger.cjs b/dist/modules/utils/stagger.cjs
index dd050a3e..28409c7f 100644
--- a/dist/modules/utils/stagger.cjs
+++ b/dist/modules/utils/stagger.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/utils/stagger.js b/dist/modules/utils/stagger.js
index 9bd08893..beaf9f85 100644
--- a/dist/modules/utils/stagger.js
+++ b/dist/modules/utils/stagger.js
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { unitsExecRgx, emptyString } from '../core/consts.js';
diff --git a/dist/modules/utils/target.cjs b/dist/modules/utils/target.cjs
index 38e167c0..3cb1c974 100644
--- a/dist/modules/utils/target.cjs
+++ b/dist/modules/utils/target.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/utils/target.js b/dist/modules/utils/target.js
index be9ceeda..350c5f25 100644
--- a/dist/modules/utils/target.js
+++ b/dist/modules/utils/target.js
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { globals } from '../core/globals.js';
diff --git a/dist/modules/utils/time.cjs b/dist/modules/utils/time.cjs
index fda49e4e..906eb178 100644
--- a/dist/modules/utils/time.cjs
+++ b/dist/modules/utils/time.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/utils/time.js b/dist/modules/utils/time.js
index b0d6800a..2a3d97e9 100644
--- a/dist/modules/utils/time.js
+++ b/dist/modules/utils/time.js
@@ -1,8 +1,8 @@
/**
* Anime.js - utils - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { noop } from '../core/consts.js';
diff --git a/dist/modules/waapi/composition.cjs b/dist/modules/waapi/composition.cjs
index 3f43dfed..179d1a21 100644
--- a/dist/modules/waapi/composition.cjs
+++ b/dist/modules/waapi/composition.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - waapi - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/waapi/composition.js b/dist/modules/waapi/composition.js
index 30e2de57..c2e16af1 100644
--- a/dist/modules/waapi/composition.js
+++ b/dist/modules/waapi/composition.js
@@ -1,8 +1,8 @@
/**
* Anime.js - waapi - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { removeChild, addChild } from '../core/helpers.js';
diff --git a/dist/modules/waapi/index.cjs b/dist/modules/waapi/index.cjs
index ae0b5550..d9849c06 100644
--- a/dist/modules/waapi/index.cjs
+++ b/dist/modules/waapi/index.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - waapi - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
diff --git a/dist/modules/waapi/index.js b/dist/modules/waapi/index.js
index 8e8283b7..911db2d8 100644
--- a/dist/modules/waapi/index.js
+++ b/dist/modules/waapi/index.js
@@ -1,8 +1,8 @@
/**
* Anime.js - waapi - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
export { WAAPIAnimation, waapi } from './waapi.js';
diff --git a/dist/modules/waapi/waapi.cjs b/dist/modules/waapi/waapi.cjs
index 251552a4..c0f14ce0 100644
--- a/dist/modules/waapi/waapi.cjs
+++ b/dist/modules/waapi/waapi.cjs
@@ -1,8 +1,8 @@
/**
* Anime.js - waapi - CJS
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
'use strict';
@@ -190,8 +190,6 @@ class WAAPIAnimation {
console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);
}
- const ease = values.setValue(params.ease, parseWAAPIEasing(globals.globals.defaults.ease));
- const spring = /** @type {Spring} */(ease).ease && ease;
const autoplay = values.setValue(params.autoplay, globals.globals.defaults.autoplay);
const scroll = autoplay && /** @type {ScrollObserver} */(autoplay).link ? autoplay : false;
const alternate = params.alternate && /** @type {Boolean} */(params.alternate) === true;
@@ -202,8 +200,6 @@ class WAAPIAnimation {
const direction = alternate ? reversed ? 'alternate-reverse' : 'alternate' : reversed ? 'reverse' : 'normal';
/** @type {FillMode} */
const fill = 'both'; // We use 'both' here because the animation can be reversed during playback
- /** @type {String} */
- const easing = parseWAAPIEasing(ease);
const timeScale = (globals.globals.timeScale === 1 ? 1 : consts.K);
/** @type {DOMTargetsArray}] */
@@ -244,6 +240,15 @@ class WAAPIAnimation {
const elStyle = $el.style;
const inlineStyles = this._inlineStyles[i] = {};
+ const easeToParse = values.setValue(params.ease, globals.globals.defaults.ease);
+
+ const easeFunctionResult = values.getFunctionValue(easeToParse, $el, i, targetsLength);
+ const keyEasing = helpers.isFnc(easeFunctionResult) || helpers.isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
+ const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;
+ /** @type {String} */
+ const easing = parseWAAPIEasing(keyEasing);
+
/** @type {Number} */
const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : values.getFunctionValue(values.setValue(params.duration, globals.globals.defaults.duration), $el, i, targetsLength)) * timeScale;
/** @type {Number} */
@@ -268,7 +273,7 @@ class WAAPIAnimation {
let parsedPropertyValue;
if (helpers.isObj(propertyValue)) {
const tweenOptions = /** @type {WAAPITweenOptions} */(propertyValue);
- const tweenOptionsEase = values.setValue(tweenOptions.ease, ease);
+ const tweenOptionsEase = values.setValue(tweenOptions.ease, easing);
const tweenOptionsSpring = /** @type {Spring} */(tweenOptionsEase).ease && tweenOptionsEase;
const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;
const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;
diff --git a/dist/modules/waapi/waapi.js b/dist/modules/waapi/waapi.js
index 5b1bc41e..f5141290 100644
--- a/dist/modules/waapi/waapi.js
+++ b/dist/modules/waapi/waapi.js
@@ -1,8 +1,8 @@
/**
* Anime.js - waapi - ESM
- * @version v4.3.0-beta.2
+ * @version v4.3.0
* @license MIT
- * @copyright 2025 - Julian Garnier
+ * @copyright 2026 - Julian Garnier
*/
import { isNil, isUnd, stringStartsWith, isKey, isObj, isArr, isStr, toLowerCase, round, isFnc, isNum } from '../core/helpers.js';
@@ -188,8 +188,6 @@ class WAAPIAnimation {
console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);
}
- const ease = setValue(params.ease, parseWAAPIEasing(globals.defaults.ease));
- const spring = /** @type {Spring} */(ease).ease && ease;
const autoplay = setValue(params.autoplay, globals.defaults.autoplay);
const scroll = autoplay && /** @type {ScrollObserver} */(autoplay).link ? autoplay : false;
const alternate = params.alternate && /** @type {Boolean} */(params.alternate) === true;
@@ -200,8 +198,6 @@ class WAAPIAnimation {
const direction = alternate ? reversed ? 'alternate-reverse' : 'alternate' : reversed ? 'reverse' : 'normal';
/** @type {FillMode} */
const fill = 'both'; // We use 'both' here because the animation can be reversed during playback
- /** @type {String} */
- const easing = parseWAAPIEasing(ease);
const timeScale = (globals.timeScale === 1 ? 1 : K);
/** @type {DOMTargetsArray}] */
@@ -242,6 +238,15 @@ class WAAPIAnimation {
const elStyle = $el.style;
const inlineStyles = this._inlineStyles[i] = {};
+ const easeToParse = setValue(params.ease, globals.defaults.ease);
+
+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
+ const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;
+ /** @type {String} */
+ const easing = parseWAAPIEasing(keyEasing);
+
/** @type {Number} */
const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;
/** @type {Number} */
@@ -266,7 +271,7 @@ class WAAPIAnimation {
let parsedPropertyValue;
if (isObj(propertyValue)) {
const tweenOptions = /** @type {WAAPITweenOptions} */(propertyValue);
- const tweenOptionsEase = setValue(tweenOptions.ease, ease);
+ const tweenOptionsEase = setValue(tweenOptions.ease, easing);
const tweenOptionsSpring = /** @type {Spring} */(tweenOptionsEase).ease && tweenOptionsEase;
const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;
const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;
diff --git a/examples/assets/css/styles.css b/examples/assets/css/styles.css
index 32d732a8..f923808b 100644
--- a/examples/assets/css/styles.css
+++ b/examples/assets/css/styles.css
@@ -145,6 +145,8 @@
--border-width: 1px;
}
+[data-color="fg"] { --color-1: var(--fg-1); --color-2: var(--fg-2); --color-3: var(--fg-3); --color-4: var(--fg-4); --color-5: var(--fg-5);}
+[data-color="bg"] { --color-1: var(--bg-1); --color-2: var(--bg-2); --color-3: var(--bg-3); --color-4: var(--bg-4); --color-5: var(--bg-5);}
[data-color="0"] { --color-1: var(--red-1); --color-2: var(--red-2); --color-3: var(--red-3); --color-4: var(--red-4); --color-5: var(--red-5);}
[data-color="1"] { --color-1: var(--corail-1); --color-2: var(--corail-2); --color-3: var(--corail-3); --color-4: var(--corail-4); --color-5: var(--corail-5);}
[data-color="2"] { --color-1: var(--orange-1); --color-2: var(--orange-2); --color-3: var(--orange-3); --color-4: var(--orange-4); --color-5: var(--orange-5);}
diff --git a/examples/auto-layout/accordion/index.html b/examples/auto-layout/accordion/index.html
new file mode 100644
index 00000000..e1ab67d6
--- /dev/null
+++ b/examples/auto-layout/accordion/index.html
@@ -0,0 +1,119 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Auto layout / Accordion / Anime.js</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link href="../../assets/css/styles.css" rel="stylesheet">
+ <style>
+ body {
+ display: flex;
+ flex-direction: column;
+ justify-content: flex-start;
+ align-items: center;
+ width: 100%;
+ padding: 6rem 1rem;
+ min-height: 100lvh;
+ }
+ .accordion {
+ --padding: 1.25rem;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: flex-start;
+ width: 100%;
+ max-width: 32rem;
+ border-radius: 1rem;
+ overflow: hidden;
+ background-color: var(--bg-3);
+ }
+ .accordion section {
+ perspective: 1000px;
+ overflow: hidden;
+ width: 100%;
+ color: var(--color-1);
+ font-size: .825rem;
+ }
+ .accordion section:not(:last-child) {
+ border-bottom: 1px solid var(--bg-1);
+ }
+ .accordion button {
+ display: flex;
+ justify-content: space-between;
+ background: transparent;
+ height: auto;
+ width: 100%;
+ font-size: 1rem;
+ color: var(--fg-2);
+ cursor: pointer;
+ padding: var(--padding);
+ border-radius: 0;
+ transition: background-color .15s ease-out;
+ }
+ .accordion button .icon {
+ display: inline-block;
+ transform: rotate(45deg);
+ }
+ .accordion .content {
+ transform-style: preserve-3d;
+ display: none;
+ width: 100%;
+ padding: 0 var(--padding) var(--padding) var(--padding);
+ transform-origin: 50% 0px;
+ }
+ .accordion section.is-open .content {
+ display: block;
+ }
+ .accordion button:focus-visible,
+ .accordion section:hover button,
+ .accordion section.is-open button,
+ .accordion section:hover,
+ .accordion section.is-open {
+ color: var(--color-1);
+ background: var(--color-5);
+ outline: none;
+ transition-duration: none;
+ }
+ .accordion section.is-open button .icon {
+ transform: rotate(0deg);
+ }
+ </style>
+</head>
+<body>
+ <div class="accordion">
+ <section data-color="1">
+ <button>Mercury <span class="icon">×</span></button>
+ <div class="content"><p>Circles the Sun in only eighty-eight days, so its airless surface is blasted by radiation before plunging into frigid darkness each night. Craters overlap in chaotic mosaics and vast scarps wrinkle the crust where the entire planet shrank as its iron core cooled. Despite furnace-like daytime temperatures, radar has detected bright deposits of water ice tucked inside permanently shadowed polar craters. Spacecraft measurements show that this tiny world still hosts an active magnetic field, remnant volcanism, and intriguing hollows, proving that Mercury is far more dynamic than its cratered face suggests.</p></div>
+ </section>
+ <section data-color="2">
+ <button>Venus <span class="icon">×</span></button>
+ <div class="content"><p>Glows brilliantly in twilight because sunlight reflects off clouds packed with sulfuric acid droplets, yet those same clouds trap enough heat to bake the surface hotter than 470 °C. Atmospheric pressure equals standing nearly a kilometer under Earth’s oceans, crushing most landers within hours. Radar mapping uncovered tessera highlands, pancake domes, and channels carved by lava, revealing a world periodically resurfaced by massive eruptions. Lightning flashes inside the dense haze, and hurricane-strength winds race around the planet despite its extremely slow rotation, creating a greenhouse furnace unlike anywhere else in the Solar System.</p></div>
+ </section>
+ <section data-color="6">
+ <button>Earth <span class="icon">×</span></button>
+ <div class="content"><p>The only known planet where liquid water, protective magnetism, and an oxygen-rich atmosphere coexist to support complex life. Plate tectonics recycle crust, drive volcanism, and sculpt mountain ranges while oceans regulate climate and shuttle nutrients. The biosphere stretches from deep-sea vents to polar ice, constantly exchanging gases with the atmosphere. Our planet’s ozone layer filters harmful ultraviolet radiation, and the magnetic field deflects solar wind particles that would otherwise strip the air away. Earth’s constantly evolving landscapes, weather systems, and ecosystems are tightly coupled, making it a rare, self-sustaining oasis in space.</p></div>
+ </section>
+ <section data-color="0">
+ <button>Mars <span class="icon">×</span></button>
+ <div class="content"><p>A cold desert wrapped in a thin carbon-dioxide atmosphere that kicks up dust storms capable of engulfing the entire planet. Towering shield volcanoes like Olympus Mons dwarf Everest, while Valles Marineris carves a canyon system stretching the width of North America. Orbiters have mapped dry river deltas, layered sedimentary rocks, and recurring slope streaks hinting at seasonal brines. Rovers continue to drill into clay-rich outcrops, finding organic molecules and mineral evidence that ancient lakes existed for millions of years. Today, permafrost and buried ice preserve a chemical record of Mars’s more hospitable past.</p></div>
+ </section>
+ <section data-color="3">
+ <button>Jupiter <span class="icon">×</span></button>
+ <div class="content"><p>A colossal gas giant composed mainly of hydrogen and helium, with storm belts powered by deep internal heat and breakneck ten-hour rotation. The Great Red Spot, a spinning cyclone wider than Earth, has raged for centuries, while lightning and ammonia blizzards illuminate the turbulent cloud decks. Beneath the pastel bands lies a mantle of metallic hydrogen that conducts electricity and generates an enormous magnetic field extending millions of kilometers. Four large moons—Io, Europa, Ganymede, and Callisto—form a miniature planetary system whose volcanic eruptions and subsurface oceans are shaped by Jupiter’s immense gravity.</p></div>
+ </section>
+ <section data-color="4">
+ <button>Saturn <span class="icon">×</span></button>
+ <div class="content"><p>Pastel atmosphere hides fierce jet streams, but its shimmering rings steal the show: billions of icy grains orbiting within a disk only tens of meters thick. Shepherd moons sculpt gaps and produce ripples, demonstrating how gravity organizes material around planets. Saturn’s low density and rapid spin flatten the poles, while a deep layer of metallic hydrogen drives a magnetic field offset from the planet’s center. Moons like Titan and Enceladus harbor methane seas and geysering plumes that feed the faint E ring, making Saturn a laboratory for understanding both planetary interiors and moon-forming disks.</p></div>
+ </section>
+ <section data-color="8">
+ <button>Uranus <span class="icon">×</span></button>
+ <div class="content"><p>An ice giant tipped almost completely on its side, so its poles alternately bask in decades of continuous sunlight before plunging into equally long winters. Methane high in the atmosphere absorbs red light, giving the planet a calm cyan appearance occasionally punctuated by bright storms and polar vortices. A set of faint dark rings and small shepherd moons circle the equator, while larger moons display tectonic canyons and resurfaced plains that hint at ancient internal heat. Uranus’s magnetic field is wildly tilted and offset, causing auroras and charged-particle belts to wander unpredictably.</p></div>
+ </section>
+ <section data-color="10">
+ <button>Neptune <span class="icon">×</span></button>
+ <div class="content"><p>Orbits so far from the Sun that daylight is nine hundred times dimmer than on Earth, yet supersonic winds power storms bigger than continents. Methane clouds and high-altitude hazes create a deep sapphire hue interrupted by transient dark vortices and bright cirrus. A complex magnetosphere, offset from the planet’s center, produces wandering auroras, while the largest moon Triton orbits backward and erupts with nitrogen geysers. Neptune’s faint rings and small shepherd moons round out a system that continues to reveal surprises, offering the clearest glimpse of what icy exoplanets might look like.</p></div>
+ </section>
+ </div>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
diff --git a/examples/auto-layout/accordion/index.js b/examples/auto-layout/accordion/index.js
new file mode 100644
index 00000000..11d13182
--- /dev/null
+++ b/examples/auto-layout/accordion/index.js
@@ -0,0 +1,13 @@
+import { createLayout, spring } from '../../../dist/modules/index.js';
+
+const accordion = createLayout('.accordion', {
+ properties: ['background-color'],
+ ease: spring({ bounce: .2, duration: 450 }),
+ added: { opacity: 0, filter: 'blur(5px)' },
+ removed: { opacity: 0, filter: 'blur(5px)' }
+});
+
+document.addEventListener('click', event => {
+ const $toggled = event.target.closest('.accordion button');
+ if ($toggled) accordion.update(() => $toggled.parentElement.classList.toggle('is-open'))
+});
diff --git a/examples/auto-layout/cards/index-2.html b/examples/auto-layout/cards/index-2.html
deleted file mode 100644
index 1d5f1b8f..00000000
--- a/examples/auto-layout/cards/index-2.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Auto layout / anime.js</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link href="../../assets/css/styles.css" rel="stylesheet">
- <style>
- body {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: flex-start;
- width: 100%;
- min-height: 100lvh;
- --header-height: 4rem;
- touch-action: none;
- overscroll-behavior: none;
- overflow: hidden;
- }
- .container {
- transform-style: preserve-3d;
- perspective: 1000px;
- overflow: hidden;
- width: 100%;
- height: 100%;
- margin-left: auto;
- margin-right: auto;
- padding: calc(var(--header-height) + var(--padding) * 1) var(--padding);
- background-color: var(--bg-2);
- }
- #root {
- display: grid;
- grid-template-columns: repeat(18,3rem);
- grid-auto-rows: 3rem;
- gap: 0.25rem;
- width: 100%;
- height: 100lvh;
- }
- .controls {
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex-direction: row;
- flex-shrink: 1;
- position: relative;
- z-index: 1;
- top: 0px;
- width: 100%;
- height: var(--header-height);
- padding: var(--padding);
- background-color: var(--bg-3);
- border: var(--border-width) solid var(--bg-3);
- }
- .controls-group {
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex-direction: row;
- height: var(--header-height);
- gap: calc(var(--padding) * .5);
- }
- .controls.actions {
- left: 0px;
- }
- .controls.display {
- right: 0px;
- }
- .controls button {
- background-color: var(--bg-4);
- color: #FFF;
- flex-shrink: 1;
- }
- .controls button:hover {
- background-color: var(--bg-5);
- }
- .controls button.is-active {
- background-color: #FFF;
- color: var(--bg-3);
- }
- .element {
- transform-style: preserve-3d;
- position: relative;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- border: var(--border-width) solid var(--color-3);
- background-color: var(--color-5);
- color: var(--color-1);
- width: 3rem;
- height: 3rem;
- /*box-shadow: 0px .125rem .75rem 1px rgba(0, 0, 0, .075), 0px 0px 0px 1px rgba(0, 0, 0, .2);*/
- }
- .element-symbol {
- font-size: 2rem;
- }
- #root[data-layout="sphere"] {
- display: block;
- }
- #root[data-layout="sphere"] .element {
- position: absolute;
- top: 50%;
- left: 50%;
- margin: -1rem 0 0 -1rem;
- }
- </style>
-</head>
-<body>
- <div class="controls">
- <div class="controls-group display br">
- <button class="is-active toggle" id="table">table</button>
- <button class="toggle" id="sphere">sphere</button>
- </div>
- <div class="controls-group actions br">
- <button class="action" id="add">add</button>
- <button class="action" id="remove">remove</button>
- </div>
- </div>
- <template id="element">
- <div class="element" data-color="0">
- <div class="element-symbol"></div>
- </div>
- </template>
- <div id="root" class="container" data-layout="table">
- </div>
- <script type="module" src="./index.js"></script>
-</body>
-</html>
diff --git a/examples/auto-layout/cards/index.html b/examples/auto-layout/cards/index.html
deleted file mode 100644
index d0629834..00000000
--- a/examples/auto-layout/cards/index.html
+++ /dev/null
@@ -1,131 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Auto layout / anime.js</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link href="../../assets/css/styles.css" rel="stylesheet">
- <style>
- body {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: flex-start;
- width: 100%;
- min-height: 100lvh;
- --header-height: 4rem;
- touch-action: none;
- overscroll-behavior: none;
- overflow: hidden;
- }
- .container {
- transform-style: preserve-3d;
- perspective: 1000px;
- overflow: hidden;
- width: 100%;
- height: 100%;
- margin-left: auto;
- margin-right: auto;
- padding: calc(var(--header-height) + var(--padding) * 1) var(--padding);
- background-color: var(--bg-2);
- }
- #root {
- display: grid;
- grid-template-columns: repeat(18,3rem);
- grid-auto-rows: 3rem;
- gap: 0.25rem;
- width: 100%;
- height: 100lvh;
- }
- .controls {
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex-direction: row;
- flex-shrink: 1;
- position: relative;
- z-index: 1;
- top: 0px;
- width: 100%;
- height: var(--header-height);
- padding: var(--padding);
- background-color: var(--bg-3);
- border: var(--border-width) solid var(--bg-3);
- }
- .controls-group {
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex-direction: row;
- height: var(--header-height);
- gap: calc(var(--padding) * .5);
- }
- .controls.actions {
- left: 0px;
- }
- .controls.display {
- right: 0px;
- }
- .controls button {
- background-color: var(--bg-4);
- color: #FFF;
- flex-shrink: 1;
- }
- .controls button:hover {
- background-color: var(--bg-5);
- }
- .controls button.is-active {
- background-color: #FFF;
- color: var(--bg-3);
- }
- .element {
- transform-style: preserve-3d;
- position: relative;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- border: var(--border-width) solid var(--color-3);
- background-color: var(--color-5);
- color: var(--color-1);
- width: 3rem;
- height: 3rem;
- /*box-shadow: 0px .125rem .75rem 1px rgba(0, 0, 0, .075), 0px 0px 0px 1px rgba(0, 0, 0, .2);*/
- }
- .element.is-removed {
- visibility: hidden;
- }
- .element-symbol {
- font-size: 2rem;
- }
- #root[data-layout="sphere"] {
- display: block;
- }
- #root[data-layout="sphere"] .element {
- position: absolute;
- top: 50%;
- left: 50%;
- margin: -1rem 0 0 -1rem;
- }
- </style>
-</head>
-<body>
- <div class="controls">
- <div class="controls-group display br">
- <button class="is-active toggle" id="table">table</button>
- <button class="toggle" id="sphere">sphere</button>
- </div>
- <div class="controls-group actions br">
- <button class="action" id="add">add</button>
- <button class="action" id="remove">remove</button>
- </div>
- </div>
- <template id="element">
- <div class="element" data-color="0">
- <div class="element-symbol"></div>
- </div>
- </template>
- <div id="root" class="container" data-layout="table">
- </div>
- <script type="module" src="./index.js"></script>
-</body>
-</html>
diff --git a/examples/auto-layout/cards/index.js b/examples/auto-layout/cards/index.js
deleted file mode 100644
index e223d94f..00000000
--- a/examples/auto-layout/cards/index.js
+++ /dev/null
@@ -1,276 +0,0 @@
-import { createLayout, animate, utils, stagger } from '../../../dist/modules/index.js';
-
-const groups = [
- "Reactive nonmetal",
- "Noble gas",
- "Alkali metal",
- "Alkaline earth metal",
- "Metalloid",
- "Post-transition metal",
- "Transition metal",
- "Lanthanide",
- "Actinide",
- "Unknown"
-];
-
-const colors = [
- "red",
- "corail",
- "yellow",
- "citrus",
- "lime",
- "green",
- "emerald",
- "turquoise",
- "cyan",
- "sega"
-];
-
-const elements = [
- "H","Hydrogen","Lightest element ",0,1,1,
- "He","Helium","Inert gas ",1,18,1,
- "Li","Lithium","Soft reactive metal ",2,1,2,
- "Be","Beryllium","Hard light metal ",3,2,2,
- "B","Boron","Brittle metalloid ",4,13,2,
- "C","Carbon","Basis of life ",0,14,2,
- "N","Nitrogen","Major air component ",0,15,2,
- "O","Oxygen","Supports combustion ",0,16,2,
- "F","Fluorine","Most electronegative ",0,17,2,
- "Ne","Neon","Glows in signs ",1,18,2,
- "Na","Sodium","Reacts with water ",2,1,3,
- "Mg","Magnesium","Light structural metal ",3,2,3,
- "Al","Aluminium","Common light metal ",5,13,3,
- "Si","Silicon","Used in chips ",4,14,3,
- "P","Phosphorus","Essential for life ",0,15,3,
- "S","Sulfur","Yellow nonmetal ",0,16,3,
- "Cl","Chlorine","Green gas disinfectant ",0,17,3,
- "Ar","Argon","Inert in air ",1,18,3,
- "K","Potassium","Reactive soft metal ",2,1,4,
- "Ca","Calcium","Bone component ",3,2,4,
- "Sc","Scandium","Rare light metal ",6,3,4,
- "Ti","Titanium","Strong light metal ",6,4,4,
- "V","Vanadium","Steel alloys ",6,5,4,
- "Cr","Chromium","Chromium plating ",6,6,4,
- "Mn","Manganese","Steel additive ",6,7,4,
- "Fe","Iron","Structural metal ",6,8,4,
- "Co","Cobalt","Magnetic metal ",6,9,4,
- "Ni","Nickel","Corrosion-resistant ",6,10,4,
- "Cu","Copper","Conductive metal ",6,11,4,
- "Zn","Zinc","Galvanizing metal ",5,12,4,
- "Ga","Gallium","Melts in hand ",5,13,4,
- "Ge","Germanium","Semiconductor ",4,14,4,
- "As","Arsenic","Toxic metalloid ",4,15,4,
- "Se","Selenium","Photoconductor ",0,16,4,
- "Br","Bromine","Red-brown liquid ",0,17,4,
- "Kr","Krypton","Inert gas ",1,18,4,
- "Rb","Rubidium","Very reactive metal ",2,1,5,
- "Sr","Strontium","Red flame color ",3,2,5,
- "Y","Yttrium","Used in phosphors ",6,3,5,
- "Zr","Zirconium","Corrosion-resistant ",6,4,5,
- "Nb","Niobium","Superconducting alloys ",6,5,5,
- "Mo","Molybdenum","High-strength alloys ",6,6,5,
- "Tc","Technetium","Radioactive metal ",6,7,5,
- "Ru","Ruthenium","Platinum-group metal ",6,8,5,
- "Rh","Rhodium","Catalyst metal ",6,9,5,
- "Pd","Palladium","Catalyst & jewelry ",6,10,5,
- "Ag","Silver","Precious metal ",6,11,5,
- "Cd","Cadmium","Batteries, toxic ",5,12,5,
- "In","Indium","Used in displays ",5,13,5,
- "Sn","Tin","Solder component ",5,14,5,
- "Sb","Antimony","Flame retardants ",4,15,5,
- "Te","Tellurium","Alloying agent ",4,16,5,
- "I","Iodine","Purple halogen ",0,17,5,
- "Xe","Xenon","Bright discharge lamps ",1,18,5,
- "Cs","Cesium","Very soft, reactive ",2,1,6,
- "Ba","Barium","Contrast agents ",3,2,6,
- "Hf","Hafnium","Neutron absorber ",6,4,6,
- "Ta","Tantalum","Capacitor metal ",6,5,6,
- "W","Tungsten","High melting point ",6,6,6,
- "Re","Rhenium","High-temp superalloys ",6,7,6,
- "Os","Osmium","Very dense metal ",6,8,6,
- "Ir","Iridium","Corrosion-resistant ",6,9,6,
- "Pt","Platinum","Precious catalyst ",6,10,6,
- "Au","Gold","Precious yellow metal ",6,11,6,
- "Hg","Mercury","Liquid metal ",5,12,6,
- "Tl","Thallium","Toxic heavy metal ",5,13,6,
- "Pb","Lead","Dense soft metal ",5,14,6,
- "Bi","Bismuth","Low-toxicity heavy metal ",5,15,6,
- "Po","Polonium","Highly radioactive ",4,16,6,
- "At","Astatine","Rare halogen ",0,17,6,
- "Rn","Radon","Radioactive gas ",1,18,6,
- "Fr","Francium","Extremely rare ",2,1,7,
- "Ra","Radium","Highly radioactive ",3,2,7,
- "Rf","Rutherfordium","Synthetic element ",6,4,7,
- "Db","Dubnium","Synthetic element ",6,5,7,
- "Sg","Seaborgium","Synthetic element ",6,6,7,
- "Bh","Bohrium","Synthetic element ",6,7,7,
- "Hs","Hassium","Synthetic element ",6,8,7,
- "Mt","Meitnerium","Superheavy element ",9,9,7,
- "Ds","Darmstadtium","Superheavy element ",9,10,7,
- "Rg","Roentgenium","Superheavy element ",9,11,7,
- "Cn","Copernicium","Superheavy element ",9,12,7,
- "Nh","Nihonium","Superheavy element ",9,13,7,
- "Fl","Flerovium","Superheavy element ",9,14,7,
- "Mc","Moscovium","Superheavy element ",9,15,7,
- "Lv","Livermorium","Superheavy element ",9,16,7,
- "Ts","Tennessine","Superheavy element ",9,17,7,
- "Og","Oganesson","Superheavy element ",9,18,7,
- "La","Lanthanum","First lanthanide ",7,3,8,
- "Ce","Cerium","Polishing powders ",7,4,8,
- "Pr","Praseodymium","Magnet alloys ",7,5,8,
- "Nd","Neodymium","Strong magnets ",7,6,8,
- "Pm","Promethium","Radioactive ",7,7,8,
- "Sm","Samarium","Magnets & reactors ",7,8,8,
- "Eu","Europium","Red phosphors ",7,9,8,
- "Gd","Gadolinium","MRI contrast ",7,10,8,
- "Tb","Terbium","Green phosphors ",7,11,8,
- "Dy","Dysprosium","High-temp magnets ",7,12,8,
- "Ho","Holmium","Magnetic research ",7,13,8,
- "Er","Erbium","Optical fibers ",7,14,8,
- "Tm","Thulium","X-ray devices ",7,15,8,
- "Yb","Ytterbium","Laser materials ",7,16,8,
- "Lu","Lutetium","Catalysts, PET scans ",7,17,8,
- "Ac","Actinium","Strongly radioactive ",8,3,9,
- "Th","Thorium","Nuclear fuel ",8,4,9,
- "Pa","Protactinium","Rare radioactive ",8,5,9,
- "U","Uranium","Nuclear fuel ",8,6,9,
- "Np","Neptunium","Synthetic actinide ",8,7,9,
- "Pu","Plutonium","Nuclear material ",8,8,9,
- "Am","Americium","Smoke detectors ",8,9,9,
- "Cm","Curium","Synthetic actinide ",8,10,9,
- "Bk","Berkelium","Research element ",8,11,9,
- "Cf","Californium","Neutron source ",8,12,9,
- "Es","Einsteinium","Highly radioactive ",8,13,9,
- "Fm","Fermium","Synthetic element ",8,14,9,
- "Md","Mendelevium","Synthetic element ",8,15,9,
- "No","Nobelium","Synthetic element ",8,16,9,
- "Lr","Lawrencium","Synthetic element ",8,17,9
-];
-
-const latin = [
- "lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit",
- "sed", "do", "eiusmod", "tempor", "incididunt", "ut", "labore", "et",
- "dolore", "magna", "aliqua", "enim", "minim", "veniam", "quis", "nostrud",
- "exercitation", "ullamco", "laboris", "nisi", "aliquip", "ex", "ea",
- "commodo", "consequat", "duis", "aute", "irure", "dolor", "in", "reprehenderit", "voluptate"
-]
-
-let nextElementIndex = 0;
-
-const buttons = utils.$('.controls button');
-const toggles = utils.$('.controls button.toggle');
-const [ $root ] = utils.$('#root');
-
-function loremIpsum(words = 100) {
- let text = [];
- for (let i = 0; i < words; i++) {
- const w = latin[Math.floor(Math.random() * latin.length)];
- text.push(w);
- }
- let sentence = text.join(" ");
- return sentence.charAt(0).toUpperCase() + sentence.slice(1) + ".";
-}
-
-const actions = {
- add: () => {
- if (nextElementIndex >= elements.length) return;
- const template = utils.$('#element')[0];
- const $removed = utils.$('#root .element.is-removed')[0];
- let $elementTarget = $removed;
- if (!$elementTarget) {
- const clone = template.content.cloneNode(true);
- const $element = clone.querySelector('.element');
- if (!$element) return;
- const $image = $element.querySelector('.element-symbol');
- // const $title = $element.querySelector('.element-title');
- // const $group = $element.querySelector('.element-group');
- // const $intro = $element.querySelector('.element-intro-description');
- // const $description = $element.querySelector('.element-more-info');
- $image.textContent = elements[nextElementIndex + 0];
- // $title.textContent = elements[nextElementIndex + 1];
- // $group.textContent = groups[elements[nextElementIndex + 3]];
- // $intro.textContent = elements[nextElementIndex + 2] + loremIpsum(6);
- $element.dataset.x = elements[nextElementIndex + 4];
- $element.dataset.y = elements[nextElementIndex + 5];
- $element.dataset.color = elements[nextElementIndex + 3];
- $element.style.gridColumn = $element.dataset.x;
- $element.style.gridRow = $element.dataset.y;
- // $description.textContent = loremIpsum(utils.random(100, 150));
- nextElementIndex += 6;
- $elementTarget = $element;
- $root.appendChild(clone);
- }
- $elementTarget.classList.remove('is-removed');
- },
- remove: test=> {
- const $randomCard = utils.$('#root .element:not(.is-removed)').pop();
- if ($randomCard) $randomCard.classList.add('is-removed');
- // if ($randomCard) $randomCard.remove();
- }
-}
-
-const initialCards = elements.length;
-// const initialCards = 10;
-for (let i = 0; i < initialCards && nextElementIndex < elements.length; i++) {
- actions.add();
-}
-
-const elementsLayout = createLayout($root, {
- children: ['.element'],
- added: {
- transform: `translateY(150%) scale(.5)`,
- },
- removed: {
- opacity: 0,
- transform: (_, i) => {
- const seededRandom = utils.createSeededRandom(i);
- const direction = seededRandom(0, 1) ? -1 : 1;
- return `translateX(${150 * direction}%) rotate(${seededRandom(35, 90) * direction}deg)`;
- },
- }
-});
-
-buttons.forEach($button => {
- $button.onclick = () => {
- const seededRandom = utils.createSeededRandom(0);
- const isToggle = $button.classList.contains('toggle');
- const isAction = $button.classList.contains('action');
- const buttonId = $button.id;
- elementsLayout.update(() => {
- if (isToggle) {
- toggles.forEach(toggle => toggle.classList.remove('is-active'));
- $button.classList.add('is-active');
- } else if (isAction) {
- actions[buttonId]();
- }
- const elements = utils.$('#root .element:not(.is-removed)');
- const layoutType = utils.$('button.is-active')[0].id;
- const total = elements.length;
- const depthSteps = 1000;
-
- $root.dataset.layout = layoutType;
-
- if (total && layoutType === 'sphere') {
- const radius = 220;
- elements.forEach((el, i) => {
- const phi = Math.acos(-1 + (2 * i) / total);
- const theta = Math.sqrt(total * Math.PI) * phi;
- const sinPhi = Math.sin(phi);
- const x = radius * sinPhi * Math.cos(theta);
- const y = radius * Math.cos(phi);
- const z = 400 + (radius * sinPhi * Math.sin(theta));
- const yaw = Math.atan2(x, z);
- const pitch = -Math.atan2(y, Math.hypot(x, z));
- el.style.transform = `translate3d(${x}px, ${y}px, ${z}px) rotateY(${yaw}rad) rotateX(${pitch}rad)`;
-
- const normalizedZ = (z + radius) / (radius * 2); // 0 → far back, 1 → closest
- el.style.zIndex = Math.round(normalizedZ * depthSteps);
- });
- }
- }, {
- duration: isAction ? 1000 : 1000,
- ease: isAction ? 'out(3)' : 'inOut(3)',
- delay: isAction ? 0 : stagger([0, 2000])
- });
- }
-});
diff --git a/examples/auto-layout/code/index.html b/examples/auto-layout/code/index.html
index e3bbdb11..97a64281 100644
--- a/examples/auto-layout/code/index.html
+++ b/examples/auto-layout/code/index.html
@@ -9,23 +9,26 @@
<style>
body {
display: flex;
+ padding: 8rem;
justify-content: center;
align-items: center;
min-height: 100lvh;
}
- .kw { color: var(--white-1); } /* keywords / properties */
- .fn { color: var(--sky-1); } /* functions */
- .str { color: var(--lime-1); } /* strings */
+ .fn { color: var(--red-1); } /* functions */
+ .str { color: var(--citrus-1); } /* strings */
.var { color: var(--orange-1); } /* variables / identifiers */
.container {
position: relative;
- width: 72ch;
- padding: 1ch 4ch;
- overflow: hidden;
- background: var(--bg-3);
+ width: 100%;
+ max-width: 66ch;
+ padding: 1rem 2rem;
+ /*overflow: hidden;*/
+ background: var(--orange-6);
+ color: var(--corail-1);
border-radius: 1rem;
+ will-change: height;
}
.container .waapi,
@@ -38,14 +41,13 @@
.container .animejs,
.container.show-animejs .waapi {
position: absolute;
- top: 1ch;
- left: 4ch;
+ top: 1rem;
+ left: 2rem;
}
.container .waapi span,
.container.show-animejs .animejs span {
display: inline-block;
- will-change: translate;
}
.container .animejs span,
diff --git a/examples/auto-layout/code/index.js b/examples/auto-layout/code/index.js
index 06935538..aa5ace49 100644
--- a/examples/auto-layout/code/index.js
+++ b/examples/auto-layout/code/index.js
@@ -1,4 +1,4 @@
-import { createLayout, stagger } from '../../../../dist/modules/index.js';
+import { createLayout, $, stagger, random, spring } from '../../../../dist/modules/index.js';
const keywordSet = /^(const|let|var|function|return|if|else|for|while|new|this|true|false|null|undefined|async|await|import|export|from|class|extends)$/;
const tokenRegex = /(['"`])(?:\\.|[^\\])*?\1|[a-zA-Z_$][a-zA-Z0-9_$]*|\s+|[^a-zA-Z_$'"`\s]+/g;
@@ -8,53 +8,52 @@ function highlightCode(el) {
const tokens = code.match(tokenRegex) || [];
const counts = {};
let html = '';
-
for (let i = 0; i < tokens.length; i++) {
const t = tokens[i];
- const escaped = t.replace(/</g, '&lt;').replace(/>/g, '&gt;');
-
- // Whitespace - keep as is
if (/^\s+$/.test(t)) {
- html += escaped;
+ html += t;
continue;
}
-
- // Track occurrence count
counts[t] = (counts[t] || 0) + 1;
const dataAttr = `data-layout-id="${t}-${counts[t]}"`;
-
- // String
if (/^['"`]/.test(t)) {
- html += `<span class="str" ${dataAttr}>${escaped}</span>`;
+ html += `<span class="str" ${dataAttr}>${t}</span>`;
}
- // Identifier
else if (/^[a-zA-Z_$]/.test(t)) {
const rest = tokens.slice(i + 1).join('').trimStart();
const isFunction = rest.startsWith('(');
const cls = keywordSet.test(t) ? 'kw' : isFunction ? 'fn' : 'var';
- html += `<span class="${cls}" ${dataAttr}>${escaped}</span>`;
+ html += `<span class="${cls}" ${dataAttr}>${t}</span>`;
}
- // Punctuation/operators
else {
- html += `<span class="op" ${dataAttr}>${escaped}</span>`;
+ html += `<span class="op" ${dataAttr}>${t}</span>`;
}
}
-
el.innerHTML = html;
}
-document.querySelectorAll('code').forEach(highlightCode);
+$('code').forEach(highlightCode);
const layout = createLayout('.container', {
- children: ['code', 'span'],
- duration: 1500,
- delay: stagger([0, 250])
+ loop: true,
+ alternate: true,
+ loopDelay: 500,
+ duration: 1000,
+ delay: 150,
+ ease: 'inOutExpo',
+ enterFrom: {
+ opacity: 0,
+ duration: 1250,
+ delay: 300,
+ },
+ leaveTo: {
+ opacity: 0,
+ // color: 'var(--white-2)',
+ transform: () => `translate(${random(-50, 50)}px, ${random(-200, 200)}px) rotate(${random(-30, 30)}deg)`,
+ duration: 750,
+ delay: stagger([0, 200], { from: 'random' }),
+ ease: 'out(3)'
+ }
});
-const animate = () => {
- return layout.update(({root}) => {
- root.classList.toggle('show-animejs');
- }).timeline.then(animate);
-}
-
-animate();
\ No newline at end of file
+document.fonts.ready.then(() => layout.update(({ root }) => root.classList.toggle('show-animejs')))
diff --git a/examples/auto-layout/nav/index.html b/examples/auto-layout/nav/index.html
new file mode 100644
index 00000000..5326a737
--- /dev/null
+++ b/examples/auto-layout/nav/index.html
@@ -0,0 +1,128 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Auto layout / Nav / Anime.js</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link href="../../assets/css/styles.css" rel="stylesheet">
+ <style>
+ body {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ padding: 6rem 1rem;
+ min-height: 100lvh;
+ }
+ nav {
+ overflow-x: scroll;
+ display: flex;
+ width: 100%;
+ border-top-left-radius: 1rem;
+ border-top-right-radius: 1rem;
+ background-color: var(--bg-2);
+ }
+ nav ul {
+ position: relative;
+ display: flex;
+ flex-shrink: 0;
+ padding: 1rem;
+ list-style: none;
+ }
+ nav button {
+ flex: 1;
+ position: relative;
+ z-index: 1;
+ background: transparent;
+ color: var(--fg-2);
+ }
+ nav button:not(:disabled):focus-visible,
+ nav button:not(:disabled):hover,
+ nav button:has(.button-bg) {
+ z-index: 0;
+ color: var(--color-1);
+ background: transparent;
+ outline: none;
+ }
+ nav button .button-bg {
+ position: absolute;
+ z-index: 0;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: var(--color-4);
+ border-radius: .25rem;
+ border: 1px solid var(--color-2);
+ }
+ nav button .button-txt {
+ position: relative;
+ z-index: 1;
+ }
+ .container {
+ width: 100%;
+ max-width: 42rem;
+ border-radius: 1rem;
+ background: var(--bg-3);
+ }
+ .content {
+ width: 100%;
+ padding: 2rem;
+ }
+ .content h1 {
+ color: var(--color-1);
+ margin-bottom: 1em;
+ }
+ .content section {
+ display: none;
+ }
+ .content section.is-active {
+ display: block;
+ }
+ </style>
+</head>
+<body>
+ <div class="container">
+ <nav>
+ <ul>
+ <li><button data-color="1" class="is-active"><span class="button-txt">Mercury</span><span class="button-bg"></span></button></li>
+ <li><button data-color="2"><span class="button-txt">Venus</span></button></li>
+ <li><button data-color="6"><span class="button-txt">Earth</span></button></li>
+ <li><button data-color="0"><span class="button-txt">Mars</span></button></li>
+ <li><button data-color="3"><span class="button-txt">Jupiter</span></button></li>
+ <li><button data-color="4"><span class="button-txt">Saturn</span></button></li>
+ <li><button data-color="8"><span class="button-txt">Uranus</span></button></li>
+ <li><button data-color="10"><span class="button-txt">Neptune</span></button></li>
+ </ul>
+ </nav>
+ <div class="content">
+ <section data-color="1" class="planet is-active">
+ <p>The smallest planet in our solar system and closest to the Sun, Mercury is only slightly larger than Earth's Moon. With extreme temperatures ranging from -290°F to 800°F, this rocky world has a cratered surface similar to our Moon.</p>
+ </section>
+ <section data-color="2" class="planet">
+ <p>Venus is the second planet from the Sun and is similar in size to Earth. Its thick atmosphere traps heat, making it the hottest planet in our solar system. The surface of Venus is a scorching 867°F.</p>
+ </section>
+ <section data-color="6" class="planet">
+ <p>Earth is the third planet from the Sun and the only known planet to harbor life. It has a diverse environment with oceans, continents, and a protective atmosphere. The average surface temperature is about 61°F.</p>
+ </section>
+ <section data-color="0" class="planet">
+ <p>Mars, the fourth planet from the Sun, is often called the "Red Planet" due to its rusty color. It has a thin atmosphere and a cold, desert-like surface with a temperature averaging -81°F.</p>
+ </section>
+ <section data-color="3" class="planet">
+ <p>Jupiter is the largest planet in our solar system, a gas giant with a powerful atmosphere. It's known for its Great Red Spot, a giant storm. The cloud-top temperature is around -234°F.</p>
+ </section>
+ <section data-color="4" class="planet">
+ <p>Saturn, the sixth planet from the Sun, is famous for its prominent rings made of ice and rock. It's a gas giant with a cloud-top temperature of about -288°F.</p>
+ </section>
+ <section data-color="8" class="planet">
+ <p>Uranus is the seventh planet from the Sun and an ice giant. It rotates on its side, giving it unique seasons. The cloud-top temperature is around -357°F.</p>
+ </section>
+ <section data-color="10" class="planet">
+ <p>Neptune is the eighth and farthest planet from the Sun. It's another ice giant with strong winds and a deep blue color. The cloud-top temperature is about -353°F.</p>
+ </section>
+ </div>
+ </div>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
diff --git a/examples/auto-layout/nav/index.js b/examples/auto-layout/nav/index.js
new file mode 100644
index 00000000..c39b938a
--- /dev/null
+++ b/examples/auto-layout/nav/index.js
@@ -0,0 +1,32 @@
+import { createLayout, spring, $ } from '../../../dist/modules/index.js';
+
+const nav = createLayout('nav ul', {
+ ease: spring({ bounce: .2, duration: 350 }),
+});
+
+const content = createLayout('.content', {
+ enterFrom: {
+ opacity: 0,
+ duration: 500,
+ delay: 200,
+ ease: 'inOut(3)'
+ },
+ leaveTo: {
+ opacity: 0,
+ duration: 500,
+ ease: 'out(3)'
+ },
+});
+
+document.onclick = e => {
+ const $button = e.target.closest('button');
+ if ($button) {
+ nav.update(() => {
+ content.record();
+ $button.appendChild($('.button-bg')[0]);
+ $('section').forEach($section => $section.classList.remove('is-active'));
+ $(`section[data-color="${$button.dataset.color}"]`)[0].classList.add('is-active');
+ content.animate();
+ });
+ }
+}
diff --git a/examples/auto-layout/periodic-table/index.html b/examples/auto-layout/periodic-table/index.html
new file mode 100644
index 00000000..0d5824a3
--- /dev/null
+++ b/examples/auto-layout/periodic-table/index.html
@@ -0,0 +1,223 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Auto layout / anime.js</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link href="../../assets/css/styles.css" rel="stylesheet">
+ <style>
+ body {
+ --header-height: 4rem;
+ display: flex;
+ flex-direction: column;
+ min-height: 100lvh;
+ overflow: hidden;
+ perspective: 1000px;
+ }
+ #scene {
+ position: fixed;
+ transform-style: preserve-3d;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ padding: calc(var(--header-height) + var(--padding)) var(--padding) var(--padding);
+ inset: 0;
+ padding: var(--header-height) var(--padding);
+ }
+ #scene-content {
+ pointer-events: none;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ transform-style: preserve-3d;
+ backface-visibility: hidden;
+ }
+ #scene-content[data-layout="table"] {
+ display: grid;
+ grid-template-columns: repeat(18, var(--w));
+ grid-auto-rows: var(--h);
+ gap: 0.25rem;
+ place-content: center;
+ }
+ .controls {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: row;
+ flex-shrink: 1;
+ position: fixed;
+ z-index: 3;
+ top: 0px;
+ width: 100%;
+ height: var(--header-height);
+ padding: var(--padding);
+ }
+ .controls-group {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ flex-direction: row;
+ height: var(--header-height);
+ gap: calc(var(--padding) * .5);
+ }
+ .controls button {
+ background-color: var(--bg-4);
+ color: var(--fg-1);
+ flex-shrink: 1;
+ }
+ .controls button:hover {
+ background-color: var(--bg-5);
+ }
+ .controls button.is-active {
+ background-color: var(--fg-1);
+ color: var(--bg-3);
+ }
+ .credits {
+ text-align: center;
+ position: fixed;
+ z-index: 1;
+ bottom: 0px;
+ width: 100%;
+ height: var(--header-height);
+ padding: var(--padding);
+ font-size: .75rem;
+ }
+ .credits a {
+ color: var(--red-1);
+ text-decoration: none;
+ }
+ .element {
+ overflow: hidden;
+ pointer-events: auto;
+ --w: 3.5rem;
+ --h: 4rem;
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: space-between;
+ border: 1px solid var(--color-3);
+ background-color: var(--color-5);
+ color: var(--color-1);
+ width: var(--w);
+ height: var(--h);
+ border-radius: .25rem;
+ padding: .25rem;
+ transform-style: preserve-3d;
+ z-index: 8;
+ cursor: pointer;
+ }
+ button.element:focus-visible,
+ button.element:hover {
+ border: 1px solid var(--color-1);
+ background-color: var(--color-4);
+ color: var(--color-1);
+ outline: none;
+ }
+ .element.is-expanded {
+ --w: 13rem;
+ --h: 13rem;
+ z-index: 1;
+ padding: 1rem;
+ align-items: flex-start;
+ }
+ .element-description {
+ display: none;
+ transform-style: preserve-3d;
+ flex-direction: column;
+ gap: .25rem;
+ width: 100%;
+ font-size: .625rem;
+ text-transform: none;
+ color: var(--color-1);
+ justify-self: flex-end;
+ margin-top: 1.5rem;
+ text-align: left;
+ }
+ .element.is-expanded .element-description {
+ display: block;
+ }
+ .element-symbol {
+ transform-style: preserve-3d;
+ margin-top: -.1rem;
+ margin-bottom: .2rem;
+ font-size: 1.5rem;
+ font-weight: 700;
+ }
+ .element.is-expanded .element-symbol {
+ margin-top: 0;
+ margin-bottom: 0;
+ font-size: 1rem;
+ text-align: left;
+ }
+ .element-title {
+ transform-style: preserve-3d;
+ font-size: .5rem;
+ font-weight: 700;
+ text-align: center;
+ }
+ .element.is-expanded .element-title {
+ font-size: 1.5rem;
+ text-align: left;
+ margin-top: 1rem;
+ }
+ .element-number {
+ transform-style: preserve-3d;
+ font-size: .5rem;
+ text-align: right;
+ align-self: flex-end;
+ }
+ .element.is-expanded .element-number {
+ position: absolute;
+ font-size: 1rem;
+ top: 1rem;
+ right: 1rem;
+ }
+ #scene-content[data-layout="sphere"] .element,
+ #scene-content[data-layout="helix"] .element,
+ #scene-content[data-layout="grid"] .element {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ margin-left: calc(var(--w) * -.5);
+ margin-top: calc(var(--h) * -.5);
+ }
+ #scene-content[data-layout="table"] .element.is-expanded {
+ left: -1.625rem;
+ top: -1.25rem;
+ margin-left: calc(var(--w) * -.25);
+ margin-top: calc(var(--h) * -.25);
+ margin-right: calc(var(--w) * -.5);
+ margin-bottom: calc(var(--h) * -.5);
+ }
+ </style>
+</head>
+<body data-layout="table">
+ <div class="controls">
+ <div class="controls-group display br">
+ <button class="is-active toggle" id="table">table</button>
+ <button class="toggle" id="sphere">sphere</button>
+ <button class="toggle" id="helix">helix</button>
+ <button class="toggle" id="grid">grid</button>
+ </div>
+ </div>
+ <div id="scene">
+ <div id="scene-content" data-layout="table"></div>
+ </div>
+ <div class="credits">
+ 3D transform calculations ported from this three.js <a href="https://threejs.org/examples/css3d_periodictable.html" target="_blank">demo</a>.
+ </div>
+ <template id="element">
+ <button class="element" data-color="0">
+ <div class="element-number"></div>
+ <div class="element-symbol"></div>
+ <div class="element-title"></div>
+ <div class="element-description"></div>
+ </button>
+ </template>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
diff --git a/examples/auto-layout/periodic-table/index.js b/examples/auto-layout/periodic-table/index.js
new file mode 100644
index 00000000..ba38485c
--- /dev/null
+++ b/examples/auto-layout/periodic-table/index.js
@@ -0,0 +1,318 @@
+import { createLayout, utils, stagger, spring, createTimer, createAnimatable } from '../../../dist/modules/index.js';
+
+// Elements data to populate the table
+
+const ELEMENT_FIELDS = {
+ SYMBOL: 0,
+ NAME: 1,
+ COLOR: 2,
+ COLUMN: 3,
+ ROW: 4,
+ ATOMIC_MASS: 5,
+ DENSITY: 6,
+ MELTING_POINT: 7,
+ BOILING_POINT: 8,
+};
+const ELEMENT_STRIDE = 9;
+
+const elements = [
+ // symbol, name, color, column, row, atomicMass, density, meltingPoint, boilingPoint
+ 'H', 'Hydrogen', 0, 1, 1, 1.008, 0.08988, -259.16, -252.88,
+ 'He', 'Helium', 1, 18, 1, 4.0026022, 0.1786, -272.2, -268.93,
+ 'Li', 'Lithium', 2, 1, 2, 6.94, 0.534, 180.5, 1329.85,
+ 'Be', 'Beryllium', 3, 2, 2, 9.01218315, 1.85, 1286.85, 2468.85,
+ 'B', 'Boron', 4, 13, 2, 10.81, 2.08, 2075.85, 3926.85,
+ 'C', 'Carbon', 0, 14, 2, 12.011, 1.821, null, null,
+ 'N', 'Nitrogen', 0, 15, 2, 14.007, 1.251, -210, -195.79,
+ 'O', 'Oxygen', 0, 16, 2, 15.999, 1.429, -218.79, -182.96,
+ 'F', 'Fluorine', 0, 17, 2, 18.9984031636, 1.696, -219.67, -188.12,
+ 'Ne', 'Neon', 1, 18, 2, 20.17976, 0.9002, -248.59, -246.05,
+ 'Na', 'Sodium', 2, 1, 3, 22.989769282, 0.968, 97.79, 882.94,
+ 'Mg', 'Magnesium', 3, 2, 3, 24.305, 1.738, 649.85, 1089.85,
+ 'Al', 'Aluminium', 5, 13, 3, 26.98153857, 2.7, 660.32, 2469.85,
+ 'Si', 'Silicon', 4, 14, 3, 28.085, 2.329, 1413.85, 3264.85,
+ 'P', 'Phosphorus', 0, 15, 3, 30.9737619985, 1.823, null, null,
+ 'S', 'Sulfur', 0, 16, 3, 32.06, 2.07, 115.21, 444.65,
+ 'Cl', 'Chlorine', 0, 17, 3, 35.45, 3.2, -101.55, -34.04,
+ 'Ar', 'Argon', 1, 18, 3, 39.9481, 1.784, -189.34, -185.85,
+ 'K', 'Potassium', 2, 1, 4, 39.09831, 0.862, 63.55, 758.85,
+ 'Ca', 'Calcium', 3, 2, 4, 40.0784, 1.55, 841.85, 1483.85,
+ 'Sc', 'Scandium', 6, 3, 4, 44.9559085, 2.985, 1540.85, 2835.85,
+ 'Ti', 'Titanium', 6, 4, 4, 47.8671, 4.506, 1667.85, 3286.85,
+ 'V', 'Vanadium', 6, 5, 4, 50.94151, 6, 1909.85, 3406.85,
+ 'Cr', 'Chromium', 6, 6, 4, 51.99616, 7.19, 1906.85, 2670.85,
+ 'Mn', 'Manganese', 6, 7, 4, 54.9380443, 7.21, 1245.85, 2060.85,
+ 'Fe', 'Iron', 6, 8, 4, 55.8452, 7.874, 1537.85, 2860.85,
+ 'Co', 'Cobalt', 6, 9, 4, 58.9331944, 8.9, 1494.85, 2926.85,
+ 'Ni', 'Nickel', 6, 10, 4, 58.69344, 8.908, 1454.85, 2729.85,
+ 'Cu', 'Copper', 6, 11, 4, 63.5463, 8.96, 1084.62, 2561.85,
+ 'Zn', 'Zinc', 5, 12, 4, 65.382, 7.14, 419.53, 906.85,
+ 'Ga', 'Gallium', 5, 13, 4, 69.7231, 5.91, 29.76, 2399.85,
+ 'Ge', 'Germanium', 4, 14, 4, 72.6308, 5.323, 938.25, 2832.85,
+ 'As', 'Arsenic', 4, 15, 4, 74.9215956, 5.727, null, null,
+ 'Se', 'Selenium', 0, 16, 4, 78.9718, 4.81, 220.85, 684.85,
+ 'Br', 'Bromine', 0, 17, 4, 79.904, 3.1028, -7.35, 58.85,
+ 'Kr', 'Krypton', 1, 18, 4, 83.7982, 3.749, -157.37, -153.22,
+ 'Rb', 'Rubidium', 2, 1, 5, 85.46783, 1.532, 39.3, 687.85,
+ 'Sr', 'Strontium', 3, 2, 5, 87.621, 2.64, 776.85, 1376.85,
+ 'Y', 'Yttrium', 6, 3, 5, 88.905842, 4.472, 1525.85, 2929.85,
+ 'Zr', 'Zirconium', 6, 4, 5, 91.2242, 6.52, 1854.85, 4376.85,
+ 'Nb', 'Niobium', 6, 5, 5, 92.906372, 8.57, 2476.85, 4743.85,
+ 'Mo', 'Molybdenum', 6, 6, 5, 95.951, 10.28, 2622.85, 4638.85,
+ 'Tc', 'Technetium', 6, 7, 5, 98, 11, 2156.85, 4264.85,
+ 'Ru', 'Ruthenium', 6, 8, 5, 101.072, 12.45, 2333.85, 4149.85,
+ 'Rh', 'Rhodium', 6, 9, 5, 102.905502, 12.41, 1963.85, 3694.85,
+ 'Pd', 'Palladium', 6, 10, 5, 106.421, 12.023, 1554.9, 2962.85,
+ 'Ag', 'Silver', 6, 11, 5, 107.86822, 10.49, 961.78, 2161.85,
+ 'Cd', 'Cadmium', 5, 12, 5, 112.4144, 8.65, 321.07, 766.85,
+ 'In', 'Indium', 5, 13, 5, 114.8181, 7.31, 156.6, 2071.85,
+ 'Sn', 'Tin', 5, 14, 5, 118.7107, 7.365, 231.93, 2601.85,
+ 'Sb', 'Antimony', 4, 15, 5, 121.7601, 6.697, 630.63, 1634.85,
+ 'Te', 'Tellurium', 4, 16, 5, 127.603, 6.24, 449.51, 987.85,
+ 'I', 'Iodine', 0, 17, 5, 126.904473, 4.933, 113.7, 184.25,
+ 'Xe', 'Xenon', 1, 18, 5, 131.2936, 5.894, -111.75, -108.1,
+ 'Cs', 'Cesium', 2, 1, 6, 132.905451966, 1.93, 28.55, 670.85,
+ 'Ba', 'Barium', 3, 2, 6, 137.3277, 3.51, 726.85, 1844.85,
+ 'Hf', 'Hafnium', 6, 4, 6, 178.492, 13.31, 2232.85, 4602.85,
+ 'Ta', 'Tantalum', 6, 5, 6, 180.947882, 16.69, 3016.85, 5457.85,
+ 'W', 'Tungsten', 6, 6, 6, 183.841, 19.25, 3421.85, 5929.85,
+ 'Re', 'Rhenium', 6, 7, 6, 186.2071, 21.02, 3185.85, 5595.85,
+ 'Os', 'Osmium', 6, 8, 6, 190.233, 22.59, 3032.85, 5011.85,
+ 'Ir', 'Iridium', 6, 9, 6, 192.2173, 22.56, 2445.85, 4129.85,
+ 'Pt', 'Platinum', 6, 10, 6, 195.0849, 21.45, 1768.25, 3824.85,
+ 'Au', 'Gold', 6, 11, 6, 196.9665695, 19.3, 1064.18, 2969.85,
+ 'Hg', 'Mercury', 5, 12, 6, 200.5923, 13.534, -38.83, 356.73,
+ 'Tl', 'Thallium', 5, 13, 6, 204.38, 11.85, 303.85, 1472.85,
+ 'Pb', 'Lead', 5, 14, 6, 207.21, 11.34, 327.46, 1748.85,
+ 'Bi', 'Bismuth', 5, 15, 6, 208.980401, 9.78, 271.55, 1563.85,
+ 'Po', 'Polonium', 4, 16, 6, 209, 9.196, 253.85, 961.85,
+ 'At', 'Astatine', 0, 17, 6, 210, 6.35, 301.85, 336.85,
+ 'Rn', 'Radon', 1, 18, 6, 222, 9.73, -71.15, -61.65,
+ 'Fr', 'Francium', 2, 1, 7, 223, 1.87, 26.85, 676.85,
+ 'Ra', 'Radium', 3, 2, 7, 226, 5.5, 959.85, 1736.85,
+ 'Rf', 'Rutherfordium', 6, 4, 7, 267, 23.2, 2126.85, 5526.85,
+ 'Db', 'Dubnium', 6, 5, 7, 268, 29.3, null, null,
+ 'Sg', 'Seaborgium', 6, 6, 7, 269, 35, null, null,
+ 'Bh', 'Bohrium', 6, 7, 7, 270, 37.1, null, null,
+ 'Hs', 'Hassium', 6, 8, 7, 269, 40.7, -147.15, null,
+ 'Mt', 'Meitnerium', 9, 9, 7, 278, 37.4, null, null,
+ 'Ds', 'Darmstadtium', 9, 10, 7, 281, 34.8, null, null,
+ 'Rg', 'Roentgenium', 9, 11, 7, 282, 28.7, null, null,
+ 'Cn', 'Copernicium', 9, 12, 7, 285, 14, null, 3296.85,
+ 'Nh', 'Nihonium', 9, 13, 7, 286, 16, 426.85, 1156.85,
+ 'Fl', 'Flerovium', 9, 14, 7, 289, 14, 66.85, 146.85,
+ 'Mc', 'Moscovium', 9, 15, 7, 289, 13.5, 396.85, 1126.85,
+ 'Lv', 'Livermorium', 9, 16, 7, 293, 12.9, 435.85, 811.85,
+ 'Ts', 'Tennessine', 9, 17, 7, 294, 7.17, 449.85, 609.85,
+ 'Og', 'Oganesson', 9, 18, 7, 294, 4.95, null, 76.85,
+ 'La', 'Lanthanum', 7, 3, 8, 138.905477, 6.162, 919.85, 3463.85,
+ 'Ce', 'Cerium', 7, 4, 8, 140.1161, 6.77, 794.85, 3442.85,
+ 'Pr', 'Praseodymium', 7, 5, 8, 140.907662, 6.77, 934.85, 3129.85,
+ 'Nd', 'Neodymium', 7, 6, 8, 144.2423, 7.01, 1023.85, 3073.85,
+ 'Pm', 'Promethium', 7, 7, 8, 145, 7.26, 1041.85, 2999.85,
+ 'Sm', 'Samarium', 7, 8, 8, 150.362, 7.52, 1071.85, 1899.85,
+ 'Eu', 'Europium', 7, 9, 8, 151.9641, 5.264, 825.85, 1528.85,
+ 'Gd', 'Gadolinium', 7, 10, 8, 157.253, 7.9, 1311.85, 2999.85,
+ 'Tb', 'Terbium', 7, 11, 8, 158.925352, 8.23, 1355.85, 3122.85,
+ 'Dy', 'Dysprosium', 7, 12, 8, 162.5001, 8.54, 1406.85, 2566.85,
+ 'Ho', 'Holmium', 7, 13, 8, 164.930332, 8.79, 1460.85, 2599.85,
+ 'Er', 'Erbium', 7, 14, 8, 167.2593, 9.066, 1528.85, 2867.85,
+ 'Tm', 'Thulium', 7, 15, 8, 168.934222, 9.32, 1544.85, 1949.85,
+ 'Yb', 'Ytterbium', 7, 16, 8, 173.0451, 6.9, 823.85, 1195.85,
+ 'Lu', 'Lutetium', 7, 17, 8, 174.96681, 9.841, 1651.85, 3401.85,
+ 'Ac', 'Actinium', 8, 3, 9, 227, 10, 1226.85, 3226.85,
+ 'Th', 'Thorium', 8, 4, 9, 232.03774, 11.724, 1749.85, 4787.85,
+ 'Pa', 'Protactinium', 8, 5, 9, 231.035882, 15.37, 1567.85, 4026.85,
+ 'U', 'Uranium', 8, 6, 9, 238.028913, 19.1, 1132.15, 4130.85,
+ 'Np', 'Neptunium', 8, 7, 9, 237, 20.45, 638.85, 4173.85,
+ 'Pu', 'Plutonium', 8, 8, 9, 244, 19.816, 639.35, 3231.85,
+ 'Am', 'Americium', 8, 9, 9, 243, 12, 1175.85, 2606.85,
+ 'Cm', 'Curium', 8, 10, 9, 247, 13.51, 1339.85, 3109.85,
+ 'Bk', 'Berkelium', 8, 11, 9, 247, 14.78, 985.85, 2626.85,
+ 'Cf', 'Californium', 8, 12, 9, 251, 15.1, 899.85, 1469.85,
+ 'Es', 'Einsteinium', 8, 13, 9, 252, 8.84, 859.85, 995.85,
+ 'Fm', 'Fermium', 8, 14, 9, 257, null, 1526.85, null,
+ 'Md', 'Mendelevium', 8, 15, 9, 258, null, 826.85, null,
+ 'No', 'Nobelium', 8, 16, 9, 259, null, 826.85, null,
+ 'Lr', 'Lawrencium', 8, 17, 9, 266, null, 1626.85, null,
+]
+
+// Genetate the table html
+
+const [ $sceneContent ] = utils.$('#scene-content');
+const [ $template ] = utils.$('#element');
+
+for (let i = 0, l = elements.length / ELEMENT_STRIDE; i < l; i += 1) {
+ const offset = i * ELEMENT_STRIDE;
+ const $el = $template.content.cloneNode(true);
+ const $element = $el.querySelector('.element');
+ const $number = $element.querySelector('.element-number');
+ const $symbol = $element.querySelector('.element-symbol');
+ const $title = $element.querySelector('.element-title');
+ const $description = $element.querySelector('.element-description');
+ $number.textContent = i + 1;
+ $symbol.textContent = elements[offset + ELEMENT_FIELDS.SYMBOL];
+ $title.textContent = elements[offset + ELEMENT_FIELDS.NAME];
+ $element.dataset.color = elements[offset + ELEMENT_FIELDS.COLOR];
+ $element.style.gridColumn = elements[offset + ELEMENT_FIELDS.COLUMN];
+ $element.style.gridRow = elements[offset + ELEMENT_FIELDS.ROW];
+ $description.innerHTML = [
+ `Atomic mass: ${elements[offset + ELEMENT_FIELDS.ATOMIC_MASS]} u`,
+ `Density: ${elements[offset + ELEMENT_FIELDS.DENSITY]} g/cm3`,
+ `Melting: ${elements[offset + ELEMENT_FIELDS.MELTING_POINT]} &deg;C`,
+ `Boiling: ${elements[offset + ELEMENT_FIELDS.BOILING_POINT]} &deg;C`,
+ ].join('<br>');
+ $sceneContent.appendChild($el);
+}
+
+const cards = utils.$('#scene-content .element');
+
+// Create the cards layout and register the font-size as an extra property for animation
+const elementsLayout = createLayout($sceneContent, {
+ properties: ['font-size'],
+ duration: 2000,
+ ease: 'inOutExpo',
+});
+
+// Move the scene relative to the cursor position
+const sceneAnimatable = createAnimatable('#scene', { rotateX: 200, rotateY: 200 });
+const pointer = { x: 0, y: 0, rotateX: 15, rotateY: 20, rx: 0, ry: 0 };
+
+createTimer({
+ onUpdate: () => {
+ pointer.rx = utils.lerp(pointer.rx, pointer.rotateX, .01);
+ pointer.ry = utils.lerp(pointer.ry, pointer.rotateY, .01);
+ sceneAnimatable.rotateX(pointer.y * pointer.rx);
+ sceneAnimatable.rotateY(pointer.x * pointer.ry);
+ }
+});
+
+// The different layout tranform
+const transformLayout = {
+ table: () => {
+ // The table view use CSS grid and has no special tranforms except for a selected element
+ pointer.rotateX = 15;
+ pointer.rotateY = 20;
+ cards.forEach($el => {
+ $el.style.opacity = 1;
+ $el.style.transform = $el.classList.contains('is-expanded') ? 'translateZ(50px)' : 'translateZ(10px)';
+ });
+ },
+ sphere: () => {
+ const radius = 300;
+ pointer.rotateX = 40;
+ pointer.rotateY = 360;
+ cards.forEach(($el, i) => {
+ const offsetZ = $el.classList.contains('is-expanded') ? 20 : 0;
+ const phi = Math.acos(-1 + (2 * i) / cards.length);
+ const theta = Math.sqrt(cards.length * Math.PI) * phi;
+ const sinPhi = Math.sin(phi);
+ const x = radius * sinPhi * Math.cos(theta);
+ const y = radius * Math.cos(phi);
+ const z = radius * sinPhi * Math.sin(theta);
+ const yaw = Math.atan2(x, z);
+ const pitch = -Math.atan2(y, Math.hypot(x, z));
+ $el.style.transform = `translate3d(${x}px, ${y}px, ${z}px) rotateY(${yaw}rad) rotateX(${pitch}rad) translateZ(${offsetZ}px)`;
+ });
+ },
+ helix: () => {
+ pointer.rotateX = 30;
+ pointer.rotateY = 300;
+ const radius = 400;
+ const thetaStep = 0.16;
+ const verticalSpacing = 3;
+ const yOffset = (cards.length * verticalSpacing) / 2;
+ cards.forEach(($el, i) => {
+ const offsetZ = $el.classList.contains('is-expanded') ? 20 : 0;
+ const theta = i * thetaStep + Math.PI;
+ const y = -(i * verticalSpacing) + yOffset;
+ const x = radius * Math.sin(theta);
+ const z = radius * Math.cos(theta);
+ const yaw = Math.atan2(x, z);
+ const pitch = -Math.atan2(y, Math.hypot(x, z) * 2);
+ $el.style.transform = `translate3d(${x}px, ${y}px, ${z}px) rotateY(${yaw}rad) rotateX(${pitch}rad) translateZ(${offsetZ}px)`;
+ });
+ },
+ grid: () => {
+ pointer.rotateX = 10;
+ pointer.rotateY = 60;
+ const cols = 5;
+ const rows = 5;
+ const colGap = 150;
+ const rowGap = 100;
+ const depthGap = 150;
+ const perLayer = cols * rows;
+ const layers = Math.ceil(cards.length / perLayer);
+ cards.forEach(($el, i) => {
+ const offsetZ = $el.classList.contains('is-expanded') ? 20 : 0;
+ const col = i % cols;
+ const row = Math.floor(i / cols) % rows;
+ const layer = Math.floor(i / perLayer);
+ const x = (col - (cols - 1) / 2) * colGap;
+ const y = ((rows - 1) / 2 - row) * rowGap;
+ const z = offsetZ + ((layer - (layers - 1) / 2) * depthGap);
+ $el.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;
+ });
+ },
+ random: () => {
+ // The table view use CSS grid and has no special tranforms except for a selected element
+ pointer.rotateX = 15;
+ pointer.rotateY = 20;
+ utils.set(cards, { x: () => utils.random(-500, 500), y: () => utils.random(-500, 500), z: () => utils.random(-500, 500)})
+ },
+};
+
+document.addEventListener('pointermove', event => {
+ const hw = window.innerWidth * .5;
+ const hh = window.innerHeight * .5;
+ pointer.x = utils.mapRange(event.clientX - hw, -hw, hw, 1, -1);
+ pointer.y = utils.mapRange(event.clientY - hh, -hh, hh, -1, 1);
+});
+
+const toggles = utils.$('.controls button.toggle');
+
+document.addEventListener('click', event => {
+ const $toggle = event.target.closest('.controls button.toggle');
+ if ($toggle) {
+ toggles.forEach(button => button.classList.remove('is-active'));
+ $toggle.classList.add('is-active');
+ const layoutType = $toggle.id;
+ elementsLayout.update(() => {
+ cards.forEach($el => $el.classList.remove('is-expanded'));
+ $sceneContent.dataset.layout = layoutType;
+ transformLayout[layoutType]();
+ }, {
+ delay: stagger([0, 750], { from: 'random' })
+ });
+ return;
+ }
+ const $card = event.target.closest('#scene-content .element');
+ const shouldExpand = $card && !$card.classList.contains('is-expanded');
+ elementsLayout.update(() => {
+ cards.forEach($el => $el.classList.remove('is-expanded'));
+ if (shouldExpand) $card.classList.add('is-expanded');
+ transformLayout[$sceneContent.dataset.layout]();
+ },{
+ ease: spring({ bounce: .2, duration: 350 }),
+ });
+});
+
+document.addEventListener('keydown', event => {
+ if (event.key !== 'Escape') return;
+ const hasExpandedCard = cards.some($el => $el.classList.contains('is-expanded'));
+ if (!hasExpandedCard) return;
+ elementsLayout.update(() => {
+ cards.forEach($el => $el.classList.remove('is-expanded'));
+ transformLayout[$sceneContent.dataset.layout]();
+ },{
+ ease: spring({ bounce: .3, duration: 350 }),
+ });
+});
+
+// Intro animation
+
+transformLayout.random();
+utils.set(cards, { opacity: 0 });
+elementsLayout.update(() => transformLayout.table(), {
+ delay: stagger([0, 750], { from: 'random' })
+});
\ No newline at end of file
diff --git a/examples/auto-layout/planets/index.html b/examples/auto-layout/planets/index.html
index 45fbe0bb..2d4b1e4b 100644
--- a/examples/auto-layout/planets/index.html
+++ b/examples/auto-layout/planets/index.html
@@ -61,7 +61,6 @@
background: transparent;
}
.close-overlay {
- opacity: 0;
position: absolute;
align-self: flex-end;
width: 3rem;
@@ -78,6 +77,10 @@
transform: rotate(-90deg) scale(.5);
transition: scale .125s ease-out;
}
+ button.close-overlay:disabled {
+ background: var(--color-4);
+ opacity: 0;
+ }
button.close-overlay:hover {
background: var(--color-3);
color: var(--color-1);
@@ -139,10 +142,11 @@
color: var(--color-1);
transform-style: preserve-3d;
transition: transform .1s ease-out;
+ text-decoration: none;
}
#root .card:hover {
cursor: pointer;
- transform: scale(1.025);
+ transform: scale(1.0125);
}
#overlay .card,
#root .card:hover {
@@ -347,11 +351,12 @@
<div class="controls-group actions br">
<button class="action" id="add">add</button>
<button class="action" id="remove">remove</button>
+ <button class="action" id="shuffle">shuffle</button>
</div>
</div>
<template id="card">
- <div class="card br" data-color="0">
- <button class="close-overlay">×</button>
+ <a href="#" class="card br" data-color="0">
+ <button disabled class="close-overlay">×</button>
<div class="card-image"><div class="card-image-grid"></div></div>
<div class="card-text">
<h2 class="card-title"></h2>
@@ -361,7 +366,7 @@
<span class="card-more-info"></span>
</p>
</div>
- </div>
+ </a>
</template>
<div id="root" class="container" data-layout="grid">
</div>
diff --git a/examples/auto-layout/planets/index.js b/examples/auto-layout/planets/index.js
index 8b5a14db..67cb14b8 100644
--- a/examples/auto-layout/planets/index.js
+++ b/examples/auto-layout/planets/index.js
@@ -28,8 +28,7 @@ const latin = [
function loremIpsum(words = 100) {
let text = [];
for (let i = 0; i < words; i++) {
- const w = latin[Math.floor(Math.random() * latin.length)];
- text.push(w);
+ text.push(latin[Math.floor(Math.random() * latin.length)]);
}
let sentence = text.join(" ");
return sentence.charAt(0).toUpperCase() + sentence.slice(1) + ".";
@@ -82,6 +81,9 @@ const actions = {
remove: () => {
const $lastCard = utils.$('#root .card:not(.is-removed)').pop();
if ($lastCard) $lastCard.classList.add('is-removed');
+ },
+ shuffle: () => {
+ utils.shuffle(utils.$('.card:not(.is-removed)')).forEach($el => $el.parentElement.appendChild($el));
}
}
@@ -91,46 +93,55 @@ for (let i = 0; i < initialPlanets; i++) {
const cardsLayout = createLayout($root, {
properties: ['font-size'],
- added: {
+ enterFrom: {
opacity: $el => $el.classList.contains('card') ? `1` : '0',
transform: $el => $el.classList.contains('card') ? `translateY(150%) scale(.5)` : 'none',
},
- removed: {
+ leaveTo: {
opacity: 0,
- transform: ($el, i) => {
- const r = utils.createSeededRandom(i);
- const d = r(0, 1) ? -1 : 1;
- return $el.classList.contains('card') ? `translate(${100 * d}%, 50%) rotate(${r(35, 90) * d}deg) scale(.5)` : 'none';
+ transform: ($el) => {
+ const i = [...$el.parentElement.children].indexOf($el);
+ const d = i % 2 ? -1 : 1;
+ return $el.classList.contains('card') ? `translate(${50 * d}%, 50%) rotate(${20 * d}deg) scale(.5)` : 'none';
},
},
});
const modalLayout = createLayout($overlay, {
children: ['.card', '.card-image', '.card-image-grid', '.card-title', '.card-type', '.close-overlay'],
- properties: ['font-size', '--overlay-alpha'],
+ properties: ['--overlay-alpha'],
+ duration: 500,
});
const closeModal = () => {
+ let $card;
modalLayout.update(() => {
$overlay.close();
- utils.$('#root .card.is-open').forEach($card => {
- $card.classList.remove('is-open');
- });
- });
+ $card = utils.$('#root .card.is-open')[0];
+ $card.classList.remove('is-open');
+ $card.focus();
+ }).then(() => {
+ $card.focus();
+ })
};
const handleClick = e => {
const $target = e.target;
const $card = $target.closest('#root .card');
if ($card) {
- const $clone = $card.cloneNode(true);
+ e.preventDefault();
+ const $clone = document.createElement('div');
+ $clone.innerHTML = $card.cloneNode(true).innerHTML;
+ $clone.classList = $card.classList;
+ $clone.dataset.layoutId = $card.dataset.layoutId;
+ $clone.dataset.color = $card.dataset.color;
$overlay.innerHTML = '';
const cloneChildren = $clone.querySelectorAll('*');
- $clone.removeAttribute('style');
- cloneChildren.forEach(el => el.removeAttribute('style'));
+ cloneChildren.forEach($el => $el.removeAttribute('style'));
$overlay.appendChild($clone);
modalLayout.update(() => {
$overlay.showModal();
+ $clone.querySelector('button').disabled = false;
$card.classList.add('is-open');
});
}
diff --git a/examples/auto-layout/reorder/index.html b/examples/auto-layout/reorder/index.html
deleted file mode 100644
index c80d3a98..00000000
--- a/examples/auto-layout/reorder/index.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Auto layout / Reorder / anime.js</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link href="../../assets/css/styles.css" rel="stylesheet">
- <style>
- html {
- --top-bar-height: 8rem;
- }
- body {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 100%;
- min-height: 100lvh;
- padding: var(--padding);
- padding: 0;
- gap: var(--padding);
- padding: var(--padding);
- }
- .list {
- position: relative;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: center;
- gap: calc(var(--padding) * .5);
- padding: calc(var(--padding) * .5);
- border: var(--border-width) solid var(--bg-5);
- background-color: var(--bg-3);
- }
- .list:empty {
- background-color: var(--bg-2);
- border-color: var(--bg-2);
- }
- .list-a {
- width: 20rem;
- color: var(--orange-1);
- }
- .list-b {
- width: 16rem;
- color: var(--green-1);
- }
- .list .card {
- width: 100%;
- padding: var(--padding);
- border: var(--border-width) solid currentColor;
- background: var(--black-1);
- transition: color .1s ease-out, border-color .1s ease-out;
- background-color: var(--bg-5);
- cursor: pointer;
- }
- </style>
-</head>
-<body>
- <h2>Click to reorder cards</h2>
- <div class="container br">
- <div class="list br">
- <div class="card br red">■■■■■■■ ■■ ■■■■■■■■■■ ■■■ ■■■■■■■■ ■■■■ ■■■■■■■■■ ■■■■■■ ■■■■ ■■■■■■■ ■■■ ■■ ■■■■■■■■■ ■■■■</div>
- <div class="card br orange">■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ ■■ ■■■ ■■■■■■■ ■■■■■■■ ■■■ ■■ ■■■■■■■■■ ■■</div>
- <div class="card br yellow">■■ ■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ ■■ ■■■■■■■■ ■■■■ ■■■■■■■■■ ■■■■■■ ■■■■</div>
- <div class="card br green">■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ ■■ ■■■■■■■■ ■■■■■■■ ■■</div>
- <div class="card br blue">■■■■■■■■■ ■■■■ ■■■■■■■ ■■■■■■■■■■ ■■ ■■■ ■■■■■■■ ■■■■■■■ ■■■ ■■ ■■■■■■■■■ ■■■■ </div>
- </div>
- </div>
- <script type="module" src="./index.js"></script>
-</body>
-</html>
diff --git a/examples/auto-layout/reorder/index.js b/examples/auto-layout/reorder/index.js
deleted file mode 100644
index bd61f9fc..00000000
--- a/examples/auto-layout/reorder/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { createLayout, utils } from '../../../../dist/modules/index.js';
-
-const layout = createLayout('.container', { duration: 1000 });
-const cards = [...utils.$('.card')];
-const [ $list ] = utils.$('.list');
-
-let shuffled = false;
-
-const shuffleCards = $card => {
- utils.shuffle(utils.$('.card')).forEach($card => {
- $list.appendChild($card);
- })
-}
-
-document.addEventListener('click', e => {
- const $card = e.target.closest('.card');
- if ($card) layout.update(() => shuffleCards($card));
-});
diff --git a/examples/auto-layout/simple/index.html b/examples/auto-layout/simple/index.html
deleted file mode 100644
index ae8b306d..00000000
--- a/examples/auto-layout/simple/index.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Auto layout / anime.js</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link href="../assets/css/styles.css" rel="stylesheet">
- <style>
- html {
- --br: 1rem;
- --padding: 1rem;
- --top-bar-height: 8rem;
- --border-width: 1px;
- }
- .br { border-radius: var(--br); }
- .br .br { border-radius: calc(var(--br) * .5); }
- body {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 100%;
- min-height: 100lvh;
- padding: var(--padding);
- padding: 0;
- gap: var(--padding);
- padding: var(--padding);
- font-family: BerkeleyMono-Regular, monospace;
- }
- #controls {
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- align-items: center;
- position: fixed;
- z-index: 1;
- bottom: 2rem;
- right: 2rem;
- width: 100%;
- max-width: 30rem;
- padding: .5rem;
- gap: 0rem;
- background-color: #2A2A2A;
- border: var(--border-width) solid currentColor;
- }
- #controls button {
- width: 20%;
- flex-grow: 1;
- flex-shrink: 0;
- height: 4ch;
- min-width: 0;
- margin: .5ch;
- background-color: #3A3A3A;
- color: #FFF;
- }
- #controls button:hover {
- background-color: #404040;
- }
- #controls button.is-active {
- background-color: #FFF;
- color: #2A2A2A;
- }
- .list {
- overflow-x: hidden;
- overflow-y: auto;
- display: flex;
- gap: calc(var(--padding) * .5);
- padding: calc(var(--padding) * .5);
- flex-direction: column;
- border: var(--border-width) solid currentColor;
- }
- .list.horizontal {
- overflow-x: auto;
- overflow-y: hidden;
- flex-direction: row;
- max-width: 100%;
- }
- .list p {
- width: 32rem;
- padding: var(--padding);
- border: var(--border-width) solid currentColor;
- background: var(--black-1);
- }
- .list.horizontal p {
- width: 8rem;
- }
- </style>
-</head>
-<body>
- <div id="controls" class="br">
- <button class="toggle" id="reorder">reorder</button>
- </div>
- <div class="list br">
- <p class="br">■■■■■■■ ■■ <span>nested</span> ■■■ ■■■■■■■■ ■■■■ ■■■■■■■■■ ■■■■■■ ■■■■ ■■■■■■■ ■■■ ■■ ■■■■■■■■■ ■■■■</p>
- <p class="br">■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ ■■ ■■■ ■■■■■■■ ■■■■■■■ ■■■ ■■ ■■■■■■■■■ ■■</p>
- <p class="br">■■ ■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ ■■ ■■■■■■■■ ■■■■ ■■■■■■■■■ ■■■■■■ ■■■■</p>
- <p class="br">■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ <span>nested</span> ■■■■■■■ ■■</p>
- <p class="br">■■■■■■■■■ ■■■■ ■■■■■■■ ■■■■■■■■■■ ■■ ■■■ ■■■■■■■ ■■■■■■■ ■■■ ■■ ■■■■■■■■■ ■■■■ </p>
- <p class="br">■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ <span>nested</span> ■■ ■■■■■■■■ ■■■■ ■■■■■■■■■</p>
- <p class="br">■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■■ ■■■■ ■■■■■■■■■ ■■ ■■■ ■■■■■■■</p>
- <p class="br">■■ ■■■■■■■■ ■■■ ■■ ■■■■■■■■■ <span>nested</span> ■■■■ ■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■</p>
- <p class="br">■■■■■■■■ ■■■■■■■■ ■■■■■■■■■ ■■■■■■■ ■■ ■■■■■■■■■ <span>nested</span> ■■■■ ■■■■■■■■■ ■■</p>
- <p class="br">■■ ■■■■ ■■■■■■■■■ ■■■ ■■■■■■■ ■■■■■■■■■■ ■■ ■■■■■■■■■ <span>nested</span> ■■■■ ■■■■■■■■■ ■■■■■■■ ■■</p>
- </div>
- <script type="module" src="./index-2.js"></script>
-</body>
-</html>
diff --git a/examples/auto-layout/simple/index.js b/examples/auto-layout/simple/index.js
deleted file mode 100644
index 2287a854..00000000
--- a/examples/auto-layout/simple/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { createLayout, animate, utils } from '../../dist/modules/index.js';
-
-const [ $list ] = utils.$('.list');
-const [ $reorder ] = utils.$('button');
-
-const layout = createLayout('.list');
-
-$reorder.addEventListener("click", () => {
- layout.update(() => {
- $list.classList.toggle("horizontal");
- });
-});
diff --git a/examples/auto-layout/stress-test/index.html b/examples/auto-layout/stress-test/index.html
deleted file mode 100644
index 5e0c3f2b..00000000
--- a/examples/auto-layout/stress-test/index.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Layout / Anime.js</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link href="../assets/css/styles.css" rel="stylesheet">
- <style>
- body {
- font-family: monospace;
- padding: 20px;
- --border-radius: 40px;
- --border-width: 10px;
- --color: #A0A0A0;
- color: var(--color);
- perspective: 1000px;
- }
-
- .grid-cell {
- transform-style: preserve-3d;
- display: grid;
- gap: 2px;
- padding: 2px;
- width: 100%;
- min-height: 50px;
- border: var(--border-width) solid currentColor;
- }
-
- .level-0 {
- transform-style: preserve-3d;
- grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
- border-width: 3px;
- border-radius: calc(var(--border-radius) * 1);
- max-width: calc(100vw - 40px);
- }
-
- .level-1 {
- transform-style: preserve-3d;
- grid-template-columns: repeat(auto-fit, minmax(20px, 1fr));
- border-radius: calc(var(--border-radius) * .75);
- border-color: currentColor;
- }
-
- .square {
- transform-style: preserve-3d;
- border: var(--border-width) solid currentColor;
- border-radius: calc(var(--border-radius) * .5);
- min-height: 20px;
- min-width: 20px;
- overflow: hidden;
- border-radius: var(--border-radius);
- }
-
- button {
- margin: 10px 0;
- padding: 10px 20px;
- font-size: 16px;
- cursor: pointer;
- }
- </style>
-</head>
-<body>
- <div id="root" class="grid-cell level-0"></div>
- <script type="module" src="./index.js"></script>
-</body>
-</html>
diff --git a/examples/auto-layout/stress-test/index.js b/examples/auto-layout/stress-test/index.js
deleted file mode 100644
index e95f03b0..00000000
--- a/examples/auto-layout/stress-test/index.js
+++ /dev/null
@@ -1,131 +0,0 @@
-import {
- utils,
- createLayout,
-} from '../../../dist/modules/index.js';
-
-// Create nested grid structure
-function createNestedGrid(level, maxLevel = 2) {
- const grid = document.createElement('div');
- grid.className = `grid-cell level-${level}`;
- grid.dataset.level = level;
- for (let i = 0; i < 10; i++) {
- const square = document.createElement('div');
- square.className = 'square';
- if (level < maxLevel - 1) {
- square.appendChild(createNestedGrid(level + 1, maxLevel));
- }
-
- grid.appendChild(square);
- }
-
- return grid;
-}
-
-// Shuffle a single grid
-function shuffleGrid(grid, removeCount = 2) {
- const squares = Array.from(grid.children).filter(child =>
- child.classList.contains('square')
- );
-
- if (squares.length < removeCount) return;
-
- // Remove specified number of random elements
- for (let i = 0; i < removeCount && squares.length > 0; i++) {
- const randomIndex = Math.floor(Math.random() * squares.length);
- const toRemove = squares.splice(randomIndex, 1)[0];
- toRemove.remove();
- }
-
- // Add same number of new elements back
- const level = parseInt(grid.dataset.level);
- for (let i = 0; i < removeCount; i++) {
- const square = document.createElement('div');
- square.className = 'square';
-
- // If not at max level, maybe add nested grid
- if (level < 1 && Math.random() > 0.5) {
- square.appendChild(createNestedGrid(level + 1, 2));
- }
-
- grid.appendChild(square);
- }
-
- // Get the current number of squares for better layout calculation
- const currentSquares = grid.querySelectorAll(':scope > .square').length;
-
- utils.set('.square', {
- x: () => utils.random(-100, 100) + 'px',
- y: () => utils.random(-100, 100) + 'px',
- z: () => utils.random(-100, 100) + 'px',
- rotateX: () => utils.random(-45, 45),
- rotateY: () => utils.random(-45, 45),
- rotateZ: () => utils.random(-45, 45),
- })
-
- // Calculate columns and rows - favor fewer columns for taller appearance
- const cols = Math.max(2, Math.min(4, Math.floor(Math.sqrt(currentSquares) * 0.8)));
- const rows = Math.ceil(currentSquares / cols);
-
- // Change grid layout randomly - using fewer columns for taller appearance
- const layouts = [
- `repeat(${cols}, 1fr)`,
- `repeat(${Math.max(2, cols - 1)}, 1fr)`,
- 'repeat(2, 1fr)', // Tall with 2 columns
- 'repeat(3, 1fr)', // 3 columns
- 'repeat(4, 1fr)', // Maximum 4 columns
- '1fr 1fr', // Two equal columns
- '2fr 1fr', // Asymmetric two columns
- '1fr 2fr', // Asymmetric two columns
- '1fr 1fr 1fr' // Three equal columns
- ];
-
- grid.style.gridTemplateColumns = layouts[Math.floor(Math.random() * layouts.length)];
-
- // Set rows based on actual content - auto-sized
- const rowLayouts = [
- `repeat(${rows}, auto)`, // Auto-sized rows based on content
- `repeat(${rows}, minmax(50px, 1fr))`, // Minimum height with flexibility
- `repeat(${Math.max(3, rows)}, auto)`, // At least 3 rows
- 'repeat(auto-fit, minmax(50px, 1fr))', // Auto-fit rows
- '1fr 1fr 1fr', // 3 equal rows
- '1fr 2fr 1fr', // Middle emphasis
- 'auto auto auto auto', // 4 auto rows
- `repeat(${rows}, 1fr)` // Equal distribution
- ];
-
- grid.style.gridTemplateRows = rowLayouts[Math.floor(Math.random() * rowLayouts.length)];
-
-}
-
-function shuffleAllGrids(removeCount = 2) {
- utils.set(document.body, {
- '--border-radius': utils.random(0, 32) + 'px',
- '--border-width': utils.random(1, 20) + 'px',
- // '--color': utils.randomPick(['#FF0000', '#FF00FF', '#0000FF']),
- });
- const allGrids = document.querySelectorAll('.grid-cell');
- allGrids.forEach(grid => shuffleGrid(grid, removeCount));
-
- // Also shuffle the root
- const root = document.getElementById('root');
- shuffleGrid(root, removeCount);
-}
-
-const root = document.getElementById('root');
-for (let i = 0; i < 10; i++) {
- const square = document.createElement('div');
- square.className = 'square';
- // square.style.translate = `200px 300px`;
- square.appendChild(createNestedGrid(1, 2));
- root.appendChild(square);
-}
-
-shuffleAllGrids(0);
-
-const layout = createLayout(root, { relative: true });
-
-document.addEventListener('click', () => {
- layout.update($el => {
- shuffleAllGrids(2);
- });
-});
\ No newline at end of file
diff --git a/examples/auto-layout/todo-list/index.html b/examples/auto-layout/todo-list/index.html
index 97a3c476..b96edbb0 100644
--- a/examples/auto-layout/todo-list/index.html
+++ b/examples/auto-layout/todo-list/index.html
@@ -9,70 +9,95 @@
body {
display: flex;
flex-direction: column;
- justify-content: center;
+ justify-content: flex-start;
align-items: center;
width: 100%;
+ padding: 6rem 1rem;
min-height: 100lvh;
}
- .app {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: flex-start;
+ #\$app {
width: 100%;
+ height: 100%;
+ max-height: calc(100vh - 12rem);
max-width: 32rem;
- background: var(--bg-2);
+ background-color: var(--bg-3);
padding: 1rem 1rem;
border-radius: 1rem;
+ overflow-y: scroll;
}
- #create {
+ #\$container {
+ display: flex;
+ flex-direction: column;
+ justify-content: flex-start;
+ align-items: flex-start;
width: 100%;
+ }
+ #\$addInput {
+ width: 100%;
+ height: 100%;
border: none;
- color: #FFF;
+ color: var(--fg-1);
background-color: transparent;
}
+ #\$addInput:focus {
+ outline: none;
+ }
.block {
+ position: relative;
width: 100%;
list-style: none;
}
- .block:not(:last-child) {
- margin-bottom: 1rem;
- }
.icon {
display: inline;
flex-shrink: 0;
width: 1rem;
height: 1rem;
text-align: center;
+ transition: opacity .125s ease-out;
}
.list {
position: relative;
- gap: 1px;
display: flex;
flex-direction: column;
+ gap: 1px;
+ width: 100%;
+ height: 100%;
}
.item {
position: relative;
+ z-index: 1;
display: flex;
align-items: center;
width: 100%;
height: calc(3rem - 1px);
- background: var(--bg-4);
- padding: .5rem 1rem;
+ color: var(--color-1);
+ background-color: var(--color-5);
+ padding: 0 1rem;
+ border-radius: .5rem;
+ box-shadow: 0 0 0 1px var(--bg-3);
+ transition: background-color 100ms ease-out ;
+ will-change: translate, background-color;
+ }
+ .item:hover {
+ transition-duration: 0ms;
+ background-color: var(--color-4);
}
- .item:first-child {
- border-top-left-radius: .5rem;
- border-top-right-radius: .5rem;
+ #\$new {
+ position: absolute;
+ top: 0;
+ left: 0;
}
- .item:last-child {
- border-bottom-left-radius: .5rem;
- border-bottom-right-radius: .5rem;
+ #\$header .item {
+ color: var(--fg-1);
+ background-color: var(--bg-4);
+ }
+ #\$header .item:has(#\$addInput:focus) {
+ background-color: var(--bg-5);
}
.list { z-index: 0; }
.list.is-active { z-index: 1; }
-
- .item { z-index: 0; }
- .item.is-floating { z-index: 2; }
+ .item.is-floating { z-index: 3; }
+ .item.is-removed { display: none; z-index: 0; }
.item,
label {
gap: 1rem;
@@ -81,50 +106,85 @@
label {
display: flex;
flex: 1;
+ height: 100%;
+ }
+ input.icon {
+ accent-color: var(--color-1);
}
- .delete {
+ button.icon {
margin-left: auto;
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.5rem;
- height: 1.5rem;
+ height: 3rem;
border: none;
background: transparent;
- color: var(--text-2);
+ color: var(--color-3);
font-size: 1.25rem;
line-height: 1;
cursor: pointer;
}
- .delete:hover {
- color: var(--text-1);
+ button.icon:not(:disabled):hover {
+ color: var(--color-1);
+ background: transparent;
+ }
+ #\$createForm:has(#\$addInput:invalid) button.icon {
+ opacity: 0;
+ }
+ #\$createForm button.icon:not(:disabled):hover {
+ color: var(--color-1);
+ background: transparent;
+ }
+ #\$header button.icon {
+ transform: rotate(-45deg);
}
h2 {
- display: flex;
+ z-index: 2;
+ display: inline-block;
align-items: center;
- width: 100%;
height: 2rem;
gap: .5rem;
+ margin-top: 1rem;
+ color: var(--fg-3);
+ }
+ .block:not(:has(.item)) h2 {
+ display: none;
}
</style>
</head>
<body>
- <div class="app">
- <form class="block create" autocomplete="off">
- <div class="item">
- <span class="icon">+</span>
- <input id="create" type="text" placeholder="What needs to be done?" />
+ <div id="$app">
+ <div id="$container">
+ <div id="$header" class="block">
+ <ul id="$new" class="list"></ul>
+ <form id="$createForm" autocomplete="off">
+ <div class="item">
+ <input class="icon" type="checkbox" disabled>
+ <input id="$addInput" type="text" required placeholder="What needs to be done?" />
+ <button type="button" class="action icon" aria-label="Create todo">×</button>
+ </div>
+ </form>
+ </div>
+ <div class="block" data-color="4">
+ <h2>Pending</h2>
+ <ul id="$pending" class="list"></ul>
+ </div>
+ <div class="block" data-color="6">
+ <h2>Completed</h2>
+ <ul id="$completed" class="list"></ul>
</div>
- </form>
- <h2>Pending</h2>
- <ul class="block list pending">
-
- </ul>
- <h2>Completed</h2>
- <ul class="block list completed">
-
- </ul>
+ </div>
</div>
+ <template id="$todoTemplate">
+ <li class="item">
+ <label>
+ <input class="icon" type="checkbox">
+ <span class="text"></span>
+ </label>
+ <button type="button" class="action icon" aria-label="Delete todo">×</button>
+ </li>
+ </template>
<script type="module" src="./index.js"></script>
</body>
</html>
diff --git a/examples/auto-layout/todo-list/index.js b/examples/auto-layout/todo-list/index.js
index 9b574a27..288b04b9 100644
--- a/examples/auto-layout/todo-list/index.js
+++ b/examples/auto-layout/todo-list/index.js
@@ -1,79 +1,71 @@
-import { createLayout, $ } from '../../../dist/modules/index.js';
+import { createLayout, spring, stagger, $ } from '../../../dist/modules/index.js';
-const $app = document.querySelector('.app');
-const $form = document.querySelector('.create');
-const $input = document.querySelector('#create');
-const $pending = document.querySelector('.pending');
-const $completed = document.querySelector('.completed');
-
-const layout = createLayout($app, {
- duration: 500
+const layout = createLayout($container, {
+ properties: ['backgroundColor', 'color', 'accent-color'],
+ ease: spring({ bounce: .3, duration: 450 }),
+ leaveTo: {
+ opacity: 0,
+ transform: 'translateY(.5rem) scale(.9)',
+ }
});
-let ids = 0;
-
-const createItem = (text, checked) => {
- const todoId = `todo-${ids}`;
- const $item = document.createElement('li');
- const $label = document.createElement('label');
- const $checkbox = document.createElement('input');
- const $delete = document.createElement('button');
- $item.className = 'item';
- $label.setAttribute('for', todoId);
- $label.append(text);
- $checkbox.id = todoId;
- $checkbox.type = 'checkbox';
- $checkbox.className = 'icon';
- $checkbox.checked = checked;
+const createItem = (text) => {
+ const $item = /** @type {HTMLLIElement} */($todoTemplate.content.firstElementChild.cloneNode(true));
+ const $checkbox = $item.querySelector('input[type="checkbox"]');
+ const $labelText = $item.querySelector('.text');
+ $labelText.textContent = text;
$checkbox.addEventListener('change', handleToggle);
- $delete.type = 'button';
- $delete.className = 'delete icon';
- $delete.textContent = '×';
- $delete.addEventListener('click', handleDelete);
- $item.append($checkbox);
- $item.append($label);
- $item.append($delete);
- ids++;
return $item;
-};
+}
const handleToggle = event => {
- const checkbox = /** @type {HTMLInputElement} */(event.currentTarget);
- const $item = checkbox.closest('.item');
+ const $checkbox = /** @type {HTMLInputElement} */(event.currentTarget);
+ const $item = $checkbox.closest('.item');
if (!$item) return;
- const $targetList = checkbox.checked ? $completed : $pending;
+ const $targetList = $checkbox.checked ? $completed : $pending;
$('.list').forEach($el => $el.classList.toggle('is-active', $el === $targetList));
$('.item').forEach($el => $el.classList.toggle('is-floating', $el === $item));
- layout.update(() => {
- $targetList.insertBefore($item, $targetList.firstElementChild);
- });
-};
+ layout.update(() => $targetList.insertBefore($item, $targetList.firstElementChild), { ease: 'inOutExpo' });
+}
+
+const addItem = () => {
+ const value = $addInput.value.trim();
+ if (!value) return;
+ const $item = createItem(value);
+ // debugger;
+ $new.appendChild($item);
+ layout.update(() => $pending.insertBefore($item, $pending.firstElementChild));
+ $addInput.value = '';
+}
-const handleDelete = event => {
- const button = /** @type {HTMLButtonElement} */(event.currentTarget);
- const $item = button.closest('.item');
+const handleAction = event => {
+ const $button = /** @type {HTMLButtonElement} */(event.target);
+ const $item = $button.closest('.item');
if (!$item) return;
- layout.update(() => {
- $item.style.display = 'none';
- }, {
- onComplete: () => $item.remove()
- });
-};
+ const $parent = $item.parentElement;
+ if ($parent.id === '$createForm') {
+ addItem();
+ } else {
+ layout.update(() => {
+ $item.classList.add('is-removed');
+ }, {
+ ease: 'out(3.5)',
+ onComplete: () => {
+ if ($parent.children.length > 1) { // If there are more than one element left remove the element directly
+ $item.remove();
+ } else { // Otherwise wrap the removal into a layout.update() to avoid abrupt list resizing
+ layout.update(() => $item.remove())
+ }
+ }
+ });
+ }
+}
-$form.addEventListener('submit', event => {
+$createForm.addEventListener('submit', event => {
event.preventDefault();
- const value = $input.value.trim();
- if (!value) return;
- const newItem = createItem(value, false);
- layout.update(() => {
- $pending.insertBefore(newItem, $pending.firstElementChild);
- });
- $input.value = '';
+ addItem();
});
-document.querySelectorAll('.item input[type="checkbox"]').forEach(checkbox => {
- checkbox.addEventListener('change', handleToggle);
-});
-document.querySelectorAll('.item .delete').forEach(button => {
- button.addEventListener('click', handleDelete);
-});
+document.addEventListener('click', event => {
+ if (event.target.classList.contains('action')) handleAction(event);
+});
\ No newline at end of file
diff --git a/package.json b/package.json
index 215c16ec..ce45202f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "animejs",
- "version": "4.3.0-beta.2",
+ "version": "4.3.0",
"description": "JavaScript animation engine",
"homepage": "https://animejs.com",
"author": "Julian Garnier <[email protected]>",
diff --git a/src/animation/animation.js b/src/animation/animation.js
index 291a8d0e..965e27dd 100644
--- a/src/animation/animation.js
+++ b/src/animation/animation.js
@@ -20,6 +20,8 @@ import {
isNum,
round,
isNil,
+ isFnc,
+ isStr,
} from '../core/helpers.js';
import {
@@ -357,10 +359,13 @@ export class JSAnimation extends Timer {
tweenToValue = computedToValue;
}
const tweenFromValue = getFunctionValue(key.from, target, ti, tl);
- const keyEasing = key.ease;
+ const easeToParse = key.ease || tEasing;
+
+ const easeFunctionResult = getFunctionValue(easeToParse, target, ti, tl);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
- // Easing are treated differently and don't accept function based value to prevent having to pass a function wrapper that returns an other function all the time
- const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing || tEasing;
+ const tweenEasing = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
// Calculate default individual keyframe duration by dividing the tl of keyframes
const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(setValue(key.duration, (l > 1 ? getFunctionValue(tDuration, target, ti, tl) / l : tDuration)), target, ti, tl);
// Default delay value should only be applied to the first tween
diff --git a/src/core/helpers.js b/src/core/helpers.js
index 944f3c52..60bde892 100644
--- a/src/core/helpers.js
+++ b/src/core/helpers.js
@@ -56,9 +56,9 @@ export const isSvg = a => isBrowser && a instanceof SVGElement;
/**@param {any} a @return {Boolean} */
export const isHex = a => hexTestRgx.test(a);
/**@param {any} a @return {Boolean} */
-export const isRgb = a => stringStartsWith(a, 'rgb');
+export const isRgb = a => stringStartsWith(a, 'rgb') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
-export const isHsl = a => stringStartsWith(a, 'hsl');
+export const isHsl = a => stringStartsWith(a, 'hsl') && a[a.length - 1] === ')';
/**@param {any} a @return {Boolean} */
export const isCol = a => isHex(a) || isRgb(a) || isHsl(a);
/**@param {any} a @return {Boolean} */
diff --git a/src/layout/layout.js b/src/layout/layout.js
index 3dad605a..139ed4d9 100644
--- a/src/layout/layout.js
+++ b/src/layout/layout.js
@@ -11,15 +11,15 @@ import {
registerTargets,
} from '../core/targets.js';
+import {
+ parseEase,
+} from '../easings/eases/parser.js';
+
import {
getFunctionValue,
setValue,
} from '../core/values.js';
-import {
- noop,
-} from '../core/consts.js';
-
import {
createTimeline,
} from '../timeline/timeline.js';
@@ -29,12 +29,17 @@ import {
} from '../waapi/waapi.js';
import {
+ defaults,
scope,
} from '../core/globals.js';
/**
* @import {
* AnimationParams,
+ * RenderableCallbacks,
+ * TickableCallbacks,
+ * TimelineParams,
+ * TimerParams,
* } from '../types/index.js'
*/
@@ -50,13 +55,18 @@ import {
* } from '../waapi/waapi.js'
*/
+/**
+ * @import {
+ * Spring,
+ } from '../easings/spring/index.js'
+*/
+
/**
* @import {
* DOMTarget,
* DOMTargetSelector,
* FunctionValue,
* EasingParam,
- * Callback,
} from '../types/index.js'
*/
@@ -65,29 +75,47 @@ import {
*/
/**
- * @typedef {Record<String, Number|String>} LayoutStateParams
+ * @typedef {Object} LayoutAnimationTimingsParams
+ * @property {Number|FunctionValue} [delay]
+ * @property {Number|FunctionValue} [duration]
+ * @property {EasingParam|FunctionValue} [ease]
+ */
+
+/**
+ * @typedef {Record<String, Number|String|FunctionValue>} LayoutStateAnimationProperties
*/
/**
- * @typedef {Object} LayoutAnimationParams
+ * @typedef {LayoutStateAnimationProperties & LayoutAnimationTimingsParams} LayoutStateParams
+ */
+
+/**
+ * @typedef {Object} LayoutSpecificAnimationParams
* @property {Number|FunctionValue} [delay]
* @property {Number|FunctionValue} [duration]
- * @property {EasingParam} [ease]
- * @property {LayoutStateParams} [frozen]
- * @property {LayoutStateParams} [added]
- * @property {LayoutStateParams} [removed]
- * @property {Callback<AutoLayout>} [onComplete]
+ * @property {EasingParam|FunctionValue} [ease]
+ * @property {EasingParam} [playbackEase]
+ * @property {LayoutStateParams} [swapAt]
+ * @property {LayoutStateParams} [enterFrom]
+ * @property {LayoutStateParams} [leaveTo]
*/
/**
- * @typedef {LayoutAnimationParams & {
- * children?: LayoutChildrenParam,
- * properties?: Array<String>,
- * }} AutoLayoutParams
+ * @typedef {LayoutSpecificAnimationParams & TimerParams & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} LayoutAnimationParams
*/
/**
- * @typedef {Record<String, Number|String> & {
+ * @typedef {Object} LayoutOptions
+ * @property {LayoutChildrenParam} [children]
+ * @property {Array<String>} [properties]
+ */
+
+/**
+ * @typedef {LayoutAnimationParams & LayoutOptions} AutoLayoutParams
+ */
+
+/**
+ * @typedef {Record<String, Number|String|FunctionValue> & {
* transform: String,
* x: Number,
* y: Number,
@@ -108,13 +136,15 @@ import {
* @property {Number} total
* @property {Number} delay
* @property {Number} duration
+ * @property {EasingParam} ease
* @property {DOMTarget} $measure
* @property {LayoutSnapshot} state
* @property {AutoLayout} layout
* @property {LayoutNode|null} parentNode
* @property {Boolean} isTarget
+ * @property {Boolean} isEntering
+ * @property {Boolean} isLeaving
* @property {Boolean} hasTransform
- * @property {Boolean} isAnimated
* @property {Array<String>} inlineStyles
* @property {String|null} inlineTransforms
* @property {String|null} inlineTransition
@@ -255,7 +285,7 @@ const detachNode = node => {
* @param {DOMTarget} $el
* @param {LayoutNode|null} parentNode
* @param {LayoutSnapshot} state
- * @param {LayoutNode} [recycledNode]
+ * @param {LayoutNode} recycledNode
* @return {LayoutNode}
*/
const createNode = ($el, parentNode, state, recycledNode) => {
@@ -269,12 +299,15 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.total = 1;
node.delay = 0;
node.duration = 0;
+ node.ease = null;
node.state = state;
node.layout = state.layout;
node.parentNode = parentNode || null;
node.isTarget = false;
+ node.isEntering = false;
+ node.isLeaving = false;
+ node.isInlined = false;
node.hasTransform = false;
- node.isAnimated = false;
node.inlineStyles = [];
node.inlineTransforms = null;
node.inlineTransition = null;
@@ -282,7 +315,6 @@ const createNode = ($el, parentNode, state, recycledNode) => {
node.branchRemoved = false;
node.branchNotRendered = false;
node.sizeChanged = false;
- node.isInlined = false;
node.hasVisibilitySwap = false;
node.hasDisplayNone = false;
node.hasVisibilityHidden = false;
@@ -425,7 +457,7 @@ const recordNodeState = (node, $measure, computedStyle, skipMeasurements) => {
/**
* @param {LayoutNode} node
- * @param {LayoutStateParams} [props]
+ * @param {LayoutStateAnimationProperties} [props]
*/
const updateNodeProperties = (node, props) => {
if (!props) return;
@@ -434,6 +466,19 @@ const updateNodeProperties = (node, props) => {
}
}
+/**
+ * @param {LayoutNode} node
+ * @param {LayoutAnimationTimingsParams} params
+ */
+const updateNodeTimingParams = (node, params) => {
+ const easeFunctionResult = getFunctionValue(params.ease, node.$el, node.index, node.total);
+ const keyEasing = isFnc(easeFunctionResult) ? easeFunctionResult : params.ease;
+ const hasSpring = !isUnd(keyEasing) && !isUnd(/** @type {Spring} */(keyEasing).ease);
+ node.ease = hasSpring ? /** @type {Spring} */(keyEasing).ease : keyEasing;
+ node.duration = hasSpring ? /** @type {Spring} */(keyEasing).settlingDuration : getFunctionValue(params.duration, node.$el, node.index, node.total);
+ node.delay = getFunctionValue(params.delay, node.$el, node.index, node.total);
+}
+
/**
* @param {LayoutNode} node
*/
@@ -508,9 +553,9 @@ const restoreNodeVisualState = node => {
node.$measure.style.removeProperty('visibility');
}
}
- if (node.measuredIsRemoved) {
- node.layout.pendingRemoved.delete(node.$el);
- }
+ // if (node.measuredIsRemoved) {
+ node.layout.pendingRemoval.delete(node.$el);
+ // }
}
/**
@@ -560,6 +605,7 @@ class LayoutSnapshot {
*/
revert() {
this.forEachNode(node => {
+ this.layout.pendingRemoval.delete(node.$el);
node.$el.removeAttribute('data-layout-id');
node.$measure.removeAttribute('data-layout-id');
});
@@ -571,34 +617,22 @@ class LayoutSnapshot {
/**
* @param {DOMTarget} $el
- * @return {LayoutNodeProperties|undefined}
+ * @return {LayoutNode}
*/
- get($el) {
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- return node.properties;
+ getNode($el) {
+ if (!$el || !$el.dataset) return;
+ return this.nodes.get($el.dataset.layoutId);
}
/**
* @param {DOMTarget} $el
* @param {String} prop
- * @return {Number|String|undefined}
+ * @return {Number|String}
*/
- getValue($el, prop) {
- if (!$el || !$el.dataset) {
- console.warn(`No element found on state (${$el})`);
- return;
- }
- const node = this.nodes.get($el.dataset.layoutId);
- if (!node) {
- console.warn(`No node found on state`);
- return;
- }
- const value = node.properties[prop];
- if (!isUnd(value)) return getFunctionValue(value, $el, node.index, node.total);
+ getComputedValue($el, prop) {
+ const node = this.getNode($el);
+ if (!node) return;
+ return /** @type {Number|String} */(node.properties[prop]);
}
/**
@@ -659,10 +693,10 @@ class LayoutSnapshot {
const $parent = /** @type {LayoutNode|null} */(stack.pop());
/** @type {DOMTarget|null} */
const $current = /** @type {DOMTarget|null} */(stack.pop());
+
if (!$current || $current.nodeType !== 1 || isSvg($current)) continue;
const skipMeasurements = $parent ? $parent.measuredIsRemoved : false;
-
const computedStyle = skipMeasurements ? hiddenComputedStyle : getComputedStyle($current);
const hasDisplayNone = skipMeasurements ? true : computedStyle.display === 'none';
const hasVisibilityHidden = skipMeasurements ? true : computedStyle.visibility === 'hidden';
@@ -709,11 +743,10 @@ class LayoutSnapshot {
node.branchRemoved = false;
node.branchNotRendered = false;
node.isTarget = false;
- node.isAnimated = false;
+ node.sizeChanged = false;
node.hasVisibilityHidden = hasVisibilityHidden;
node.hasDisplayNone = hasDisplayNone;
node.hasVisibilitySwap = (hasVisibilityHidden && !node.measuredHasVisibilityHidden) || (hasDisplayNone && !node.measuredHasDisplayNone);
- // node.hasVisibilitySwap = (hasVisibilityHidden !== node.measuredHasVisibilityHidden) || (hasDisplayNone !== node.measuredHasDisplayNone);
this.nodes.set(node.id, node);
@@ -732,6 +765,7 @@ class LayoutSnapshot {
$parent._tail = node;
}
} else {
+ // Each disconnected subtree becomes its own root in the snapshot graph
this.rootNodes.add(node);
}
@@ -775,11 +809,29 @@ class LayoutSnapshot {
* @return {this}
*/
record() {
- const { children, root } = this.layout;
+ const layout = this.layout;
+ const children = layout.children;
+ const root = layout.root;
const toParse = isArr(children) ? children : [children];
const scoped = [];
const scopeRoot = children === '*' ? root : scope.root;
+ // Mute transition and transforms of root ancestors before recording the state
+
+ /** @type {Array<DOMTarget|String|null>} */
+ const rootAncestorTransformStore = [];
+ let $ancestor = root.parentElement;
+ while ($ancestor && $ancestor.nodeType === 1) {
+ const computedStyle = getComputedStyle($ancestor);
+ if (computedStyle.transform && computedStyle.transform !== 'none') {
+ const inlineTransform = $ancestor.style.transform || '';
+ const inlineTransition = muteElementTransition($ancestor);
+ rootAncestorTransformStore.push($ancestor, inlineTransform, inlineTransition);
+ $ancestor.style.transform = 'none';
+ }
+ $ancestor = $ancestor.parentElement;
+ }
+
for (let i = 0, l = toParse.length; i < l; i++) {
const child = toParse[i];
scoped[i] = isStr(child) ? scopeRoot.querySelectorAll(child) : child;
@@ -795,9 +847,13 @@ class LayoutSnapshot {
rootNode.isTarget = true;
this.rootNode = rootNode;
- // Track ids of nodes that belong to the current root to filter detached matches
const inRootNodeIds = new Set();
+ // Update index and total for inital timing calculation
+ let index = 0, total = this.nodes.size;
this.nodes.forEach((node, id) => {
+ node.index = index++;
+ node.total = total;
+ // Track ids of nodes that belong to the current root to filter detached matches
if (node && node.measuredIsInsideRoot) {
inRootNodeIds.add(id);
}
@@ -827,7 +883,7 @@ class LayoutSnapshot {
for (let i = 0, l = parsedChildren.length; i < l; i++) {
const $el = parsedChildren[i];
- const node = this.nodes.get($el.dataset.layoutId);
+ const node = this.getNode($el);
if (node) {
let cur = node;
while (cur) {
@@ -841,18 +897,52 @@ class LayoutSnapshot {
this.scrollX = window.scrollX;
this.scrollY = window.scrollY;
- const total = this.nodes.size;
-
this.forEachNode(restoreNodeTransform);
- this.forEachNode((node, i) => {
- node.index = i;
- node.total = total;
- });
+
+ // Restore transition and transforms of root ancestors
+
+ for (let i = 0, l = rootAncestorTransformStore.length; i < l; i += 3) {
+ const $el = /** @type {DOMTarget} */(rootAncestorTransformStore[i]);
+ const inlineTransform = /** @type {String} */(rootAncestorTransformStore[i + 1]);
+ const inlineTransition = /** @type {String|null} */(rootAncestorTransformStore[i + 2]);
+ if (inlineTransform && inlineTransform !== '') {
+ $el.style.transform = inlineTransform;
+ } else {
+ $el.style.removeProperty('transform');
+ }
+ restoreElementTransition($el, inlineTransition);
+ }
return this;
}
}
+/**
+ * @param {LayoutStateParams} params
+ * @return {[LayoutStateAnimationProperties, LayoutAnimationTimingsParams]}
+ */
+function splitPropertiesFromParams(params) {
+ /** @type {LayoutStateAnimationProperties} */
+ const properties = {};
+ /** @type {LayoutAnimationTimingsParams} */
+ const parameters = {};
+ for (let name in params) {
+ const value = params[name];
+ const isEase = name === 'ease';
+ const isTiming = name === 'duration' || name === 'delay';
+ if (isTiming || isEase) {
+ if (isEase) {
+ parameters[name] = /** @type {EasingParam} */(value);
+ } else {
+ parameters[name] = /** @type {Number|FunctionValue} */(value);
+ }
+ } else {
+ properties[name] = /** @type {Number|String} */(value);
+ }
+ }
+ return [properties, parameters];
+}
+
export class AutoLayout {
/**
* @param {DOMTargetSelector} root
@@ -860,10 +950,16 @@ export class AutoLayout {
*/
constructor(root, params = {}) {
if (scope.current) scope.current.register(this);
- const frozenParams = params.frozen;
- const addedParams = params.added;
- const removedParams = params.removed;
- const propsParams = params.properties;
+ const swapAtSplitParams = splitPropertiesFromParams(params.swapAt);
+ const enterFromSplitParams = splitPropertiesFromParams(params.enterFrom);
+ const leaveToSplitParams = splitPropertiesFromParams(params.leaveTo);
+ const transitionProperties = params.properties;
+ /** @type {Number|FunctionValue} */
+ params.duration = setValue(params.duration, 350);
+ /** @type {Number|FunctionValue} */
+ params.delay = setValue(params.delay, 0);
+ /** @type {EasingParam|FunctionValue} */
+ params.ease = setValue(params.ease, 'inOut(3.5)');
/** @type {AutoLayoutParams} */
this.params = params;
/** @type {DOMTarget} */
@@ -874,29 +970,27 @@ export class AutoLayout {
this.children = params.children || '*';
/** @type {Boolean} */
this.absoluteCoords = false;
- /** @type {Number|FunctionValue} */
- this.duration = setValue(params.duration, 500);
- /** @type {Number|FunctionValue} */
- this.delay = setValue(params.delay, 0);
- /** @type {EasingParam} */
- this.ease = setValue(params.ease, 'inOut(3.5)');
- /** @type {Callback<this>} */
- this.onComplete = setValue(params.onComplete, /** @type {Callback<this>} */(noop));
/** @type {LayoutStateParams} */
- this.frozenParams = frozenParams || { opacity: 0 };
+ this.swapAtParams = mergeObjects(params.swapAt || { opacity: 0 }, { ease: 'inOut(1.75)' });
/** @type {LayoutStateParams} */
- this.addedParams = addedParams || { opacity: 0 };
+ this.enterFromParams = params.enterFrom || { opacity: 0 };
/** @type {LayoutStateParams} */
- this.removedParams = removedParams || { opacity: 0 };
+ this.leaveToParams = params.leaveTo || { opacity: 0 };
/** @type {Set<String>} */
this.properties = new Set([
'opacity',
+ 'fontSize',
+ 'color',
+ 'backgroundColor',
'borderRadius',
+ 'border',
+ 'filter',
+ 'clipPath',
]);
- if (frozenParams) for (let name in frozenParams) this.properties.add(name);
- if (addedParams) for (let name in addedParams) this.properties.add(name);
- if (removedParams) for (let name in removedParams) this.properties.add(name);
- if (propsParams) for (let i = 0, l = propsParams.length; i < l; i++) this.properties.add(propsParams[i]);
+ if (swapAtSplitParams[0]) for (let name in swapAtSplitParams[0]) this.properties.add(name);
+ if (enterFromSplitParams[0]) for (let name in enterFromSplitParams[0]) this.properties.add(name);
+ if (leaveToSplitParams[0]) for (let name in leaveToSplitParams[0]) this.properties.add(name);
+ if (transitionProperties) for (let i = 0, l = transitionProperties.length; i < l; i++) this.properties.add(transitionProperties[i]);
/** @type {Set<String>} */
this.recordedProperties = new Set([
'display',
@@ -916,24 +1010,26 @@ export class AutoLayout {
]);
this.properties.forEach(prop => this.recordedProperties.add(prop));
/** @type {WeakSet<DOMTarget>} */
- this.pendingRemoved = new WeakSet();
+ this.pendingRemoval = new WeakSet();
/** @type {Map<DOMTarget, String|null>} */
this.transitionMuteStore = new Map();
/** @type {LayoutSnapshot} */
this.oldState = new LayoutSnapshot(this);
/** @type {LayoutSnapshot} */
this.newState = new LayoutSnapshot(this);
- /** @type {Timeline|null} */
+ /** @type {Timeline} */
this.timeline = null;
- /** @type {WAAPIAnimation|null} */
+ /** @type {WAAPIAnimation} */
this.transformAnimation = null;
/** @type {Array<DOMTarget>} */
- this.frozen = [];
+ this.animating = [];
/** @type {Array<DOMTarget>} */
- this.removed = [];
+ this.swapping = [];
/** @type {Array<DOMTarget>} */
- this.added = [];
- // Record the current state as the old state to init the data attributes
+ this.leaving = [];
+ /** @type {Array<DOMTarget>} */
+ this.entering = [];
+ // Record the current state as the old state to init the data attributes and allow imediate .animate()
this.oldState.record();
// And all layout transition muted during the record
restoreLayoutTransition(this.transitionMuteStore);
@@ -943,6 +1039,7 @@ export class AutoLayout {
* @return {this}
*/
revert() {
+ this.root.classList.remove('is-animated');
if (this.timeline) {
this.timeline.complete();
this.timeline = null;
@@ -951,8 +1048,7 @@ export class AutoLayout {
this.transformAnimation.complete();
this.transformAnimation = null;
}
- this.root.classList.remove('is-animated');
- this.frozen.length = this.removed.length = this.added.length = 0;
+ this.animating.length = this.swapping.length = this.leaving.length = this.entering.length = 0;
this.oldState.revert();
this.newState.revert();
requestAnimationFrame(() => restoreLayoutTransition(this.transitionMuteStore));
@@ -985,20 +1081,72 @@ export class AutoLayout {
* @return {Timeline}
*/
animate(params = {}) {
- const delay = setValue(params.delay, this.delay);
- const duration = setValue(params.duration, this.duration);
- const onComplete = setValue(params.onComplete, this.onComplete);
- const frozenParams = params.frozen ? mergeObjects(params.frozen, this.frozenParams) : this.frozenParams;
- const addedParams = params.added ? mergeObjects(params.added, this.addedParams) : this.addedParams;
- const removedParams = params.removed ? mergeObjects(params.removed, this.removedParams) : this.removedParams;
+ /** @type { LayoutAnimationTimingsParams } */
+ const animationTimings = {
+ ease: setValue(params.ease, this.params.ease),
+ delay: setValue(params.delay, this.params.delay),
+ duration: setValue(params.duration, this.params.duration),
+ }
+ /** @type {TimelineParams} */
+ const tlParams = {};
+ const onComplete = setValue(params.onComplete, this.params.onComplete);
+ const onPause = setValue(params.onPause, this.params.onPause);
+ for (let name in defaults) {
+ if (name !== 'ease' && name !== 'duration' && name !== 'delay') {
+ if (!isUnd(params[name])) {
+ tlParams[name] = params[name];
+ } else if (!isUnd(this.params[name])) {
+ tlParams[name] = this.params[name];
+ }
+ }
+ }
+ tlParams.onComplete = () => {
+ // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(node => {
+ restoreNodeVisualState(node);
+ restoreNodeInlineStyles(node);
+ });
+ for (let i = 0, l = transformed.length; i < l; i++) {
+ const $el = transformed[i];
+ $el.style.transform = newState.getComputedValue($el, 'transform');
+ }
+ if (this.root.classList.contains('is-animated')) {
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ }
+ // Avoid CSS transitions at the end of the animation by restoring them on the next frame
+ requestAnimationFrame(() => {
+ if (this.root.classList.contains('is-animated')) return;
+ restoreLayoutTransition(this.transitionMuteStore);
+ });
+ };
+ tlParams.onPause = () => {
+ if (!this.root.classList.contains('is-animated')) return;
+ if (this.transformAnimation) this.transformAnimation.cancel();
+ newState.forEachRootNode(restoreNodeVisualState);
+ this.root.classList.remove('is-animated');
+ if (onComplete) onComplete(this.timeline);
+ if (onPause) onPause(this.timeline);
+ };
+ tlParams.composition = false;
+
+ const swapAtParams = mergeObjects(mergeObjects(params.swapAt || {}, this.swapAtParams), animationTimings);
+ const enterFromParams = mergeObjects(mergeObjects(params.enterFrom || {}, this.enterFromParams), animationTimings);
+ const leaveToParams = mergeObjects(mergeObjects(params.leaveTo || {}, this.leaveToParams), animationTimings);
+ const [ swapAtProps, swapAtTimings ] = splitPropertiesFromParams(swapAtParams);
+ const [ enterFromProps, enterFromTimings ] = splitPropertiesFromParams(enterFromParams);
+ const [ leaveToProps, leaveToTimings ] = splitPropertiesFromParams(leaveToParams);
+
const oldState = this.oldState;
const newState = this.newState;
- const added = this.added;
- const removed = this.removed;
- const frozen = this.frozen;
- const pendingRemoved = this.pendingRemoved;
+ const animating = this.animating;
+ const swapping = this.swapping;
+ const entering = this.entering;
+ const leaving = this.leaving;
+ const pendingRemoval = this.pendingRemoval;
- added.length = removed.length = frozen.length = 0;
+ animating.length = swapping.length = entering.length = leaving.length = 0;
// Mute old state CSS transitions to prevent wrong properties calculation
oldState.forEachRootNode(muteNodeTransition);
@@ -1009,10 +1157,12 @@ export class AutoLayout {
const targets = [];
const animated = [];
const transformed = [];
- const animatedFrozen = [];
- const root = newState.rootNode.$el;
+ const animatedSwap = [];
+ const rootNode = newState.rootNode;
+ const $root = rootNode.$el;
newState.forEachRootNode(node => {
+
const $el = node.$el;
const id = node.id;
const parent = node.parentNode;
@@ -1020,10 +1170,6 @@ export class AutoLayout {
const parentRemoved = parent ? parent.branchRemoved : false;
const parentNotRendered = parent ? parent.branchNotRendered : false;
- // Delay and duration must be calculated in the animate() call to support delay override
- node.delay = +(isFnc(delay) ? delay($el, node.index, node.total) : delay);
- node.duration = +(isFnc(duration) ? duration($el, node.index, node.total) : duration);
-
let oldStateNode = oldState.nodes.get(id);
const hasNoOldState = !oldStateNode;
@@ -1073,7 +1219,7 @@ export class AutoLayout {
}
}
- const wasPendingRemoval = pendingRemoved.has($el);
+ const wasPendingRemoval = pendingRemoval.has($el);
const wasVisibleBefore = oldStateNode.measuredIsVisible;
const isVisibleNow = node.measuredIsVisible;
const becomeVisible = !wasVisibleBefore && isVisibleNow && !parentNotRendered;
@@ -1081,113 +1227,156 @@ export class AutoLayout {
const newlyRemoved = isRemovedNow && !wasRemovedBefore && !parentRemoved;
const topLevelRemoved = newlyRemoved || isRemovedNow && wasPendingRemoval && !parentRemoved;
- if (node.measuredIsRemoved && wasVisibleBefore) {
+ node.branchAdded = parentAdded || topLevelAdded;
+ node.branchRemoved = parentRemoved || topLevelRemoved;
+ node.branchNotRendered = parentNotRendered || isRemovedNow;
+
+ if (isRemovedNow && wasVisibleBefore) {
node.$el.style.display = oldStateNode.measuredDisplay;
node.$el.style.visibility = 'visible';
cloneNodeProperties(oldStateNode, node, newState);
}
+ // Node is leaving
if (newlyRemoved) {
- removed.push($el);
- pendingRemoved.add($el);
+ if (node.isTarget) {
+ leaving.push($el);
+ node.isLeaving = true;
+ }
+ pendingRemoval.add($el);
} else if (!isRemovedNow && wasPendingRemoval) {
- pendingRemoved.delete($el);
+ pendingRemoval.delete($el);
}
- // Node is added
+ // Node is entering
if ((topLevelAdded && !parentNotRendered) || becomeVisible) {
- updateNodeProperties(oldStateNode, addedParams);
- added.push($el);
- // Node is removed
+ updateNodeProperties(oldStateNode, enterFromProps);
+ if (node.isTarget) {
+ entering.push($el);
+ node.isEntering = true;
+ }
+ // Node is leaving
} else if (topLevelRemoved && !parentNotRendered) {
- updateNodeProperties(node, removedParams);
+ updateNodeProperties(node, leaveToProps);
}
- // Compute function based propety values before cheking for changes
- for (let name in node.properties) {
- node.properties[name] = newState.getValue(node.$el, name);
- // NOTE: I'm using node.$el to get the value of old state, make sure this is valid instead of oldStateNode.$el
- oldStateNode.properties[name] = oldState.getValue(node.$el, name);
+ // Node is animating
+ // The animating array is used only to calculate delays and duration on root children
+ if (node !== rootNode && node.isTarget && !node.isEntering && !node.isLeaving) {
+ animating.push($el);
}
- const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
- let propertyChanged = false;
+ targets.push($el);
+ });
- if (node.isTarget && (!node.measuredIsRemoved && wasVisibleBefore || node.measuredIsRemoved && isVisibleNow)) {
- if (!node.isInlined && (node.properties.transform !== 'none' || oldStateNode.properties.transform !== 'none')) {
- node.hasTransform = true;
- propertyChanged = true;
- transformed.push($el);
- }
- for (let name in node.properties) {
- if (name !== 'transform' && (node.properties[name] !== oldStateNode.properties[name] || hiddenStateChanged)) {
- propertyChanged = true;
- animated.push($el);
- break;
- }
- }
+ let enteringIndex = 0;
+ let leavingIndex = 0;
+ let animatingIndex = 0;
+
+ newState.forEachRootNode(node => {
+
+ const $el = node.$el;
+ const parent = node.parentNode;
+ const oldStateNode = oldState.nodes.get(node.id);
+ const nodeProperties = node.properties;
+ const oldStateNodeProperties = oldStateNode.properties;
+
+ // Use closest animated parent index and total values so that children staggered delays are in sync with their parent
+ let animatedParent = parent !== rootNode && parent;
+ while (animatedParent && !animatedParent.isTarget && animatedParent !== rootNode) {
+ animatedParent = animatedParent.parentNode;
}
- const nodeHasChanged = (propertyChanged || topLevelAdded || topLevelRemoved || becomeVisible);
- const nodeIsAnimated = node.isTarget && nodeHasChanged;
+ const animatingTotal = animating.length;
+
+ // Root is always animated first in sync with the first child (animating.length is the total of children)
+ if (node === rootNode) {
+ node.index = 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else if (node.isEntering) {
+ node.index = animatedParent ? animatedParent.index : enteringIndex;
+ node.total = animatedParent ? animatingTotal : entering.length;
+ updateNodeTimingParams(node, enterFromTimings);
+ enteringIndex++;
+ } else if (node.isLeaving) {
+ node.index = animatedParent ? animatedParent.index : leavingIndex;
+ node.total = animatedParent ? animatingTotal : leaving.length;
+ leavingIndex++;
+ updateNodeTimingParams(node, leaveToTimings);
+ } else if (node.isTarget) {
+ node.index = animatingIndex++;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, animationTimings);
+ } else {
+ node.index = animatedParent ? animatedParent.index : 0;
+ node.total = animatingTotal;
+ updateNodeTimingParams(node, swapAtTimings);
+ }
- node.isAnimated = nodeIsAnimated;
- node.branchAdded = parentAdded || topLevelAdded;
- node.branchRemoved = parentRemoved || topLevelRemoved;
- node.branchNotRendered = parentNotRendered || node.measuredIsRemoved;
+ // Make sure the old state node has its inex and total values up to date for valid "from" function values calculation
+ oldStateNode.index = node.index;
+ oldStateNode.total = node.total;
+ // Computes all values up front so we can check for changes and we don't have to re-compute them inside the animation props
+ for (let prop in nodeProperties) {
+ nodeProperties[prop] = getFunctionValue(nodeProperties[prop], $el, node.index, node.total);
+ oldStateNodeProperties[prop] = getFunctionValue(oldStateNodeProperties[prop], $el, oldStateNode.index, oldStateNode.total);
+ }
+
+ // Use a 1px tolerance to detect dimensions changes to prevent width / height animations on barelly visible elements
const sizeTolerance = 1;
- const widthChanged = Math.abs(node.properties.width - oldStateNode.properties.width) > sizeTolerance;
- const heightChanged = Math.abs(node.properties.height - oldStateNode.properties.height) > sizeTolerance;
+ const widthChanged = Math.abs(nodeProperties.width - oldStateNodeProperties.width) > sizeTolerance;
+ const heightChanged = Math.abs(nodeProperties.height - oldStateNodeProperties.height) > sizeTolerance;
node.sizeChanged = (widthChanged || heightChanged);
- targets.push($el);
+ // const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
+
+ if (node.isTarget && (!node.measuredIsRemoved && oldStateNode.measuredIsVisible || node.measuredIsRemoved && node.measuredIsVisible)) {
+ if (!node.isInlined && (nodeProperties.transform !== 'none' || oldStateNodeProperties.transform !== 'none')) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ for (let prop in nodeProperties) {
+ // if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop] || hiddenStateChanged)) {
+ if (prop !== 'transform' && (nodeProperties[prop] !== oldStateNodeProperties[prop])) {
+ animated.push($el);
+ break;
+ }
+ }
+ }
if (!node.isTarget) {
- frozen.push($el);
- if ((nodeHasChanged || node.sizeChanged) && parent && parent.isTarget && parent.isAnimated && parent.sizeChanged) {
- animatedFrozen.push($el);
+ swapping.push($el);
+ if (node.sizeChanged && parent && parent.isTarget && parent.sizeChanged) {
+ if (!node.isInlined && swapAtProps.transform) {
+ node.hasTransform = true;
+ transformed.push($el);
+ }
+ animatedSwap.push($el);
}
}
+
});
- const defaults = {
- ease: setValue(params.ease, this.ease),
- duration: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).duration,
- delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
+ const timingParams = {
+ delay: (/** @type {HTMLElement} */$el) => newState.getNode($el).delay,
+ duration: (/** @type {HTMLElement} */$el) => newState.getNode($el).duration,
+ ease: (/** @type {HTMLElement} */$el) => newState.getNode($el).ease,
}
- this.timeline = createTimeline({
- onComplete: () => {
- // Make sure to call .cancel() after restoreNodeInlineStyles(node); otehrwise the commited styles get reverted
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(node => {
- restoreNodeVisualState(node);
- restoreNodeInlineStyles(node);
- });
- for (let i = 0, l = transformed.length; i < l; i++) {
- const $el = transformed[i];
- $el.style.transform = newState.getValue($el, 'transform');
- }
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- // Avoid CSS transitions at the end of the animation by restoring them on the next frame
- requestAnimationFrame(() => {
- if (this.root.classList.contains('is-animated')) return;
- restoreLayoutTransition(this.transitionMuteStore);
- });
- },
- onPause: () => {
- if (this.transformAnimation) this.transformAnimation.cancel();
- newState.forEachRootNode(restoreNodeVisualState);
- this.root.classList.remove('is-animated');
- if (onComplete) onComplete(this);
- },
- composition: false,
- defaults,
- });
+ tlParams.defaults = timingParams;
+
+ this.timeline = createTimeline(tlParams);
+
+ // Imediatly return the timeline if no layout changes detected
+ if (!animated.length && !transformed.length && !swapping.length) {
+ // Make sure to restore all CSS transition if no animation
+ restoreLayoutTransition(this.transitionMuteStore);
+ return this.timeline.complete();
+ }
if (targets.length) {
@@ -1200,15 +1389,14 @@ export class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
- // Make sure to mute all CSS transition before applying the oldState styles back
- muteNodeTransition(newNode);
+ // muteNodeTransition(newNode);
// Don't animate dimensions and positions of inlined elements
if (!newNode.isInlined) {
// Display grid can mess with the absolute positioning, so set it to block during transition
- if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.display = 'block';
- // All children must be in position absolue
- if ($el !== root || this.absoluteCoords) {
+ if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.setProperty('display', 'block', 'important');
+ // All children must be in position absolute or fixed
+ if ($el !== $root || this.absoluteCoords) {
$el.style.position = this.absoluteCoords ? 'fixed' : 'absolute';
$el.style.left = '0px';
$el.style.top = '0px';
@@ -1216,7 +1404,7 @@ export class AutoLayout {
$el.style.marginTop = '0px';
$el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
}
- if ($el === root && newNode.measuredPosition === 'static') {
+ if ($el === $root && newNode.measuredPosition === 'static') {
$el.style.position = 'relative';
// Cancel left / trop in case the static element had muted values now activated by potision relative
$el.style.left = '0px';
@@ -1235,9 +1423,7 @@ export class AutoLayout {
// Restore the scroll position if the oldState differs from the current state
if (oldState.scrollX !== window.scrollX || oldState.scrollY !== window.scrollY) {
// Restoring in the next frame avoids race conditions if for example a waapi animation commit styles that affect the root height
- requestAnimationFrame(() => {
- window.scrollTo(oldState.scrollX, oldState.scrollY);
- });
+ requestAnimationFrame(() => window.scrollTo(oldState.scrollX, oldState.scrollY));
}
for (let i = 0, l = animated.length; i < l; i++) {
@@ -1247,25 +1433,25 @@ export class AutoLayout {
const newNode = newState.nodes.get(id);
const oldNodeState = oldNode.properties;
const newNodeState = newNode.properties;
- let hasChanged = false;
+ let nodeHasChanged = false;
+ /** @type {AnimationParams} */
const animatedProps = {
composition: 'none',
- // delay: (/** @type {HTMLElement} */$el) => newState.nodes.get($el.dataset.layoutId).delay,
}
if (!newNode.isInlined) {
if (oldNodeState.width !== newNodeState.width) {
animatedProps.width = [oldNodeState.width, newNodeState.width];
- hasChanged = true;
+ nodeHasChanged = true;
}
if (oldNodeState.height !== newNodeState.height) {
animatedProps.height = [oldNodeState.height, newNodeState.height];
- hasChanged = true;
+ nodeHasChanged = true;
}
// If the node has transforms we handle the translate animation in wappi otherwise translate and other transforms can be out of sync
// Always animate translate
if (!newNode.hasTransform) {
animatedProps.translate = [`${oldNodeState.x}px ${oldNodeState.y}px`, `${newNodeState.x}px ${newNodeState.y}px`];
- hasChanged = true;
+ nodeHasChanged = true;
}
}
this.properties.forEach(prop => {
@@ -1273,73 +1459,77 @@ export class AutoLayout {
const newVal = newNodeState[prop];
if (prop !== 'transform' && oldVal !== newVal) {
animatedProps[prop] = [oldVal, newVal];
- hasChanged = true;
+ nodeHasChanged = true;
}
});
- if (hasChanged) {
+ if (nodeHasChanged) {
this.timeline.add($el, animatedProps, 0);
}
}
}
- if (frozen.length) {
+ if (swapping.length) {
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const oldNode = oldState.nodes.get($el.dataset.layoutId);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const oldNode = oldState.getNode($el);
if (!oldNode.isInlined) {
- const oldNodeState = oldState.get($el);
- $el.style.width = `${oldNodeState.width}px`;
- $el.style.height = `${oldNodeState.height}px`;
+ const oldNodeProps = oldNode.properties;
+ $el.style.width = `${oldNodeProps.width}px`;
+ $el.style.height = `${oldNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${oldNodeState.x}px ${oldNodeState.y}px`;
+ $el.style.translate = `${oldNodeProps.x}px ${oldNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${oldState.getValue($el, prop)}`;
+ $el.style[prop] = `${oldState.getComputedValue($el, prop)}`;
}
});
}
- for (let i = 0, l = frozen.length; i < l; i++) {
- const $el = frozen[i];
- const newNode = newState.nodes.get($el.dataset.layoutId);
- const newNodeState = newState.get($el);
+ for (let i = 0, l = swapping.length; i < l; i++) {
+ const $el = swapping[i];
+ const newNode = newState.getNode($el);
+ const newNodeProps = newNode.properties;
this.timeline.call(() => {
if (!newNode.isInlined) {
- $el.style.width = `${newNodeState.width}px`;
- $el.style.height = `${newNodeState.height}px`;
+ $el.style.width = `${newNodeProps.width}px`;
+ $el.style.height = `${newNodeProps.height}px`;
// Overrides user defined min and max to prevents width and height clamping
$el.style.minWidth = `auto`;
$el.style.minHeight = `auto`;
$el.style.maxWidth = `none`;
$el.style.maxHeight = `none`;
- $el.style.translate = `${newNodeState.x}px ${newNodeState.y}px`;
+ $el.style.translate = `${newNodeProps.x}px ${newNodeProps.y}px`;
}
this.properties.forEach(prop => {
if (prop !== 'transform') {
- $el.style[prop] = `${newState.getValue($el, prop)}`;
+ $el.style[prop] = `${newState.getComputedValue($el, prop)}`;
}
});
}, newNode.delay + newNode.duration / 2);
}
- if (animatedFrozen.length) {
- const animatedFrozenParams = /** @type {AnimationParams} */({});
- if (frozenParams) {
- for (let prop in frozenParams) {
- animatedFrozenParams[prop] = [
- { from: (/** @type {HTMLElement} */$el) => oldState.getValue($el, prop), ease: 'in(1.75)', to: frozenParams[prop] },
- { from: frozenParams[prop], to: (/** @type {HTMLElement} */$el) => newState.getValue($el, prop), ease: 'out(1.75)' }
- ]
+ if (animatedSwap.length) {
+ const ease = parseEase(newState.nodes.get(animatedSwap[0].dataset.layoutId).ease);
+ const inverseEased = t => 1 - ease(1 - t);
+ const animatedSwapParams = /** @type {AnimationParams} */({});
+ if (swapAtProps) {
+ for (let prop in swapAtProps) {
+ if (prop !== 'transform') {
+ animatedSwapParams[prop] = [
+ { from: (/** @type {HTMLElement} */$el) => oldState.getComputedValue($el, prop), to: swapAtProps[prop] },
+ { from: swapAtProps[prop], to: (/** @type {HTMLElement} */$el) => newState.getComputedValue($el, prop), ease: inverseEased }
+ ]
+ }
}
}
- this.timeline.add(animatedFrozen, animatedFrozenParams, 0);
+ this.timeline.add(animatedSwap, animatedSwapParams, 0);
}
}
@@ -1347,18 +1537,29 @@ export class AutoLayout {
const transformedLength = transformed.length;
if (transformedLength) {
- // We only need to set the transform property here since translate is alread defined the targets loop
+ // We only need to set the transform property here since translate is alread defined in the targets loop
for (let i = 0; i < transformedLength; i++) {
const $el = transformed[i];
- $el.style.translate = `${oldState.get($el).x}px ${oldState.get($el).y}px`,
- $el.style.transform = oldState.getValue($el, 'transform');
+ $el.style.translate = `${oldState.getComputedValue($el, 'x')}px ${oldState.getComputedValue($el, 'y')}px`,
+ $el.style.transform = oldState.getComputedValue($el, 'transform');
+ if (animatedSwap.includes($el)) {
+ const node = newState.getNode($el);
+ node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);
+ node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);
+ }
}
this.transformAnimation = waapi.animate(transformed, {
- translate: (/** @type {HTMLElement} */$el) => `${newState.get($el).x}px ${newState.get($el).y}px`,
- transform: (/** @type {HTMLElement} */$el) => newState.getValue($el, 'transform'),
+ translate: (/** @type {HTMLElement} */$el) => `${newState.getComputedValue($el, 'x')}px ${newState.getComputedValue($el, 'y')}px`,
+ transform: (/** @type {HTMLElement} */$el) => {
+ const newValue = newState.getComputedValue($el, 'transform');
+ if (!animatedSwap.includes($el)) return newValue;
+ const oldValue = oldState.getComputedValue($el, 'transform');
+ const node = newState.getNode($el);
+ return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]
+ },
autoplay: false,
persist: true,
- ...defaults,
+ ...timingParams,
});
this.timeline.sync(this.transformAnimation, 0);
}
@@ -1369,13 +1570,12 @@ export class AutoLayout {
/**
* @param {(layout: this) => void} callback
* @param {LayoutAnimationParams} [params]
- * @return {this}
+ * @return {Timeline}
*/
update(callback, params = {}) {
this.record();
callback(this);
- this.animate(params);
- return this;
+ return this.animate(params);
}
}
diff --git a/src/timer/timer.js b/src/timer/timer.js
index bac40bdb..0949a951 100644
--- a/src/timer/timer.js
+++ b/src/timer/timer.js
@@ -494,10 +494,11 @@ export class Timer extends Clock {
/**
* Imediatly completes the timer, cancels it and triggers the onComplete callback
+ * @param {Boolean|Number} [muteCallbacks]
* @return {this}
*/
- complete() {
- return this.seek(this.duration).cancel();
+ complete(muteCallbacks = 0) {
+ return this.seek(this.duration, muteCallbacks).cancel();
}
/**
diff --git a/src/types/index.js b/src/types/index.js
index e65997fb..f19b18a9 100644
--- a/src/types/index.js
+++ b/src/types/index.js
@@ -38,7 +38,7 @@ export {}
* @property {Number|FunctionValue} [duration]
* @property {Number|FunctionValue} [delay]
* @property {Number} [loopDelay]
- * @property {EasingParam} [ease]
+ * @property {EasingParam|FunctionValue} [ease]
* @property {'none'|'replace'|'blend'|compositionTypes} [composition]
* @property {(v: any) => any} [modifier]
* @property {Callback<Tickable>} [onBegin]
@@ -203,7 +203,7 @@ export {}
* @param {Target} target - The animated target
* @param {Number} index - The target index
* @param {Number} length - The total number of animated targets
- * @return {Number|String|TweenObjectValue|Array.<Number|String|TweenObjectValue>}
+ * @return {Number|String|TweenObjectValue|EasingParam|Array.<Number|String|TweenObjectValue>}
*/
/**
@@ -271,7 +271,7 @@ export {}
// JSAnimation types
/**
- * @typedef {Number|String|FunctionValue} TweenParamValue
+ * @typedef {Number|String|FunctionValue|EasingParam} TweenParamValue
*/
/**
@@ -286,7 +286,7 @@ export {}
* @typedef {Object} TweenParamsOptions
* @property {TweenParamValue} [duration]
* @property {TweenParamValue} [delay]
- * @property {EasingParam} [ease]
+ * @property {EasingParam|FunctionValue} [ease]
* @property {TweenModifier} [modifier]
* @property {TweenComposition} [composition]
*/
@@ -395,7 +395,7 @@ export {}
* @param {DOMTarget} target - The animated target
* @param {Number} index - The target index
* @param {Number} length - The total number of animated targets
- * @return {WAAPITweenValue}
+ * @return {WAAPITweenValue|WAAPIEasingParam}
*/
/**
@@ -421,7 +421,7 @@ export {}
* @property {Number} [playbackRate]
* @property {Number|WAAPIFunctionValue} [duration]
* @property {Number|WAAPIFunctionValue} [delay]
- * @property {WAAPIEasingParam} [ease]
+ * @property {WAAPIEasingParam|WAAPIFunctionValue} [ease]
* @property {CompositeOperation} [composition]
* @property {Boolean} [persist]
* @property {Callback<WAAPIAnimation>} [onComplete]
diff --git a/src/waapi/waapi.js b/src/waapi/waapi.js
index d33dc80b..98081159 100644
--- a/src/waapi/waapi.js
+++ b/src/waapi/waapi.js
@@ -224,8 +224,6 @@ export class WAAPIAnimation {
console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);
}
- const ease = setValue(params.ease, parseWAAPIEasing(globals.defaults.ease));
- const spring = /** @type {Spring} */(ease).ease && ease;
const autoplay = setValue(params.autoplay, globals.defaults.autoplay);
const scroll = autoplay && /** @type {ScrollObserver} */(autoplay).link ? autoplay : false;
const alternate = params.alternate && /** @type {Boolean} */(params.alternate) === true;
@@ -236,8 +234,6 @@ export class WAAPIAnimation {
const direction = alternate ? reversed ? 'alternate-reverse' : 'alternate' : reversed ? 'reverse' : 'normal';
/** @type {FillMode} */
const fill = 'both'; // We use 'both' here because the animation can be reversed during playback
- /** @type {String} */
- const easing = parseWAAPIEasing(ease);
const timeScale = (globals.timeScale === 1 ? 1 : K);
/** @type {DOMTargetsArray}] */
@@ -278,6 +274,15 @@ export class WAAPIAnimation {
const elStyle = $el.style;
const inlineStyles = this._inlineStyles[i] = {};
+ const easeToParse = setValue(params.ease, globals.defaults.ease);
+
+ const easeFunctionResult = getFunctionValue(easeToParse, $el, i, targetsLength);
+ const keyEasing = isFnc(easeFunctionResult) || isStr(easeFunctionResult) ? easeFunctionResult : easeToParse;
+
+ const spring = /** @type {Spring} */(easeToParse).ease && easeToParse;
+ /** @type {String} */
+ const easing = parseWAAPIEasing(keyEasing);
+
/** @type {Number} */
const duration = (spring ? /** @type {Spring} */(spring).settlingDuration : getFunctionValue(setValue(params.duration, globals.defaults.duration), $el, i, targetsLength)) * timeScale;
/** @type {Number} */
@@ -302,7 +307,7 @@ export class WAAPIAnimation {
let parsedPropertyValue;
if (isObj(propertyValue)) {
const tweenOptions = /** @type {WAAPITweenOptions} */(propertyValue);
- const tweenOptionsEase = setValue(tweenOptions.ease, ease);
+ const tweenOptionsEase = setValue(tweenOptions.ease, easing);
const tweenOptionsSpring = /** @type {Spring} */(tweenOptionsEase).ease && tweenOptionsEase;
const to = /** @type {WAAPITweenOptions} */(tweenOptions).to;
const from = /** @type {WAAPITweenOptions} */(tweenOptions).from;
diff --git a/examples/auto-layout/clone/index.html b/tests/playground/layout/clone/index.html
similarity index 100%
rename from examples/auto-layout/clone/index.html
rename to tests/playground/layout/clone/index.html
diff --git a/examples/auto-layout/clone/index.js b/tests/playground/layout/clone/index.js
similarity index 84%
rename from examples/auto-layout/clone/index.js
rename to tests/playground/layout/clone/index.js
index 66435c9a..7d3c653b 100644
--- a/examples/auto-layout/clone/index.js
+++ b/tests/playground/layout/clone/index.js
@@ -1,4 +1,4 @@
-import { createLayout, utils } from '../../../../dist/modules/index.js';
+import { createLayout, utils } from '../../../dist/modules/index.js';
const layout = createLayout('.container', {
properties: ['color'],
@@ -15,5 +15,6 @@ const moveCard = $card => {
document.addEventListener('click', e => {
const $card = e.target.closest('.card');
+ console.log($card);
if ($card) layout.update(() => moveCard($card));
});
diff --git a/tests/playground/layout/index.html b/tests/playground/layout/index.html
index 1c6bfad3..42c38516 100644
--- a/tests/playground/layout/index.html
+++ b/tests/playground/layout/index.html
@@ -161,6 +161,9 @@
.vertical {
flex-direction: column;
}
+ .vertical.reverse {
+ flex-direction: column-reverse;
+ }
.horizontal {
flex-direction: row;
}
@@ -441,6 +444,56 @@
</div>
</div>
</div>
+ <div id="stagger-timings" class="test fixed-height">
+ <div class="test-header">
+ <h2>Stagger timings</h2>
+ <button>Animate</button>
+ </div>
+ <div class="demo">
+ <div class="container vertical reverse">
+ <div class="child child-animated"><div>anim</div></div>
+ <div class="child child-removed"><div>rem</div></div>
+ <div class="child child-added" style="display: none"><div>add</div></div>
+ <div class="child child-animated"><div>anim</div></div>
+ <div class="child child-removed"><div>rem</div></div>
+ <div class="child child-added" style="display: none"><div>add</div></div>
+ <div class="child child-animated"><div>anim</div></div>
+ <div class="child child-removed"><div>rem</div></div>
+ <div class="child child-added" style="display: none"><div>add</div></div>
+ </div>
+ </div>
+ </div>
+ <div id="stagger-values" class="test fixed-height">
+ <div class="test-header">
+ <h2>Stagger values</h2>
+ <button>Animate</button>
+ </div>
+ <div class="demo">
+ <div class="container vertical reverse">
+ <div class="child child-animated"><div>anim</div></div>
+ <div class="child child-removed"><div>rem</div></div>
+ <div class="child child-added" style="display: none"><div>add</div></div>
+ <div class="child child-animated"><div>anim</div></div>
+ <div class="child child-removed"><div>rem</div></div>
+ <div class="child child-added" style="display: none"><div>add</div></div>
+ <div class="child child-animated"><div>anim</div></div>
+ <div class="child child-removed"><div>rem</div></div>
+ <div class="child child-added" style="display: none"><div>add</div></div>
+ </div>
+ </div>
+ </div>
+ <div id="transformed-parent" class="test fixed-height">
+ <div class="test-header">
+ <h2>Transformed parent</h2>
+ <button>Animate</button>
+ </div>
+ <div class="demo" style="transform: rotate(20deg) scale(.87); perspective: 1000px;">
+ <div class="container vertical reverse" style="transform: rotateX(-40deg); transform-style: preserve-3d;">
+ <div class="child">A direct <span>child</span> element. <div class="sub-child"> And a <span>sub child</span> element</div></div>
+ <div class="child">A direct <span>child</span> element. <div class="sub-child"> And a <span>sub child</span> element</div></div>
+ </div>
+ </div>
+ </div>
<div id="swap-inside-root" class="test fixed-height double-container">
<div class="test-header">
<h2>Swap element inside root</h2>
diff --git a/tests/playground/layout/index.js b/tests/playground/layout/index.js
index 301b5117..866cc02d 100644
--- a/tests/playground/layout/index.js
+++ b/tests/playground/layout/index.js
@@ -115,11 +115,13 @@ const tests = [
data.$button = utils.$('button')[0];
data.layout = createLayout('.container', {
children: ['.child', '.child > span'],
- frozen: {
+ swapAt: {
color: 'var(--red-1)',
borderColor: 'var(--red-1)',
filter: 'blur(5px)',
- }
+ transform: 'scale(.8)',
+ ease: 'inOutExpo'
+ },
});
data.$button.addEventListener('click', () => {
data.layout.update(({ root }) => {
@@ -132,7 +134,7 @@ const tests = [
data.layout = createLayout('.container', {
children: ['.child', '.child > span'],
properties: ['background-color'],
- removed: {
+ leaveTo: {
transform: 'rotate(45deg) scale(0)',
},
});
@@ -141,7 +143,7 @@ const tests = [
const $child = root.querySelector('.child');
root.classList.toggle('vertical');
$child.style.display = $child.style.display === 'none' ? 'block' : 'none';
- }, { duration, removed: { 'background-color': 'var(--red-1)' } })
+ }, { duration, leaveTo: { 'background-color': 'var(--red-1)' } })
});
}),
createScope({ root: '#added-properties' }).add(({ data }) => {
@@ -149,7 +151,7 @@ const tests = [
data.layout = createLayout('.container', {
properties: ['background-color'],
children: ['.child', '.child > span'],
- added: {
+ enterFrom: {
transform: 'rotate(-45deg) scale(0)',
},
});
@@ -158,7 +160,7 @@ const tests = [
root.classList.toggle('vertical');
const $child = root.querySelector('.child');
$child.style.display = $child.style.display === 'none' ? 'block' : 'none';
- }, { duration, added: { 'background-color': 'var(--green-1)' } })
+ }, { duration, enterFrom: { 'background-color': 'var(--green-1)' } })
});
}),
createScope({ root: '#custom-timings' }).add(({ data }) => {
@@ -207,7 +209,7 @@ const tests = [
data.$button.addEventListener('click', () => {
const $newContainer = root.querySelector('.container.target-container');
const $oldContainer = root.querySelector('.container:not(.target-container)');
- data.layout.update(({root}) => {
+ data.layout.update(() => {
$newContainer.classList.remove('target-container');
$oldContainer.classList.add('target-container');
}, { duration })
@@ -244,4 +246,87 @@ const tests = [
}, { duration })
});
}),
+ createScope({ root: '#stagger-timings' }).add(({ root, data }) => {
+ data.$button = utils.$('button')[0];
+ const $container = utils.$('.container');
+ data.layout = createLayout('.container', {
+ children: '.child',
+ delay: stagger(200),
+ onBegin: () => {
+ utils.set($container, {
+ background: 'var(--sky-2)',
+ })
+ },
+ onComplete: () => {
+ utils.set($container, {
+ background: 'var(--green-2)',
+ })
+ },
+ enterFrom: {
+ opacity: 0,
+ background: 'var(--green-1)',
+ transform: 'translateX(-100%)',
+ },
+ leaveTo: {
+ opacity: 0,
+ background: 'var(--red-1)',
+ transform: 'translateX(100%)',
+ },
+ swapAt: {
+ opacity: 0,
+ background: 'var(--yellow-1)',
+ }
+ });
+ data.$button.addEventListener('click', () => {
+ const $added = root.querySelectorAll('.child-added');
+ const $removed = root.querySelectorAll('.child-removed');
+ data.layout.update(({root}) => {
+ const isReverse = root.classList.contains('reverse');
+ root.classList.toggle('reverse');
+ root.classList.toggle('vertical');
+ utils.set($added, { display: isReverse ? 'block' : 'none' });
+ utils.set($removed, { display: isReverse ? 'none' : 'block' });
+ }, { duration })
+ });
+ }),
+ createScope({ root: '#stagger-values' }).add(({ root, data }) => {
+ data.$button = utils.$('button')[0];
+ data.layout = createLayout('.container', {
+ children: '.child',
+ delay: stagger(200),
+ enterFrom: {
+ opacity: 0,
+ innerHTML: (_, i, t) => `enter: ${i}, ${t}`,
+ },
+ leaveTo: {
+ opacity: 0,
+ innerHTML: (_, i, t) => `leave: ${i}, ${t}`,
+ },
+ swapAt: {
+ opacity: 0,
+ innerHTML: (_, i, t) => `swap: ${i}, ${t}`,
+ }
+ });
+ data.$button.addEventListener('click', () => {
+ const $added = root.querySelectorAll('.child-added');
+ const $removed = root.querySelectorAll('.child-removed');
+ data.layout.update(({root}) => {
+ const isReverse = root.classList.contains('reverse');
+ root.classList.toggle('reverse');
+ root.classList.toggle('vertical');
+ utils.set($added, { display: isReverse ? 'block' : 'none' });
+ utils.set($removed, { display: isReverse ? 'none' : 'block' });
+ }, { duration })
+ });
+ }),
+ createScope({ root: '#transformed-parent' }).add(({ root, data }) => {
+ data.$button = utils.$('button')[0];
+ data.layout = createLayout('.container');
+ data.$button.addEventListener('click', () => {
+ data.layout.update(({ root }) => {
+ root.classList.toggle('vertical');
+ root.style.transform = `rotateX(${utils.random(-75, 75)}deg) rotateY(${utils.random(-75, 75)}deg) scale(${utils.random(.75, 1, 2)})`;
+ }, { duration })
+ });
+ })
]
\ No newline at end of file
diff --git a/tests/suites/function-based-values.test.js b/tests/suites/function-based-values.test.js
index ba31eca0..3d8b1a70 100644
--- a/tests/suites/function-based-values.test.js
+++ b/tests/suites/function-based-values.test.js
@@ -29,6 +29,9 @@ suite('Function based values', () => {
const index = parseFloat(el.dataset.index);
return total + ((i + index) * 100);
},
+ ease: () => {
+ return (/** @type {Number} */t) => t;
+ },
});
// Property value
@@ -83,8 +86,8 @@ suite('Function based values', () => {
const animation = animate($targets, {
autoplay: false,
translateX: [
- { to: el => el.getAttribute('data-index') * 100, duration: stagger(100), delay: stagger(100) },
- { to: el => el.getAttribute('data-index') * 50, duration: stagger(100), delay: stagger(100) }
+ { to: el => el.getAttribute('data-index') * 100, duration: stagger(100), delay: stagger(100), ease: () => t => t },
+ { to: el => el.getAttribute('data-index') * 50, duration: stagger(100), delay: stagger(100), ease: () => t => t }
],
});
diff --git a/tests/suites/waapi.test.js b/tests/suites/waapi.test.js
index e0504f39..21f5f01d 100644
--- a/tests/suites/waapi.test.js
+++ b/tests/suites/waapi.test.js
@@ -46,7 +46,7 @@ suite('WAAPI', () => {
test('Animate multiple elements', resolve => {
const targets = utils.$('.target-class');
- const animation = waapi.animate(targets, {
+ waapi.animate(targets, {
transform: `translateX(100px)`,
duration: 10,
onComplete: anim => {
@@ -62,7 +62,7 @@ suite('WAAPI', () => {
test('Animate multiple elements with stagger', resolve => {
const targets = utils.$('.target-class');
- const animation = waapi.animate(targets, {
+ waapi.animate(targets, {
transform: `translateX(100px)`,
duration: 10,
delay: stagger(1),
@@ -79,7 +79,7 @@ suite('WAAPI', () => {
test('Animate with function based values', resolve => {
const targets = utils.$('.target-class');
- const animation = waapi.animate(targets, {
+ waapi.animate(targets, {
transform: (_, i) => `translateX(${i * 100}px)`,
duration: 10,
delay: stagger(1),
@@ -93,9 +93,25 @@ suite('WAAPI', () => {
});
});
- test('Animate with function based keyframes value', resolve => {
+ test('Animate with function based properties', () => {
const targets = utils.$('.target-class');
const animation = waapi.animate(targets, {
+ transform: `translateX(100px)`,
+ duration: (_, i) => i * 20,
+ delay: (_, i) => i * 5,
+ ease: () => (t) => t,
+ autoplay: false
+ });
+ animation.seek(20).commitStyles();
+ expect(utils.get(targets[0], 'x')).to.equal('100px');
+ expect(utils.get(targets[1], 'x')).to.equal('75px');
+ expect(utils.get(targets[2], 'x')).to.equal('25px');
+ expect(utils.get(targets[3], 'x')).to.equal('8.33333px');
+ });
+
+ test('Animate with function based keyframes value', resolve => {
+ const targets = utils.$('.target-class');
+ waapi.animate(targets, {
transform: ['translateX(200px)', (_, i) => `translateX(${i * 100}px)`],
duration: 10,
delay: stagger(1),