Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

v4.1.0

Julian Garnier5afd38f9a2b3
diff --git a/assets/sponsors/huly-logomark-dark.png b/assets/sponsors/huly-logomark-dark.png
deleted file mode 100644
index 3ee75cf5..00000000
Binary files a/assets/sponsors/huly-logomark-dark.png and /dev/null differ
diff --git a/assets/sponsors/huly-logomark.png b/assets/sponsors/huly-logomark.png
deleted file mode 100644
index 2660665f..00000000
Binary files a/assets/sponsors/huly-logomark.png and /dev/null differ
diff --git a/examples/svg-graph/index.html b/examples/svg-graph/index.html
new file mode 100644
index 00000000..f43b4905
--- /dev/null
+++ b/examples/svg-graph/index.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>SVG Graph / 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 {
+ min-height: 100lvh;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+ #graph {
+ position: relative;
+ border: 1px solid rgba(255,255,255,.1);
+ width: 942px;
+ height: 352px;
+ background: #272421;
+ }
+ svg {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ }
+ #views {
+ position: absolute;
+ top: 20px;
+ right: 20px;
+ font-family: BerkeleyMono-Regular;
+ font-size: 50px;
+ text-align: right;
+ }
+ #label {
+ display: block;
+ font-size: 20px;
+ color: #F6F4F2;
+ }
+ #count {
+ font-family: BerkeleyMono-Regular;
+ font-size: 50px;
+ color: #B7FF54;
+ text-align: right;
+ }
+ </style>
+</head>
+<body>
+ <div id="graph">
+ <svg width="940" height="290" viewBox="0 0 940 290"><defs><linearGradient id="c" x1="50%" x2="50%" y1=".399%" y2="87.205%"><stop offset="0%" stop-color="#B7FF54" stop-opacity=".211"/><stop offset="100%" stop-color="#B7FF54" stop-opacity="0"/></linearGradient><rect id="b" width="900" height="250" x="0" y="0"/><path id="a" d="M0,0 L940,0 L940,290 L0,290 L0,0 Z"/></defs><g fill="none" fill-rule="evenodd"><use xlink:href="#a" fill="#272421"/><g transform="translate(20 20)"><mask id="d" fill="#fff"><use xlink:href="#b"/></mask><path fill="url(#c)" stroke="#B7FF54" stroke-width="4" d="M-29.9084975,125.442049 C0.592599392,125.442049 26.5003803,199.691642 59.4112837,199.691642 C92.322187,199.691642 113.7965,108.141783 127.38192,79.926918 C140.96734,51.7120527 152.068784,5.15668539 180.801803,30.2096433 C209.534821,55.2626012 212.50407,56.7639176 230.281891,56.7639176 C248.059712,56.7639176 281.005076,76.9686041 289.048637,107.339775 C297.092198,137.710946 301.167159,161.192233 318.659135,171.388065 C336.151111,181.583897 346.858132,163.610445 355.870023,132.663097 C364.881913,101.715749 367.137656,101.502549 393.914073,101.502549 C420.69049,101.502549 435.873542,104.822478 454.251861,114.536107 C472.63018,124.249736 492.205061,129.256489 502.089999,151.958408 C511.974938,174.660327 523.807615,199.691642 549.270028,199.691642 C574.732442,199.691642 579.028989,136.335995 586.711365,114.536107 C594.393742,92.7362195 620.605115,121.939481 640.47249,125.442049 C660.339864,128.944617 697.353541,112.61418 705.490168,133.317716 C713.626795,154.021252 727.481496,188.892846 756.256164,188.892846 C785.030831,188.892846 781.166604,121.152289 823.970316,113.461034 C866.774027,105.769778 893.00728,107.339775 907.900967,107.339775 C907.900967,107.339775 907.900967,166.243609 907.900967,284.051276 L-29.9084975,284.051276 C-29.9084975,178.017092 -29.9084975,125.14735 -29.9084975,125.442049 Z" mask="url(#d)"/></g></g></svg>
+ <div id="views"><span id="label">views</span><span id="count">1145097</span></div>
+ </div>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
diff --git a/examples/svg-graph/index.js b/examples/svg-graph/index.js
new file mode 100644
index 00000000..396b4a36
--- /dev/null
+++ b/examples/svg-graph/index.js
@@ -0,0 +1,39 @@
+import {
+ svg,
+ animate,
+ createTimeline,
+ stagger,
+ utils,
+} from '../../lib/anime.esm.js';
+
+const line = svg.createDrawable('line');
+
+createTimeline({
+ loop: true,
+ defaults: {
+ ease: 'inOut(3)',
+ duration: 2000,
+ }
+})
+.add('#views', {
+ opacity: [0, 1],
+ duration: 500,
+}, 0)
+.add('#b', {
+ x: [0, 0],
+ width: [0, 900],
+}, 0)
+.add('#count', {
+ innerHTML: { from: 0 },
+ modifier: v => utils.round(v, 0).toLocaleString(),
+}, '<<')
+.add('#b', {
+ x: 900,
+ width: 0,
+ duration: 1500,
+}, '+=500')
+.add('#views', {
+ opacity: 0,
+ duration: 1500,
+}, '<<')
+.init()
diff --git a/examples/text/hover-effects/index.html b/examples/text/hover-effects/index.html
new file mode 100644
index 00000000..06cd4928
--- /dev/null
+++ b/examples/text/hover-effects/index.html
@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Text / Hover effects / 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">
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:[email protected]&display=swap" rel="stylesheet">
+ <style>
+
+body {
+ display: flex;
+ justify-content: center;
+ flex-direction: column;
+ align-items: center;
+ min-height: 100svh;
+ font-family: "Noto Sans JP", sans-serif;
+ font-kerning: none;
+ font-variant-ligatures: none;
+ text-rendering: optimizeSpeed;
+}
+
+main {
+ margin: 0 auto;
+ padding: 20px;
+ width: 100%;
+ max-width: 1200px;
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
+ gap: 20px;
+ justify-content: center;
+ container-type: inline-size;
+}
+
+article {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ min-height: 200px;
+ padding: 20px;
+ container-type: inline-size;
+ border-radius: 1cqw;
+ background: #2A2A2A;
+ color: #D0D0D0;
+ transition: background-color .25s ease-out;
+}
+
+article:has(p) {
+ /*justify-content: flex-start;*/
+ align-items: flex-start;
+}
+
+article:hover {
+ cursor: default;
+ background: #303030;
+}
+
+article a,
+article a span {
+ color: var(--red);
+}
+
+article a span {
+ text-decoration: underline;
+}
+
+article code {
+ font-family: monospace;
+ color: #B0B0B0;
+}
+
+article p {
+ width: 100%;
+ font-size: clamp(14px, 5cqw, 18px);
+}
+
+article strong {
+ font-weight: 600;
+}
+
+article h2 {
+ text-align: center;
+ font-size: clamp(20px, 8cqw, 30px);
+}
+
+ </style>
+</head>
+<body>
+ <main>
+ <article id="info">
+ <p>This is a collection of text effects made with Anime.js v4 and the new text splitter utility function.</p>
+ <p>Hover the cards to trigger the animations.</p>
+ <p>Learn more at <a href="https://animejs.com/documentation">animejs.com</a>.</p>
+ </article>
+ <article id="wavy-text-effect">
+ <h2>Waaaaavvvvy</h2>
+ </article>
+ <article id="slide-up">
+ <h2>Raining letters</h2>
+ </article>
+ <article id="light-words">
+ <h2>Subtle text highlight</h2>
+ </article>
+ <article id="words-3d-jp">
+ <h2>3Dで単語を回転させる</h2>
+ </article>
+ <article id="words-slide-x">
+ <h2>Horizontal shift split</h2>
+ </article>
+ <article id="lines-mask">
+ <p>This is an example of lines masking that works by only splitting words. This allows animating per line even when the text contains multiple levels of nested elements, like <a href="https://animejs.com/">links with multiple words and nested <strong>strong & <em>em tags</em></strong></a>.</p>
+ </article>
+ <article>
+ <h2>Effect 5</h2>
+ </article>
+ <article>
+ <h2>Effect 6</h2>
+ </article>
+ <article>
+ <h2>Effect 7</h2>
+ </article>
+ <article>
+ <h2>Effect 8</h2>
+ </article>
+ <article>
+ <h2>Effect 9</h2>
+ </article>
+ </main>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
diff --git a/examples/text/hover-effects/index.js b/examples/text/hover-effects/index.js
new file mode 100644
index 00000000..313d42d6
--- /dev/null
+++ b/examples/text/hover-effects/index.js
@@ -0,0 +1,220 @@
+import {
+ animate,
+ createScope,
+ createSpring,
+ createDraggable,
+ createTimeline,
+ stagger,
+ text,
+ utils,
+} from '../../../lib/anime.esm.js';
+
+// Wait until the fonts are all loaded
+document.fonts.ready.then(() => {
+
+ createScope({
+ root: '#wavy-text-effect',
+ defaults: { ease: 'inOut(3)', duration: 350 },
+ }).add(({ root }) => {
+
+ const params = {
+ split: text.split('h2', { chars: true }),
+ strength: 0,
+ };
+
+ const waveAnim = createTimeline().add(params.split.chars, {
+ y: [`-50%`, `50%`],
+ duration: 500,
+ loop: true,
+ alternate: true,
+ ease: 'inOut(2)',
+ autoplay: false,
+ modifier: v => v * params.strength,
+ }, stagger(50)).seek(1000);
+
+ root.addEventListener('pointerenter', () => animate(params, {
+ strength: 1,
+ onBegin: () => waveAnim.play(),
+ }));
+
+ root.addEventListener('pointerleave', () => animate(params, {
+ strength: 0,
+ onComplete: () => waveAnim.pause(),
+ }));
+
+ });
+
+ createScope({
+ root: '#slide-up',
+ }).add((self) => {
+
+ const { root, methods } = self;
+
+ text.split('h2', {
+ chars: {
+ class: 'char',
+ clone: 'top',
+ wrap: 'clip',
+ },
+ });
+
+ const ease = createSpring({ stiffness: 90, damping: 12 });
+
+ self.add('onEnter', e => {
+ createTimeline().add('.char > span', {
+ y: '100%',
+ composition: 'blend',
+ ease,
+ }, stagger(10, { use: 'data-char', from: 'random' }));
+ });
+
+ self.add('onLeave', e => {
+ createTimeline().add('.char > span', {
+ y: '0%',
+ composition: 'blend',
+ ease,
+ }, stagger(10, { use: 'data-char', from: 'random' }));
+ });
+
+ root.addEventListener('pointerenter', /** @type {EventListener} */(methods.onEnter));
+ root.addEventListener('pointerleave', /** @type {EventListener} */(methods.onLeave));
+
+ });
+
+ createScope({
+ root: '#light-words',
+ defaults: { ease: 'out(3)', duration: 350, composition: 'blend' },
+ }).add((self) => {
+
+ const { root, methods } = self;
+
+ const { chars } = text.split('h2', { chars: true });
+
+ utils.set(chars, { opacity: .25 });
+
+ self.add('onEnter', e => {
+ createTimeline().add(chars, { opacity: 1 }, stagger(5));
+ });
+
+ self.add('onLeave', e => {
+ createTimeline().add(chars, { opacity: .25 }, stagger(5));
+ });
+
+ root.addEventListener('pointerenter', /** @type {EventListener} */(methods.onEnter));
+ root.addEventListener('pointerleave', /** @type {EventListener} */(methods.onLeave));
+
+ });
+
+ createScope({
+ root: '#words-3d-jp',
+ defaults: {
+ ease: 'outQuad',
+ duration: 500,
+ }
+ }).add((self) => {
+
+ const { root, methods } = self;
+
+ text.split('h2', {
+ words: `<span class="word-3d" style="position: relative; transform-style: preserve-3d; transform-origin: 50% 0%">
+ <span style="transform-origin: 50% 0%; transform: rotateX(0deg)">{value}</span>
+ <span style="position: absolute; top: 100%; left: 0; transform-origin: 50% 0%; transform: rotateX(90deg)">{value}</span>
+ </span>`,
+ lines: false,
+ chars: false,
+ })
+
+ const wordStagger = stagger(100, { use: 'data-word', start: 0 });
+
+ const rotateAnim = createTimeline({
+ autoplay: false,
+ defaults: { ease: 'inOutQuad', duration: 400, }
+ })
+ .add('.word-3d', { rotateX: -90 }, wordStagger)
+ .add('.word-3d > span:first-child', { opacity: [1, .25] }, wordStagger)
+ .add('.word-3d > span:last-child', { opacity: [.25, 1] }, wordStagger)
+
+ self.add('onEnter', e => {
+ animate(rotateAnim, { progress: 1 });
+ });
+
+ self.add('onLeave', e => {
+ animate(rotateAnim, { progress: 0 });
+ });
+
+ root.addEventListener('pointerenter', /** @type {EventListener} */(methods.onEnter));
+ root.addEventListener('pointerleave', /** @type {EventListener} */(methods.onLeave));
+
+ });
+
+ createScope({
+ root: '#words-slide-x',
+ defaults: {
+ ease: 'outQuad',
+ duration: 500,
+ }
+ }).add((self) => {
+
+ const { root, methods } = self;
+
+ text.split('h2', {
+ chars: {
+ class: 'char',
+ clone: 'left',
+ wrap: 'clip',
+ },
+ });
+
+ const rotateAnim = createTimeline({
+ autoplay: false,
+ defaults: { ease: 'inOutQuad', duration: 400, }
+ })
+ .add('.char > span', { x: '100%' }, stagger(5, { use: 'data-char' }))
+
+ self.add('onEnter', e => {
+ animate(rotateAnim, { progress: 1 });
+ });
+
+ self.add('onLeave', e => {
+ animate(rotateAnim, { progress: 0 });
+ });
+
+ root.addEventListener('pointerenter', /** @type {EventListener} */(methods.onEnter));
+ root.addEventListener('pointerleave', /** @type {EventListener} */(methods.onLeave));
+
+ });
+
+ createScope({
+ root: '#lines-mask',
+ defaults: {
+ duration: 300,
+ composition: 'blend',
+ }
+ }).add((self) => {
+
+ const { root, methods } = self;
+
+ text.split('p', {
+ lines: {
+ class: 'line',
+ clone: 'top',
+ wrap: 'clip',
+ },
+ });
+
+ utils.set('.line > span:first-child', { color: '#A0A0A0' });
+
+ self.add('onEnter', e => {
+ animate('.line > span', { y: '100%', delay: stagger(50) })
+ });
+
+ self.add('onLeave', e => {
+ animate('.line > span', { y: 0, delay: stagger(50) })
+ });
+
+ root.addEventListener('pointerenter', /** @type {EventListener} */(methods.onEnter));
+ root.addEventListener('pointerleave', /** @type {EventListener} */(methods.onLeave));
+
+ });
+
+});
diff --git a/examples/text/split-effects/index.html b/examples/text/split-effects/index.html
new file mode 100644
index 00000000..c4226d44
--- /dev/null
+++ b/examples/text/split-effects/index.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Text / Split effects / 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">
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:[email protected]&display=swap" rel="stylesheet">
+ <style>
+ body {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ gap: 2rem;
+ width: 100%;
+ min-height: 100dvh;
+ padding: 2rem;
+ font-family: "Noto Sans JP", sans-serif;
+ font-kerning: none;
+ font-variant-ligatures: none;
+ text-rendering: optimizeSpeed;
+ }
+
+ .controls {
+ display: flex;
+ gap: .5rem;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .button {
+ padding: .125rem .5rem;
+ border: none;
+ border-radius: .125rem;
+ }
+
+ main {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ gap: 2rem;
+ width: calc(100% - 12rem);
+ max-width: 820px;
+ }
+
+ main p {
+ width: 100%;
+ text-align: center;
+ will-change: transform;
+ }
+
+ main p span {
+ will-change: color, transform;
+ }
+
+ </style>
+</head>
+<body class="is-debug">
+ <main>
+ <p>
+ Wave propagation and fluid dynamics encompass several interconnected physical phenomena that govern how water moves through oceanic systems, demonstrating the fundamental principles of energy transfer and momentum conservation. Wave "continuation" describes how energy persists through water long after the initial disturbance has passed, with individual water particles following elliptical orbital paths that decrease in amplitude with depth, creating the illusion of forward motion while actually moving in circular patterns. "Differential flow" occurs because various layers of water move at different velocities—surface currents respond to wind stress differently than deeper thermohaline circulation, and coastal waters behave distinctly from open ocean systems. A related phenomenon is "hydrodynamic lag," where water masses respond gradually to driving forces, whether from atmospheric pressure, gravitational pull, or temperature gradients. This lag affects everything from floating objects like debris and marine organisms to distinct water bodies themselves, such as upwelling zones and convergence areas. In oceanic circulation, deep water acts as the primary driver, with surface waves, spray, and foam representing secondary responses to local conditions. Water masses with different densities, such as warm surface layers and cold deep currents, or areas with varying salinity, exhibit more independent behavior than uniform water columns. Extreme manifestations of these forces create phenomena like rogue waves and storm surges, while calmer conditions require precise balance between competing forces to maintain stable patterns. Even apparently static water bodies demonstrate constant motion through molecular vibration, thermal convection, and microscopic currents that prevent true stagnation and maintain the ocean's dynamic equilibrium.
+ </p>
+ </main>
+ <div class="controls">
+ <button class="button" id="revert">REVERT</button>
+ <button class="button" id="split">SPLIT & ANIMATE</button>
+ <button class="button" id="reorder">TIDY UP</button>
+ <button class="button" id="debug">SHOW DEBUG</button>
+ </div>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/examples/text/split-effects/index.js b/examples/text/split-effects/index.js
new file mode 100644
index 00000000..4277aaf2
--- /dev/null
+++ b/examples/text/split-effects/index.js
@@ -0,0 +1,92 @@
+import {
+ animate,
+ createTimeline,
+ stagger,
+ text,
+ utils,
+} from '../../../lib/anime.esm.js';
+
+const coords = [];
+const [ $revert ] = utils.$('#revert');
+const [ $split ] = utils.$('#split');
+const [ $reorder ] = utils.$('#reorder');
+const [ $debug ] = utils.$('#debug');
+
+$revert.disabled = true;
+$split.disabled = false;
+$reorder.disabled = true;
+
+let split;
+
+const splitAndAnimate = () => {
+ $revert.disabled = false;
+ $split.disabled = true;
+
+ split = text.split('p', {
+ lines: true,
+ });
+
+ split.addEffect(split => {
+ // Returning the timeline syncs it with the splitter between lines split
+ return createTimeline({
+ defaults: {
+ alternate: true,
+ loop: true,
+ loopDelay: 75,
+ duration: 1500,
+ ease: 'inOutQuad',
+ },
+ })
+ .add(split.lines, {
+ color: { from: '#61C3FF' },
+ y: -10,
+ scale: 1.1,
+ }, stagger(100, { start: 0 }))
+ .add(split.words, {
+ scale: [.98, 1.04],
+ }, stagger(100, { use: 'data-line', start: 0 }))
+ .init()
+ });
+
+ split.addEffect(split => {
+ split.words.forEach(($el, i) => {
+ const c = coords[i];
+ if (c) utils.set($el, { x: c.x, y: c.y });
+ $el.addEventListener('pointerenter', () => {
+ $reorder.disabled = false;
+ animate($el, {
+ x: utils.random(-50, 50),
+ y: utils.random(-50, 50),
+ })
+ });
+ });
+ return () => {
+ // Store the words coordinates before the new split
+ split.words.forEach((w, i) => coords[i] = { x: utils.get(w, 'x'), y: utils.get(w, 'y') });
+ }
+ });
+}
+
+splitAndAnimate();
+
+$revert.addEventListener('click', () => {
+ split.revert();
+ coords.length = 0;
+ $revert.disabled = true;
+ $split.disabled = false;
+});
+
+$split.addEventListener('click', splitAndAnimate);
+
+$reorder.addEventListener('click', () => {
+ animate(split.words, {
+ x: 0, y: 0, ease: 'inOutExpo'
+ });
+ $reorder.disabled = true;
+});
+
+$debug.addEventListener('click', () => {
+ split.debug = !split.debug;
+ split.refresh();
+ $debug.innerText = split.debug ? 'HIDE DEBUG' : 'SHOW DEBUG';
+});
diff --git a/examples/text/split-playground/index.html b/examples/text/split-playground/index.html
new file mode 100644
index 00000000..e093e27e
--- /dev/null
+++ b/examples/text/split-playground/index.html
@@ -0,0 +1,319 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Text / Split playground / 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">
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:[email protected]&display=swap" rel="stylesheet">
+ <style>
+ body {
+ opacity: 0;
+ display: flex;
+ flex-direction: row;
+ gap: 2rem;
+ width: 100%;
+ min-height: 100dvh;
+ padding: 2rem;
+ font-family: "Noto Sans JP", sans-serif;
+ font-kerning: none;
+ font-variant-ligatures: none;
+ text-rendering: optimizeSpeed;
+ }
+
+ body.is-ready {
+ opacity: 1;
+ }
+
+ aside {
+ justify-self: flex-end;
+ width: 12rem;
+ padding: .75rem 1rem;
+ border-radius: .5rem;
+ background-color: #404040;
+ }
+
+ aside li {
+ list-style: none;
+ margin-bottom: .5rem;
+ }
+
+ fieldset {
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ }
+
+ legend {
+ padding-bottom: .25rem;
+ }
+
+ fieldset:disabled {
+ opacity: .5;
+ }
+
+ fieldset input,
+ fieldset select {
+ width: 50%;
+ margin: 0px;
+ border-radius: .25rem;
+ }
+
+ fieldset input {
+ padding-left: .25rem;
+ padding-right: .25rem;
+ }
+
+ .field {
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+ padding-bottom: .25rem;
+ }
+
+ main {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ gap: 2rem;
+ width: calc(100% - 12rem);
+ }
+
+ article {
+ width: 100%;
+ max-width: 800px;
+ justify-self: center;
+ font-weight: 400;
+ }
+
+ article h1 {
+ font-size: 3em;
+ font-weight: 600;
+ margin-bottom: .5em;
+ line-height: 1.4;
+ }
+
+ article span:has(~ span h1) h1 {
+ margin-bottom: 0;
+ }
+
+ article p {
+ font-size: 1.25rem;
+ line-height: 1.5;
+ margin-bottom: 1rem;
+ }
+
+ article span:has(~ span p) p {
+ margin-bottom: 0;
+ }
+
+ article ul {
+ padding-left: 1rem;
+ margin-bottom: 1rem;
+ }
+
+ article span:has(~ span ul) ul {
+ margin-bottom: 0;
+ }
+
+ article a {
+ color: var(--red);
+ text-decoration: underline;
+ }
+
+ article a span {
+ text-decoration: underline;
+ }
+
+ .nested { color: rgba(200, 100, 200, 1) }
+ .nested .nested { color: rgba(200, 100, 200, .8) }
+ .nested .nested .nested { color: rgba(200, 100, 200, .6) }
+ .nested .nested .nested .nested { color: rgba(200, 100, 200, .4) }
+ .nested .nested .nested .nested .nested { color: rgba(200, 100, 200, .2) }
+
+ code {
+ color: rgba(200, 200, 200, 1);
+ font-family: monospace;
+ }
+
+ </style>
+</head>
+<body class="is-debug">
+ <main>
+ <article>
+ <h1>An all-in-one text splitter function to easily split, wrap, and clone text<br></h1>
+ <p>
+ Anime.js <code>text.split()</code> utility function is an easy to use, fully-featured, lightweight and performant modern text splitter for JavaScript.<br>
+ It does all the following in only <strong>7KB</strong>:
+ </p>
+ <ul>
+ <li>Can split text by characters, words, and lines.</li>
+ <li>Support splitting through elements like <a href="#">links with <strong>nested elements like</strong></a> <code>&lt;strong&gt;</code> tags and <span class="nested">any <span class="nested">level <span class="nested">of <span class="nested">nested <span class="nested">tags</span></span></span></span></span> automatically.</li>
+ <li>Element cloning with configurable position.</li>
+ <li>Use your own custom wrapper with a powerful templating system.</li>
+ <li>Split words in languages that don't use spaces like Chinese and Japanese この日本語の文のように.</li>
+ <li>Handles splitting ѕρє¢ιαℓ ¢нαяα¢тєяѕ and 🇪Ⓜ️🅾️🇯ℹ️s.</li>
+ <li>Is accessible for screen readers.</li>
+ <li>And is 100% responsive.</li>
+ </ul>
+ <p>
+ Check out the full documenation and learn more at <a href="https://animejs.com/documentation">animejs.com/documentation</a>.
+ </p>
+ </article>
+ </main>
+ <aside id="parameters">
+ <form id="splitForm">
+ <ul>
+ <li>
+ <legend>
+ <input type="checkbox" id="lines" name="lines">
+ <label for="lines">lines</label>
+ </legend>
+ <fieldset id="lines-options">
+ <div class="field">
+ <label for="lines-wrap">wrap:</label>
+ <select id="lines-wrap" name="lines-wrap">
+ <option value="false">false</option>
+ <option value="clip">clip</option>
+ <option value="visible">visible</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="lines-clone">clone:</label>
+ <select id="lines-clone" name="lines-clone">
+ <option value="false">false</option>
+ <option value="top">top</option>
+ <option value="right">right</option>
+ <option value="bottom">bottom</option>
+ <option value="left">left</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="lines-animate">animate:</label>
+ <select id="lines-animate" name="lines-animate">
+ <option value="false">false</option>
+ <option value="250">200ms</option>
+ <option value="500">500ms</option>
+ <option value="750">750ms</option>
+ <option value="1000">1000ms</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="lines-stagger">stagger:</label>
+ <select id="lines-stagger" name="lines-stagger">
+ <option value="10">10</option>
+ <option value="50">50</option>
+ <option value="200">200</option>
+ <option value="random">random</option>
+ </select>
+ </div>
+ </fieldset>
+ </li>
+ <li>
+ <input type="checkbox" id="words" name="words" checked>
+ <label for="words">words</label>
+ <fieldset id="words-options">
+ <div class="field">
+ <label for="words-wrap">wrap:</label>
+ <select id="words-wrap" name="words-wrap">
+ <option value="false">false</option>
+ <option selected value="clip">clip</option>
+ <option value="visible">visible</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="words-clone">clone:</label>
+ <select id="words-clone" name="words-clone">
+ <option value="false">false</option>
+ <option value="top">top</option>
+ <option value="right">right</option>
+ <option selected value="bottom">bottom</option>
+ <option value="left">left</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="words-animate">animate:</label>
+ <select id="words-animate" name="words-animate">
+ <option value="false">false</option>
+ <option value="250">250ms</option>
+ <option value="500">500ms</option>
+ <option value="750">750ms</option>
+ <option value="1000">1000ms</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="words-stagger">stagger:</label>
+ <select id="words-stagger" name="words-stagger">
+ <option value="10">10</option>
+ <option value="50">50</option>
+ <option value="200">200</option>
+ <option value="random">random</option>
+ </select>
+ </div>
+ </fieldset>
+ </li>
+ <li>
+ <input type="checkbox" id="chars" name="chars">
+ <label for="chars">chars</label>
+ <fieldset id="chars-options">
+ <div class="field">
+ <label for="chars-wrap">wrap:</label>
+ <select id="chars-wrap" name="chars-wrap">
+ <option value="false">false</option>
+ <option value="clip">clip</option>
+ <option value="visible">visible</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="chars-clone">clone:</label>
+ <select id="chars-clone" name="chars-clone">
+ <option value="false">false</option>
+ <option value="top">top</option>
+ <option value="right">right</option>
+ <option value="bottom">bottom</option>
+ <option value="left">left</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="chars-animate">animate:</label>
+ <select id="chars-animate" name="chars-animate">
+ <option value="false">false</option>
+ <option value="250">250ms</option>
+ <option value="500">500ms</option>
+ <option value="750">750ms</option>
+ <option value="1000">1000ms</option>
+ </select>
+ </div>
+ <div class="field">
+ <label for="chars-stagger">stagger:</label>
+ <select id="chars-stagger" name="chars-stagger">
+ <option value="10">10</option>
+ <option value="50">50</option>
+ <option value="200">200</option>
+ <option value="random">random</option>
+ </select>
+ </div>
+ </fieldset>
+ </li>
+ <li>
+ <input type="checkbox" id="includeSpaces" name="includeSpaces">
+ <label for="includeSpaces">includeSpaces</label>
+ </li>
+ <li>
+ <input type="checkbox" id="accessible" name="accessible" checked>
+ <label for="accessible">accessible</label>
+ </li>
+ <li>
+ <input type="checkbox" id="debug" name="debug" checked>
+ <label for="debug">debug</label>
+ </li>
+ </ul>
+ </form>
+ <button id="revert" name="revert">Revert</button>
+ <button id="split" name="revert">Split</button>
+ </aside>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/examples/text/split-playground/index.js b/examples/text/split-playground/index.js
new file mode 100644
index 00000000..d86ad744
--- /dev/null
+++ b/examples/text/split-playground/index.js
@@ -0,0 +1,93 @@
+import {
+ animate,
+ createTimeline,
+ createScope,
+ stagger,
+ text,
+ utils,
+ Scope,
+} from '../../../lib/anime.esm.js';
+
+let split;
+
+const form = document.getElementById('splitForm');
+const $revert = document.getElementById('revert');
+const $split = document.getElementById('split');
+
+const config = {
+ split: {
+ lines: false,
+ words: false,
+ chars: false,
+ includeSpaces: false,
+ accessible: false,
+ debug: false
+ },
+ animation: {
+ lines: false,
+ words: false,
+ chars: false,
+ }
+};
+
+const animateSplit = (targets, type) => {
+ const param = config.split[type];
+ const anim = config.animation[type];
+ const dir = param.clone;
+ const randomStagger = anim.stagger === 'random';
+ return animate(targets, {
+ x: dir === 'left' ? '100%' : dir === 'right' ? '-100%' : 0,
+ y: dir === 'top' ? '100%' : dir === 'bottom' ? '-100%' : !dir ? '-100%' : 0,
+ loop: true,
+ alternate: true,
+ duration: anim.duration,
+ delay: stagger(randomStagger ? 10 : anim.stagger, { from: randomStagger ? 'random' : 0 }),
+ });
+}
+
+function updateSplitConfig() {
+ const data = new FormData(/** @type {HTMLFormElement} */(document.getElementById('splitForm')));
+
+ ['lines', 'words', 'chars'].forEach(type => {
+ config.split[type] = false;
+ if (data.has(type)) {
+ const wrap = data.get(`${type}-wrap`);
+ const clone = data.get(`${type}-clone`);
+ const animate = data.get(`${type}-animate`);
+ config.split[type] = {
+ wrap: wrap === 'false' ? false : wrap,
+ clone: clone === 'false' ? false : clone
+ };
+ config.animation[type] = !+animate ? false : {
+ duration: +animate,
+ stagger: data.get(`${type}-stagger`)
+ };
+ }
+ });
+
+ config.split.includeSpaces = data.has('includeSpaces');
+ config.split.accessible = data.has('accessible');
+ config.split.debug = data.has('debug');
+
+ if (split) split.revert();
+
+ split = text.split('article', { ...config.split })
+ .addEffect(self => config.animation.lines && self.lines.length && animateSplit(self.lines, 'lines'))
+ .addEffect(self => config.animation.words && self.words.length && animateSplit(self.words, 'words'))
+ .addEffect(self => config.animation.chars && self.chars.length && animateSplit(self.chars, 'chars'))
+ $revert.removeAttribute('disabled');
+}
+
+document.fonts.ready.then(() => {
+ document.body.classList.add('is-ready');
+ ['lines', 'words', 'chars'].forEach(type => {
+ const checkbox = /** @type {HTMLInputElement} */(document.getElementById(type));
+ const fieldset = /** @type {HTMLInputElement} */(document.getElementById(`${type}-options`));
+ checkbox.addEventListener('change', () => fieldset.disabled = !checkbox.checked);
+ fieldset.disabled = !checkbox.checked;
+ });
+ form.addEventListener('change', updateSplitConfig);
+ $revert.addEventListener('click', () => {split && split.revert(); $revert.setAttribute('disabled', 'false'); });
+ $split.addEventListener('click', updateSplitConfig);
+ updateSplitConfig();
+});
diff --git a/lib/anime.cjs b/lib/anime.cjs
index 840de0cc..1a0aecbe 100644
--- a/lib/anime.cjs
+++ b/lib/anime.cjs
@@ -1,9 +1,9 @@
/**
* anime.js - CJS
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
-"use strict";const isBrowser=typeof window!=="undefined";const win=isBrowser?window:null;const doc=isBrowser?document:null;const tweenTypes={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4};const valueTypes={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3};const tickModes={NONE:0,AUTO:1,FORCE:2};const compositionTypes={replace:0,none:1,blend:2};const isRegisteredTargetSymbol=Symbol();const isDomSymbol=Symbol();const isSvgSymbol=Symbol();const transformsSymbol=Symbol();const morphPointsSymbol=Symbol();const proxyTargetSymbol=Symbol();const minValue=1e-11;const maxValue=1e12;const K=1e3;const maxFps=120;const emptyString="";const shortTransforms=new Map;shortTransforms.set("x","translateX");shortTransforms.set("y","translateY");shortTransforms.set("z","translateZ");const validTransforms=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"];const transformsFragmentStrings=validTransforms.reduce(((a,v)=>({...a,[v]:v+"("})),{});const noop=()=>{};const hexTestRgx=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;const rgbExecRgx=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;const rgbaExecRgx=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const hslExecRgx=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;const hslaExecRgx=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const digitWithExponentRgx=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;const unitsExecRgx=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx=/([a-z])([A-Z])/g;const transformsExecRgx=/(\w+)(\([^)]+\)+)/g;const relativeValuesExecRgx=/(\*=|\+=|-=)/;const defaults={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:maxFps,loop:0,reversed:false,alternate:false,autoplay:true,duration:K,delay:0,loopDelay:0,ease:"out(2)",composition:compositionTypes.replace,modifier:v=>v,onBegin:noop,onBeforeUpdate:noop,onUpdate:noop,onLoop:noop,onPause:noop,onComplete:noop,onRender:noop};const globals={defaults:defaults,root:doc,scope:null,precision:4,timeScale:1,tickThreshold:200};const globalVersions={version:"4.0.2",engine:null};if(isBrowser){if(!win.AnimeJS)win.AnimeJS=[];win.AnimeJS.push(globalVersions)}const toLowerCase=str=>str.replace(lowerCaseRgx,"$1-$2").toLowerCase();const stringStartsWith=(str,sub)=>str.indexOf(sub)===0;const now=Date.now;const isArr=Array.isArray;const isObj=a=>a&&a.constructor===Object;const isNum=a=>typeof a==="number"&&!isNaN(a);const isStr=a=>typeof a==="string";const isFnc=a=>typeof a==="function";const isUnd=a=>typeof a==="undefined";const isNil=a=>isUnd(a)||a===null;const isSvg=a=>isBrowser&&a instanceof SVGElement;const isHex=a=>hexTestRgx.test(a);const isRgb=a=>stringStartsWith(a,"rgb");const isHsl=a=>stringStartsWith(a,"hsl");const isCol=a=>isHex(a)||isRgb(a)||isHsl(a);const isKey=a=>!globals.defaults.hasOwnProperty(a);const parseNumber=str=>isStr(str)?parseFloat(str):str;const pow=Math.pow;const sqrt=Math.sqrt;const sin=Math.sin;const cos=Math.cos;const abs=Math.abs;const exp=Math.exp;const ceil=Math.ceil;const floor=Math.floor;const asin=Math.asin;const max=Math.max;const atan2=Math.atan2;const PI=Math.PI;const _round=Math.round;const clamp=(v,min,max)=>v<min?min:v>max?max:v;const powCache={};const round=(v,decimalLength)=>{if(decimalLength<0)return v;if(!decimalLength)return _round(v);let p=powCache[decimalLength];if(!p)p=powCache[decimalLength]=10**decimalLength;return _round(v*p)/p};const snap=(v,increment)=>isArr(increment)?increment.reduce(((closest,cv)=>abs(cv-v)<abs(closest-v)?cv:closest)):increment?_round(v/increment)*increment:v;const interpolate=(start,end,progress)=>start+(end-start)*progress;const clampInfinity=v=>v===Infinity?maxValue:v===-Infinity?-1e12:v;const normalizeTime=v=>v<=minValue?minValue:clampInfinity(round(v,11));const cloneArray=a=>isArr(a)?[...a]:a;const mergeObjects=(o1,o2)=>{const merged={...o1};for(let p in o2){const o1p=o1[p];merged[p]=isUnd(o1p)?o2[p]:o1p}return merged};const forEachChildren=(parent,callback,reverse,prevProp="_prev",nextProp="_next")=>{let next=parent._head;let adjustedNextProp=nextProp;if(reverse){next=parent._tail;adjustedNextProp=prevProp}while(next){const currentNext=next[adjustedNextProp];callback(next);next=currentNext}};const removeChild=(parent,child,prevProp="_prev",nextProp="_next")=>{const prev=child[prevProp];const next=child[nextProp];prev?prev[nextProp]=next:parent._head=next;next?next[prevProp]=prev:parent._tail=prev;child[prevProp]=null;child[nextProp]=null};const addChild=(parent,child,sortMethod,prevProp="_prev",nextProp="_next")=>{let prev=parent._tail;while(prev&&sortMethod&&sortMethod(prev,child))prev=prev[prevProp];const next=prev?prev[nextProp]:parent._head;prev?prev[nextProp]=child:parent._head=child;next?next[prevProp]=child:parent._tail=child;child[prevProp]=prev;child[nextProp]=next};class Clock{constructor(initTime=0){this.deltaTime=0;this._currentTime=initTime;this._elapsedTime=initTime;this._startTime=initTime;this._lastTime=initTime;this._scheduledTime=0;this._frameDuration=round(K/maxFps,0);this._fps=maxFps;this._speed=1;this._hasChildren=false;this._head=null;this._tail=null}get fps(){return this._fps}set fps(frameRate){const previousFrameDuration=this._frameDuration;const fr=+frameRate;const fps=fr<minValue?minValue:fr;const frameDuration=round(K/fps,0);this._fps=fps;this._frameDuration=frameDuration;this._scheduledTime+=frameDuration-previousFrameDuration}get speed(){return this._speed}set speed(playbackRate){const pbr=+playbackRate;this._speed=pbr<minValue?minValue:pbr}requestTick(time){const scheduledTime=this._scheduledTime;const elapsedTime=this._elapsedTime;this._elapsedTime+=time-elapsedTime;if(elapsedTime<scheduledTime)return tickModes.NONE;const frameDuration=this._frameDuration;const frameDelta=elapsedTime-scheduledTime;this._scheduledTime+=frameDelta<frameDuration?frameDuration:frameDelta;return tickModes.AUTO}computeDeltaTime(time){const delta=time-this._lastTime;this.deltaTime=delta;this._lastTime=time;return delta}}const render=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const parent=tickable.parent;const duration=tickable.duration;const completed=tickable.completed;const iterationDuration=tickable.iterationDuration;const iterationCount=tickable.iterationCount;const _currentIteration=tickable._currentIteration;const _loopDelay=tickable._loopDelay;const _reversed=tickable._reversed;const _alternate=tickable._alternate;const _hasChildren=tickable._hasChildren;const tickableDelay=tickable._delay;const tickablePrevAbsoluteTime=tickable._currentTime;const tickableEndTime=tickableDelay+iterationDuration;const tickableAbsoluteTime=time-tickableDelay;const tickablePrevTime=clamp(tickablePrevAbsoluteTime,-tickableDelay,duration);const tickableCurrentTime=clamp(tickableAbsoluteTime,-tickableDelay,duration);const deltaTime=tickableAbsoluteTime-tickablePrevAbsoluteTime;const isCurrentTimeAboveZero=tickableCurrentTime>0;const isCurrentTimeEqualOrAboveDuration=tickableCurrentTime>=duration;const isSetter=duration<=minValue;const forcedTick=tickMode===tickModes.FORCE;let isOdd=0;let iterationElapsedTime=tickableAbsoluteTime;let hasRendered=0;if(iterationCount>1){const currentIteration=~~(tickableCurrentTime/(iterationDuration+(isCurrentTimeEqualOrAboveDuration?0:_loopDelay)));tickable._currentIteration=clamp(currentIteration,0,iterationCount);if(isCurrentTimeEqualOrAboveDuration)tickable._currentIteration--;isOdd=tickable._currentIteration%2;iterationElapsedTime=tickableCurrentTime%(iterationDuration+_loopDelay)||0}const isReversed=_reversed^(_alternate&&isOdd);const _ease=tickable._ease;let iterationTime=isCurrentTimeEqualOrAboveDuration?isReversed?0:duration:isReversed?iterationDuration-iterationElapsedTime:iterationElapsedTime;if(_ease)iterationTime=iterationDuration*_ease(iterationTime/iterationDuration)||0;const isRunningBackwards=(parent?parent.backwards:tickableAbsoluteTime<tickablePrevAbsoluteTime)?!isReversed:!!isReversed;tickable._currentTime=tickableAbsoluteTime;tickable._iterationTime=iterationTime;tickable.backwards=isRunningBackwards;if(isCurrentTimeAboveZero&&!tickable.began){tickable.began=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onBegin(tickable)}}else if(tickableAbsoluteTime<=0){tickable.began=false}if(!muteCallbacks&&!_hasChildren&&isCurrentTimeAboveZero&&tickable._currentIteration!==_currentIteration){tickable.onLoop(tickable)}if(forcedTick||tickMode===tickModes.AUTO&&(time>=tickableDelay&&time<=tickableEndTime||time<=tickableDelay&&tickablePrevTime>tickableDelay||time>=tickableEndTime&&tickablePrevTime!==duration)||iterationTime>=tickableEndTime&&tickablePrevTime!==duration||iterationTime<=tickableDelay&&tickablePrevTime>0||time<=tickablePrevTime&&tickablePrevTime===duration&&completed||isCurrentTimeEqualOrAboveDuration&&!completed&&isSetter){if(isCurrentTimeAboveZero){tickable.computeDeltaTime(tickablePrevTime);if(!muteCallbacks)tickable.onBeforeUpdate(tickable)}if(!_hasChildren){const forcedRender=forcedTick||(isRunningBackwards?deltaTime*-1:deltaTime)>=globals.tickThreshold;const absoluteTime=tickable._offset+(parent?parent._offset:0)+tickableDelay+iterationTime;let tween=tickable._head;let tweenTarget;let tweenStyle;let tweenTargetTransforms;let tweenTargetTransformsProperties;let tweenTransformsNeedUpdate=0;while(tween){const tweenComposition=tween._composition;const tweenCurrentTime=tween._currentTime;const tweenChangeDuration=tween._changeDuration;const tweenAbsEndTime=tween._absoluteStartTime+tween._changeDuration;const tweenNextRep=tween._nextRep;const tweenPrevRep=tween._prevRep;const tweenHasComposition=tweenComposition!==compositionTypes.none;if((forcedRender||(tweenCurrentTime!==tweenChangeDuration||absoluteTime<=tweenAbsEndTime+(tweenNextRep?tweenNextRep._delay:0))&&(tweenCurrentTime!==0||absoluteTime>=tween._absoluteStartTime))&&(!tweenHasComposition||!tween._isOverridden&&(!tween._isOverlapped||absoluteTime<=tweenAbsEndTime)&&(!tweenNextRep||(tweenNextRep._isOverridden||absoluteTime<=tweenNextRep._absoluteStartTime))&&(!tweenPrevRep||(tweenPrevRep._isOverridden||absoluteTime>=tweenPrevRep._absoluteStartTime+tweenPrevRep._changeDuration+tween._delay)))){const tweenNewTime=tween._currentTime=clamp(iterationTime-tween._startTime,0,tweenChangeDuration);const tweenProgress=tween._ease(tweenNewTime/tween._updateDuration);const tweenModifier=tween._modifier;const tweenValueType=tween._valueType;const tweenType=tween._tweenType;const tweenIsObject=tweenType===tweenTypes.OBJECT;const tweenIsNumber=tweenValueType===valueTypes.NUMBER;const tweenPrecision=tweenIsNumber&&tweenIsObject||tweenProgress===0||tweenProgress===1?-1:globals.precision;let value;let number;if(tweenIsNumber){value=number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision))}else if(tweenValueType===valueTypes.UNIT){number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision));value=`${number}${tween._unit}`}else if(tweenValueType===valueTypes.COLOR){const fn=tween._fromNumbers;const tn=tween._toNumbers;const r=round(clamp(tweenModifier(interpolate(fn[0],tn[0],tweenProgress)),0,255),0);const g=round(clamp(tweenModifier(interpolate(fn[1],tn[1],tweenProgress)),0,255),0);const b=round(clamp(tweenModifier(interpolate(fn[2],tn[2],tweenProgress)),0,255),0);const a=clamp(tweenModifier(round(interpolate(fn[3],tn[3],tweenProgress),tweenPrecision)),0,1);value=`rgba(${r},${g},${b},${a})`;if(tweenHasComposition){const ns=tween._numbers;ns[0]=r;ns[1]=g;ns[2]=b;ns[3]=a}}else if(tweenValueType===valueTypes.COMPLEX){value=tween._strings[0];for(let j=0,l=tween._toNumbers.length;j<l;j++){const n=tweenModifier(round(interpolate(tween._fromNumbers[j],tween._toNumbers[j],tweenProgress),tweenPrecision));const s=tween._strings[j+1];value+=`${s?n+s:n}`;if(tweenHasComposition){tween._numbers[j]=n}}}if(tweenHasComposition){tween._number=number}if(!internalRender&&tweenComposition!==compositionTypes.blend){const tweenProperty=tween.property;tweenTarget=tween.target;if(tweenIsObject){tweenTarget[tweenProperty]=value}else if(tweenType===tweenTypes.ATTRIBUTE){tweenTarget.setAttribute(tweenProperty,value)}else{tweenStyle=tweenTarget.style;if(tweenType===tweenTypes.TRANSFORM){if(tweenTarget!==tweenTargetTransforms){tweenTargetTransforms=tweenTarget;tweenTargetTransformsProperties=tweenTarget[transformsSymbol]}tweenTargetTransformsProperties[tweenProperty]=value;tweenTransformsNeedUpdate=1}else if(tweenType===tweenTypes.CSS){tweenStyle[tweenProperty]=value}else if(tweenType===tweenTypes.CSS_VAR){tweenStyle.setProperty(tweenProperty,value)}}if(isCurrentTimeAboveZero)hasRendered=1}else{tween._value=value}}if(tweenTransformsNeedUpdate&&tween._renderTransforms){let str=emptyString;for(let key in tweenTargetTransformsProperties){str+=`${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `}tweenStyle.transform=str;tweenTransformsNeedUpdate=0}tween=tween._next}if(!muteCallbacks&&hasRendered){tickable.onRender(tickable)}}if(!muteCallbacks&&isCurrentTimeAboveZero){tickable.onUpdate(tickable)}}if(parent&&isSetter){if(!muteCallbacks&&(parent.began&&!isRunningBackwards&&tickableAbsoluteTime>=duration&&!completed||isRunningBackwards&&tickableAbsoluteTime<=minValue&&completed)){tickable.onComplete(tickable);tickable.completed=!isRunningBackwards}}else if(isCurrentTimeAboveZero&&isCurrentTimeEqualOrAboveDuration){if(iterationCount===Infinity){tickable._startTime+=tickable.duration}else if(tickable._currentIteration>=iterationCount-1){tickable.paused=true;if(!completed&&!_hasChildren){tickable.completed=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onComplete(tickable);tickable._resolve(tickable)}}}}else{tickable.completed=false}return hasRendered};const tick=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const _currentIteration=tickable._currentIteration;render(tickable,time,muteCallbacks,internalRender,tickMode);if(tickable._hasChildren){const tl=tickable;const tlIsRunningBackwards=tl.backwards;const tlChildrenTime=internalRender?time:tl._iterationTime;const tlCildrenTickTime=now();let tlChildrenHasRendered=0;let tlChildrenHaveCompleted=true;if(!internalRender&&tl._currentIteration!==_currentIteration){const tlIterationDuration=tl.iterationDuration;forEachChildren(tl,(child=>{if(!tlIsRunningBackwards){if(!child.completed&&!child.backwards&&child._currentTime<child.iterationDuration){render(child,tlIterationDuration,muteCallbacks,1,tickModes.FORCE)}child.began=false;child.completed=false}else{const childDuration=child.duration;const childStartTime=child._offset+child._delay;const childEndTime=childStartTime+childDuration;if(!muteCallbacks&&childDuration<=minValue&&(!childStartTime||childEndTime===tlIterationDuration)){child.onComplete(child)}}}));if(!muteCallbacks)tl.onLoop(tl)}forEachChildren(tl,(child=>{const childTime=round((tlChildrenTime-child._offset)*child._speed,12);const childTickMode=child._fps<tl._fps?child.requestTick(tlCildrenTickTime):tickMode;tlChildrenHasRendered+=render(child,childTime,muteCallbacks,internalRender,childTickMode);if(!child.completed&&tlChildrenHaveCompleted)tlChildrenHaveCompleted=false}),tlIsRunningBackwards);if(!muteCallbacks&&tlChildrenHasRendered)tl.onRender(tl);if(tlChildrenHaveCompleted&&tl._currentTime>=tl.duration){tl.paused=true;if(!tl.completed){tl.completed=true;if(!muteCallbacks){tl.onComplete(tl);tl._resolve(tl)}}}}};const additive={animation:null,update:noop};const addAdditiveAnimation=lookups=>{let animation=additive.animation;if(!animation){animation={duration:minValue,computeDeltaTime:noop,_offset:0,_delay:0,_head:null,_tail:null};additive.animation=animation;additive.update=()=>{lookups.forEach((propertyAnimation=>{for(let propertyName in propertyAnimation){const tweens=propertyAnimation[propertyName];const lookupTween=tweens._head;if(lookupTween){const valueType=lookupTween._valueType;const additiveValues=valueType===valueTypes.COMPLEX||valueType===valueTypes.COLOR?cloneArray(lookupTween._fromNumbers):null;let additiveValue=lookupTween._fromNumber;let tween=tweens._tail;while(tween&&tween!==lookupTween){if(additiveValues){for(let i=0,l=tween._numbers.length;i<l;i++)additiveValues[i]+=tween._numbers[i]}else{additiveValue+=tween._number}tween=tween._prevAdd}lookupTween._toNumber=additiveValue;lookupTween._toNumbers=additiveValues}}}));render(animation,1,1,0,tickModes.FORCE)}}return animation};const engineTickMethod=isBrowser?requestAnimationFrame:setImmediate;const engineCancelMethod=isBrowser?cancelAnimationFrame:clearImmediate;class Engine extends Clock{constructor(initTime){super(initTime);this.useDefaultMainLoop=true;this.pauseOnDocumentHidden=true;this.defaults=defaults;this.paused=isBrowser&&doc.hidden?true:false;this.reqId=null}update(){const time=this._currentTime=now();if(this.requestTick(time)){this.computeDeltaTime(time);const engineSpeed=this._speed;const engineFps=this._fps;let activeTickable=this._head;while(activeTickable){const nextTickable=activeTickable._next;if(!activeTickable.paused){tick(activeTickable,(time-activeTickable._startTime)*activeTickable._speed*engineSpeed,0,0,activeTickable._fps<engineFps?activeTickable.requestTick(time):tickModes.AUTO)}else{removeChild(this,activeTickable);this._hasChildren=!!this._tail;activeTickable._running=false;if(activeTickable.completed&&!activeTickable._cancelled){activeTickable.cancel()}}activeTickable=nextTickable}additive.update()}}wake(){if(this.useDefaultMainLoop&&!this.reqId&&!this.paused){this.reqId=engineTickMethod(tickEngine)}return this}pause(){this.paused=true;return killEngine()}resume(){if(!this.paused)return;this.paused=false;forEachChildren(this,(child=>child.resetTime()));return this.wake()}get speed(){return this._speed*(globals.timeScale===1?1:K)}set speed(playbackRate){this._speed=playbackRate*globals.timeScale;forEachChildren(this,(child=>child.speed=child._speed))}get timeUnit(){return globals.timeScale===1?"ms":"s"}set timeUnit(unit){const secondsScale=.001;const isSecond=unit==="s";const newScale=isSecond?secondsScale:1;if(globals.timeScale!==newScale){globals.timeScale=newScale;globals.tickThreshold=200*newScale;const scaleFactor=isSecond?secondsScale:K;this.defaults.duration*=scaleFactor;this._speed*=scaleFactor}}get precision(){return globals.precision}set precision(precision){globals.precision=precision}}const engine=(()=>{const engine=new Engine(now());if(isBrowser){globalVersions.engine=engine;doc.addEventListener("visibilitychange",(()=>{if(!engine.pauseOnDocumentHidden)return;doc.hidden?engine.pause():engine.resume()}))}return engine})();const tickEngine=()=>{if(engine._head){engine.reqId=engineTickMethod(tickEngine);engine.update()}else{engine.reqId=0}};const killEngine=()=>{engineCancelMethod(engine.reqId);engine.reqId=0;return engine};const parseInlineTransforms=(target,propName,animationInlineStyles)=>{const inlineTransforms=target.style.transform;let inlinedStylesPropertyValue;if(inlineTransforms){const cachedTransforms=target[transformsSymbol];let t;while(t=transformsExecRgx.exec(inlineTransforms)){const inlinePropertyName=t[1];const inlinePropertyValue=t[2].slice(1,-1);cachedTransforms[inlinePropertyName]=inlinePropertyValue;if(inlinePropertyName===propName){inlinedStylesPropertyValue=inlinePropertyValue;if(animationInlineStyles){animationInlineStyles[propName]=inlinePropertyValue}}}}return inlineTransforms&&!isUnd(inlinedStylesPropertyValue)?inlinedStylesPropertyValue:stringStartsWith(propName,"scale")?"1":stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew")?"0deg":"0px"};function getNodeList(v){const n=isStr(v)?globals.root.querySelectorAll(v):v;if(n instanceof NodeList||n instanceof HTMLCollection)return n}function parseTargets(targets){if(isNil(targets))return[];if(isArr(targets)){const flattened=targets.flat(Infinity);const parsed=[];for(let i=0,l=flattened.length;i<l;i++){const item=flattened[i];if(!isNil(item)){const nodeList=getNodeList(item);if(nodeList){for(let j=0,jl=nodeList.length;j<jl;j++){const subItem=nodeList[j];if(!isNil(subItem)){let isDuplicate=false;for(let k=0,kl=parsed.length;k<kl;k++){if(parsed[k]===subItem){isDuplicate=true;break}}if(!isDuplicate){parsed.push(subItem)}}}}else{let isDuplicate=false;for(let j=0,jl=parsed.length;j<jl;j++){if(parsed[j]===item){isDuplicate=true;break}}if(!isDuplicate){parsed.push(item)}}}}return parsed}if(!isBrowser)return[targets];const nodeList=getNodeList(targets);if(nodeList)return Array.from(nodeList);return[targets]}function registerTargets(targets){const parsedTargetsArray=parseTargets(targets);const parsedTargetsLength=parsedTargetsArray.length;if(parsedTargetsLength){for(let i=0;i<parsedTargetsLength;i++){const target=parsedTargetsArray[i];if(!target[isRegisteredTargetSymbol]){target[isRegisteredTargetSymbol]=true;const isSvgType=isSvg(target);const isDom=target.nodeType||isSvgType;if(isDom){target[isDomSymbol]=true;target[isSvgSymbol]=isSvgType;target[transformsSymbol]={}}}}}return parsedTargetsArray}const getPath=path=>{const parsedTargets=parseTargets(path);const $parsedSvg=parsedTargets[0];if(!$parsedSvg||!isSvg($parsedSvg))return;return $parsedSvg};const morphTo=(path2,precision=.33)=>$path1=>{const $path2=getPath(path2);if(!$path2)return;const isPath=$path1.tagName==="path";const separator=isPath?" ":",";const previousPoints=$path1[morphPointsSymbol];if(previousPoints)$path1.setAttribute(isPath?"d":"points",previousPoints);let v1="",v2="";if(!precision){v1=$path1.getAttribute(isPath?"d":"points");v2=$path2.getAttribute(isPath?"d":"points")}else{const length1=$path1.getTotalLength();const length2=$path2.getTotalLength();const maxPoints=Math.max(Math.ceil(length1*precision),Math.ceil(length2*precision));for(let i=0;i<maxPoints;i++){const t=i/(maxPoints-1);const pointOnPath1=$path1.getPointAtLength(length1*t);const pointOnPath2=$path2.getPointAtLength(length2*t);const prefix=isPath?i===0?"M":"L":"";v1+=prefix+round(pointOnPath1.x,3)+separator+pointOnPath1.y+" ";v2+=prefix+round(pointOnPath2.x,3)+separator+pointOnPath2.y+" "}}$path1[morphPointsSymbol]=v2;return[v1,v2]};const getScaleFactor=$el=>{let scaleFactor=1;if($el&&$el.getCTM){const ctm=$el.getCTM();if(ctm){const scaleX=sqrt(ctm.a*ctm.a+ctm.b*ctm.b);const scaleY=sqrt(ctm.c*ctm.c+ctm.d*ctm.d);scaleFactor=(scaleX+scaleY)/2}}return scaleFactor};const createDrawableProxy=($el,start,end)=>{const pathLength=K;const computedStyles=getComputedStyle($el);const strokeLineCap=computedStyles.strokeLinecap;const $scalled=computedStyles.vectorEffect==="non-scaling-stroke"?$el:null;let currentCap=strokeLineCap;const proxy=new Proxy($el,{get(target,property){const value=target[property];if(property===proxyTargetSymbol)return target;if(property==="setAttribute"){return(...args)=>{if(args[0]==="draw"){const value=args[1];const values=value.split(" ");const v1=+values[0];const v2=+values[1];const scaleFactor=getScaleFactor($scalled);const os=v1*-1e3*scaleFactor;const d1=v2*pathLength*scaleFactor+os;const d2=pathLength*scaleFactor+(v1===0&&v2===1||v1===1&&v2===0?0:10*scaleFactor)-d1;if(strokeLineCap!=="butt"){const newCap=v1===v2?"butt":strokeLineCap;if(currentCap!==newCap){target.style.strokeLinecap=`${newCap}`;currentCap=newCap}}target.setAttribute("stroke-dashoffset",`${os}`);target.setAttribute("stroke-dasharray",`${d1} ${d2}`)}return Reflect.apply(value,target,args)}}if(isFnc(value)){return(...args)=>Reflect.apply(value,target,args)}else{return value}}});if($el.getAttribute("pathLength")!==`${pathLength}`){$el.setAttribute("pathLength",`${pathLength}`);proxy.setAttribute("draw",`${start} ${end}`)}return proxy};const createDrawable=(selector,start=0,end=0)=>{const els=parseTargets(selector);return els.map(($el=>createDrawableProxy($el,start,end)))};const getPathPoint=($path,progress,lookup=0)=>$path.getPointAtLength(progress+lookup>=1?progress+lookup:0);const getPathProgess=($path,pathProperty)=>$el=>{const totalLength=+$path.getTotalLength();const inSvg=$el[isSvgSymbol];const ctm=$path.getCTM();return{from:0,to:totalLength,modifier:progress=>{if(pathProperty==="a"){const p0=getPathPoint($path,progress,-1);const p1=getPathPoint($path,progress,1);return atan2(p1.y-p0.y,p1.x-p0.x)*180/PI}else{const p=getPathPoint($path,progress,0);return pathProperty==="x"?inSvg||!ctm?p.x:p.x*ctm.a+p.y*ctm.c+ctm.e:inSvg||!ctm?p.y:p.x*ctm.b+p.y*ctm.d+ctm.f}}}};const createMotionPath=path=>{const $path=getPath(path);if(!$path)return;return{translateX:getPathProgess($path,"x"),translateY:getPathProgess($path,"y"),rotate:getPathProgess($path,"a")}};const cssReservedProperties=["opacity","rotate","overflow","color"];const isValidSVGAttribute=(el,propertyName)=>{if(cssReservedProperties.includes(propertyName))return false;if(el.getAttribute(propertyName)||propertyName in el){if(propertyName==="scale"){const elParentNode=el.parentNode;return elParentNode&&elParentNode.tagName==="filter"}return true}};const svg={morphTo:morphTo,createMotionPath:createMotionPath,createDrawable:createDrawable};const rgbToRgba=rgbValue=>{const rgba=rgbExecRgx.exec(rgbValue)||rgbaExecRgx.exec(rgbValue);const a=!isUnd(rgba[4])?+rgba[4]:1;return[+rgba[1],+rgba[2],+rgba[3],a]};const hexToRgba=hexValue=>{const hexLength=hexValue.length;const isShort=hexLength===4||hexLength===5;return[+("0x"+hexValue[1]+hexValue[isShort?1:2]),+("0x"+hexValue[isShort?2:3]+hexValue[isShort?2:4]),+("0x"+hexValue[isShort?3:5]+hexValue[isShort?3:6]),hexLength===5||hexLength===9?+(+("0x"+hexValue[isShort?4:7]+hexValue[isShort?4:8])/255).toFixed(3):1]};const hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;return t<1/6?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p};const hslToRgba=hslValue=>{const hsla=hslExecRgx.exec(hslValue)||hslaExecRgx.exec(hslValue);const h=+hsla[1]/360;const s=+hsla[2]/100;const l=+hsla[3]/100;const a=!isUnd(hsla[4])?+hsla[4]:1;let r,g,b;if(s===0){r=g=b=l}else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=round(hue2rgb(p,q,h+1/3)*255,0);g=round(hue2rgb(p,q,h)*255,0);b=round(hue2rgb(p,q,h-1/3)*255,0)}return[r,g,b,a]};const convertColorStringValuesToRgbaArray=colorString=>isRgb(colorString)?rgbToRgba(colorString):isHex(colorString)?hexToRgba(colorString):isHsl(colorString)?hslToRgba(colorString):[0,0,0,1];const setValue=(targetValue,defaultValue)=>isUnd(targetValue)?defaultValue:targetValue;const getFunctionValue=(value,target,index,total,store)=>{if(isFnc(value)){const func=()=>{const computed=value(target,index,total);return!isNaN(+computed)?+computed:computed||0};if(store){store.func=func}return func()}else{return value}};const getTweenType=(target,prop)=>!target[isDomSymbol]?tweenTypes.OBJECT:target[isSvgSymbol]&&isValidSVGAttribute(target,prop)?tweenTypes.ATTRIBUTE:validTransforms.includes(prop)||shortTransforms.get(prop)?tweenTypes.TRANSFORM:stringStartsWith(prop,"--")?tweenTypes.CSS_VAR:prop in target.style?tweenTypes.CSS:prop in target?tweenTypes.OBJECT:tweenTypes.ATTRIBUTE;const getCSSValue=(target,propName,animationInlineStyles)=>{const inlineStyles=target.style[propName];if(inlineStyles&&animationInlineStyles){animationInlineStyles[propName]=inlineStyles}const value=inlineStyles||getComputedStyle(target[proxyTargetSymbol]||target).getPropertyValue(propName);return value==="auto"?"0":value};const getOriginalAnimatableValue=(target,propName,tweenType,animationInlineStyles)=>{const type=!isUnd(tweenType)?tweenType:getTweenType(target,propName);return type===tweenTypes.OBJECT?target[propName]||0:type===tweenTypes.ATTRIBUTE?target.getAttribute(propName):type===tweenTypes.TRANSFORM?parseInlineTransforms(target,propName,animationInlineStyles):type===tweenTypes.CSS_VAR?getCSSValue(target,propName,animationInlineStyles).trimStart():getCSSValue(target,propName,animationInlineStyles)};const getRelativeValue=(x,y,operator)=>operator==="-"?x-y:operator==="+"?x+y:x*y;const createDecomposedValueTargetObject=()=>({t:valueTypes.NUMBER,n:0,u:null,o:null,d:null,s:null});const decomposeRawValue=(rawValue,targetObject)=>{targetObject.t=valueTypes.NUMBER;targetObject.n=0;targetObject.u=null;targetObject.o=null;targetObject.d=null;targetObject.s=null;if(!rawValue)return targetObject;const num=+rawValue;if(!isNaN(num)){targetObject.n=num;return targetObject}else{let str=rawValue;if(str[1]==="="){targetObject.o=str[0];str=str.slice(2)}const unitMatch=str.includes(" ")?false:unitsExecRgx.exec(str);if(unitMatch){targetObject.t=valueTypes.UNIT;targetObject.n=+unitMatch[1];targetObject.u=unitMatch[2];return targetObject}else if(targetObject.o){targetObject.n=+str;return targetObject}else if(isCol(str)){targetObject.t=valueTypes.COLOR;targetObject.d=convertColorStringValuesToRgbaArray(str);return targetObject}else{const matchedNumbers=str.match(digitWithExponentRgx);targetObject.t=valueTypes.COMPLEX;targetObject.d=matchedNumbers?matchedNumbers.map(Number):[];targetObject.s=str.split(digitWithExponentRgx)||[];return targetObject}}};const decomposeTweenValue=(tween,targetObject)=>{targetObject.t=tween._valueType;targetObject.n=tween._toNumber;targetObject.u=tween._unit;targetObject.o=null;targetObject.d=cloneArray(tween._toNumbers);targetObject.s=cloneArray(tween._strings);return targetObject};const decomposedOriginalValue=createDecomposedValueTargetObject();const lookups={_rep:new WeakMap,_add:new Map};const getTweenSiblings=(target,property,lookup="_rep")=>{const lookupMap=lookups[lookup];let targetLookup=lookupMap.get(target);if(!targetLookup){targetLookup={};lookupMap.set(target,targetLookup)}return targetLookup[property]?targetLookup[property]:targetLookup[property]={_head:null,_tail:null}};const addTweenSortMethod=(p,c)=>p._isOverridden||p._absoluteStartTime>c._absoluteStartTime;const overrideTween=tween=>{tween._isOverlapped=1;tween._isOverridden=1;tween._changeDuration=minValue;tween._currentTime=minValue};const composeTween=(tween,siblings)=>{const tweenCompositionType=tween._composition;if(tweenCompositionType===compositionTypes.replace){const tweenAbsStartTime=tween._absoluteStartTime;addChild(siblings,tween,addTweenSortMethod,"_prevRep","_nextRep");const prevSibling=tween._prevRep;if(prevSibling){const prevParent=prevSibling.parent;const prevAbsEndTime=prevSibling._absoluteStartTime+prevSibling._changeDuration;if(tween.parent.id!==prevParent.id&&prevParent.iterationCount>1&&prevAbsEndTime+(prevParent.duration-prevParent.iterationDuration)>tweenAbsStartTime){overrideTween(prevSibling);let prevPrevSibling=prevSibling._prevRep;while(prevPrevSibling&&prevPrevSibling.parent.id===prevParent.id){overrideTween(prevPrevSibling);prevPrevSibling=prevPrevSibling._prevRep}}const absoluteUpdateStartTime=tweenAbsStartTime-tween._delay;if(prevAbsEndTime>absoluteUpdateStartTime){const prevChangeStartTime=prevSibling._startTime;const prevTLOffset=prevAbsEndTime-(prevChangeStartTime+prevSibling._updateDuration);prevSibling._changeDuration=absoluteUpdateStartTime-prevTLOffset-prevChangeStartTime;prevSibling._currentTime=prevSibling._changeDuration;prevSibling._isOverlapped=1;if(prevSibling._changeDuration<minValue){overrideTween(prevSibling)}}let pausePrevParentAnimation=true;forEachChildren(prevParent,(t=>{if(!t._isOverlapped)pausePrevParentAnimation=false}));if(pausePrevParentAnimation){const prevParentTL=prevParent.parent;if(prevParentTL){let pausePrevParentTL=true;forEachChildren(prevParentTL,(a=>{if(a!==prevParent){forEachChildren(a,(t=>{if(!t._isOverlapped)pausePrevParentTL=false}))}}));if(pausePrevParentTL){prevParentTL.cancel()}}else{prevParent.cancel()}}}}else if(tweenCompositionType===compositionTypes.blend){const additiveTweenSiblings=getTweenSiblings(tween.target,tween.property,"_add");const additiveAnimation=addAdditiveAnimation(lookups._add);let lookupTween=additiveTweenSiblings._head;if(!lookupTween){lookupTween={...tween};lookupTween._composition=compositionTypes.replace;lookupTween._updateDuration=minValue;lookupTween._startTime=0;lookupTween._numbers=cloneArray(tween._fromNumbers);lookupTween._number=0;lookupTween._next=null;lookupTween._prev=null;addChild(additiveTweenSiblings,lookupTween);addChild(additiveAnimation,lookupTween)}const toNumber=tween._toNumber;tween._fromNumber=lookupTween._fromNumber-toNumber;tween._toNumber=0;tween._numbers=cloneArray(tween._fromNumbers);tween._number=0;lookupTween._fromNumber=toNumber;if(tween._toNumbers){const toNumbers=cloneArray(tween._toNumbers);if(toNumbers){toNumbers.forEach(((value,i)=>{tween._fromNumbers[i]=lookupTween._fromNumbers[i]-value;tween._toNumbers[i]=0}))}lookupTween._fromNumbers=toNumbers}addChild(additiveTweenSiblings,tween,null,"_prevAdd","_nextAdd")}return tween};const removeTweenSliblings=tween=>{const tweenComposition=tween._composition;if(tweenComposition!==compositionTypes.none){const tweenTarget=tween.target;const tweenProperty=tween.property;const replaceTweensLookup=lookups._rep;const replaceTargetProps=replaceTweensLookup.get(tweenTarget);const tweenReplaceSiblings=replaceTargetProps[tweenProperty];removeChild(tweenReplaceSiblings,tween,"_prevRep","_nextRep");if(tweenComposition===compositionTypes.blend){const addTweensLookup=lookups._add;const addTargetProps=addTweensLookup.get(tweenTarget);if(!addTargetProps)return;const additiveTweenSiblings=addTargetProps[tweenProperty];const additiveAnimation=additive.animation;removeChild(additiveTweenSiblings,tween,"_prevAdd","_nextAdd");const lookupTween=additiveTweenSiblings._head;if(lookupTween&&lookupTween===additiveTweenSiblings._tail){removeChild(additiveTweenSiblings,lookupTween,"_prevAdd","_nextAdd");removeChild(additiveAnimation,lookupTween);let shouldClean=true;for(let prop in addTargetProps){if(addTargetProps[prop]._head){shouldClean=false;break}}if(shouldClean){addTweensLookup.delete(tweenTarget)}}}}return tween};const resetTimerProperties=timer=>{timer.paused=true;timer.began=false;timer.completed=false;return timer};const reviveTimer=timer=>{if(!timer._cancelled)return timer;if(timer._hasChildren){forEachChildren(timer,reviveTimer)}else{forEachChildren(timer,(tween=>{if(tween._composition!==compositionTypes.none){composeTween(tween,getTweenSiblings(tween.target,tween.property))}}))}timer._cancelled=0;return timer};let timerId=0;class Timer extends Clock{constructor(parameters={},parent=null,parentPosition=0){super(0);const{id:id,delay:delay,duration:duration,reversed:reversed,alternate:alternate,loop:loop,loopDelay:loopDelay,autoplay:autoplay,frameRate:frameRate,playbackRate:playbackRate,onComplete:onComplete,onLoop:onLoop,onPause:onPause,onBegin:onBegin,onBeforeUpdate:onBeforeUpdate,onUpdate:onUpdate}=parameters;if(globals.scope)globals.scope.revertibles.push(this);const timerInitTime=parent?0:engine._elapsedTime;const timerDefaults=parent?parent.defaults:globals.defaults;const timerDelay=isFnc(delay)||isUnd(delay)?timerDefaults.delay:+delay;const timerDuration=isFnc(duration)||isUnd(duration)?Infinity:+duration;const timerLoop=setValue(loop,timerDefaults.loop);const timerLoopDelay=setValue(loopDelay,timerDefaults.loopDelay);const timerIterationCount=timerLoop===true||timerLoop===Infinity||timerLoop<0?Infinity:timerLoop+1;let offsetPosition=0;if(parent){offsetPosition=parentPosition}else{let startTime=now();if(engine.paused){engine.requestTick(startTime);startTime=engine._elapsedTime}offsetPosition=startTime-engine._startTime}this.id=!isUnd(id)?id:++timerId;this.parent=parent;this.duration=clampInfinity((timerDuration+timerLoopDelay)*timerIterationCount-timerLoopDelay)||minValue;this.backwards=false;this.paused=true;this.began=false;this.completed=false;this.onBegin=onBegin||timerDefaults.onBegin;this.onBeforeUpdate=onBeforeUpdate||timerDefaults.onBeforeUpdate;this.onUpdate=onUpdate||timerDefaults.onUpdate;this.onLoop=onLoop||timerDefaults.onLoop;this.onPause=onPause||timerDefaults.onPause;this.onComplete=onComplete||timerDefaults.onComplete;this.iterationDuration=timerDuration;this.iterationCount=timerIterationCount;this._autoplay=parent?false:setValue(autoplay,timerDefaults.autoplay);this._offset=offsetPosition;this._delay=timerDelay;this._loopDelay=timerLoopDelay;this._iterationTime=0;this._currentIteration=0;this._resolve=noop;this._running=false;this._reversed=+setValue(reversed,timerDefaults.reversed);this._reverse=this._reversed;this._cancelled=0;this._alternate=setValue(alternate,timerDefaults.alternate);this._prev=null;this._next=null;this._elapsedTime=timerInitTime;this._startTime=timerInitTime;this._lastTime=timerInitTime;this._fps=setValue(frameRate,timerDefaults.frameRate);this._speed=setValue(playbackRate,timerDefaults.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(cancelled){cancelled?this.cancel():this.reset(1).play()}get currentTime(){return clamp(round(this._currentTime,globals.precision),-this._delay,this.duration)}set currentTime(time){const paused=this.paused;this.pause().seek(+time);if(!paused)this.resume()}get iterationCurrentTime(){return round(this._iterationTime,globals.precision)}set iterationCurrentTime(time){this.currentTime=this.iterationDuration*this._currentIteration+time}get progress(){return clamp(round(this._currentTime/this.duration,5),0,1)}set progress(progress){this.currentTime=this.duration*progress}get iterationProgress(){return clamp(round(this._iterationTime/this.iterationDuration,5),0,1)}set iterationProgress(progress){const iterationDuration=this.iterationDuration;this.currentTime=iterationDuration*this._currentIteration+iterationDuration*progress}get currentIteration(){return this._currentIteration}set currentIteration(iterationCount){this.currentTime=this.iterationDuration*clamp(+iterationCount,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(reverse){reverse?this.reverse():this.play()}get speed(){return super.speed}set speed(playbackRate){super.speed=playbackRate;this.resetTime()}reset(internalRender=0){reviveTimer(this);if(this._reversed&&!this._reverse)this.reversed=false;this._iterationTime=this.iterationDuration;tick(this,0,1,internalRender,tickModes.FORCE);resetTimerProperties(this);if(this._hasChildren){forEachChildren(this,resetTimerProperties)}return this}init(internalRender=0){this.fps=this._fps;this.speed=this._speed;if(!internalRender&&this._hasChildren){tick(this,this.duration,1,internalRender,tickModes.FORCE)}this.reset(internalRender);const autoplay=this._autoplay;if(autoplay===true){this.resume()}else if(autoplay&&!isUnd(autoplay.linked)){autoplay.link(this)}return this}resetTime(){const timeScale=1/(this._speed*engine._speed);this._startTime=now()-(this._currentTime+this._delay)*timeScale;return this}pause(){if(this.paused)return this;this.paused=true;this.onPause(this);return this}resume(){if(!this.paused)return this;this.paused=false;if(this.duration<=minValue&&!this._hasChildren){tick(this,minValue,0,0,tickModes.FORCE)}else{if(!this._running){addChild(engine,this);engine._hasChildren=true;this._running=true}this.resetTime();this._startTime-=12;engine.wake()}return this}restart(){return this.reset(0).resume()}seek(time,muteCallbacks=0,internalRender=0){reviveTimer(this);this.completed=false;const isPaused=this.paused;this.paused=true;tick(this,time+this._delay,~~muteCallbacks,~~internalRender,tickModes.AUTO);return isPaused?this:this.resume()}alternate(){const reversed=this._reversed;const count=this.iterationCount;const duration=this.iterationDuration;const iterations=count===Infinity?floor(maxValue/duration):count;this._reversed=+(this._alternate&&!(iterations%2)?reversed:!reversed);if(count===Infinity){this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress}else{this.seek(duration*iterations-this._currentTime)}this.resetTime();return this}play(){if(this._reversed)this.alternate();return this.resume()}reverse(){if(!this._reversed)this.alternate();return this.resume()}cancel(){if(this._hasChildren){forEachChildren(this,(child=>child.cancel()),true)}else{forEachChildren(this,removeTweenSliblings)}this._cancelled=1;return this.pause()}stretch(newDuration){const currentDuration=this.duration;const normlizedDuration=normalizeTime(newDuration);if(currentDuration===normlizedDuration)return this;const timeScale=newDuration/currentDuration;const isSetter=newDuration<=minValue;this.duration=isSetter?minValue:normlizedDuration;this.iterationDuration=isSetter?minValue:normalizeTime(this.iterationDuration*timeScale);this._offset*=timeScale;this._delay*=timeScale;this._loopDelay*=timeScale;return this}revert(){tick(this,0,1,0,tickModes.AUTO);const ap=this._autoplay;if(ap&&ap.linked&&ap.linked===this)ap.revert();return this.cancel()}complete(){return this.seek(this.duration).cancel()}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const createTimer=parameters=>new Timer(parameters,null,0).init();const none=t=>t;const calcBezier=(aT,aA1,aA2)=>(((1-3*aA2+3*aA1)*aT+(3*aA2-6*aA1))*aT+3*aA1)*aT;const binarySubdivide=(aX,mX1,mX2)=>{let aA=0,aB=1,currentX,currentT,i=0;do{currentT=aA+(aB-aA)/2;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0){aB=currentT}else{aA=currentT}}while(abs(currentX)>1e-7&&++i<100);return currentT};const cubicBezier=(mX1=.5,mY1=0,mX2=.5,mY2=1)=>mX1===mY1&&mX2===mY2?none:t=>t===0||t===1?t:calcBezier(binarySubdivide(t,mX1,mX2),mY1,mY2);const steps=(steps=10,fromStart)=>{const roundMethod=fromStart?ceil:floor;return t=>roundMethod(clamp(t,0,1)*steps)*(1/steps)};const linear=(...args)=>{const argsLength=args.length;if(!argsLength)return none;const totalPoints=argsLength-1;const firstArg=args[0];const lastArg=args[totalPoints];const xPoints=[0];const yPoints=[parseNumber(firstArg)];for(let i=1;i<totalPoints;i++){const arg=args[i];const splitValue=isStr(arg)?arg.trim().split(" "):[arg];const value=splitValue[0];const percent=splitValue[1];xPoints.push(!isUnd(percent)?parseNumber(percent)/100:i/totalPoints);yPoints.push(parseNumber(value))}yPoints.push(parseNumber(lastArg));xPoints.push(1);return function easeLinear(t){for(let i=1,l=xPoints.length;i<l;i++){const currentX=xPoints[i];if(t<=currentX){const prevX=xPoints[i-1];const prevY=yPoints[i-1];return prevY+(yPoints[i]-prevY)*(t-prevX)/(currentX-prevX)}}return yPoints[yPoints.length-1]}};const irregular=(length=10,randomness=1)=>{const values=[0];const total=length-1;for(let i=1;i<total;i++){const previousValue=values[i-1];const spacing=i/total;const segmentEnd=(i+1)/total;const randomVariation=spacing+(segmentEnd-spacing)*Math.random();const randomValue=spacing*(1-randomness)+randomVariation*randomness;values.push(clamp(randomValue,previousValue,1))}values.push(1);return linear(...values)};const halfPI=PI/2;const doublePI=PI*2;const easeInPower=(p=1.68)=>t=>pow(t,+p);const easeInFunctions={[emptyString]:easeInPower,Quad:easeInPower(2),Cubic:easeInPower(3),Quart:easeInPower(4),Quint:easeInPower(5),Sine:t=>1-cos(t*halfPI),Circ:t=>1-sqrt(1-t*t),Expo:t=>t?pow(2,10*t-10):0,Bounce:t=>{let pow2,b=4;while(t<((pow2=pow(2,--b))-1)/11);return 1/pow(4,3-b)-7.5625*pow((pow2*3-2)/22-t,2)},Back:(overshoot=1.70158)=>t=>(+overshoot+1)*t*t*t-+overshoot*t*t,Elastic:(amplitude=1,period=.3)=>{const a=clamp(+amplitude,1,10);const p=clamp(+period,minValue,2);const s=p/doublePI*asin(1/a);const e=doublePI/p;return t=>t===0||t===1?t:-a*pow(2,-10*(1-t))*sin((1-t-s)*e)}};const easeTypes={in:easeIn=>t=>easeIn(t),out:easeIn=>t=>1-easeIn(1-t),inOut:easeIn=>t=>t<.5?easeIn(t*2)/2:1-easeIn(t*-2+2)/2,outIn:easeIn=>t=>t<.5?(1-easeIn(1-t*2))/2:(easeIn(t*2-1)+1)/2};const parseEaseString=(string,easesFunctions,easesLookups)=>{if(easesLookups[string])return easesLookups[string];if(string.indexOf("(")<=-1){const hasParams=easeTypes[string]||string.includes("Back")||string.includes("Elastic");const parsedFn=hasParams?easesFunctions[string]():easesFunctions[string];return parsedFn?easesLookups[string]=parsedFn:none}else{const split=string.slice(0,-1).split("(");const parsedFn=easesFunctions[split[0]];return parsedFn?easesLookups[string]=parsedFn(...split[1].split(",")):none}};const eases=(()=>{const list={linear:linear,irregular:irregular,steps:steps,cubicBezier:cubicBezier};for(let type in easeTypes){for(let name in easeInFunctions){const easeIn=easeInFunctions[name];const easeType=easeTypes[type];list[type+name]=name===emptyString||name==="Back"||name==="Elastic"?(a,b)=>easeType(easeIn(a,b)):easeType(easeIn)}}return list})();const JSEasesLookups={linear:none};const parseEasings=ease=>isFnc(ease)?ease:isStr(ease)?parseEaseString(ease,eases,JSEasesLookups):none;const propertyNamesCache={};const sanitizePropertyName=(propertyName,target,tweenType)=>{if(tweenType===tweenTypes.TRANSFORM){const t=shortTransforms.get(propertyName);return t?t:propertyName}else if(tweenType===tweenTypes.CSS||tweenType===tweenTypes.ATTRIBUTE&&(isSvg(target)&&propertyName in target.style)){const cachedPropertyName=propertyNamesCache[propertyName];if(cachedPropertyName){return cachedPropertyName}else{const lowerCaseName=propertyName?toLowerCase(propertyName):propertyName;propertyNamesCache[propertyName]=lowerCaseName;return lowerCaseName}}else{return propertyName}};const angleUnitsMap={deg:1,rad:180/PI,turn:360};const convertedValuesCache={};const convertValueUnit=(el,decomposedValue,unit,force=false)=>{const currentUnit=decomposedValue.u;const currentNumber=decomposedValue.n;if(decomposedValue.t===valueTypes.UNIT&&currentUnit===unit){return decomposedValue}const cachedKey=currentNumber+currentUnit+unit;const cached=convertedValuesCache[cachedKey];if(!isUnd(cached)&&!force){decomposedValue.n=cached}else{let convertedValue;if(currentUnit in angleUnitsMap){convertedValue=currentNumber*angleUnitsMap[currentUnit]/angleUnitsMap[unit]}else{const baseline=100;const tempEl=el.cloneNode();const parentNode=el.parentNode;const parentEl=parentNode&&parentNode!==doc?parentNode:doc.body;parentEl.appendChild(tempEl);const elStyle=tempEl.style;elStyle.width=baseline+currentUnit;const currentUnitWidth=tempEl.offsetWidth||baseline;elStyle.width=baseline+unit;const newUnitWidth=tempEl.offsetWidth||baseline;const factor=currentUnitWidth/newUnitWidth;parentEl.removeChild(tempEl);convertedValue=factor*currentNumber}decomposedValue.n=convertedValue;convertedValuesCache[cachedKey]=convertedValue}decomposedValue.t===valueTypes.UNIT;decomposedValue.u=unit;return decomposedValue};const cleanInlineStyles=renderable=>{if(renderable._hasChildren){forEachChildren(renderable,cleanInlineStyles,true)}else{const animation=renderable;animation.pause();forEachChildren(animation,(tween=>{const tweenProperty=tween.property;const tweenTarget=tween.target;if(tweenTarget[isDomSymbol]){const targetStyle=tweenTarget.style;const originalInlinedValue=animation._inlineStyles[tweenProperty];if(tween._tweenType===tweenTypes.TRANSFORM){const cachedTransforms=tweenTarget[transformsSymbol];if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){delete cachedTransforms[tweenProperty]}else{cachedTransforms[tweenProperty]=originalInlinedValue}if(tween._renderTransforms){if(!Object.keys(cachedTransforms).length){targetStyle.removeProperty("transform")}else{let str=emptyString;for(let key in cachedTransforms){str+=transformsFragmentStrings[key]+cachedTransforms[key]+") "}targetStyle.transform=str}}}else{if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){targetStyle.removeProperty(tweenProperty)}else{targetStyle[tweenProperty]=originalInlinedValue}}if(animation._tail===tween){animation.targets.forEach((t=>{if(t.getAttribute&&t.getAttribute("style")===emptyString){t.removeAttribute("style")}}))}}}))}return renderable};const fromTargetObject=createDecomposedValueTargetObject();const toTargetObject=createDecomposedValueTargetObject();const toFunctionStore={func:null};const keyframesTargetArray=[null];const fastSetValuesArray=[null,null];const keyObjectTarget={to:null};let tweenId=0;let keyframes;let key;const generateKeyframes=(keyframes,parameters)=>{const properties={};if(isArr(keyframes)){const propertyNames=[].concat(...keyframes.map((key=>Object.keys(key)))).filter(isKey);for(let i=0,l=propertyNames.length;i<l;i++){const propName=propertyNames[i];const propArray=keyframes.map((key=>{const newKey={};for(let p in key){const keyValue=key[p];if(isKey(p)){if(p===propName){newKey.to=keyValue}}else{newKey[p]=keyValue}}return newKey}));properties[propName]=propArray}}else{const totalDuration=setValue(parameters.duration,globals.defaults.duration);const keys=Object.keys(keyframes).map((key=>({o:parseFloat(key)/100,p:keyframes[key]}))).sort(((a,b)=>a.o-b.o));keys.forEach((key=>{const offset=key.o;const prop=key.p;for(let name in prop){if(isKey(name)){let propArray=properties[name];if(!propArray)propArray=properties[name]=[];const duration=offset*totalDuration;let length=propArray.length;let prevKey=propArray[length-1];const keyObj={to:prop[name]};let durProgress=0;for(let i=0;i<length;i++){durProgress+=propArray[i].duration}if(length===1){keyObj.from=prevKey.to}if(prop.ease){keyObj.ease=prop.ease}keyObj.duration=duration-(length?durProgress:0);propArray.push(keyObj)}}return key}));for(let name in properties){const propArray=properties[name];let prevEase;for(let i=0,l=propArray.length;i<l;i++){const prop=propArray[i];const currentEase=prop.ease;prop.ease=prevEase?prevEase:undefined;prevEase=currentEase}if(!propArray[0].duration){propArray.shift()}}}return properties};class JSAnimation extends Timer{constructor(targets,parameters,parent,parentPosition,fastSet=false,index=0,length=0){super(parameters,parent,parentPosition);const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;const kfParams=parameters.keyframes;const params=kfParams?mergeObjects(generateKeyframes(kfParams,parameters),parameters):parameters;const{delay:delay,duration:duration,ease:ease,playbackEase:playbackEase,modifier:modifier,composition:composition,onRender:onRender}=params;const animDefaults=parent?parent.defaults:globals.defaults;const animaPlaybackEase=setValue(playbackEase,animDefaults.playbackEase);const animEase=animaPlaybackEase?parseEasings(animaPlaybackEase):null;const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const tEasing=hasSpring?ease.ease:setValue(ease,animEase?"linear":animDefaults.ease);const tDuration=hasSpring?ease.duration:setValue(duration,animDefaults.duration);const tDelay=setValue(delay,animDefaults.delay);const tModifier=modifier||animDefaults.modifier;const tComposition=isUnd(composition)&&targetsLength>=K?compositionTypes.none:!isUnd(composition)?composition:animDefaults.composition;const animInlineStyles={};const absoluteOffsetTime=this._offset+(parent?parent._offset:0);let iterationDuration=NaN;let iterationDelay=NaN;let animationAnimationLength=0;let shouldTriggerRender=0;for(let targetIndex=0;targetIndex<targetsLength;targetIndex++){const target=parsedTargets[targetIndex];const ti=index||targetIndex;const tl=length||targetsLength;let lastTransformGroupIndex=NaN;let lastTransformGroupLength=NaN;for(let p in params){if(isKey(p)){const tweenType=getTweenType(target,p);const propName=sanitizePropertyName(p,target,tweenType);let propValue=params[p];const isPropValueArray=isArr(propValue);if(fastSet&&!isPropValueArray){fastSetValuesArray[0]=propValue;fastSetValuesArray[1]=propValue;propValue=fastSetValuesArray}if(isPropValueArray){const arrayLength=propValue.length;const isNotObjectValue=!isObj(propValue[0]);if(arrayLength===2&&isNotObjectValue){keyObjectTarget.to=propValue;keyframesTargetArray[0]=keyObjectTarget;keyframes=keyframesTargetArray}else if(arrayLength>2&&isNotObjectValue){keyframes=[];propValue.forEach(((v,i)=>{if(!i){fastSetValuesArray[0]=v}else if(i===1){fastSetValuesArray[1]=v;keyframes.push(fastSetValuesArray)}else{keyframes.push(v)}}))}else{keyframes=propValue}}else{keyframesTargetArray[0]=propValue;keyframes=keyframesTargetArray}let siblings=null;let prevTween=null;let firstTweenChangeStartTime=NaN;let lastTweenChangeEndTime=0;let tweenIndex=0;for(let l=keyframes.length;tweenIndex<l;tweenIndex++){const keyframe=keyframes[tweenIndex];if(isObj(keyframe)){key=keyframe}else{keyObjectTarget.to=keyframe;key=keyObjectTarget}toFunctionStore.func=null;const computedToValue=getFunctionValue(key.to,target,ti,tl,toFunctionStore);let tweenToValue;if(isObj(computedToValue)&&!isUnd(computedToValue.to)){key=computedToValue;tweenToValue=computedToValue.to}else{tweenToValue=computedToValue}const tweenFromValue=getFunctionValue(key.from,target,ti,tl);const keyEasing=key.ease;const hasSpring=!isUnd(keyEasing)&&!isUnd(keyEasing.ease);const tweenEasing=hasSpring?keyEasing.ease:keyEasing||tEasing;const tweenDuration=hasSpring?keyEasing.duration:getFunctionValue(setValue(key.duration,l>1?getFunctionValue(tDuration,target,ti,tl)/l:tDuration),target,ti,tl);const tweenDelay=getFunctionValue(setValue(key.delay,!tweenIndex?tDelay:0),target,ti,tl);const computedComposition=getFunctionValue(setValue(key.composition,tComposition),target,ti,tl);const tweenComposition=isNum(computedComposition)?computedComposition:compositionTypes[computedComposition];const tweenModifier=key.modifier||tModifier;const hasFromvalue=!isUnd(tweenFromValue);const hasToValue=!isUnd(tweenToValue);const isFromToArray=isArr(tweenToValue);const isFromToValue=isFromToArray||hasFromvalue&&hasToValue;const tweenStartTime=prevTween?lastTweenChangeEndTime+tweenDelay:tweenDelay;const absoluteStartTime=absoluteOffsetTime+tweenStartTime;if(!shouldTriggerRender&&(hasFromvalue||isFromToArray))shouldTriggerRender=1;let prevSibling=prevTween;if(tweenComposition!==compositionTypes.none){if(!siblings)siblings=getTweenSiblings(target,propName);let nextSibling=siblings._head;while(nextSibling&&!nextSibling._isOverridden&&nextSibling._absoluteStartTime<=absoluteStartTime){prevSibling=nextSibling;nextSibling=nextSibling._nextRep;if(nextSibling&&nextSibling._absoluteStartTime>=absoluteStartTime){while(nextSibling){overrideTween(nextSibling);nextSibling=nextSibling._nextRep}}}}if(isFromToValue){decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[0],target,ti,tl):tweenFromValue,fromTargetObject);decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[1],target,ti,tl,toFunctionStore):tweenToValue,toTargetObject);if(fromTargetObject.t===valueTypes.NUMBER){if(prevSibling){if(prevSibling._valueType===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=prevSibling._unit}}else{decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=decomposedOriginalValue.u}}}}else{if(hasToValue){decomposeRawValue(tweenToValue,toTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,toTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),toTargetObject)}}if(hasFromvalue){decomposeRawValue(tweenFromValue,fromTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,fromTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),fromTargetObject)}}}if(fromTargetObject.o){fromTargetObject.n=getRelativeValue(!prevSibling?decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue).n:prevSibling._toNumber,fromTargetObject.n,fromTargetObject.o)}if(toTargetObject.o){toTargetObject.n=getRelativeValue(fromTargetObject.n,toTargetObject.n,toTargetObject.o)}if(fromTargetObject.t!==toTargetObject.t){if(fromTargetObject.t===valueTypes.COMPLEX||toTargetObject.t===valueTypes.COMPLEX){const complexValue=fromTargetObject.t===valueTypes.COMPLEX?fromTargetObject:toTargetObject;const notComplexValue=fromTargetObject.t===valueTypes.COMPLEX?toTargetObject:fromTargetObject;notComplexValue.t=valueTypes.COMPLEX;notComplexValue.s=cloneArray(complexValue.s);notComplexValue.d=complexValue.d.map((()=>notComplexValue.n))}else if(fromTargetObject.t===valueTypes.UNIT||toTargetObject.t===valueTypes.UNIT){const unitValue=fromTargetObject.t===valueTypes.UNIT?fromTargetObject:toTargetObject;const notUnitValue=fromTargetObject.t===valueTypes.UNIT?toTargetObject:fromTargetObject;notUnitValue.t=valueTypes.UNIT;notUnitValue.u=unitValue.u}else if(fromTargetObject.t===valueTypes.COLOR||toTargetObject.t===valueTypes.COLOR){const colorValue=fromTargetObject.t===valueTypes.COLOR?fromTargetObject:toTargetObject;const notColorValue=fromTargetObject.t===valueTypes.COLOR?toTargetObject:fromTargetObject;notColorValue.t=valueTypes.COLOR;notColorValue.s=colorValue.s;notColorValue.d=[0,0,0,1]}}if(fromTargetObject.u!==toTargetObject.u){let valueToConvert=toTargetObject.u?fromTargetObject:toTargetObject;valueToConvert=convertValueUnit(target,valueToConvert,toTargetObject.u?toTargetObject.u:fromTargetObject.u,false)}if(toTargetObject.d&&fromTargetObject.d&&toTargetObject.d.length!==fromTargetObject.d.length){const longestValue=fromTargetObject.d.length>toTargetObject.d.length?fromTargetObject:toTargetObject;const shortestValue=longestValue===fromTargetObject?toTargetObject:fromTargetObject;shortestValue.d=longestValue.d.map(((_,i)=>isUnd(shortestValue.d[i])?0:shortestValue.d[i]));shortestValue.s=cloneArray(longestValue.s)}const tweenUpdateDuration=round(+tweenDuration||minValue,12);const tween={parent:this,id:tweenId++,property:propName,target:target,_value:null,_func:toFunctionStore.func,_ease:parseEasings(tweenEasing),_fromNumbers:cloneArray(fromTargetObject.d),_toNumbers:cloneArray(toTargetObject.d),_strings:cloneArray(toTargetObject.s),_fromNumber:fromTargetObject.n,_toNumber:toTargetObject.n,_numbers:cloneArray(fromTargetObject.d),_number:fromTargetObject.n,_unit:toTargetObject.u,_modifier:tweenModifier,_currentTime:0,_startTime:tweenStartTime,_delay:+tweenDelay,_updateDuration:tweenUpdateDuration,_changeDuration:tweenUpdateDuration,_absoluteStartTime:absoluteStartTime,_tweenType:tweenType,_valueType:toTargetObject.t,_composition:tweenComposition,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};if(tweenComposition!==compositionTypes.none){composeTween(tween,siblings)}if(isNaN(firstTweenChangeStartTime)){firstTweenChangeStartTime=tween._startTime}lastTweenChangeEndTime=round(tweenStartTime+tweenUpdateDuration,12);prevTween=tween;animationAnimationLength++;addChild(this,tween)}if(isNaN(iterationDelay)||firstTweenChangeStartTime<iterationDelay){iterationDelay=firstTweenChangeStartTime}if(isNaN(iterationDuration)||lastTweenChangeEndTime>iterationDuration){iterationDuration=lastTweenChangeEndTime}if(tweenType===tweenTypes.TRANSFORM){lastTransformGroupIndex=animationAnimationLength-tweenIndex;lastTransformGroupLength=animationAnimationLength}}}if(!isNaN(lastTransformGroupIndex)){let i=0;forEachChildren(this,(tween=>{if(i>=lastTransformGroupIndex&&i<lastTransformGroupLength){tween._renderTransforms=1;if(tween._composition===compositionTypes.blend){forEachChildren(additive.animation,(additiveTween=>{if(additiveTween.id===tween.id){additiveTween._renderTransforms=1}}))}}i++}))}}if(!targetsLength){console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`)}if(iterationDelay){forEachChildren(this,(tween=>{if(!(tween._startTime-tween._delay)){tween._delay-=iterationDelay}tween._startTime-=iterationDelay}));iterationDuration-=iterationDelay}else{iterationDelay=0}if(!iterationDuration){iterationDuration=minValue;this.iterationCount=0}this.targets=parsedTargets;this.duration=iterationDuration===minValue?minValue:clampInfinity((iterationDuration+this._loopDelay)*this.iterationCount-this._loopDelay)||minValue;this.onRender=onRender||animDefaults.onRender;this._ease=animEase;this._delay=iterationDelay;this.iterationDuration=iterationDuration;this._inlineStyles=animInlineStyles;if(!this._autoplay&&shouldTriggerRender)this.onRender(this)}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;forEachChildren(this,(tween=>{tween._updateDuration=normalizeTime(tween._updateDuration*timeScale);tween._changeDuration=normalizeTime(tween._changeDuration*timeScale);tween._currentTime*=timeScale;tween._startTime*=timeScale;tween._absoluteStartTime*=timeScale}));return super.stretch(newDuration)}refresh(){forEachChildren(this,(tween=>{const ogValue=getOriginalAnimatableValue(tween.target,tween.property,tween._tweenType);decomposeRawValue(ogValue,decomposedOriginalValue);tween._fromNumbers=cloneArray(decomposedOriginalValue.d);tween._fromNumber=decomposedOriginalValue.n;if(tween._func){decomposeRawValue(tween._func(),toTargetObject);tween._toNumbers=cloneArray(toTargetObject.d);tween._strings=cloneArray(toTargetObject.s);tween._toNumber=toTargetObject.n}}));return this}revert(){super.revert();return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const animate=(targets,parameters)=>new JSAnimation(targets,parameters,null,0,false).init();const easingToLinear=(fn,samples=100)=>{const points=[];for(let i=0;i<=samples;i++)points.push(fn(i/samples));return`linear(${points.join(", ")})`};const WAAPIEasesLookups={in:"ease-in",out:"ease-out",inOut:"ease-in-out"};const WAAPIeases=(()=>{const list={};for(let type in easeTypes)list[type]=a=>easeTypes[type](easeInPower(a));return list})();const parseWAAPIEasing=ease=>{let parsedEase=WAAPIEasesLookups[ease];if(parsedEase)return parsedEase;parsedEase="linear";if(isStr(ease)){if(stringStartsWith(ease,"linear")||stringStartsWith(ease,"cubic-")||stringStartsWith(ease,"steps")||stringStartsWith(ease,"ease")){parsedEase=ease}else if(stringStartsWith(ease,"cubicB")){parsedEase=toLowerCase(ease)}else{const parsed=parseEaseString(ease,WAAPIeases,WAAPIEasesLookups);if(isFnc(parsed))parsedEase=parsed===none?"linear":easingToLinear(parsed)}WAAPIEasesLookups[ease]=parsedEase}else if(isFnc(ease)){const easing=easingToLinear(ease);if(easing)parsedEase=easing}else if(ease.ease){parsedEase=easingToLinear(ease.ease)}return parsedEase};const transformsShorthands=["x","y","z"];const commonDefaultPXProperties=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...transformsShorthands];const validIndividualTransforms=[...transformsShorthands,...validTransforms.filter((t=>["X","Y","Z"].some((axis=>t.endsWith(axis)))))];let transformsPropertiesRegistered=isBrowser&&(isUnd(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const registerTransformsProperties=()=>{if(transformsPropertiesRegistered)return;validTransforms.forEach((t=>{const isSkew=stringStartsWith(t,"skew");const isScale=stringStartsWith(t,"scale");const isRotate=stringStartsWith(t,"rotate");const isTranslate=stringStartsWith(t,"translate");const isAngle=isRotate||isSkew;const syntax=isAngle?"<angle>":isScale?"<number>":isTranslate?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:syntax,inherits:false,initialValue:isTranslate?"0px":isAngle?"0deg":isScale?"1":"0"})}catch{}}));transformsPropertiesRegistered=true};const WAAPIAnimationsLookups={_head:null,_tail:null};const removeWAAPIAnimation=($el,property,parent)=>{let nextLookup=WAAPIAnimationsLookups._head;while(nextLookup){const next=nextLookup._next;const matchTarget=nextLookup.$el===$el;const matchProperty=!property||nextLookup.property===property;const matchParent=!parent||nextLookup.parent===parent;if(matchTarget&&matchProperty&&matchParent){const anim=nextLookup.animation;try{anim.commitStyles()}catch{}anim.cancel();removeChild(WAAPIAnimationsLookups,nextLookup);const lookupParent=nextLookup.parent;if(lookupParent){lookupParent._completed++;if(lookupParent.animations.length===lookupParent._completed){lookupParent.completed=true;if(!lookupParent.muteCallbacks){lookupParent.paused=true;lookupParent.onComplete(lookupParent);lookupParent._resolve(lookupParent)}}}}nextLookup=next}};const addWAAPIAnimation=(parent,$el,property,keyframes,params)=>{const animation=$el.animate(keyframes,params);const animTotalDuration=params.delay+ +params.duration*params.iterations;animation.playbackRate=parent._speed;if(parent.paused)animation.pause();if(parent.duration<animTotalDuration){parent.duration=animTotalDuration;parent.controlAnimation=animation}parent.animations.push(animation);removeWAAPIAnimation($el,property);addChild(WAAPIAnimationsLookups,{parent:parent,animation:animation,$el:$el,property:property,_next:null,_prev:null});const handleRemove=()=>{removeWAAPIAnimation($el,property,parent)};animation.onremove=handleRemove;animation.onfinish=handleRemove;return animation};const normalizeTweenValue=(propName,value,$el,i,targetsLength)=>{let v=getFunctionValue(value,$el,i,targetsLength);if(!isNum(v))return v;if(commonDefaultPXProperties.includes(propName)||stringStartsWith(propName,"translate"))return`${v}px`;if(stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew"))return`${v}deg`;return`${v}`};const parseIndividualTweenValue=($el,propName,from,to,i,targetsLength)=>{let tweenValue="0";const computedTo=!isUnd(to)?normalizeTweenValue(propName,to,$el,i,targetsLength):getComputedStyle($el)[propName];if(!isUnd(from)){const computedFrom=normalizeTweenValue(propName,from,$el,i,targetsLength);tweenValue=[computedFrom,computedTo]}else{tweenValue=isArr(to)?to.map((v=>normalizeTweenValue(propName,v,$el,i,targetsLength))):computedTo}return tweenValue};class WAAPIAnimation{constructor(targets,params){if(globals.scope)globals.scope.revertibles.push(this);registerTransformsProperties();const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;if(!targetsLength){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=ease.ease&&ease;const autoplay=setValue(params.autoplay,globals.defaults.autoplay);const scroll=autoplay&&autoplay.link?autoplay:false;const alternate=params.alternate&&params.alternate===true;const reversed=params.reversed&&params.reversed===true;const loop=setValue(params.loop,globals.defaults.loop);const iterations=loop===true||loop===Infinity?Infinity:isNum(loop)?loop+1:1;const direction=alternate?reversed?"alternate-reverse":"alternate":reversed?"reverse":"normal";const fill="forwards";const easing=parseWAAPIEasing(ease);const timeScale=globals.timeScale===1?1:K;this.targets=parsedTargets;this.animations=[];this.controlAnimation=null;this.onComplete=params.onComplete||noop;this.duration=0;this.muteCallbacks=false;this.completed=false;this.paused=!autoplay||scroll!==false;this.reversed=reversed;this.autoplay=autoplay;this._speed=setValue(params.playbackRate,globals.defaults.playbackRate);this._resolve=noop;this._completed=0;this._inlineStyles=parsedTargets.map(($el=>$el.getAttribute("style")));parsedTargets.forEach((($el,i)=>{const cachedTransforms=$el[transformsSymbol];const hasIndividualTransforms=validIndividualTransforms.some((t=>params.hasOwnProperty(t)));const duration=(spring?spring.duration:getFunctionValue(setValue(params.duration,globals.defaults.duration),$el,i,targetsLength))*timeScale;const delay=getFunctionValue(setValue(params.delay,globals.defaults.delay),$el,i,targetsLength)*timeScale;const composite=setValue(params.composition,"replace");for(let name in params){if(!isKey(name))continue;const keyframes={};const tweenParams={iterations:iterations,direction:direction,fill:fill,easing:easing,duration:duration,delay:delay,composite:composite};const propertyValue=params[name];const individualTransformProperty=hasIndividualTransforms?validTransforms.includes(name)?name:shortTransforms.get(name):false;let parsedPropertyValue;if(isObj(propertyValue)){const tweenOptions=propertyValue;const tweenOptionsEase=setValue(tweenOptions.ease,ease);const tweenOptionsSpring=tweenOptionsEase.ease&&tweenOptionsEase;const to=tweenOptions.to;const from=tweenOptions.from;tweenParams.duration=(tweenOptionsSpring?tweenOptionsSpring.duration:getFunctionValue(setValue(tweenOptions.duration,duration),$el,i,targetsLength))*timeScale;tweenParams.delay=getFunctionValue(setValue(tweenOptions.delay,delay),$el,i,targetsLength)*timeScale;tweenParams.composite=setValue(tweenOptions.composition,composite);tweenParams.easing=parseWAAPIEasing(tweenOptionsEase);parsedPropertyValue=parseIndividualTweenValue($el,name,from,to,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parseIndividualTweenValue($el,name,from,to,i,targetsLength)}addWAAPIAnimation(this,$el,name,keyframes,tweenParams);if(!isUnd(from)){if(!individualTransformProperty){$el.style[name]=keyframes[name][0]}else{const key=`--${individualTransformProperty}`;$el.style.setProperty(key,keyframes[key][0])}}}else{parsedPropertyValue=isArr(propertyValue)?propertyValue.map((v=>normalizeTweenValue(name,v,$el,i,targetsLength))):normalizeTweenValue(name,propertyValue,$el,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parsedPropertyValue}addWAAPIAnimation(this,$el,name,keyframes,tweenParams)}}if(hasIndividualTransforms){let transforms=emptyString;for(let t in cachedTransforms){transforms+=`${transformsFragmentStrings[t]}var(--${t})) `}$el.style.transform=transforms}}));if(scroll){this.autoplay.link(this)}}forEach(callback){const cb=isStr(callback)?a=>a[callback]():callback;this.animations.forEach(cb);return this}get speed(){return this._speed}set speed(speed){this._speed=+speed;this.forEach((anim=>anim.playbackRate=speed))}get currentTime(){const controlAnimation=this.controlAnimation;const timeScale=globals.timeScale;return this.completed?this.duration:controlAnimation?+controlAnimation.currentTime*(timeScale===1?1:timeScale):0}set currentTime(time){const t=time*(globals.timeScale===1?1:K);this.forEach((anim=>{if(t>=this.duration)anim.play();anim.currentTime=t}))}get progress(){return this.currentTime/this.duration}set progress(progress){this.forEach((anim=>anim.currentTime=progress*this.duration||0))}resume(){if(!this.paused)return this;this.paused=false;return this.forEach("play")}pause(){if(this.paused)return this;this.paused=true;return this.forEach("pause")}alternate(){this.reversed=!this.reversed;this.forEach("reverse");if(this.paused)this.forEach("pause");return this}play(){if(this.reversed)this.alternate();return this.resume()}reverse(){if(!this.reversed)this.alternate();return this.resume()}seek(time,muteCallbacks=false){if(muteCallbacks)this.muteCallbacks=true;if(time<this.duration)this.completed=false;this.currentTime=time;this.muteCallbacks=false;if(this.paused)this.pause();return this}restart(){this.completed=false;return this.seek(0,true).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){this.forEach("cancel");return this.pause()}revert(){this.cancel();this.targets.forEach((($el,i)=>$el.setAttribute("style",this._inlineStyles[i])));return this}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const waapi={animate:(targets,params)=>new WAAPIAnimation(targets,params),convertEase:easingToLinear};const sync=(callback=noop)=>new Timer({duration:1*globals.timeScale,onComplete:callback},null,0).resume();function getTargetValue(targetSelector,propName,unit){const targets=registerTargets(targetSelector);if(!targets.length)return;const[target]=targets;const tweenType=getTweenType(target,propName);const normalizePropName=sanitizePropertyName(propName,target,tweenType);let originalValue=getOriginalAnimatableValue(target,normalizePropName);if(isUnd(unit)){return originalValue}else{decomposeRawValue(originalValue,decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.NUMBER||decomposedOriginalValue.t===valueTypes.UNIT){if(unit===false){return decomposedOriginalValue.n}else{const convertedValue=convertValueUnit(target,decomposedOriginalValue,unit,false);return`${round(convertedValue.n,globals.precision)}${convertedValue.u}`}}}}const setTargetValues=(targets,parameters)=>{if(isUnd(parameters))return;parameters.duration=minValue;parameters.composition=setValue(parameters.composition,compositionTypes.none);return new JSAnimation(targets,parameters,null,0,true).resume()};const removeTargetsFromAnimation=(targetsArray,animation,propertyName)=>{let tweensMatchesTargets=false;forEachChildren(animation,(tween=>{const tweenTarget=tween.target;if(targetsArray.includes(tweenTarget)){const tweenName=tween.property;const tweenType=tween._tweenType;const normalizePropName=sanitizePropertyName(propertyName,tweenTarget,tweenType);if(!normalizePropName||normalizePropName&&normalizePropName===tweenName){if(tween.parent._tail===tween&&tween._tweenType===tweenTypes.TRANSFORM&&tween._prev&&tween._prev._tweenType===tweenTypes.TRANSFORM){tween._prev._renderTransforms=1}removeChild(animation,tween);removeTweenSliblings(tween);tweensMatchesTargets=true}}}),true);return tweensMatchesTargets};const remove=(targets,renderable,propertyName)=>{const targetsArray=parseTargets(targets);const parent=renderable?renderable:engine;const waapiAnimation=renderable&&renderable.controlAnimation&&renderable;for(let i=0,l=targetsArray.length;i<l;i++){const $el=targetsArray[i];removeWAAPIAnimation($el,propertyName,waapiAnimation)}let removeMatches;if(parent._hasChildren){let iterationDuration=0;forEachChildren(parent,(child=>{if(!child._hasChildren){removeMatches=removeTargetsFromAnimation(targetsArray,child,propertyName);if(removeMatches&&!child._head){child.cancel();removeChild(parent,child)}else{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>iterationDuration){iterationDuration=childDur}}}if(child._head){remove(targets,child,propertyName)}else{child._hasChildren=false}}),true);if(!isUnd(parent.iterationDuration)){parent.iterationDuration=iterationDuration}}else{removeMatches=removeTargetsFromAnimation(targetsArray,parent,propertyName)}if(removeMatches&&!parent._head){parent._hasChildren=false;if(parent.cancel)parent.cancel()}return targetsArray};const random=(min,max,decimalLength)=>{const m=10**(decimalLength||0);return floor((Math.random()*(max-min+1/m)+min)*m)/m};const randomPick=items=>items[random(0,items.length-1)];const shuffle=items=>{let m=items.length,t,i;while(m){i=random(0,--m);t=items[m];items[m]=items[i];items[i]=t}return items};const roundPad=(v,decimalLength)=>(+v).toFixed(decimalLength);const padStart=(v,totalLength,padString)=>`${v}`.padStart(totalLength,padString);const padEnd=(v,totalLength,padString)=>`${v}`.padEnd(totalLength,padString);const wrap=(v,min,max)=>((v-min)%(max-min)+(max-min))%(max-min)+min;const mapRange=(value,inLow,inHigh,outLow,outHigh)=>outLow+(value-inLow)/(inHigh-inLow)*(outHigh-outLow);const degToRad=degrees=>degrees*PI/180;const radToDeg=radians=>radians*180/PI;const lerp=(start,end,amount,renderable)=>{let dt=K/globals.defaults.frameRate;if(renderable!==false){const ticker=renderable||engine._hasChildren&&engine;if(ticker&&ticker.deltaTime){dt=ticker.deltaTime}}const t=1-Math.exp(-amount*dt*.1);return!amount?start:amount===1?end:(1-t)*start+t*end};const curry=(fn,last=0)=>(...args)=>last?v=>fn(...args,v):v=>fn(v,...args);const chain=fn=>(...args)=>{const result=fn(...args);return new Proxy(noop,{apply:(_,__,[v])=>result(v),get:(_,prop)=>chain(((...nextArgs)=>{const nextResult=utils[prop](...nextArgs);return v=>nextResult(result(v))}))})};const makeChainable=(fn,right=0)=>(...args)=>(args.length<fn.length?chain(curry(fn,right)):fn)(...args);const utils={$:registerTargets,get:getTargetValue,set:setTargetValues,remove:remove,cleanInlineStyles:cleanInlineStyles,random:random,randomPick:randomPick,shuffle:shuffle,lerp:lerp,sync:sync,clamp:makeChainable(clamp),round:makeChainable(round),snap:makeChainable(snap),wrap:makeChainable(wrap),interpolate:makeChainable(interpolate,1),mapRange:makeChainable(mapRange),roundPad:makeChainable(roundPad),padStart:makeChainable(padStart),padEnd:makeChainable(padEnd),degToRad:makeChainable(degToRad),radToDeg:makeChainable(radToDeg)};const getPrevChildOffset=(timeline,timePosition)=>{if(stringStartsWith(timePosition,"<")){const goToPrevAnimationOffset=timePosition[1]==="<";const prevAnimation=timeline._tail;const prevOffset=prevAnimation?prevAnimation._offset+prevAnimation._delay:0;return goToPrevAnimationOffset?prevOffset:prevOffset+prevAnimation.duration}};const parseTimelinePosition=(timeline,timePosition)=>{let tlDuration=timeline.iterationDuration;if(tlDuration===minValue)tlDuration=0;if(isUnd(timePosition))return tlDuration;if(isNum(+timePosition))return+timePosition;const timePosStr=timePosition;const tlLabels=timeline?timeline.labels:null;const hasLabels=!isNil(tlLabels);const prevOffset=getPrevChildOffset(timeline,timePosStr);const hasSibling=!isUnd(prevOffset);const matchedRelativeOperator=relativeValuesExecRgx.exec(timePosStr);if(matchedRelativeOperator){const fullOperator=matchedRelativeOperator[0];const split=timePosStr.split(fullOperator);const labelOffset=hasLabels&&split[0]?tlLabels[split[0]]:tlDuration;const parsedOffset=hasSibling?prevOffset:hasLabels?labelOffset:tlDuration;const parsedNumericalOffset=+split[1];return getRelativeValue(parsedOffset,parsedNumericalOffset,fullOperator[0])}else{return hasSibling?prevOffset:hasLabels?!isUnd(tlLabels[timePosStr])?tlLabels[timePosStr]:tlDuration:tlDuration}};function getTimelineTotalDuration(tl){return clampInfinity((tl.iterationDuration+tl._loopDelay)*tl.iterationCount-tl._loopDelay)||minValue}function addTlChild(childParams,tl,timePosition,targets,index,length){const isSetter=isNum(childParams.duration)&&childParams.duration<=minValue;const adjustedPosition=isSetter?timePosition-minValue:timePosition;tick(tl,adjustedPosition,1,1,tickModes.AUTO);const tlChild=targets?new JSAnimation(targets,childParams,tl,adjustedPosition,false,index,length):new Timer(childParams,tl,adjustedPosition);tlChild.init(1);addChild(tl,tlChild);forEachChildren(tl,(child=>{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>tl.iterationDuration)tl.iterationDuration=childDur}));tl.duration=getTimelineTotalDuration(tl);return tl}class Timeline extends Timer{constructor(parameters={}){super(parameters,null,0);this.duration=0;this.labels={};const defaultsParams=parameters.defaults;const globalDefaults=globals.defaults;this.defaults=defaultsParams?mergeObjects(defaultsParams,globalDefaults):globalDefaults;this.onRender=parameters.onRender||globalDefaults.onRender;const tlPlaybackEase=setValue(parameters.playbackEase,globalDefaults.playbackEase);this._ease=tlPlaybackEase?parseEasings(tlPlaybackEase):null;this.iterationDuration=0}add(a1,a2,a3){const isAnim=isObj(a2);const isTimer=isObj(a1);if(isAnim||isTimer){this._hasChildren=true;if(isAnim){const childParams=a2;if(isFnc(a3)){const staggeredPosition=a3;const parsedTargetsArray=parseTargets(a1);const tlDuration=this.duration;const tlIterationDuration=this.iterationDuration;const id=childParams.id;let i=0;const parsedLength=parsedTargetsArray.length;parsedTargetsArray.forEach((target=>{const staggeredChildParams={...childParams};this.duration=tlDuration;this.iterationDuration=tlIterationDuration;if(!isUnd(id))staggeredChildParams.id=id+"-"+i;addTlChild(staggeredChildParams,this,staggeredPosition(target,i,parsedLength,this),target,i,parsedLength);i++}))}else{addTlChild(childParams,this,parseTimelinePosition(this,a3),a1)}}else{addTlChild(a1,this,parseTimelinePosition(this,a2))}return this.init(1)}}sync(synced,position){if(isUnd(synced)||synced&&isUnd(synced.pause))return this;synced.pause();const duration=+(synced.effect?synced.effect.getTiming().duration:synced.duration);return this.add(synced,{currentTime:[0,duration],duration:duration,ease:"linear"},position)}set(targets,parameters,position){if(isUnd(parameters))return this;parameters.duration=minValue;parameters.composition=compositionTypes.replace;return this.add(targets,parameters,position)}call(callback,position){if(isUnd(callback)||callback&&!isFnc(callback))return this;return this.add({duration:0,onComplete:()=>callback(this)},position)}label(labelName,position){if(isUnd(labelName)||labelName&&!isStr(labelName))return this;this.labels[labelName]=parseTimelinePosition(this,position);return this}remove(targets,propertyName){remove(targets,this,propertyName);return this}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;const labels=this.labels;forEachChildren(this,(child=>child.stretch(child.duration*timeScale)));for(let labelName in labels)labels[labelName]*=timeScale;return super.stretch(newDuration)}refresh(){forEachChildren(this,(child=>{if(child.refresh)child.refresh()}));return this}revert(){super.revert();forEachChildren(this,(child=>child.revert),true);return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const createTimeline=parameters=>new Timeline(parameters).init();class Animatable{constructor(targets,parameters){if(globals.scope)globals.scope.revertibles.push(this);const globalParams={};const properties={};this.targets=[];this.animations={};if(isUnd(targets)||isUnd(parameters))return;for(let propName in parameters){const paramValue=parameters[propName];if(isKey(propName)){properties[propName]=paramValue}else{globalParams[propName]=paramValue}}for(let propName in properties){const propValue=properties[propName];const isObjValue=isObj(propValue);let propParams={};let to="+=0";if(isObjValue){const unit=propValue.unit;if(isStr(unit))to+=unit}else{propParams.duration=propValue}propParams[propName]=isObjValue?mergeObjects({to:to},propValue):to;const animParams=mergeObjects(globalParams,propParams);animParams.composition=compositionTypes.replace;animParams.autoplay=false;const animation=this.animations[propName]=new JSAnimation(targets,animParams,null,0,false).init();if(!this.targets.length)this.targets.push(...animation.targets);this[propName]=(to,duration,ease)=>{const tween=animation._head;if(isUnd(to)&&tween){const numbers=tween._numbers;if(numbers&&numbers.length){return numbers}else{return tween._modifier(tween._number)}}else{forEachChildren(animation,(tween=>{if(isArr(to)){for(let i=0,l=to.length;i<l;i++){if(!isUnd(tween._numbers[i])){tween._fromNumbers[i]=tween._modifier(tween._numbers[i]);tween._toNumbers[i]=to[i]}}}else{tween._fromNumber=tween._modifier(tween._number);tween._toNumber=to}if(!isUnd(ease))tween._ease=parseEasings(ease);tween._currentTime=0}));if(!isUnd(duration))animation.stretch(duration);animation.reset(1).resume();return this}}}}revert(){for(let propName in this.animations){this[propName]=noop;this.animations[propName].revert()}this.animations={};this.targets.length=0;return this}}const createAnimatable=(targets,parameters)=>new Animatable(targets,parameters);class Spring{constructor(parameters={}){this.timeStep=.02;this.restThreshold=5e-4;this.restDuration=200;this.maxDuration=6e4;this.maxRestSteps=this.restDuration/this.timeStep/K;this.maxIterations=this.maxDuration/this.timeStep/K;this.m=clamp(setValue(parameters.mass,1),0,K);this.s=clamp(setValue(parameters.stiffness,100),1,K);this.d=clamp(setValue(parameters.damping,10),.1,K);this.v=clamp(setValue(parameters.velocity,0),-1e3,K);this.w0=0;this.zeta=0;this.wd=0;this.b=0;this.solverDuration=0;this.duration=0;this.compute();this.ease=t=>t===0||t===1?t:this.solve(t*this.solverDuration)}solve(time){const{zeta:zeta,w0:w0,wd:wd,b:b}=this;let t=time;if(zeta<1){t=exp(-t*zeta*w0)*(1*cos(wd*t)+b*sin(wd*t))}else{t=(1+b*t)*exp(-t*w0)}return 1-t}compute(){const{maxRestSteps:maxRestSteps,maxIterations:maxIterations,restThreshold:restThreshold,timeStep:timeStep,m:m,d:d,s:s,v:v}=this;const w0=this.w0=clamp(sqrt(s/m),minValue,K);const zeta=this.zeta=d/(2*sqrt(s*m));const wd=this.wd=zeta<1?w0*sqrt(1-zeta*zeta):0;this.b=zeta<1?(zeta*w0+-v)/wd:-v+w0;let solverTime=0;let restSteps=0;let iterations=0;while(restSteps<maxRestSteps&&iterations<maxIterations){if(abs(1-this.solve(solverTime))<restThreshold){restSteps++}else{restSteps=0}this.solverDuration=solverTime;solverTime+=timeStep;iterations++}this.duration=round(this.solverDuration*K,0)*globals.timeScale}get mass(){return this.m}set mass(v){this.m=clamp(setValue(v,1),0,K);this.compute()}get stiffness(){return this.s}set stiffness(v){this.s=clamp(setValue(v,100),1,K);this.compute()}get damping(){return this.d}set damping(v){this.d=clamp(setValue(v,10),.1,K);this.compute()}get velocity(){return this.v}set velocity(v){this.v=clamp(setValue(v,0),-1e3,K);this.compute()}}const createSpring=parameters=>new Spring(parameters);const preventDefault=e=>{if(e.cancelable)e.preventDefault()};class DOMProxy{constructor(el){this.el=el;this.zIndex=0;this.parentElement=null;this.classList={add:noop,remove:noop}}get x(){return this.el.x||0}set x(v){this.el.x=v}get y(){return this.el.y||0}set y(v){this.el.y=v}get width(){return this.el.width||0}set width(v){this.el.width=v}get height(){return this.el.height||0}set height(v){this.el.height=v}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Transforms{constructor($el){this.$el=$el;this.inlineTransforms=[];this.point=new DOMPoint;this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(x,y){this.point.x=x;this.point.y=y;return this.point.matrixTransform(this.inversedMatrix)}traverseUp(cb){let $el=this.$el.parentElement,i=0;while($el&&$el!==doc){cb($el,i);$el=$el.parentElement;i++}}getMatrix(){const matrix=new DOMMatrix;this.traverseUp(($el=>{const transformValue=getComputedStyle($el).transform;if(transformValue){const elMatrix=new DOMMatrix(transformValue);matrix.preMultiplySelf(elMatrix)}}));return matrix}remove(){this.traverseUp((($el,i)=>{this.inlineTransforms[i]=$el.style.transform;$el.style.transform="none"}))}revert(){this.traverseUp((($el,i)=>{const ct=this.inlineTransforms[i];if(ct===""){$el.style.removeProperty("transform")}else{$el.style.transform=ct}}))}}const parseDraggableFunctionParameter=(value,draggable)=>value&&isFnc(value)?value(draggable):value;let zIndex=0;class Draggable{constructor(target,parameters={}){if(!target)return;if(globals.scope)globals.scope.revertibles.push(this);const paramX=parameters.x;const paramY=parameters.y;const trigger=parameters.trigger;const modifier=parameters.modifier;const ease=parameters.releaseEase;const customEase=ease&&parseEasings(ease);const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const xProp=isObj(paramX)&&!isUnd(paramX.mapTo)?paramX.mapTo:"translateX";const yProp=isObj(paramY)&&!isUnd(paramY.mapTo)?paramY.mapTo:"translateY";const container=parseDraggableFunctionParameter(parameters.container,this);this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.$target=isObj(target)?new DOMProxy(target):parseTargets(target)[0];this.$trigger=parseTargets(trigger?trigger:target)[0];this.fixed=getTargetValue(this.$target,"position")==="fixed";this.isFinePointer=true;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.maxVelocity=0;this.minVelocity=0;this.velocityMultiplier=0;this.cursor=false;this.releaseXSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseYSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseEase=customEase||eases.outQuint;this.hasReleaseSpring=hasSpring;this.onGrab=parameters.onGrab||noop;this.onDrag=parameters.onDrag||noop;this.onRelease=parameters.onRelease||noop;this.onUpdate=parameters.onUpdate||noop;this.onSettle=parameters.onSettle||noop;this.onSnap=parameters.onSnap||noop;this.onResize=parameters.onResize||noop;this.onAfterResize=parameters.onAfterResize||noop;this.disabled=[0,0];const animatableParams={};if(modifier)animatableParams.modifier=modifier;if(isUnd(paramX)||paramX===true){animatableParams[xProp]=0}else if(isObj(paramX)){const paramXObject=paramX;const animatableXParams={};if(paramXObject.modifier)animatableXParams.modifier=paramXObject.modifier;if(paramXObject.composition)animatableXParams.composition=paramXObject.composition;animatableParams[xProp]=animatableXParams}else if(paramX===false){animatableParams[xProp]=0;this.disabled[0]=1}if(isUnd(paramY)||paramY===true){animatableParams[yProp]=0}else if(isObj(paramY)){const paramYObject=paramY;const animatableYParams={};if(paramYObject.modifier)animatableYParams.modifier=paramYObject.modifier;if(paramYObject.composition)animatableYParams.composition=paramYObject.composition;animatableParams[yProp]=animatableYParams}else if(paramY===false){animatableParams[yProp]=0;this.disabled[1]=1}this.animate=new Animatable(this.$target,animatableParams);this.xProp=xProp;this.yProp=yProp;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=[-1e12,maxValue,maxValue,-1e12];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=now();this.velocity=0;this.angle=0;this.cursorStyles=null;this.triggerStyles=null;this.bodyStyles=null;this.targetStyles=null;this.touchActionStyles=null;this.transforms=new Transforms(this.$target);this.overshootCoords={x:0,y:0};this.overshootXTicker=new Timer({autoplay:false},null,0).init();this.overshootYTicker=new Timer({autoplay:false},null,0).init();this.updateTicker=new Timer({autoplay:false},null,0).init();this.overshootXTicker.onUpdate=()=>{if(this.disabled[0])return;this.updated=true;this.manual=true;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootXTicker.onComplete=()=>{if(this.disabled[0])return;this.manual=false;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootYTicker.onUpdate=()=>{if(this.disabled[1])return;this.updated=true;this.manual=true;this.animate[this.yProp](this.overshootCoords.y,0)};this.overshootYTicker.onComplete=()=>{if(this.disabled[1])return;this.manual=false;this.animate[this.yProp](this.overshootCoords.y,0)};this.updateTicker.onUpdate=()=>this.update();this.contained=!isUnd(container);this.manual=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.enabled=false;this.initialized=false;this.activeProp=this.disabled[1]?xProp:yProp;this.animate.animations[this.activeProp].onRender=()=>{const hasUpdated=this.updated;const hasMoved=this.grabbed&&hasUpdated;const hasReleased=!hasMoved&&this.released;const x=this.x;const y=this.y;const dx=x-this.coords[2];const dy=y-this.coords[3];this.deltaX=dx;this.deltaY=dy;this.coords[2]=x;this.coords[3]=y;if(hasUpdated){this.onUpdate(this)}if(!hasReleased){this.updated=false}else{this.computeVelocity(dx,dy);this.angle=atan2(dy,dx)}};this.animate.animations[this.activeProp].onComplete=()=>{if(!this.grabbed&&this.released){this.released=false}if(!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 Timer({autoplay:false,duration:150*globals.timeScale,onComplete:()=>{this.onResize(this);this.refresh();this.onAfterResize(this)}}).init();this.parameters=parameters;this.resizeObserver=new ResizeObserver((()=>{if(this.initialized){this.resizeTicker.restart()}else{this.initialized=true}}));this.enable();this.refresh();this.resizeObserver.observe(this.$container);if(!isObj(target))this.resizeObserver.observe(this.$target)}computeVelocity(dx,dy){const prevTime=this.velocityTime;const curTime=now();const elapsed=curTime-prevTime;if(elapsed<17)return this.velocity;this.velocityTime=curTime;const velocityStack=this.velocityStack;const vMul=this.velocityMultiplier;const minV=this.minVelocity;const maxV=this.maxVelocity;const vi=this.velocityStackIndex;velocityStack[vi]=round(clamp(sqrt(dx*dx+dy*dy)/elapsed*vMul,minV,maxV),5);const velocity=max(velocityStack[0],velocityStack[1],velocityStack[2]);this.velocity=velocity;this.velocityStackIndex=(vi+1)%3;return velocity}setX(x,muteUpdateCallback=false){if(this.disabled[0])return;const v=round(x,5);this.overshootXTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destX=v;this.snapped[0]=snap(v,this.snapX);this.animate[this.xProp](v,0);this.manual=false;return this}setY(y,muteUpdateCallback=false){if(this.disabled[1])return;const v=round(y,5);this.overshootYTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destY=v;this.snapped[1]=snap(v,this.snapY);this.animate[this.yProp](v,0);this.manual=false;return this}get x(){return round(this.animate[this.xProp](),globals.precision)}set x(x){this.setX(x,false)}get y(){return round(this.animate[this.yProp](),globals.precision)}set y(y){this.setY(y,false)}get progressX(){return mapRange(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(x){this.setX(mapRange(x,0,1,this.containerBounds[3],this.containerBounds[1]),false)}get progressY(){return mapRange(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(y){this.setY(mapRange(y,0,1,this.containerBounds[0],this.containerBounds[2]),false)}updateScrollCoords(){const sx=round(this.useWin?win.scrollX:this.$container.scrollLeft,0);const sy=round(this.useWin?win.scrollY:this.$container.scrollTop,0);const[cpt,cpr,cpb,cpl]=this.containerPadding;const threshold=this.scrollThreshold;this.scroll.x=sx;this.scroll.y=sy;this.scrollBounds[0]=sy-this.targetBounds[0]+cpt-threshold;this.scrollBounds[1]=sx-this.targetBounds[1]-cpr+threshold;this.scrollBounds[2]=sy-this.targetBounds[2]-cpb+threshold;this.scrollBounds[3]=sx-this.targetBounds[3]+cpl-threshold}updateBoundingValues(){const $container=this.$container;const cx=this.x;const cy=this.y;const cx2=this.coords[2];const cy2=this.coords[3];this.coords[2]=0;this.coords[3]=0;this.setX(0,true);this.setY(0,true);this.transforms.remove();const iw=this.window[0]=win.innerWidth;const ih=this.window[1]=win.innerHeight;const uw=this.useWin;const sw=$container.scrollWidth;const sh=$container.scrollHeight;const fx=this.fixed;const transformContainerRect=$container.getBoundingClientRect();const[cpt,cpr,cpb,cpl]=this.containerPadding;this.dragArea[0]=uw?0:transformContainerRect.left;this.dragArea[1]=uw?0:transformContainerRect.top;this.scrollView[0]=uw?clamp(sw,iw,sw):sw;this.scrollView[1]=uw?clamp(sh,ih,sh):sh;this.updateScrollCoords();const{width:width,height:height,left:left,top:top,right:right,bottom:bottom}=$container.getBoundingClientRect();this.dragArea[2]=round(uw?clamp(width,iw,iw):width,0);this.dragArea[3]=round(uw?clamp(height,ih,ih):height,0);const containerOverflow=getTargetValue($container,"overflow");const visibleOverflow=containerOverflow==="visible";const hiddenOverflow=containerOverflow==="hidden";this.canScroll=fx?false:this.contained&&($container===doc.body&&visibleOverflow||!hiddenOverflow&&!visibleOverflow)&&(sw>this.dragArea[2]+cpl-cpr||sh>this.dragArea[3]+cpt-cpb)&&(!this.containerArray||this.containerArray&&!isArr(this.containerArray));if(this.contained){const sx=this.scroll.x;const sy=this.scroll.y;const canScroll=this.canScroll;const targetRect=this.$target.getBoundingClientRect();const hiddenLeft=canScroll?uw?0:$container.scrollLeft:0;const hiddenTop=canScroll?uw?0:$container.scrollTop:0;const hiddenRight=canScroll?this.scrollView[0]-hiddenLeft-width:0;const hiddenBottom=canScroll?this.scrollView[1]-hiddenTop-height:0;this.targetBounds[0]=round(targetRect.top+sy-(uw?0:top),0);this.targetBounds[1]=round(targetRect.right+sx-(uw?iw:right),0);this.targetBounds[2]=round(targetRect.bottom+sy-(uw?ih:bottom),0);this.targetBounds[3]=round(targetRect.left+sx-(uw?0:left),0);if(this.containerArray){this.containerBounds[0]=this.containerArray[0]+cpt;this.containerBounds[1]=this.containerArray[1]-cpr;this.containerBounds[2]=this.containerArray[2]-cpb;this.containerBounds[3]=this.containerArray[3]+cpl}else{this.containerBounds[0]=-round(targetRect.top-(fx?clamp(top,0,ih):top)+hiddenTop-cpt,0);this.containerBounds[1]=-round(targetRect.right-(fx?clamp(right,0,iw):right)-hiddenRight+cpr,0);this.containerBounds[2]=-round(targetRect.bottom-(fx?clamp(bottom,0,ih):bottom)-hiddenBottom+cpb,0);this.containerBounds[3]=-round(targetRect.left-(fx?clamp(left,0,iw):left)+hiddenLeft-cpl,0)}}this.transforms.revert();this.coords[2]=cx2;this.coords[3]=cy2;this.setX(cx,true);this.setY(cy,true)}isOutOfBounds(bounds,x,y){if(!this.contained)return 0;const[bt,br,bb,bl]=bounds;const[dx,dy]=this.disabled;const obx=!dx&&x<bl||!dx&&x>br;const oby=!dy&&y<bt||!dy&&y>bb;return obx&&!oby?1:!obx&&oby?2:obx&&oby?3:0}refresh(){const params=this.parameters;const paramX=params.x;const paramY=params.y;const container=parseDraggableFunctionParameter(params.container,this);const cp=parseDraggableFunctionParameter(params.containerPadding,this)||0;const containerPadding=isArr(cp)?cp:[cp,cp,cp,cp];const cx=this.x;const cy=this.y;const parsedCursorStyles=parseDraggableFunctionParameter(params.cursor,this);const cursorStyles={onHover:"grab",onGrab:"grabbing"};if(parsedCursorStyles){const{onHover:onHover,onGrab:onGrab}=parsedCursorStyles;if(onHover)cursorStyles.onHover=onHover;if(onGrab)cursorStyles.onGrab=onGrab}this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.isFinePointer=matchMedia("(pointer:fine)").matches;this.containerPadding=setValue(containerPadding,[0,0,0,0]);this.containerFriction=clamp(setValue(parseDraggableFunctionParameter(params.containerFriction,this),.8),0,1);this.releaseContainerFriction=clamp(setValue(parseDraggableFunctionParameter(params.releaseContainerFriction,this),this.containerFriction),0,1);this.snapX=parseDraggableFunctionParameter(isObj(paramX)&&!isUnd(paramX.snap)?paramX.snap:params.snap,this);this.snapY=parseDraggableFunctionParameter(isObj(paramY)&&!isUnd(paramY.snap)?paramY.snap:params.snap,this);this.scrollSpeed=setValue(parseDraggableFunctionParameter(params.scrollSpeed,this),1.5);this.scrollThreshold=setValue(parseDraggableFunctionParameter(params.scrollThreshold,this),20);this.dragSpeed=setValue(parseDraggableFunctionParameter(params.dragSpeed,this),1);this.minVelocity=setValue(parseDraggableFunctionParameter(params.minVelocity,this),0);this.maxVelocity=setValue(parseDraggableFunctionParameter(params.maxVelocity,this),50);this.velocityMultiplier=setValue(parseDraggableFunctionParameter(params.velocityMultiplier,this),1);this.cursor=parsedCursorStyles===false?false:cursorStyles;this.updateBoundingValues();const[bt,br,bb,bl]=this.containerBounds;this.setX(clamp(cx,bl,br),true);this.setY(clamp(cy,bt,bb),true)}update(){this.updateScrollCoords();if(this.canScroll){const[cpt,cpr,cpb,cpl]=this.containerPadding;const[sw,sh]=this.scrollView;const daw=this.dragArea[2];const dah=this.dragArea[3];const csx=this.scroll.x;const csy=this.scroll.y;const nsw=this.$container.scrollWidth;const nsh=this.$container.scrollHeight;const csw=this.useWin?clamp(nsw,this.window[0],nsw):nsw;const csh=this.useWin?clamp(nsh,this.window[1],nsh):nsh;const swd=sw-csw;const shd=sh-csh;if(this.dragged&&swd>0){this.coords[0]-=swd;this.scrollView[0]=csw}if(this.dragged&&shd>0){this.coords[1]-=shd;this.scrollView[1]=csh}const s=this.scrollSpeed*10;const threshold=this.scrollThreshold;const[x,y]=this.coords;const[st,sr,sb,sl]=this.scrollBounds;const t=round(clamp((y-st+cpt)/threshold,-1,0)*s,0);const r=round(clamp((x-sr-cpr)/threshold,0,1)*s,0);const b=round(clamp((y-sb-cpb)/threshold,0,1)*s,0);const l=round(clamp((x-sl+cpl)/threshold,-1,0)*s,0);if(t||b||l||r){const[nx,ny]=this.disabled;let scrollX=csx;let scrollY=csy;if(!nx){scrollX=round(clamp(csx+(l||r),0,sw-daw),0);this.coords[0]-=csx-scrollX}if(!ny){scrollY=round(clamp(csy+(t||b),0,sh-dah),0);this.coords[1]-=csy-scrollY}if(this.useWin){this.$scrollContainer.scrollBy(-(csx-scrollX),-(csy-scrollY))}else{this.$scrollContainer.scrollTo(scrollX,scrollY)}}}const[ct,cr,cb,cl]=this.containerBounds;const[px1,py1,px2,py2,px3,py3]=this.pointer;this.coords[0]+=(px1-px3)*this.dragSpeed;this.coords[1]+=(py1-py3)*this.dragSpeed;this.pointer[4]=px1;this.pointer[5]=py1;const[cx,cy]=this.coords;const[sx,sy]=this.snapped;const cf=(1-this.containerFriction)*this.dragSpeed;this.setX(cx>cr?cr+(cx-cr)*cf:cx<cl?cl+(cx-cl)*cf:cx,false);this.setY(cy>cb?cb+(cy-cb)*cf:cy<ct?ct+(cy-ct)*cf:cy,false);this.computeVelocity(px1-px3,py1-py3);this.angle=atan2(py1-py2,px1-px2);const[nsx,nsy]=this.snapped;if(nsx!==sx&&this.snapX||nsy!==sy&&this.snapY){this.onSnap(this)}}stop(){this.updateTicker.pause();this.overshootXTicker.pause();this.overshootYTicker.pause();for(let prop in this.animate.animations)this.animate.animations[prop].pause();remove(this,null,"x");remove(this,null,"y");remove(this,null,"progressX");remove(this,null,"progressY");remove(this.scroll);remove(this.overshootCoords);return this}scrollInView(duration,gap=0,ease=eases.inOutQuad){this.updateScrollCoords();const x=this.destX;const y=this.destY;const scroll=this.scroll;const scrollBounds=this.scrollBounds;const canScroll=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(scrollBounds,x,y)){const[st,sr,sb,sl]=scrollBounds;const t=round(clamp(y-st,-1e12,0),0);const r=round(clamp(x-sr,0,maxValue),0);const b=round(clamp(y-sb,0,maxValue),0);const l=round(clamp(x-sl,-1e12,0),0);new JSAnimation(scroll,{x:round(scroll.x+(l?l-gap:r?r+gap:0),0),y:round(scroll.y+(t?t-gap:b?b+gap:0),0),duration:isUnd(duration)?350*globals.timeScale:duration,ease:ease,onUpdate:()=>{this.canScroll=false;this.$scrollContainer.scrollTo(scroll.x,scroll.y)}}).init().then((()=>{this.canScroll=canScroll}))}return this}handleHover(){if(this.isFinePointer&&this.cursor&&!this.cursorStyles){this.cursorStyles=setTargetValues(this.$trigger,{cursor:this.cursor.onHover})}}animateInView(duration,gap=0,ease=eases.inOutQuad){this.stop();this.updateBoundingValues();const x=this.x;const y=this.y;const[cpt,cpr,cpb,cpl]=this.containerPadding;const bt=this.scroll.y-this.targetBounds[0]+cpt+gap;const br=this.scroll.x-this.targetBounds[1]-cpr-gap;const bb=this.scroll.y-this.targetBounds[2]-cpb-gap;const bl=this.scroll.x-this.targetBounds[3]+cpl+gap;const ob=this.isOutOfBounds([bt,br,bb,bl],x,y);if(ob){const[disabledX,disabledY]=this.disabled;const destX=clamp(snap(x,this.snapX),bl,br);const destY=clamp(snap(y,this.snapY),bt,bb);const dur=isUnd(duration)?350*globals.timeScale:duration;if(!disabledX&&(ob===1||ob===3))this.animate[this.xProp](destX,dur,ease);if(!disabledY&&(ob===2||ob===3))this.animate[this.yProp](destY,dur,ease)}return this}handleDown(e){const $eTarget=e.target;if(this.grabbed||$eTarget.type==="range")return;e.stopPropagation();this.grabbed=true;this.released=false;this.stop();this.updateBoundingValues();const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const[ct,cr,cb,cl]=this.containerBounds;const cf=(1-this.containerFriction)*this.dragSpeed;const cx=this.x;const cy=this.y;this.coords[0]=this.coords[2]=!cf?cx:cx>cr?cr+(cx-cr)/cf:cx<cl?cl+(cx-cl)/cf:cx;this.coords[1]=this.coords[3]=!cf?cy:cy>cb?cb+(cy-cb)/cf:cy<ct?ct+(cy-ct)/cf:cy;this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y;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;if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}const z=getTargetValue(this.$target,"zIndex",false);zIndex=(z>zIndex?z:zIndex)+1;this.targetStyles=setTargetValues(this.$target,{zIndex:zIndex});if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.isFinePointer&&this.cursor){this.bodyStyles=setTargetValues(doc.body,{cursor:this.cursor.onGrab})}this.scrollInView(100,0,eases.out(3));this.onGrab(this);doc.addEventListener("touchmove",this);doc.addEventListener("touchend",this);doc.addEventListener("touchcancel",this);doc.addEventListener("mousemove",this);doc.addEventListener("mouseup",this);doc.addEventListener("selectstart",this)}handleMove(e){if(!this.grabbed)return;const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const movedX=x-this.pointer[6];const movedY=y-this.pointer[7];let $parent=e.target;let isAtTop=false;let isAtBottom=false;let canTouchScroll=false;while(touches&&$parent&&$parent!==this.$trigger){const overflowY=getTargetValue($parent,"overflow-y");if(overflowY!=="hidden"&&overflowY!=="visible"){const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=$parent;if(scrollHeight>clientHeight){canTouchScroll=true;isAtTop=scrollTop<=3;isAtBottom=scrollTop>=scrollHeight-clientHeight-3;break}}$parent=$parent.parentNode}if(canTouchScroll&&(!isAtTop&&!isAtBottom||isAtTop&&movedY<0||isAtBottom&&movedY>0)){this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y}else{preventDefault(e);if(!this.triggerStyles)this.triggerStyles=setTargetValues(this.$trigger,{pointerEvents:"none"});this.$trigger.addEventListener("touchstart",preventDefault,{passive:false});this.$trigger.addEventListener("touchmove",preventDefault,{passive:false});this.$trigger.addEventListener("touchend",preventDefault);if(!this.disabled[0]&&abs(movedX)>3||!this.disabled[1]&&abs(movedY)>3){this.updateTicker.resume();this.pointer[2]=this.pointer[0];this.pointer[3]=this.pointer[1];this.pointer[0]=x;this.pointer[1]=y;this.dragged=true;this.released=false;this.onDrag(this)}}}handleUp(){if(!this.grabbed)return;this.updateTicker.pause();if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}const[disabledX,disabledY]=this.disabled;const[px1,py1,px2,py2,px3,py3]=this.pointer;const[ct,cr,cb,cl]=this.containerBounds;const[sx,sy]=this.snapped;const springX=this.releaseXSpring;const springY=this.releaseYSpring;const releaseEase=this.releaseEase;const hasReleaseSpring=this.hasReleaseSpring;const overshootCoords=this.overshootCoords;const cx=this.x;const cy=this.y;const pv=this.computeVelocity(px1-px3,py1-py3);const pa=this.angle=atan2(py1-py2,px1-px2);const ds=pv*150;const cf=(1-this.releaseContainerFriction)*this.dragSpeed;const nx=cx+cos(pa)*ds;const ny=cy+sin(pa)*ds;const bx=nx>cr?cr+(nx-cr)*cf:nx<cl?cl+(nx-cl)*cf:nx;const by=ny>cb?cb+(ny-cb)*cf:ny<ct?ct+(ny-ct)*cf:ny;const dx=this.destX=clamp(round(snap(bx,this.snapX),5),cl,cr);const dy=this.destY=clamp(round(snap(by,this.snapY),5),ct,cb);const ob=this.isOutOfBounds(this.containerBounds,nx,ny);let durationX=0;let durationY=0;let easeX=releaseEase;let easeY=releaseEase;let longestReleaseDuration=0;overshootCoords.x=cx;overshootCoords.y=cy;if(!disabledX){const directionX=dx===cr?cx>cr?-1:1:cx<cl?-1:1;const distanceX=round(cx-dx,0);springX.velocity=disabledY&&hasReleaseSpring?distanceX?ds*directionX/abs(distanceX):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springX;durationX=cx===dx?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeX=ease;if(durationX>longestReleaseDuration)longestReleaseDuration=durationX}if(!disabledY){const directionY=dy===cb?cy>cb?-1:1:cy<ct?-1:1;const distanceY=round(cy-dy,0);springY.velocity=disabledX&&hasReleaseSpring?distanceY?ds*directionY/abs(distanceY):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springY;durationY=cy===dy?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeY=ease;if(durationY>longestReleaseDuration)longestReleaseDuration=durationY}if(!hasReleaseSpring&&ob&&cf&&(durationX||durationY)){const composition=compositionTypes.blend;new JSAnimation(overshootCoords,{x:{to:bx,duration:durationX*.65},y:{to:by,duration:durationY*.65},ease:releaseEase,composition:composition}).init();new JSAnimation(overshootCoords,{x:{to:dx,duration:durationX},y:{to:dy,duration:durationY},ease:releaseEase,composition:composition}).init();this.overshootXTicker.stretch(durationX).restart();this.overshootYTicker.stretch(durationY).restart()}else{if(!disabledX)this.animate[this.xProp](dx,durationX,easeX);if(!disabledY)this.animate[this.yProp](dy,durationY,easeY)}this.scrollInView(longestReleaseDuration,this.scrollThreshold,releaseEase);let hasSnapped=false;if(dx!==sx){this.snapped[0]=dx;if(this.snapX)hasSnapped=true}if(dy!==sy&&this.snapY){this.snapped[1]=dy;if(this.snapY)hasSnapped=true}if(hasSnapped)this.onSnap(this);this.grabbed=false;this.dragged=false;this.updated=true;this.released=true;this.onRelease(this);this.$trigger.removeEventListener("touchstart",preventDefault);this.$trigger.removeEventListener("touchmove",preventDefault);this.$trigger.removeEventListener("touchend",preventDefault);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this)}reset(){this.stop();this.resizeTicker.pause();this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.setX(0,true);this.setY(0,true);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;return this}enable(){if(!this.enabled){this.enabled=true;this.$target.classList.remove("is-disabled");this.touchActionStyles=setTargetValues(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"});this.$trigger.addEventListener("touchstart",this,{passive:true});this.$trigger.addEventListener("mousedown",this,{passive:true});this.$trigger.addEventListener("mouseenter",this)}return this}disable(){this.enabled=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.touchActionStyles.revert();if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}this.stop();this.$target.classList.add("is-disabled");this.$trigger.removeEventListener("touchstart",this);this.$trigger.removeEventListener("mousedown",this);this.$trigger.removeEventListener("mouseenter",this);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this);return this}revert(){this.reset();this.disable();this.$target.classList.remove("is-disabled");this.updateTicker.revert();this.overshootXTicker.revert();this.overshootYTicker.revert();this.resizeTicker.revert();this.animate.revert();return this}handleEvent(e){switch(e.type){case"mousedown":this.handleDown(e);break;case"touchstart":this.handleDown(e);break;case"mousemove":this.handleMove(e);break;case"touchmove":this.handleMove(e);break;case"mouseup":this.handleUp();break;case"touchend":this.handleUp();break;case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":preventDefault(e);break}}}const createDraggable=(target,parameters)=>new Draggable(target,parameters);class Scope{constructor(parameters={}){if(globals.scope)globals.scope.revertibles.push(this);const rootParam=parameters.root;let root=doc;if(rootParam){root=rootParam.current||rootParam.nativeElement||parseTargets(rootParam)[0]||doc}const scopeDefaults=parameters.defaults;const globalDefault=globals.defaults;const mediaQueries=parameters.mediaQueries;this.defaults=scopeDefaults?mergeObjects(scopeDefaults,globalDefault):globalDefault;this.root=root;this.constructors=[];this.revertConstructors=[];this.revertibles=[];this.methods={};this.matches={};this.mediaQueryLists={};this.data={};if(mediaQueries){for(let mq in mediaQueries){const _mq=win.matchMedia(mediaQueries[mq]);this.mediaQueryLists[mq]=_mq;_mq.addEventListener("change",this)}}}execute(cb){let activeScope=globals.scope;let activeRoot=globals.root;let activeDefaults=globals.defaults;globals.scope=this;globals.root=this.root;globals.defaults=this.defaults;const mqs=this.mediaQueryLists;for(let mq in mqs)this.matches[mq]=mqs[mq].matches;const returned=cb(this);globals.scope=activeScope;globals.root=activeRoot;globals.defaults=activeDefaults;return returned}refresh(){this.execute((()=>{let i=this.revertibles.length;let y=this.revertConstructors.length;while(i--)this.revertibles[i].revert();while(y--)this.revertConstructors[y](this);this.revertibles.length=0;this.revertConstructors.length=0;this.constructors.forEach((constructor=>{const revertConstructor=constructor(this);if(revertConstructor){this.revertConstructors.push(revertConstructor)}}))}));return this}add(a1,a2){if(isFnc(a1)){const constructor=a1;this.constructors.push(constructor);this.execute((()=>{const revertConstructor=constructor(this);if(revertConstructor){this.revertConstructors.push(revertConstructor)}}))}else{this.methods[a1]=(...args)=>this.execute((()=>a2(...args)))}return this}handleEvent(e){switch(e.type){case"change":this.refresh();break}}revert(){const revertibles=this.revertibles;const revertConstructors=this.revertConstructors;const mqs=this.mediaQueryLists;let i=revertibles.length;let y=revertConstructors.length;while(i--)revertibles[i].revert();while(y--)revertConstructors[y](this);for(let mq in mqs)mqs[mq].removeEventListener("change",this);revertibles.length=0;revertConstructors.length=0;this.constructors.length=0;this.matches={};this.methods={};this.mediaQueryLists={};this.data={}}}const createScope=params=>new Scope(params);const getMaxViewHeight=()=>{const $el=document.createElement("div");doc.body.appendChild($el);$el.style.height="100lvh";const height=$el.offsetHeight;doc.body.removeChild($el);return height};const parseScrollObserverFunctionParameter=(value,scroller)=>value&&isFnc(value)?value(scroller):value;const scrollContainers=new Map;class ScrollContainer{constructor($el){this.element=$el;this.useWin=this.element===doc.body;this.winWidth=0;this.winHeight=0;this.width=0;this.height=0;this.left=0;this.top=0;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=false;this.backwardY=false;this.scrollTicker=new Timer({autoplay:false,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const backwards=this.backwardX||this.backwardY;forEachChildren(this,(child=>child.handleScroll()),backwards)},onComplete:()=>this.dataTimer.pause()}).init();this.dataTimer=new Timer({autoplay:false,frameRate:30,onUpdate:self=>{const dt=self.deltaTime;const px=this.prevScrollX;const py=this.prevScrollY;const nx=this.scrollX;const ny=this.scrollY;const dx=px-nx;const dy=py-ny;this.prevScrollX=nx;this.prevScrollY=ny;if(dx)this.backwardX=px>nx;if(dy)this.backwardY=py>ny;this.velocity=round(dt>0?Math.sqrt(dx*dx+dy*dy)/dt:0,5)}}).init();this.resizeTicker=new Timer({autoplay:false,duration:250*globals.timeScale,onComplete:()=>{this.updateWindowBounds();this.refreshScrollObservers();this.handleScroll()}}).init();this.wakeTicker=new Timer({autoplay:false,duration:500*globals.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?win:this.element).addEventListener("scroll",this,false)}updateScrollCoords(){const useWin=this.useWin;const $el=this.element;this.scrollX=round(useWin?win.scrollX:$el.scrollLeft,0);this.scrollY=round(useWin?win.scrollY:$el.scrollTop,0)}updateWindowBounds(){this.winWidth=win.innerWidth;this.winHeight=getMaxViewHeight()}updateBounds(){const style=getComputedStyle(this.element);const $el=this.element;this.scrollWidth=$el.scrollWidth+parseFloat(style.marginLeft)+parseFloat(style.marginRight);this.scrollHeight=$el.scrollHeight+parseFloat(style.marginTop)+parseFloat(style.marginBottom);this.updateWindowBounds();let width,height;if(this.useWin){width=this.winWidth;height=this.winHeight}else{const elRect=$el.getBoundingClientRect();width=elRect.width;height=elRect.height;this.top=elRect.top;this.left=elRect.left}this.width=width;this.height=height}refreshScrollObservers(){forEachChildren(this,(child=>{if(child._debug){child.removeDebug()}}));this.updateBounds();forEachChildren(this,(child=>{child.refresh();if(child._debug){child.debug()}}))}refresh(){this.updateWindowBounds();this.updateBounds();this.refreshScrollObservers();this.handleScroll()}handleScroll(){this.updateScrollCoords();this.wakeTicker.restart()}handleEvent(e){switch(e.type){case"scroll":this.handleScroll();break}}revert(){this.scrollTicker.cancel();this.dataTimer.cancel();this.resizeTicker.cancel();this.wakeTicker.cancel();this.resizeObserver.unobserve(this.element);(this.useWin?win:this.element).removeEventListener("scroll",this);scrollContainers.delete(this.element)}}const registerAndGetScrollContainer=target=>{const $el=target?parseTargets(target)[0]||doc.body:doc.body;let scrollContainer=scrollContainers.get($el);if(!scrollContainer){scrollContainer=new ScrollContainer($el);scrollContainers.set($el,scrollContainer)}return scrollContainer};const convertValueToPx=($el,v,size,under,over)=>{const clampMin=v==="min";const clampMax=v==="max";const value=v==="top"||v==="left"||v==="start"||clampMin?0:v==="bottom"||v==="right"||v==="end"||clampMax?"100%":v==="center"?"50%":v;const{n:n,u:u}=decomposeRawValue(value,decomposedOriginalValue);let px=n;if(u==="%"){px=n/100*size}else if(u){px=convertValueUnit($el,decomposedOriginalValue,"px",true).n}if(clampMax&&under<0)px+=under;if(clampMin&&over>0)px+=over;return px};const parseBoundValue=($el,v,size,under,over)=>{let value;if(isStr(v)){const matchedOperator=relativeValuesExecRgx.exec(v);if(matchedOperator){const splitter=matchedOperator[0];const operator=splitter[0];const splitted=v.split(splitter);const clampMin=splitted[0]==="min";const clampMax=splitted[0]==="max";const valueAPx=convertValueToPx($el,splitted[0],size,under,over);const valueBPx=convertValueToPx($el,splitted[1],size,under,over);if(clampMin){const min=getRelativeValue(convertValueToPx($el,"min",size),valueBPx,operator);value=min<valueAPx?valueAPx:min}else if(clampMax){const max=getRelativeValue(convertValueToPx($el,"max",size),valueBPx,operator);value=max>valueAPx?valueAPx:max}else{value=getRelativeValue(valueAPx,valueBPx,operator)}}else{value=convertValueToPx($el,v,size,under,over)}}else{value=v}return round(value,0)};const getAnimationDomTarget=linked=>{let $linkedTarget;const linkedTargets=linked.targets;for(let i=0,l=linkedTargets.length;i<l;i++){const target=linkedTargets[i];if(target[isDomSymbol]){$linkedTarget=target;break}}return $linkedTarget};let scrollerIndex=0;const debugColors=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ScrollObserver{constructor(parameters={}){if(globals.scope)globals.scope.revertibles.push(this);const syncMode=setValue(parameters.sync,"play pause");const ease=syncMode?parseEasings(syncMode):null;const isLinear=syncMode&&(syncMode==="linear"||syncMode===none);const isEase=syncMode&&!(ease===none&&!isLinear);const isSmooth=syncMode&&(isNum(syncMode)||syncMode===true||isLinear);const isMethods=syncMode&&(isStr(syncMode)&&!isEase&&!isSmooth);const syncMethods=isMethods?syncMode.split(" ").map((m=>()=>{const linked=this.linked;return linked&&linked[m]?linked[m]():null})):null;const biDirSync=isMethods&&syncMethods.length>2;this.index=scrollerIndex++;this.id=!isUnd(parameters.id)?parameters.id:this.index;this.container=registerAndGetScrollContainer(parameters.container);this.target=null;this.linked=null;this.repeat=null;this.horizontal=null;this.enter=null;this.leave=null;this.sync=isEase||isSmooth||!!syncMethods;this.syncEase=isEase?ease:null;this.syncSmooth=isSmooth?syncMode===true||isLinear?1:syncMode:null;this.onSyncEnter=syncMethods&&!biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeave=syncMethods&&!biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterForward=syncMethods&&biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeaveForward=syncMethods&&biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterBackward=syncMethods&&biDirSync&&syncMethods[2]?syncMethods[2]:noop;this.onSyncLeaveBackward=syncMethods&&biDirSync&&syncMethods[3]?syncMethods[3]:noop;this.onEnter=parameters.onEnter||noop;this.onLeave=parameters.onLeave||noop;this.onEnterForward=parameters.onEnterForward||noop;this.onLeaveForward=parameters.onLeaveForward||noop;this.onEnterBackward=parameters.onEnterBackward||noop;this.onLeaveBackward=parameters.onLeaveBackward||noop;this.onUpdate=parameters.onUpdate||noop;this.onSyncComplete=parameters.onSyncComplete||noop;this.reverted=false;this.completed=false;this.began=false;this.isInView=false;this.forceEnter=false;this.hasEntered=false;this.offsets=[];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=parameters;this._debug=setValue(parameters.debug,false);this._next=null;this._prev=null;addChild(this.container,this);sync((()=>{if(this.reverted)return;if(!this.target){const target=parseTargets(parameters.target)[0];this.target=target||doc.body;this.refresh()}if(this._debug)this.debug()}))}link(linked){if(linked){linked.pause();this.linked=linked;if(!this._params.target){let $linkedTarget;if(!isUnd(linked.targets)){$linkedTarget=getAnimationDomTarget(linked)}else{forEachChildren(linked,(child=>{if(child.targets&&!$linkedTarget){$linkedTarget=getAnimationDomTarget(child)}}))}this.target=$linkedTarget||doc.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 p=(this.scroll-this.offsetStart)/this.distance;return p===Infinity||isNaN(p)?0:round(clamp(p,0,1),6)}refresh(){this.reverted=false;const params=this._params;this.repeat=setValue(parseScrollObserverFunctionParameter(params.repeat,this),true);this.horizontal=setValue(parseScrollObserverFunctionParameter(params.axis,this),"y")==="x";this.enter=setValue(parseScrollObserverFunctionParameter(params.enter,this),"end start");this.leave=setValue(parseScrollObserverFunctionParameter(params.leave,this),"start end");this.updateBounds();this.handleScroll();return this}removeDebug(){if(this.$debug){this.$debug.parentNode.removeChild(this.$debug);this.$debug=null}if(this.debugStyles){this.debugStyles.revert();this.$debug=null}return this}debug(){this.removeDebug();const container=this.container;const isHori=this.horizontal;const $existingDebug=container.element.querySelector(":scope > .animejs-onscroll-debug");const $debug=doc.createElement("div");const $thresholds=doc.createElement("div");const $triggers=doc.createElement("div");const color=debugColors[this.index%debugColors.length];const useWin=container.useWin;const containerWidth=useWin?container.winWidth:container.width;const containerHeight=useWin?container.winHeight:container.height;const scrollWidth=container.scrollWidth;const scrollHeight=container.scrollHeight;const size=this.container.width>360?320:260;const offLeft=isHori?0:10;const offTop=isHori?10:0;const half=isHori?24:size/2;const labelHeight=isHori?half:15;const labelWidth=isHori?60:half;const labelSize=isHori?labelWidth:labelHeight;const repeat=isHori?"repeat-x":"repeat-y";const gradientOffset=v=>isHori?"0px "+v+"px":v+"px"+" 2px";const lineCSS=c=>`linear-gradient(${isHori?90:0}deg, ${c} 2px, transparent 1px)`;const baseCSS=(p,l,t,w,h)=>`position:${p};left:${l}px;top:${t}px;width:${w}px;height:${h}px;`;$debug.style.cssText=`${baseCSS("absolute",offLeft,offTop,isHori?scrollWidth:size,isHori?size:scrollHeight)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `;$thresholds.style.cssText=`${baseCSS("sticky",0,0,isHori?containerWidth:half,isHori?half:containerHeight)}`;if(!$existingDebug){$thresholds.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(half-10)} / ${isHori?"100px 100px":"100px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(half-10)} / ${isHori?"10px 10px":"10px 10px"} ${repeat};\n `}$triggers.style.cssText=`${baseCSS("relative",0,0,isHori?scrollWidth:half,isHori?half:scrollHeight)}`;if(!$existingDebug){$triggers.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(0)} / ${isHori?"100px 10px":"10px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(0)} / ${isHori?"10px 0px":"0px 10px"} ${repeat};\n `}const labels=[" enter: "," leave: "];this.coords.forEach(((v,i)=>{const isView=i>1;const value=(isView?0:this.offset)+v;const isTail=i%2;const isFirst=value<labelSize;const isOver=value>(isView?isHori?containerWidth:containerHeight:isHori?scrollWidth:scrollHeight)-labelSize;const isFlip=(isView?isTail&&!isFirst:!isTail&&!isFirst)||isOver;const $label=doc.createElement("div");const $text=doc.createElement("div");const dirProp=isHori?isFlip?"right":"left":isFlip?"bottom":"top";const flipOffset=isFlip?(isHori?labelWidth:labelHeight)+(!isView?isHori?-1:-2:isHori?-1:isOver?0:-2):!isView?isHori?1:0:isHori?1:0;$text.innerHTML=`${this.id}${labels[isTail]}${this.thresholds[i]}`;$label.style.cssText=`${baseCSS("absolute",0,0,labelWidth,labelHeight)}\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n justify-content: flex-${isView?"start":"end"};\n align-items: flex-${isFlip?"end":"start"};\n border-${dirProp}: 2px ${isTail?"solid":"solid"} ${color};\n `;$text.style.cssText=`\n overflow: hidden;\n max-width: ${size/2-10}px;\n height: ${labelHeight};\n margin-${isHori?isFlip?"right":"left":isFlip?"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: ${isHori&&isFlip||!isHori&&!isView?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${isTail?color:"rgba(0,0,0,.75)"};\n background-color: ${isTail?"rgba(0,0,0,.65)":color};\n border: 2px solid ${isTail?color:"transparent"};\n border-${isHori?isFlip?"top-left":"top-right":isFlip?"top-left":"bottom-left"}-radius: 5px;\n border-${isHori?isFlip?"bottom-left":"bottom-right":isFlip?"top-right":"bottom-right"}-radius: 5px;\n `;$label.appendChild($text);let position=value-flipOffset+(isHori?1:0);$label.style[isHori?"left":"top"]=`${position}px`;(isView?$thresholds:$triggers).appendChild($label)}));$debug.appendChild($thresholds);$debug.appendChild($triggers);container.element.appendChild($debug);if(!$existingDebug)$debug.classList.add("animejs-onscroll-debug");this.$debug=$debug;const containerPosition=getTargetValue(container.element,"position");if(containerPosition==="static"){this.debugStyles=setTargetValues(container.element,{position:"relative "})}}updateBounds(){if(this._debug){this.removeDebug()}let stickys;const $target=this.target;const container=this.container;const isHori=this.horizontal;const linked=this.linked;let linkedTime;let $el=$target;let offsetX=0;let offsetY=0;let $offsetParent=$el;if(linked){linkedTime=linked.currentTime;linked.seek(0,true)}const isContainerStatic=getTargetValue(container.element,"position")==="static"?setTargetValues(container.element,{position:"relative "}):false;while($el&&$el!==container.element&&$el!==doc.body){const isSticky=getTargetValue($el,"position")==="sticky"?setTargetValues($el,{position:"static"}):false;if($el===$offsetParent){offsetX+=$el.offsetLeft||0;offsetY+=$el.offsetTop||0;$offsetParent=$el.offsetParent}$el=$el.parentElement;if(isSticky){if(!stickys)stickys=[];stickys.push(isSticky)}}if(isContainerStatic)isContainerStatic.revert();const offset=isHori?offsetX:offsetY;const targetSize=isHori?$target.offsetWidth:$target.offsetHeight;const containerSize=isHori?container.width:container.height;const scrollSize=isHori?container.scrollWidth:container.scrollHeight;const maxScroll=scrollSize-containerSize;const enter=this.enter;const leave=this.leave;let enterTarget="start";let leaveTarget="end";let enterContainer="end";let leaveContainer="start";if(isStr(enter)){const splitted=enter.split(" ");enterContainer=splitted[0];enterTarget=splitted.length>1?splitted[1]:enterTarget}else if(isObj(enter)){const e=enter;if(!isUnd(e.container))enterContainer=e.container;if(!isUnd(e.target))enterTarget=e.target}else if(isNum(enter)){enterContainer=enter}if(isStr(leave)){const splitted=leave.split(" ");leaveContainer=splitted[0];leaveTarget=splitted.length>1?splitted[1]:leaveTarget}else if(isObj(leave)){const t=leave;if(!isUnd(t.container))leaveContainer=t.container;if(!isUnd(t.target))leaveTarget=t.target}else if(isNum(leave)){leaveContainer=leave}const parsedEnterTarget=parseBoundValue($target,enterTarget,targetSize);const parsedLeaveTarget=parseBoundValue($target,leaveTarget,targetSize);const under=parsedEnterTarget+offset-containerSize;const over=parsedLeaveTarget+offset-maxScroll;const parsedEnterContainer=parseBoundValue($target,enterContainer,containerSize,under,over);const parsedLeaveContainer=parseBoundValue($target,leaveContainer,containerSize,under,over);const offsetStart=parsedEnterTarget+offset-parsedEnterContainer;const offsetEnd=parsedLeaveTarget+offset-parsedLeaveContainer;const scrollDelta=offsetEnd-offsetStart;this.offsets[0]=offsetX;this.offsets[1]=offsetY;this.offset=offset;this.offsetStart=offsetStart;this.offsetEnd=offsetEnd;this.distance=scrollDelta<=0?0:scrollDelta;this.thresholds=[enterTarget,leaveTarget,enterContainer,leaveContainer];this.coords=[parsedEnterTarget,parsedLeaveTarget,parsedEnterContainer,parsedLeaveContainer];if(stickys){stickys.forEach((sticky=>sticky.revert()))}if(linked){linked.seek(linkedTime,true)}if(this._debug){this.debug()}}handleScroll(){const linked=this.linked;const sync=this.sync;const syncEase=this.syncEase;const syncSmooth=this.syncSmooth;const shouldSeek=linked&&(syncEase||syncSmooth);const isHori=this.horizontal;const container=this.container;const scroll=this.scroll;const isBefore=scroll<=this.offsetStart;const isAfter=scroll>=this.offsetEnd;const isInView=!isBefore&&!isAfter;const isOnTheEdge=scroll===this.offsetStart||scroll===this.offsetEnd;const forceEnter=!this.hasEntered&&isOnTheEdge;const $debug=this._debug&&this.$debug;let hasUpdated=false;let syncCompleted=false;let p=this.progress;if(isBefore&&this.began){this.began=false}if(p>0&&!this.began){this.began=true}if(shouldSeek){const lp=linked.progress;if(syncSmooth&&isNum(syncSmooth)){if(syncSmooth<1){const step=1e-4;const snap=lp<p&&p===1?step:lp>p&&!p?-1e-4:0;p=round(lerp(lp,p,interpolate(.01,.2,syncSmooth),false)+snap,6)}}else if(syncEase){p=syncEase(p)}hasUpdated=p!==this.prevProgress;syncCompleted=lp===1;if(hasUpdated&&!syncCompleted&&(syncSmooth&&lp)){container.wakeTicker.restart()}}if($debug){const sticky=isHori?container.scrollY:container.scrollX;$debug.style[isHori?"top":"left"]=sticky+10+"px"}if(isInView&&!this.isInView||forceEnter&&!this.forceEnter&&!this.hasEntered){if(isInView)this.isInView=true;if(!this.forceEnter||!this.hasEntered){if($debug&&isInView)$debug.style.zIndex=`${this.container.zIndex++}`;this.onSyncEnter(this);this.onEnter(this);if(this.backward){this.onSyncEnterBackward(this);this.onEnterBackward(this)}else{this.onSyncEnterForward(this);this.onEnterForward(this)}this.hasEntered=true;if(forceEnter)this.forceEnter=true}else if(isInView){this.forceEnter=false}}if(isInView||!isInView&&this.isInView){hasUpdated=true}if(hasUpdated){if(shouldSeek)linked.seek(linked.duration*p);this.onUpdate(this)}if(!isInView&&this.isInView){this.isInView=false;this.onSyncLeave(this);this.onLeave(this);if(this.backward){this.onSyncLeaveBackward(this);this.onLeaveBackward(this)}else{this.onSyncLeaveForward(this);this.onLeaveForward(this)}if(sync&&!syncSmooth){syncCompleted=true}}if(p>=1&&this.began&&!this.completed&&(sync&&syncCompleted||!sync)){if(sync){this.onSyncComplete(this)}this.completed=true;if(!this.repeat&&!linked||!this.repeat&&linked&&linked.completed){this.revert()}}if(p<1&&this.completed){this.completed=false}this.prevProgress=p}revert(){if(this.reverted)return;const container=this.container;removeChild(container,this);if(!container._head){container.revert()}if(this._debug){this.removeDebug()}this.reverted=true;return this}}const onScroll=(parameters={})=>new ScrollObserver(parameters);const stagger=(val,params={})=>{let values=[];let maxValue=0;const from=params.from;const reversed=params.reversed;const ease=params.ease;const hasEasing=!isUnd(ease);const hasSpring=hasEasing&&!isUnd(ease.ease);const staggerEase=hasSpring?ease.ease:hasEasing?parseEasings(ease):null;const grid=params.grid;const axis=params.axis;const fromFirst=isUnd(from)||from===0||from==="first";const fromCenter=from==="center";const fromLast=from==="last";const isRange=isArr(val);const val1=isRange?parseNumber(val[0]):parseNumber(val);const val2=isRange?parseNumber(val[1]):0;const unitMatch=unitsExecRgx.exec((isRange?val[1]:val)+emptyString);const start=params.start||0+(isRange?val1:0);let fromIndex=fromFirst?0:isNum(from)?from:0;return(_,i,t,tl)=>{if(fromCenter)fromIndex=(t-1)/2;if(fromLast)fromIndex=t-1;if(!values.length){for(let index=0;index<t;index++){if(!grid){values.push(abs(fromIndex-index))}else{const fromX=!fromCenter?fromIndex%grid[0]:(grid[0]-1)/2;const fromY=!fromCenter?floor(fromIndex/grid[0]):(grid[1]-1)/2;const toX=index%grid[0];const toY=floor(index/grid[0]);const distanceX=fromX-toX;const distanceY=fromY-toY;let value=sqrt(distanceX*distanceX+distanceY*distanceY);if(axis==="x")value=-distanceX;if(axis==="y")value=-distanceY;values.push(value)}maxValue=max(...values)}if(staggerEase)values=values.map((val=>staggerEase(val/maxValue)*maxValue));if(reversed)values=values.map((val=>axis?val<0?val*-1:-val:abs(maxValue-val)))}const spacing=isRange?(val2-val1)/maxValue:val1;const offset=tl?parseTimelinePosition(tl,isUnd(params.start)?tl.iterationDuration:start):start;let output=offset+(spacing*round(values[i],2)||0);if(params.modifier)output=params.modifier(output);if(unitMatch)output=`${output}${unitMatch[2]}`;return output}};exports.Animatable=Animatable;exports.Draggable=Draggable;exports.JSAnimation=JSAnimation;exports.Scope=Scope;exports.ScrollObserver=ScrollObserver;exports.Spring=Spring;exports.Timeline=Timeline;exports.Timer=Timer;exports.WAAPIAnimation=WAAPIAnimation;exports.animate=animate;exports.createAnimatable=createAnimatable;exports.createDraggable=createDraggable;exports.createScope=createScope;exports.createSpring=createSpring;exports.createTimeline=createTimeline;exports.createTimer=createTimer;exports.eases=eases;exports.engine=engine;exports.onScroll=onScroll;exports.scrollContainers=scrollContainers;exports.stagger=stagger;exports.svg=svg;exports.utils=utils;exports.waapi=waapi;
+"use strict";const isBrowser=typeof window!=="undefined";const win=isBrowser?window:null;const doc=isBrowser?document:null;const tweenTypes={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4};const valueTypes={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3};const tickModes={NONE:0,AUTO:1,FORCE:2};const compositionTypes={replace:0,none:1,blend:2};const isRegisteredTargetSymbol=Symbol();const isDomSymbol=Symbol();const isSvgSymbol=Symbol();const transformsSymbol=Symbol();const morphPointsSymbol=Symbol();const proxyTargetSymbol=Symbol();const minValue=1e-11;const maxValue=1e12;const K=1e3;const maxFps=120;const emptyString="";const shortTransforms=(()=>{const map=new Map;map.set("x","translateX");map.set("y","translateY");map.set("z","translateZ");return map})();const validTransforms=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"];const transformsFragmentStrings=validTransforms.reduce(((a,v)=>({...a,[v]:v+"("})),{});const noop=()=>{};const hexTestRgx=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;const rgbExecRgx=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;const rgbaExecRgx=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const hslExecRgx=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;const hslaExecRgx=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const digitWithExponentRgx=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;const unitsExecRgx=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx=/([a-z])([A-Z])/g;const transformsExecRgx=/(\w+)(\([^)]+\)+)/g;const relativeValuesExecRgx=/(\*=|\+=|-=)/;const defaults={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:maxFps,loop:0,reversed:false,alternate:false,autoplay:true,duration:K,delay:0,loopDelay:0,ease:"out(2)",composition:compositionTypes.replace,modifier:v=>v,onBegin:noop,onBeforeUpdate:noop,onUpdate:noop,onLoop:noop,onPause:noop,onComplete:noop,onRender:noop};const scope={current:null,root:doc};const globals={defaults:defaults,precision:4,timeScale:1,tickThreshold:200};const globalVersions={version:"4.1.0",engine:null};if(isBrowser){if(!win.AnimeJS)win.AnimeJS=[];win.AnimeJS.push(globalVersions)}const toLowerCase=str=>str.replace(lowerCaseRgx,"$1-$2").toLowerCase();const stringStartsWith=(str,sub)=>str.indexOf(sub)===0;const now=Date.now;const isArr=Array.isArray;const isObj=a=>a&&a.constructor===Object;const isNum=a=>typeof a==="number"&&!isNaN(a);const isStr=a=>typeof a==="string";const isFnc=a=>typeof a==="function";const isUnd=a=>typeof a==="undefined";const isNil=a=>isUnd(a)||a===null;const isSvg=a=>isBrowser&&a instanceof SVGElement;const isHex=a=>hexTestRgx.test(a);const isRgb=a=>stringStartsWith(a,"rgb");const isHsl=a=>stringStartsWith(a,"hsl");const isCol=a=>isHex(a)||isRgb(a)||isHsl(a);const isKey=a=>!globals.defaults.hasOwnProperty(a);const parseNumber=str=>isStr(str)?parseFloat(str):str;const pow=Math.pow;const sqrt=Math.sqrt;const sin=Math.sin;const cos=Math.cos;const abs=Math.abs;const exp=Math.exp;const ceil=Math.ceil;const floor=Math.floor;const asin=Math.asin;const max=Math.max;const atan2=Math.atan2;const PI=Math.PI;const _round=Math.round;const clamp=(v,min,max)=>v<min?min:v>max?max:v;const powCache={};const round=(v,decimalLength)=>{if(decimalLength<0)return v;if(!decimalLength)return _round(v);let p=powCache[decimalLength];if(!p)p=powCache[decimalLength]=10**decimalLength;return _round(v*p)/p};const snap=(v,increment)=>isArr(increment)?increment.reduce(((closest,cv)=>abs(cv-v)<abs(closest-v)?cv:closest)):increment?_round(v/increment)*increment:v;const interpolate=(start,end,progress)=>start+(end-start)*progress;const random=(min,max,decimalLength)=>{const m=10**(decimalLength||0);return floor((Math.random()*(max-min+1/m)+min)*m)/m};const shuffle=items=>{let m=items.length,t,i;while(m){i=random(0,--m);t=items[m];items[m]=items[i];items[i]=t}return items};const clampInfinity=v=>v===Infinity?maxValue:v===-Infinity?-1e12:v;const normalizeTime=v=>v<=minValue?minValue:clampInfinity(round(v,11));const cloneArray=a=>isArr(a)?[...a]:a;const mergeObjects=(o1,o2)=>{const merged={...o1};for(let p in o2){const o1p=o1[p];merged[p]=isUnd(o1p)?o2[p]:o1p}return merged};const forEachChildren=(parent,callback,reverse,prevProp="_prev",nextProp="_next")=>{let next=parent._head;let adjustedNextProp=nextProp;if(reverse){next=parent._tail;adjustedNextProp=prevProp}while(next){const currentNext=next[adjustedNextProp];callback(next);next=currentNext}};const removeChild=(parent,child,prevProp="_prev",nextProp="_next")=>{const prev=child[prevProp];const next=child[nextProp];prev?prev[nextProp]=next:parent._head=next;next?next[prevProp]=prev:parent._tail=prev;child[prevProp]=null;child[nextProp]=null};const addChild=(parent,child,sortMethod,prevProp="_prev",nextProp="_next")=>{let prev=parent._tail;while(prev&&sortMethod&&sortMethod(prev,child))prev=prev[prevProp];const next=prev?prev[nextProp]:parent._head;prev?prev[nextProp]=child:parent._head=child;next?next[prevProp]=child:parent._tail=child;child[prevProp]=prev;child[nextProp]=next};const createRefreshable=constructor=>{let tracked;return(...args)=>{let currentIteration,currentIterationProgress,reversed,alternate;if(tracked){currentIteration=tracked.currentIteration;currentIterationProgress=tracked.iterationProgress;reversed=tracked.reversed;alternate=tracked._alternate;tracked.revert()}const cleanup=constructor(...args);if(cleanup&&!isFnc(cleanup)&&cleanup.revert)tracked=cleanup;if(!isUnd(currentIterationProgress)){tracked.currentIteration=currentIteration;tracked.iterationProgress=(alternate?!(currentIteration%2)?reversed:!reversed:reversed)?1-currentIterationProgress:currentIterationProgress}return cleanup||noop}};class Clock{constructor(initTime=0){this.deltaTime=0;this._currentTime=initTime;this._elapsedTime=initTime;this._startTime=initTime;this._lastTime=initTime;this._scheduledTime=0;this._frameDuration=round(K/maxFps,0);this._fps=maxFps;this._speed=1;this._hasChildren=false;this._head=null;this._tail=null}get fps(){return this._fps}set fps(frameRate){const previousFrameDuration=this._frameDuration;const fr=+frameRate;const fps=fr<minValue?minValue:fr;const frameDuration=round(K/fps,0);this._fps=fps;this._frameDuration=frameDuration;this._scheduledTime+=frameDuration-previousFrameDuration}get speed(){return this._speed}set speed(playbackRate){const pbr=+playbackRate;this._speed=pbr<minValue?minValue:pbr}requestTick(time){const scheduledTime=this._scheduledTime;const elapsedTime=this._elapsedTime;this._elapsedTime+=time-elapsedTime;if(elapsedTime<scheduledTime)return tickModes.NONE;const frameDuration=this._frameDuration;const frameDelta=elapsedTime-scheduledTime;this._scheduledTime+=frameDelta<frameDuration?frameDuration:frameDelta;return tickModes.AUTO}computeDeltaTime(time){const delta=time-this._lastTime;this.deltaTime=delta;this._lastTime=time;return delta}}const render=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const parent=tickable.parent;const duration=tickable.duration;const completed=tickable.completed;const iterationDuration=tickable.iterationDuration;const iterationCount=tickable.iterationCount;const _currentIteration=tickable._currentIteration;const _loopDelay=tickable._loopDelay;const _reversed=tickable._reversed;const _alternate=tickable._alternate;const _hasChildren=tickable._hasChildren;const tickableDelay=tickable._delay;const tickablePrevAbsoluteTime=tickable._currentTime;const tickableEndTime=tickableDelay+iterationDuration;const tickableAbsoluteTime=time-tickableDelay;const tickablePrevTime=clamp(tickablePrevAbsoluteTime,-tickableDelay,duration);const tickableCurrentTime=clamp(tickableAbsoluteTime,-tickableDelay,duration);const deltaTime=tickableAbsoluteTime-tickablePrevAbsoluteTime;const isCurrentTimeAboveZero=tickableCurrentTime>0;const isCurrentTimeEqualOrAboveDuration=tickableCurrentTime>=duration;const isSetter=duration<=minValue;const forcedTick=tickMode===tickModes.FORCE;let isOdd=0;let iterationElapsedTime=tickableAbsoluteTime;let hasRendered=0;if(iterationCount>1){const currentIteration=~~(tickableCurrentTime/(iterationDuration+(isCurrentTimeEqualOrAboveDuration?0:_loopDelay)));tickable._currentIteration=clamp(currentIteration,0,iterationCount);if(isCurrentTimeEqualOrAboveDuration)tickable._currentIteration--;isOdd=tickable._currentIteration%2;iterationElapsedTime=tickableCurrentTime%(iterationDuration+_loopDelay)||0}const isReversed=_reversed^(_alternate&&isOdd);const _ease=tickable._ease;let iterationTime=isCurrentTimeEqualOrAboveDuration?isReversed?0:duration:isReversed?iterationDuration-iterationElapsedTime:iterationElapsedTime;if(_ease)iterationTime=iterationDuration*_ease(iterationTime/iterationDuration)||0;const isRunningBackwards=(parent?parent.backwards:tickableAbsoluteTime<tickablePrevAbsoluteTime)?!isReversed:!!isReversed;tickable._currentTime=tickableAbsoluteTime;tickable._iterationTime=iterationTime;tickable.backwards=isRunningBackwards;if(isCurrentTimeAboveZero&&!tickable.began){tickable.began=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onBegin(tickable)}}else if(tickableAbsoluteTime<=0){tickable.began=false}if(!muteCallbacks&&!_hasChildren&&isCurrentTimeAboveZero&&tickable._currentIteration!==_currentIteration){tickable.onLoop(tickable)}if(forcedTick||tickMode===tickModes.AUTO&&(time>=tickableDelay&&time<=tickableEndTime||time<=tickableDelay&&tickablePrevTime>tickableDelay||time>=tickableEndTime&&tickablePrevTime!==duration)||iterationTime>=tickableEndTime&&tickablePrevTime!==duration||iterationTime<=tickableDelay&&tickablePrevTime>0||time<=tickablePrevTime&&tickablePrevTime===duration&&completed||isCurrentTimeEqualOrAboveDuration&&!completed&&isSetter){if(isCurrentTimeAboveZero){tickable.computeDeltaTime(tickablePrevTime);if(!muteCallbacks)tickable.onBeforeUpdate(tickable)}if(!_hasChildren){const forcedRender=forcedTick||(isRunningBackwards?deltaTime*-1:deltaTime)>=globals.tickThreshold;const absoluteTime=tickable._offset+(parent?parent._offset:0)+tickableDelay+iterationTime;let tween=tickable._head;let tweenTarget;let tweenStyle;let tweenTargetTransforms;let tweenTargetTransformsProperties;let tweenTransformsNeedUpdate=0;while(tween){const tweenComposition=tween._composition;const tweenCurrentTime=tween._currentTime;const tweenChangeDuration=tween._changeDuration;const tweenAbsEndTime=tween._absoluteStartTime+tween._changeDuration;const tweenNextRep=tween._nextRep;const tweenPrevRep=tween._prevRep;const tweenHasComposition=tweenComposition!==compositionTypes.none;if((forcedRender||(tweenCurrentTime!==tweenChangeDuration||absoluteTime<=tweenAbsEndTime+(tweenNextRep?tweenNextRep._delay:0))&&(tweenCurrentTime!==0||absoluteTime>=tween._absoluteStartTime))&&(!tweenHasComposition||!tween._isOverridden&&(!tween._isOverlapped||absoluteTime<=tweenAbsEndTime)&&(!tweenNextRep||(tweenNextRep._isOverridden||absoluteTime<=tweenNextRep._absoluteStartTime))&&(!tweenPrevRep||(tweenPrevRep._isOverridden||absoluteTime>=tweenPrevRep._absoluteStartTime+tweenPrevRep._changeDuration+tween._delay)))){const tweenNewTime=tween._currentTime=clamp(iterationTime-tween._startTime,0,tweenChangeDuration);const tweenProgress=tween._ease(tweenNewTime/tween._updateDuration);const tweenModifier=tween._modifier;const tweenValueType=tween._valueType;const tweenType=tween._tweenType;const tweenIsObject=tweenType===tweenTypes.OBJECT;const tweenIsNumber=tweenValueType===valueTypes.NUMBER;const tweenPrecision=tweenIsNumber&&tweenIsObject||tweenProgress===0||tweenProgress===1?-1:globals.precision;let value;let number;if(tweenIsNumber){value=number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision))}else if(tweenValueType===valueTypes.UNIT){number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision));value=`${number}${tween._unit}`}else if(tweenValueType===valueTypes.COLOR){const fn=tween._fromNumbers;const tn=tween._toNumbers;const r=round(clamp(tweenModifier(interpolate(fn[0],tn[0],tweenProgress)),0,255),0);const g=round(clamp(tweenModifier(interpolate(fn[1],tn[1],tweenProgress)),0,255),0);const b=round(clamp(tweenModifier(interpolate(fn[2],tn[2],tweenProgress)),0,255),0);const a=clamp(tweenModifier(round(interpolate(fn[3],tn[3],tweenProgress),tweenPrecision)),0,1);value=`rgba(${r},${g},${b},${a})`;if(tweenHasComposition){const ns=tween._numbers;ns[0]=r;ns[1]=g;ns[2]=b;ns[3]=a}}else if(tweenValueType===valueTypes.COMPLEX){value=tween._strings[0];for(let j=0,l=tween._toNumbers.length;j<l;j++){const n=tweenModifier(round(interpolate(tween._fromNumbers[j],tween._toNumbers[j],tweenProgress),tweenPrecision));const s=tween._strings[j+1];value+=`${s?n+s:n}`;if(tweenHasComposition){tween._numbers[j]=n}}}if(tweenHasComposition){tween._number=number}if(!internalRender&&tweenComposition!==compositionTypes.blend){const tweenProperty=tween.property;tweenTarget=tween.target;if(tweenIsObject){tweenTarget[tweenProperty]=value}else if(tweenType===tweenTypes.ATTRIBUTE){tweenTarget.setAttribute(tweenProperty,value)}else{tweenStyle=tweenTarget.style;if(tweenType===tweenTypes.TRANSFORM){if(tweenTarget!==tweenTargetTransforms){tweenTargetTransforms=tweenTarget;tweenTargetTransformsProperties=tweenTarget[transformsSymbol]}tweenTargetTransformsProperties[tweenProperty]=value;tweenTransformsNeedUpdate=1}else if(tweenType===tweenTypes.CSS){tweenStyle[tweenProperty]=value}else if(tweenType===tweenTypes.CSS_VAR){tweenStyle.setProperty(tweenProperty,value)}}if(isCurrentTimeAboveZero)hasRendered=1}else{tween._value=value}}if(tweenTransformsNeedUpdate&&tween._renderTransforms){let str=emptyString;for(let key in tweenTargetTransformsProperties){str+=`${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `}tweenStyle.transform=str;tweenTransformsNeedUpdate=0}tween=tween._next}if(!muteCallbacks&&hasRendered){tickable.onRender(tickable)}}if(!muteCallbacks&&isCurrentTimeAboveZero){tickable.onUpdate(tickable)}}if(parent&&isSetter){if(!muteCallbacks&&(parent.began&&!isRunningBackwards&&tickableAbsoluteTime>=duration&&!completed||isRunningBackwards&&tickableAbsoluteTime<=minValue&&completed)){tickable.onComplete(tickable);tickable.completed=!isRunningBackwards}}else if(isCurrentTimeAboveZero&&isCurrentTimeEqualOrAboveDuration){if(iterationCount===Infinity){tickable._startTime+=tickable.duration}else if(tickable._currentIteration>=iterationCount-1){tickable.paused=true;if(!completed&&!_hasChildren){tickable.completed=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onComplete(tickable);tickable._resolve(tickable)}}}}else{tickable.completed=false}return hasRendered};const tick=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const _currentIteration=tickable._currentIteration;render(tickable,time,muteCallbacks,internalRender,tickMode);if(tickable._hasChildren){const tl=tickable;const tlIsRunningBackwards=tl.backwards;const tlChildrenTime=internalRender?time:tl._iterationTime;const tlCildrenTickTime=now();let tlChildrenHasRendered=0;let tlChildrenHaveCompleted=true;if(!internalRender&&tl._currentIteration!==_currentIteration){const tlIterationDuration=tl.iterationDuration;forEachChildren(tl,(child=>{if(!tlIsRunningBackwards){if(!child.completed&&!child.backwards&&child._currentTime<child.iterationDuration){render(child,tlIterationDuration,muteCallbacks,1,tickModes.FORCE)}child.began=false;child.completed=false}else{const childDuration=child.duration;const childStartTime=child._offset+child._delay;const childEndTime=childStartTime+childDuration;if(!muteCallbacks&&childDuration<=minValue&&(!childStartTime||childEndTime===tlIterationDuration)){child.onComplete(child)}}}));if(!muteCallbacks)tl.onLoop(tl)}forEachChildren(tl,(child=>{const childTime=round((tlChildrenTime-child._offset)*child._speed,12);const childTickMode=child._fps<tl._fps?child.requestTick(tlCildrenTickTime):tickMode;tlChildrenHasRendered+=render(child,childTime,muteCallbacks,internalRender,childTickMode);if(!child.completed&&tlChildrenHaveCompleted)tlChildrenHaveCompleted=false}),tlIsRunningBackwards);if(!muteCallbacks&&tlChildrenHasRendered)tl.onRender(tl);if(tlChildrenHaveCompleted&&tl._currentTime>=tl.duration){tl.paused=true;if(!tl.completed){tl.completed=true;if(!muteCallbacks){tl.onComplete(tl);tl._resolve(tl)}}}}};const additive={animation:null,update:noop};const addAdditiveAnimation=lookups=>{let animation=additive.animation;if(!animation){animation={duration:minValue,computeDeltaTime:noop,_offset:0,_delay:0,_head:null,_tail:null};additive.animation=animation;additive.update=()=>{lookups.forEach((propertyAnimation=>{for(let propertyName in propertyAnimation){const tweens=propertyAnimation[propertyName];const lookupTween=tweens._head;if(lookupTween){const valueType=lookupTween._valueType;const additiveValues=valueType===valueTypes.COMPLEX||valueType===valueTypes.COLOR?cloneArray(lookupTween._fromNumbers):null;let additiveValue=lookupTween._fromNumber;let tween=tweens._tail;while(tween&&tween!==lookupTween){if(additiveValues){for(let i=0,l=tween._numbers.length;i<l;i++)additiveValues[i]+=tween._numbers[i]}else{additiveValue+=tween._number}tween=tween._prevAdd}lookupTween._toNumber=additiveValue;lookupTween._toNumbers=additiveValues}}}));render(animation,1,1,0,tickModes.FORCE)}}return animation};const engineTickMethod=(()=>isBrowser?requestAnimationFrame:setImmediate)();const engineCancelMethod=(()=>isBrowser?cancelAnimationFrame:clearImmediate)();class Engine extends Clock{constructor(initTime){super(initTime);this.useDefaultMainLoop=true;this.pauseOnDocumentHidden=true;this.defaults=defaults;this.paused=isBrowser&&doc.hidden?true:false;this.reqId=null}update(){const time=this._currentTime=now();if(this.requestTick(time)){this.computeDeltaTime(time);const engineSpeed=this._speed;const engineFps=this._fps;let activeTickable=this._head;while(activeTickable){const nextTickable=activeTickable._next;if(!activeTickable.paused){tick(activeTickable,(time-activeTickable._startTime)*activeTickable._speed*engineSpeed,0,0,activeTickable._fps<engineFps?activeTickable.requestTick(time):tickModes.AUTO)}else{removeChild(this,activeTickable);this._hasChildren=!!this._tail;activeTickable._running=false;if(activeTickable.completed&&!activeTickable._cancelled){activeTickable.cancel()}}activeTickable=nextTickable}additive.update()}}wake(){if(this.useDefaultMainLoop&&!this.reqId&&!this.paused){this.reqId=engineTickMethod(tickEngine)}return this}pause(){this.paused=true;return killEngine()}resume(){if(!this.paused)return;this.paused=false;forEachChildren(this,(child=>child.resetTime()));return this.wake()}get speed(){return this._speed*(globals.timeScale===1?1:K)}set speed(playbackRate){this._speed=playbackRate*globals.timeScale;forEachChildren(this,(child=>child.speed=child._speed))}get timeUnit(){return globals.timeScale===1?"ms":"s"}set timeUnit(unit){const secondsScale=.001;const isSecond=unit==="s";const newScale=isSecond?secondsScale:1;if(globals.timeScale!==newScale){globals.timeScale=newScale;globals.tickThreshold=200*newScale;const scaleFactor=isSecond?secondsScale:K;this.defaults.duration*=scaleFactor;this._speed*=scaleFactor}}get precision(){return globals.precision}set precision(precision){globals.precision=precision}}const engine=(()=>{const engine=new Engine(now());if(isBrowser){globalVersions.engine=engine;doc.addEventListener("visibilitychange",(()=>{if(!engine.pauseOnDocumentHidden)return;doc.hidden?engine.pause():engine.resume()}))}return engine})();const tickEngine=()=>{if(engine._head){engine.reqId=engineTickMethod(tickEngine);engine.update()}else{engine.reqId=0}};const killEngine=()=>{engineCancelMethod(engine.reqId);engine.reqId=0;return engine};const parseInlineTransforms=(target,propName,animationInlineStyles)=>{const inlineTransforms=target.style.transform;let inlinedStylesPropertyValue;if(inlineTransforms){const cachedTransforms=target[transformsSymbol];let t;while(t=transformsExecRgx.exec(inlineTransforms)){const inlinePropertyName=t[1];const inlinePropertyValue=t[2].slice(1,-1);cachedTransforms[inlinePropertyName]=inlinePropertyValue;if(inlinePropertyName===propName){inlinedStylesPropertyValue=inlinePropertyValue;if(animationInlineStyles){animationInlineStyles[propName]=inlinePropertyValue}}}}return inlineTransforms&&!isUnd(inlinedStylesPropertyValue)?inlinedStylesPropertyValue:stringStartsWith(propName,"scale")?"1":stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew")?"0deg":"0px"};function getNodeList(v){const n=isStr(v)?scope.root.querySelectorAll(v):v;if(n instanceof NodeList||n instanceof HTMLCollection)return n}function parseTargets(targets){if(isNil(targets))return[];if(isArr(targets)){const flattened=targets.flat(Infinity);const parsed=[];for(let i=0,l=flattened.length;i<l;i++){const item=flattened[i];if(!isNil(item)){const nodeList=getNodeList(item);if(nodeList){for(let j=0,jl=nodeList.length;j<jl;j++){const subItem=nodeList[j];if(!isNil(subItem)){let isDuplicate=false;for(let k=0,kl=parsed.length;k<kl;k++){if(parsed[k]===subItem){isDuplicate=true;break}}if(!isDuplicate){parsed.push(subItem)}}}}else{let isDuplicate=false;for(let j=0,jl=parsed.length;j<jl;j++){if(parsed[j]===item){isDuplicate=true;break}}if(!isDuplicate){parsed.push(item)}}}}return parsed}if(!isBrowser)return[targets];const nodeList=getNodeList(targets);if(nodeList)return Array.from(nodeList);return[targets]}function registerTargets(targets){const parsedTargetsArray=parseTargets(targets);const parsedTargetsLength=parsedTargetsArray.length;if(parsedTargetsLength){for(let i=0;i<parsedTargetsLength;i++){const target=parsedTargetsArray[i];if(!target[isRegisteredTargetSymbol]){target[isRegisteredTargetSymbol]=true;const isSvgType=isSvg(target);const isDom=target.nodeType||isSvgType;if(isDom){target[isDomSymbol]=true;target[isSvgSymbol]=isSvgType;target[transformsSymbol]={}}}}}return parsedTargetsArray}const getPath=path=>{const parsedTargets=parseTargets(path);const $parsedSvg=parsedTargets[0];if(!$parsedSvg||!isSvg($parsedSvg))return;return $parsedSvg};const morphTo=(path2,precision=.33)=>$path1=>{const $path2=getPath(path2);if(!$path2)return;const isPath=$path1.tagName==="path";const separator=isPath?" ":",";const previousPoints=$path1[morphPointsSymbol];if(previousPoints)$path1.setAttribute(isPath?"d":"points",previousPoints);let v1="",v2="";if(!precision){v1=$path1.getAttribute(isPath?"d":"points");v2=$path2.getAttribute(isPath?"d":"points")}else{const length1=$path1.getTotalLength();const length2=$path2.getTotalLength();const maxPoints=Math.max(Math.ceil(length1*precision),Math.ceil(length2*precision));for(let i=0;i<maxPoints;i++){const t=i/(maxPoints-1);const pointOnPath1=$path1.getPointAtLength(length1*t);const pointOnPath2=$path2.getPointAtLength(length2*t);const prefix=isPath?i===0?"M":"L":"";v1+=prefix+round(pointOnPath1.x,3)+separator+pointOnPath1.y+" ";v2+=prefix+round(pointOnPath2.x,3)+separator+pointOnPath2.y+" "}}$path1[morphPointsSymbol]=v2;return[v1,v2]};const getScaleFactor=$el=>{let scaleFactor=1;if($el&&$el.getCTM){const ctm=$el.getCTM();if(ctm){const scaleX=sqrt(ctm.a*ctm.a+ctm.b*ctm.b);const scaleY=sqrt(ctm.c*ctm.c+ctm.d*ctm.d);scaleFactor=(scaleX+scaleY)/2}}return scaleFactor};const createDrawableProxy=($el,start,end)=>{const pathLength=K;const computedStyles=getComputedStyle($el);const strokeLineCap=computedStyles.strokeLinecap;const $scalled=computedStyles.vectorEffect==="non-scaling-stroke"?$el:null;let currentCap=strokeLineCap;const proxy=new Proxy($el,{get(target,property){const value=target[property];if(property===proxyTargetSymbol)return target;if(property==="setAttribute"){return(...args)=>{if(args[0]==="draw"){const value=args[1];const values=value.split(" ");const v1=+values[0];const v2=+values[1];const scaleFactor=getScaleFactor($scalled);const os=v1*-1e3*scaleFactor;const d1=v2*pathLength*scaleFactor+os;const d2=pathLength*scaleFactor+(v1===0&&v2===1||v1===1&&v2===0?0:10*scaleFactor)-d1;if(strokeLineCap!=="butt"){const newCap=v1===v2?"butt":strokeLineCap;if(currentCap!==newCap){target.style.strokeLinecap=`${newCap}`;currentCap=newCap}}target.setAttribute("stroke-dashoffset",`${os}`);target.setAttribute("stroke-dasharray",`${d1} ${d2}`)}return Reflect.apply(value,target,args)}}if(isFnc(value)){return(...args)=>Reflect.apply(value,target,args)}else{return value}}});if($el.getAttribute("pathLength")!==`${pathLength}`){$el.setAttribute("pathLength",`${pathLength}`);proxy.setAttribute("draw",`${start} ${end}`)}return proxy};const createDrawable=(selector,start=0,end=0)=>{const els=parseTargets(selector);return els.map(($el=>createDrawableProxy($el,start,end)))};const getPathPoint=($path,progress,lookup=0)=>$path.getPointAtLength(progress+lookup>=1?progress+lookup:0);const getPathProgess=($path,pathProperty)=>$el=>{const totalLength=+$path.getTotalLength();const inSvg=$el[isSvgSymbol];const ctm=$path.getCTM();return{from:0,to:totalLength,modifier:progress=>{if(pathProperty==="a"){const p0=getPathPoint($path,progress,-1);const p1=getPathPoint($path,progress,1);return atan2(p1.y-p0.y,p1.x-p0.x)*180/PI}else{const p=getPathPoint($path,progress,0);return pathProperty==="x"?inSvg||!ctm?p.x:p.x*ctm.a+p.y*ctm.c+ctm.e:inSvg||!ctm?p.y:p.x*ctm.b+p.y*ctm.d+ctm.f}}}};const createMotionPath=path=>{const $path=getPath(path);if(!$path)return;return{translateX:getPathProgess($path,"x"),translateY:getPathProgess($path,"y"),rotate:getPathProgess($path,"a")}};const cssReservedProperties=["opacity","rotate","overflow","color"];const isValidSVGAttribute=(el,propertyName)=>{if(cssReservedProperties.includes(propertyName))return false;if(el.getAttribute(propertyName)||propertyName in el){if(propertyName==="scale"){const elParentNode=el.parentNode;return elParentNode&&elParentNode.tagName==="filter"}return true}};const svg={morphTo:morphTo,createMotionPath:createMotionPath,createDrawable:createDrawable};const rgbToRgba=rgbValue=>{const rgba=rgbExecRgx.exec(rgbValue)||rgbaExecRgx.exec(rgbValue);const a=!isUnd(rgba[4])?+rgba[4]:1;return[+rgba[1],+rgba[2],+rgba[3],a]};const hexToRgba=hexValue=>{const hexLength=hexValue.length;const isShort=hexLength===4||hexLength===5;return[+("0x"+hexValue[1]+hexValue[isShort?1:2]),+("0x"+hexValue[isShort?2:3]+hexValue[isShort?2:4]),+("0x"+hexValue[isShort?3:5]+hexValue[isShort?3:6]),hexLength===5||hexLength===9?+(+("0x"+hexValue[isShort?4:7]+hexValue[isShort?4:8])/255).toFixed(3):1]};const hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;return t<1/6?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p};const hslToRgba=hslValue=>{const hsla=hslExecRgx.exec(hslValue)||hslaExecRgx.exec(hslValue);const h=+hsla[1]/360;const s=+hsla[2]/100;const l=+hsla[3]/100;const a=!isUnd(hsla[4])?+hsla[4]:1;let r,g,b;if(s===0){r=g=b=l}else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=round(hue2rgb(p,q,h+1/3)*255,0);g=round(hue2rgb(p,q,h)*255,0);b=round(hue2rgb(p,q,h-1/3)*255,0)}return[r,g,b,a]};const convertColorStringValuesToRgbaArray=colorString=>isRgb(colorString)?rgbToRgba(colorString):isHex(colorString)?hexToRgba(colorString):isHsl(colorString)?hslToRgba(colorString):[0,0,0,1];const setValue=(targetValue,defaultValue)=>isUnd(targetValue)?defaultValue:targetValue;const getFunctionValue=(value,target,index,total,store)=>{if(isFnc(value)){const func=()=>{const computed=value(target,index,total);return!isNaN(+computed)?+computed:computed||0};if(store){store.func=func}return func()}else{return value}};const getTweenType=(target,prop)=>!target[isDomSymbol]?tweenTypes.OBJECT:target[isSvgSymbol]&&isValidSVGAttribute(target,prop)?tweenTypes.ATTRIBUTE:validTransforms.includes(prop)||shortTransforms.get(prop)?tweenTypes.TRANSFORM:stringStartsWith(prop,"--")?tweenTypes.CSS_VAR:prop in target.style?tweenTypes.CSS:prop in target?tweenTypes.OBJECT:tweenTypes.ATTRIBUTE;const getCSSValue=(target,propName,animationInlineStyles)=>{const inlineStyles=target.style[propName];if(inlineStyles&&animationInlineStyles){animationInlineStyles[propName]=inlineStyles}const value=inlineStyles||getComputedStyle(target[proxyTargetSymbol]||target).getPropertyValue(propName);return value==="auto"?"0":value};const getOriginalAnimatableValue=(target,propName,tweenType,animationInlineStyles)=>{const type=!isUnd(tweenType)?tweenType:getTweenType(target,propName);return type===tweenTypes.OBJECT?target[propName]||0:type===tweenTypes.ATTRIBUTE?target.getAttribute(propName):type===tweenTypes.TRANSFORM?parseInlineTransforms(target,propName,animationInlineStyles):type===tweenTypes.CSS_VAR?getCSSValue(target,propName,animationInlineStyles).trimStart():getCSSValue(target,propName,animationInlineStyles)};const getRelativeValue=(x,y,operator)=>operator==="-"?x-y:operator==="+"?x+y:x*y;const createDecomposedValueTargetObject=()=>({t:valueTypes.NUMBER,n:0,u:null,o:null,d:null,s:null});const decomposeRawValue=(rawValue,targetObject)=>{targetObject.t=valueTypes.NUMBER;targetObject.n=0;targetObject.u=null;targetObject.o=null;targetObject.d=null;targetObject.s=null;if(!rawValue)return targetObject;const num=+rawValue;if(!isNaN(num)){targetObject.n=num;return targetObject}else{let str=rawValue;if(str[1]==="="){targetObject.o=str[0];str=str.slice(2)}const unitMatch=str.includes(" ")?false:unitsExecRgx.exec(str);if(unitMatch){targetObject.t=valueTypes.UNIT;targetObject.n=+unitMatch[1];targetObject.u=unitMatch[2];return targetObject}else if(targetObject.o){targetObject.n=+str;return targetObject}else if(isCol(str)){targetObject.t=valueTypes.COLOR;targetObject.d=convertColorStringValuesToRgbaArray(str);return targetObject}else{const matchedNumbers=str.match(digitWithExponentRgx);targetObject.t=valueTypes.COMPLEX;targetObject.d=matchedNumbers?matchedNumbers.map(Number):[];targetObject.s=str.split(digitWithExponentRgx)||[];return targetObject}}};const decomposeTweenValue=(tween,targetObject)=>{targetObject.t=tween._valueType;targetObject.n=tween._toNumber;targetObject.u=tween._unit;targetObject.o=null;targetObject.d=cloneArray(tween._toNumbers);targetObject.s=cloneArray(tween._strings);return targetObject};const decomposedOriginalValue=createDecomposedValueTargetObject();const lookups={_rep:new WeakMap,_add:new Map};const getTweenSiblings=(target,property,lookup="_rep")=>{const lookupMap=lookups[lookup];let targetLookup=lookupMap.get(target);if(!targetLookup){targetLookup={};lookupMap.set(target,targetLookup)}return targetLookup[property]?targetLookup[property]:targetLookup[property]={_head:null,_tail:null}};const addTweenSortMethod=(p,c)=>p._isOverridden||p._absoluteStartTime>c._absoluteStartTime;const overrideTween=tween=>{tween._isOverlapped=1;tween._isOverridden=1;tween._changeDuration=minValue;tween._currentTime=minValue};const composeTween=(tween,siblings)=>{const tweenCompositionType=tween._composition;if(tweenCompositionType===compositionTypes.replace){const tweenAbsStartTime=tween._absoluteStartTime;addChild(siblings,tween,addTweenSortMethod,"_prevRep","_nextRep");const prevSibling=tween._prevRep;if(prevSibling){const prevParent=prevSibling.parent;const prevAbsEndTime=prevSibling._absoluteStartTime+prevSibling._changeDuration;if(tween.parent.id!==prevParent.id&&prevParent.iterationCount>1&&prevAbsEndTime+(prevParent.duration-prevParent.iterationDuration)>tweenAbsStartTime){overrideTween(prevSibling);let prevPrevSibling=prevSibling._prevRep;while(prevPrevSibling&&prevPrevSibling.parent.id===prevParent.id){overrideTween(prevPrevSibling);prevPrevSibling=prevPrevSibling._prevRep}}const absoluteUpdateStartTime=tweenAbsStartTime-tween._delay;if(prevAbsEndTime>absoluteUpdateStartTime){const prevChangeStartTime=prevSibling._startTime;const prevTLOffset=prevAbsEndTime-(prevChangeStartTime+prevSibling._updateDuration);prevSibling._changeDuration=absoluteUpdateStartTime-prevTLOffset-prevChangeStartTime;prevSibling._currentTime=prevSibling._changeDuration;prevSibling._isOverlapped=1;if(prevSibling._changeDuration<minValue){overrideTween(prevSibling)}}let pausePrevParentAnimation=true;forEachChildren(prevParent,(t=>{if(!t._isOverlapped)pausePrevParentAnimation=false}));if(pausePrevParentAnimation){const prevParentTL=prevParent.parent;if(prevParentTL){let pausePrevParentTL=true;forEachChildren(prevParentTL,(a=>{if(a!==prevParent){forEachChildren(a,(t=>{if(!t._isOverlapped)pausePrevParentTL=false}))}}));if(pausePrevParentTL){prevParentTL.cancel()}}else{prevParent.cancel()}}}}else if(tweenCompositionType===compositionTypes.blend){const additiveTweenSiblings=getTweenSiblings(tween.target,tween.property,"_add");const additiveAnimation=addAdditiveAnimation(lookups._add);let lookupTween=additiveTweenSiblings._head;if(!lookupTween){lookupTween={...tween};lookupTween._composition=compositionTypes.replace;lookupTween._updateDuration=minValue;lookupTween._startTime=0;lookupTween._numbers=cloneArray(tween._fromNumbers);lookupTween._number=0;lookupTween._next=null;lookupTween._prev=null;addChild(additiveTweenSiblings,lookupTween);addChild(additiveAnimation,lookupTween)}const toNumber=tween._toNumber;tween._fromNumber=lookupTween._fromNumber-toNumber;tween._toNumber=0;tween._numbers=cloneArray(tween._fromNumbers);tween._number=0;lookupTween._fromNumber=toNumber;if(tween._toNumbers){const toNumbers=cloneArray(tween._toNumbers);if(toNumbers){toNumbers.forEach(((value,i)=>{tween._fromNumbers[i]=lookupTween._fromNumbers[i]-value;tween._toNumbers[i]=0}))}lookupTween._fromNumbers=toNumbers}addChild(additiveTweenSiblings,tween,null,"_prevAdd","_nextAdd")}return tween};const removeTweenSliblings=tween=>{const tweenComposition=tween._composition;if(tweenComposition!==compositionTypes.none){const tweenTarget=tween.target;const tweenProperty=tween.property;const replaceTweensLookup=lookups._rep;const replaceTargetProps=replaceTweensLookup.get(tweenTarget);const tweenReplaceSiblings=replaceTargetProps[tweenProperty];removeChild(tweenReplaceSiblings,tween,"_prevRep","_nextRep");if(tweenComposition===compositionTypes.blend){const addTweensLookup=lookups._add;const addTargetProps=addTweensLookup.get(tweenTarget);if(!addTargetProps)return;const additiveTweenSiblings=addTargetProps[tweenProperty];const additiveAnimation=additive.animation;removeChild(additiveTweenSiblings,tween,"_prevAdd","_nextAdd");const lookupTween=additiveTweenSiblings._head;if(lookupTween&&lookupTween===additiveTweenSiblings._tail){removeChild(additiveTweenSiblings,lookupTween,"_prevAdd","_nextAdd");removeChild(additiveAnimation,lookupTween);let shouldClean=true;for(let prop in addTargetProps){if(addTargetProps[prop]._head){shouldClean=false;break}}if(shouldClean){addTweensLookup.delete(tweenTarget)}}}}return tween};const resetTimerProperties=timer=>{timer.paused=true;timer.began=false;timer.completed=false;return timer};const reviveTimer=timer=>{if(!timer._cancelled)return timer;if(timer._hasChildren){forEachChildren(timer,reviveTimer)}else{forEachChildren(timer,(tween=>{if(tween._composition!==compositionTypes.none){composeTween(tween,getTweenSiblings(tween.target,tween.property))}}))}timer._cancelled=0;return timer};let timerId=0;class Timer extends Clock{constructor(parameters={},parent=null,parentPosition=0){super(0);const{id:id,delay:delay,duration:duration,reversed:reversed,alternate:alternate,loop:loop,loopDelay:loopDelay,autoplay:autoplay,frameRate:frameRate,playbackRate:playbackRate,onComplete:onComplete,onLoop:onLoop,onPause:onPause,onBegin:onBegin,onBeforeUpdate:onBeforeUpdate,onUpdate:onUpdate}=parameters;if(scope.current)scope.current.register(this);const timerInitTime=parent?0:engine._elapsedTime;const timerDefaults=parent?parent.defaults:globals.defaults;const timerDelay=isFnc(delay)||isUnd(delay)?timerDefaults.delay:+delay;const timerDuration=isFnc(duration)||isUnd(duration)?Infinity:+duration;const timerLoop=setValue(loop,timerDefaults.loop);const timerLoopDelay=setValue(loopDelay,timerDefaults.loopDelay);const timerIterationCount=timerLoop===true||timerLoop===Infinity||timerLoop<0?Infinity:timerLoop+1;let offsetPosition=0;if(parent){offsetPosition=parentPosition}else{let startTime=now();if(engine.paused){engine.requestTick(startTime);startTime=engine._elapsedTime}offsetPosition=startTime-engine._startTime}this.id=!isUnd(id)?id:++timerId;this.parent=parent;this.duration=clampInfinity((timerDuration+timerLoopDelay)*timerIterationCount-timerLoopDelay)||minValue;this.backwards=false;this.paused=true;this.began=false;this.completed=false;this.onBegin=onBegin||timerDefaults.onBegin;this.onBeforeUpdate=onBeforeUpdate||timerDefaults.onBeforeUpdate;this.onUpdate=onUpdate||timerDefaults.onUpdate;this.onLoop=onLoop||timerDefaults.onLoop;this.onPause=onPause||timerDefaults.onPause;this.onComplete=onComplete||timerDefaults.onComplete;this.iterationDuration=timerDuration;this.iterationCount=timerIterationCount;this._autoplay=parent?false:setValue(autoplay,timerDefaults.autoplay);this._offset=offsetPosition;this._delay=timerDelay;this._loopDelay=timerLoopDelay;this._iterationTime=0;this._currentIteration=0;this._resolve=noop;this._running=false;this._reversed=+setValue(reversed,timerDefaults.reversed);this._reverse=this._reversed;this._cancelled=0;this._alternate=setValue(alternate,timerDefaults.alternate);this._prev=null;this._next=null;this._elapsedTime=timerInitTime;this._startTime=timerInitTime;this._lastTime=timerInitTime;this._fps=setValue(frameRate,timerDefaults.frameRate);this._speed=setValue(playbackRate,timerDefaults.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(cancelled){cancelled?this.cancel():this.reset(1).play()}get currentTime(){return clamp(round(this._currentTime,globals.precision),-this._delay,this.duration)}set currentTime(time){const paused=this.paused;this.pause().seek(+time);if(!paused)this.resume()}get iterationCurrentTime(){return round(this._iterationTime,globals.precision)}set iterationCurrentTime(time){this.currentTime=this.iterationDuration*this._currentIteration+time}get progress(){return clamp(round(this._currentTime/this.duration,10),0,1)}set progress(progress){this.currentTime=this.duration*progress}get iterationProgress(){return clamp(round(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(progress){const iterationDuration=this.iterationDuration;this.currentTime=iterationDuration*this._currentIteration+iterationDuration*progress}get currentIteration(){return this._currentIteration}set currentIteration(iterationCount){this.currentTime=this.iterationDuration*clamp(+iterationCount,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(reverse){reverse?this.reverse():this.play()}get speed(){return super.speed}set speed(playbackRate){super.speed=playbackRate;this.resetTime()}reset(internalRender=0){reviveTimer(this);if(this._reversed&&!this._reverse)this.reversed=false;this._iterationTime=this.iterationDuration;tick(this,0,1,internalRender,tickModes.FORCE);resetTimerProperties(this);if(this._hasChildren){forEachChildren(this,resetTimerProperties)}return this}init(internalRender=0){this.fps=this._fps;this.speed=this._speed;if(!internalRender&&this._hasChildren){tick(this,this.duration,1,internalRender,tickModes.FORCE)}this.reset(internalRender);const autoplay=this._autoplay;if(autoplay===true){this.resume()}else if(autoplay&&!isUnd(autoplay.linked)){autoplay.link(this)}return this}resetTime(){const timeScale=1/(this._speed*engine._speed);this._startTime=now()-(this._currentTime+this._delay)*timeScale;return this}pause(){if(this.paused)return this;this.paused=true;this.onPause(this);return this}resume(){if(!this.paused)return this;this.paused=false;if(this.duration<=minValue&&!this._hasChildren){tick(this,minValue,0,0,tickModes.FORCE)}else{if(!this._running){addChild(engine,this);engine._hasChildren=true;this._running=true}this.resetTime();this._startTime-=12;engine.wake()}return this}restart(){return this.reset(0).resume()}seek(time,muteCallbacks=0,internalRender=0){reviveTimer(this);this.completed=false;const isPaused=this.paused;this.paused=true;tick(this,time+this._delay,~~muteCallbacks,~~internalRender,tickModes.AUTO);return isPaused?this:this.resume()}alternate(){const reversed=this._reversed;const count=this.iterationCount;const duration=this.iterationDuration;const iterations=count===Infinity?floor(maxValue/duration):count;this._reversed=+(this._alternate&&!(iterations%2)?reversed:!reversed);if(count===Infinity){this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress}else{this.seek(duration*iterations-this._currentTime)}this.resetTime();return this}play(){if(this._reversed)this.alternate();return this.resume()}reverse(){if(!this._reversed)this.alternate();return this.resume()}cancel(){if(this._hasChildren){forEachChildren(this,(child=>child.cancel()),true)}else{forEachChildren(this,removeTweenSliblings)}this._cancelled=1;return this.pause()}stretch(newDuration){const currentDuration=this.duration;const normlizedDuration=normalizeTime(newDuration);if(currentDuration===normlizedDuration)return this;const timeScale=newDuration/currentDuration;const isSetter=newDuration<=minValue;this.duration=isSetter?minValue:normlizedDuration;this.iterationDuration=isSetter?minValue:normalizeTime(this.iterationDuration*timeScale);this._offset*=timeScale;this._delay*=timeScale;this._loopDelay*=timeScale;return this}revert(){tick(this,0,1,0,tickModes.AUTO);const ap=this._autoplay;if(ap&&ap.linked&&ap.linked===this)ap.revert();return this.cancel()}complete(){return this.seek(this.duration).cancel()}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const createTimer=parameters=>new Timer(parameters,null,0).init();const none=t=>t;const calcBezier=(aT,aA1,aA2)=>(((1-3*aA2+3*aA1)*aT+(3*aA2-6*aA1))*aT+3*aA1)*aT;const binarySubdivide=(aX,mX1,mX2)=>{let aA=0,aB=1,currentX,currentT,i=0;do{currentT=aA+(aB-aA)/2;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0){aB=currentT}else{aA=currentT}}while(abs(currentX)>1e-7&&++i<100);return currentT};const cubicBezier=(mX1=.5,mY1=0,mX2=.5,mY2=1)=>mX1===mY1&&mX2===mY2?none:t=>t===0||t===1?t:calcBezier(binarySubdivide(t,mX1,mX2),mY1,mY2);const steps=(steps=10,fromStart)=>{const roundMethod=fromStart?ceil:floor;return t=>roundMethod(clamp(t,0,1)*steps)*(1/steps)};const linear=(...args)=>{const argsLength=args.length;if(!argsLength)return none;const totalPoints=argsLength-1;const firstArg=args[0];const lastArg=args[totalPoints];const xPoints=[0];const yPoints=[parseNumber(firstArg)];for(let i=1;i<totalPoints;i++){const arg=args[i];const splitValue=isStr(arg)?arg.trim().split(" "):[arg];const value=splitValue[0];const percent=splitValue[1];xPoints.push(!isUnd(percent)?parseNumber(percent)/100:i/totalPoints);yPoints.push(parseNumber(value))}yPoints.push(parseNumber(lastArg));xPoints.push(1);return function easeLinear(t){for(let i=1,l=xPoints.length;i<l;i++){const currentX=xPoints[i];if(t<=currentX){const prevX=xPoints[i-1];const prevY=yPoints[i-1];return prevY+(yPoints[i]-prevY)*(t-prevX)/(currentX-prevX)}}return yPoints[yPoints.length-1]}};const irregular=(length=10,randomness=1)=>{const values=[0];const total=length-1;for(let i=1;i<total;i++){const previousValue=values[i-1];const spacing=i/total;const segmentEnd=(i+1)/total;const randomVariation=spacing+(segmentEnd-spacing)*Math.random();const randomValue=spacing*(1-randomness)+randomVariation*randomness;values.push(clamp(randomValue,previousValue,1))}values.push(1);return linear(...values)};const halfPI=PI/2;const doublePI=PI*2;const easeInPower=(p=1.68)=>t=>pow(t,+p);const easeInFunctions={[emptyString]:easeInPower,Quad:easeInPower(2),Cubic:easeInPower(3),Quart:easeInPower(4),Quint:easeInPower(5),Sine:t=>1-cos(t*halfPI),Circ:t=>1-sqrt(1-t*t),Expo:t=>t?pow(2,10*t-10):0,Bounce:t=>{let pow2,b=4;while(t<((pow2=pow(2,--b))-1)/11);return 1/pow(4,3-b)-7.5625*pow((pow2*3-2)/22-t,2)},Back:(overshoot=1.70158)=>t=>(+overshoot+1)*t*t*t-+overshoot*t*t,Elastic:(amplitude=1,period=.3)=>{const a=clamp(+amplitude,1,10);const p=clamp(+period,minValue,2);const s=p/doublePI*asin(1/a);const e=doublePI/p;return t=>t===0||t===1?t:-a*pow(2,-10*(1-t))*sin((1-t-s)*e)}};const easeTypes={in:easeIn=>t=>easeIn(t),out:easeIn=>t=>1-easeIn(1-t),inOut:easeIn=>t=>t<.5?easeIn(t*2)/2:1-easeIn(t*-2+2)/2,outIn:easeIn=>t=>t<.5?(1-easeIn(1-t*2))/2:(easeIn(t*2-1)+1)/2};const parseEaseString=(string,easesFunctions,easesLookups)=>{if(easesLookups[string])return easesLookups[string];if(string.indexOf("(")<=-1){const hasParams=easeTypes[string]||string.includes("Back")||string.includes("Elastic");const parsedFn=hasParams?easesFunctions[string]():easesFunctions[string];return parsedFn?easesLookups[string]=parsedFn:none}else{const split=string.slice(0,-1).split("(");const parsedFn=easesFunctions[split[0]];return parsedFn?easesLookups[string]=parsedFn(...split[1].split(",")):none}};const eases=(()=>{const list={linear:linear,irregular:irregular,steps:steps,cubicBezier:cubicBezier};for(let type in easeTypes){for(let name in easeInFunctions){const easeIn=easeInFunctions[name];const easeType=easeTypes[type];list[type+name]=name===emptyString||name==="Back"||name==="Elastic"?(a,b)=>easeType(easeIn(a,b)):easeType(easeIn)}}return list})();const JSEasesLookups={linear:none};const parseEasings=ease=>isFnc(ease)?ease:isStr(ease)?parseEaseString(ease,eases,JSEasesLookups):none;const propertyNamesCache={};const sanitizePropertyName=(propertyName,target,tweenType)=>{if(tweenType===tweenTypes.TRANSFORM){const t=shortTransforms.get(propertyName);return t?t:propertyName}else if(tweenType===tweenTypes.CSS||tweenType===tweenTypes.ATTRIBUTE&&(isSvg(target)&&propertyName in target.style)){const cachedPropertyName=propertyNamesCache[propertyName];if(cachedPropertyName){return cachedPropertyName}else{const lowerCaseName=propertyName?toLowerCase(propertyName):propertyName;propertyNamesCache[propertyName]=lowerCaseName;return lowerCaseName}}else{return propertyName}};const angleUnitsMap={deg:1,rad:180/PI,turn:360};const convertedValuesCache={};const convertValueUnit=(el,decomposedValue,unit,force=false)=>{const currentUnit=decomposedValue.u;const currentNumber=decomposedValue.n;if(decomposedValue.t===valueTypes.UNIT&&currentUnit===unit){return decomposedValue}const cachedKey=currentNumber+currentUnit+unit;const cached=convertedValuesCache[cachedKey];if(!isUnd(cached)&&!force){decomposedValue.n=cached}else{let convertedValue;if(currentUnit in angleUnitsMap){convertedValue=currentNumber*angleUnitsMap[currentUnit]/angleUnitsMap[unit]}else{const baseline=100;const tempEl=el.cloneNode();const parentNode=el.parentNode;const parentEl=parentNode&&parentNode!==doc?parentNode:doc.body;parentEl.appendChild(tempEl);const elStyle=tempEl.style;elStyle.width=baseline+currentUnit;const currentUnitWidth=tempEl.offsetWidth||baseline;elStyle.width=baseline+unit;const newUnitWidth=tempEl.offsetWidth||baseline;const factor=currentUnitWidth/newUnitWidth;parentEl.removeChild(tempEl);convertedValue=factor*currentNumber}decomposedValue.n=convertedValue;convertedValuesCache[cachedKey]=convertedValue}decomposedValue.t===valueTypes.UNIT;decomposedValue.u=unit;return decomposedValue};const cleanInlineStyles=renderable=>{if(renderable._hasChildren){forEachChildren(renderable,cleanInlineStyles,true)}else{const animation=renderable;animation.pause();forEachChildren(animation,(tween=>{const tweenProperty=tween.property;const tweenTarget=tween.target;if(tweenTarget[isDomSymbol]){const targetStyle=tweenTarget.style;const originalInlinedValue=animation._inlineStyles[tweenProperty];if(tween._tweenType===tweenTypes.TRANSFORM){const cachedTransforms=tweenTarget[transformsSymbol];if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){delete cachedTransforms[tweenProperty]}else{cachedTransforms[tweenProperty]=originalInlinedValue}if(tween._renderTransforms){if(!Object.keys(cachedTransforms).length){targetStyle.removeProperty("transform")}else{let str=emptyString;for(let key in cachedTransforms){str+=transformsFragmentStrings[key]+cachedTransforms[key]+") "}targetStyle.transform=str}}}else{if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){targetStyle.removeProperty(tweenProperty)}else{targetStyle[tweenProperty]=originalInlinedValue}}if(animation._tail===tween){animation.targets.forEach((t=>{if(t.getAttribute&&t.getAttribute("style")===emptyString){t.removeAttribute("style")}}))}}}))}return renderable};const fromTargetObject=createDecomposedValueTargetObject();const toTargetObject=createDecomposedValueTargetObject();const toFunctionStore={func:null};const keyframesTargetArray=[null];const fastSetValuesArray=[null,null];const keyObjectTarget={to:null};let tweenId=0;let keyframes;let key;const generateKeyframes=(keyframes,parameters)=>{const properties={};if(isArr(keyframes)){const propertyNames=[].concat(...keyframes.map((key=>Object.keys(key)))).filter(isKey);for(let i=0,l=propertyNames.length;i<l;i++){const propName=propertyNames[i];const propArray=keyframes.map((key=>{const newKey={};for(let p in key){const keyValue=key[p];if(isKey(p)){if(p===propName){newKey.to=keyValue}}else{newKey[p]=keyValue}}return newKey}));properties[propName]=propArray}}else{const totalDuration=setValue(parameters.duration,globals.defaults.duration);const keys=Object.keys(keyframes).map((key=>({o:parseFloat(key)/100,p:keyframes[key]}))).sort(((a,b)=>a.o-b.o));keys.forEach((key=>{const offset=key.o;const prop=key.p;for(let name in prop){if(isKey(name)){let propArray=properties[name];if(!propArray)propArray=properties[name]=[];const duration=offset*totalDuration;let length=propArray.length;let prevKey=propArray[length-1];const keyObj={to:prop[name]};let durProgress=0;for(let i=0;i<length;i++){durProgress+=propArray[i].duration}if(length===1){keyObj.from=prevKey.to}if(prop.ease){keyObj.ease=prop.ease}keyObj.duration=duration-(length?durProgress:0);propArray.push(keyObj)}}return key}));for(let name in properties){const propArray=properties[name];let prevEase;for(let i=0,l=propArray.length;i<l;i++){const prop=propArray[i];const currentEase=prop.ease;prop.ease=prevEase?prevEase:undefined;prevEase=currentEase}if(!propArray[0].duration){propArray.shift()}}}return properties};class JSAnimation extends Timer{constructor(targets,parameters,parent,parentPosition,fastSet=false,index=0,length=0){super(parameters,parent,parentPosition);const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;const kfParams=parameters.keyframes;const params=kfParams?mergeObjects(generateKeyframes(kfParams,parameters),parameters):parameters;const{delay:delay,duration:duration,ease:ease,playbackEase:playbackEase,modifier:modifier,composition:composition,onRender:onRender}=params;const animDefaults=parent?parent.defaults:globals.defaults;const animaPlaybackEase=setValue(playbackEase,animDefaults.playbackEase);const animEase=animaPlaybackEase?parseEasings(animaPlaybackEase):null;const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const tEasing=hasSpring?ease.ease:setValue(ease,animEase?"linear":animDefaults.ease);const tDuration=hasSpring?ease.duration:setValue(duration,animDefaults.duration);const tDelay=setValue(delay,animDefaults.delay);const tModifier=modifier||animDefaults.modifier;const tComposition=isUnd(composition)&&targetsLength>=K?compositionTypes.none:!isUnd(composition)?composition:animDefaults.composition;const animInlineStyles={};const absoluteOffsetTime=this._offset+(parent?parent._offset:0);let iterationDuration=NaN;let iterationDelay=NaN;let animationAnimationLength=0;let shouldTriggerRender=0;for(let targetIndex=0;targetIndex<targetsLength;targetIndex++){const target=parsedTargets[targetIndex];const ti=index||targetIndex;const tl=length||targetsLength;let lastTransformGroupIndex=NaN;let lastTransformGroupLength=NaN;for(let p in params){if(isKey(p)){const tweenType=getTweenType(target,p);const propName=sanitizePropertyName(p,target,tweenType);let propValue=params[p];const isPropValueArray=isArr(propValue);if(fastSet&&!isPropValueArray){fastSetValuesArray[0]=propValue;fastSetValuesArray[1]=propValue;propValue=fastSetValuesArray}if(isPropValueArray){const arrayLength=propValue.length;const isNotObjectValue=!isObj(propValue[0]);if(arrayLength===2&&isNotObjectValue){keyObjectTarget.to=propValue;keyframesTargetArray[0]=keyObjectTarget;keyframes=keyframesTargetArray}else if(arrayLength>2&&isNotObjectValue){keyframes=[];propValue.forEach(((v,i)=>{if(!i){fastSetValuesArray[0]=v}else if(i===1){fastSetValuesArray[1]=v;keyframes.push(fastSetValuesArray)}else{keyframes.push(v)}}))}else{keyframes=propValue}}else{keyframesTargetArray[0]=propValue;keyframes=keyframesTargetArray}let siblings=null;let prevTween=null;let firstTweenChangeStartTime=NaN;let lastTweenChangeEndTime=0;let tweenIndex=0;for(let l=keyframes.length;tweenIndex<l;tweenIndex++){const keyframe=keyframes[tweenIndex];if(isObj(keyframe)){key=keyframe}else{keyObjectTarget.to=keyframe;key=keyObjectTarget}toFunctionStore.func=null;const computedToValue=getFunctionValue(key.to,target,ti,tl,toFunctionStore);let tweenToValue;if(isObj(computedToValue)&&!isUnd(computedToValue.to)){key=computedToValue;tweenToValue=computedToValue.to}else{tweenToValue=computedToValue}const tweenFromValue=getFunctionValue(key.from,target,ti,tl);const keyEasing=key.ease;const hasSpring=!isUnd(keyEasing)&&!isUnd(keyEasing.ease);const tweenEasing=hasSpring?keyEasing.ease:keyEasing||tEasing;const tweenDuration=hasSpring?keyEasing.duration:getFunctionValue(setValue(key.duration,l>1?getFunctionValue(tDuration,target,ti,tl)/l:tDuration),target,ti,tl);const tweenDelay=getFunctionValue(setValue(key.delay,!tweenIndex?tDelay:0),target,ti,tl);const computedComposition=getFunctionValue(setValue(key.composition,tComposition),target,ti,tl);const tweenComposition=isNum(computedComposition)?computedComposition:compositionTypes[computedComposition];const tweenModifier=key.modifier||tModifier;const hasFromvalue=!isUnd(tweenFromValue);const hasToValue=!isUnd(tweenToValue);const isFromToArray=isArr(tweenToValue);const isFromToValue=isFromToArray||hasFromvalue&&hasToValue;const tweenStartTime=prevTween?lastTweenChangeEndTime+tweenDelay:tweenDelay;const absoluteStartTime=absoluteOffsetTime+tweenStartTime;if(!shouldTriggerRender&&(hasFromvalue||isFromToArray))shouldTriggerRender=1;let prevSibling=prevTween;if(tweenComposition!==compositionTypes.none){if(!siblings)siblings=getTweenSiblings(target,propName);let nextSibling=siblings._head;while(nextSibling&&!nextSibling._isOverridden&&nextSibling._absoluteStartTime<=absoluteStartTime){prevSibling=nextSibling;nextSibling=nextSibling._nextRep;if(nextSibling&&nextSibling._absoluteStartTime>=absoluteStartTime){while(nextSibling){overrideTween(nextSibling);nextSibling=nextSibling._nextRep}}}}if(isFromToValue){decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[0],target,ti,tl):tweenFromValue,fromTargetObject);decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[1],target,ti,tl,toFunctionStore):tweenToValue,toTargetObject);if(fromTargetObject.t===valueTypes.NUMBER){if(prevSibling){if(prevSibling._valueType===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=prevSibling._unit}}else{decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=decomposedOriginalValue.u}}}}else{if(hasToValue){decomposeRawValue(tweenToValue,toTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,toTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),toTargetObject)}}if(hasFromvalue){decomposeRawValue(tweenFromValue,fromTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,fromTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),fromTargetObject)}}}if(fromTargetObject.o){fromTargetObject.n=getRelativeValue(!prevSibling?decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue).n:prevSibling._toNumber,fromTargetObject.n,fromTargetObject.o)}if(toTargetObject.o){toTargetObject.n=getRelativeValue(fromTargetObject.n,toTargetObject.n,toTargetObject.o)}if(fromTargetObject.t!==toTargetObject.t){if(fromTargetObject.t===valueTypes.COMPLEX||toTargetObject.t===valueTypes.COMPLEX){const complexValue=fromTargetObject.t===valueTypes.COMPLEX?fromTargetObject:toTargetObject;const notComplexValue=fromTargetObject.t===valueTypes.COMPLEX?toTargetObject:fromTargetObject;notComplexValue.t=valueTypes.COMPLEX;notComplexValue.s=cloneArray(complexValue.s);notComplexValue.d=complexValue.d.map((()=>notComplexValue.n))}else if(fromTargetObject.t===valueTypes.UNIT||toTargetObject.t===valueTypes.UNIT){const unitValue=fromTargetObject.t===valueTypes.UNIT?fromTargetObject:toTargetObject;const notUnitValue=fromTargetObject.t===valueTypes.UNIT?toTargetObject:fromTargetObject;notUnitValue.t=valueTypes.UNIT;notUnitValue.u=unitValue.u}else if(fromTargetObject.t===valueTypes.COLOR||toTargetObject.t===valueTypes.COLOR){const colorValue=fromTargetObject.t===valueTypes.COLOR?fromTargetObject:toTargetObject;const notColorValue=fromTargetObject.t===valueTypes.COLOR?toTargetObject:fromTargetObject;notColorValue.t=valueTypes.COLOR;notColorValue.s=colorValue.s;notColorValue.d=[0,0,0,1]}}if(fromTargetObject.u!==toTargetObject.u){let valueToConvert=toTargetObject.u?fromTargetObject:toTargetObject;valueToConvert=convertValueUnit(target,valueToConvert,toTargetObject.u?toTargetObject.u:fromTargetObject.u,false)}if(toTargetObject.d&&fromTargetObject.d&&toTargetObject.d.length!==fromTargetObject.d.length){const longestValue=fromTargetObject.d.length>toTargetObject.d.length?fromTargetObject:toTargetObject;const shortestValue=longestValue===fromTargetObject?toTargetObject:fromTargetObject;shortestValue.d=longestValue.d.map(((_,i)=>isUnd(shortestValue.d[i])?0:shortestValue.d[i]));shortestValue.s=cloneArray(longestValue.s)}const tweenUpdateDuration=round(+tweenDuration||minValue,12);const tween={parent:this,id:tweenId++,property:propName,target:target,_value:null,_func:toFunctionStore.func,_ease:parseEasings(tweenEasing),_fromNumbers:cloneArray(fromTargetObject.d),_toNumbers:cloneArray(toTargetObject.d),_strings:cloneArray(toTargetObject.s),_fromNumber:fromTargetObject.n,_toNumber:toTargetObject.n,_numbers:cloneArray(fromTargetObject.d),_number:fromTargetObject.n,_unit:toTargetObject.u,_modifier:tweenModifier,_currentTime:0,_startTime:tweenStartTime,_delay:+tweenDelay,_updateDuration:tweenUpdateDuration,_changeDuration:tweenUpdateDuration,_absoluteStartTime:absoluteStartTime,_tweenType:tweenType,_valueType:toTargetObject.t,_composition:tweenComposition,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};if(tweenComposition!==compositionTypes.none){composeTween(tween,siblings)}if(isNaN(firstTweenChangeStartTime)){firstTweenChangeStartTime=tween._startTime}lastTweenChangeEndTime=round(tweenStartTime+tweenUpdateDuration,12);prevTween=tween;animationAnimationLength++;addChild(this,tween)}if(isNaN(iterationDelay)||firstTweenChangeStartTime<iterationDelay){iterationDelay=firstTweenChangeStartTime}if(isNaN(iterationDuration)||lastTweenChangeEndTime>iterationDuration){iterationDuration=lastTweenChangeEndTime}if(tweenType===tweenTypes.TRANSFORM){lastTransformGroupIndex=animationAnimationLength-tweenIndex;lastTransformGroupLength=animationAnimationLength}}}if(!isNaN(lastTransformGroupIndex)){let i=0;forEachChildren(this,(tween=>{if(i>=lastTransformGroupIndex&&i<lastTransformGroupLength){tween._renderTransforms=1;if(tween._composition===compositionTypes.blend){forEachChildren(additive.animation,(additiveTween=>{if(additiveTween.id===tween.id){additiveTween._renderTransforms=1}}))}}i++}))}}if(!targetsLength){console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`)}if(iterationDelay){forEachChildren(this,(tween=>{if(!(tween._startTime-tween._delay)){tween._delay-=iterationDelay}tween._startTime-=iterationDelay}));iterationDuration-=iterationDelay}else{iterationDelay=0}if(!iterationDuration){iterationDuration=minValue;this.iterationCount=0}this.targets=parsedTargets;this.duration=iterationDuration===minValue?minValue:clampInfinity((iterationDuration+this._loopDelay)*this.iterationCount-this._loopDelay)||minValue;this.onRender=onRender||animDefaults.onRender;this._ease=animEase;this._delay=iterationDelay;this.iterationDuration=iterationDuration;this._inlineStyles=animInlineStyles;if(!this._autoplay&&shouldTriggerRender)this.onRender(this)}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;forEachChildren(this,(tween=>{tween._updateDuration=normalizeTime(tween._updateDuration*timeScale);tween._changeDuration=normalizeTime(tween._changeDuration*timeScale);tween._currentTime*=timeScale;tween._startTime*=timeScale;tween._absoluteStartTime*=timeScale}));return super.stretch(newDuration)}refresh(){forEachChildren(this,(tween=>{const tweenFunc=tween._func;if(tweenFunc){const ogValue=getOriginalAnimatableValue(tween.target,tween.property,tween._tweenType);decomposeRawValue(ogValue,decomposedOriginalValue);decomposeRawValue(tweenFunc(),toTargetObject);tween._fromNumbers=cloneArray(decomposedOriginalValue.d);tween._fromNumber=decomposedOriginalValue.n;tween._toNumbers=cloneArray(toTargetObject.d);tween._strings=cloneArray(toTargetObject.s);tween._toNumber=toTargetObject.n}}));return this}revert(){super.revert();return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const animate=(targets,parameters)=>new JSAnimation(targets,parameters,null,0,false).init();const easingToLinear=(fn,samples=100)=>{const points=[];for(let i=0;i<=samples;i++)points.push(fn(i/samples));return`linear(${points.join(", ")})`};const WAAPIEasesLookups={in:"ease-in",out:"ease-out",inOut:"ease-in-out"};const WAAPIeases=(()=>{const list={};for(let type in easeTypes)list[type]=a=>easeTypes[type](easeInPower(a));return list})();const parseWAAPIEasing=ease=>{let parsedEase=WAAPIEasesLookups[ease];if(parsedEase)return parsedEase;parsedEase="linear";if(isStr(ease)){if(stringStartsWith(ease,"linear")||stringStartsWith(ease,"cubic-")||stringStartsWith(ease,"steps")||stringStartsWith(ease,"ease")){parsedEase=ease}else if(stringStartsWith(ease,"cubicB")){parsedEase=toLowerCase(ease)}else{const parsed=parseEaseString(ease,WAAPIeases,WAAPIEasesLookups);if(isFnc(parsed))parsedEase=parsed===none?"linear":easingToLinear(parsed)}WAAPIEasesLookups[ease]=parsedEase}else if(isFnc(ease)){const easing=easingToLinear(ease);if(easing)parsedEase=easing}else if(ease.ease){parsedEase=easingToLinear(ease.ease)}return parsedEase};const transformsShorthands=["x","y","z"];const commonDefaultPXProperties=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...transformsShorthands];const validIndividualTransforms=(()=>[...transformsShorthands,...validTransforms.filter((t=>["X","Y","Z"].some((axis=>t.endsWith(axis)))))])();let transformsPropertiesRegistered=null;const WAAPIAnimationsLookups={_head:null,_tail:null};const removeWAAPIAnimation=($el,property,parent)=>{let nextLookup=WAAPIAnimationsLookups._head;while(nextLookup){const next=nextLookup._next;const matchTarget=nextLookup.$el===$el;const matchProperty=!property||nextLookup.property===property;const matchParent=!parent||nextLookup.parent===parent;if(matchTarget&&matchProperty&&matchParent){const anim=nextLookup.animation;try{anim.commitStyles()}catch{}anim.cancel();removeChild(WAAPIAnimationsLookups,nextLookup);const lookupParent=nextLookup.parent;if(lookupParent){lookupParent._completed++;if(lookupParent.animations.length===lookupParent._completed){lookupParent.completed=true;if(!lookupParent.muteCallbacks){lookupParent.paused=true;lookupParent.onComplete(lookupParent);lookupParent._resolve(lookupParent)}}}}nextLookup=next}};const addWAAPIAnimation=(parent,$el,property,keyframes,params)=>{const animation=$el.animate(keyframes,params);const animTotalDuration=params.delay+ +params.duration*params.iterations;animation.playbackRate=parent._speed;if(parent.paused)animation.pause();if(parent.duration<animTotalDuration){parent.duration=animTotalDuration;parent.controlAnimation=animation}parent.animations.push(animation);removeWAAPIAnimation($el,property);addChild(WAAPIAnimationsLookups,{parent:parent,animation:animation,$el:$el,property:property,_next:null,_prev:null});const handleRemove=()=>{removeWAAPIAnimation($el,property,parent)};animation.onremove=handleRemove;animation.onfinish=handleRemove;return animation};const normalizeTweenValue=(propName,value,$el,i,targetsLength)=>{let v=getFunctionValue(value,$el,i,targetsLength);if(!isNum(v))return v;if(commonDefaultPXProperties.includes(propName)||stringStartsWith(propName,"translate"))return`${v}px`;if(stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew"))return`${v}deg`;return`${v}`};const parseIndividualTweenValue=($el,propName,from,to,i,targetsLength)=>{let tweenValue="0";const computedTo=!isUnd(to)?normalizeTweenValue(propName,to,$el,i,targetsLength):getComputedStyle($el)[propName];if(!isUnd(from)){const computedFrom=normalizeTweenValue(propName,from,$el,i,targetsLength);tweenValue=[computedFrom,computedTo]}else{tweenValue=isArr(to)?to.map((v=>normalizeTweenValue(propName,v,$el,i,targetsLength))):computedTo}return tweenValue};class WAAPIAnimation{constructor(targets,params){if(scope.current)scope.current.register(this);if(isNil(transformsPropertiesRegistered)){if(isBrowser&&(isUnd(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"))){transformsPropertiesRegistered=false}else{validTransforms.forEach((t=>{const isSkew=stringStartsWith(t,"skew");const isScale=stringStartsWith(t,"scale");const isRotate=stringStartsWith(t,"rotate");const isTranslate=stringStartsWith(t,"translate");const isAngle=isRotate||isSkew;const syntax=isAngle?"<angle>":isScale?"<number>":isTranslate?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:syntax,inherits:false,initialValue:isTranslate?"0px":isAngle?"0deg":isScale?"1":"0"})}catch{}}));transformsPropertiesRegistered=true}}const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;if(!targetsLength){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=ease.ease&&ease;const autoplay=setValue(params.autoplay,globals.defaults.autoplay);const scroll=autoplay&&autoplay.link?autoplay:false;const alternate=params.alternate&&params.alternate===true;const reversed=params.reversed&&params.reversed===true;const loop=setValue(params.loop,globals.defaults.loop);const iterations=loop===true||loop===Infinity?Infinity:isNum(loop)?loop+1:1;const direction=alternate?reversed?"alternate-reverse":"alternate":reversed?"reverse":"normal";const fill="forwards";const easing=parseWAAPIEasing(ease);const timeScale=globals.timeScale===1?1:K;this.targets=parsedTargets;this.animations=[];this.controlAnimation=null;this.onComplete=params.onComplete||noop;this.duration=0;this.muteCallbacks=false;this.completed=false;this.paused=!autoplay||scroll!==false;this.reversed=reversed;this.autoplay=autoplay;this._speed=setValue(params.playbackRate,globals.defaults.playbackRate);this._resolve=noop;this._completed=0;this._inlineStyles=parsedTargets.map(($el=>$el.getAttribute("style")));parsedTargets.forEach((($el,i)=>{const cachedTransforms=$el[transformsSymbol];const hasIndividualTransforms=validIndividualTransforms.some((t=>params.hasOwnProperty(t)));const duration=(spring?spring.duration:getFunctionValue(setValue(params.duration,globals.defaults.duration),$el,i,targetsLength))*timeScale;const delay=getFunctionValue(setValue(params.delay,globals.defaults.delay),$el,i,targetsLength)*timeScale;const composite=setValue(params.composition,"replace");for(let name in params){if(!isKey(name))continue;const keyframes={};const tweenParams={iterations:iterations,direction:direction,fill:fill,easing:easing,duration:duration,delay:delay,composite:composite};const propertyValue=params[name];const individualTransformProperty=hasIndividualTransforms?validTransforms.includes(name)?name:shortTransforms.get(name):false;let parsedPropertyValue;if(isObj(propertyValue)){const tweenOptions=propertyValue;const tweenOptionsEase=setValue(tweenOptions.ease,ease);const tweenOptionsSpring=tweenOptionsEase.ease&&tweenOptionsEase;const to=tweenOptions.to;const from=tweenOptions.from;tweenParams.duration=(tweenOptionsSpring?tweenOptionsSpring.duration:getFunctionValue(setValue(tweenOptions.duration,duration),$el,i,targetsLength))*timeScale;tweenParams.delay=getFunctionValue(setValue(tweenOptions.delay,delay),$el,i,targetsLength)*timeScale;tweenParams.composite=setValue(tweenOptions.composition,composite);tweenParams.easing=parseWAAPIEasing(tweenOptionsEase);parsedPropertyValue=parseIndividualTweenValue($el,name,from,to,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parseIndividualTweenValue($el,name,from,to,i,targetsLength)}addWAAPIAnimation(this,$el,name,keyframes,tweenParams);if(!isUnd(from)){if(!individualTransformProperty){$el.style[name]=keyframes[name][0]}else{const key=`--${individualTransformProperty}`;$el.style.setProperty(key,keyframes[key][0])}}}else{parsedPropertyValue=isArr(propertyValue)?propertyValue.map((v=>normalizeTweenValue(name,v,$el,i,targetsLength))):normalizeTweenValue(name,propertyValue,$el,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parsedPropertyValue}addWAAPIAnimation(this,$el,name,keyframes,tweenParams)}}if(hasIndividualTransforms){let transforms=emptyString;for(let t in cachedTransforms){transforms+=`${transformsFragmentStrings[t]}var(--${t})) `}$el.style.transform=transforms}}));if(scroll){this.autoplay.link(this)}}forEach(callback){const cb=isStr(callback)?a=>a[callback]():callback;this.animations.forEach(cb);return this}get speed(){return this._speed}set speed(speed){this._speed=+speed;this.forEach((anim=>anim.playbackRate=speed))}get currentTime(){const controlAnimation=this.controlAnimation;const timeScale=globals.timeScale;return this.completed?this.duration:controlAnimation?+controlAnimation.currentTime*(timeScale===1?1:timeScale):0}set currentTime(time){const t=time*(globals.timeScale===1?1:K);this.forEach((anim=>{if(t>=this.duration)anim.play();anim.currentTime=t}))}get progress(){return this.currentTime/this.duration}set progress(progress){this.forEach((anim=>anim.currentTime=progress*this.duration||0))}resume(){if(!this.paused)return this;this.paused=false;return this.forEach("play")}pause(){if(this.paused)return this;this.paused=true;return this.forEach("pause")}alternate(){this.reversed=!this.reversed;this.forEach("reverse");if(this.paused)this.forEach("pause");return this}play(){if(this.reversed)this.alternate();return this.resume()}reverse(){if(!this.reversed)this.alternate();return this.resume()}seek(time,muteCallbacks=false){if(muteCallbacks)this.muteCallbacks=true;if(time<this.duration)this.completed=false;this.currentTime=time;this.muteCallbacks=false;if(this.paused)this.pause();return this}restart(){this.completed=false;return this.seek(0,true).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){this.forEach("cancel");return this.pause()}revert(){this.cancel();this.targets.forEach((($el,i)=>$el.setAttribute("style",this._inlineStyles[i])));return this}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const waapi={animate:(targets,params)=>new WAAPIAnimation(targets,params),convertEase:easingToLinear};const sync=(callback=noop)=>new Timer({duration:1*globals.timeScale,onComplete:callback},null,0).resume();function getTargetValue(targetSelector,propName,unit){const targets=registerTargets(targetSelector);if(!targets.length)return;const[target]=targets;const tweenType=getTweenType(target,propName);const normalizePropName=sanitizePropertyName(propName,target,tweenType);let originalValue=getOriginalAnimatableValue(target,normalizePropName);if(isUnd(unit)){return originalValue}else{decomposeRawValue(originalValue,decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.NUMBER||decomposedOriginalValue.t===valueTypes.UNIT){if(unit===false){return decomposedOriginalValue.n}else{const convertedValue=convertValueUnit(target,decomposedOriginalValue,unit,false);return`${round(convertedValue.n,globals.precision)}${convertedValue.u}`}}}}const setTargetValues=(targets,parameters)=>{if(isUnd(parameters))return;parameters.duration=minValue;parameters.composition=setValue(parameters.composition,compositionTypes.none);return new JSAnimation(targets,parameters,null,0,true).resume()};const removeTargetsFromAnimation=(targetsArray,animation,propertyName)=>{let tweensMatchesTargets=false;forEachChildren(animation,(tween=>{const tweenTarget=tween.target;if(targetsArray.includes(tweenTarget)){const tweenName=tween.property;const tweenType=tween._tweenType;const normalizePropName=sanitizePropertyName(propertyName,tweenTarget,tweenType);if(!normalizePropName||normalizePropName&&normalizePropName===tweenName){if(tween.parent._tail===tween&&tween._tweenType===tweenTypes.TRANSFORM&&tween._prev&&tween._prev._tweenType===tweenTypes.TRANSFORM){tween._prev._renderTransforms=1}removeChild(animation,tween);removeTweenSliblings(tween);tweensMatchesTargets=true}}}),true);return tweensMatchesTargets};const remove=(targets,renderable,propertyName)=>{const targetsArray=parseTargets(targets);const parent=renderable?renderable:engine;const waapiAnimation=renderable&&renderable.controlAnimation&&renderable;for(let i=0,l=targetsArray.length;i<l;i++){const $el=targetsArray[i];removeWAAPIAnimation($el,propertyName,waapiAnimation)}let removeMatches;if(parent._hasChildren){let iterationDuration=0;forEachChildren(parent,(child=>{if(!child._hasChildren){removeMatches=removeTargetsFromAnimation(targetsArray,child,propertyName);if(removeMatches&&!child._head){child.cancel();removeChild(parent,child)}else{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>iterationDuration){iterationDuration=childDur}}}if(child._head){remove(targets,child,propertyName)}else{child._hasChildren=false}}),true);if(!isUnd(parent.iterationDuration)){parent.iterationDuration=iterationDuration}}else{removeMatches=removeTargetsFromAnimation(targetsArray,parent,propertyName)}if(removeMatches&&!parent._head){parent._hasChildren=false;if(parent.cancel)parent.cancel()}return targetsArray};const keepTime=createRefreshable;const randomPick=items=>items[random(0,items.length-1)];const roundPad=(v,decimalLength)=>(+v).toFixed(decimalLength);const padStart=(v,totalLength,padString)=>`${v}`.padStart(totalLength,padString);const padEnd=(v,totalLength,padString)=>`${v}`.padEnd(totalLength,padString);const wrap=(v,min,max)=>((v-min)%(max-min)+(max-min))%(max-min)+min;const mapRange=(value,inLow,inHigh,outLow,outHigh)=>outLow+(value-inLow)/(inHigh-inLow)*(outHigh-outLow);const degToRad=degrees=>degrees*PI/180;const radToDeg=radians=>radians*180/PI;const lerp=(start,end,amount,renderable)=>{let dt=K/globals.defaults.frameRate;if(renderable!==false){const ticker=renderable||engine._hasChildren&&engine;if(ticker&&ticker.deltaTime){dt=ticker.deltaTime}}const t=1-Math.exp(-amount*dt*.1);return!amount?start:amount===1?end:(1-t)*start+t*end};const curry=(fn,last=0)=>(...args)=>last?v=>fn(...args,v):v=>fn(v,...args);const chain=fn=>(...args)=>{const result=fn(...args);return new Proxy(noop,{apply:(_,__,[v])=>result(v),get:(_,prop)=>chain(((...nextArgs)=>{const nextResult=utils[prop](...nextArgs);return v=>nextResult(result(v))}))})};const makeChainable=(fn,right=0)=>(...args)=>(args.length<fn.length?chain(curry(fn,right)):fn)(...args);const utils={$:registerTargets,get:getTargetValue,set:setTargetValues,remove:remove,cleanInlineStyles:cleanInlineStyles,random:random,randomPick:randomPick,shuffle:shuffle,lerp:lerp,sync:sync,keepTime:keepTime,clamp:makeChainable(clamp),round:makeChainable(round),snap:makeChainable(snap),wrap:makeChainable(wrap),interpolate:makeChainable(interpolate,1),mapRange:makeChainable(mapRange),roundPad:makeChainable(roundPad),padStart:makeChainable(padStart),padEnd:makeChainable(padEnd),degToRad:makeChainable(degToRad),radToDeg:makeChainable(radToDeg)};const getPrevChildOffset=(timeline,timePosition)=>{if(stringStartsWith(timePosition,"<")){const goToPrevAnimationOffset=timePosition[1]==="<";const prevAnimation=timeline._tail;const prevOffset=prevAnimation?prevAnimation._offset+prevAnimation._delay:0;return goToPrevAnimationOffset?prevOffset:prevOffset+prevAnimation.duration}};const parseTimelinePosition=(timeline,timePosition)=>{let tlDuration=timeline.iterationDuration;if(tlDuration===minValue)tlDuration=0;if(isUnd(timePosition))return tlDuration;if(isNum(+timePosition))return+timePosition;const timePosStr=timePosition;const tlLabels=timeline?timeline.labels:null;const hasLabels=!isNil(tlLabels);const prevOffset=getPrevChildOffset(timeline,timePosStr);const hasSibling=!isUnd(prevOffset);const matchedRelativeOperator=relativeValuesExecRgx.exec(timePosStr);if(matchedRelativeOperator){const fullOperator=matchedRelativeOperator[0];const split=timePosStr.split(fullOperator);const labelOffset=hasLabels&&split[0]?tlLabels[split[0]]:tlDuration;const parsedOffset=hasSibling?prevOffset:hasLabels?labelOffset:tlDuration;const parsedNumericalOffset=+split[1];return getRelativeValue(parsedOffset,parsedNumericalOffset,fullOperator[0])}else{return hasSibling?prevOffset:hasLabels?!isUnd(tlLabels[timePosStr])?tlLabels[timePosStr]:tlDuration:tlDuration}};function getTimelineTotalDuration(tl){return clampInfinity((tl.iterationDuration+tl._loopDelay)*tl.iterationCount-tl._loopDelay)||minValue}function addTlChild(childParams,tl,timePosition,targets,index,length){const isSetter=isNum(childParams.duration)&&childParams.duration<=minValue;const adjustedPosition=isSetter?timePosition-minValue:timePosition;tick(tl,adjustedPosition,1,1,tickModes.AUTO);const tlChild=targets?new JSAnimation(targets,childParams,tl,adjustedPosition,false,index,length):new Timer(childParams,tl,adjustedPosition);tlChild.init(1);addChild(tl,tlChild);forEachChildren(tl,(child=>{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>tl.iterationDuration)tl.iterationDuration=childDur}));tl.duration=getTimelineTotalDuration(tl);return tl}class Timeline extends Timer{constructor(parameters={}){super(parameters,null,0);this.duration=0;this.labels={};const defaultsParams=parameters.defaults;const globalDefaults=globals.defaults;this.defaults=defaultsParams?mergeObjects(defaultsParams,globalDefaults):globalDefaults;this.onRender=parameters.onRender||globalDefaults.onRender;const tlPlaybackEase=setValue(parameters.playbackEase,globalDefaults.playbackEase);this._ease=tlPlaybackEase?parseEasings(tlPlaybackEase):null;this.iterationDuration=0}add(a1,a2,a3){const isAnim=isObj(a2);const isTimer=isObj(a1);if(isAnim||isTimer){this._hasChildren=true;if(isAnim){const childParams=a2;if(isFnc(a3)){const staggeredPosition=a3;const parsedTargetsArray=parseTargets(a1);const tlDuration=this.duration;const tlIterationDuration=this.iterationDuration;const id=childParams.id;let i=0;const parsedLength=parsedTargetsArray.length;parsedTargetsArray.forEach((target=>{const staggeredChildParams={...childParams};this.duration=tlDuration;this.iterationDuration=tlIterationDuration;if(!isUnd(id))staggeredChildParams.id=id+"-"+i;addTlChild(staggeredChildParams,this,staggeredPosition(target,i,parsedLength,this),target,i,parsedLength);i++}))}else{addTlChild(childParams,this,parseTimelinePosition(this,a3),a1)}}else{addTlChild(a1,this,parseTimelinePosition(this,a2))}return this.init(1)}}sync(synced,position){if(isUnd(synced)||synced&&isUnd(synced.pause))return this;synced.pause();const duration=+(synced.effect?synced.effect.getTiming().duration:synced.duration);return this.add(synced,{currentTime:[0,duration],duration:duration,ease:"linear"},position)}set(targets,parameters,position){if(isUnd(parameters))return this;parameters.duration=minValue;parameters.composition=compositionTypes.replace;return this.add(targets,parameters,position)}call(callback,position){if(isUnd(callback)||callback&&!isFnc(callback))return this;return this.add({duration:0,onComplete:()=>callback(this)},position)}label(labelName,position){if(isUnd(labelName)||labelName&&!isStr(labelName))return this;this.labels[labelName]=parseTimelinePosition(this,position);return this}remove(targets,propertyName){remove(targets,this,propertyName);return this}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;const labels=this.labels;forEachChildren(this,(child=>child.stretch(child.duration*timeScale)));for(let labelName in labels)labels[labelName]*=timeScale;return super.stretch(newDuration)}refresh(){forEachChildren(this,(child=>{if(child.refresh)child.refresh()}));return this}revert(){super.revert();forEachChildren(this,(child=>child.revert),true);return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const createTimeline=parameters=>new Timeline(parameters).init();class Animatable{constructor(targets,parameters){if(scope.current)scope.current.register(this);const globalParams={};const properties={};this.targets=[];this.animations={};if(isUnd(targets)||isUnd(parameters))return;for(let propName in parameters){const paramValue=parameters[propName];if(isKey(propName)){properties[propName]=paramValue}else{globalParams[propName]=paramValue}}for(let propName in properties){const propValue=properties[propName];const isObjValue=isObj(propValue);let propParams={};let to="+=0";if(isObjValue){const unit=propValue.unit;if(isStr(unit))to+=unit}else{propParams.duration=propValue}propParams[propName]=isObjValue?mergeObjects({to:to},propValue):to;const animParams=mergeObjects(globalParams,propParams);animParams.composition=compositionTypes.replace;animParams.autoplay=false;const animation=this.animations[propName]=new JSAnimation(targets,animParams,null,0,false).init();if(!this.targets.length)this.targets.push(...animation.targets);this[propName]=(to,duration,ease)=>{const tween=animation._head;if(isUnd(to)&&tween){const numbers=tween._numbers;if(numbers&&numbers.length){return numbers}else{return tween._modifier(tween._number)}}else{forEachChildren(animation,(tween=>{if(isArr(to)){for(let i=0,l=to.length;i<l;i++){if(!isUnd(tween._numbers[i])){tween._fromNumbers[i]=tween._modifier(tween._numbers[i]);tween._toNumbers[i]=to[i]}}}else{tween._fromNumber=tween._modifier(tween._number);tween._toNumber=to}if(!isUnd(ease))tween._ease=parseEasings(ease);tween._currentTime=0}));if(!isUnd(duration))animation.stretch(duration);animation.reset(1).resume();return this}}}}revert(){for(let propName in this.animations){this[propName]=noop;this.animations[propName].revert()}this.animations={};this.targets.length=0;return this}}const createAnimatable=(targets,parameters)=>new Animatable(targets,parameters);class Spring{constructor(parameters={}){this.timeStep=.02;this.restThreshold=5e-4;this.restDuration=200;this.maxDuration=6e4;this.maxRestSteps=this.restDuration/this.timeStep/K;this.maxIterations=this.maxDuration/this.timeStep/K;this.m=clamp(setValue(parameters.mass,1),0,K);this.s=clamp(setValue(parameters.stiffness,100),1,K);this.d=clamp(setValue(parameters.damping,10),.1,K);this.v=clamp(setValue(parameters.velocity,0),-1e3,K);this.w0=0;this.zeta=0;this.wd=0;this.b=0;this.solverDuration=0;this.duration=0;this.compute();this.ease=t=>t===0||t===1?t:this.solve(t*this.solverDuration)}solve(time){const{zeta:zeta,w0:w0,wd:wd,b:b}=this;let t=time;if(zeta<1){t=exp(-t*zeta*w0)*(1*cos(wd*t)+b*sin(wd*t))}else{t=(1+b*t)*exp(-t*w0)}return 1-t}compute(){const{maxRestSteps:maxRestSteps,maxIterations:maxIterations,restThreshold:restThreshold,timeStep:timeStep,m:m,d:d,s:s,v:v}=this;const w0=this.w0=clamp(sqrt(s/m),minValue,K);const zeta=this.zeta=d/(2*sqrt(s*m));const wd=this.wd=zeta<1?w0*sqrt(1-zeta*zeta):0;this.b=zeta<1?(zeta*w0+-v)/wd:-v+w0;let solverTime=0;let restSteps=0;let iterations=0;while(restSteps<maxRestSteps&&iterations<maxIterations){if(abs(1-this.solve(solverTime))<restThreshold){restSteps++}else{restSteps=0}this.solverDuration=solverTime;solverTime+=timeStep;iterations++}this.duration=round(this.solverDuration*K,0)*globals.timeScale}get mass(){return this.m}set mass(v){this.m=clamp(setValue(v,1),0,K);this.compute()}get stiffness(){return this.s}set stiffness(v){this.s=clamp(setValue(v,100),1,K);this.compute()}get damping(){return this.d}set damping(v){this.d=clamp(setValue(v,10),.1,K);this.compute()}get velocity(){return this.v}set velocity(v){this.v=clamp(setValue(v,0),-1e3,K);this.compute()}}const createSpring=parameters=>new Spring(parameters);const preventDefault=e=>{if(e.cancelable)e.preventDefault()};class DOMProxy{constructor(el){this.el=el;this.zIndex=0;this.parentElement=null;this.classList={add:noop,remove:noop}}get x(){return this.el.x||0}set x(v){this.el.x=v}get y(){return this.el.y||0}set y(v){this.el.y=v}get width(){return this.el.width||0}set width(v){this.el.width=v}get height(){return this.el.height||0}set height(v){this.el.height=v}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Transforms{constructor($el){this.$el=$el;this.inlineTransforms=[];this.point=new DOMPoint;this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(x,y){this.point.x=x;this.point.y=y;return this.point.matrixTransform(this.inversedMatrix)}traverseUp(cb){let $el=this.$el.parentElement,i=0;while($el&&$el!==doc){cb($el,i);$el=$el.parentElement;i++}}getMatrix(){const matrix=new DOMMatrix;this.traverseUp(($el=>{const transformValue=getComputedStyle($el).transform;if(transformValue){const elMatrix=new DOMMatrix(transformValue);matrix.preMultiplySelf(elMatrix)}}));return matrix}remove(){this.traverseUp((($el,i)=>{this.inlineTransforms[i]=$el.style.transform;$el.style.transform="none"}))}revert(){this.traverseUp((($el,i)=>{const ct=this.inlineTransforms[i];if(ct===""){$el.style.removeProperty("transform")}else{$el.style.transform=ct}}))}}const parseDraggableFunctionParameter=(value,draggable)=>value&&isFnc(value)?value(draggable):value;let zIndex=0;class Draggable{constructor(target,parameters={}){if(!target)return;if(scope.current)scope.current.register(this);const paramX=parameters.x;const paramY=parameters.y;const trigger=parameters.trigger;const modifier=parameters.modifier;const ease=parameters.releaseEase;const customEase=ease&&parseEasings(ease);const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const xProp=isObj(paramX)&&!isUnd(paramX.mapTo)?paramX.mapTo:"translateX";const yProp=isObj(paramY)&&!isUnd(paramY.mapTo)?paramY.mapTo:"translateY";const container=parseDraggableFunctionParameter(parameters.container,this);this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.$target=isObj(target)?new DOMProxy(target):parseTargets(target)[0];this.$trigger=parseTargets(trigger?trigger:target)[0];this.fixed=getTargetValue(this.$target,"position")==="fixed";this.isFinePointer=true;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.maxVelocity=0;this.minVelocity=0;this.velocityMultiplier=0;this.cursor=false;this.releaseXSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseYSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseEase=customEase||eases.outQuint;this.hasReleaseSpring=hasSpring;this.onGrab=parameters.onGrab||noop;this.onDrag=parameters.onDrag||noop;this.onRelease=parameters.onRelease||noop;this.onUpdate=parameters.onUpdate||noop;this.onSettle=parameters.onSettle||noop;this.onSnap=parameters.onSnap||noop;this.onResize=parameters.onResize||noop;this.onAfterResize=parameters.onAfterResize||noop;this.disabled=[0,0];const animatableParams={};if(modifier)animatableParams.modifier=modifier;if(isUnd(paramX)||paramX===true){animatableParams[xProp]=0}else if(isObj(paramX)){const paramXObject=paramX;const animatableXParams={};if(paramXObject.modifier)animatableXParams.modifier=paramXObject.modifier;if(paramXObject.composition)animatableXParams.composition=paramXObject.composition;animatableParams[xProp]=animatableXParams}else if(paramX===false){animatableParams[xProp]=0;this.disabled[0]=1}if(isUnd(paramY)||paramY===true){animatableParams[yProp]=0}else if(isObj(paramY)){const paramYObject=paramY;const animatableYParams={};if(paramYObject.modifier)animatableYParams.modifier=paramYObject.modifier;if(paramYObject.composition)animatableYParams.composition=paramYObject.composition;animatableParams[yProp]=animatableYParams}else if(paramY===false){animatableParams[yProp]=0;this.disabled[1]=1}this.animate=new Animatable(this.$target,animatableParams);this.xProp=xProp;this.yProp=yProp;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=[-1e12,maxValue,maxValue,-1e12];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=now();this.velocity=0;this.angle=0;this.cursorStyles=null;this.triggerStyles=null;this.bodyStyles=null;this.targetStyles=null;this.touchActionStyles=null;this.transforms=new Transforms(this.$target);this.overshootCoords={x:0,y:0};this.overshootXTicker=new Timer({autoplay:false},null,0).init();this.overshootYTicker=new Timer({autoplay:false},null,0).init();this.updateTicker=new Timer({autoplay:false},null,0).init();this.overshootXTicker.onUpdate=()=>{if(this.disabled[0])return;this.updated=true;this.manual=true;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootXTicker.onComplete=()=>{if(this.disabled[0])return;this.manual=false;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootYTicker.onUpdate=()=>{if(this.disabled[1])return;this.updated=true;this.manual=true;this.animate[this.yProp](this.overshootCoords.y,0)};this.overshootYTicker.onComplete=()=>{if(this.disabled[1])return;this.manual=false;this.animate[this.yProp](this.overshootCoords.y,0)};this.updateTicker.onUpdate=()=>this.update();this.contained=!isUnd(container);this.manual=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.enabled=false;this.initialized=false;this.activeProp=this.disabled[1]?xProp:yProp;this.animate.animations[this.activeProp].onRender=()=>{const hasUpdated=this.updated;const hasMoved=this.grabbed&&hasUpdated;const hasReleased=!hasMoved&&this.released;const x=this.x;const y=this.y;const dx=x-this.coords[2];const dy=y-this.coords[3];this.deltaX=dx;this.deltaY=dy;this.coords[2]=x;this.coords[3]=y;if(hasUpdated){this.onUpdate(this)}if(!hasReleased){this.updated=false}else{this.computeVelocity(dx,dy);this.angle=atan2(dy,dx)}};this.animate.animations[this.activeProp].onComplete=()=>{if(!this.grabbed&&this.released){this.released=false}if(!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 Timer({autoplay:false,duration:150*globals.timeScale,onComplete:()=>{this.onResize(this);this.refresh();this.onAfterResize(this)}}).init();this.parameters=parameters;this.resizeObserver=new ResizeObserver((()=>{if(this.initialized){this.resizeTicker.restart()}else{this.initialized=true}}));this.enable();this.refresh();this.resizeObserver.observe(this.$container);if(!isObj(target))this.resizeObserver.observe(this.$target)}computeVelocity(dx,dy){const prevTime=this.velocityTime;const curTime=now();const elapsed=curTime-prevTime;if(elapsed<17)return this.velocity;this.velocityTime=curTime;const velocityStack=this.velocityStack;const vMul=this.velocityMultiplier;const minV=this.minVelocity;const maxV=this.maxVelocity;const vi=this.velocityStackIndex;velocityStack[vi]=round(clamp(sqrt(dx*dx+dy*dy)/elapsed*vMul,minV,maxV),5);const velocity=max(velocityStack[0],velocityStack[1],velocityStack[2]);this.velocity=velocity;this.velocityStackIndex=(vi+1)%3;return velocity}setX(x,muteUpdateCallback=false){if(this.disabled[0])return;const v=round(x,5);this.overshootXTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destX=v;this.snapped[0]=snap(v,this.snapX);this.animate[this.xProp](v,0);this.manual=false;return this}setY(y,muteUpdateCallback=false){if(this.disabled[1])return;const v=round(y,5);this.overshootYTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destY=v;this.snapped[1]=snap(v,this.snapY);this.animate[this.yProp](v,0);this.manual=false;return this}get x(){return round(this.animate[this.xProp](),globals.precision)}set x(x){this.setX(x,false)}get y(){return round(this.animate[this.yProp](),globals.precision)}set y(y){this.setY(y,false)}get progressX(){return mapRange(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(x){this.setX(mapRange(x,0,1,this.containerBounds[3],this.containerBounds[1]),false)}get progressY(){return mapRange(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(y){this.setY(mapRange(y,0,1,this.containerBounds[0],this.containerBounds[2]),false)}updateScrollCoords(){const sx=round(this.useWin?win.scrollX:this.$container.scrollLeft,0);const sy=round(this.useWin?win.scrollY:this.$container.scrollTop,0);const[cpt,cpr,cpb,cpl]=this.containerPadding;const threshold=this.scrollThreshold;this.scroll.x=sx;this.scroll.y=sy;this.scrollBounds[0]=sy-this.targetBounds[0]+cpt-threshold;this.scrollBounds[1]=sx-this.targetBounds[1]-cpr+threshold;this.scrollBounds[2]=sy-this.targetBounds[2]-cpb+threshold;this.scrollBounds[3]=sx-this.targetBounds[3]+cpl-threshold}updateBoundingValues(){const $container=this.$container;const cx=this.x;const cy=this.y;const cx2=this.coords[2];const cy2=this.coords[3];this.coords[2]=0;this.coords[3]=0;this.setX(0,true);this.setY(0,true);this.transforms.remove();const iw=this.window[0]=win.innerWidth;const ih=this.window[1]=win.innerHeight;const uw=this.useWin;const sw=$container.scrollWidth;const sh=$container.scrollHeight;const fx=this.fixed;const transformContainerRect=$container.getBoundingClientRect();const[cpt,cpr,cpb,cpl]=this.containerPadding;this.dragArea[0]=uw?0:transformContainerRect.left;this.dragArea[1]=uw?0:transformContainerRect.top;this.scrollView[0]=uw?clamp(sw,iw,sw):sw;this.scrollView[1]=uw?clamp(sh,ih,sh):sh;this.updateScrollCoords();const{width:width,height:height,left:left,top:top,right:right,bottom:bottom}=$container.getBoundingClientRect();this.dragArea[2]=round(uw?clamp(width,iw,iw):width,0);this.dragArea[3]=round(uw?clamp(height,ih,ih):height,0);const containerOverflow=getTargetValue($container,"overflow");const visibleOverflow=containerOverflow==="visible";const hiddenOverflow=containerOverflow==="hidden";this.canScroll=fx?false:this.contained&&($container===doc.body&&visibleOverflow||!hiddenOverflow&&!visibleOverflow)&&(sw>this.dragArea[2]+cpl-cpr||sh>this.dragArea[3]+cpt-cpb)&&(!this.containerArray||this.containerArray&&!isArr(this.containerArray));if(this.contained){const sx=this.scroll.x;const sy=this.scroll.y;const canScroll=this.canScroll;const targetRect=this.$target.getBoundingClientRect();const hiddenLeft=canScroll?uw?0:$container.scrollLeft:0;const hiddenTop=canScroll?uw?0:$container.scrollTop:0;const hiddenRight=canScroll?this.scrollView[0]-hiddenLeft-width:0;const hiddenBottom=canScroll?this.scrollView[1]-hiddenTop-height:0;this.targetBounds[0]=round(targetRect.top+sy-(uw?0:top),0);this.targetBounds[1]=round(targetRect.right+sx-(uw?iw:right),0);this.targetBounds[2]=round(targetRect.bottom+sy-(uw?ih:bottom),0);this.targetBounds[3]=round(targetRect.left+sx-(uw?0:left),0);if(this.containerArray){this.containerBounds[0]=this.containerArray[0]+cpt;this.containerBounds[1]=this.containerArray[1]-cpr;this.containerBounds[2]=this.containerArray[2]-cpb;this.containerBounds[3]=this.containerArray[3]+cpl}else{this.containerBounds[0]=-round(targetRect.top-(fx?clamp(top,0,ih):top)+hiddenTop-cpt,0);this.containerBounds[1]=-round(targetRect.right-(fx?clamp(right,0,iw):right)-hiddenRight+cpr,0);this.containerBounds[2]=-round(targetRect.bottom-(fx?clamp(bottom,0,ih):bottom)-hiddenBottom+cpb,0);this.containerBounds[3]=-round(targetRect.left-(fx?clamp(left,0,iw):left)+hiddenLeft-cpl,0)}}this.transforms.revert();this.coords[2]=cx2;this.coords[3]=cy2;this.setX(cx,true);this.setY(cy,true)}isOutOfBounds(bounds,x,y){if(!this.contained)return 0;const[bt,br,bb,bl]=bounds;const[dx,dy]=this.disabled;const obx=!dx&&x<bl||!dx&&x>br;const oby=!dy&&y<bt||!dy&&y>bb;return obx&&!oby?1:!obx&&oby?2:obx&&oby?3:0}refresh(){const params=this.parameters;const paramX=params.x;const paramY=params.y;const container=parseDraggableFunctionParameter(params.container,this);const cp=parseDraggableFunctionParameter(params.containerPadding,this)||0;const containerPadding=isArr(cp)?cp:[cp,cp,cp,cp];const cx=this.x;const cy=this.y;const parsedCursorStyles=parseDraggableFunctionParameter(params.cursor,this);const cursorStyles={onHover:"grab",onGrab:"grabbing"};if(parsedCursorStyles){const{onHover:onHover,onGrab:onGrab}=parsedCursorStyles;if(onHover)cursorStyles.onHover=onHover;if(onGrab)cursorStyles.onGrab=onGrab}this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.isFinePointer=matchMedia("(pointer:fine)").matches;this.containerPadding=setValue(containerPadding,[0,0,0,0]);this.containerFriction=clamp(setValue(parseDraggableFunctionParameter(params.containerFriction,this),.8),0,1);this.releaseContainerFriction=clamp(setValue(parseDraggableFunctionParameter(params.releaseContainerFriction,this),this.containerFriction),0,1);this.snapX=parseDraggableFunctionParameter(isObj(paramX)&&!isUnd(paramX.snap)?paramX.snap:params.snap,this);this.snapY=parseDraggableFunctionParameter(isObj(paramY)&&!isUnd(paramY.snap)?paramY.snap:params.snap,this);this.scrollSpeed=setValue(parseDraggableFunctionParameter(params.scrollSpeed,this),1.5);this.scrollThreshold=setValue(parseDraggableFunctionParameter(params.scrollThreshold,this),20);this.dragSpeed=setValue(parseDraggableFunctionParameter(params.dragSpeed,this),1);this.minVelocity=setValue(parseDraggableFunctionParameter(params.minVelocity,this),0);this.maxVelocity=setValue(parseDraggableFunctionParameter(params.maxVelocity,this),50);this.velocityMultiplier=setValue(parseDraggableFunctionParameter(params.velocityMultiplier,this),1);this.cursor=parsedCursorStyles===false?false:cursorStyles;this.updateBoundingValues();const[bt,br,bb,bl]=this.containerBounds;this.setX(clamp(cx,bl,br),true);this.setY(clamp(cy,bt,bb),true)}update(){this.updateScrollCoords();if(this.canScroll){const[cpt,cpr,cpb,cpl]=this.containerPadding;const[sw,sh]=this.scrollView;const daw=this.dragArea[2];const dah=this.dragArea[3];const csx=this.scroll.x;const csy=this.scroll.y;const nsw=this.$container.scrollWidth;const nsh=this.$container.scrollHeight;const csw=this.useWin?clamp(nsw,this.window[0],nsw):nsw;const csh=this.useWin?clamp(nsh,this.window[1],nsh):nsh;const swd=sw-csw;const shd=sh-csh;if(this.dragged&&swd>0){this.coords[0]-=swd;this.scrollView[0]=csw}if(this.dragged&&shd>0){this.coords[1]-=shd;this.scrollView[1]=csh}const s=this.scrollSpeed*10;const threshold=this.scrollThreshold;const[x,y]=this.coords;const[st,sr,sb,sl]=this.scrollBounds;const t=round(clamp((y-st+cpt)/threshold,-1,0)*s,0);const r=round(clamp((x-sr-cpr)/threshold,0,1)*s,0);const b=round(clamp((y-sb-cpb)/threshold,0,1)*s,0);const l=round(clamp((x-sl+cpl)/threshold,-1,0)*s,0);if(t||b||l||r){const[nx,ny]=this.disabled;let scrollX=csx;let scrollY=csy;if(!nx){scrollX=round(clamp(csx+(l||r),0,sw-daw),0);this.coords[0]-=csx-scrollX}if(!ny){scrollY=round(clamp(csy+(t||b),0,sh-dah),0);this.coords[1]-=csy-scrollY}if(this.useWin){this.$scrollContainer.scrollBy(-(csx-scrollX),-(csy-scrollY))}else{this.$scrollContainer.scrollTo(scrollX,scrollY)}}}const[ct,cr,cb,cl]=this.containerBounds;const[px1,py1,px2,py2,px3,py3]=this.pointer;this.coords[0]+=(px1-px3)*this.dragSpeed;this.coords[1]+=(py1-py3)*this.dragSpeed;this.pointer[4]=px1;this.pointer[5]=py1;const[cx,cy]=this.coords;const[sx,sy]=this.snapped;const cf=(1-this.containerFriction)*this.dragSpeed;this.setX(cx>cr?cr+(cx-cr)*cf:cx<cl?cl+(cx-cl)*cf:cx,false);this.setY(cy>cb?cb+(cy-cb)*cf:cy<ct?ct+(cy-ct)*cf:cy,false);this.computeVelocity(px1-px3,py1-py3);this.angle=atan2(py1-py2,px1-px2);const[nsx,nsy]=this.snapped;if(nsx!==sx&&this.snapX||nsy!==sy&&this.snapY){this.onSnap(this)}}stop(){this.updateTicker.pause();this.overshootXTicker.pause();this.overshootYTicker.pause();for(let prop in this.animate.animations)this.animate.animations[prop].pause();remove(this,null,"x");remove(this,null,"y");remove(this,null,"progressX");remove(this,null,"progressY");remove(this.scroll);remove(this.overshootCoords);return this}scrollInView(duration,gap=0,ease=eases.inOutQuad){this.updateScrollCoords();const x=this.destX;const y=this.destY;const scroll=this.scroll;const scrollBounds=this.scrollBounds;const canScroll=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(scrollBounds,x,y)){const[st,sr,sb,sl]=scrollBounds;const t=round(clamp(y-st,-1e12,0),0);const r=round(clamp(x-sr,0,maxValue),0);const b=round(clamp(y-sb,0,maxValue),0);const l=round(clamp(x-sl,-1e12,0),0);new JSAnimation(scroll,{x:round(scroll.x+(l?l-gap:r?r+gap:0),0),y:round(scroll.y+(t?t-gap:b?b+gap:0),0),duration:isUnd(duration)?350*globals.timeScale:duration,ease:ease,onUpdate:()=>{this.canScroll=false;this.$scrollContainer.scrollTo(scroll.x,scroll.y)}}).init().then((()=>{this.canScroll=canScroll}))}return this}handleHover(){if(this.isFinePointer&&this.cursor&&!this.cursorStyles){this.cursorStyles=setTargetValues(this.$trigger,{cursor:this.cursor.onHover})}}animateInView(duration,gap=0,ease=eases.inOutQuad){this.stop();this.updateBoundingValues();const x=this.x;const y=this.y;const[cpt,cpr,cpb,cpl]=this.containerPadding;const bt=this.scroll.y-this.targetBounds[0]+cpt+gap;const br=this.scroll.x-this.targetBounds[1]-cpr-gap;const bb=this.scroll.y-this.targetBounds[2]-cpb-gap;const bl=this.scroll.x-this.targetBounds[3]+cpl+gap;const ob=this.isOutOfBounds([bt,br,bb,bl],x,y);if(ob){const[disabledX,disabledY]=this.disabled;const destX=clamp(snap(x,this.snapX),bl,br);const destY=clamp(snap(y,this.snapY),bt,bb);const dur=isUnd(duration)?350*globals.timeScale:duration;if(!disabledX&&(ob===1||ob===3))this.animate[this.xProp](destX,dur,ease);if(!disabledY&&(ob===2||ob===3))this.animate[this.yProp](destY,dur,ease)}return this}handleDown(e){const $eTarget=e.target;if(this.grabbed||$eTarget.type==="range")return;e.stopPropagation();this.grabbed=true;this.released=false;this.stop();this.updateBoundingValues();const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const[ct,cr,cb,cl]=this.containerBounds;const cf=(1-this.containerFriction)*this.dragSpeed;const cx=this.x;const cy=this.y;this.coords[0]=this.coords[2]=!cf?cx:cx>cr?cr+(cx-cr)/cf:cx<cl?cl+(cx-cl)/cf:cx;this.coords[1]=this.coords[3]=!cf?cy:cy>cb?cb+(cy-cb)/cf:cy<ct?ct+(cy-ct)/cf:cy;this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y;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;if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}const z=getTargetValue(this.$target,"zIndex",false);zIndex=(z>zIndex?z:zIndex)+1;this.targetStyles=setTargetValues(this.$target,{zIndex:zIndex});if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.isFinePointer&&this.cursor){this.bodyStyles=setTargetValues(doc.body,{cursor:this.cursor.onGrab})}this.scrollInView(100,0,eases.out(3));this.onGrab(this);doc.addEventListener("touchmove",this);doc.addEventListener("touchend",this);doc.addEventListener("touchcancel",this);doc.addEventListener("mousemove",this);doc.addEventListener("mouseup",this);doc.addEventListener("selectstart",this)}handleMove(e){if(!this.grabbed)return;const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const movedX=x-this.pointer[6];const movedY=y-this.pointer[7];let $parent=e.target;let isAtTop=false;let isAtBottom=false;let canTouchScroll=false;while(touches&&$parent&&$parent!==this.$trigger){const overflowY=getTargetValue($parent,"overflow-y");if(overflowY!=="hidden"&&overflowY!=="visible"){const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=$parent;if(scrollHeight>clientHeight){canTouchScroll=true;isAtTop=scrollTop<=3;isAtBottom=scrollTop>=scrollHeight-clientHeight-3;break}}$parent=$parent.parentNode}if(canTouchScroll&&(!isAtTop&&!isAtBottom||isAtTop&&movedY<0||isAtBottom&&movedY>0)){this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y}else{preventDefault(e);if(!this.triggerStyles)this.triggerStyles=setTargetValues(this.$trigger,{pointerEvents:"none"});this.$trigger.addEventListener("touchstart",preventDefault,{passive:false});this.$trigger.addEventListener("touchmove",preventDefault,{passive:false});this.$trigger.addEventListener("touchend",preventDefault);if(!this.disabled[0]&&abs(movedX)>3||!this.disabled[1]&&abs(movedY)>3){this.updateTicker.resume();this.pointer[2]=this.pointer[0];this.pointer[3]=this.pointer[1];this.pointer[0]=x;this.pointer[1]=y;this.dragged=true;this.released=false;this.onDrag(this)}}}handleUp(){if(!this.grabbed)return;this.updateTicker.pause();if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}const[disabledX,disabledY]=this.disabled;const[px1,py1,px2,py2,px3,py3]=this.pointer;const[ct,cr,cb,cl]=this.containerBounds;const[sx,sy]=this.snapped;const springX=this.releaseXSpring;const springY=this.releaseYSpring;const releaseEase=this.releaseEase;const hasReleaseSpring=this.hasReleaseSpring;const overshootCoords=this.overshootCoords;const cx=this.x;const cy=this.y;const pv=this.computeVelocity(px1-px3,py1-py3);const pa=this.angle=atan2(py1-py2,px1-px2);const ds=pv*150;const cf=(1-this.releaseContainerFriction)*this.dragSpeed;const nx=cx+cos(pa)*ds;const ny=cy+sin(pa)*ds;const bx=nx>cr?cr+(nx-cr)*cf:nx<cl?cl+(nx-cl)*cf:nx;const by=ny>cb?cb+(ny-cb)*cf:ny<ct?ct+(ny-ct)*cf:ny;const dx=this.destX=clamp(round(snap(bx,this.snapX),5),cl,cr);const dy=this.destY=clamp(round(snap(by,this.snapY),5),ct,cb);const ob=this.isOutOfBounds(this.containerBounds,nx,ny);let durationX=0;let durationY=0;let easeX=releaseEase;let easeY=releaseEase;let longestReleaseDuration=0;overshootCoords.x=cx;overshootCoords.y=cy;if(!disabledX){const directionX=dx===cr?cx>cr?-1:1:cx<cl?-1:1;const distanceX=round(cx-dx,0);springX.velocity=disabledY&&hasReleaseSpring?distanceX?ds*directionX/abs(distanceX):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springX;durationX=cx===dx?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeX=ease;if(durationX>longestReleaseDuration)longestReleaseDuration=durationX}if(!disabledY){const directionY=dy===cb?cy>cb?-1:1:cy<ct?-1:1;const distanceY=round(cy-dy,0);springY.velocity=disabledX&&hasReleaseSpring?distanceY?ds*directionY/abs(distanceY):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springY;durationY=cy===dy?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeY=ease;if(durationY>longestReleaseDuration)longestReleaseDuration=durationY}if(!hasReleaseSpring&&ob&&cf&&(durationX||durationY)){const composition=compositionTypes.blend;new JSAnimation(overshootCoords,{x:{to:bx,duration:durationX*.65},y:{to:by,duration:durationY*.65},ease:releaseEase,composition:composition}).init();new JSAnimation(overshootCoords,{x:{to:dx,duration:durationX},y:{to:dy,duration:durationY},ease:releaseEase,composition:composition}).init();this.overshootXTicker.stretch(durationX).restart();this.overshootYTicker.stretch(durationY).restart()}else{if(!disabledX)this.animate[this.xProp](dx,durationX,easeX);if(!disabledY)this.animate[this.yProp](dy,durationY,easeY)}this.scrollInView(longestReleaseDuration,this.scrollThreshold,releaseEase);let hasSnapped=false;if(dx!==sx){this.snapped[0]=dx;if(this.snapX)hasSnapped=true}if(dy!==sy&&this.snapY){this.snapped[1]=dy;if(this.snapY)hasSnapped=true}if(hasSnapped)this.onSnap(this);this.grabbed=false;this.dragged=false;this.updated=true;this.released=true;this.onRelease(this);this.$trigger.removeEventListener("touchstart",preventDefault);this.$trigger.removeEventListener("touchmove",preventDefault);this.$trigger.removeEventListener("touchend",preventDefault);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this)}reset(){this.stop();this.resizeTicker.pause();this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.setX(0,true);this.setY(0,true);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;return this}enable(){if(!this.enabled){this.enabled=true;this.$target.classList.remove("is-disabled");this.touchActionStyles=setTargetValues(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"});this.$trigger.addEventListener("touchstart",this,{passive:true});this.$trigger.addEventListener("mousedown",this,{passive:true});this.$trigger.addEventListener("mouseenter",this)}return this}disable(){this.enabled=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.touchActionStyles.revert();if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}this.stop();this.$target.classList.add("is-disabled");this.$trigger.removeEventListener("touchstart",this);this.$trigger.removeEventListener("mousedown",this);this.$trigger.removeEventListener("mouseenter",this);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this);return this}revert(){this.reset();this.disable();this.$target.classList.remove("is-disabled");this.updateTicker.revert();this.overshootXTicker.revert();this.overshootYTicker.revert();this.resizeTicker.revert();this.animate.revert();return this}handleEvent(e){switch(e.type){case"mousedown":this.handleDown(e);break;case"touchstart":this.handleDown(e);break;case"mousemove":this.handleMove(e);break;case"touchmove":this.handleMove(e);break;case"mouseup":this.handleUp();break;case"touchend":this.handleUp();break;case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":preventDefault(e);break}}}const createDraggable=(target,parameters)=>new Draggable(target,parameters);class Scope{constructor(parameters={}){if(scope.current)scope.current.register(this);const rootParam=parameters.root;let root=doc;if(rootParam){root=rootParam.current||rootParam.nativeElement||parseTargets(rootParam)[0]||doc}const scopeDefaults=parameters.defaults;const globalDefault=globals.defaults;const mediaQueries=parameters.mediaQueries;this.defaults=scopeDefaults?mergeObjects(scopeDefaults,globalDefault):globalDefault;this.root=root;this.constructors=[];this.revertConstructors=[];this.revertibles=[];this.constructorsOnce=[];this.revertConstructorsOnce=[];this.revertiblesOnce=[];this.once=false;this.onceIndex=0;this.methods={};this.matches={};this.mediaQueryLists={};this.data={};if(mediaQueries){for(let mq in mediaQueries){const _mq=win.matchMedia(mediaQueries[mq]);this.mediaQueryLists[mq]=_mq;_mq.addEventListener("change",this)}}}register(revertible){const store=this.once?this.revertiblesOnce:this.revertibles;store.push(revertible)}execute(cb){let activeScope=scope.current;let activeRoot=scope.root;let activeDefaults=globals.defaults;scope.current=this;scope.root=this.root;globals.defaults=this.defaults;const mqs=this.mediaQueryLists;for(let mq in mqs)this.matches[mq]=mqs[mq].matches;const returned=cb(this);scope.current=activeScope;scope.root=activeRoot;globals.defaults=activeDefaults;return returned}refresh(){this.onceIndex=0;this.execute((()=>{let i=this.revertibles.length;let y=this.revertConstructors.length;while(i--)this.revertibles[i].revert();while(y--)this.revertConstructors[y](this);this.revertibles.length=0;this.revertConstructors.length=0;this.constructors.forEach((constructor=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructors.push(revertConstructor)}}))}));return this}add(a1,a2){this.once=false;if(isFnc(a1)){const constructor=a1;this.constructors.push(constructor);this.execute((()=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructors.push(revertConstructor)}}))}else{this.methods[a1]=(...args)=>this.execute((()=>a2(...args)))}return this}addOnce(scopeConstructorCallback){this.once=true;if(isFnc(scopeConstructorCallback)){const currentIndex=this.onceIndex++;const tracked=this.constructorsOnce[currentIndex];if(tracked)return this;const constructor=scopeConstructorCallback;this.constructorsOnce[currentIndex]=constructor;this.execute((()=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructorsOnce.push(revertConstructor)}}))}return this}keepTime(cb){this.once=true;const currentIndex=this.onceIndex++;const tracked=this.constructorsOnce[currentIndex];if(isFnc(tracked))return tracked(this);const constructor=createRefreshable(cb);this.constructorsOnce[currentIndex]=constructor;let trackedTickable;this.execute((()=>{trackedTickable=constructor(this)}));return trackedTickable}handleEvent(e){switch(e.type){case"change":this.refresh();break}}revert(){const revertibles=this.revertibles;const revertConstructors=this.revertConstructors;const revertiblesOnce=this.revertiblesOnce;const revertConstructorsOnce=this.revertConstructorsOnce;const mqs=this.mediaQueryLists;let i=revertibles.length;let j=revertConstructors.length;let k=revertiblesOnce.length;let l=revertConstructorsOnce.length;while(i--)revertibles[i].revert();while(j--)revertConstructors[j](this);while(k--)revertiblesOnce[k].revert();while(l--)revertConstructorsOnce[l](this);for(let mq in mqs)mqs[mq].removeEventListener("change",this);revertibles.length=0;revertConstructors.length=0;this.constructors.length=0;revertiblesOnce.length=0;revertConstructorsOnce.length=0;this.constructorsOnce.length=0;this.onceIndex=0;this.matches={};this.methods={};this.mediaQueryLists={};this.data={}}}const createScope=params=>new Scope(params);const getMaxViewHeight=()=>{const $el=document.createElement("div");doc.body.appendChild($el);$el.style.height="100lvh";const height=$el.offsetHeight;doc.body.removeChild($el);return height};const parseScrollObserverFunctionParameter=(value,scroller)=>value&&isFnc(value)?value(scroller):value;const scrollContainers=new Map;class ScrollContainer{constructor($el){this.element=$el;this.useWin=this.element===doc.body;this.winWidth=0;this.winHeight=0;this.width=0;this.height=0;this.left=0;this.top=0;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=false;this.backwardY=false;this.scrollTicker=new Timer({autoplay:false,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const backwards=this.backwardX||this.backwardY;forEachChildren(this,(child=>child.handleScroll()),backwards)},onComplete:()=>this.dataTimer.pause()}).init();this.dataTimer=new Timer({autoplay:false,frameRate:30,onUpdate:self=>{const dt=self.deltaTime;const px=this.prevScrollX;const py=this.prevScrollY;const nx=this.scrollX;const ny=this.scrollY;const dx=px-nx;const dy=py-ny;this.prevScrollX=nx;this.prevScrollY=ny;if(dx)this.backwardX=px>nx;if(dy)this.backwardY=py>ny;this.velocity=round(dt>0?Math.sqrt(dx*dx+dy*dy)/dt:0,5)}}).init();this.resizeTicker=new Timer({autoplay:false,duration:250*globals.timeScale,onComplete:()=>{this.updateWindowBounds();this.refreshScrollObservers();this.handleScroll()}}).init();this.wakeTicker=new Timer({autoplay:false,duration:500*globals.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?win:this.element).addEventListener("scroll",this,false)}updateScrollCoords(){const useWin=this.useWin;const $el=this.element;this.scrollX=round(useWin?win.scrollX:$el.scrollLeft,0);this.scrollY=round(useWin?win.scrollY:$el.scrollTop,0)}updateWindowBounds(){this.winWidth=win.innerWidth;this.winHeight=getMaxViewHeight()}updateBounds(){const style=getComputedStyle(this.element);const $el=this.element;this.scrollWidth=$el.scrollWidth+parseFloat(style.marginLeft)+parseFloat(style.marginRight);this.scrollHeight=$el.scrollHeight+parseFloat(style.marginTop)+parseFloat(style.marginBottom);this.updateWindowBounds();let width,height;if(this.useWin){width=this.winWidth;height=this.winHeight}else{const elRect=$el.getBoundingClientRect();width=elRect.width;height=elRect.height;this.top=elRect.top;this.left=elRect.left}this.width=width;this.height=height}refreshScrollObservers(){forEachChildren(this,(child=>{if(child._debug){child.removeDebug()}}));this.updateBounds();forEachChildren(this,(child=>{child.refresh();if(child._debug){child.debug()}}))}refresh(){this.updateWindowBounds();this.updateBounds();this.refreshScrollObservers();this.handleScroll()}handleScroll(){this.updateScrollCoords();this.wakeTicker.restart()}handleEvent(e){switch(e.type){case"scroll":this.handleScroll();break}}revert(){this.scrollTicker.cancel();this.dataTimer.cancel();this.resizeTicker.cancel();this.wakeTicker.cancel();this.resizeObserver.unobserve(this.element);(this.useWin?win:this.element).removeEventListener("scroll",this);scrollContainers.delete(this.element)}}const registerAndGetScrollContainer=target=>{const $el=target?parseTargets(target)[0]||doc.body:doc.body;let scrollContainer=scrollContainers.get($el);if(!scrollContainer){scrollContainer=new ScrollContainer($el);scrollContainers.set($el,scrollContainer)}return scrollContainer};const convertValueToPx=($el,v,size,under,over)=>{const clampMin=v==="min";const clampMax=v==="max";const value=v==="top"||v==="left"||v==="start"||clampMin?0:v==="bottom"||v==="right"||v==="end"||clampMax?"100%":v==="center"?"50%":v;const{n:n,u:u}=decomposeRawValue(value,decomposedOriginalValue);let px=n;if(u==="%"){px=n/100*size}else if(u){px=convertValueUnit($el,decomposedOriginalValue,"px",true).n}if(clampMax&&under<0)px+=under;if(clampMin&&over>0)px+=over;return px};const parseBoundValue=($el,v,size,under,over)=>{let value;if(isStr(v)){const matchedOperator=relativeValuesExecRgx.exec(v);if(matchedOperator){const splitter=matchedOperator[0];const operator=splitter[0];const splitted=v.split(splitter);const clampMin=splitted[0]==="min";const clampMax=splitted[0]==="max";const valueAPx=convertValueToPx($el,splitted[0],size,under,over);const valueBPx=convertValueToPx($el,splitted[1],size,under,over);if(clampMin){const min=getRelativeValue(convertValueToPx($el,"min",size),valueBPx,operator);value=min<valueAPx?valueAPx:min}else if(clampMax){const max=getRelativeValue(convertValueToPx($el,"max",size),valueBPx,operator);value=max>valueAPx?valueAPx:max}else{value=getRelativeValue(valueAPx,valueBPx,operator)}}else{value=convertValueToPx($el,v,size,under,over)}}else{value=v}return round(value,0)};const getAnimationDomTarget=linked=>{let $linkedTarget;const linkedTargets=linked.targets;for(let i=0,l=linkedTargets.length;i<l;i++){const target=linkedTargets[i];if(target[isDomSymbol]){$linkedTarget=target;break}}return $linkedTarget};let scrollerIndex=0;const debugColors$1=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ScrollObserver{constructor(parameters={}){if(scope.current)scope.current.register(this);const syncMode=setValue(parameters.sync,"play pause");const ease=syncMode?parseEasings(syncMode):null;const isLinear=syncMode&&(syncMode==="linear"||syncMode===none);const isEase=syncMode&&!(ease===none&&!isLinear);const isSmooth=syncMode&&(isNum(syncMode)||syncMode===true||isLinear);const isMethods=syncMode&&(isStr(syncMode)&&!isEase&&!isSmooth);const syncMethods=isMethods?syncMode.split(" ").map((m=>()=>{const linked=this.linked;return linked&&linked[m]?linked[m]():null})):null;const biDirSync=isMethods&&syncMethods.length>2;this.index=scrollerIndex++;this.id=!isUnd(parameters.id)?parameters.id:this.index;this.container=registerAndGetScrollContainer(parameters.container);this.target=null;this.linked=null;this.repeat=null;this.horizontal=null;this.enter=null;this.leave=null;this.sync=isEase||isSmooth||!!syncMethods;this.syncEase=isEase?ease:null;this.syncSmooth=isSmooth?syncMode===true||isLinear?1:syncMode:null;this.onSyncEnter=syncMethods&&!biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeave=syncMethods&&!biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterForward=syncMethods&&biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeaveForward=syncMethods&&biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterBackward=syncMethods&&biDirSync&&syncMethods[2]?syncMethods[2]:noop;this.onSyncLeaveBackward=syncMethods&&biDirSync&&syncMethods[3]?syncMethods[3]:noop;this.onEnter=parameters.onEnter||noop;this.onLeave=parameters.onLeave||noop;this.onEnterForward=parameters.onEnterForward||noop;this.onLeaveForward=parameters.onLeaveForward||noop;this.onEnterBackward=parameters.onEnterBackward||noop;this.onLeaveBackward=parameters.onLeaveBackward||noop;this.onUpdate=parameters.onUpdate||noop;this.onSyncComplete=parameters.onSyncComplete||noop;this.reverted=false;this.completed=false;this.began=false;this.isInView=false;this.forceEnter=false;this.hasEntered=false;this.offsets=[];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=parameters;this._debug=setValue(parameters.debug,false);this._next=null;this._prev=null;addChild(this.container,this);sync((()=>{if(this.reverted)return;if(!this.target){const target=parseTargets(parameters.target)[0];this.target=target||doc.body;this.refresh()}if(this._debug)this.debug()}))}link(linked){if(linked){linked.pause();this.linked=linked;if(!this._params.target){let $linkedTarget;if(!isUnd(linked.targets)){$linkedTarget=getAnimationDomTarget(linked)}else{forEachChildren(linked,(child=>{if(child.targets&&!$linkedTarget){$linkedTarget=getAnimationDomTarget(child)}}))}this.target=$linkedTarget||doc.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 p=(this.scroll-this.offsetStart)/this.distance;return p===Infinity||isNaN(p)?0:round(clamp(p,0,1),6)}refresh(){this.reverted=false;const params=this._params;this.repeat=setValue(parseScrollObserverFunctionParameter(params.repeat,this),true);this.horizontal=setValue(parseScrollObserverFunctionParameter(params.axis,this),"y")==="x";this.enter=setValue(parseScrollObserverFunctionParameter(params.enter,this),"end start");this.leave=setValue(parseScrollObserverFunctionParameter(params.leave,this),"start end");this.updateBounds();this.handleScroll();return this}removeDebug(){if(this.$debug){this.$debug.parentNode.removeChild(this.$debug);this.$debug=null}if(this.debugStyles){this.debugStyles.revert();this.$debug=null}return this}debug(){this.removeDebug();const container=this.container;const isHori=this.horizontal;const $existingDebug=container.element.querySelector(":scope > .animejs-onscroll-debug");const $debug=doc.createElement("div");const $thresholds=doc.createElement("div");const $triggers=doc.createElement("div");const color=debugColors$1[this.index%debugColors$1.length];const useWin=container.useWin;const containerWidth=useWin?container.winWidth:container.width;const containerHeight=useWin?container.winHeight:container.height;const scrollWidth=container.scrollWidth;const scrollHeight=container.scrollHeight;const size=this.container.width>360?320:260;const offLeft=isHori?0:10;const offTop=isHori?10:0;const half=isHori?24:size/2;const labelHeight=isHori?half:15;const labelWidth=isHori?60:half;const labelSize=isHori?labelWidth:labelHeight;const repeat=isHori?"repeat-x":"repeat-y";const gradientOffset=v=>isHori?"0px "+v+"px":v+"px"+" 2px";const lineCSS=c=>`linear-gradient(${isHori?90:0}deg, ${c} 2px, transparent 1px)`;const baseCSS=(p,l,t,w,h)=>`position:${p};left:${l}px;top:${t}px;width:${w}px;height:${h}px;`;$debug.style.cssText=`${baseCSS("absolute",offLeft,offTop,isHori?scrollWidth:size,isHori?size:scrollHeight)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `;$thresholds.style.cssText=`${baseCSS("sticky",0,0,isHori?containerWidth:half,isHori?half:containerHeight)}`;if(!$existingDebug){$thresholds.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(half-10)} / ${isHori?"100px 100px":"100px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(half-10)} / ${isHori?"10px 10px":"10px 10px"} ${repeat};\n `}$triggers.style.cssText=`${baseCSS("relative",0,0,isHori?scrollWidth:half,isHori?half:scrollHeight)}`;if(!$existingDebug){$triggers.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(0)} / ${isHori?"100px 10px":"10px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(0)} / ${isHori?"10px 0px":"0px 10px"} ${repeat};\n `}const labels=[" enter: "," leave: "];this.coords.forEach(((v,i)=>{const isView=i>1;const value=(isView?0:this.offset)+v;const isTail=i%2;const isFirst=value<labelSize;const isOver=value>(isView?isHori?containerWidth:containerHeight:isHori?scrollWidth:scrollHeight)-labelSize;const isFlip=(isView?isTail&&!isFirst:!isTail&&!isFirst)||isOver;const $label=doc.createElement("div");const $text=doc.createElement("div");const dirProp=isHori?isFlip?"right":"left":isFlip?"bottom":"top";const flipOffset=isFlip?(isHori?labelWidth:labelHeight)+(!isView?isHori?-1:-2:isHori?-1:isOver?0:-2):!isView?isHori?1:0:isHori?1:0;$text.innerHTML=`${this.id}${labels[isTail]}${this.thresholds[i]}`;$label.style.cssText=`${baseCSS("absolute",0,0,labelWidth,labelHeight)}\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n justify-content: flex-${isView?"start":"end"};\n align-items: flex-${isFlip?"end":"start"};\n border-${dirProp}: 2px ${isTail?"solid":"solid"} ${color};\n `;$text.style.cssText=`\n overflow: hidden;\n max-width: ${size/2-10}px;\n height: ${labelHeight};\n margin-${isHori?isFlip?"right":"left":isFlip?"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: ${isHori&&isFlip||!isHori&&!isView?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${isTail?color:"rgba(0,0,0,.75)"};\n background-color: ${isTail?"rgba(0,0,0,.65)":color};\n border: 2px solid ${isTail?color:"transparent"};\n border-${isHori?isFlip?"top-left":"top-right":isFlip?"top-left":"bottom-left"}-radius: 5px;\n border-${isHori?isFlip?"bottom-left":"bottom-right":isFlip?"top-right":"bottom-right"}-radius: 5px;\n `;$label.appendChild($text);let position=value-flipOffset+(isHori?1:0);$label.style[isHori?"left":"top"]=`${position}px`;(isView?$thresholds:$triggers).appendChild($label)}));$debug.appendChild($thresholds);$debug.appendChild($triggers);container.element.appendChild($debug);if(!$existingDebug)$debug.classList.add("animejs-onscroll-debug");this.$debug=$debug;const containerPosition=getTargetValue(container.element,"position");if(containerPosition==="static"){this.debugStyles=setTargetValues(container.element,{position:"relative "})}}updateBounds(){if(this._debug){this.removeDebug()}let stickys;const $target=this.target;const container=this.container;const isHori=this.horizontal;const linked=this.linked;let linkedTime;let $el=$target;let offsetX=0;let offsetY=0;let $offsetParent=$el;if(linked){linkedTime=linked.currentTime;linked.seek(0,true)}const isContainerStatic=getTargetValue(container.element,"position")==="static"?setTargetValues(container.element,{position:"relative "}):false;while($el&&$el!==container.element&&$el!==doc.body){const isSticky=getTargetValue($el,"position")==="sticky"?setTargetValues($el,{position:"static"}):false;if($el===$offsetParent){offsetX+=$el.offsetLeft||0;offsetY+=$el.offsetTop||0;$offsetParent=$el.offsetParent}$el=$el.parentElement;if(isSticky){if(!stickys)stickys=[];stickys.push(isSticky)}}if(isContainerStatic)isContainerStatic.revert();const offset=isHori?offsetX:offsetY;const targetSize=isHori?$target.offsetWidth:$target.offsetHeight;const containerSize=isHori?container.width:container.height;const scrollSize=isHori?container.scrollWidth:container.scrollHeight;const maxScroll=scrollSize-containerSize;const enter=this.enter;const leave=this.leave;let enterTarget="start";let leaveTarget="end";let enterContainer="end";let leaveContainer="start";if(isStr(enter)){const splitted=enter.split(" ");enterContainer=splitted[0];enterTarget=splitted.length>1?splitted[1]:enterTarget}else if(isObj(enter)){const e=enter;if(!isUnd(e.container))enterContainer=e.container;if(!isUnd(e.target))enterTarget=e.target}else if(isNum(enter)){enterContainer=enter}if(isStr(leave)){const splitted=leave.split(" ");leaveContainer=splitted[0];leaveTarget=splitted.length>1?splitted[1]:leaveTarget}else if(isObj(leave)){const t=leave;if(!isUnd(t.container))leaveContainer=t.container;if(!isUnd(t.target))leaveTarget=t.target}else if(isNum(leave)){leaveContainer=leave}const parsedEnterTarget=parseBoundValue($target,enterTarget,targetSize);const parsedLeaveTarget=parseBoundValue($target,leaveTarget,targetSize);const under=parsedEnterTarget+offset-containerSize;const over=parsedLeaveTarget+offset-maxScroll;const parsedEnterContainer=parseBoundValue($target,enterContainer,containerSize,under,over);const parsedLeaveContainer=parseBoundValue($target,leaveContainer,containerSize,under,over);const offsetStart=parsedEnterTarget+offset-parsedEnterContainer;const offsetEnd=parsedLeaveTarget+offset-parsedLeaveContainer;const scrollDelta=offsetEnd-offsetStart;this.offsets[0]=offsetX;this.offsets[1]=offsetY;this.offset=offset;this.offsetStart=offsetStart;this.offsetEnd=offsetEnd;this.distance=scrollDelta<=0?0:scrollDelta;this.thresholds=[enterTarget,leaveTarget,enterContainer,leaveContainer];this.coords=[parsedEnterTarget,parsedLeaveTarget,parsedEnterContainer,parsedLeaveContainer];if(stickys){stickys.forEach((sticky=>sticky.revert()))}if(linked){linked.seek(linkedTime,true)}if(this._debug){this.debug()}}handleScroll(){const linked=this.linked;const sync=this.sync;const syncEase=this.syncEase;const syncSmooth=this.syncSmooth;const shouldSeek=linked&&(syncEase||syncSmooth);const isHori=this.horizontal;const container=this.container;const scroll=this.scroll;const isBefore=scroll<=this.offsetStart;const isAfter=scroll>=this.offsetEnd;const isInView=!isBefore&&!isAfter;const isOnTheEdge=scroll===this.offsetStart||scroll===this.offsetEnd;const forceEnter=!this.hasEntered&&isOnTheEdge;const $debug=this._debug&&this.$debug;let hasUpdated=false;let syncCompleted=false;let p=this.progress;if(isBefore&&this.began){this.began=false}if(p>0&&!this.began){this.began=true}if(shouldSeek){const lp=linked.progress;if(syncSmooth&&isNum(syncSmooth)){if(syncSmooth<1){const step=1e-4;const snap=lp<p&&p===1?step:lp>p&&!p?-1e-4:0;p=round(lerp(lp,p,interpolate(.01,.2,syncSmooth),false)+snap,6)}}else if(syncEase){p=syncEase(p)}hasUpdated=p!==this.prevProgress;syncCompleted=lp===1;if(hasUpdated&&!syncCompleted&&(syncSmooth&&lp)){container.wakeTicker.restart()}}if($debug){const sticky=isHori?container.scrollY:container.scrollX;$debug.style[isHori?"top":"left"]=sticky+10+"px"}if(isInView&&!this.isInView||forceEnter&&!this.forceEnter&&!this.hasEntered){if(isInView)this.isInView=true;if(!this.forceEnter||!this.hasEntered){if($debug&&isInView)$debug.style.zIndex=`${this.container.zIndex++}`;this.onSyncEnter(this);this.onEnter(this);if(this.backward){this.onSyncEnterBackward(this);this.onEnterBackward(this)}else{this.onSyncEnterForward(this);this.onEnterForward(this)}this.hasEntered=true;if(forceEnter)this.forceEnter=true}else if(isInView){this.forceEnter=false}}if(isInView||!isInView&&this.isInView){hasUpdated=true}if(hasUpdated){if(shouldSeek)linked.seek(linked.duration*p);this.onUpdate(this)}if(!isInView&&this.isInView){this.isInView=false;this.onSyncLeave(this);this.onLeave(this);if(this.backward){this.onSyncLeaveBackward(this);this.onLeaveBackward(this)}else{this.onSyncLeaveForward(this);this.onLeaveForward(this)}if(sync&&!syncSmooth){syncCompleted=true}}if(p>=1&&this.began&&!this.completed&&(sync&&syncCompleted||!sync)){if(sync){this.onSyncComplete(this)}this.completed=true;if(!this.repeat&&!linked||!this.repeat&&linked&&linked.completed){this.revert()}}if(p<1&&this.completed){this.completed=false}this.prevProgress=p}revert(){if(this.reverted)return;const container=this.container;removeChild(container,this);if(!container._head){container.revert()}if(this._debug){this.removeDebug()}this.reverted=true;return this}}const onScroll=(parameters={})=>new ScrollObserver(parameters);const segmenter=!isUnd(Intl)&&Intl.Segmenter;const valueRgx=/\{value\}/g;const indexRgx=/\{i\}/g;const whiteSpaceGroupRgx=/(\s+)/;const whiteSpaceRgx=/^\s+$/;const lineType="line";const wordType="word";const charType="char";const dataLine=`data-line`;let wordSegmenter=null;let graphemeSegmenter=null;let $splitTemplate=null;const isSegmentWordLike=seg=>seg.isWordLike||seg.segment===" "||isNum(+seg.segment);const setAriaHidden=$el=>$el.setAttribute("aria-hidden","true");const getAllTopLevelElements=($el,type)=>[...$el.querySelectorAll(`[data-${type}]:not([data-${type}] [data-${type}])`)];const debugColors={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"};const filterEmptyElements=$el=>{if(!$el.childElementCount&&!$el.textContent.trim()){const $parent=$el.parentElement;$el.remove();if($parent)filterEmptyElements($parent)}};const filterLineElements=($el,lineIndex,bin)=>{const dataLineAttr=$el.getAttribute(dataLine);if(dataLineAttr!==null&&+dataLineAttr!==lineIndex||$el.tagName==="BR")bin.add($el);let i=$el.childElementCount;while(i--)filterLineElements($el.children[i],lineIndex,bin);return bin};const generateTemplate=(type,params={})=>{let template=``;const classString=isStr(params.class)?` class="${params.class}"`:"";const cloneType=setValue(params.clone,false);const wrapType=setValue(params.wrap,false);const overflow=wrapType?wrapType===true?"clip":wrapType:cloneType?"clip":false;if(wrapType)template+=`<span${overflow?` style="overflow:${overflow};"`:""}>`;template+=`<span${classString}${cloneType?` style="position:relative;"`:""} data-${type}="{i}">`;if(cloneType){const left=cloneType==="left"?"-100%":cloneType==="right"?"100%":"0";const top=cloneType==="top"?"-100%":cloneType==="bottom"?"100%":"0";template+=`<span>{value}</span>`;template+=`<span inert style="position:absolute;top:${top};left:${left};white-space:nowrap;">{value}</span>`}else{template+=`{value}`}template+=`</span>`;if(wrapType)template+=`</span>`;return template};const processHTMLTemplate=(htmlTemplate,store,node,$parentFragment,type,debug,lineIndex,wordIndex,charIndex)=>{const isLine=type===lineType;const isChar=type===charType;const className=`_${type}_`;const template=isFnc(htmlTemplate)?htmlTemplate(node):htmlTemplate;const displayStyle=isLine?"block":"inline-block";$splitTemplate.innerHTML=template.replace(valueRgx,`<i class="${className}"></i>`).replace(indexRgx,`${isChar?charIndex:isLine?lineIndex:wordIndex}`);const $content=$splitTemplate.content;const $highestParent=$content.firstElementChild;const $split=$content.querySelector(`[data-${type}]`)||$highestParent;const $replacables=$content.querySelectorAll(`i.${className}`);const replacablesLength=$replacables.length;if(replacablesLength){$highestParent.style.display=displayStyle;$split.style.display=displayStyle;$split.setAttribute(dataLine,`${lineIndex}`);if(!isLine){$split.setAttribute("data-word",`${wordIndex}`);if(isChar)$split.setAttribute("data-char",`${charIndex}`)}let i=replacablesLength;while(i--){const $replace=$replacables[i];const $closestParent=$replace.parentElement;$closestParent.style.display=displayStyle;if(isLine){$closestParent.innerHTML=node.innerHTML}else{$closestParent.replaceChild(node.cloneNode(true),$replace)}}store.push($split);$parentFragment.appendChild($content)}else{console.warn(`The expression "{value}" is missing from the provided template.`)}if(debug)$highestParent.style.outline=`1px dotted ${debugColors[type]}`;return $highestParent};class TextSplitter{constructor(target,parameters={}){if(!wordSegmenter)wordSegmenter=segmenter?new segmenter([],{granularity:wordType}):{segment:text=>{const segments=[];const words=text.split(whiteSpaceGroupRgx);for(let i=0,l=words.length;i<l;i++){const segment=words[i];segments.push({segment:segment,isWordLike:!whiteSpaceRgx.test(segment)})}return segments}};if(!graphemeSegmenter)graphemeSegmenter=segmenter?new segmenter([],{granularity:"grapheme"}):{segment:text=>[...text].map((char=>({segment:char})))};if(!$splitTemplate&&isBrowser)$splitTemplate=doc.createElement("template");if(scope.current)scope.current.register(this);const{words:words,chars:chars,lines:lines,accessible:accessible,includeSpaces:includeSpaces,debug:debug}=parameters;const $target=(target=isArr(target)?target[0]:target)&&target.nodeType?target:(getNodeList(target)||[])[0];const lineParams=lines===true?{}:lines;const wordParams=words===true||isUnd(words)?{}:words;const charParams=chars===true?{}:chars;this.debug=setValue(debug,false);this.includeSpaces=setValue(includeSpaces,false);this.accessible=setValue(accessible,true);this.linesOnly=lineParams&&(!wordParams&&!charParams);this.lineTemplate=isObj(lineParams)?generateTemplate(lineType,lineParams):lineParams;this.wordTemplate=isObj(wordParams)||this.linesOnly?generateTemplate(wordType,wordParams):wordParams;this.charTemplate=isObj(charParams)?generateTemplate(charType,charParams):charParams;this.$target=$target;this.html=$target&&$target.innerHTML;this.lines=[];this.words=[];this.chars=[];this.effects=[];this.effectsCleanups=[];this.cache=null;this.ready=false;this.width=0;this.resizeTimeout=null;const handleSplit=()=>this.html&&(lineParams||wordParams||charParams)&&this.split();this.resizeObserver=new ResizeObserver((()=>{clearTimeout(this.resizeTimeout);this.resizeTimeout=setTimeout((()=>{const currentWidth=$target.offsetWidth;if(currentWidth===this.width)return;this.width=currentWidth;handleSplit()}),150)}));if(this.lineTemplate&&!this.ready){doc.fonts.ready.then(handleSplit)}else{handleSplit()}$target?this.resizeObserver.observe($target):console.warn("No Text Splitter target found.")}addEffect(effect){if(!isFnc(effect))return console.warn("Effect must return a function.");const refreshableEffect=createRefreshable(effect);this.effects.push(refreshableEffect);if(this.ready)this.effectsCleanups[this.effects.length-1]=refreshableEffect(this);return this}revert(){clearTimeout(this.resizeTimeout);this.lines.length=this.words.length=this.chars.length=0;this.resizeObserver.disconnect();this.effectsCleanups.forEach((cleanup=>isFnc(cleanup)?cleanup(this):cleanup.revert&&cleanup.revert()));this.$target.innerHTML=this.html;return this}splitNode(node){const wordTemplate=this.wordTemplate;const charTemplate=this.charTemplate;const includeSpaces=this.includeSpaces;const debug=this.debug;const nodeType=node.nodeType;if(nodeType===3){const nodeText=node.nodeValue;if(nodeText.trim()){const tempWords=[];const words=this.words;const chars=this.chars;const wordSegments=wordSegmenter.segment(nodeText);const $wordsFragment=doc.createDocumentFragment();let prevSeg=null;for(const wordSegment of wordSegments){const segment=wordSegment.segment;const isWordLike=isSegmentWordLike(wordSegment);if(!prevSeg||isWordLike&&(prevSeg&&isSegmentWordLike(prevSeg))){tempWords.push(segment)}else{const lastWordIndex=tempWords.length-1;const lastWord=tempWords[lastWordIndex];if(!lastWord.includes(" ")&&!segment.includes(" ")){tempWords[lastWordIndex]+=segment}else{tempWords.push(segment)}}prevSeg=wordSegment}for(let i=0,l=tempWords.length;i<l;i++){const word=tempWords[i];if(!word.trim()){if(i&&includeSpaces)continue;$wordsFragment.appendChild(doc.createTextNode(word))}else{const nextWord=tempWords[i+1];const hasWordFollowingSpace=includeSpaces&&nextWord&&!nextWord.trim();const wordToProcess=word;const charSegments=charTemplate?graphemeSegmenter.segment(wordToProcess):null;const $charsFragment=charTemplate?doc.createDocumentFragment():doc.createTextNode(hasWordFollowingSpace?word+" ":word);if(charTemplate){const charSegmentsArray=[...charSegments];for(let j=0,jl=charSegmentsArray.length;j<jl;j++){const charSegment=charSegmentsArray[j];const isLastChar=j===jl-1;const charText=isLastChar&&hasWordFollowingSpace?charSegment.segment+" ":charSegment.segment;const $charNode=doc.createTextNode(charText);processHTMLTemplate(charTemplate,chars,$charNode,$charsFragment,charType,debug,-1,words.length,chars.length)}}if(wordTemplate){processHTMLTemplate(wordTemplate,words,$charsFragment,$wordsFragment,wordType,debug,-1,words.length,chars.length)}else if(charTemplate){$wordsFragment.appendChild($charsFragment)}else{$wordsFragment.appendChild(doc.createTextNode(word))}if(hasWordFollowingSpace)i++}}node.parentNode.replaceChild($wordsFragment,node)}}else if(nodeType===1){const childNodes=[...node.childNodes];for(let i=0,l=childNodes.length;i<l;i++)this.splitNode(childNodes[i])}}split(clearCache=false){const $el=this.$target;const isCached=!!this.cache&&!clearCache;const lineTemplate=this.lineTemplate;const wordTemplate=this.wordTemplate;const charTemplate=this.charTemplate;const fontsReady=doc.fonts.status!=="loading";const canSplitLines=lineTemplate&&fontsReady;this.ready=!lineTemplate||fontsReady;if(!isCached){if(clearCache){$el.innerHTML=this.html;this.words.length=this.chars.length=0}this.splitNode($el);this.cache=$el.innerHTML}if(canSplitLines){this.effectsCleanups.forEach((cleanup=>isFnc(cleanup)&&cleanup(this)));if(isCached)$el.innerHTML=this.cache;this.lines.length=0;if(wordTemplate)this.words=getAllTopLevelElements($el,wordType)}if(charTemplate&&(canSplitLines||wordTemplate)){this.chars=getAllTopLevelElements($el,charType)}const elementsArray=this.words.length?this.words:this.chars;let y,linesCount=0;for(let i=0,l=elementsArray.length;i<l;i++){const $el=elementsArray[i];const{top:top,height:height}=$el.getBoundingClientRect();if(y&&top-y>height*.5)linesCount++;$el.setAttribute(dataLine,`${linesCount}`);const nested=$el.querySelectorAll(`[${dataLine}]`);let c=nested.length;while(c--)nested[c].setAttribute(dataLine,`${linesCount}`);y=top}if(canSplitLines){const linesFragment=doc.createDocumentFragment();const parents=new Set;const clones=[];for(let lineIndex=0;lineIndex<linesCount+1;lineIndex++){const $clone=$el.cloneNode(true);filterLineElements($clone,lineIndex,new Set).forEach(($el=>{const $parent=$el.parentElement;if($parent)parents.add($parent);$el.remove()}));clones.push($clone)}parents.forEach(filterEmptyElements);for(let cloneIndex=0,clonesLength=clones.length;cloneIndex<clonesLength;cloneIndex++){processHTMLTemplate(lineTemplate,this.lines,clones[cloneIndex],linesFragment,lineType,this.debug,cloneIndex)}$el.innerHTML="";$el.appendChild(linesFragment);if(wordTemplate)this.words=getAllTopLevelElements($el,wordType);if(charTemplate)this.chars=getAllTopLevelElements($el,charType)}if(this.linesOnly){const words=this.words;let w=words.length;while(w--){const $word=words[w];$word.replaceWith($word.textContent)}words.length=0}if(canSplitLines||clearCache){this.effects.forEach(((effect,i)=>this.effectsCleanups[i]=effect(this)))}if(this.accessible&&(canSplitLines||!isCached)){const $accessible=doc.createElement("span");$accessible.style.cssText=`position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;`;$accessible.innerHTML=this.html;$el.insertBefore($accessible,$el.firstChild);this.lines.forEach(setAriaHidden);this.words.forEach(setAriaHidden);this.chars.forEach(setAriaHidden)}this.width=$el.offsetWidth;return this}refresh(){this.split(true)}}const split=(target,parameters)=>new TextSplitter(target,parameters);const text={split:split};const stagger=(val,params={})=>{let values=[];let maxValue=0;const from=params.from;const reversed=params.reversed;const ease=params.ease;const hasEasing=!isUnd(ease);const hasSpring=hasEasing&&!isUnd(ease.ease);const staggerEase=hasSpring?ease.ease:hasEasing?parseEasings(ease):null;const grid=params.grid;const axis=params.axis;const customTotal=params.total;const fromFirst=isUnd(from)||from===0||from==="first";const fromCenter=from==="center";const fromLast=from==="last";const fromRandom=from==="random";const isRange=isArr(val);const useProp=params.use;const val1=isRange?parseNumber(val[0]):parseNumber(val);const val2=isRange?parseNumber(val[1]):0;const unitMatch=unitsExecRgx.exec((isRange?val[1]:val)+emptyString);const start=params.start||0+(isRange?val1:0);let fromIndex=fromFirst?0:isNum(from)?from:0;return(target,i,t,tl)=>{const[registeredTarget]=registerTargets(target);const total=isUnd(customTotal)?t:customTotal;const customIndex=!isUnd(useProp)?isFnc(useProp)?useProp(registeredTarget,i,total):getOriginalAnimatableValue(registeredTarget,useProp):false;const staggerIndex=isNum(customIndex)||isStr(customIndex)&&isNum(+customIndex)?+customIndex:i;if(fromCenter)fromIndex=(total-1)/2;if(fromLast)fromIndex=total-1;if(!values.length){for(let index=0;index<total;index++){if(!grid){values.push(abs(fromIndex-index))}else{const fromX=!fromCenter?fromIndex%grid[0]:(grid[0]-1)/2;const fromY=!fromCenter?floor(fromIndex/grid[0]):(grid[1]-1)/2;const toX=index%grid[0];const toY=floor(index/grid[0]);const distanceX=fromX-toX;const distanceY=fromY-toY;let value=sqrt(distanceX*distanceX+distanceY*distanceY);if(axis==="x")value=-distanceX;if(axis==="y")value=-distanceY;values.push(value)}maxValue=max(...values)}if(staggerEase)values=values.map((val=>staggerEase(val/maxValue)*maxValue));if(reversed)values=values.map((val=>axis?val<0?val*-1:-val:abs(maxValue-val)));if(fromRandom)values=shuffle(values)}const spacing=isRange?(val2-val1)/maxValue:val1;const offset=tl?parseTimelinePosition(tl,isUnd(params.start)?tl.iterationDuration:start):start;let output=offset+(spacing*round(values[staggerIndex],2)||0);if(params.modifier)output=params.modifier(output);if(unitMatch)output=`${output}${unitMatch[2]}`;return output}};exports.Animatable=Animatable;exports.Draggable=Draggable;exports.JSAnimation=JSAnimation;exports.Scope=Scope;exports.ScrollObserver=ScrollObserver;exports.Spring=Spring;exports.TextSplitter=TextSplitter;exports.Timeline=Timeline;exports.Timer=Timer;exports.WAAPIAnimation=WAAPIAnimation;exports.animate=animate;exports.createAnimatable=createAnimatable;exports.createDraggable=createDraggable;exports.createScope=createScope;exports.createSpring=createSpring;exports.createTimeline=createTimeline;exports.createTimer=createTimer;exports.eases=eases;exports.engine=engine;exports.onScroll=onScroll;exports.scrollContainers=scrollContainers;exports.stagger=stagger;exports.svg=svg;exports.text=text;exports.utils=utils;exports.waapi=waapi;
diff --git a/lib/anime.esm.js b/lib/anime.esm.js
index 6ce2459a..7d1c7fab 100644
--- a/lib/anime.esm.js
+++ b/lib/anime.esm.js
@@ -1,12 +1,14 @@
/**
* anime.js - ESM
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
+// Global types ///////////////////////////////////////////////////////////////
+
/**
* @typedef {Object} DefaultsParams
* @property {Number|String} [id]
@@ -36,61 +38,33 @@
/** @typedef {JSAnimation|Timeline} Renderable */
/** @typedef {Timer|Renderable} Tickable */
/** @typedef {Timer&JSAnimation&Timeline} CallbackArgument */
-/** @typedef {Animatable|Tickable|Draggable|ScrollObserver|Scope} Revertible */
+/** @typedef {Animatable|Tickable|Draggable|ScrollObserver|TextSplitter|Scope} Revertible */
-/**
- * @typedef {Object} DraggableAxisParam
- * @property {String} [mapTo]
- * @property {TweenModifier} [modifier]
- * @property {TweenComposition} [composition]
- * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
- */
+// Stagger types //////////////////////////////////////////////////////////////
/**
- * @typedef {Object} DraggableCursorParams
- * @property {String} [onHover]
- * @property {String} [onGrab]
+ * @callback StaggerFunction
+ * @param {Target} [target]
+ * @param {Number} [index]
+ * @param {Number} [length]
+ * @param {Timeline} [tl]
+ * @return {Number|String}
*/
/**
- * @typedef {Object} DraggableParams
- * @property {DOMTargetSelector} [trigger]
- * @property {DOMTargetSelector|Array<Number>|((draggable: Draggable) => DOMTargetSelector|Array<Number>)} [container]
- * @property {Boolean|DraggableAxisParam} [x]
- * @property {Boolean|DraggableAxisParam} [y]
+ * @typedef {Object} StaggerParams
+ * @property {Number|String} [start]
+ * @property {Number|'first'|'center'|'last'|'random'} [from]
+ * @property {Boolean} [reversed]
+ * @property {Array.<Number>} [grid]
+ * @property {('x'|'y')} [axis]
+ * @property {String|StaggerFunction} [use]
+ * @property {Number} [total]
+ * @property {EasingParam} [ease]
* @property {TweenModifier} [modifier]
- * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
- * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [containerPadding]
- * @property {Number|((draggable: Draggable) => Number)} [containerFriction]
- * @property {Number|((draggable: Draggable) => Number)} [releaseContainerFriction]
- * @property {Number|((draggable: Draggable) => Number)} [dragSpeed]
- * @property {Number|((draggable: Draggable) => Number)} [scrollSpeed]
- * @property {Number|((draggable: Draggable) => Number)} [scrollThreshold]
- * @property {Number|((draggable: Draggable) => Number)} [minVelocity]
- * @property {Number|((draggable: Draggable) => Number)} [maxVelocity]
- * @property {Number|((draggable: Draggable) => Number)} [velocityMultiplier]
- * @property {Number} [releaseMass]
- * @property {Number} [releaseStiffness]
- * @property {Number} [releaseDamping]
- * @property {Boolean} [releaseDamping]
- * @property {EasingParam} [releaseEase]
- * @property {Boolean|DraggableCursorParams|((draggable: Draggable) => Boolean|DraggableCursorParams)} [cursor]
- * @property {Callback<Draggable>} [onGrab]
- * @property {Callback<Draggable>} [onDrag]
- * @property {Callback<Draggable>} [onRelease]
- * @property {Callback<Draggable>} [onUpdate]
- * @property {Callback<Draggable>} [onSettle]
- * @property {Callback<Draggable>} [onSnap]
- * @property {Callback<Draggable>} [onResize]
- * @property {Callback<Draggable>} [onAfterResize]
*/
-/**
- * @typedef {SVGGeometryElement & {
- * setAttribute(name: 'draw', value: `${number} ${number}`): void;
- * draw: `${number} ${number}`;
- * }} DrawableSVGGeometry
- */
+// Eases types ////////////////////////////////////////////////////////////////
/**
* @callback EasingFunction
@@ -118,21 +92,7 @@
/** @typedef {Array.<TargetSelector>|TargetSelector} TargetsParam */
/** @typedef {Array.<Target>} TargetsArray */
-/**
- * @callback FunctionValue
- * @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>}
- */
-
-/**
- * @callback TweenModifier
- * @param {Number} value - The animated value
- * @return {Number|String}
- */
-
-/** @typedef {[Number, Number, Number, Number]} ColorArray */
+ // Callback types ////////////////////////////////////////////////////////////
/**
* @template T
@@ -159,6 +119,46 @@
* @property {Callback<T>} [onRender]
*/
+// Timer types ////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} TimerOptions
+ * @property {Number|String} [id]
+ * @property {TweenParamValue} [duration]
+ * @property {TweenParamValue} [delay]
+ * @property {Number} [loopDelay]
+ * @property {Boolean} [reversed]
+ * @property {Boolean} [alternate]
+ * @property {Boolean|Number} [loop]
+ * @property {Boolean|ScrollObserver} [autoplay]
+ * @property {Number} [frameRate]
+ * @property {Number} [playbackRate]
+ */
+
+/**
+
+/**
+ * @typedef {TimerOptions & TickableCallbacks<Timer>} TimerParams
+ */
+
+// Tween types ////////////////////////////////////////////////////////////////
+
+/**
+ * @callback FunctionValue
+ * @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>}
+ */
+
+/**
+ * @callback TweenModifier
+ * @param {Number} value - The animated value
+ * @return {Number|String}
+ */
+
+/** @typedef {[Number, Number, Number, Number]} ColorArray */
+
/**
* @typedef {Object} Tween
* @property {Number} id
@@ -212,25 +212,7 @@
/** @typedef {WeakMap.<Target, TweenLookups>} TweenReplaceLookups */
/** @typedef {Map.<Target, TweenLookups>} TweenAdditiveLookups */
-/**
- * @typedef {Object} TimerOptions
- * @property {Number|String} [id]
- * @property {TweenParamValue} [duration]
- * @property {TweenParamValue} [delay]
- * @property {Number} [loopDelay]
- * @property {Boolean} [reversed]
- * @property {Boolean} [alternate]
- * @property {Boolean|Number} [loop]
- * @property {Boolean|ScrollObserver} [autoplay]
- * @property {Number} [frameRate]
- * @property {Number} [playbackRate]
- */
-
-/**
-
-/**
- * @typedef {TimerOptions & TickableCallbacks<Timer>} TimerParams
- */
+// Animation types ////////////////////////////////////////////////////////////
/**
* @typedef {Number|String|FunctionValue} TweenParamValue
@@ -304,6 +286,8 @@
* @typedef {Record<String, TweenOptions | Callback<JSAnimation> | TweenModifier | boolean | PercentageKeyframes | DurationKeyframes | ScrollObserver> & TimerOptions & AnimationOptions & TweenParamsOptions & TickableCallbacks<JSAnimation> & RenderableCallbacks<JSAnimation>} AnimationParams
*/
+// Timeline types /////////////////////////////////////////////////////////////
+
/**
* @typedef {Object} TimelineOptions
* @property {DefaultsParams} [defaults]
@@ -314,6 +298,8 @@
* @typedef {TimerOptions & TimelineOptions & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} TimelineParams
*/
+// Animatable types ///////////////////////////////////////////////////////////
+
/**
* @callback AnimatablePropertySetter
* @param {Number|Array.<Number>} to
@@ -348,6 +334,136 @@
* @typedef {Record<String, TweenParamValue | EasingParam | TweenModifier | TweenComposition | AnimatablePropertyParamsOptions> & AnimatablePropertyParamsOptions} AnimatableParams
*/
+// Scope types ////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} ReactRef
+ * @property {HTMLElement|SVGElement|null} [current]
+ */
+
+/**
+ * @typedef {Object} AngularRef
+ * @property {HTMLElement|SVGElement} [nativeElement]
+ */
+
+/**
+ * @typedef {Object} ScopeParams
+ * @property {DOMTargetSelector|ReactRef|AngularRef} [root]
+ * @property {DefaultsParams} [defaults]
+ * @property {Record<String, String>} [mediaQueries]
+ */
+
+/**
+ * @template T
+ * @callback ScopedCallback
+ * @param {Scope} scope
+ * @return {T}
+ */
+
+/**
+ * @callback ScopeCleanupCallback
+ * @param {Scope} [scope]
+ */
+
+/**
+ * @callback ScopeConstructorCallback
+ * @param {Scope} [scope]
+ * @return {ScopeCleanupCallback|void}
+ */
+
+/**
+ * @callback ScopeMethod
+ * @param {...*} args
+ * @return {ScopeCleanupCallback|void}
+ */
+
+// Draggable types ////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} DraggableAxisParam
+ * @property {String} [mapTo]
+ * @property {TweenModifier} [modifier]
+ * @property {TweenComposition} [composition]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
+ */
+
+/**
+ * @typedef {Object} DraggableCursorParams
+ * @property {String} [onHover]
+ * @property {String} [onGrab]
+ */
+
+/**
+ * @typedef {Object} DraggableParams
+ * @property {DOMTargetSelector} [trigger]
+ * @property {DOMTargetSelector|Array<Number>|((draggable: Draggable) => DOMTargetSelector|Array<Number>)} [container]
+ * @property {Boolean|DraggableAxisParam} [x]
+ * @property {Boolean|DraggableAxisParam} [y]
+ * @property {TweenModifier} [modifier]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [containerPadding]
+ * @property {Number|((draggable: Draggable) => Number)} [containerFriction]
+ * @property {Number|((draggable: Draggable) => Number)} [releaseContainerFriction]
+ * @property {Number|((draggable: Draggable) => Number)} [dragSpeed]
+ * @property {Number|((draggable: Draggable) => Number)} [scrollSpeed]
+ * @property {Number|((draggable: Draggable) => Number)} [scrollThreshold]
+ * @property {Number|((draggable: Draggable) => Number)} [minVelocity]
+ * @property {Number|((draggable: Draggable) => Number)} [maxVelocity]
+ * @property {Number|((draggable: Draggable) => Number)} [velocityMultiplier]
+ * @property {Number} [releaseMass]
+ * @property {Number} [releaseStiffness]
+ * @property {Number} [releaseDamping]
+ * @property {Boolean} [releaseDamping]
+ * @property {EasingParam} [releaseEase]
+ * @property {Boolean|DraggableCursorParams|((draggable: Draggable) => Boolean|DraggableCursorParams)} [cursor]
+ * @property {Callback<Draggable>} [onGrab]
+ * @property {Callback<Draggable>} [onDrag]
+ * @property {Callback<Draggable>} [onRelease]
+ * @property {Callback<Draggable>} [onUpdate]
+ * @property {Callback<Draggable>} [onSettle]
+ * @property {Callback<Draggable>} [onSnap]
+ * @property {Callback<Draggable>} [onResize]
+ * @property {Callback<Draggable>} [onAfterResize]
+ */
+
+// Text types /////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} splitTemplateParams
+ * @property {false|String} [class]
+ * @property {Boolean|'hidden'|'clip'|'visible'|'scroll'|'auto'} [wrap]
+ * @property {Boolean|'top'|'right'|'bottom'|'left'|'center'} [clone]
+ */
+
+/**
+ * @typedef {Boolean|String} SplitValue
+ */
+
+/**
+ * @callback SplitFunctionValue
+ * @param {Node|HTMLElement} [value]
+ * @return String
+ */
+
+/**
+ * @typedef {Object} TextSplitterParams
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [lines]
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [words]
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [chars]
+ * @property {Boolean} [accessible]
+ * @property {Boolean} [includeSpaces]
+ * @property {Boolean} [debug]
+ */
+
+// SVG types //////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {SVGGeometryElement & {
+ * setAttribute(name: 'draw', value: `${number} ${number}`): void;
+ * draw: `${number} ${number}`;
+ * }} DrawableSVGGeometry
+ */
+
// Environments
@@ -412,11 +528,13 @@ const maxFps = 120;
// Strings
const emptyString = '';
-const shortTransforms = new Map();
-
-shortTransforms.set('x', 'translateX');
-shortTransforms.set('y', 'translateY');
-shortTransforms.set('z', 'translateZ');
+const shortTransforms = /*#__PURE__*/ (() => {
+ const map = new Map();
+ map.set('x', 'translateX');
+ map.set('y', 'translateY');
+ map.set('z', 'translateZ');
+ return map;
+})();
const validTransforms = [
'translateX',
@@ -438,7 +556,7 @@ const validTransforms = [
'matrix3d',
];
-const transformsFragmentStrings = validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});
+const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});
// Functions
@@ -489,13 +607,16 @@ const defaults = {
onRender: noop,
};
+const scope = {
+ /** @type {Scope} */
+ current: null,
+ /** @type {Document|DOMTarget} */
+ root: doc,
+};
+
const globals = {
/** @type {DefaultsParams} */
defaults,
- /** @type {Document|DOMTarget} */
- root: doc,
- /** @type {Scope} */
- scope: null,
/** @type {Number} */
precision: 4,
/** @type {Number} */
@@ -504,7 +625,7 @@ const globals = {
tickThreshold: 200,
};
-const globalVersions = { version: '4.0.2', engine: null };
+const globalVersions = { version: '4.1.0', engine: null };
if (isBrowser) {
if (!win.AnimeJS) win.AnimeJS = [];
@@ -623,6 +744,25 @@ const snap = (v, increment) => isArr(increment) ? increment.reduce((closest, cv)
*/
const interpolate = (start, end, progress) => start + (end - start) * progress;
+/**
+ * @param {Number} min
+ * @param {Number} max
+ * @param {Number} [decimalLength]
+ * @return {Number}
+ */
+const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength || 0); return floor((Math.random() * (max - min + (1 / m)) + min) * m) / m };
+
+/**
+ * Adapted from https://bost.ocks.org/mike/shuffle/
+ * @param {Array} items
+ * @return {Array}
+ */
+const shuffle = items => {
+ let m = items.length, t, i;
+ while (m) { i = random(0, --m); t = items[m]; items[m] = items[i]; items[i] = t; }
+ return items;
+};
+
/**
* @param {Number} v
* @return {Number}
@@ -719,6 +859,32 @@ const addChild = (parent, child, sortMethod, prevProp = '_prev', nextProp = '_ne
child[nextProp] = next;
};
+/**
+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor
+ * @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}
+ */
+const createRefreshable = constructor => {
+ /** @type {Tickable} */
+ let tracked;
+ return (...args) => {
+ let currentIteration, currentIterationProgress, reversed, alternate;
+ if (tracked) {
+ currentIteration = tracked.currentIteration;
+ currentIterationProgress = tracked.iterationProgress;
+ reversed = tracked.reversed;
+ alternate = tracked._alternate;
+ tracked.revert();
+ }
+ const cleanup = constructor(...args);
+ if (cleanup && !isFnc(cleanup) && cleanup.revert) tracked = cleanup;
+ if (!isUnd(currentIterationProgress)) {
+ /** @type {Tickable} */(tracked).currentIteration = currentIteration;
+ /** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;
+ }
+ return cleanup || noop;
+ }
+};
+
/*
* Base class to control framerate and playback rate.
* Inherited by Engine, Timer, Animation and Timeline.
@@ -1227,8 +1393,8 @@ const addAdditiveAnimation = lookups => {
return animation;
};
-const engineTickMethod = isBrowser ? requestAnimationFrame : setImmediate;
-const engineCancelMethod = isBrowser ? cancelAnimationFrame : clearImmediate;
+const engineTickMethod = /*#__PURE__*/ (() => isBrowser ? requestAnimationFrame : setImmediate)();
+const engineCancelMethod = /*#__PURE__*/ (() => isBrowser ? cancelAnimationFrame : clearImmediate)();
class Engine extends Clock {
@@ -1402,7 +1568,7 @@ const parseInlineTransforms = (target, propName, animationInlineStyles) => {
* @return {NodeList|HTMLCollection}
*/
function getNodeList(v) {
- const n = isStr(v) ? globals.root.querySelectorAll(v) : v;
+ const n = isStr(v) ? scope.root.querySelectorAll(v) : v;
if (n instanceof NodeList || n instanceof HTMLCollection) return n;
}
@@ -2335,7 +2501,7 @@ class Timer extends Clock {
onUpdate,
} = parameters;
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const timerInitTime = parent ? 0 : engine._elapsedTime;
const timerDefaults = parent ? parent.defaults : globals.defaults;
@@ -2465,7 +2631,7 @@ class Timer extends Clock {
}
get progress() {
- return clamp(round(this._currentTime / this.duration, 5), 0, 1);
+ return clamp(round(this._currentTime / this.duration, 10), 0, 1);
}
/** @param {Number} progress */
@@ -2474,7 +2640,7 @@ class Timer extends Clock {
}
get iterationProgress() {
- return clamp(round(this._iterationTime / this.iterationDuration, 5), 0, 1);
+ return clamp(round(this._iterationTime / this.iterationDuration, 10), 0, 1);
}
/** @param {Number} progress */
@@ -3734,12 +3900,13 @@ class JSAnimation extends Timer {
*/
refresh() {
forEachChildren(this, (/** @type {Tween} */tween) => {
- const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
- decomposeRawValue(ogValue, decomposedOriginalValue);
- tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
- tween._fromNumber = decomposedOriginalValue.n;
- if (tween._func) {
- decomposeRawValue(tween._func(), toTargetObject);
+ const tweenFunc = tween._func;
+ if (tweenFunc) {
+ const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
+ decomposeRawValue(ogValue, decomposedOriginalValue);
+ decomposeRawValue(tweenFunc(), toTargetObject);
+ tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
+ tween._fromNumber = decomposedOriginalValue.n;
tween._toNumbers = cloneArray(toTargetObject.d);
tween._strings = cloneArray(toTargetObject.s);
tween._toNumber = toTargetObject.n;
@@ -3898,30 +4065,9 @@ const commonDefaultPXProperties = [
...transformsShorthands
];
-const validIndividualTransforms = [...transformsShorthands, ...validTransforms.filter(t => ['X', 'Y', 'Z'].some(axis => t.endsWith(axis)))];
-
-// Setting it to true in case CSS.registerProperty is not supported will automatically skip the registration and fallback to no animation
-let transformsPropertiesRegistered = isBrowser && (isUnd(CSS) || !Object.hasOwnProperty.call(CSS, 'registerProperty'));
-
-const registerTransformsProperties = () => {
- if (transformsPropertiesRegistered) return;
- validTransforms.forEach(t => {
- const isSkew = stringStartsWith(t, 'skew');
- const isScale = stringStartsWith(t, 'scale');
- const isRotate = stringStartsWith(t, 'rotate');
- const isTranslate = stringStartsWith(t, 'translate');
- const isAngle = isRotate || isSkew;
- const syntax = isAngle ? '<angle>' : isScale ? "<number>" : isTranslate ? "<length-percentage>" : "*";
- try {
- CSS.registerProperty({
- name: '--' + t,
- syntax,
- inherits: false,
- initialValue: isTranslate ? '0px' : isAngle ? '0deg' : isScale ? '1' : '0',
- });
- } catch {} });
- transformsPropertiesRegistered = true;
-};
+const validIndividualTransforms = /*#__PURE__*/ (() => [...transformsShorthands, ...validTransforms.filter(t => ['X', 'Y', 'Z'].some(axis => t.endsWith(axis)))])();
+
+let transformsPropertiesRegistered = null;
const WAAPIAnimationsLookups = {
_head: null,
@@ -4032,9 +4178,31 @@ class WAAPIAnimation {
*/
constructor(targets, params) {
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
- registerTransformsProperties();
+ // Skip the registration and fallback to no animation in case CSS.registerProperty is not supported
+ if (isNil(transformsPropertiesRegistered)) {
+ if (isBrowser && (isUnd(CSS) || !Object.hasOwnProperty.call(CSS, 'registerProperty'))) {
+ transformsPropertiesRegistered = false;
+ } else {
+ validTransforms.forEach(t => {
+ const isSkew = stringStartsWith(t, 'skew');
+ const isScale = stringStartsWith(t, 'scale');
+ const isRotate = stringStartsWith(t, 'rotate');
+ const isTranslate = stringStartsWith(t, 'translate');
+ const isAngle = isRotate || isSkew;
+ const syntax = isAngle ? '<angle>' : isScale ? "<number>" : isTranslate ? "<length-percentage>" : "*";
+ try {
+ CSS.registerProperty({
+ name: '--' + t,
+ syntax,
+ inherits: false,
+ initialValue: isTranslate ? '0px' : isAngle ? '0deg' : isScale ? '1' : '0',
+ });
+ } catch {} });
+ transformsPropertiesRegistered = true;
+ }
+ }
const parsedTargets = registerTargets(targets);
const targetsLength = parsedTargets.length;
@@ -4488,12 +4656,10 @@ const remove = (targets, renderable, propertyName) => {
};
/**
- * @param {Number} min
- * @param {Number} max
- * @param {Number} [decimalLength]
- * @return {Number}
+ * @param {(...args: any[]) => Tickable} constructor
+ * @return {(...args: any[]) => Tickable}
*/
-const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength || 0); return floor((Math.random() * (max - min + (1 / m)) + min) * m) / m };
+const keepTime = createRefreshable;
/**
* @param {String|Array} items
@@ -4501,17 +4667,6 @@ const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength ||
*/
const randomPick = items => items[random(0, items.length - 1)];
-/**
- * Adapted from https://bost.ocks.org/mike/shuffle/
- * @param {Array} items
- * @return {Array}
- */
-const shuffle = items => {
- let m = items.length, t, i;
- while (m) { i = random(0, --m); t = items[m]; items[m] = items[i]; items[i] = t; }
- return items;
-};
-
/**
* @param {Number|String} v
* @param {Number} decimalLength
@@ -4706,6 +4861,7 @@ const utils = {
shuffle,
lerp,
sync,
+ keepTime,
clamp: /** @type {typeof clamp & ChainedClamp} */(makeChainable(clamp)),
round: /** @type {typeof round & ChainedRound} */(makeChainable(round)),
snap: /** @type {typeof snap & ChainedSnap} */(makeChainable(snap)),
@@ -5045,7 +5201,7 @@ class Animatable {
* @param {AnimatableParams} parameters
*/
constructor(targets, parameters) {
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
/** @type {AnimationParams} */
const globalParams = {};
const properties = {};
@@ -5381,7 +5537,7 @@ class Draggable {
*/
constructor(target, parameters = {}) {
if (!target) return;
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const paramX = parameters.x;
const paramY = parameters.y;
const trigger = parameters.trigger;
@@ -6442,44 +6598,10 @@ const createDraggable = (target, parameters) => new Draggable(target, parameters
-/**
- * @typedef {Object} ReactRef
- * @property {HTMLElement|SVGElement|null} [current]
- */
-
-/**
- * @typedef {Object} AngularRef
- * @property {HTMLElement|SVGElement} [nativeElement]
- */
-
-/**
- * @typedef {Object} ScopeParams
- * @property {DOMTargetSelector|ReactRef|AngularRef} [root]
- * @property {DefaultsParams} [defaults]
- * @property {Record<String, String>} [mediaQueries]
- */
-
-/**
- * @callback ScopeCleanup
- * @param {Scope} [scope]
- */
-
-/**
- * @callback ScopeConstructor
- * @param {Scope} [scope]
- * @return {ScopeCleanup|void}
- */
-
-/**
- * @callback ScopeMethod
- * @param {...*} args
- * @return {ScopeCleanup|void}
- */
-
class Scope {
/** @param {ScopeParams} [parameters] */
constructor(parameters = {}) {
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const rootParam = parameters.root;
/** @type {Document|DOMTarget} */
let root = doc;
@@ -6496,13 +6618,23 @@ class Scope {
this.defaults = scopeDefaults ? mergeObjects(scopeDefaults, globalDefault) : globalDefault;
/** @type {Document|DOMTarget} */
this.root = root;
- /** @type {Array<ScopeConstructor>} */
+ /** @type {Array<ScopeConstructorCallback>} */
this.constructors = [];
- /** @type {Array<Function>} */
+ /** @type {Array<ScopeCleanupCallback>} */
this.revertConstructors = [];
/** @type {Array<Revertible>} */
this.revertibles = [];
- /** @type {Record<String, Function>} */
+ /** @type {Array<ScopeConstructorCallback | ((scope: this) => Tickable)>} */
+ this.constructorsOnce = [];
+ /** @type {Array<ScopeCleanupCallback>} */
+ this.revertConstructorsOnce = [];
+ /** @type {Array<Revertible>} */
+ this.revertiblesOnce = [];
+ /** @type {Boolean} */
+ this.once = false;
+ /** @type {Number} */
+ this.onceIndex = 0;
+ /** @type {Record<String, ScopeMethod>} */
this.methods = {};
/** @type {Record<String, Boolean>} */
this.matches = {};
@@ -6520,25 +6652,30 @@ class Scope {
}
/**
- * @callback ScoppedCallback
- * @param {this} scope
- * @return {any}
- *
- * @param {ScoppedCallback} cb
- * @return {this}
+ * @param {Revertible} revertible
+ */
+ register(revertible) {
+ const store = this.once ? this.revertiblesOnce : this.revertibles;
+ store.push(revertible);
+ }
+
+ /**
+ * @template T
+ * @param {ScopedCallback<T>} cb
+ * @return {T}
*/
execute(cb) {
- let activeScope = globals.scope;
- let activeRoot = globals.root;
+ let activeScope = scope.current;
+ let activeRoot = scope.root;
let activeDefaults = globals.defaults;
- globals.scope = this;
- globals.root = this.root;
+ scope.current = this;
+ scope.root = this.root;
globals.defaults = this.defaults;
const mqs = this.mediaQueryLists;
for (let mq in mqs) this.matches[mq] = mqs[mq].matches;
const returned = cb(this);
- globals.scope = activeScope;
- globals.root = activeRoot;
+ scope.current = activeScope;
+ scope.root = activeRoot;
globals.defaults = activeDefaults;
return returned;
}
@@ -6547,6 +6684,7 @@ class Scope {
* @return {this}
*/
refresh() {
+ this.onceIndex = 0;
this.execute(() => {
let i = this.revertibles.length;
let y = this.revertConstructors.length;
@@ -6554,9 +6692,9 @@ class Scope {
while (y--) this.revertConstructors[y](this);
this.revertibles.length = 0;
this.revertConstructors.length = 0;
- this.constructors.forEach( constructor => {
+ this.constructors.forEach((/** @type {ScopeConstructorCallback} */constructor) => {
const revertConstructor = constructor(this);
- if (revertConstructor) {
+ if (isFnc(revertConstructor)) {
this.revertConstructors.push(revertConstructor);
}
});
@@ -6565,28 +6703,26 @@ class Scope {
}
/**
- * @callback contructorCallback
- * @param {this} self
- *
* @overload
* @param {String} a1
* @param {ScopeMethod} a2
* @return {this}
*
* @overload
- * @param {contructorCallback} a1
+ * @param {ScopeConstructorCallback} a1
* @return {this}
*
- * @param {String|contructorCallback} a1
+ * @param {String|ScopeConstructorCallback} a1
* @param {ScopeMethod} [a2]
*/
add(a1, a2) {
+ this.once = false;
if (isFnc(a1)) {
- const constructor = /** @type {contructorCallback} */(a1);
+ const constructor = /** @type {ScopeConstructorCallback} */(a1);
this.constructors.push(constructor);
this.execute(() => {
const revertConstructor = constructor(this);
- if (revertConstructor) {
+ if (isFnc(revertConstructor)) {
this.revertConstructors.push(revertConstructor);
}
});
@@ -6596,6 +6732,46 @@ class Scope {
return this;
}
+ /**
+ * @param {ScopeConstructorCallback} scopeConstructorCallback
+ * @return {this}
+ */
+ addOnce(scopeConstructorCallback) {
+ this.once = true;
+ if (isFnc(scopeConstructorCallback)) {
+ const currentIndex = this.onceIndex++;
+ const tracked = this.constructorsOnce[currentIndex];
+ if (tracked) return this;
+ const constructor = /** @type {ScopeConstructorCallback} */(scopeConstructorCallback);
+ this.constructorsOnce[currentIndex] = constructor;
+ this.execute(() => {
+ const revertConstructor = constructor(this);
+ if (isFnc(revertConstructor)) {
+ this.revertConstructorsOnce.push(revertConstructor);
+ }
+ });
+ }
+ return this;
+ }
+
+ /**
+ * @param {(scope: this) => Tickable} cb
+ * @return {Tickable}
+ */
+ keepTime(cb) {
+ this.once = true;
+ const currentIndex = this.onceIndex++;
+ const tracked = /** @type {(scope: this) => Tickable} */(this.constructorsOnce[currentIndex]);
+ if (isFnc(tracked)) return tracked(this);
+ const constructor = /** @type {(scope: this) => Tickable} */(createRefreshable(cb));
+ this.constructorsOnce[currentIndex] = constructor;
+ let trackedTickable;
+ this.execute(() => {
+ trackedTickable = constructor(this);
+ });
+ return trackedTickable;
+ }
+
/**
* @param {Event} e
*/
@@ -6610,15 +6786,25 @@ class Scope {
revert() {
const revertibles = this.revertibles;
const revertConstructors = this.revertConstructors;
+ const revertiblesOnce = this.revertiblesOnce;
+ const revertConstructorsOnce = this.revertConstructorsOnce;
const mqs = this.mediaQueryLists;
let i = revertibles.length;
- let y = revertConstructors.length;
+ let j = revertConstructors.length;
+ let k = revertiblesOnce.length;
+ let l = revertConstructorsOnce.length;
while (i--) revertibles[i].revert();
- while (y--) revertConstructors[y](this);
+ while (j--) revertConstructors[j](this);
+ while (k--) revertiblesOnce[k].revert();
+ while (l--) revertConstructorsOnce[l](this);
for (let mq in mqs) mqs[mq].removeEventListener('change', this);
revertibles.length = 0;
revertConstructors.length = 0;
this.constructors.length = 0;
+ revertiblesOnce.length = 0;
+ revertConstructorsOnce.length = 0;
+ this.constructorsOnce.length = 0;
+ this.onceIndex = 0;
this.matches = {};
this.methods = {};
this.mediaQueryLists = {};
@@ -6944,7 +7130,7 @@ const getAnimationDomTarget = linked => {
let scrollerIndex = 0;
-const debugColors = ['#FF4B4B','#FF971B','#FFC730','#F9F640','#7AFF5A','#18FF74','#17E09B','#3CFFEC','#05DBE9','#33B3F1','#638CF9','#C563FE','#FF4FCF','#F93F8A'];
+const debugColors$1 = ['#FF4B4B','#FF971B','#FFC730','#F9F640','#7AFF5A','#18FF74','#17E09B','#3CFFEC','#05DBE9','#33B3F1','#638CF9','#C563FE','#FF4FCF','#F93F8A'];
/**
* @typedef {Object} ScrollThresholdParam
@@ -6990,7 +7176,7 @@ class ScrollObserver {
* @param {ScrollObserverParams} parameters
*/
constructor(parameters = {}) {
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const syncMode = setValue(parameters.sync, 'play pause');
const ease = syncMode ? parseEasings(/** @type {EasingParam} */(syncMode)) : null;
const isLinear = syncMode && (syncMode === 'linear' || syncMode === none);
@@ -7187,7 +7373,7 @@ class ScrollObserver {
const $debug = doc.createElement('div');
const $thresholds = doc.createElement('div');
const $triggers = doc.createElement('div');
- const color = debugColors[this.index % debugColors.length];
+ const color = debugColors$1[this.index % debugColors$1.length];
const useWin = container.useWin;
const containerWidth = useWin ? container.winWidth : container.width;
const containerHeight = useWin ? container.winHeight : container.height;
@@ -7545,29 +7731,462 @@ const onScroll = (parameters = {}) => new ScrollObserver(parameters);
+const segmenter = !isUnd(Intl) && Intl.Segmenter;
+const valueRgx = /\{value\}/g;
+const indexRgx = /\{i\}/g;
+const whiteSpaceGroupRgx = /(\s+)/;
+const whiteSpaceRgx = /^\s+$/;
+const lineType = 'line';
+const wordType = 'word';
+const charType = 'char';
+const dataLine = `data-line`;
+
/**
- * @typedef {Object} StaggerParameters
- * @property {Number|String} [start]
- * @property {Number|'first'|'center'|'last'} [from]
- * @property {Boolean} [reversed]
- * @property {Array.<Number>} [grid]
- * @property {('x'|'y')} [axis]
- * @property {EasingParam} [ease]
- * @property {TweenModifier} [modifier]
+ * @typedef {Object} Segment
+ * @property {String} segment
+ * @property {Boolean} [isWordLike]
*/
/**
- * @callback StaggerFunction
- * @param {Target} [target]
- * @param {Number} [index]
- * @param {Number} [length]
- * @param {Timeline} [tl]
- * @return {Number|String}
+ * @typedef {Object} Segmenter
+ * @property {function(String): Iterable<Segment>} segment
+ */
+
+/** @type {Segmenter} */
+let wordSegmenter = null;
+/** @type {Segmenter} */
+let graphemeSegmenter = null;
+let $splitTemplate = null;
+
+/**
+ * @param {Segment} seg
+ * @return {Boolean}
+ */
+const isSegmentWordLike = seg => {
+ return seg.isWordLike ||
+ seg.segment === ' ' || // Consider spaces as words first, then handle them diffrently later
+ isNum(+seg.segment); // Safari doesn't considers numbers as words
+};
+
+/**
+ * @param {HTMLElement} $el
+ */
+const setAriaHidden = $el => $el.setAttribute('aria-hidden', 'true');
+
+/**
+ * @param {DOMTarget} $el
+ * @param {String} type
+ * @return {Array<HTMLElement>}
+ */
+const getAllTopLevelElements = ($el, type) => [.../** @type {*} */($el.querySelectorAll(`[data-${type}]:not([data-${type}] [data-${type}])`))];
+
+const debugColors = { line: '#00D672', word: '#FF4B4B', char: '#5A87FF' };
+
+/**
+ * @param {HTMLElement} $el
+ */
+const filterEmptyElements = $el => {
+ if (!$el.childElementCount && !$el.textContent.trim()) {
+ const $parent = $el.parentElement;
+ $el.remove();
+ if ($parent) filterEmptyElements($parent);
+ }
+};
+
+/**
+ * @param {HTMLElement} $el
+ * @param {Number} lineIndex
+ * @param {Set<HTMLElement>} bin
+ * @returns {Set<HTMLElement>}
+ */
+const filterLineElements = ($el, lineIndex, bin) => {
+ const dataLineAttr = $el.getAttribute(dataLine);
+ if (dataLineAttr !== null && +dataLineAttr !== lineIndex || $el.tagName === 'BR') bin.add($el);
+ let i = $el.childElementCount;
+ while (i--) filterLineElements(/** @type {HTMLElement} */($el.children[i]), lineIndex, bin);
+ return bin;
+};
+
+/**
+ * @param {'line'|'word'|'char'} type
+ * @param {splitTemplateParams} params
+ * @return {String}
+ */
+const generateTemplate = (type, params = {}) => {
+ let template = ``;
+ const classString = isStr(params.class) ? ` class="${params.class}"` : '';
+ const cloneType = setValue(params.clone, false);
+ const wrapType = setValue(params.wrap, false);
+ const overflow = wrapType ? wrapType === true ? 'clip' : wrapType : cloneType ? 'clip' : false;
+ if (wrapType) template += `<span${overflow ? ` style="overflow:${overflow};"` : ''}>`;
+ template += `<span${classString}${cloneType ? ` style="position:relative;"` : ''} data-${type}="{i}">`;
+ if (cloneType) {
+ const left = cloneType === 'left' ? '-100%' : cloneType === 'right' ? '100%' : '0';
+ const top = cloneType === 'top' ? '-100%' : cloneType === 'bottom' ? '100%' : '0';
+ template += `<span>{value}</span>`;
+ template += `<span inert style="position:absolute;top:${top};left:${left};white-space:nowrap;">{value}</span>`;
+ } else {
+ template += `{value}`;
+ }
+ template += `</span>`;
+ if (wrapType) template += `</span>`;
+ return template;
+};
+
+/**
+ * @param {String|SplitFunctionValue} htmlTemplate
+ * @param {Array<HTMLElement>} store
+ * @param {Node|HTMLElement} node
+ * @param {DocumentFragment} $parentFragment
+ * @param {'line'|'word'|'char'} type
+ * @param {Boolean} debug
+ * @param {Number} lineIndex
+ * @param {Number} [wordIndex]
+ * @param {Number} [charIndex]
+ * @return {HTMLElement}
+ */
+const processHTMLTemplate = (htmlTemplate, store, node, $parentFragment, type, debug, lineIndex, wordIndex, charIndex) => {
+ const isLine = type === lineType;
+ const isChar = type === charType;
+ const className = `_${type}_`;
+ const template = isFnc(htmlTemplate) ? htmlTemplate(node) : htmlTemplate;
+ const displayStyle = isLine ? 'block' : 'inline-block';
+ $splitTemplate.innerHTML = template
+ .replace(valueRgx, `<i class="${className}"></i>`)
+ .replace(indexRgx, `${isChar ? charIndex : isLine ? lineIndex : wordIndex}`);
+ const $content = $splitTemplate.content;
+ const $highestParent = /** @type {HTMLElement} */($content.firstElementChild);
+ const $split = /** @type {HTMLElement} */($content.querySelector(`[data-${type}]`)) || $highestParent;
+ const $replacables = /** @type {NodeListOf<HTMLElement>} */($content.querySelectorAll(`i.${className}`));
+ const replacablesLength = $replacables.length;
+ if (replacablesLength) {
+ $highestParent.style.display = displayStyle;
+ $split.style.display = displayStyle;
+ $split.setAttribute(dataLine, `${lineIndex}`);
+ if (!isLine) {
+ $split.setAttribute('data-word', `${wordIndex}`);
+ if (isChar) $split.setAttribute('data-char', `${charIndex}`);
+ }
+ let i = replacablesLength;
+ while (i--) {
+ const $replace = $replacables[i];
+ const $closestParent = $replace.parentElement;
+ $closestParent.style.display = displayStyle;
+ if (isLine) {
+ $closestParent.innerHTML = /** @type {HTMLElement} */(node).innerHTML;
+ } else {
+ $closestParent.replaceChild(node.cloneNode(true), $replace);
+ }
+ }
+ store.push($split);
+ $parentFragment.appendChild($content);
+ } else {
+ console.warn(`The expression "{value}" is missing from the provided template.`);
+ }
+ if (debug) $highestParent.style.outline = `1px dotted ${debugColors[type]}`;
+ return $highestParent;
+};
+
+/**
+ * A class that splits text into words and wraps them in span elements while preserving the original HTML structure.
+ * @class
+ */
+class TextSplitter {
+ /**
+ * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target
+ * @param {TextSplitterParams} [parameters]
+ */
+ constructor(target, parameters = {}) {
+ // Only init segmenters when needed
+ if (!wordSegmenter) wordSegmenter = segmenter ? new segmenter([], { granularity: wordType }) : {
+ segment: (text) => {
+ const segments = [];
+ const words = text.split(whiteSpaceGroupRgx);
+ for (let i = 0, l = words.length; i < l; i++) {
+ const segment = words[i];
+ segments.push({
+ segment,
+ isWordLike: !whiteSpaceRgx.test(segment), // Consider non-whitespace as word-like
+ });
+ }
+ return segments;
+ }
+ };
+ if (!graphemeSegmenter) graphemeSegmenter = segmenter ? new segmenter([], { granularity: 'grapheme' }) : {
+ segment: text => [...text].map(char => ({ segment: char }))
+ };
+ if (!$splitTemplate && isBrowser) $splitTemplate = doc.createElement('template');
+ if (scope.current) scope.current.register(this);
+ const { words, chars, lines, accessible, includeSpaces, debug } = parameters;
+ const $target = /** @type {HTMLElement} */((target = isArr(target) ? target[0] : target) && /** @type {Node} */(target).nodeType ? target : (getNodeList(target) || [])[0]);
+ const lineParams = lines === true ? {} : lines;
+ const wordParams = words === true || isUnd(words) ? {} : words;
+ const charParams = chars === true ? {} : chars;
+ this.debug = setValue(debug, false);
+ this.includeSpaces = setValue(includeSpaces, false);
+ this.accessible = setValue(accessible, true);
+ this.linesOnly = lineParams && (!wordParams && !charParams);
+ /** @type {String|false|SplitFunctionValue} */
+ this.lineTemplate = isObj(lineParams) ? generateTemplate(lineType, /** @type {splitTemplateParams} */(lineParams)) : lineParams;
+ /** @type {String|false|SplitFunctionValue} */
+ this.wordTemplate = isObj(wordParams) || this.linesOnly ? generateTemplate(wordType, /** @type {splitTemplateParams} */(wordParams)) : wordParams;
+ /** @type {String|false|SplitFunctionValue} */
+ this.charTemplate = isObj(charParams) ? generateTemplate(charType, /** @type {splitTemplateParams} */(charParams)) : charParams;
+ this.$target = $target;
+ this.html = $target && $target.innerHTML;
+ this.lines = [];
+ this.words = [];
+ this.chars = [];
+ this.effects = [];
+ this.effectsCleanups = [];
+ this.cache = null;
+ this.ready = false;
+ this.width = 0;
+ this.resizeTimeout = null;
+ const handleSplit = () => this.html && (lineParams || wordParams || charParams) && this.split();
+ // Make sure this is declared before calling handleSplit() in case revert() is called inside an effect callback
+ this.resizeObserver = new ResizeObserver(() => {
+ // Use a setTimeout instead of a Timer for better tree shaking
+ clearTimeout(this.resizeTimeout);
+ this.resizeTimeout = setTimeout(() => {
+ const currentWidth = /** @type {HTMLElement} */($target).offsetWidth;
+ if (currentWidth === this.width) return;
+ this.width = currentWidth;
+ handleSplit();
+ }, 150);
+ });
+ // Only declare the font ready promise when splitting by lines and not alreay split
+ if (this.lineTemplate && !this.ready) {
+ doc.fonts.ready.then(handleSplit);
+ } else {
+ handleSplit();
+ }
+ $target ? this.resizeObserver.observe($target) : console.warn('No Text Splitter target found.');
+ }
+
+ /**
+ * @param {(...args: any[]) => Tickable | (() => void)} effect
+ * @return this
+ */
+ addEffect(effect) {
+ if (!isFnc(effect)) return console.warn('Effect must return a function.');
+ const refreshableEffect = createRefreshable(effect);
+ this.effects.push(refreshableEffect);
+ if (this.ready) this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);
+ return this;
+ }
+
+ revert() {
+ clearTimeout(this.resizeTimeout);
+ this.lines.length = this.words.length = this.chars.length = 0;
+ this.resizeObserver.disconnect();
+ // Make sure to revert the effects after disconnecting the resizeObserver to avoid triggering it in the process
+ this.effectsCleanups.forEach(cleanup => isFnc(cleanup) ? cleanup(this) : cleanup.revert && cleanup.revert());
+ this.$target.innerHTML = this.html;
+ return this;
+ }
+
+ /**
+ * Recursively processes a node and its children
+ * @param {Node} node
+ */
+ splitNode(node) {
+ const wordTemplate = this.wordTemplate;
+ const charTemplate = this.charTemplate;
+ const includeSpaces = this.includeSpaces;
+ const debug = this.debug;
+ const nodeType = node.nodeType;
+ if (nodeType === 3) {
+ const nodeText = node.nodeValue;
+ // If the nodeText is only whitespace, leave it as is
+ if (nodeText.trim()) {
+ const tempWords = [];
+ const words = this.words;
+ const chars = this.chars;
+ const wordSegments = wordSegmenter.segment(nodeText);
+ const $wordsFragment = doc.createDocumentFragment();
+ let prevSeg = null;
+ for (const wordSegment of wordSegments) {
+ const segment = wordSegment.segment;
+ const isWordLike = isSegmentWordLike(wordSegment);
+ // Determine if this segment should be a new word, first segment always becomes a new word
+ if (!prevSeg || (isWordLike && (prevSeg && (isSegmentWordLike(prevSeg))))) {
+ tempWords.push(segment);
+ } else {
+ // Only concatenate if both current and previous are non-word-like and don't contain spaces
+ const lastWordIndex = tempWords.length - 1;
+ const lastWord = tempWords[lastWordIndex];
+ if (!lastWord.includes(' ') && !segment.includes(' ')) {
+ tempWords[lastWordIndex] += segment;
+ } else {
+ tempWords.push(segment);
+ }
+ }
+ prevSeg = wordSegment;
+ }
+
+ for (let i = 0, l = tempWords.length; i < l; i++) {
+ const word = tempWords[i];
+ if (!word.trim()) {
+ // Preserve whitespace only if includeSpaces is false and if the current space is not the first node
+ if (i && includeSpaces) continue;
+ $wordsFragment.appendChild(doc.createTextNode(word));
+ } else {
+ const nextWord = tempWords[i + 1];
+ const hasWordFollowingSpace = includeSpaces && nextWord && !nextWord.trim();
+ const wordToProcess = word;
+ const charSegments = charTemplate ? graphemeSegmenter.segment(wordToProcess) : null;
+ const $charsFragment = charTemplate ? doc.createDocumentFragment() : doc.createTextNode(hasWordFollowingSpace ? word + '\xa0' : word);
+ if (charTemplate) {
+ const charSegmentsArray = [...charSegments];
+ for (let j = 0, jl = charSegmentsArray.length; j < jl; j++) {
+ const charSegment = charSegmentsArray[j];
+ const isLastChar = j === jl - 1;
+ // If this is the last character and includeSpaces is true with a following space, append the space
+ const charText = isLastChar && hasWordFollowingSpace ? charSegment.segment + '\xa0' : charSegment.segment;
+ const $charNode = doc.createTextNode(charText);
+ processHTMLTemplate(charTemplate, chars, $charNode, /** @type {DocumentFragment} */($charsFragment), charType, debug, -1, words.length, chars.length);
+ }
+ }
+ if (wordTemplate) {
+ processHTMLTemplate(wordTemplate, words, $charsFragment, $wordsFragment, wordType, debug, -1, words.length, chars.length);
+ // Chars elements must be re-parsed in the split() method if both words and chars are parsed
+ } else if (charTemplate) {
+ $wordsFragment.appendChild($charsFragment);
+ } else {
+ $wordsFragment.appendChild(doc.createTextNode(word));
+ }
+ // Skip the next iteration if we included a space
+ if (hasWordFollowingSpace) i++;
+ }
+ }
+ node.parentNode.replaceChild($wordsFragment, node);
+ }
+ } else if (nodeType === 1) {
+ // Converting to an array is necessary to work around childNodes pottential mutation
+ const childNodes = /** @type {Array<Node>} */([.../** @type {*} */(node.childNodes)]);
+ for (let i = 0, l = childNodes.length; i < l; i++) this.splitNode(childNodes[i]);
+ }
+ }
+
+ /**
+ * @param {Boolean} clearCache
+ * @return {this}
+ */
+ split(clearCache = false) {
+ const $el = this.$target;
+ const isCached = !!this.cache && !clearCache;
+ const lineTemplate = this.lineTemplate;
+ const wordTemplate = this.wordTemplate;
+ const charTemplate = this.charTemplate;
+ const fontsReady = doc.fonts.status !== 'loading';
+ const canSplitLines = lineTemplate && fontsReady;
+ this.ready = !lineTemplate || fontsReady;
+ if (!isCached) {
+ if (clearCache) {
+ $el.innerHTML = this.html;
+ this.words.length = this.chars.length = 0;
+ }
+ this.splitNode($el);
+ this.cache = $el.innerHTML;
+ }
+ // Always reset the html when splitting by lines
+ if (canSplitLines) {
+ // No need to revert effects animations here since it's already taken care by the refreshable
+ this.effectsCleanups.forEach(cleanup => isFnc(cleanup) && cleanup(this));
+ if (isCached) $el.innerHTML = this.cache;
+ this.lines.length = 0;
+ if (wordTemplate) this.words = getAllTopLevelElements($el, wordType);
+ }
+ // Always reparse characters after a line reset or if both words and chars are activated
+ if (charTemplate && (canSplitLines || wordTemplate)) {
+ this.chars = getAllTopLevelElements($el, charType);
+ }
+ // Words are used when lines only and prioritized over chars
+ const elementsArray = this.words.length ? this.words : this.chars;
+ let y, linesCount = 0;
+ for (let i = 0, l = elementsArray.length; i < l; i++) {
+ const $el = elementsArray[i];
+ const { top, height } = $el.getBoundingClientRect();
+ if (y && top - y > height * .5) linesCount++;
+ $el.setAttribute(dataLine, `${linesCount}`);
+ const nested = $el.querySelectorAll(`[${dataLine}]`);
+ let c = nested.length;
+ while (c--) nested[c].setAttribute(dataLine, `${linesCount}`);
+ y = top;
+ }
+ if (canSplitLines) {
+ const linesFragment = doc.createDocumentFragment();
+ const parents = new Set();
+ const clones = [];
+ for (let lineIndex = 0; lineIndex < linesCount + 1; lineIndex++) {
+ const $clone = /** @type {HTMLElement} */($el.cloneNode(true));
+ filterLineElements($clone, lineIndex, new Set()).forEach($el => {
+ const $parent = $el.parentElement;
+ if ($parent) parents.add($parent);
+ $el.remove();
+ });
+ clones.push($clone);
+ }
+ parents.forEach(filterEmptyElements);
+ for (let cloneIndex = 0, clonesLength = clones.length; cloneIndex < clonesLength; cloneIndex++) {
+ processHTMLTemplate(lineTemplate, this.lines, clones[cloneIndex], linesFragment, lineType, this.debug, cloneIndex);
+ }
+ $el.innerHTML = '';
+ $el.appendChild(linesFragment);
+ if (wordTemplate) this.words = getAllTopLevelElements($el, wordType);
+ if (charTemplate) this.chars = getAllTopLevelElements($el, charType);
+ }
+ // Remove the word wrappers and clear the words array if lines split only
+ if (this.linesOnly) {
+ const words = this.words;
+ let w = words.length;
+ while (w--) {
+ const $word = words[w];
+ $word.replaceWith($word.textContent);
+ }
+ words.length = 0;
+ }
+ if (canSplitLines || clearCache) {
+ this.effects.forEach((effect, i) => this.effectsCleanups[i] = effect(this));
+ }
+ if (this.accessible && (canSplitLines || !isCached)) {
+ const $accessible = doc.createElement('span');
+ // Make the accessible element visually-hidden (https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html)
+ $accessible.style.cssText = `position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;`;
+ // $accessible.setAttribute('tabindex', '-1');
+ $accessible.innerHTML = this.html;
+ $el.insertBefore($accessible, $el.firstChild);
+ this.lines.forEach(setAriaHidden);
+ this.words.forEach(setAriaHidden);
+ this.chars.forEach(setAriaHidden);
+ }
+ this.width = /** @type {HTMLElement} */($el).offsetWidth;
+ return this;
+ }
+
+ refresh() {
+ this.split(true);
+ }
+}
+
+/**
+ * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target
+ * @param {TextSplitterParams} [parameters]
+ * @return {TextSplitter}
*/
+const split = (target, parameters) => new TextSplitter(target, parameters);
+
+const text = {
+ split,
+};
+
+
+
/**
* @param {Number|String|[Number|String,Number|String]} val
- * @param {StaggerParameters} params
+ * @param {StaggerParams} params
* @return {StaggerFunction}
*/
const stagger = (val, params = {}) => {
@@ -7581,20 +8200,27 @@ const stagger = (val, params = {}) => {
const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parseEasings(ease) : null;
const grid = params.grid;
const axis = params.axis;
+ const customTotal = params.total;
const fromFirst = isUnd(from) || from === 0 || from === 'first';
const fromCenter = from === 'center';
const fromLast = from === 'last';
+ const fromRandom = from === 'random';
const isRange = isArr(val);
+ const useProp = params.use;
const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);
const val2 = isRange ? parseNumber(val[1]) : 0;
const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);
const start = params.start || 0 + (isRange ? val1 : 0);
let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;
- return (_, i, t, tl) => {
- if (fromCenter) fromIndex = (t - 1) / 2;
- if (fromLast) fromIndex = t - 1;
+ return (target, i, t, tl) => {
+ const [ registeredTarget ] = registerTargets(target);
+ const total = isUnd(customTotal) ? t : customTotal;
+ const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;
+ const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;
+ if (fromCenter) fromIndex = (total - 1) / 2;
+ if (fromLast) fromIndex = total - 1;
if (!values.length) {
- for (let index = 0; index < t; index++) {
+ for (let index = 0; index < total; index++) {
if (!grid) {
values.push(abs(fromIndex - index));
} else {
@@ -7613,15 +8239,16 @@ const stagger = (val, params = {}) => {
}
if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);
if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));
+ if (fromRandom) values = shuffle(values);
}
const spacing = isRange ? (val2 - val1) / maxValue : val1;
const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);
/** @type {String|Number} */
- let output = offset + ((spacing * round(values[i], 2)) || 0);
+ let output = offset + ((spacing * round(values[staggerIndex], 2)) || 0);
if (params.modifier) output = params.modifier(output);
if (unitMatch) output = `${output}${unitMatch[2]}`;
return output;
}
};
-export { Animatable, Draggable, JSAnimation, Scope, ScrollObserver, Spring, Timeline, Timer, WAAPIAnimation, animate, createAnimatable, createDraggable, createScope, createSpring, createTimeline, createTimer, eases, engine, onScroll, scrollContainers, stagger, svg, utils, waapi };
+export { Animatable, Draggable, JSAnimation, Scope, ScrollObserver, Spring, TextSplitter, Timeline, Timer, WAAPIAnimation, animate, createAnimatable, createDraggable, createScope, createSpring, createTimeline, createTimer, eases, engine, onScroll, scrollContainers, stagger, svg, text, utils, waapi };
diff --git a/lib/anime.esm.min.js b/lib/anime.esm.min.js
index a0485a94..5876a6a0 100644
--- a/lib/anime.esm.min.js
+++ b/lib/anime.esm.min.js
@@ -1,9 +1,9 @@
/**
* anime.js - ESM
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
-const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={replace:0,none:1,blend:2},r=Symbol(),n=Symbol(),o=Symbol(),a=Symbol(),h=Symbol(),l=Symbol(),c=1e-11,d=1e12,u=1e3,p="",m=new Map;m.set("x","translateX"),m.set("y","translateY"),m.set("z","translateZ");const f=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],g=f.reduce(((t,e)=>({...t,[e]:e+"("})),{}),_=()=>{},y=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,v=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,b=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,S=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,x=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,T=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,w=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,k=/([a-z])([A-Z])/g,$=/(\w+)(\([^)]+\)+)/g,E=/(\*=|\+=|-=)/,C={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:u,delay:0,loopDelay:0,ease:"out(2)",composition:i.replace,modifier:t=>t,onBegin:_,onBeforeUpdate:_,onUpdate:_,onLoop:_,onPause:_,onComplete:_,onRender:_},B={defaults:C,root:s,scope:null,precision:4,timeScale:1,tickThreshold:200},D={version:"4.0.2",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(D));const L=t=>t.replace(k,"$1-$2").toLowerCase(),N=(t,e)=>0===t.indexOf(e),A=Date.now,F=Array.isArray,P=t=>t&&t.constructor===Object,R=t=>"number"==typeof t&&!isNaN(t),Y=t=>"string"==typeof t,X=t=>"function"==typeof t,M=t=>void 0===t,z=t=>M(t)||null===t,O=e=>t&&e instanceof SVGElement,I=t=>y.test(t),W=t=>N(t,"rgb"),V=t=>N(t,"hsl"),U=t=>!B.defaults.hasOwnProperty(t),H=t=>Y(t)?parseFloat(t):t,q=Math.pow,Q=Math.sqrt,j=Math.sin,G=Math.cos,Z=Math.abs,J=Math.exp,K=Math.ceil,tt=Math.floor,et=Math.asin,st=Math.max,it=Math.atan2,rt=Math.PI,nt=Math.round,ot=(t,e,s)=>t<e?e:t>s?s:t,at={},ht=(t,e)=>{if(e<0)return t;if(!e)return nt(t);let s=at[e];return s||(s=at[e]=10**e),nt(t*s)/s},lt=(t,e)=>F(e)?e.reduce(((e,s)=>Z(s-t)<Z(e-t)?s:e)):e?nt(t/e)*e:t,ct=(t,e,s)=>t+(e-t)*s,dt=t=>t===1/0?d:t===-1/0?-1e12:t,ut=t=>t<=c?c:dt(ht(t,11)),pt=t=>F(t)?[...t]:t,mt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=M(r)?e[i]:r}return s},ft=(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}},gt=(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},_t=(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};class yt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=ht(u/120,0),this._fps=120,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=ht(u/i,0);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,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const vt=(t,e,s,r,n)=>{const o=t.parent,h=t.duration,l=t.completed,d=t.iterationDuration,u=t.iterationCount,m=t._currentIteration,f=t._loopDelay,_=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,S=t._currentTime,x=b+d,T=e-b,w=ot(S,-b,h),k=ot(T,-b,h),$=T-S,E=k>0,C=k>=h,D=h<=c,L=2===n;let N=0,A=T,F=0;if(u>1){const e=~~(k/(d+(C?0:f)));t._currentIteration=ot(e,0,u),C&&t._currentIteration--,N=t._currentIteration%2,A=k%(d+f)||0}const P=_^(y&&N),R=t._ease;let Y=C?P?0:h:P?d-A:A;R&&(Y=d*R(Y/d)||0);const X=(o?o.backwards:T<S)?!P:!!P;if(t._currentTime=T,t._iterationTime=Y,t.backwards=X,E&&!t.began?(t.began=!0,s||o&&(X||!o.began)||t.onBegin(t)):T<=0&&(t.began=!1),s||v||!E||t._currentIteration===m||t.onLoop(t),L||1===n&&(e>=b&&e<=x||e<=b&&w>b||e>=x&&w!==h)||Y>=x&&w!==h||Y<=b&&w>0||e<=w&&w===h&&l||C&&!l&&D){if(E&&(t.computeDeltaTime(w),s||t.onBeforeUpdate(t)),!v){const e=L||(X?-1*$:$)>=B.tickThreshold,n=t._offset+(o?o._offset:0)+b+Y;let h,l,c,d,u=t._head,m=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,_=u._nextRep,y=u._prevRep,v=t!==i.none;if((e||(s!==o||n<=f+(_?_._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!_||_._isOverridden||n<=_._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=ot(Y-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,p=u._valueType,f=u._tweenType,g=0===f,_=0===p,y=_&&g||0===s||1===s?-1:B.precision;let b,S;if(_)b=S=n(ht(ct(u._fromNumber,u._toNumber,s),y));else if(1===p)S=n(ht(ct(u._fromNumber,u._toNumber,s),y)),b=`${S}${u._unit}`;else if(2===p){const t=u._fromNumbers,e=u._toNumbers,i=ht(ot(n(ct(t[0],e[0],s)),0,255),0),r=ht(ot(n(ct(t[1],e[1],s)),0,255),0),o=ht(ot(n(ct(t[2],e[2],s)),0,255),0),a=ot(n(ht(ct(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${a})`,v){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(3===p){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(ht(ct(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=S),r||t===i.blend)u._value=b;else{const t=u.property;h=u.target,g?h[t]=b:1===f?h.setAttribute(t,b):(l=h.style,3===f?(h!==c&&(c=h,d=h[a]),d[t]=b,m=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),E&&(F=1)}}if(m&&u._renderTransforms){let t=p;for(let e in d)t+=`${g[e]}${d[e]}) `;l.transform=t,m=0}u=u._next}!s&&F&&t.onRender(t)}!s&&E&&t.onUpdate(t)}return o&&D?!s&&(o.began&&!X&&T>=h&&!l||X&&T<=c&&l)&&(t.onComplete(t),t.completed=!X):E&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(X||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},bt=(t,e,s,i,r)=>{const n=t._currentIteration;if(vt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,h=i?e:o._iterationTime,l=A();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;ft(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&&vt(e,t,s,1,2),e.began=!1,e.completed=!1})),s||o.onLoop(o)}ft(o,(t=>{const e=ht((h-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;d+=vt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),a),!s&&d&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},St={animation:null,update:_},xt=t?requestAnimationFrame:setImmediate,Tt=t?cancelAnimationFrame:clearImmediate;class wt extends yt{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=C,this.paused=!(!t||!s.hidden),this.reqId=null}update(){const t=this._currentTime=A();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?(gt(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}St.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=xt($t)),this}pause(){return this.paused=!0,Et()}resume(){if(this.paused)return this.paused=!1,ft(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===B.timeScale?1:u)}set speed(t){this._speed=t*B.timeScale,ft(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:u;this.defaults.duration*=t,this._speed*=t}}get precision(){return B.precision}set precision(t){B.precision=t}}const kt=(()=>{const e=new wt(A());return t&&(D.engine=e,s.addEventListener("visibilitychange",(()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())}))),e})(),$t=()=>{kt._head?(kt.reqId=xt($t),kt.update()):kt.reqId=0},Et=()=>(Tt(kt.reqId),kt.reqId=0,kt);function Ct(t){const e=Y(t)?B.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Bt(e){if(z(e))return[];if(F(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(i)){const t=Ct(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(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}if(!t)return[e];const s=Ct(e);return s?Array.from(s):[e]}function Dt(t){const e=Bt(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[r]){s[r]=!0;const t=O(s);(s.nodeType||t)&&(s[n]=!0,s[o]=t,s[a]={})}}return e}const Lt=t=>{const e=Bt(t)[0];if(e&&O(e))return e},Nt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),At=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[o],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Nt(t,s,-1),i=Nt(t,s,1);return 180*it(i.y-e.y,i.x-e.x)/rt}{const i=Nt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Ft=["opacity","rotate","overflow","color"],Pt={morphTo:(t,e=.33)=>s=>{const i=Lt(t);if(!i)return;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 c=e/(h-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";a+=p+ht(d.x,3)+n+d.y+" ",l+=p+ht(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]},createMotionPath:t=>{const e=Lt(t);if(e)return{translateX:At(e,"x"),translateY:At(e,"y"),rotate:At(e,"a")}},createDrawable:(t,e=0,s=0)=>Bt(t).map((t=>((t,e,s)=>{const i=u,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===l?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],h=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(Q(s.a*s.a+s.b*s.b)+Q(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=h*i*l+c,u=i*l+(0===r&&1===h||1===r&&0===h?0:10*l)-d;if("butt"!==n){const e=r===h?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:X(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),h.setAttribute("draw",`${e} ${s}`)),h})(t,e,s)))},Rt=(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),Yt=(t,e)=>M(t)?e:t,Xt=(t,e,s,i,r)=>{if(X(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Mt=(t,e)=>t[n]?t[o]&&((t,e)=>{if(Ft.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:f.includes(e)||m.get(e)?3:N(e,"--")?4:e in t.style?2:e in t?0:1:0,zt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[l]||t).getPropertyValue(e);return"auto"===r?"0":r},Ot=(t,e,s,i)=>{const r=M(s)?Mt(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[a];let o;for(;o=$.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&&!M(r)?r:N(e,"scale")?"1":N(e,"rotate")||N(e,"skew")?"0deg":"0px"})(t,e,i):4===r?zt(t,e,i).trimStart():zt(t,e,i)},It=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Wt=(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(" ")&&w.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(I(r=s)||W(r)||V(r))return e.t=2,e.d=W(i=s)?(t=>{const e=v.exec(t)||b.exec(t),s=M(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):I(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):V(i)?(t=>{const e=S.exec(t)||x.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=M(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=ht(255*Rt(e,t,s+1/3),0),a=ht(255*Rt(e,t,s),0),h=ht(255*Rt(e,t,s-1/3),0)}return[o,a,h,n]})(i):[0,0,0,1],e;{const t=s.match(T);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(T)||[],e}}var i,r;return e.n=s,e},Vt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=pt(t._toNumbers),e.s=pt(t._strings),e),Ut={t:0,n:0,u:null,o:null,d:null,s:null},Ht={_rep:new WeakMap,_add:new Map},qt=(t,e,s="_rep")=>{const i=Ht[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Qt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,jt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},Gt=(t,e)=>{const s=t._composition;if(s===i.replace){const s=t._absoluteStartTime;_t(e,t,Qt,"_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){jt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)jt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<c&&jt(i)}let o=!0;if(ft(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;ft(t,(t=>{t!==e&&ft(t,(t=>{t._isOverlapped||(s=!1)}))})),s&&t.cancel()}else e.cancel()}}}else if(s===i.blend){const e=qt(t.target,t.property,"_add"),s=(t=>{let e=St.animation;return e||(e={duration:c,computeDeltaTime:_,_offset:0,_delay:0,_head:null,_tail:null},St.animation=e,St.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?pt(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}}})),vt(e,1,1,0,2)}),e})(Ht._add);let r=e._head;r||(r={...t},r._composition=i.replace,r._updateDuration=c,r._startTime=0,r._numbers=pt(t._fromNumbers),r._number=0,r._next=null,r._prev=null,_t(e,r),_t(s,r));const n=t._toNumber;if(t._fromNumber=r._fromNumber-n,t._toNumber=0,t._numbers=pt(t._fromNumbers),t._number=0,r._fromNumber=n,t._toNumbers){const e=pt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=r._fromNumbers[s]-e,t._toNumbers[s]=0})),r._fromNumbers=e}_t(e,t,null,"_prevAdd","_nextAdd")}return t},Zt=t=>{const e=t._composition;if(e!==i.none){const s=t.target,r=t.property,n=Ht._rep.get(s)[r];if(gt(n,t,"_prevRep","_nextRep"),e===i.blend){const e=Ht._add,i=e.get(s);if(!i)return;const n=i[r],o=St.animation;gt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){gt(n,a,"_prevAdd","_nextAdd"),gt(o,a);let t=!0;for(let e in i)if(i[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Jt=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),Kt=t=>t._cancelled?(t._hasChildren?ft(t,Kt):ft(t,(t=>{t._composition!==i.none&&Gt(t,qt(t.target,t.property))})),t._cancelled=0,t):t;let te=0;class ee extends yt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:h,loopDelay:l,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:b}=t;B.scope&&B.scope.revertibles.push(this);const S=e?0:kt._elapsedTime,x=e?e.defaults:B.defaults,T=X(r)||M(r)?x.delay:+r,w=X(n)||M(n)?1/0:+n,k=Yt(h,x.loop),$=Yt(l,x.loopDelay),E=!0===k||k===1/0||k<0?1/0:k+1;let C=0;if(e)C=s;else{let t=A();kt.paused&&(kt.requestTick(t),t=kt._elapsedTime),C=t-kt._startTime}this.id=M(i)?++te:i,this.parent=e,this.duration=dt((w+$)*E-$)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=b||x.onUpdate,this.onLoop=f||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=w,this.iterationCount=E,this._autoplay=!e&&Yt(d,x.autoplay),this._offset=C,this._delay=T,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=_,this._running=!1,this._reversed=+Yt(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Yt(a,x.alternate),this._prev=null,this._next=null,this._elapsedTime=S,this._startTime=S,this._lastTime=S,this._fps=Yt(u,x.frameRate),this._speed=Yt(p,x.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return ot(ht(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 ht(this._iterationTime,B.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ot(ht(this._currentTime/this.duration,5),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ot(ht(this._iterationTime/this.iterationDuration,5),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*ot(+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=0){return Kt(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,bt(this,0,1,t,2),Jt(this),this._hasChildren&&ft(this,Jt),this}init(t=0){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&&!M(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*kt._speed);return this._startTime=A()-(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||(_t(kt,this),kt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,kt.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){Kt(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?tt(d/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?ft(this,(t=>t.cancel()),!0):ft(this,Zt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=ut(t);if(e===s)return this;const i=t/e,r=t<=c;return this.duration=r?c:s,this.iterationDuration=r?c:ut(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(){return this.seek(this.duration).cancel()}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const se=t=>new ee(t,null,0).init(),ie=t=>t,re=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,ne=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?ie:r=>0===r||1===r?r:re(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=re(r,e,s)-t,i>0?o=r:n=r}while(Z(i)>1e-7&&++a<100);return r})(r,t,s),e,i),oe=(t=10,e)=>{const s=e?K:tt;return e=>s(ot(e,0,1)*t)*(1/t)},ae=(...t)=>{const e=t.length;if(!e)return ie;const s=e-1,i=t[0],r=t[s],n=[0],o=[H(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(M(h)?e/s:H(h)/100),o.push(H(a))}return o.push(H(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]}},he=(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(ot(o,r,1))}return s.push(1),ae(...s)},le=rt/2,ce=2*rt,de=(t=1.68)=>e=>q(e,+t),ue={[p]:de,Quad:de(2),Cubic:de(3),Quart:de(4),Quint:de(5),Sine:t=>1-G(t*le),Circ:t=>1-Q(1-t*t),Expo:t=>t?q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=q(2,--s))-1)/11;);return 1/q(4,3-s)-7.5625*q((3*e-2)/22-t,2)},Back:(t=1.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ot(+t,1,10),i=ot(+e,c,2),r=i/ce*et(1/s),n=ce/i;return t=>0===t||1===t?t:-s*q(2,-10*(1-t))*j((1-t-r)*n)}},pe={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},me=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=pe[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:ie}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):ie}},fe=(()=>{const t={linear:ae,irregular:he,steps:oe,cubicBezier:ne};for(let e in pe)for(let s in ue){const i=ue[s],r=pe[e];t[e+s]=s===p||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ge={linear:ie},_e=t=>X(t)?t:Y(t)?me(t,fe,ge):ie,ye={},ve=(t,e,s)=>{if(3===s)return m.get(t)||t;if(2===s||1===s&&O(e)&&t in e.style){const e=ye[t];if(e)return e;{const e=t?L(t):t;return ye[t]=e,e}}return t},be={deg:1,rad:180/rt,turn:360},Se={},xe=(t,e,i,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===i)return e;const a=o+n+i,h=Se[a];if(M(h)||r){let r;if(n in be)r=o*be[n]/be[i];else{const e=100,a=t.cloneNode(),h=t.parentNode,l=h&&h!==s?h:s.body;l.appendChild(a);const c=a.style;c.width=e+n;const d=a.offsetWidth||e;c.width=e+i;const u=d/(a.offsetWidth||e);l.removeChild(a),r=u*o}e.n=r,Se[a]=r}else e.n=h;return e.t,e.u=i,e},Te=t=>{if(t._hasChildren)ft(t,Te,!0);else{const e=t;e.pause(),ft(e,(t=>{const s=t.property,i=t.target;if(i[n]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[a];if(M(n)||n===p?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=p;for(let s in e)t+=g[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else M(n)||n===p?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===p&&t.removeAttribute("style")}))}}))}return t},we={t:0,n:0,u:null,o:null,d:null,s:null},ke={t:0,n:0,u:null,o:null,d:null,s:null},$e={func:null},Ee=[null],Ce=[null,null],Be={to:null};let De,Le,Ne=0;class Ae extends ee{constructor(t,e,s,r,n=!1,o=0,a=0){super(e,s,r);const h=Dt(t),l=h.length,d=e.keyframes,p=d?mt(((t,e)=>{const s={};if(F(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(U);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];U(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=Yt(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(U(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 c=0;for(let t=0;t<a;t++)c+=n[t].duration;1===a&&(l.from=h.to),r.ease&&(l.ease=r.ease),l.duration=o-(a?c: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})(d,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=p,S=s?s.defaults:B.defaults,x=Yt(_,S.playbackEase),T=x?_e(x):null,w=!M(g)&&!M(g.ease),k=w?g.ease:Yt(g,T?"linear":S.ease),$=w?g.duration:Yt(f,S.duration),E=Yt(m,S.delay),C=y||S.modifier,D=M(v)&&l>=u?i.none:M(v)?S.composition:v,L={},N=this._offset+(s?s._offset:0);let A=NaN,Y=NaN,X=0,z=0;for(let t=0;t<l;t++){const e=h[t],r=o||t,d=a||l;let u=NaN,m=NaN;for(let t in p)if(U(t)){const o=Mt(e,t),a=ve(t,e,o);let h=p[t];const l=F(h);if(n&&!l&&(Ce[0]=h,Ce[1]=h,h=Ce),l){const t=h.length,e=!P(h[0]);2===t&&e?(Be.to=h,Ee[0]=Be,De=Ee):t>2&&e?(De=[],h.forEach(((t,e)=>{e?1===e?(Ce[1]=t,De.push(Ce)):De.push(t):Ce[0]=t}))):De=h}else Ee[0]=h,De=Ee;let f=null,g=null,_=NaN,y=0,v=0;for(let t=De.length;v<t;v++){const n=De[v];P(n)?Le=n:(Be.to=n,Le=Be),$e.func=null;const h=Xt(Le.to,e,r,d,$e);let l;P(h)&&!M(h.to)?(Le=h,l=h.to):l=h;const u=Xt(Le.from,e,r,d),p=Le.ease,m=!M(p)&&!M(p.ease),b=m?p.ease:p||k,S=m?p.duration:Xt(Yt(Le.duration,t>1?Xt($,e,r,d)/t:$),e,r,d),x=Xt(Yt(Le.delay,v?0:E),e,r,d),T=Xt(Yt(Le.composition,D),e,r,d),w=R(T)?T:i[T],B=Le.modifier||C,A=!M(u),Y=!M(l),O=F(l),I=O||A&&Y,W=g?y+x:x,V=N+W;z||!A&&!O||(z=1);let U=g;if(w!==i.none){f||(f=qt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(U=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)jt(t),t=t._nextRep}if(I?(Wt(O?Xt(l[0],e,r,d):u,we),Wt(O?Xt(l[1],e,r,d,$e):l,ke),0===we.t&&(U?1===U._valueType&&(we.t=1,we.u=U._unit):(Wt(Ot(e,a,o,L),Ut),1===Ut.t&&(we.t=1,we.u=Ut.u)))):(Y?Wt(l,ke):g?Vt(g,ke):Wt(s&&U&&U.parent.parent===s?U._value:Ot(e,a,o,L),ke),A?Wt(u,we):g?Vt(g,we):Wt(s&&U&&U.parent.parent===s?U._value:Ot(e,a,o,L),we)),we.o&&(we.n=It(U?U._toNumber:Wt(Ot(e,a,o,L),Ut).n,we.n,we.o)),ke.o&&(ke.n=It(we.n,ke.n,ke.o)),we.t!==ke.t)if(3===we.t||3===ke.t){const t=3===we.t?we:ke,e=3===we.t?ke:we;e.t=3,e.s=pt(t.s),e.d=t.d.map((()=>e.n))}else if(1===we.t||1===ke.t){const t=1===we.t?we:ke,e=1===we.t?ke:we;e.t=1,e.u=t.u}else if(2===we.t||2===ke.t){const t=2===we.t?we:ke,e=2===we.t?ke:we;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(we.u!==ke.u){let t=ke.u?we:ke;t=xe(e,t,ke.u?ke.u:we.u,!1)}if(ke.d&&we.d&&ke.d.length!==we.d.length){const t=we.d.length>ke.d.length?we:ke,e=t===we?ke:we;e.d=t.d.map(((t,s)=>M(e.d[s])?0:e.d[s])),e.s=pt(t.s)}const H=ht(+S||c,12),q={parent:this,id:Ne++,property:a,target:e,_value:null,_func:$e.func,_ease:_e(b),_fromNumbers:pt(we.d),_toNumbers:pt(ke.d),_strings:pt(ke.s),_fromNumber:we.n,_toNumber:ke.n,_numbers:pt(we.d),_number:we.n,_unit:ke.u,_modifier:B,_currentTime:0,_startTime:W,_delay:+x,_updateDuration:H,_changeDuration:H,_absoluteStartTime:V,_tweenType:o,_valueType:ke.t,_composition:w,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};w!==i.none&&Gt(q,f),isNaN(_)&&(_=q._startTime),y=ht(W+H,12),g=q,X++,_t(this,q)}(isNaN(Y)||_<Y)&&(Y=_),(isNaN(A)||y>A)&&(A=y),3===o&&(u=X-v,m=X)}if(!isNaN(u)){let t=0;ft(this,(e=>{t>=u&&t<m&&(e._renderTransforms=1,e._composition===i.blend&&ft(St.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),Y?(ft(this,(t=>{t._startTime-t._delay||(t._delay-=Y),t._startTime-=Y})),A-=Y):Y=0,A||(A=c,this.iterationCount=0),this.targets=h,this.duration=A===c?c:dt((A+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=b||S.onRender,this._ease=T,this._delay=Y,this.iterationDuration=A,this._inlineStyles=L,!this._autoplay&&z&&this.onRender(this)}stretch(t){const e=this.duration;if(e===ut(t))return this;const s=t/e;return ft(this,(t=>{t._updateDuration=ut(t._updateDuration*s),t._changeDuration=ut(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return ft(this,(t=>{const e=Ot(t.target,t.property,t._tweenType);Wt(e,Ut),t._fromNumbers=pt(Ut.d),t._fromNumber=Ut.n,t._func&&(Wt(t._func(),ke),t._toNumbers=pt(ke.d),t._strings=pt(ke.s),t._toNumber=ke.n)})),this}revert(){return super.revert(),Te(this)}then(t){return super.then(t)}}const Fe=(t,e)=>new Ae(t,e,null,0,!1).init(),Pe=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Re={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Ye=(()=>{const t={};for(let e in pe)t[e]=t=>pe[e](de(t));return t})(),Xe=t=>{let e=Re[t];if(e)return e;if(e="linear",Y(t)){if(N(t,"linear")||N(t,"cubic-")||N(t,"steps")||N(t,"ease"))e=t;else if(N(t,"cubicB"))e=L(t);else{const s=me(t,Ye,Re);X(s)&&(e=s===ie?"linear":Pe(s))}Re[t]=e}else if(X(t)){const s=Pe(t);s&&(e=s)}else t.ease&&(e=Pe(t.ease));return e},Me=["x","y","z"],ze=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Me],Oe=[...Me,...f.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))];let Ie=t&&(M(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const We={_head:null,_tail:null},Ve=(t,e,s)=>{let i=We._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,a=!s||i.parent===s;if(n&&o&&a){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),gt(We,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},Ue=(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),Ve(e,s),_t(We,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{Ve(e,s,t)};return n.onremove=a,n.onfinish=a,n},He=(t,e,s,i,r)=>{let n=Xt(e,s,i,r);return R(n)?ze.includes(t)||N(t,"translate")?`${n}px`:N(t,"rotate")||N(t,"skew")?`${n}deg`:`${n}`:n},qe=(t,e,s,i,r,n)=>{let o="0";const a=M(i)?getComputedStyle(t)[e]:He(e,i,t,r,n);return o=M(s)?F(i)?i.map((s=>He(e,s,t,r,n))):a:[He(e,s,t,r,n),a],o};class Qe{constructor(t,e){B.scope&&B.scope.revertibles.push(this),Ie||(f.forEach((t=>{const e=N(t,"skew"),s=N(t,"scale"),i=N(t,"rotate"),r=N(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{}})),Ie=!0);const s=Dt(t),i=s.length;i||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const r=Yt(e.ease,Xe(B.defaults.ease)),n=r.ease&&r,o=Yt(e.autoplay,B.defaults.autoplay),h=!(!o||!o.link)&&o,l=e.alternate&&!0===e.alternate,c=e.reversed&&!0===e.reversed,d=Yt(e.loop,B.defaults.loop),y=!0===d||d===1/0?1/0:R(d)?d+1:1,v=l?c?"alternate-reverse":"alternate":c?"reverse":"normal",b=Xe(r),S=1===B.timeScale?1:u;this.targets=s,this.animations=[],this.controlAnimation=null,this.onComplete=e.onComplete||_,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!o||!1!==h,this.reversed=c,this.autoplay=o,this._speed=Yt(e.playbackRate,B.defaults.playbackRate),this._resolve=_,this._completed=0,this._inlineStyles=s.map((t=>t.getAttribute("style"))),s.forEach(((t,s)=>{const o=t[a],h=Oe.some((t=>e.hasOwnProperty(t))),l=(n?n.duration:Xt(Yt(e.duration,B.defaults.duration),t,s,i))*S,c=Xt(Yt(e.delay,B.defaults.delay),t,s,i)*S,d=Yt(e.composition,"replace");for(let n in e){if(!U(n))continue;const a={},u={iterations:y,direction:v,fill:"forwards",easing:b,duration:l,delay:c,composite:d},p=e[n],g=!!h&&(f.includes(n)?n:m.get(n));let _;if(P(p)){const e=p,h=Yt(e.ease,r),m=h.ease&&h,f=e.to,y=e.from;if(u.duration=(m?m.duration:Xt(Yt(e.duration,l),t,s,i))*S,u.delay=Xt(Yt(e.delay,c),t,s,i)*S,u.composite=Yt(e.composition,d),u.easing=Xe(h),_=qe(t,n,y,f,s,i),g?(a[`--${g}`]=_,o[g]=_):a[n]=qe(t,n,y,f,s,i),Ue(this,t,n,a,u),!M(y))if(g){const e=`--${g}`;t.style.setProperty(e,a[e][0])}else t.style[n]=a[n][0]}else _=F(p)?p.map((e=>He(n,e,t,s,i))):He(n,p,t,s,i),g?(a[`--${g}`]=_,o[g]=_):a[n]=_,Ue(this,t,n,a,u)}if(h){let e=p;for(let t in o)e+=`${g[t]}var(--${t})) `;t.style.transform=e}})),h&&this.autoplay.link(this)}forEach(t){const e=Y(t)?e=>e[t]():t;return this.animations.forEach(e),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:u);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const je={animate:(t,e)=>new Qe(t,e),convertEase:Pe},Ge=(t=_)=>new ee({duration:1*B.timeScale,onComplete:t},null,0).resume();function Ze(t,e,s){const i=Dt(t);if(!i.length)return;const[r]=i,n=Mt(r,e),o=ve(e,r,n);let a=Ot(r,o);if(M(s))return a;if(Wt(a,Ut),0===Ut.t||1===Ut.t){if(!1===s)return Ut.n;{const t=xe(r,Ut,s,!1);return`${ht(t.n,B.precision)}${t.u}`}}}const Je=(t,e)=>{if(!M(e))return e.duration=c,e.composition=Yt(e.composition,i.none),new Ae(t,e,null,0,!0).resume()},Ke=(t,e,s)=>{let i=!1;return ft(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=ve(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),gt(e,r),Zt(r),i=!0)}}),!0),i},ts=(t,e,s)=>{const i=Bt(t),r=e||kt,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];Ve(e,s,n)}let o;if(r._hasChildren){let e=0;ft(r,(n=>{if(!n._hasChildren)if(o=Ke(i,n,s),o&&!n._head)n.cancel(),gt(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?ts(t,n,s):n._hasChildren=!1}),!0),M(r.iterationDuration)||(r.iterationDuration=e)}else o=Ke(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},es=(t,e,s)=>{const i=10**(s||0);return tt((Math.random()*(e-t+1/i)+t)*i)/i},ss=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),is=(t,e,s,i)=>{let r=u/B.defaults.frameRate;if(!1!==i){const t=i||kt._hasChildren&&kt;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},rs=t=>(...e)=>{const s=t(...e);return new Proxy(_,{apply:(t,e,[i])=>s(i),get:(t,e)=>rs(((...t)=>{const i=os[e](...t);return t=>i(s(t))}))})},ns=(t,e=0)=>(...s)=>(s.length<t.length?rs(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),os={$:Dt,get:Ze,set:Je,remove:ts,cleanInlineStyles:Te,random:es,randomPick:t=>t[es(0,t.length-1)],shuffle:t=>{let e,s,i=t.length;for(;i;)s=es(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},lerp:is,sync:Ge,clamp:ns(ot),round:ns(ht),snap:ns(lt),wrap:ns(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:ns(ct,1),mapRange:ns(ss),roundPad:ns(((t,e)=>(+t).toFixed(e))),padStart:ns(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:ns(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:ns((t=>t*rt/180)),radToDeg:ns((t=>180*t/rt))},as=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),M(e))return s;if(R(+e))return+e;const i=e,r=t?t.labels:null,n=!z(r),o=((t,e)=>{if(N(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!M(o),h=E.exec(i);if(h){const t=h[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=a?o:n?l:s,d=+e[1];return It(c,d,t[0])}return a?o:n?M(r[i])?s:r[i]:s};function hs(t,e,s,i,r,n){const o=R(t.duration)&&t.duration<=c?s-c:s;bt(e,o,1,1,1);const a=i?new Ae(i,t,e,o,!1,r,n):new ee(t,e,o);return a.init(1),_t(e,a),ft(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return dt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}class ls extends ee{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=B.defaults;this.defaults=e?mt(e,s):s,this.onRender=t.onRender||s.onRender;const i=Yt(t.playbackEase,s.playbackEase);this._ease=i?_e(i):null,this.iterationDuration=0}add(t,e,s){const i=P(e),r=P(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(X(s)){const e=s,r=Bt(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,M(a)||(s.id=a+"-"+h),hs(s,this,e(t,h,l,this),t,h,l),h++}))}else hs(i,this,as(this,s),t)}else hs(t,this,as(this,e));return this.init(1)}}sync(t,e){if(M(t)||t&&M(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,ease:"linear"},e)}set(t,e,s){return M(e)?this:(e.duration=c,e.composition=i.replace,this.add(t,e,s))}call(t,e){return M(t)||t&&!X(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return M(t)||t&&!Y(t)||(this.labels[t]=as(this,e)),this}remove(t,e){return ts(t,this,e),this}stretch(t){const e=this.duration;if(e===ut(t))return this;const s=t/e,i=this.labels;ft(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return ft(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),ft(this,(t=>t.revert),!0),Te(this)}then(t){return super.then(t)}}const cs=t=>new ls(t).init();class ds{constructor(t,e){B.scope&&B.scope.revertibles.push(this);const s={},r={};if(this.targets=[],this.animations={},!M(t)&&!M(e)){for(let t in e){const i=e[t];U(t)?r[t]=i:s[t]=i}for(let e in r){const n=r[e],o=P(n);let a={},h="+=0";if(o){const t=n.unit;Y(t)&&(h+=t)}else a.duration=n;a[e]=o?mt({to:h},n):h;const l=mt(s,a);l.composition=i.replace,l.autoplay=!1;const c=this.animations[e]=new Ae(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(M(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return ft(c,(e=>{if(F(t))for(let s=0,i=t.length;s<i;s++)M(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;M(s)||(e._ease=_e(s)),e._currentTime=0})),M(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=_,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}const us=(t,e)=>new ds(t,e);class ps{constructor(t={}){this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/u,this.maxIterations=this.maxDuration/this.timeStep/u,this.m=ot(Yt(t.mass,1),0,u),this.s=ot(Yt(t.stiffness,100),1,u),this.d=ot(Yt(t.damping,10),.1,u),this.v=ot(Yt(t.velocity,0),-1e3,u),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?J(-n*e*s)*(1*G(i*n)+r*j(i*n)):(1+r*n)*J(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,h=this.w0=ot(Q(o/r),c,u),l=this.zeta=n/(2*Q(o*r)),d=this.wd=l<1?h*Q(1-l*l):0;this.b=l<1?(l*h-a)/d:-a+h;let p=0,m=0,f=0;for(;m<t&&f<e;)Z(1-this.solve(p))<s?m++:m=0,this.solverDuration=p,p+=i,f++;this.duration=ht(this.solverDuration*u,0)*B.timeScale}get mass(){return this.m}set mass(t){this.m=ot(Yt(t,1),0,u),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ot(Yt(t,100),1,u),this.compute()}get damping(){return this.d}set damping(t){this.d=ot(Yt(t,10),.1,u),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ot(Yt(t,0),-1e3,u),this.compute()}}const ms=t=>new ps(t),fs=t=>{t.cancelable&&t.preventDefault()};class gs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:_,remove:_}}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 ys=(t,e)=>t&&X(t)?t(e):t;let vs=0;class bs{constructor(t,i={}){if(!t)return;B.scope&&B.scope.revertibles.push(this);const r=i.x,n=i.y,o=i.trigger,a=i.modifier,h=i.releaseEase,l=h&&_e(h),c=!M(h)&&!M(h.ease),u=P(r)&&!M(r.mapTo)?r.mapTo:"translateX",p=P(n)&&!M(n.mapTo)?n.mapTo:"translateY",m=ys(i.container,this);this.containerArray=F(m)?m:null,this.$container=m&&!this.containerArray?Bt(m)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=P(t)?new gs(t):Bt(t)[0],this.$trigger=Bt(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?h:ms({mass:Yt(i.releaseMass,1),stiffness:Yt(i.releaseStiffness,80),damping:Yt(i.releaseDamping,20)}),this.releaseYSpring=c?h:ms({mass:Yt(i.releaseMass,1),stiffness:Yt(i.releaseStiffness,80),damping:Yt(i.releaseDamping,20)}),this.releaseEase=l||fe.outQuint,this.hasReleaseSpring=c,this.onGrab=i.onGrab||_,this.onDrag=i.onDrag||_,this.onRelease=i.onRelease||_,this.onUpdate=i.onUpdate||_,this.onSettle=i.onSettle||_,this.onSnap=i.onSnap||_,this.onResize=i.onResize||_,this.onAfterResize=i.onAfterResize||_,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),M(r)||!0===r)f[u]=0;else if(P(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===r&&(f[u]=0,this.disabled[0]=1);if(M(n)||!0===n)f[p]=0;else if(P(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 ds(this.$target,f),this.xProp=u,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=[-1e12,d,d,-1e12],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=A(),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.overshootXTicker=new ee({autoplay:!1},null,0).init(),this.overshootYTicker=new ee({autoplay:!1},null,0).init(),this.updateTicker=new ee({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),this.contained=!M(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]?u:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=it(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 ee({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),P(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=A(),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]=ht(ot(Q(t*t+e*e)/r*o,a,h),5);const c=st(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=ht(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=lt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=ht(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=lt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return ht(this.animate[this.xProp](),B.precision)}set x(t){this.setX(t,!1)}get y(){return ht(this.animate[this.yProp](),B.precision)}set y(t){this.setY(t,!1)}get progressX(){return ss(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(ss(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return ss(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(ss(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=ht(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=ht(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,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,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?ot(c,a,c):c,this.scrollView[1]=l?ot(d,h,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:S,right:x,bottom:T}=t.getBoundingClientRect();this.dragArea[2]=ht(l?ot(y,a,a):y,0),this.dragArea[3]=ht(l?ot(v,h,h):v,0);const w=Ze(t,"overflow"),k="visible"===w,$="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===s.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!F(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,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=ht(r.top+s-(l?0:S),0),this.targetBounds[1]=ht(r.right+e-(l?a:x),0),this.targetBounds[2]=ht(r.bottom+s-(l?h:T),0),this.targetBounds[3]=ht(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]+_):(this.containerBounds[0]=-ht(r.top-(u?ot(S,0,h):S)+o-m,0),this.containerBounds[1]=-ht(r.right-(u?ot(x,0,a):x)-c+f,0),this.containerBounds[2]=-ht(r.bottom-(u?ot(T,0,h):T)-d+g,0),this.containerBounds[3]=-ht(r.left-(u?ot(b,0,a):b)+n-_,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,c=!h&&s<i||!h&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=ys(t.container,this),o=ys(t.containerPadding,this)||0,a=F(o)?o:[o,o,o,o],h=this.x,l=this.y,c=ys(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=F(n)?n:null,this.$container=n&&!this.containerArray?Bt(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=Yt(a,[0,0,0,0]),this.containerFriction=ot(Yt(ys(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ot(Yt(ys(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=ys(P(i)&&!M(i.snap)?i.snap:t.snap,this),this.snapY=ys(P(r)&&!M(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Yt(ys(t.scrollSpeed,this),1.5),this.scrollThreshold=Yt(ys(t.scrollThreshold,this),20),this.dragSpeed=Yt(ys(t.dragSpeed,this),1),this.minVelocity=Yt(ys(t.minVelocity,this),0),this.maxVelocity=Yt(ys(t.maxVelocity,this),50),this.velocityMultiplier=Yt(ys(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(ot(h,f,p),!0),this.setY(ot(l,u,m),!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,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?ot(c,this.window[0],c):c,p=this.useWin?ot(d,this.window[1],d):d,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,_=this.scrollThreshold,[y,v]=this.coords,[b,S,x,T]=this.scrollBounds,w=ht(ot((v-b+t)/_,-1,0)*g,0),k=ht(ot((y-S-e)/_,0,1)*g,0),$=ht(ot((v-x-s)/_,0,1)*g,0),E=ht(ot((y-T+i)/_,-1,0)*g,0);if(w||$||E||k){const[t,e]=this.disabled;let s=h,i=l;t||(s=ht(ot(h+(E||k),0,r-o),0),this.coords[0]-=h-s),e||(i=ht(ot(l+(w||$),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[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-h,n-l),this.angle=it(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.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return ts(this,null,"x"),ts(this,null,"y"),ts(this,null,"progressX"),ts(this,null,"progressY"),ts(this.scroll),ts(this.overshootCoords),this}scrollInView(t,e=0,s=fe.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,c,u]=o,p=ht(ot(r-h,-1e12,0),0),m=ht(ot(i-l,0,d),0),f=ht(ot(r-c,0,d),0),g=ht(ot(i-u,-1e12,0),0);new Ae(n,{x:ht(n.x+(g?g-e:m?m+e:0),0),y:ht(n.y+(p?p-e:f?f+e:0),0),duration:M(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=Je(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=fe.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,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+h+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=ot(lt(i,this.snapX),u,c),a=ot(lt(r,this.snapY),l,d),h=M(t)?350*B.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,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/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);vs=(f>vs?f:vs)+1,this.targetStyles=Je(this.$target,{zIndex:vs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Je(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,fe.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,c=!1,d=!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){d=!0,l=t<=3,c=t>=e-s-3;break}}h=h.parentNode}d&&(!l&&!c||l&&a<0||c&&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):(fs(t),this.triggerStyles||(this.triggerStyles=Je(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",fs,{passive:!1}),this.$trigger.addEventListener("touchmove",fs,{passive:!1}),this.$trigger.addEventListener("touchend",fs),(!this.disabled[0]&&Z(o)>3||!this.disabled[1]&&Z(a)>3)&&(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,[r,n,o,a,h,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,_=this.releaseYSpring,y=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,S=this.x,x=this.y,T=this.computeVelocity(r-h,n-l),w=this.angle=it(n-a,r-o),k=150*T,$=(1-this.releaseContainerFriction)*this.dragSpeed,E=S+G(w)*k,C=x+j(w)*k,D=E>d?d+(E-d)*$:E<p?p+(E-p)*$:E,L=C>u?u+(C-u)*$:C<c?c+(C-c)*$:C,N=this.destX=ot(ht(lt(D,this.snapX),5),p,d),A=this.destY=ot(ht(lt(L,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,E,C);let P=0,R=0,Y=y,X=y,M=0;if(b.x=S,b.y=x,!t){const t=N===d?S>d?-1:1:S<p?-1:1,s=ht(S-N,0);g.velocity=e&&v?s?k*t/Z(s):0:T;const{ease:i,duration:r,restDuration:n}=g;P=S===N?0:v?r:r-n*B.timeScale,v&&(Y=i),P>M&&(M=P)}if(!e){const e=A===u?x>u?-1:1:x<c?-1:1,s=ht(x-A,0);_.velocity=t&&v?s?k*e/Z(s):0:T;const{ease:i,duration:r,restDuration:n}=_;R=x===A?0:v?r:r-n*B.timeScale,v&&(X=i),R>M&&(M=R)}if(!v&&F&&$&&(P||R)){const t=i.blend;new Ae(b,{x:{to:D,duration:.65*P},y:{to:L,duration:.65*R},ease:y,composition:t}).init(),new Ae(b,{x:{to:N,duration:P},y:{to:A,duration:R},ease:y,composition:t}).init(),this.overshootXTicker.stretch(P).restart(),this.overshootYTicker.stretch(R).restart()}else t||this.animate[this.xProp](N,P,Y),e||this.animate[this.yProp](A,R,X);this.scrollInView(M,this.scrollThreshold,y);let z=!1;N!==m&&(this.snapped[0]=N,this.snapX&&(z=!0)),A!==f&&this.snapY&&(this.snapped[1]=A,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",fs),this.$trigger.removeEventListener("touchmove",fs),this.$trigger.removeEventListener("touchend",fs),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=Je(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":fs(t)}}}const Ss=(t,e)=>new bs(t,e);class xs{constructor(t={}){B.scope&&B.scope.revertibles.push(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||Bt(i)[0]||s);const n=t.defaults,o=B.defaults,a=t.mediaQueries;if(this.defaults=n?mt(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],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)}}execute(t){let e=B.scope,s=B.root,i=B.defaults;B.scope=this,B.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 B.scope=e,B.root=s,B.defaults=i,n}refresh(){return 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);e&&this.revertConstructors.push(e)}))})),this}add(t,e){if(X(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);t&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.mediaQueryLists;let i=t.length,r=e.length;for(;i--;)t[i].revert();for(;r--;)e[r](this);for(let t in s)s[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const Ts=t=>new xs(t),ws=(t,e)=>t&&X(t)?t(e):t,ks=new Map;class $s{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.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 ee({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;ft(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ee({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=ht(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ee({autoplay:!1,duration:250*B.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ee({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=ht(t?e.scrollX:s.scrollLeft,0),this.scrollY=ht(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=(()=>{const t=document.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){ft(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),ft(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.unobserve(this.element),(this.useWin?e:this.element).removeEventListener("scroll",this),ks.delete(this.element)}}const Es=(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}=Wt(a,Ut);let c=h;return"%"===l?c=h/100*s:l&&(c=xe(t,Ut,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},Cs=(t,e,s,i,r)=>{let n;if(Y(e)){const o=E.exec(e);if(o){const a=o[0],h=a[0],l=e.split(a),c="min"===l[0],d="max"===l[0],u=Es(t,l[0],s,i,r),p=Es(t,l[1],s,i,r);if(c){const e=It(Es(t,"min",s),p,h);n=e<u?u:e}else if(d){const e=It(Es(t,"max",s),p,h);n=e>u?u:e}else n=It(u,p,h)}else n=Es(t,e,s,i,r)}else n=e;return ht(n,0)},Bs=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[n]){e=i;break}}return e};let Ds=0;const Ls=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Ns{constructor(t={}){B.scope&&B.scope.revertibles.push(this);const e=Yt(t.sync,"play pause"),i=e?_e(e):null,r=e&&("linear"===e||e===ie),n=e&&!(i===ie&&!r),o=e&&(R(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=Ds++,this.id=M(t.id)?this.index:t.id,this.container=(t=>{const e=t&&Bt(t)[0]||s.body;let i=ks.get(e);return i||(i=new $s(e),ks.set(e,i)),i})(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]:_,this.onSyncLeave=h&&!l&&h[1]?h[1]:_,this.onSyncEnterForward=h&&l&&h[0]?h[0]:_,this.onSyncLeaveForward=h&&l&&h[1]?h[1]:_,this.onSyncEnterBackward=h&&l&&h[2]?h[2]:_,this.onSyncLeaveBackward=h&&l&&h[3]?h[3]:_,this.onEnter=t.onEnter||_,this.onLeave=t.onLeave||_,this.onEnterForward=t.onEnterForward||_,this.onLeaveForward=t.onLeaveForward||_,this.onEnterBackward=t.onEnterBackward||_,this.onLeaveBackward=t.onLeaveBackward||_,this.onUpdate=t.onUpdate||_,this.onSyncComplete=t.onSyncComplete||_,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=Yt(t.debug,!1),this._next=null,this._prev=null,_t(this.container,this),Ge((()=>{if(!this.reverted){if(!this.target){const e=Bt(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;M(t.targets)?ft(t,(t=>{t.targets&&!e&&(e=Bs(t))})):e=Bs(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:ht(ot(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=Yt(ws(t.repeat,this),!0),this.horizontal="x"===Yt(ws(t.axis,this),"y"),this.enter=Yt(ws(t.enter,this),"end start"),this.leave=Yt(ws(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=Ls[this.index%Ls.length],h=t.useWin,l=h?t.winWidth:t.width,c=h?t.winHeight:t.height,d=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,_=e?g:15,y=e?60:g,v=e?y:_,b=e?"repeat-x":"repeat-y",S=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,T=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${T("absolute",m,f,e?d: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=`${T("sticky",0,0,e?l:g,e?g:c)}`,i||(n.style.cssText+=`background:\n ${x("#FFFF")}${S(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${S(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${T("relative",0,0,e?d:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${x("#FFFF")}${S(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${S(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<v,g=h>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,S=s.createElement("div"),x=s.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?y:_)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${w[m]}${this.thresholds[i]}`,S.style.cssText=`${T("absolute",0,0,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-${k}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${_};\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 `,S.appendChild(x);let E=h-$+(e?1:0);S.style[e?"left":"top"]=`${E}px`,(r?n:o).appendChild(S)})),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=Je(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,h=0,l=0,c=a;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===Ze(i.element,"position")&&Je(i.element,{position:"relative "});for(;a&&a!==i.element&&a!==s.body;){const e="sticky"===Ze(a,"position")&&Je(a,{position:"static"});a===c&&(h+=a.offsetLeft||0,l+=a.offsetTop||0,c=a.offsetParent),a=a.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?h:l,p=r?e.offsetWidth:e.offsetHeight,m=r?i.width:i.height,f=(r?i.scrollWidth:i.scrollHeight)-m,g=this.enter,_=this.leave;let y="start",v="end",b="end",S="start";if(Y(g)){const t=g.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(P(g)){const t=g;M(t.container)||(b=t.container),M(t.target)||(y=t.target)}else R(g)&&(b=g);if(Y(_)){const t=_.split(" ");S=t[0],v=t.length>1?t[1]:v}else if(P(_)){const t=_;M(t.container)||(S=t.container),M(t.target)||(v=t.target)}else R(_)&&(S=_);const x=Cs(e,y,p),T=Cs(e,v,p),w=x+u-m,k=T+u-f,$=Cs(e,b,m,w,k),E=Cs(e,S,m,w,k),C=x+u-$,B=T+u-E,D=B-C;this.offsets[0]=h,this.offsets[1]=l,this.offset=u,this.offsetStart=C,this.offsetEnd=B,this.distance=D<=0?0:D,this.thresholds=[y,v,b,S],this.coords=[x,T,$,E],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){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,c=!h&&!l,d=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&d,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&&R(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=ht(is(e,g,ct(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 gt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}const As=(t={})=>new Ns(t),Fs=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!M(o),h=a&&!M(o.ease)?o.ease:a?_e(o):null,l=e.grid,c=e.axis,d=M(r)||0===r||"first"===r,u="center"===r,m="last"===r,f=F(t),g=H(f?t[0]:t),_=f?H(t[1]):0,y=w.exec((f?t[1]:t)+p),v=e.start||0+(f?g:0);let b=d?0:R(r)?r:0;return(t,r,o,a)=>{if(u&&(b=(o-1)/2),m&&(b=o-1),!s.length){for(let t=0;t<o;t++){if(l){const e=u?(l[0]-1)/2:b%l[0],i=u?(l[1]-1)/2:tt(b/l[0]),r=e-t%l[0],n=i-tt(t/l[0]);let o=Q(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(Z(b-t));i=st(...s)}h&&(s=s.map((t=>h(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:Z(i-t))))}const d=f?(_-g)/i:g;let p=(a?as(a,M(e.start)?a.iterationDuration:v):v)+(d*ht(s[r],2)||0);return e.modifier&&(p=e.modifier(p)),y&&(p=`${p}${y[2]}`),p}};export{ds as Animatable,bs as Draggable,Ae as JSAnimation,xs as Scope,Ns as ScrollObserver,ps as Spring,ls as Timeline,ee as Timer,Qe as WAAPIAnimation,Fe as animate,us as createAnimatable,Ss as createDraggable,Ts as createScope,ms as createSpring,cs as createTimeline,se as createTimer,fe as eases,kt as engine,As as onScroll,ks as scrollContainers,Fs as stagger,Pt as svg,os as utils,je as waapi};
+const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={replace:0,none:1,blend:2},r=Symbol(),n=Symbol(),o=Symbol(),h=Symbol(),a=Symbol(),l=Symbol(),c=1e-11,d=1e12,u=1e3,p="",m=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),f=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],g=f.reduce(((t,e)=>({...t,[e]:e+"("})),{}),_=()=>{},y=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,v=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,b=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,T=/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,x=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,S=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,k=/([a-z])([A-Z])/g,$=/(\w+)(\([^)]+\)+)/g,E=/(\*=|\+=|-=)/,C={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:u,delay:0,loopDelay:0,ease:"out(2)",composition:i.replace,modifier:t=>t,onBegin:_,onBeforeUpdate:_,onUpdate:_,onLoop:_,onPause:_,onComplete:_,onRender:_},B={current:null,root:s},L={defaults:C,precision:4,timeScale:1,tickThreshold:200},D={version:"4.1.0",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(D));const N=t=>t.replace(k,"$1-$2").toLowerCase(),A=(t,e)=>0===t.indexOf(e),F=Date.now,O=Array.isArray,P=t=>t&&t.constructor===Object,M=t=>"number"==typeof t&&!isNaN(t),R=t=>"string"==typeof t,Y=t=>"function"==typeof t,X=t=>void 0===t,z=t=>X(t)||null===t,I=e=>t&&e instanceof SVGElement,W=t=>y.test(t),V=t=>A(t,"rgb"),H=t=>A(t,"hsl"),U=t=>!L.defaults.hasOwnProperty(t),q=t=>R(t)?parseFloat(t):t,Q=Math.pow,j=Math.sqrt,G=Math.sin,Z=Math.cos,J=Math.abs,K=Math.exp,tt=Math.ceil,et=Math.floor,st=Math.asin,it=Math.max,rt=Math.atan2,nt=Math.PI,ot=Math.round,ht=(t,e,s)=>t<e?e:t>s?s:t,at={},lt=(t,e)=>{if(e<0)return t;if(!e)return ot(t);let s=at[e];return s||(s=at[e]=10**e),ot(t*s)/s},ct=(t,e)=>O(e)?e.reduce(((e,s)=>J(s-t)<J(e-t)?s:e)):e?ot(t/e)*e:t,dt=(t,e,s)=>t+(e-t)*s,ut=(t,e,s)=>{const i=10**(s||0);return et((Math.random()*(e-t+1/i)+t)*i)/i},pt=t=>{let e,s,i=t.length;for(;i;)s=ut(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},mt=t=>t===1/0?d:t===-1/0?-1e12:t,ft=t=>t<=c?c:mt(lt(t,11)),gt=t=>O(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},yt=(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}},vt=(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},bt=(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},Tt=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 h=t(...s);return h&&!Y(h)&&h.revert&&(e=h),X(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),h||_}};class wt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=lt(u/120,0),this._fps=120,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=lt(u/i,0);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,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const xt=(t,e,s,r,n)=>{const o=t.parent,a=t.duration,l=t.completed,d=t.iterationDuration,u=t.iterationCount,m=t._currentIteration,f=t._loopDelay,_=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,T=t._currentTime,w=b+d,x=e-b,S=ht(T,-b,a),k=ht(x,-b,a),$=x-T,E=k>0,C=k>=a,B=a<=c,D=2===n;let N=0,A=x,F=0;if(u>1){const e=~~(k/(d+(C?0:f)));t._currentIteration=ht(e,0,u),C&&t._currentIteration--,N=t._currentIteration%2,A=k%(d+f)||0}const O=_^(y&&N),P=t._ease;let M=C?O?0:a:O?d-A:A;P&&(M=d*P(M/d)||0);const R=(o?o.backwards:x<T)?!O:!!O;if(t._currentTime=x,t._iterationTime=M,t.backwards=R,E&&!t.began?(t.began=!0,s||o&&(R||!o.began)||t.onBegin(t)):x<=0&&(t.began=!1),s||v||!E||t._currentIteration===m||t.onLoop(t),D||1===n&&(e>=b&&e<=w||e<=b&&S>b||e>=w&&S!==a)||M>=w&&S!==a||M<=b&&S>0||e<=S&&S===a&&l||C&&!l&&B){if(E&&(t.computeDeltaTime(S),s||t.onBeforeUpdate(t)),!v){const e=D||(R?-1*$:$)>=L.tickThreshold,n=t._offset+(o?o._offset:0)+b+M;let a,l,c,d,u=t._head,m=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,_=u._nextRep,y=u._prevRep,v=t!==i.none;if((e||(s!==o||n<=f+(_?_._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!_||_._isOverridden||n<=_._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=ht(M-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,p=u._valueType,f=u._tweenType,g=0===f,_=0===p,y=_&&g||0===s||1===s?-1:L.precision;let b,T;if(_)b=T=n(lt(dt(u._fromNumber,u._toNumber,s),y));else if(1===p)T=n(lt(dt(u._fromNumber,u._toNumber,s),y)),b=`${T}${u._unit}`;else if(2===p){const t=u._fromNumbers,e=u._toNumbers,i=lt(ht(n(dt(t[0],e[0],s)),0,255),0),r=lt(ht(n(dt(t[1],e[1],s)),0,255),0),o=lt(ht(n(dt(t[2],e[2],s)),0,255),0),h=ht(n(lt(dt(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${h})`,v){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=h}}else if(3===p){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(lt(dt(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=T),r||t===i.blend)u._value=b;else{const t=u.property;a=u.target,g?a[t]=b:1===f?a.setAttribute(t,b):(l=a.style,3===f?(a!==c&&(c=a,d=a[h]),d[t]=b,m=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),E&&(F=1)}}if(m&&u._renderTransforms){let t=p;for(let e in d)t+=`${g[e]}${d[e]}) `;l.transform=t,m=0}u=u._next}!s&&F&&t.onRender(t)}!s&&E&&t.onUpdate(t)}return o&&B?!s&&(o.began&&!R&&x>=a&&!l||R&&x<=c&&l)&&(t.onComplete(t),t.completed=!R):E&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(R||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},St=(t,e,s,i,r)=>{const n=t._currentIteration;if(xt(t,e,s,i,r),t._hasChildren){const o=t,h=o.backwards,a=i?e:o._iterationTime,l=F();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;yt(o,(e=>{if(h){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&&xt(e,t,s,1,2),e.began=!1,e.completed=!1})),s||o.onLoop(o)}yt(o,(t=>{const e=lt((a-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;d+=xt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),h),!s&&d&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},kt={animation:null,update:_},$t=(()=>t?requestAnimationFrame:setImmediate)(),Et=(()=>t?cancelAnimationFrame:clearImmediate)();class Ct extends wt{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=C,this.paused=!(!t||!s.hidden),this.reqId=null}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?(vt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):St(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}kt.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=$t(Lt)),this}pause(){return this.paused=!0,Dt()}resume(){if(this.paused)return this.paused=!1,yt(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===L.timeScale?1:u)}set speed(t){this._speed=t*L.timeScale,yt(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:u;this.defaults.duration*=t,this._speed*=t}}get precision(){return L.precision}set precision(t){L.precision=t}}const Bt=(()=>{const e=new Ct(F());return t&&(D.engine=e,s.addEventListener("visibilitychange",(()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())}))),e})(),Lt=()=>{Bt._head?(Bt.reqId=$t(Lt),Bt.update()):Bt.reqId=0},Dt=()=>(Et(Bt.reqId),Bt.reqId=0,Bt);function Nt(t){const e=R(t)?B.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function At(e){if(z(e))return[];if(O(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(i)){const t=Nt(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(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}if(!t)return[e];const s=Nt(e);return s?Array.from(s):[e]}function Ft(t){const e=At(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[r]){s[r]=!0;const t=I(s);(s.nodeType||t)&&(s[n]=!0,s[o]=t,s[h]={})}}return e}const Ot=t=>{const e=At(t)[0];if(e&&I(e))return e},Pt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),Mt=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[o],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Pt(t,s,-1),i=Pt(t,s,1);return 180*rt(i.y-e.y,i.x-e.x)/nt}{const i=Pt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Rt=["opacity","rotate","overflow","color"],Yt={morphTo:(t,e=.33)=>s=>{const i=Ot(t);if(!i)return;const r="path"===s.tagName,n=r?" ":",",o=s[a];o&&s.setAttribute(r?"d":"points",o);let h="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),a=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<a;e++){const c=e/(a-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";h+=p+lt(d.x,3)+n+d.y+" ",l+=p+lt(u.x,3)+n+u.y+" "}}else h=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[a]=l,[h,l]},createMotionPath:t=>{const e=Ot(t);if(e)return{translateX:Mt(e,"x"),translateY:Mt(e,"y"),rotate:Mt(e,"a")}},createDrawable:(t,e=0,s=0)=>At(t).map((t=>((t,e,s)=>{const i=u,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let h=n;const a=new Proxy(t,{get(t,e){const s=t[e];return e===l?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],a=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(j(s.a*s.a+s.b*s.b)+j(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=a*i*l+c,u=i*l+(0===r&&1===a||1===r&&0===a?0:10*l)-d;if("butt"!==n){const e=r===a?"butt":n;h!==e&&(t.style.strokeLinecap=`${e}`,h=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:Y(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),a.setAttribute("draw",`${e} ${s}`)),a})(t,e,s)))},Xt=(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),zt=(t,e)=>X(t)?e:t,It=(t,e,s,i,r)=>{if(Y(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Wt=(t,e)=>t[n]?t[o]&&((t,e)=>{if(Rt.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:f.includes(e)||m.get(e)?3:A(e,"--")?4:e in t.style?2:e in t?0:1:0,Vt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[l]||t).getPropertyValue(e);return"auto"===r?"0":r},Ht=(t,e,s,i)=>{const r=X(s)?Wt(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[h];let o;for(;o=$.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:A(e,"scale")?"1":A(e,"rotate")||A(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Vt(t,e,i).trimStart():Vt(t,e,i)},Ut=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,qt=(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(" ")&&S.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(W(r=s)||V(r)||H(r))return e.t=2,e.d=V(i=s)?(t=>{const e=v.exec(t)||b.exec(t),s=X(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):W(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):H(i)?(t=>{const e=T.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,h,a;if(0===i)o=h=a=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=lt(255*Xt(e,t,s+1/3),0),h=lt(255*Xt(e,t,s),0),a=lt(255*Xt(e,t,s-1/3),0)}return[o,h,a,n]})(i):[0,0,0,1],e;{const t=s.match(x);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(x)||[],e}}var i,r;return e.n=s,e},Qt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=gt(t._toNumbers),e.s=gt(t._strings),e),jt={t:0,n:0,u:null,o:null,d:null,s:null},Gt={_rep:new WeakMap,_add:new Map},Zt=(t,e,s="_rep")=>{const i=Gt[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,Kt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},te=(t,e)=>{const s=t._composition;if(s===i.replace){const s=t._absoluteStartTime;bt(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){Kt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)Kt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<c&&Kt(i)}let o=!0;if(yt(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;yt(t,(t=>{t!==e&&yt(t,(t=>{t._isOverlapped||(s=!1)}))})),s&&t.cancel()}else e.cancel()}}}else if(s===i.blend){const e=Zt(t.target,t.property,"_add"),s=(t=>{let e=kt.animation;return e||(e={duration:c,computeDeltaTime:_,_offset:0,_delay:0,_head:null,_tail:null},kt.animation=e,kt.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?gt(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}}})),xt(e,1,1,0,2)}),e})(Gt._add);let r=e._head;r||(r={...t},r._composition=i.replace,r._updateDuration=c,r._startTime=0,r._numbers=gt(t._fromNumbers),r._number=0,r._next=null,r._prev=null,bt(e,r),bt(s,r));const n=t._toNumber;if(t._fromNumber=r._fromNumber-n,t._toNumber=0,t._numbers=gt(t._fromNumbers),t._number=0,r._fromNumber=n,t._toNumbers){const e=gt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=r._fromNumbers[s]-e,t._toNumbers[s]=0})),r._fromNumbers=e}bt(e,t,null,"_prevAdd","_nextAdd")}return t},ee=t=>{const e=t._composition;if(e!==i.none){const s=t.target,r=t.property,n=Gt._rep.get(s)[r];if(vt(n,t,"_prevRep","_nextRep"),e===i.blend){const e=Gt._add,i=e.get(s);if(!i)return;const n=i[r],o=kt.animation;vt(n,t,"_prevAdd","_nextAdd");const h=n._head;if(h&&h===n._tail){vt(n,h,"_prevAdd","_nextAdd"),vt(o,h);let t=!0;for(let e in i)if(i[e]._head){t=!1;break}t&&e.delete(s)}}}return t},se=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),ie=t=>t._cancelled?(t._hasChildren?yt(t,ie):yt(t,(t=>{t._composition!==i.none&&te(t,Zt(t.target,t.property))})),t._cancelled=0,t):t;let re=0;class ne extends wt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:h,loop:a,loopDelay:l,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:b}=t;B.current&&B.current.register(this);const T=e?0:Bt._elapsedTime,w=e?e.defaults:L.defaults,x=Y(r)||X(r)?w.delay:+r,S=Y(n)||X(n)?1/0:+n,k=zt(a,w.loop),$=zt(l,w.loopDelay),E=!0===k||k===1/0||k<0?1/0:k+1;let C=0;if(e)C=s;else{let t=F();Bt.paused&&(Bt.requestTick(t),t=Bt._elapsedTime),C=t-Bt._startTime}this.id=X(i)?++re:i,this.parent=e,this.duration=mt((S+$)*E-$)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||w.onBegin,this.onBeforeUpdate=v||w.onBeforeUpdate,this.onUpdate=b||w.onUpdate,this.onLoop=f||w.onLoop,this.onPause=g||w.onPause,this.onComplete=m||w.onComplete,this.iterationDuration=S,this.iterationCount=E,this._autoplay=!e&&zt(d,w.autoplay),this._offset=C,this._delay=x,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=_,this._running=!1,this._reversed=+zt(o,w.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=zt(h,w.alternate),this._prev=null,this._next=null,this._elapsedTime=T,this._startTime=T,this._lastTime=T,this._fps=zt(u,w.frameRate),this._speed=zt(p,w.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return ht(lt(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 lt(this._iterationTime,L.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ht(lt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ht(lt(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*ht(+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=0){return ie(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,St(this,0,1,t,2),se(this),this._hasChildren&&yt(this,se),this}init(t=0){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&St(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*Bt._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?St(this,c,0,0,2):(this._running||(bt(Bt,this),Bt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,Bt.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){ie(this),this.completed=!1;const i=this.paused;return this.paused=!0,St(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?et(d/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?yt(this,(t=>t.cancel()),!0):yt(this,ee),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=ft(t);if(e===s)return this;const i=t/e,r=t<=c;return this.duration=r?c:s,this.iterationDuration=r?c:ft(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){St(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=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const oe=t=>new ne(t,null,0).init(),he=t=>t,ae=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,le=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?he:r=>0===r||1===r?r:ae(((t,e,s)=>{let i,r,n=0,o=1,h=0;do{r=n+(o-n)/2,i=ae(r,e,s)-t,i>0?o=r:n=r}while(J(i)>1e-7&&++h<100);return r})(r,t,s),e,i),ce=(t=10,e)=>{const s=e?tt:et;return e=>s(ht(e,0,1)*t)*(1/t)},de=(...t)=>{const e=t.length;if(!e)return he;const s=e-1,i=t[0],r=t[s],n=[0],o=[q(i)];for(let e=1;e<s;e++){const i=t[e],r=R(i)?i.trim().split(" "):[i],h=r[0],a=r[1];n.push(X(a)?e/s:q(a)/100),o.push(q(h))}return o.push(q(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]}},ue=(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(ht(o,r,1))}return s.push(1),de(...s)},pe=nt/2,me=2*nt,fe=(t=1.68)=>e=>Q(e,+t),ge={[p]:fe,Quad:fe(2),Cubic:fe(3),Quart:fe(4),Quint:fe(5),Sine:t=>1-Z(t*pe),Circ:t=>1-j(1-t*t),Expo:t=>t?Q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=Q(2,--s))-1)/11;);return 1/Q(4,3-s)-7.5625*Q((3*e-2)/22-t,2)},Back:(t=1.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ht(+t,1,10),i=ht(+e,c,2),r=i/me*st(1/s),n=me/i;return t=>0===t||1===t?t:-s*Q(2,-10*(1-t))*G((1-t-r)*n)}},_e={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},ye=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=_e[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:he}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):he}},ve=(()=>{const t={linear:de,irregular:ue,steps:ce,cubicBezier:le};for(let e in _e)for(let s in ge){const i=ge[s],r=_e[e];t[e+s]=s===p||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),be={linear:he},Te=t=>Y(t)?t:R(t)?ye(t,ve,be):he,we={},xe=(t,e,s)=>{if(3===s)return m.get(t)||t;if(2===s||1===s&&I(e)&&t in e.style){const e=we[t];if(e)return e;{const e=t?N(t):t;return we[t]=e,e}}return t},Se={deg:1,rad:180/nt,turn:360},ke={},$e=(t,e,i,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===i)return e;const h=o+n+i,a=ke[h];if(X(a)||r){let r;if(n in Se)r=o*Se[n]/Se[i];else{const e=100,h=t.cloneNode(),a=t.parentNode,l=a&&a!==s?a:s.body;l.appendChild(h);const c=h.style;c.width=e+n;const d=h.offsetWidth||e;c.width=e+i;const u=d/(h.offsetWidth||e);l.removeChild(h),r=u*o}e.n=r,ke[h]=r}else e.n=a;return e.t,e.u=i,e},Ee=t=>{if(t._hasChildren)yt(t,Ee,!0);else{const e=t;e.pause(),yt(e,(t=>{const s=t.property,i=t.target;if(i[n]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[h];if(X(n)||n===p?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=p;for(let s in e)t+=g[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else X(n)||n===p?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===p&&t.removeAttribute("style")}))}}))}return t},Ce={t:0,n:0,u:null,o:null,d:null,s:null},Be={t:0,n:0,u:null,o:null,d:null,s:null},Le={func:null},De=[null],Ne=[null,null],Ae={to:null};let Fe,Oe,Pe=0;class Me extends ne{constructor(t,e,s,r,n=!1,o=0,h=0){super(e,s,r);const a=Ft(t),l=a.length,d=e.keyframes,p=d?_t(((t,e)=>{const s={};if(O(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(U);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];U(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=zt(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(U(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let h=n.length,a=n[h-1];const l={to:r[t]};let c=0;for(let t=0;t<h;t++)c+=n[t].duration;1===h&&(l.from=a.to),r.ease&&(l.ease=r.ease),l.duration=o-(h?c: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})(d,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=p,T=s?s.defaults:L.defaults,w=zt(_,T.playbackEase),x=w?Te(w):null,S=!X(g)&&!X(g.ease),k=S?g.ease:zt(g,x?"linear":T.ease),$=S?g.duration:zt(f,T.duration),E=zt(m,T.delay),C=y||T.modifier,B=X(v)&&l>=u?i.none:X(v)?T.composition:v,D={},N=this._offset+(s?s._offset:0);let A=NaN,F=NaN,R=0,Y=0;for(let t=0;t<l;t++){const e=a[t],r=o||t,d=h||l;let u=NaN,m=NaN;for(let t in p)if(U(t)){const o=Wt(e,t),h=xe(t,e,o);let a=p[t];const l=O(a);if(n&&!l&&(Ne[0]=a,Ne[1]=a,a=Ne),l){const t=a.length,e=!P(a[0]);2===t&&e?(Ae.to=a,De[0]=Ae,Fe=De):t>2&&e?(Fe=[],a.forEach(((t,e)=>{e?1===e?(Ne[1]=t,Fe.push(Ne)):Fe.push(t):Ne[0]=t}))):Fe=a}else De[0]=a,Fe=De;let f=null,g=null,_=NaN,y=0,v=0;for(let t=Fe.length;v<t;v++){const n=Fe[v];P(n)?Oe=n:(Ae.to=n,Oe=Ae),Le.func=null;const a=It(Oe.to,e,r,d,Le);let l;P(a)&&!X(a.to)?(Oe=a,l=a.to):l=a;const u=It(Oe.from,e,r,d),p=Oe.ease,m=!X(p)&&!X(p.ease),b=m?p.ease:p||k,T=m?p.duration:It(zt(Oe.duration,t>1?It($,e,r,d)/t:$),e,r,d),w=It(zt(Oe.delay,v?0:E),e,r,d),x=It(zt(Oe.composition,B),e,r,d),S=M(x)?x:i[x],L=Oe.modifier||C,A=!X(u),F=!X(l),z=O(l),I=z||A&&F,W=g?y+w:w,V=N+W;Y||!A&&!z||(Y=1);let H=g;if(S!==i.none){f||(f=Zt(e,h));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(H=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)Kt(t),t=t._nextRep}if(I?(qt(z?It(l[0],e,r,d):u,Ce),qt(z?It(l[1],e,r,d,Le):l,Be),0===Ce.t&&(H?1===H._valueType&&(Ce.t=1,Ce.u=H._unit):(qt(Ht(e,h,o,D),jt),1===jt.t&&(Ce.t=1,Ce.u=jt.u)))):(F?qt(l,Be):g?Qt(g,Be):qt(s&&H&&H.parent.parent===s?H._value:Ht(e,h,o,D),Be),A?qt(u,Ce):g?Qt(g,Ce):qt(s&&H&&H.parent.parent===s?H._value:Ht(e,h,o,D),Ce)),Ce.o&&(Ce.n=Ut(H?H._toNumber:qt(Ht(e,h,o,D),jt).n,Ce.n,Ce.o)),Be.o&&(Be.n=Ut(Ce.n,Be.n,Be.o)),Ce.t!==Be.t)if(3===Ce.t||3===Be.t){const t=3===Ce.t?Ce:Be,e=3===Ce.t?Be:Ce;e.t=3,e.s=gt(t.s),e.d=t.d.map((()=>e.n))}else if(1===Ce.t||1===Be.t){const t=1===Ce.t?Ce:Be,e=1===Ce.t?Be:Ce;e.t=1,e.u=t.u}else if(2===Ce.t||2===Be.t){const t=2===Ce.t?Ce:Be,e=2===Ce.t?Be:Ce;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Ce.u!==Be.u){let t=Be.u?Ce:Be;t=$e(e,t,Be.u?Be.u:Ce.u,!1)}if(Be.d&&Ce.d&&Be.d.length!==Ce.d.length){const t=Ce.d.length>Be.d.length?Ce:Be,e=t===Ce?Be:Ce;e.d=t.d.map(((t,s)=>X(e.d[s])?0:e.d[s])),e.s=gt(t.s)}const U=lt(+T||c,12),q={parent:this,id:Pe++,property:h,target:e,_value:null,_func:Le.func,_ease:Te(b),_fromNumbers:gt(Ce.d),_toNumbers:gt(Be.d),_strings:gt(Be.s),_fromNumber:Ce.n,_toNumber:Be.n,_numbers:gt(Ce.d),_number:Ce.n,_unit:Be.u,_modifier:L,_currentTime:0,_startTime:W,_delay:+w,_updateDuration:U,_changeDuration:U,_absoluteStartTime:V,_tweenType:o,_valueType:Be.t,_composition:S,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};S!==i.none&&te(q,f),isNaN(_)&&(_=q._startTime),y=lt(W+U,12),g=q,R++,bt(this,q)}(isNaN(F)||_<F)&&(F=_),(isNaN(A)||y>A)&&(A=y),3===o&&(u=R-v,m=R)}if(!isNaN(u)){let t=0;yt(this,(e=>{t>=u&&t<m&&(e._renderTransforms=1,e._composition===i.blend&&yt(kt.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),F?(yt(this,(t=>{t._startTime-t._delay||(t._delay-=F),t._startTime-=F})),A-=F):F=0,A||(A=c,this.iterationCount=0),this.targets=a,this.duration=A===c?c:mt((A+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=b||T.onRender,this._ease=x,this._delay=F,this.iterationDuration=A,this._inlineStyles=D,!this._autoplay&&Y&&this.onRender(this)}stretch(t){const e=this.duration;if(e===ft(t))return this;const s=t/e;return yt(this,(t=>{t._updateDuration=ft(t._updateDuration*s),t._changeDuration=ft(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return yt(this,(t=>{const e=t._func;if(e){const s=Ht(t.target,t.property,t._tweenType);qt(s,jt),qt(e(),Be),t._fromNumbers=gt(jt.d),t._fromNumber=jt.n,t._toNumbers=gt(Be.d),t._strings=gt(Be.s),t._toNumber=Be.n}})),this}revert(){return super.revert(),Ee(this)}then(t){return super.then(t)}}const Re=(t,e)=>new Me(t,e,null,0,!1).init(),Ye=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Xe={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},ze=(()=>{const t={};for(let e in _e)t[e]=t=>_e[e](fe(t));return t})(),Ie=t=>{let e=Xe[t];if(e)return e;if(e="linear",R(t)){if(A(t,"linear")||A(t,"cubic-")||A(t,"steps")||A(t,"ease"))e=t;else if(A(t,"cubicB"))e=N(t);else{const s=ye(t,ze,Xe);Y(s)&&(e=s===he?"linear":Ye(s))}Xe[t]=e}else if(Y(t)){const s=Ye(t);s&&(e=s)}else t.ease&&(e=Ye(t.ease));return e},We=["x","y","z"],Ve=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...We],He=(()=>[...We,...f.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))])();let Ue=null;const qe={_head:null,_tail:null},Qe=(t,e,s)=>{let i=qe._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,h=!s||i.parent===s;if(n&&o&&h){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),vt(qe,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},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),bt(qe,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const h=()=>{Qe(e,s,t)};return n.onremove=h,n.onfinish=h,n},Ge=(t,e,s,i,r)=>{let n=It(e,s,i,r);return M(n)?Ve.includes(t)||A(t,"translate")?`${n}px`:A(t,"rotate")||A(t,"skew")?`${n}deg`:`${n}`:n},Ze=(t,e,s,i,r,n)=>{let o="0";const h=X(i)?getComputedStyle(t)[e]:Ge(e,i,t,r,n);return o=X(s)?O(i)?i.map((s=>Ge(e,s,t,r,n))):h:[Ge(e,s,t,r,n),h],o};class Je{constructor(e,s){B.current&&B.current.register(this),z(Ue)&&(!t||!X(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(f.forEach((t=>{const e=A(t,"skew"),s=A(t,"scale"),i=A(t,"rotate"),r=A(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{}})),Ue=!0):Ue=!1);const i=Ft(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=zt(s.ease,Ie(L.defaults.ease)),o=n.ease&&n,a=zt(s.autoplay,L.defaults.autoplay),l=!(!a||!a.link)&&a,c=s.alternate&&!0===s.alternate,d=s.reversed&&!0===s.reversed,y=zt(s.loop,L.defaults.loop),v=!0===y||y===1/0?1/0:M(y)?y+1:1,b=c?d?"alternate-reverse":"alternate":d?"reverse":"normal",T=Ie(n),w=1===L.timeScale?1:u;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||_,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!a||!1!==l,this.reversed=d,this.autoplay=a,this._speed=zt(s.playbackRate,L.defaults.playbackRate),this._resolve=_,this._completed=0,this._inlineStyles=i.map((t=>t.getAttribute("style"))),i.forEach(((t,e)=>{const i=t[h],a=He.some((t=>s.hasOwnProperty(t))),l=(o?o.duration:It(zt(s.duration,L.defaults.duration),t,e,r))*w,c=It(zt(s.delay,L.defaults.delay),t,e,r)*w,d=zt(s.composition,"replace");for(let o in s){if(!U(o))continue;const h={},u={iterations:v,direction:b,fill:"forwards",easing:T,duration:l,delay:c,composite:d},p=s[o],g=!!a&&(f.includes(o)?o:m.get(o));let _;if(P(p)){const s=p,a=zt(s.ease,n),m=a.ease&&a,f=s.to,y=s.from;if(u.duration=(m?m.duration:It(zt(s.duration,l),t,e,r))*w,u.delay=It(zt(s.delay,c),t,e,r)*w,u.composite=zt(s.composition,d),u.easing=Ie(a),_=Ze(t,o,y,f,e,r),g?(h[`--${g}`]=_,i[g]=_):h[o]=Ze(t,o,y,f,e,r),je(this,t,o,h,u),!X(y))if(g){const e=`--${g}`;t.style.setProperty(e,h[e][0])}else t.style[o]=h[o][0]}else _=O(p)?p.map((s=>Ge(o,s,t,e,r))):Ge(o,p,t,e,r),g?(h[`--${g}`]=_,i[g]=_):h[o]=_,je(this,t,o,h,u)}if(a){let e=p;for(let t in i)e+=`${g[t]}var(--${t})) `;t.style.transform=e}})),l&&this.autoplay.link(this)}forEach(t){const e=R(t)?e=>e[t]():t;return this.animations.forEach(e),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:u);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const Ke={animate:(t,e)=>new Je(t,e),convertEase:Ye},ts=(t=_)=>new ne({duration:1*L.timeScale,onComplete:t},null,0).resume();function es(t,e,s){const i=Ft(t);if(!i.length)return;const[r]=i,n=Wt(r,e),o=xe(e,r,n);let h=Ht(r,o);if(X(s))return h;if(qt(h,jt),0===jt.t||1===jt.t){if(!1===s)return jt.n;{const t=$e(r,jt,s,!1);return`${lt(t.n,L.precision)}${t.u}`}}}const ss=(t,e)=>{if(!X(e))return e.duration=c,e.composition=zt(e.composition,i.none),new Me(t,e,null,0,!0).resume()},is=(t,e,s)=>{let i=!1;return yt(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,h=xe(s,n,o);(!h||h&&h===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),vt(e,r),ee(r),i=!0)}}),!0),i},rs=(t,e,s)=>{const i=At(t),r=e||Bt,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];Qe(e,s,n)}let o;if(r._hasChildren){let e=0;yt(r,(n=>{if(!n._hasChildren)if(o=is(i,n,s),o&&!n._head)n.cancel(),vt(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?rs(t,n,s):n._hasChildren=!1}),!0),X(r.iterationDuration)||(r.iterationDuration=e)}else o=is(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},ns=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),os=(t,e,s,i)=>{let r=u/L.defaults.frameRate;if(!1!==i){const t=i||Bt._hasChildren&&Bt;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},hs=t=>(...e)=>{const s=t(...e);return new Proxy(_,{apply:(t,e,[i])=>s(i),get:(t,e)=>hs(((...t)=>{const i=ls[e](...t);return t=>i(s(t))}))})},as=(t,e=0)=>(...s)=>(s.length<t.length?hs(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),ls={$:Ft,get:es,set:ss,remove:rs,cleanInlineStyles:Ee,random:ut,randomPick:t=>t[ut(0,t.length-1)],shuffle:pt,lerp:os,sync:ts,keepTime:Tt,clamp:as(ht),round:as(lt),snap:as(ct),wrap:as(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:as(dt,1),mapRange:as(ns),roundPad:as(((t,e)=>(+t).toFixed(e))),padStart:as(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:as(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:as((t=>t*nt/180)),radToDeg:as((t=>180*t/nt))},cs=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),X(e))return s;if(M(+e))return+e;const i=e,r=t?t.labels:null,n=!z(r),o=((t,e)=>{if(A(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),h=!X(o),a=E.exec(i);if(a){const t=a[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=h?o:n?l:s,d=+e[1];return Ut(c,d,t[0])}return h?o:n?X(r[i])?s:r[i]:s};function ds(t,e,s,i,r,n){const o=M(t.duration)&&t.duration<=c?s-c:s;St(e,o,1,1,1);const h=i?new Me(i,t,e,o,!1,r,n):new ne(t,e,o);return h.init(1),bt(e,h),yt(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return mt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}class us extends ne{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=L.defaults;this.defaults=e?_t(e,s):s,this.onRender=t.onRender||s.onRender;const i=zt(t.playbackEase,s.playbackEase);this._ease=i?Te(i):null,this.iterationDuration=0}add(t,e,s){const i=P(e),r=P(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(Y(s)){const e=s,r=At(t),n=this.duration,o=this.iterationDuration,h=i.id;let a=0;const l=r.length;r.forEach((t=>{const s={...i};this.duration=n,this.iterationDuration=o,X(h)||(s.id=h+"-"+a),ds(s,this,e(t,a,l,this),t,a,l),a++}))}else ds(i,this,cs(this,s),t)}else ds(t,this,cs(this,e));return this.init(1)}}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,ease:"linear"},e)}set(t,e,s){return X(e)?this:(e.duration=c,e.composition=i.replace,this.add(t,e,s))}call(t,e){return X(t)||t&&!Y(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return X(t)||t&&!R(t)||(this.labels[t]=cs(this,e)),this}remove(t,e){return rs(t,this,e),this}stretch(t){const e=this.duration;if(e===ft(t))return this;const s=t/e,i=this.labels;yt(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return yt(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),yt(this,(t=>t.revert),!0),Ee(this)}then(t){return super.then(t)}}const ps=t=>new us(t).init();class ms{constructor(t,e){B.current&&B.current.register(this);const s={},r={};if(this.targets=[],this.animations={},!X(t)&&!X(e)){for(let t in e){const i=e[t];U(t)?r[t]=i:s[t]=i}for(let e in r){const n=r[e],o=P(n);let h={},a="+=0";if(o){const t=n.unit;R(t)&&(a+=t)}else h.duration=n;h[e]=o?_t({to:a},n):a;const l=_t(s,h);l.composition=i.replace,l.autoplay=!1;const c=this.animations[e]=new Me(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(X(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return yt(c,(e=>{if(O(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=Te(s)),e._currentTime=0})),X(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=_,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}const fs=(t,e)=>new ms(t,e);class gs{constructor(t={}){this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/u,this.maxIterations=this.maxDuration/this.timeStep/u,this.m=ht(zt(t.mass,1),0,u),this.s=ht(zt(t.stiffness,100),1,u),this.d=ht(zt(t.damping,10),.1,u),this.v=ht(zt(t.velocity,0),-1e3,u),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?K(-n*e*s)*(1*Z(i*n)+r*G(i*n)):(1+r*n)*K(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:h}=this,a=this.w0=ht(j(o/r),c,u),l=this.zeta=n/(2*j(o*r)),d=this.wd=l<1?a*j(1-l*l):0;this.b=l<1?(l*a-h)/d:-h+a;let p=0,m=0,f=0;for(;m<t&&f<e;)J(1-this.solve(p))<s?m++:m=0,this.solverDuration=p,p+=i,f++;this.duration=lt(this.solverDuration*u,0)*L.timeScale}get mass(){return this.m}set mass(t){this.m=ht(zt(t,1),0,u),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ht(zt(t,100),1,u),this.compute()}get damping(){return this.d}set damping(t){this.d=ht(zt(t,10),.1,u),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ht(zt(t,0),-1e3,u),this.compute()}}const _s=t=>new gs(t),ys=t=>{t.cancelable&&t.preventDefault()};class vs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:_,remove:_}}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 bs{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 Ts=(t,e)=>t&&Y(t)?t(e):t;let ws=0;class xs{constructor(t,i={}){if(!t)return;B.current&&B.current.register(this);const r=i.x,n=i.y,o=i.trigger,h=i.modifier,a=i.releaseEase,l=a&&Te(a),c=!X(a)&&!X(a.ease),u=P(r)&&!X(r.mapTo)?r.mapTo:"translateX",p=P(n)&&!X(n.mapTo)?n.mapTo:"translateY",m=Ts(i.container,this);this.containerArray=O(m)?m:null,this.$container=m&&!this.containerArray?At(m)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=P(t)?new vs(t):At(t)[0],this.$trigger=At(o||t)[0],this.fixed="fixed"===es(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?a:_s({mass:zt(i.releaseMass,1),stiffness:zt(i.releaseStiffness,80),damping:zt(i.releaseDamping,20)}),this.releaseYSpring=c?a:_s({mass:zt(i.releaseMass,1),stiffness:zt(i.releaseStiffness,80),damping:zt(i.releaseDamping,20)}),this.releaseEase=l||ve.outQuint,this.hasReleaseSpring=c,this.onGrab=i.onGrab||_,this.onDrag=i.onDrag||_,this.onRelease=i.onRelease||_,this.onUpdate=i.onUpdate||_,this.onSettle=i.onSettle||_,this.onSnap=i.onSnap||_,this.onResize=i.onResize||_,this.onAfterResize=i.onAfterResize||_,this.disabled=[0,0];const f={};if(h&&(f.modifier=h),X(r)||!0===r)f[u]=0;else if(P(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===r&&(f[u]=0,this.disabled[0]=1);if(X(n)||!0===n)f[p]=0;else if(P(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 ms(this.$target,f),this.xProp=u,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=[-1e12,d,d,-1e12],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 bs(this.$target),this.overshootCoords={x:0,y:0},this.overshootXTicker=new ne({autoplay:!1},null,0).init(),this.overshootYTicker=new ne({autoplay:!1},null,0).init(),this.updateTicker=new ne({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),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]?u:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=rt(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 ne({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),P(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,h=this.minVelocity,a=this.maxVelocity,l=this.velocityStackIndex;n[l]=lt(ht(j(t*t+e*e)/r*o,h,a),5);const c=it(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=lt(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=ct(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=lt(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=ct(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return lt(this.animate[this.xProp](),L.precision)}set x(t){this.setX(t,!1)}get y(){return lt(this.animate[this.yProp](),L.precision)}set y(t){this.setY(t,!1)}get progressX(){return ns(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(ns(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return ns(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(ns(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=lt(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=lt(this.useWin?e.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,h=this.scrollThreshold;this.scroll.x=t,this.scroll.y=s,this.scrollBounds[0]=s-this.targetBounds[0]+i-h,this.scrollBounds[1]=t-this.targetBounds[1]-r+h,this.scrollBounds[2]=s-this.targetBounds[2]-n+h,this.scrollBounds[3]=t-this.targetBounds[3]+o-h}updateBoundingValues(){const t=this.$container,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 h=this.window[0]=e.innerWidth,a=this.window[1]=e.innerHeight,l=this.useWin,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?ht(c,h,c):c,this.scrollView[1]=l?ht(d,a,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:T,right:w,bottom:x}=t.getBoundingClientRect();this.dragArea[2]=lt(l?ht(y,h,h):y,0),this.dragArea[3]=lt(l?ht(v,a,a):v,0);const S=es(t,"overflow"),k="visible"===S,$="hidden"===S;if(this.canScroll=!u&&this.contained&&(t===s.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!O(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,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=lt(r.top+s-(l?0:T),0),this.targetBounds[1]=lt(r.right+e-(l?h:w),0),this.targetBounds[2]=lt(r.bottom+s-(l?a:x),0),this.targetBounds[3]=lt(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]+_):(this.containerBounds[0]=-lt(r.top-(u?ht(T,0,a):T)+o-m,0),this.containerBounds[1]=-lt(r.right-(u?ht(w,0,h):w)-c+f,0),this.containerBounds[2]=-lt(r.bottom-(u?ht(x,0,a):x)-d+g,0),this.containerBounds[3]=-lt(r.left-(u?ht(b,0,h):b)+n-_,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,[h,a]=this.disabled,l=!h&&e<o||!h&&e>r,c=!a&&s<i||!a&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=Ts(t.container,this),o=Ts(t.containerPadding,this)||0,h=O(o)?o:[o,o,o,o],a=this.x,l=this.y,c=Ts(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=O(n)?n:null,this.$container=n&&!this.containerArray?At(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=zt(h,[0,0,0,0]),this.containerFriction=ht(zt(Ts(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ht(zt(Ts(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=Ts(P(i)&&!X(i.snap)?i.snap:t.snap,this),this.snapY=Ts(P(r)&&!X(r.snap)?r.snap:t.snap,this),this.scrollSpeed=zt(Ts(t.scrollSpeed,this),1.5),this.scrollThreshold=zt(Ts(t.scrollThreshold,this),20),this.dragSpeed=zt(Ts(t.dragSpeed,this),1),this.minVelocity=zt(Ts(t.minVelocity,this),0),this.maxVelocity=zt(Ts(t.maxVelocity,this),50),this.velocityMultiplier=zt(Ts(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(ht(a,f,p),!0),this.setY(ht(l,u,m),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],h=this.dragArea[3],a=this.scroll.x,l=this.scroll.y,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?ht(c,this.window[0],c):c,p=this.useWin?ht(d,this.window[1],d):d,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,_=this.scrollThreshold,[y,v]=this.coords,[b,T,w,x]=this.scrollBounds,S=lt(ht((v-b+t)/_,-1,0)*g,0),k=lt(ht((y-T-e)/_,0,1)*g,0),$=lt(ht((v-w-s)/_,0,1)*g,0),E=lt(ht((y-x+i)/_,-1,0)*g,0);if(S||$||E||k){const[t,e]=this.disabled;let s=a,i=l;t||(s=lt(ht(a+(E||k),0,r-o),0),this.coords[0]-=a-s),e||(i=lt(ht(l+(S||$),0,n-h),0),this.coords[1]-=l-i),this.useWin?this.$scrollContainer.scrollBy(-(a-s),-(l-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,h,a,l]=this.pointer;this.coords[0]+=(r-a)*this.dragSpeed,this.coords[1]+=(n-l)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-a,n-l),this.angle=rt(n-h,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return rs(this,null,"x"),rs(this,null,"y"),rs(this,null,"progressX"),rs(this,null,"progressY"),rs(this.scroll),rs(this.overshootCoords),this}scrollInView(t,e=0,s=ve.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,h=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[a,l,c,u]=o,p=lt(ht(r-a,-1e12,0),0),m=lt(ht(i-l,0,d),0),f=lt(ht(r-c,0,d),0),g=lt(ht(i-u,-1e12,0),0);new Me(n,{x:lt(n.x+(g?g-e:m?m+e:0),0),y:lt(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=h}))}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=ss(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=ve.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,h,a]=this.containerPadding,l=this.scroll.y-this.targetBounds[0]+n+e,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-h-e,u=this.scroll.x-this.targetBounds[3]+a+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=ht(ct(i,this.snapX),u,c),h=ht(ct(r,this.snapY),l,d),a=X(t)?350*L.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,a,s),n||2!==p&&3!==p||this.animate[this.yProp](h,a,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:h}=this.transforms.normalizePoint(r,n),[a,l,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/u:m<a?a+(m-a)/u:m:m,this.pointer[0]=o,this.pointer[1]=h,this.pointer[2]=o,this.pointer[3]=h,this.pointer[4]=o,this.pointer[5]=h,this.pointer[6]=o,this.pointer[7]=h,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=es(this.$target,"zIndex",!1);ws=(f>ws?f:ws)+1,this.targetStyles=ss(this.$target,{zIndex:ws}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=ss(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,ve.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],h=n-this.pointer[7];let a=t.target,l=!1,c=!1,d=!1;for(;e&&a&&a!==this.$trigger;){const t=es(a,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=a;if(e>s){d=!0,l=t<=3,c=t>=e-s-3;break}}a=a.parentNode}d&&(!l&&!c||l&&h<0||c&&h>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):(ys(t),this.triggerStyles||(this.triggerStyles=ss(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",ys,{passive:!1}),this.$trigger.addEventListener("touchmove",ys,{passive:!1}),this.$trigger.addEventListener("touchend",ys),(!this.disabled[0]&&J(o)>3||!this.disabled[1]&&J(h)>3)&&(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,[r,n,o,h,a,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,_=this.releaseYSpring,y=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,w=this.y,x=this.computeVelocity(r-a,n-l),S=this.angle=rt(n-h,r-o),k=150*x,$=(1-this.releaseContainerFriction)*this.dragSpeed,E=T+Z(S)*k,C=w+G(S)*k,B=E>d?d+(E-d)*$:E<p?p+(E-p)*$:E,D=C>u?u+(C-u)*$:C<c?c+(C-c)*$:C,N=this.destX=ht(lt(ct(B,this.snapX),5),p,d),A=this.destY=ht(lt(ct(D,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,E,C);let O=0,P=0,M=y,R=y,Y=0;if(b.x=T,b.y=w,!t){const t=N===d?T>d?-1:1:T<p?-1:1,s=lt(T-N,0);g.velocity=e&&v?s?k*t/J(s):0:x;const{ease:i,duration:r,restDuration:n}=g;O=T===N?0:v?r:r-n*L.timeScale,v&&(M=i),O>Y&&(Y=O)}if(!e){const e=A===u?w>u?-1:1:w<c?-1:1,s=lt(w-A,0);_.velocity=t&&v?s?k*e/J(s):0:x;const{ease:i,duration:r,restDuration:n}=_;P=w===A?0:v?r:r-n*L.timeScale,v&&(R=i),P>Y&&(Y=P)}if(!v&&F&&$&&(O||P)){const t=i.blend;new Me(b,{x:{to:B,duration:.65*O},y:{to:D,duration:.65*P},ease:y,composition:t}).init(),new Me(b,{x:{to:N,duration:O},y:{to:A,duration:P},ease:y,composition:t}).init(),this.overshootXTicker.stretch(O).restart(),this.overshootYTicker.stretch(P).restart()}else t||this.animate[this.xProp](N,O,M),e||this.animate[this.yProp](A,P,R);this.scrollInView(Y,this.scrollThreshold,y);let X=!1;N!==m&&(this.snapped[0]=N,this.snapX&&(X=!0)),A!==f&&this.snapY&&(this.snapped[1]=A,this.snapY&&(X=!0)),X&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",ys),this.$trigger.removeEventListener("touchmove",ys),this.$trigger.removeEventListener("touchend",ys),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=ss(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":ys(t)}}}const Ss=(t,e)=>new xs(t,e);class ks{constructor(t={}){B.current&&B.current.register(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||At(i)[0]||s);const n=t.defaults,o=L.defaults,h=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={},h)for(let t in h){const s=e.matchMedia(h[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);Y(e)&&this.revertConstructors.push(e)}))})),this}add(t,e){if(this.once=!1,Y(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);Y(t)&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}addOnce(t){if(this.once=!0,Y(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute((()=>{const t=s(this);Y(t)&&this.revertConstructorsOnce.push(t)}))}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(Y(s))return s(this);const i=Tt(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,h=s.length,a=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;h--;)s[h].revert();for(;a--;)i[a](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 $s=t=>new ks(t),Es=(t,e)=>t&&Y(t)?t(e):t,Cs=new Map;class Bs{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.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 ne({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;yt(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ne({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,h=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),h&&(this.backwardY=i>n),this.velocity=lt(e>0?Math.sqrt(o*o+h*h)/e:0,5)}}).init(),this.resizeTicker=new ne({autoplay:!1,duration:250*L.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ne({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=lt(t?e.scrollX:s.scrollLeft,0),this.scrollY=lt(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=(()=>{const t=document.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){yt(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),yt(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.unobserve(this.element),(this.useWin?e:this.element).removeEventListener("scroll",this),Cs.delete(this.element)}}const Ls=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,h="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:a,u:l}=qt(h,jt);let c=a;return"%"===l?c=a/100*s:l&&(c=$e(t,jt,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},Ds=(t,e,s,i,r)=>{let n;if(R(e)){const o=E.exec(e);if(o){const h=o[0],a=h[0],l=e.split(h),c="min"===l[0],d="max"===l[0],u=Ls(t,l[0],s,i,r),p=Ls(t,l[1],s,i,r);if(c){const e=Ut(Ls(t,"min",s),p,a);n=e<u?u:e}else if(d){const e=Ut(Ls(t,"max",s),p,a);n=e>u?u:e}else n=Ut(u,p,a)}else n=Ls(t,e,s,i,r)}else n=e;return lt(n,0)},Ns=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[n]){e=i;break}}return e};let As=0;const Fs=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Os{constructor(t={}){B.current&&B.current.register(this);const e=zt(t.sync,"play pause"),i=e?Te(e):null,r=e&&("linear"===e||e===he),n=e&&!(i===he&&!r),o=e&&(M(e)||!0===e||r),h=e&&R(e)&&!n&&!o,a=h?e.split(" ").map((t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null})):null,l=h&&a.length>2;this.index=As++,this.id=X(t.id)?this.index:t.id,this.container=(t=>{const e=t&&At(t)[0]||s.body;let i=Cs.get(e);return i||(i=new Bs(e),Cs.set(e,i)),i})(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!a,this.syncEase=n?i:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=a&&!l&&a[0]?a[0]:_,this.onSyncLeave=a&&!l&&a[1]?a[1]:_,this.onSyncEnterForward=a&&l&&a[0]?a[0]:_,this.onSyncLeaveForward=a&&l&&a[1]?a[1]:_,this.onSyncEnterBackward=a&&l&&a[2]?a[2]:_,this.onSyncLeaveBackward=a&&l&&a[3]?a[3]:_,this.onEnter=t.onEnter||_,this.onLeave=t.onLeave||_,this.onEnterForward=t.onEnterForward||_,this.onLeaveForward=t.onLeaveForward||_,this.onEnterBackward=t.onEnterBackward||_,this.onLeaveBackward=t.onLeaveBackward||_,this.onUpdate=t.onUpdate||_,this.onSyncComplete=t.onSyncComplete||_,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=zt(t.debug,!1),this._next=null,this._prev=null,bt(this.container,this),ts((()=>{if(!this.reverted){if(!this.target){const e=At(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;X(t.targets)?yt(t,(t=>{t.targets&&!e&&(e=Ns(t))})):e=Ns(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:lt(ht(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=zt(Es(t.repeat,this),!0),this.horizontal="x"===zt(Es(t.axis,this),"y"),this.enter=zt(Es(t.enter,this),"end start"),this.leave=zt(Es(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"),h=Fs[this.index%Fs.length],a=t.useWin,l=a?t.winWidth:t.width,c=a?t.winHeight:t.height,d=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,_=e?g:15,y=e?60:g,v=e?y:_,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",w=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?d: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:c)}`,i||(n.style.cssText+=`background:\n ${w("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${w("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${x("relative",0,0,e?d:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${w("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${w("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const S=[" enter: "," leave: "];this.coords.forEach(((t,i)=>{const r=i>1,a=(r?0:this.offset)+t,m=i%2,f=a<v,g=a>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,T=s.createElement("div"),w=s.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?y:_)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;w.innerHTML=`${this.id}${S[m]}${this.thresholds[i]}`,T.style.cssText=`${x("absolute",0,0,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-${k}: 2px solid ${h};\n `,w.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${_};\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?h:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":h};\n border: 2px solid ${m?h:"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(w);let E=a-$+(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),i||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===es(t.element,"position")&&(this.debugStyles=ss(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,h=e,a=0,l=0,c=h;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===es(i.element,"position")&&ss(i.element,{position:"relative "});for(;h&&h!==i.element&&h!==s.body;){const e="sticky"===es(h,"position")&&ss(h,{position:"static"});h===c&&(a+=h.offsetLeft||0,l+=h.offsetTop||0,c=h.offsetParent),h=h.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?a:l,p=r?e.offsetWidth:e.offsetHeight,m=r?i.width:i.height,f=(r?i.scrollWidth:i.scrollHeight)-m,g=this.enter,_=this.leave;let y="start",v="end",b="end",T="start";if(R(g)){const t=g.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(P(g)){const t=g;X(t.container)||(b=t.container),X(t.target)||(y=t.target)}else M(g)&&(b=g);if(R(_)){const t=_.split(" ");T=t[0],v=t.length>1?t[1]:v}else if(P(_)){const t=_;X(t.container)||(T=t.container),X(t.target)||(v=t.target)}else M(_)&&(T=_);const w=Ds(e,y,p),x=Ds(e,v,p),S=w+u-m,k=x+u-f,$=Ds(e,b,m,S,k),E=Ds(e,T,m,S,k),C=w+u-$,B=x+u-E,L=B-C;this.offsets[0]=a,this.offsets[1]=l,this.offset=u,this.offsetStart=C,this.offsetEnd=B,this.distance=L<=0?0:L,this.thresholds=[y,v,b,T],this.coords=[w,x,$,E],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,h=this.scroll,a=h<=this.offsetStart,l=h>=this.offsetEnd,c=!a&&!l,d=h===this.offsetStart||h===this.offsetEnd,u=!this.hasEntered&&d,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(a&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&M(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=lt(os(e,g,dt(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 vt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}const Ps=(t={})=>new Os(t),Ms=!X(Intl)&&Intl.Segmenter,Rs=/\{value\}/g,Ys=/\{i\}/g,Xs=/(\s+)/,zs=/^\s+$/,Is="line",Ws="word",Vs="char",Hs="data-line";let Us=null,qs=null,Qs=null;const js=t=>t.isWordLike||" "===t.segment||M(+t.segment),Gs=t=>t.setAttribute("aria-hidden","true"),Zs=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Js={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},Ks=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&Ks(e)}},ti=(t,e,s)=>{const i=t.getAttribute(Hs);(null!==i&&+i!==e||"BR"===t.tagName)&&s.add(t);let r=t.childElementCount;for(;r--;)ti(t.children[r],e,s);return s},ei=(t,e={})=>{let s="";const i=R(e.class)?` class="${e.class}"`:"",r=zt(e.clone,!1),n=zt(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},si=(t,e,s,i,r,n,o,h,a)=>{const l=r===Is,c=r===Vs,d=`_${r}_`,u=Y(t)?t(s):t,p=l?"block":"inline-block";Qs.innerHTML=u.replace(Rs,`<i class="${d}"></i>`).replace(Ys,`${c?a:l?o:h}`);const m=Qs.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,_=m.querySelectorAll(`i.${d}`),y=_.length;if(y){f.style.display=p,g.style.display=p,g.setAttribute(Hs,`${o}`),l||(g.setAttribute("data-word",`${h}`),c&&g.setAttribute("data-char",`${a}`));let t=y;for(;t--;){const e=_[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 ${Js[r]}`),f};class ii{constructor(e,i={}){Us||(Us=Ms?new Ms([],{granularity:Ws}):{segment:t=>{const e=[],s=t.split(Xs);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!zs.test(i)})}return e}}),qs||(qs=Ms?new Ms([],{granularity:"grapheme"}):{segment:t=>[...t].map((t=>({segment:t})))}),!Qs&&t&&(Qs=s.createElement("template")),B.current&&B.current.register(this);const{words:r,chars:n,lines:o,accessible:h,includeSpaces:a,debug:l}=i,c=(e=O(e)?e[0]:e)&&e.nodeType?e:(Nt(e)||[])[0],d=!0===o?{}:o,u=!0===r||X(r)?{}:r,p=!0===n?{}:n;this.debug=zt(l,!1),this.includeSpaces=zt(a,!1),this.accessible=zt(h,!0),this.linesOnly=d&&!u&&!p,this.lineTemplate=P(d)?ei(Is,d):d,this.wordTemplate=P(u)||this.linesOnly?ei(Ws,u):u,this.charTemplate=P(p)?ei(Vs,p):p,this.$target=c,this.html=c&&c.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&&(d||u||p)&&this.split();this.resizeObserver=new ResizeObserver((()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((()=>{const t=c.offsetWidth;t!==this.width&&(this.width=t,m())}),150)})),this.lineTemplate&&!this.ready?s.fonts.ready.then(m):m(),c?this.resizeObserver.observe(c):console.warn("No Text Splitter target found.")}addEffect(t){if(!Y(t))return console.warn("Effect must return a function.");const e=Tt(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=>Y(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 h=[],a=this.words,l=this.chars,c=Us.segment(o),d=s.createDocumentFragment();let u=null;for(const t of c){const e=t.segment,s=js(t);if(!u||s&&u&&js(u))h.push(e);else{const t=h.length-1;h[t].includes(" ")||e.includes(" ")?h.push(e):h[t]+=e}u=t}for(let t=0,o=h.length;t<o;t++){const o=h[t];if(o.trim()){const c=h[t+1],u=r&&c&&!c.trim(),p=o,m=i?qs.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],h=e===r-1&&u?o.segment+" ":o.segment,c=s.createTextNode(h);si(i,l,c,f,Vs,n,-1,a.length,l.length)}}e?si(e,a,f,d,Ws,n,-1,a.length,l.length):i?d.appendChild(f):d.appendChild(s.createTextNode(o)),u&&t++}else{if(t&&r)continue;d.appendChild(s.createTextNode(o))}}t.parentNode.replaceChild(d,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,h="loading"!==s.fonts.status,a=r&&h;this.ready=!r||h,i||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),a&&(this.effectsCleanups.forEach((t=>Y(t)&&t(this))),i&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Zs(e,Ws))),o&&(a||n)&&(this.chars=Zs(e,Vs));const l=this.words.length?this.words:this.chars;let c,d=0;for(let t=0,e=l.length;t<e;t++){const e=l[t],{top:s,height:i}=e.getBoundingClientRect();c&&s-c>.5*i&&d++,e.setAttribute(Hs,`${d}`);const r=e.querySelectorAll(`[${Hs}]`);let n=r.length;for(;n--;)r[n].setAttribute(Hs,`${d}`);c=s}if(a){const t=s.createDocumentFragment(),i=new Set,h=[];for(let t=0;t<d+1;t++){const s=e.cloneNode(!0);ti(s,t,new Set).forEach((t=>{const e=t.parentElement;e&&i.add(e),t.remove()})),h.push(s)}i.forEach(Ks);for(let e=0,s=h.length;e<s;e++)si(r,this.lines,h[e],t,Is,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Zs(e,Ws)),o&&(this.chars=Zs(e,Vs))}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((a||t)&&this.effects.forEach(((t,e)=>this.effectsCleanups[e]=t(this))),this.accessible&&(a||!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(Gs),this.words.forEach(Gs),this.chars.forEach(Gs)}return this.width=e.offsetWidth,this}refresh(){this.split(!0)}}const ri={split:(t,e)=>new ii(t,e)},ni=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,h=!X(o),a=h&&!X(o.ease)?o.ease:h?Te(o):null,l=e.grid,c=e.axis,d=e.total,u=X(r)||0===r||"first"===r,m="center"===r,f="last"===r,g="random"===r,_=O(t),y=e.use,v=q(_?t[0]:t),b=_?q(t[1]):0,T=S.exec((_?t[1]:t)+p),w=e.start||0+(_?v:0);let x=u?0:M(r)?r:0;return(t,r,o,h)=>{const[u]=Ft(t),p=X(d)?o:d,S=!X(y)&&(Y(y)?y(u,r,p):Ht(u,y)),k=M(S)||R(S)&&M(+S)?+S:r;if(m&&(x=(p-1)/2),f&&(x=p-1),!s.length){for(let t=0;t<p;t++){if(l){const e=m?(l[0]-1)/2:x%l[0],i=m?(l[1]-1)/2:et(x/l[0]),r=e-t%l[0],n=i-et(t/l[0]);let o=j(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(J(x-t));i=it(...s)}a&&(s=s.map((t=>a(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:J(i-t)))),g&&(s=pt(s))}const $=_?(b-v)/i:v;let E=(h?cs(h,X(e.start)?h.iterationDuration:w):w)+($*lt(s[k],2)||0);return e.modifier&&(E=e.modifier(E)),T&&(E=`${E}${T[2]}`),E}};export{ms as Animatable,xs as Draggable,Me as JSAnimation,ks as Scope,Os as ScrollObserver,gs as Spring,ii as TextSplitter,us as Timeline,ne as Timer,Je as WAAPIAnimation,Re as animate,fs as createAnimatable,Ss as createDraggable,$s as createScope,_s as createSpring,ps as createTimeline,oe as createTimer,ve as eases,Bt as engine,Ps as onScroll,Cs as scrollContainers,ni as stagger,Yt as svg,ri as text,ls as utils,Ke as waapi};
diff --git a/lib/anime.iife.js b/lib/anime.iife.js
index a9efc6db..376a2dc2 100644
--- a/lib/anime.iife.js
+++ b/lib/anime.iife.js
@@ -1,9 +1,9 @@
/**
* anime.js - IIFE
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
-var anime=function(exports){"use strict";const isBrowser=typeof window!=="undefined";const win=isBrowser?window:null;const doc=isBrowser?document:null;const tweenTypes={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4};const valueTypes={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3};const tickModes={NONE:0,AUTO:1,FORCE:2};const compositionTypes={replace:0,none:1,blend:2};const isRegisteredTargetSymbol=Symbol();const isDomSymbol=Symbol();const isSvgSymbol=Symbol();const transformsSymbol=Symbol();const morphPointsSymbol=Symbol();const proxyTargetSymbol=Symbol();const minValue=1e-11;const maxValue=1e12;const K=1e3;const maxFps=120;const emptyString="";const shortTransforms=new Map;shortTransforms.set("x","translateX");shortTransforms.set("y","translateY");shortTransforms.set("z","translateZ");const validTransforms=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"];const transformsFragmentStrings=validTransforms.reduce(((a,v)=>({...a,[v]:v+"("})),{});const noop=()=>{};const hexTestRgx=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;const rgbExecRgx=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;const rgbaExecRgx=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const hslExecRgx=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;const hslaExecRgx=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const digitWithExponentRgx=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;const unitsExecRgx=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx=/([a-z])([A-Z])/g;const transformsExecRgx=/(\w+)(\([^)]+\)+)/g;const relativeValuesExecRgx=/(\*=|\+=|-=)/;const defaults={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:maxFps,loop:0,reversed:false,alternate:false,autoplay:true,duration:K,delay:0,loopDelay:0,ease:"out(2)",composition:compositionTypes.replace,modifier:v=>v,onBegin:noop,onBeforeUpdate:noop,onUpdate:noop,onLoop:noop,onPause:noop,onComplete:noop,onRender:noop};const globals={defaults:defaults,root:doc,scope:null,precision:4,timeScale:1,tickThreshold:200};const globalVersions={version:"4.0.2",engine:null};if(isBrowser){if(!win.AnimeJS)win.AnimeJS=[];win.AnimeJS.push(globalVersions)}const toLowerCase=str=>str.replace(lowerCaseRgx,"$1-$2").toLowerCase();const stringStartsWith=(str,sub)=>str.indexOf(sub)===0;const now=Date.now;const isArr=Array.isArray;const isObj=a=>a&&a.constructor===Object;const isNum=a=>typeof a==="number"&&!isNaN(a);const isStr=a=>typeof a==="string";const isFnc=a=>typeof a==="function";const isUnd=a=>typeof a==="undefined";const isNil=a=>isUnd(a)||a===null;const isSvg=a=>isBrowser&&a instanceof SVGElement;const isHex=a=>hexTestRgx.test(a);const isRgb=a=>stringStartsWith(a,"rgb");const isHsl=a=>stringStartsWith(a,"hsl");const isCol=a=>isHex(a)||isRgb(a)||isHsl(a);const isKey=a=>!globals.defaults.hasOwnProperty(a);const parseNumber=str=>isStr(str)?parseFloat(str):str;const pow=Math.pow;const sqrt=Math.sqrt;const sin=Math.sin;const cos=Math.cos;const abs=Math.abs;const exp=Math.exp;const ceil=Math.ceil;const floor=Math.floor;const asin=Math.asin;const max=Math.max;const atan2=Math.atan2;const PI=Math.PI;const _round=Math.round;const clamp=(v,min,max)=>v<min?min:v>max?max:v;const powCache={};const round=(v,decimalLength)=>{if(decimalLength<0)return v;if(!decimalLength)return _round(v);let p=powCache[decimalLength];if(!p)p=powCache[decimalLength]=10**decimalLength;return _round(v*p)/p};const snap=(v,increment)=>isArr(increment)?increment.reduce(((closest,cv)=>abs(cv-v)<abs(closest-v)?cv:closest)):increment?_round(v/increment)*increment:v;const interpolate=(start,end,progress)=>start+(end-start)*progress;const clampInfinity=v=>v===Infinity?maxValue:v===-Infinity?-1e12:v;const normalizeTime=v=>v<=minValue?minValue:clampInfinity(round(v,11));const cloneArray=a=>isArr(a)?[...a]:a;const mergeObjects=(o1,o2)=>{const merged={...o1};for(let p in o2){const o1p=o1[p];merged[p]=isUnd(o1p)?o2[p]:o1p}return merged};const forEachChildren=(parent,callback,reverse,prevProp="_prev",nextProp="_next")=>{let next=parent._head;let adjustedNextProp=nextProp;if(reverse){next=parent._tail;adjustedNextProp=prevProp}while(next){const currentNext=next[adjustedNextProp];callback(next);next=currentNext}};const removeChild=(parent,child,prevProp="_prev",nextProp="_next")=>{const prev=child[prevProp];const next=child[nextProp];prev?prev[nextProp]=next:parent._head=next;next?next[prevProp]=prev:parent._tail=prev;child[prevProp]=null;child[nextProp]=null};const addChild=(parent,child,sortMethod,prevProp="_prev",nextProp="_next")=>{let prev=parent._tail;while(prev&&sortMethod&&sortMethod(prev,child))prev=prev[prevProp];const next=prev?prev[nextProp]:parent._head;prev?prev[nextProp]=child:parent._head=child;next?next[prevProp]=child:parent._tail=child;child[prevProp]=prev;child[nextProp]=next};class Clock{constructor(initTime=0){this.deltaTime=0;this._currentTime=initTime;this._elapsedTime=initTime;this._startTime=initTime;this._lastTime=initTime;this._scheduledTime=0;this._frameDuration=round(K/maxFps,0);this._fps=maxFps;this._speed=1;this._hasChildren=false;this._head=null;this._tail=null}get fps(){return this._fps}set fps(frameRate){const previousFrameDuration=this._frameDuration;const fr=+frameRate;const fps=fr<minValue?minValue:fr;const frameDuration=round(K/fps,0);this._fps=fps;this._frameDuration=frameDuration;this._scheduledTime+=frameDuration-previousFrameDuration}get speed(){return this._speed}set speed(playbackRate){const pbr=+playbackRate;this._speed=pbr<minValue?minValue:pbr}requestTick(time){const scheduledTime=this._scheduledTime;const elapsedTime=this._elapsedTime;this._elapsedTime+=time-elapsedTime;if(elapsedTime<scheduledTime)return tickModes.NONE;const frameDuration=this._frameDuration;const frameDelta=elapsedTime-scheduledTime;this._scheduledTime+=frameDelta<frameDuration?frameDuration:frameDelta;return tickModes.AUTO}computeDeltaTime(time){const delta=time-this._lastTime;this.deltaTime=delta;this._lastTime=time;return delta}}const render=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const parent=tickable.parent;const duration=tickable.duration;const completed=tickable.completed;const iterationDuration=tickable.iterationDuration;const iterationCount=tickable.iterationCount;const _currentIteration=tickable._currentIteration;const _loopDelay=tickable._loopDelay;const _reversed=tickable._reversed;const _alternate=tickable._alternate;const _hasChildren=tickable._hasChildren;const tickableDelay=tickable._delay;const tickablePrevAbsoluteTime=tickable._currentTime;const tickableEndTime=tickableDelay+iterationDuration;const tickableAbsoluteTime=time-tickableDelay;const tickablePrevTime=clamp(tickablePrevAbsoluteTime,-tickableDelay,duration);const tickableCurrentTime=clamp(tickableAbsoluteTime,-tickableDelay,duration);const deltaTime=tickableAbsoluteTime-tickablePrevAbsoluteTime;const isCurrentTimeAboveZero=tickableCurrentTime>0;const isCurrentTimeEqualOrAboveDuration=tickableCurrentTime>=duration;const isSetter=duration<=minValue;const forcedTick=tickMode===tickModes.FORCE;let isOdd=0;let iterationElapsedTime=tickableAbsoluteTime;let hasRendered=0;if(iterationCount>1){const currentIteration=~~(tickableCurrentTime/(iterationDuration+(isCurrentTimeEqualOrAboveDuration?0:_loopDelay)));tickable._currentIteration=clamp(currentIteration,0,iterationCount);if(isCurrentTimeEqualOrAboveDuration)tickable._currentIteration--;isOdd=tickable._currentIteration%2;iterationElapsedTime=tickableCurrentTime%(iterationDuration+_loopDelay)||0}const isReversed=_reversed^(_alternate&&isOdd);const _ease=tickable._ease;let iterationTime=isCurrentTimeEqualOrAboveDuration?isReversed?0:duration:isReversed?iterationDuration-iterationElapsedTime:iterationElapsedTime;if(_ease)iterationTime=iterationDuration*_ease(iterationTime/iterationDuration)||0;const isRunningBackwards=(parent?parent.backwards:tickableAbsoluteTime<tickablePrevAbsoluteTime)?!isReversed:!!isReversed;tickable._currentTime=tickableAbsoluteTime;tickable._iterationTime=iterationTime;tickable.backwards=isRunningBackwards;if(isCurrentTimeAboveZero&&!tickable.began){tickable.began=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onBegin(tickable)}}else if(tickableAbsoluteTime<=0){tickable.began=false}if(!muteCallbacks&&!_hasChildren&&isCurrentTimeAboveZero&&tickable._currentIteration!==_currentIteration){tickable.onLoop(tickable)}if(forcedTick||tickMode===tickModes.AUTO&&(time>=tickableDelay&&time<=tickableEndTime||time<=tickableDelay&&tickablePrevTime>tickableDelay||time>=tickableEndTime&&tickablePrevTime!==duration)||iterationTime>=tickableEndTime&&tickablePrevTime!==duration||iterationTime<=tickableDelay&&tickablePrevTime>0||time<=tickablePrevTime&&tickablePrevTime===duration&&completed||isCurrentTimeEqualOrAboveDuration&&!completed&&isSetter){if(isCurrentTimeAboveZero){tickable.computeDeltaTime(tickablePrevTime);if(!muteCallbacks)tickable.onBeforeUpdate(tickable)}if(!_hasChildren){const forcedRender=forcedTick||(isRunningBackwards?deltaTime*-1:deltaTime)>=globals.tickThreshold;const absoluteTime=tickable._offset+(parent?parent._offset:0)+tickableDelay+iterationTime;let tween=tickable._head;let tweenTarget;let tweenStyle;let tweenTargetTransforms;let tweenTargetTransformsProperties;let tweenTransformsNeedUpdate=0;while(tween){const tweenComposition=tween._composition;const tweenCurrentTime=tween._currentTime;const tweenChangeDuration=tween._changeDuration;const tweenAbsEndTime=tween._absoluteStartTime+tween._changeDuration;const tweenNextRep=tween._nextRep;const tweenPrevRep=tween._prevRep;const tweenHasComposition=tweenComposition!==compositionTypes.none;if((forcedRender||(tweenCurrentTime!==tweenChangeDuration||absoluteTime<=tweenAbsEndTime+(tweenNextRep?tweenNextRep._delay:0))&&(tweenCurrentTime!==0||absoluteTime>=tween._absoluteStartTime))&&(!tweenHasComposition||!tween._isOverridden&&(!tween._isOverlapped||absoluteTime<=tweenAbsEndTime)&&(!tweenNextRep||(tweenNextRep._isOverridden||absoluteTime<=tweenNextRep._absoluteStartTime))&&(!tweenPrevRep||(tweenPrevRep._isOverridden||absoluteTime>=tweenPrevRep._absoluteStartTime+tweenPrevRep._changeDuration+tween._delay)))){const tweenNewTime=tween._currentTime=clamp(iterationTime-tween._startTime,0,tweenChangeDuration);const tweenProgress=tween._ease(tweenNewTime/tween._updateDuration);const tweenModifier=tween._modifier;const tweenValueType=tween._valueType;const tweenType=tween._tweenType;const tweenIsObject=tweenType===tweenTypes.OBJECT;const tweenIsNumber=tweenValueType===valueTypes.NUMBER;const tweenPrecision=tweenIsNumber&&tweenIsObject||tweenProgress===0||tweenProgress===1?-1:globals.precision;let value;let number;if(tweenIsNumber){value=number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision))}else if(tweenValueType===valueTypes.UNIT){number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision));value=`${number}${tween._unit}`}else if(tweenValueType===valueTypes.COLOR){const fn=tween._fromNumbers;const tn=tween._toNumbers;const r=round(clamp(tweenModifier(interpolate(fn[0],tn[0],tweenProgress)),0,255),0);const g=round(clamp(tweenModifier(interpolate(fn[1],tn[1],tweenProgress)),0,255),0);const b=round(clamp(tweenModifier(interpolate(fn[2],tn[2],tweenProgress)),0,255),0);const a=clamp(tweenModifier(round(interpolate(fn[3],tn[3],tweenProgress),tweenPrecision)),0,1);value=`rgba(${r},${g},${b},${a})`;if(tweenHasComposition){const ns=tween._numbers;ns[0]=r;ns[1]=g;ns[2]=b;ns[3]=a}}else if(tweenValueType===valueTypes.COMPLEX){value=tween._strings[0];for(let j=0,l=tween._toNumbers.length;j<l;j++){const n=tweenModifier(round(interpolate(tween._fromNumbers[j],tween._toNumbers[j],tweenProgress),tweenPrecision));const s=tween._strings[j+1];value+=`${s?n+s:n}`;if(tweenHasComposition){tween._numbers[j]=n}}}if(tweenHasComposition){tween._number=number}if(!internalRender&&tweenComposition!==compositionTypes.blend){const tweenProperty=tween.property;tweenTarget=tween.target;if(tweenIsObject){tweenTarget[tweenProperty]=value}else if(tweenType===tweenTypes.ATTRIBUTE){tweenTarget.setAttribute(tweenProperty,value)}else{tweenStyle=tweenTarget.style;if(tweenType===tweenTypes.TRANSFORM){if(tweenTarget!==tweenTargetTransforms){tweenTargetTransforms=tweenTarget;tweenTargetTransformsProperties=tweenTarget[transformsSymbol]}tweenTargetTransformsProperties[tweenProperty]=value;tweenTransformsNeedUpdate=1}else if(tweenType===tweenTypes.CSS){tweenStyle[tweenProperty]=value}else if(tweenType===tweenTypes.CSS_VAR){tweenStyle.setProperty(tweenProperty,value)}}if(isCurrentTimeAboveZero)hasRendered=1}else{tween._value=value}}if(tweenTransformsNeedUpdate&&tween._renderTransforms){let str=emptyString;for(let key in tweenTargetTransformsProperties){str+=`${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `}tweenStyle.transform=str;tweenTransformsNeedUpdate=0}tween=tween._next}if(!muteCallbacks&&hasRendered){tickable.onRender(tickable)}}if(!muteCallbacks&&isCurrentTimeAboveZero){tickable.onUpdate(tickable)}}if(parent&&isSetter){if(!muteCallbacks&&(parent.began&&!isRunningBackwards&&tickableAbsoluteTime>=duration&&!completed||isRunningBackwards&&tickableAbsoluteTime<=minValue&&completed)){tickable.onComplete(tickable);tickable.completed=!isRunningBackwards}}else if(isCurrentTimeAboveZero&&isCurrentTimeEqualOrAboveDuration){if(iterationCount===Infinity){tickable._startTime+=tickable.duration}else if(tickable._currentIteration>=iterationCount-1){tickable.paused=true;if(!completed&&!_hasChildren){tickable.completed=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onComplete(tickable);tickable._resolve(tickable)}}}}else{tickable.completed=false}return hasRendered};const tick=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const _currentIteration=tickable._currentIteration;render(tickable,time,muteCallbacks,internalRender,tickMode);if(tickable._hasChildren){const tl=tickable;const tlIsRunningBackwards=tl.backwards;const tlChildrenTime=internalRender?time:tl._iterationTime;const tlCildrenTickTime=now();let tlChildrenHasRendered=0;let tlChildrenHaveCompleted=true;if(!internalRender&&tl._currentIteration!==_currentIteration){const tlIterationDuration=tl.iterationDuration;forEachChildren(tl,(child=>{if(!tlIsRunningBackwards){if(!child.completed&&!child.backwards&&child._currentTime<child.iterationDuration){render(child,tlIterationDuration,muteCallbacks,1,tickModes.FORCE)}child.began=false;child.completed=false}else{const childDuration=child.duration;const childStartTime=child._offset+child._delay;const childEndTime=childStartTime+childDuration;if(!muteCallbacks&&childDuration<=minValue&&(!childStartTime||childEndTime===tlIterationDuration)){child.onComplete(child)}}}));if(!muteCallbacks)tl.onLoop(tl)}forEachChildren(tl,(child=>{const childTime=round((tlChildrenTime-child._offset)*child._speed,12);const childTickMode=child._fps<tl._fps?child.requestTick(tlCildrenTickTime):tickMode;tlChildrenHasRendered+=render(child,childTime,muteCallbacks,internalRender,childTickMode);if(!child.completed&&tlChildrenHaveCompleted)tlChildrenHaveCompleted=false}),tlIsRunningBackwards);if(!muteCallbacks&&tlChildrenHasRendered)tl.onRender(tl);if(tlChildrenHaveCompleted&&tl._currentTime>=tl.duration){tl.paused=true;if(!tl.completed){tl.completed=true;if(!muteCallbacks){tl.onComplete(tl);tl._resolve(tl)}}}}};const additive={animation:null,update:noop};const addAdditiveAnimation=lookups=>{let animation=additive.animation;if(!animation){animation={duration:minValue,computeDeltaTime:noop,_offset:0,_delay:0,_head:null,_tail:null};additive.animation=animation;additive.update=()=>{lookups.forEach((propertyAnimation=>{for(let propertyName in propertyAnimation){const tweens=propertyAnimation[propertyName];const lookupTween=tweens._head;if(lookupTween){const valueType=lookupTween._valueType;const additiveValues=valueType===valueTypes.COMPLEX||valueType===valueTypes.COLOR?cloneArray(lookupTween._fromNumbers):null;let additiveValue=lookupTween._fromNumber;let tween=tweens._tail;while(tween&&tween!==lookupTween){if(additiveValues){for(let i=0,l=tween._numbers.length;i<l;i++)additiveValues[i]+=tween._numbers[i]}else{additiveValue+=tween._number}tween=tween._prevAdd}lookupTween._toNumber=additiveValue;lookupTween._toNumbers=additiveValues}}}));render(animation,1,1,0,tickModes.FORCE)}}return animation};const engineTickMethod=isBrowser?requestAnimationFrame:setImmediate;const engineCancelMethod=isBrowser?cancelAnimationFrame:clearImmediate;class Engine extends Clock{constructor(initTime){super(initTime);this.useDefaultMainLoop=true;this.pauseOnDocumentHidden=true;this.defaults=defaults;this.paused=isBrowser&&doc.hidden?true:false;this.reqId=null}update(){const time=this._currentTime=now();if(this.requestTick(time)){this.computeDeltaTime(time);const engineSpeed=this._speed;const engineFps=this._fps;let activeTickable=this._head;while(activeTickable){const nextTickable=activeTickable._next;if(!activeTickable.paused){tick(activeTickable,(time-activeTickable._startTime)*activeTickable._speed*engineSpeed,0,0,activeTickable._fps<engineFps?activeTickable.requestTick(time):tickModes.AUTO)}else{removeChild(this,activeTickable);this._hasChildren=!!this._tail;activeTickable._running=false;if(activeTickable.completed&&!activeTickable._cancelled){activeTickable.cancel()}}activeTickable=nextTickable}additive.update()}}wake(){if(this.useDefaultMainLoop&&!this.reqId&&!this.paused){this.reqId=engineTickMethod(tickEngine)}return this}pause(){this.paused=true;return killEngine()}resume(){if(!this.paused)return;this.paused=false;forEachChildren(this,(child=>child.resetTime()));return this.wake()}get speed(){return this._speed*(globals.timeScale===1?1:K)}set speed(playbackRate){this._speed=playbackRate*globals.timeScale;forEachChildren(this,(child=>child.speed=child._speed))}get timeUnit(){return globals.timeScale===1?"ms":"s"}set timeUnit(unit){const secondsScale=.001;const isSecond=unit==="s";const newScale=isSecond?secondsScale:1;if(globals.timeScale!==newScale){globals.timeScale=newScale;globals.tickThreshold=200*newScale;const scaleFactor=isSecond?secondsScale:K;this.defaults.duration*=scaleFactor;this._speed*=scaleFactor}}get precision(){return globals.precision}set precision(precision){globals.precision=precision}}const engine=(()=>{const engine=new Engine(now());if(isBrowser){globalVersions.engine=engine;doc.addEventListener("visibilitychange",(()=>{if(!engine.pauseOnDocumentHidden)return;doc.hidden?engine.pause():engine.resume()}))}return engine})();const tickEngine=()=>{if(engine._head){engine.reqId=engineTickMethod(tickEngine);engine.update()}else{engine.reqId=0}};const killEngine=()=>{engineCancelMethod(engine.reqId);engine.reqId=0;return engine};const parseInlineTransforms=(target,propName,animationInlineStyles)=>{const inlineTransforms=target.style.transform;let inlinedStylesPropertyValue;if(inlineTransforms){const cachedTransforms=target[transformsSymbol];let t;while(t=transformsExecRgx.exec(inlineTransforms)){const inlinePropertyName=t[1];const inlinePropertyValue=t[2].slice(1,-1);cachedTransforms[inlinePropertyName]=inlinePropertyValue;if(inlinePropertyName===propName){inlinedStylesPropertyValue=inlinePropertyValue;if(animationInlineStyles){animationInlineStyles[propName]=inlinePropertyValue}}}}return inlineTransforms&&!isUnd(inlinedStylesPropertyValue)?inlinedStylesPropertyValue:stringStartsWith(propName,"scale")?"1":stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew")?"0deg":"0px"};function getNodeList(v){const n=isStr(v)?globals.root.querySelectorAll(v):v;if(n instanceof NodeList||n instanceof HTMLCollection)return n}function parseTargets(targets){if(isNil(targets))return[];if(isArr(targets)){const flattened=targets.flat(Infinity);const parsed=[];for(let i=0,l=flattened.length;i<l;i++){const item=flattened[i];if(!isNil(item)){const nodeList=getNodeList(item);if(nodeList){for(let j=0,jl=nodeList.length;j<jl;j++){const subItem=nodeList[j];if(!isNil(subItem)){let isDuplicate=false;for(let k=0,kl=parsed.length;k<kl;k++){if(parsed[k]===subItem){isDuplicate=true;break}}if(!isDuplicate){parsed.push(subItem)}}}}else{let isDuplicate=false;for(let j=0,jl=parsed.length;j<jl;j++){if(parsed[j]===item){isDuplicate=true;break}}if(!isDuplicate){parsed.push(item)}}}}return parsed}if(!isBrowser)return[targets];const nodeList=getNodeList(targets);if(nodeList)return Array.from(nodeList);return[targets]}function registerTargets(targets){const parsedTargetsArray=parseTargets(targets);const parsedTargetsLength=parsedTargetsArray.length;if(parsedTargetsLength){for(let i=0;i<parsedTargetsLength;i++){const target=parsedTargetsArray[i];if(!target[isRegisteredTargetSymbol]){target[isRegisteredTargetSymbol]=true;const isSvgType=isSvg(target);const isDom=target.nodeType||isSvgType;if(isDom){target[isDomSymbol]=true;target[isSvgSymbol]=isSvgType;target[transformsSymbol]={}}}}}return parsedTargetsArray}const getPath=path=>{const parsedTargets=parseTargets(path);const $parsedSvg=parsedTargets[0];if(!$parsedSvg||!isSvg($parsedSvg))return;return $parsedSvg};const morphTo=(path2,precision=.33)=>$path1=>{const $path2=getPath(path2);if(!$path2)return;const isPath=$path1.tagName==="path";const separator=isPath?" ":",";const previousPoints=$path1[morphPointsSymbol];if(previousPoints)$path1.setAttribute(isPath?"d":"points",previousPoints);let v1="",v2="";if(!precision){v1=$path1.getAttribute(isPath?"d":"points");v2=$path2.getAttribute(isPath?"d":"points")}else{const length1=$path1.getTotalLength();const length2=$path2.getTotalLength();const maxPoints=Math.max(Math.ceil(length1*precision),Math.ceil(length2*precision));for(let i=0;i<maxPoints;i++){const t=i/(maxPoints-1);const pointOnPath1=$path1.getPointAtLength(length1*t);const pointOnPath2=$path2.getPointAtLength(length2*t);const prefix=isPath?i===0?"M":"L":"";v1+=prefix+round(pointOnPath1.x,3)+separator+pointOnPath1.y+" ";v2+=prefix+round(pointOnPath2.x,3)+separator+pointOnPath2.y+" "}}$path1[morphPointsSymbol]=v2;return[v1,v2]};const getScaleFactor=$el=>{let scaleFactor=1;if($el&&$el.getCTM){const ctm=$el.getCTM();if(ctm){const scaleX=sqrt(ctm.a*ctm.a+ctm.b*ctm.b);const scaleY=sqrt(ctm.c*ctm.c+ctm.d*ctm.d);scaleFactor=(scaleX+scaleY)/2}}return scaleFactor};const createDrawableProxy=($el,start,end)=>{const pathLength=K;const computedStyles=getComputedStyle($el);const strokeLineCap=computedStyles.strokeLinecap;const $scalled=computedStyles.vectorEffect==="non-scaling-stroke"?$el:null;let currentCap=strokeLineCap;const proxy=new Proxy($el,{get(target,property){const value=target[property];if(property===proxyTargetSymbol)return target;if(property==="setAttribute"){return(...args)=>{if(args[0]==="draw"){const value=args[1];const values=value.split(" ");const v1=+values[0];const v2=+values[1];const scaleFactor=getScaleFactor($scalled);const os=v1*-1e3*scaleFactor;const d1=v2*pathLength*scaleFactor+os;const d2=pathLength*scaleFactor+(v1===0&&v2===1||v1===1&&v2===0?0:10*scaleFactor)-d1;if(strokeLineCap!=="butt"){const newCap=v1===v2?"butt":strokeLineCap;if(currentCap!==newCap){target.style.strokeLinecap=`${newCap}`;currentCap=newCap}}target.setAttribute("stroke-dashoffset",`${os}`);target.setAttribute("stroke-dasharray",`${d1} ${d2}`)}return Reflect.apply(value,target,args)}}if(isFnc(value)){return(...args)=>Reflect.apply(value,target,args)}else{return value}}});if($el.getAttribute("pathLength")!==`${pathLength}`){$el.setAttribute("pathLength",`${pathLength}`);proxy.setAttribute("draw",`${start} ${end}`)}return proxy};const createDrawable=(selector,start=0,end=0)=>{const els=parseTargets(selector);return els.map(($el=>createDrawableProxy($el,start,end)))};const getPathPoint=($path,progress,lookup=0)=>$path.getPointAtLength(progress+lookup>=1?progress+lookup:0);const getPathProgess=($path,pathProperty)=>$el=>{const totalLength=+$path.getTotalLength();const inSvg=$el[isSvgSymbol];const ctm=$path.getCTM();return{from:0,to:totalLength,modifier:progress=>{if(pathProperty==="a"){const p0=getPathPoint($path,progress,-1);const p1=getPathPoint($path,progress,1);return atan2(p1.y-p0.y,p1.x-p0.x)*180/PI}else{const p=getPathPoint($path,progress,0);return pathProperty==="x"?inSvg||!ctm?p.x:p.x*ctm.a+p.y*ctm.c+ctm.e:inSvg||!ctm?p.y:p.x*ctm.b+p.y*ctm.d+ctm.f}}}};const createMotionPath=path=>{const $path=getPath(path);if(!$path)return;return{translateX:getPathProgess($path,"x"),translateY:getPathProgess($path,"y"),rotate:getPathProgess($path,"a")}};const cssReservedProperties=["opacity","rotate","overflow","color"];const isValidSVGAttribute=(el,propertyName)=>{if(cssReservedProperties.includes(propertyName))return false;if(el.getAttribute(propertyName)||propertyName in el){if(propertyName==="scale"){const elParentNode=el.parentNode;return elParentNode&&elParentNode.tagName==="filter"}return true}};const svg={morphTo:morphTo,createMotionPath:createMotionPath,createDrawable:createDrawable};const rgbToRgba=rgbValue=>{const rgba=rgbExecRgx.exec(rgbValue)||rgbaExecRgx.exec(rgbValue);const a=!isUnd(rgba[4])?+rgba[4]:1;return[+rgba[1],+rgba[2],+rgba[3],a]};const hexToRgba=hexValue=>{const hexLength=hexValue.length;const isShort=hexLength===4||hexLength===5;return[+("0x"+hexValue[1]+hexValue[isShort?1:2]),+("0x"+hexValue[isShort?2:3]+hexValue[isShort?2:4]),+("0x"+hexValue[isShort?3:5]+hexValue[isShort?3:6]),hexLength===5||hexLength===9?+(+("0x"+hexValue[isShort?4:7]+hexValue[isShort?4:8])/255).toFixed(3):1]};const hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;return t<1/6?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p};const hslToRgba=hslValue=>{const hsla=hslExecRgx.exec(hslValue)||hslaExecRgx.exec(hslValue);const h=+hsla[1]/360;const s=+hsla[2]/100;const l=+hsla[3]/100;const a=!isUnd(hsla[4])?+hsla[4]:1;let r,g,b;if(s===0){r=g=b=l}else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=round(hue2rgb(p,q,h+1/3)*255,0);g=round(hue2rgb(p,q,h)*255,0);b=round(hue2rgb(p,q,h-1/3)*255,0)}return[r,g,b,a]};const convertColorStringValuesToRgbaArray=colorString=>isRgb(colorString)?rgbToRgba(colorString):isHex(colorString)?hexToRgba(colorString):isHsl(colorString)?hslToRgba(colorString):[0,0,0,1];const setValue=(targetValue,defaultValue)=>isUnd(targetValue)?defaultValue:targetValue;const getFunctionValue=(value,target,index,total,store)=>{if(isFnc(value)){const func=()=>{const computed=value(target,index,total);return!isNaN(+computed)?+computed:computed||0};if(store){store.func=func}return func()}else{return value}};const getTweenType=(target,prop)=>!target[isDomSymbol]?tweenTypes.OBJECT:target[isSvgSymbol]&&isValidSVGAttribute(target,prop)?tweenTypes.ATTRIBUTE:validTransforms.includes(prop)||shortTransforms.get(prop)?tweenTypes.TRANSFORM:stringStartsWith(prop,"--")?tweenTypes.CSS_VAR:prop in target.style?tweenTypes.CSS:prop in target?tweenTypes.OBJECT:tweenTypes.ATTRIBUTE;const getCSSValue=(target,propName,animationInlineStyles)=>{const inlineStyles=target.style[propName];if(inlineStyles&&animationInlineStyles){animationInlineStyles[propName]=inlineStyles}const value=inlineStyles||getComputedStyle(target[proxyTargetSymbol]||target).getPropertyValue(propName);return value==="auto"?"0":value};const getOriginalAnimatableValue=(target,propName,tweenType,animationInlineStyles)=>{const type=!isUnd(tweenType)?tweenType:getTweenType(target,propName);return type===tweenTypes.OBJECT?target[propName]||0:type===tweenTypes.ATTRIBUTE?target.getAttribute(propName):type===tweenTypes.TRANSFORM?parseInlineTransforms(target,propName,animationInlineStyles):type===tweenTypes.CSS_VAR?getCSSValue(target,propName,animationInlineStyles).trimStart():getCSSValue(target,propName,animationInlineStyles)};const getRelativeValue=(x,y,operator)=>operator==="-"?x-y:operator==="+"?x+y:x*y;const createDecomposedValueTargetObject=()=>({t:valueTypes.NUMBER,n:0,u:null,o:null,d:null,s:null});const decomposeRawValue=(rawValue,targetObject)=>{targetObject.t=valueTypes.NUMBER;targetObject.n=0;targetObject.u=null;targetObject.o=null;targetObject.d=null;targetObject.s=null;if(!rawValue)return targetObject;const num=+rawValue;if(!isNaN(num)){targetObject.n=num;return targetObject}else{let str=rawValue;if(str[1]==="="){targetObject.o=str[0];str=str.slice(2)}const unitMatch=str.includes(" ")?false:unitsExecRgx.exec(str);if(unitMatch){targetObject.t=valueTypes.UNIT;targetObject.n=+unitMatch[1];targetObject.u=unitMatch[2];return targetObject}else if(targetObject.o){targetObject.n=+str;return targetObject}else if(isCol(str)){targetObject.t=valueTypes.COLOR;targetObject.d=convertColorStringValuesToRgbaArray(str);return targetObject}else{const matchedNumbers=str.match(digitWithExponentRgx);targetObject.t=valueTypes.COMPLEX;targetObject.d=matchedNumbers?matchedNumbers.map(Number):[];targetObject.s=str.split(digitWithExponentRgx)||[];return targetObject}}};const decomposeTweenValue=(tween,targetObject)=>{targetObject.t=tween._valueType;targetObject.n=tween._toNumber;targetObject.u=tween._unit;targetObject.o=null;targetObject.d=cloneArray(tween._toNumbers);targetObject.s=cloneArray(tween._strings);return targetObject};const decomposedOriginalValue=createDecomposedValueTargetObject();const lookups={_rep:new WeakMap,_add:new Map};const getTweenSiblings=(target,property,lookup="_rep")=>{const lookupMap=lookups[lookup];let targetLookup=lookupMap.get(target);if(!targetLookup){targetLookup={};lookupMap.set(target,targetLookup)}return targetLookup[property]?targetLookup[property]:targetLookup[property]={_head:null,_tail:null}};const addTweenSortMethod=(p,c)=>p._isOverridden||p._absoluteStartTime>c._absoluteStartTime;const overrideTween=tween=>{tween._isOverlapped=1;tween._isOverridden=1;tween._changeDuration=minValue;tween._currentTime=minValue};const composeTween=(tween,siblings)=>{const tweenCompositionType=tween._composition;if(tweenCompositionType===compositionTypes.replace){const tweenAbsStartTime=tween._absoluteStartTime;addChild(siblings,tween,addTweenSortMethod,"_prevRep","_nextRep");const prevSibling=tween._prevRep;if(prevSibling){const prevParent=prevSibling.parent;const prevAbsEndTime=prevSibling._absoluteStartTime+prevSibling._changeDuration;if(tween.parent.id!==prevParent.id&&prevParent.iterationCount>1&&prevAbsEndTime+(prevParent.duration-prevParent.iterationDuration)>tweenAbsStartTime){overrideTween(prevSibling);let prevPrevSibling=prevSibling._prevRep;while(prevPrevSibling&&prevPrevSibling.parent.id===prevParent.id){overrideTween(prevPrevSibling);prevPrevSibling=prevPrevSibling._prevRep}}const absoluteUpdateStartTime=tweenAbsStartTime-tween._delay;if(prevAbsEndTime>absoluteUpdateStartTime){const prevChangeStartTime=prevSibling._startTime;const prevTLOffset=prevAbsEndTime-(prevChangeStartTime+prevSibling._updateDuration);prevSibling._changeDuration=absoluteUpdateStartTime-prevTLOffset-prevChangeStartTime;prevSibling._currentTime=prevSibling._changeDuration;prevSibling._isOverlapped=1;if(prevSibling._changeDuration<minValue){overrideTween(prevSibling)}}let pausePrevParentAnimation=true;forEachChildren(prevParent,(t=>{if(!t._isOverlapped)pausePrevParentAnimation=false}));if(pausePrevParentAnimation){const prevParentTL=prevParent.parent;if(prevParentTL){let pausePrevParentTL=true;forEachChildren(prevParentTL,(a=>{if(a!==prevParent){forEachChildren(a,(t=>{if(!t._isOverlapped)pausePrevParentTL=false}))}}));if(pausePrevParentTL){prevParentTL.cancel()}}else{prevParent.cancel()}}}}else if(tweenCompositionType===compositionTypes.blend){const additiveTweenSiblings=getTweenSiblings(tween.target,tween.property,"_add");const additiveAnimation=addAdditiveAnimation(lookups._add);let lookupTween=additiveTweenSiblings._head;if(!lookupTween){lookupTween={...tween};lookupTween._composition=compositionTypes.replace;lookupTween._updateDuration=minValue;lookupTween._startTime=0;lookupTween._numbers=cloneArray(tween._fromNumbers);lookupTween._number=0;lookupTween._next=null;lookupTween._prev=null;addChild(additiveTweenSiblings,lookupTween);addChild(additiveAnimation,lookupTween)}const toNumber=tween._toNumber;tween._fromNumber=lookupTween._fromNumber-toNumber;tween._toNumber=0;tween._numbers=cloneArray(tween._fromNumbers);tween._number=0;lookupTween._fromNumber=toNumber;if(tween._toNumbers){const toNumbers=cloneArray(tween._toNumbers);if(toNumbers){toNumbers.forEach(((value,i)=>{tween._fromNumbers[i]=lookupTween._fromNumbers[i]-value;tween._toNumbers[i]=0}))}lookupTween._fromNumbers=toNumbers}addChild(additiveTweenSiblings,tween,null,"_prevAdd","_nextAdd")}return tween};const removeTweenSliblings=tween=>{const tweenComposition=tween._composition;if(tweenComposition!==compositionTypes.none){const tweenTarget=tween.target;const tweenProperty=tween.property;const replaceTweensLookup=lookups._rep;const replaceTargetProps=replaceTweensLookup.get(tweenTarget);const tweenReplaceSiblings=replaceTargetProps[tweenProperty];removeChild(tweenReplaceSiblings,tween,"_prevRep","_nextRep");if(tweenComposition===compositionTypes.blend){const addTweensLookup=lookups._add;const addTargetProps=addTweensLookup.get(tweenTarget);if(!addTargetProps)return;const additiveTweenSiblings=addTargetProps[tweenProperty];const additiveAnimation=additive.animation;removeChild(additiveTweenSiblings,tween,"_prevAdd","_nextAdd");const lookupTween=additiveTweenSiblings._head;if(lookupTween&&lookupTween===additiveTweenSiblings._tail){removeChild(additiveTweenSiblings,lookupTween,"_prevAdd","_nextAdd");removeChild(additiveAnimation,lookupTween);let shouldClean=true;for(let prop in addTargetProps){if(addTargetProps[prop]._head){shouldClean=false;break}}if(shouldClean){addTweensLookup.delete(tweenTarget)}}}}return tween};const resetTimerProperties=timer=>{timer.paused=true;timer.began=false;timer.completed=false;return timer};const reviveTimer=timer=>{if(!timer._cancelled)return timer;if(timer._hasChildren){forEachChildren(timer,reviveTimer)}else{forEachChildren(timer,(tween=>{if(tween._composition!==compositionTypes.none){composeTween(tween,getTweenSiblings(tween.target,tween.property))}}))}timer._cancelled=0;return timer};let timerId=0;class Timer extends Clock{constructor(parameters={},parent=null,parentPosition=0){super(0);const{id:id,delay:delay,duration:duration,reversed:reversed,alternate:alternate,loop:loop,loopDelay:loopDelay,autoplay:autoplay,frameRate:frameRate,playbackRate:playbackRate,onComplete:onComplete,onLoop:onLoop,onPause:onPause,onBegin:onBegin,onBeforeUpdate:onBeforeUpdate,onUpdate:onUpdate}=parameters;if(globals.scope)globals.scope.revertibles.push(this);const timerInitTime=parent?0:engine._elapsedTime;const timerDefaults=parent?parent.defaults:globals.defaults;const timerDelay=isFnc(delay)||isUnd(delay)?timerDefaults.delay:+delay;const timerDuration=isFnc(duration)||isUnd(duration)?Infinity:+duration;const timerLoop=setValue(loop,timerDefaults.loop);const timerLoopDelay=setValue(loopDelay,timerDefaults.loopDelay);const timerIterationCount=timerLoop===true||timerLoop===Infinity||timerLoop<0?Infinity:timerLoop+1;let offsetPosition=0;if(parent){offsetPosition=parentPosition}else{let startTime=now();if(engine.paused){engine.requestTick(startTime);startTime=engine._elapsedTime}offsetPosition=startTime-engine._startTime}this.id=!isUnd(id)?id:++timerId;this.parent=parent;this.duration=clampInfinity((timerDuration+timerLoopDelay)*timerIterationCount-timerLoopDelay)||minValue;this.backwards=false;this.paused=true;this.began=false;this.completed=false;this.onBegin=onBegin||timerDefaults.onBegin;this.onBeforeUpdate=onBeforeUpdate||timerDefaults.onBeforeUpdate;this.onUpdate=onUpdate||timerDefaults.onUpdate;this.onLoop=onLoop||timerDefaults.onLoop;this.onPause=onPause||timerDefaults.onPause;this.onComplete=onComplete||timerDefaults.onComplete;this.iterationDuration=timerDuration;this.iterationCount=timerIterationCount;this._autoplay=parent?false:setValue(autoplay,timerDefaults.autoplay);this._offset=offsetPosition;this._delay=timerDelay;this._loopDelay=timerLoopDelay;this._iterationTime=0;this._currentIteration=0;this._resolve=noop;this._running=false;this._reversed=+setValue(reversed,timerDefaults.reversed);this._reverse=this._reversed;this._cancelled=0;this._alternate=setValue(alternate,timerDefaults.alternate);this._prev=null;this._next=null;this._elapsedTime=timerInitTime;this._startTime=timerInitTime;this._lastTime=timerInitTime;this._fps=setValue(frameRate,timerDefaults.frameRate);this._speed=setValue(playbackRate,timerDefaults.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(cancelled){cancelled?this.cancel():this.reset(1).play()}get currentTime(){return clamp(round(this._currentTime,globals.precision),-this._delay,this.duration)}set currentTime(time){const paused=this.paused;this.pause().seek(+time);if(!paused)this.resume()}get iterationCurrentTime(){return round(this._iterationTime,globals.precision)}set iterationCurrentTime(time){this.currentTime=this.iterationDuration*this._currentIteration+time}get progress(){return clamp(round(this._currentTime/this.duration,5),0,1)}set progress(progress){this.currentTime=this.duration*progress}get iterationProgress(){return clamp(round(this._iterationTime/this.iterationDuration,5),0,1)}set iterationProgress(progress){const iterationDuration=this.iterationDuration;this.currentTime=iterationDuration*this._currentIteration+iterationDuration*progress}get currentIteration(){return this._currentIteration}set currentIteration(iterationCount){this.currentTime=this.iterationDuration*clamp(+iterationCount,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(reverse){reverse?this.reverse():this.play()}get speed(){return super.speed}set speed(playbackRate){super.speed=playbackRate;this.resetTime()}reset(internalRender=0){reviveTimer(this);if(this._reversed&&!this._reverse)this.reversed=false;this._iterationTime=this.iterationDuration;tick(this,0,1,internalRender,tickModes.FORCE);resetTimerProperties(this);if(this._hasChildren){forEachChildren(this,resetTimerProperties)}return this}init(internalRender=0){this.fps=this._fps;this.speed=this._speed;if(!internalRender&&this._hasChildren){tick(this,this.duration,1,internalRender,tickModes.FORCE)}this.reset(internalRender);const autoplay=this._autoplay;if(autoplay===true){this.resume()}else if(autoplay&&!isUnd(autoplay.linked)){autoplay.link(this)}return this}resetTime(){const timeScale=1/(this._speed*engine._speed);this._startTime=now()-(this._currentTime+this._delay)*timeScale;return this}pause(){if(this.paused)return this;this.paused=true;this.onPause(this);return this}resume(){if(!this.paused)return this;this.paused=false;if(this.duration<=minValue&&!this._hasChildren){tick(this,minValue,0,0,tickModes.FORCE)}else{if(!this._running){addChild(engine,this);engine._hasChildren=true;this._running=true}this.resetTime();this._startTime-=12;engine.wake()}return this}restart(){return this.reset(0).resume()}seek(time,muteCallbacks=0,internalRender=0){reviveTimer(this);this.completed=false;const isPaused=this.paused;this.paused=true;tick(this,time+this._delay,~~muteCallbacks,~~internalRender,tickModes.AUTO);return isPaused?this:this.resume()}alternate(){const reversed=this._reversed;const count=this.iterationCount;const duration=this.iterationDuration;const iterations=count===Infinity?floor(maxValue/duration):count;this._reversed=+(this._alternate&&!(iterations%2)?reversed:!reversed);if(count===Infinity){this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress}else{this.seek(duration*iterations-this._currentTime)}this.resetTime();return this}play(){if(this._reversed)this.alternate();return this.resume()}reverse(){if(!this._reversed)this.alternate();return this.resume()}cancel(){if(this._hasChildren){forEachChildren(this,(child=>child.cancel()),true)}else{forEachChildren(this,removeTweenSliblings)}this._cancelled=1;return this.pause()}stretch(newDuration){const currentDuration=this.duration;const normlizedDuration=normalizeTime(newDuration);if(currentDuration===normlizedDuration)return this;const timeScale=newDuration/currentDuration;const isSetter=newDuration<=minValue;this.duration=isSetter?minValue:normlizedDuration;this.iterationDuration=isSetter?minValue:normalizeTime(this.iterationDuration*timeScale);this._offset*=timeScale;this._delay*=timeScale;this._loopDelay*=timeScale;return this}revert(){tick(this,0,1,0,tickModes.AUTO);const ap=this._autoplay;if(ap&&ap.linked&&ap.linked===this)ap.revert();return this.cancel()}complete(){return this.seek(this.duration).cancel()}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const createTimer=parameters=>new Timer(parameters,null,0).init();const none=t=>t;const calcBezier=(aT,aA1,aA2)=>(((1-3*aA2+3*aA1)*aT+(3*aA2-6*aA1))*aT+3*aA1)*aT;const binarySubdivide=(aX,mX1,mX2)=>{let aA=0,aB=1,currentX,currentT,i=0;do{currentT=aA+(aB-aA)/2;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0){aB=currentT}else{aA=currentT}}while(abs(currentX)>1e-7&&++i<100);return currentT};const cubicBezier=(mX1=.5,mY1=0,mX2=.5,mY2=1)=>mX1===mY1&&mX2===mY2?none:t=>t===0||t===1?t:calcBezier(binarySubdivide(t,mX1,mX2),mY1,mY2);const steps=(steps=10,fromStart)=>{const roundMethod=fromStart?ceil:floor;return t=>roundMethod(clamp(t,0,1)*steps)*(1/steps)};const linear=(...args)=>{const argsLength=args.length;if(!argsLength)return none;const totalPoints=argsLength-1;const firstArg=args[0];const lastArg=args[totalPoints];const xPoints=[0];const yPoints=[parseNumber(firstArg)];for(let i=1;i<totalPoints;i++){const arg=args[i];const splitValue=isStr(arg)?arg.trim().split(" "):[arg];const value=splitValue[0];const percent=splitValue[1];xPoints.push(!isUnd(percent)?parseNumber(percent)/100:i/totalPoints);yPoints.push(parseNumber(value))}yPoints.push(parseNumber(lastArg));xPoints.push(1);return function easeLinear(t){for(let i=1,l=xPoints.length;i<l;i++){const currentX=xPoints[i];if(t<=currentX){const prevX=xPoints[i-1];const prevY=yPoints[i-1];return prevY+(yPoints[i]-prevY)*(t-prevX)/(currentX-prevX)}}return yPoints[yPoints.length-1]}};const irregular=(length=10,randomness=1)=>{const values=[0];const total=length-1;for(let i=1;i<total;i++){const previousValue=values[i-1];const spacing=i/total;const segmentEnd=(i+1)/total;const randomVariation=spacing+(segmentEnd-spacing)*Math.random();const randomValue=spacing*(1-randomness)+randomVariation*randomness;values.push(clamp(randomValue,previousValue,1))}values.push(1);return linear(...values)};const halfPI=PI/2;const doublePI=PI*2;const easeInPower=(p=1.68)=>t=>pow(t,+p);const easeInFunctions={[emptyString]:easeInPower,Quad:easeInPower(2),Cubic:easeInPower(3),Quart:easeInPower(4),Quint:easeInPower(5),Sine:t=>1-cos(t*halfPI),Circ:t=>1-sqrt(1-t*t),Expo:t=>t?pow(2,10*t-10):0,Bounce:t=>{let pow2,b=4;while(t<((pow2=pow(2,--b))-1)/11);return 1/pow(4,3-b)-7.5625*pow((pow2*3-2)/22-t,2)},Back:(overshoot=1.70158)=>t=>(+overshoot+1)*t*t*t-+overshoot*t*t,Elastic:(amplitude=1,period=.3)=>{const a=clamp(+amplitude,1,10);const p=clamp(+period,minValue,2);const s=p/doublePI*asin(1/a);const e=doublePI/p;return t=>t===0||t===1?t:-a*pow(2,-10*(1-t))*sin((1-t-s)*e)}};const easeTypes={in:easeIn=>t=>easeIn(t),out:easeIn=>t=>1-easeIn(1-t),inOut:easeIn=>t=>t<.5?easeIn(t*2)/2:1-easeIn(t*-2+2)/2,outIn:easeIn=>t=>t<.5?(1-easeIn(1-t*2))/2:(easeIn(t*2-1)+1)/2};const parseEaseString=(string,easesFunctions,easesLookups)=>{if(easesLookups[string])return easesLookups[string];if(string.indexOf("(")<=-1){const hasParams=easeTypes[string]||string.includes("Back")||string.includes("Elastic");const parsedFn=hasParams?easesFunctions[string]():easesFunctions[string];return parsedFn?easesLookups[string]=parsedFn:none}else{const split=string.slice(0,-1).split("(");const parsedFn=easesFunctions[split[0]];return parsedFn?easesLookups[string]=parsedFn(...split[1].split(",")):none}};const eases=(()=>{const list={linear:linear,irregular:irregular,steps:steps,cubicBezier:cubicBezier};for(let type in easeTypes){for(let name in easeInFunctions){const easeIn=easeInFunctions[name];const easeType=easeTypes[type];list[type+name]=name===emptyString||name==="Back"||name==="Elastic"?(a,b)=>easeType(easeIn(a,b)):easeType(easeIn)}}return list})();const JSEasesLookups={linear:none};const parseEasings=ease=>isFnc(ease)?ease:isStr(ease)?parseEaseString(ease,eases,JSEasesLookups):none;const propertyNamesCache={};const sanitizePropertyName=(propertyName,target,tweenType)=>{if(tweenType===tweenTypes.TRANSFORM){const t=shortTransforms.get(propertyName);return t?t:propertyName}else if(tweenType===tweenTypes.CSS||tweenType===tweenTypes.ATTRIBUTE&&(isSvg(target)&&propertyName in target.style)){const cachedPropertyName=propertyNamesCache[propertyName];if(cachedPropertyName){return cachedPropertyName}else{const lowerCaseName=propertyName?toLowerCase(propertyName):propertyName;propertyNamesCache[propertyName]=lowerCaseName;return lowerCaseName}}else{return propertyName}};const angleUnitsMap={deg:1,rad:180/PI,turn:360};const convertedValuesCache={};const convertValueUnit=(el,decomposedValue,unit,force=false)=>{const currentUnit=decomposedValue.u;const currentNumber=decomposedValue.n;if(decomposedValue.t===valueTypes.UNIT&&currentUnit===unit){return decomposedValue}const cachedKey=currentNumber+currentUnit+unit;const cached=convertedValuesCache[cachedKey];if(!isUnd(cached)&&!force){decomposedValue.n=cached}else{let convertedValue;if(currentUnit in angleUnitsMap){convertedValue=currentNumber*angleUnitsMap[currentUnit]/angleUnitsMap[unit]}else{const baseline=100;const tempEl=el.cloneNode();const parentNode=el.parentNode;const parentEl=parentNode&&parentNode!==doc?parentNode:doc.body;parentEl.appendChild(tempEl);const elStyle=tempEl.style;elStyle.width=baseline+currentUnit;const currentUnitWidth=tempEl.offsetWidth||baseline;elStyle.width=baseline+unit;const newUnitWidth=tempEl.offsetWidth||baseline;const factor=currentUnitWidth/newUnitWidth;parentEl.removeChild(tempEl);convertedValue=factor*currentNumber}decomposedValue.n=convertedValue;convertedValuesCache[cachedKey]=convertedValue}decomposedValue.t===valueTypes.UNIT;decomposedValue.u=unit;return decomposedValue};const cleanInlineStyles=renderable=>{if(renderable._hasChildren){forEachChildren(renderable,cleanInlineStyles,true)}else{const animation=renderable;animation.pause();forEachChildren(animation,(tween=>{const tweenProperty=tween.property;const tweenTarget=tween.target;if(tweenTarget[isDomSymbol]){const targetStyle=tweenTarget.style;const originalInlinedValue=animation._inlineStyles[tweenProperty];if(tween._tweenType===tweenTypes.TRANSFORM){const cachedTransforms=tweenTarget[transformsSymbol];if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){delete cachedTransforms[tweenProperty]}else{cachedTransforms[tweenProperty]=originalInlinedValue}if(tween._renderTransforms){if(!Object.keys(cachedTransforms).length){targetStyle.removeProperty("transform")}else{let str=emptyString;for(let key in cachedTransforms){str+=transformsFragmentStrings[key]+cachedTransforms[key]+") "}targetStyle.transform=str}}}else{if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){targetStyle.removeProperty(tweenProperty)}else{targetStyle[tweenProperty]=originalInlinedValue}}if(animation._tail===tween){animation.targets.forEach((t=>{if(t.getAttribute&&t.getAttribute("style")===emptyString){t.removeAttribute("style")}}))}}}))}return renderable};const fromTargetObject=createDecomposedValueTargetObject();const toTargetObject=createDecomposedValueTargetObject();const toFunctionStore={func:null};const keyframesTargetArray=[null];const fastSetValuesArray=[null,null];const keyObjectTarget={to:null};let tweenId=0;let keyframes;let key;const generateKeyframes=(keyframes,parameters)=>{const properties={};if(isArr(keyframes)){const propertyNames=[].concat(...keyframes.map((key=>Object.keys(key)))).filter(isKey);for(let i=0,l=propertyNames.length;i<l;i++){const propName=propertyNames[i];const propArray=keyframes.map((key=>{const newKey={};for(let p in key){const keyValue=key[p];if(isKey(p)){if(p===propName){newKey.to=keyValue}}else{newKey[p]=keyValue}}return newKey}));properties[propName]=propArray}}else{const totalDuration=setValue(parameters.duration,globals.defaults.duration);const keys=Object.keys(keyframes).map((key=>({o:parseFloat(key)/100,p:keyframes[key]}))).sort(((a,b)=>a.o-b.o));keys.forEach((key=>{const offset=key.o;const prop=key.p;for(let name in prop){if(isKey(name)){let propArray=properties[name];if(!propArray)propArray=properties[name]=[];const duration=offset*totalDuration;let length=propArray.length;let prevKey=propArray[length-1];const keyObj={to:prop[name]};let durProgress=0;for(let i=0;i<length;i++){durProgress+=propArray[i].duration}if(length===1){keyObj.from=prevKey.to}if(prop.ease){keyObj.ease=prop.ease}keyObj.duration=duration-(length?durProgress:0);propArray.push(keyObj)}}return key}));for(let name in properties){const propArray=properties[name];let prevEase;for(let i=0,l=propArray.length;i<l;i++){const prop=propArray[i];const currentEase=prop.ease;prop.ease=prevEase?prevEase:undefined;prevEase=currentEase}if(!propArray[0].duration){propArray.shift()}}}return properties};class JSAnimation extends Timer{constructor(targets,parameters,parent,parentPosition,fastSet=false,index=0,length=0){super(parameters,parent,parentPosition);const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;const kfParams=parameters.keyframes;const params=kfParams?mergeObjects(generateKeyframes(kfParams,parameters),parameters):parameters;const{delay:delay,duration:duration,ease:ease,playbackEase:playbackEase,modifier:modifier,composition:composition,onRender:onRender}=params;const animDefaults=parent?parent.defaults:globals.defaults;const animaPlaybackEase=setValue(playbackEase,animDefaults.playbackEase);const animEase=animaPlaybackEase?parseEasings(animaPlaybackEase):null;const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const tEasing=hasSpring?ease.ease:setValue(ease,animEase?"linear":animDefaults.ease);const tDuration=hasSpring?ease.duration:setValue(duration,animDefaults.duration);const tDelay=setValue(delay,animDefaults.delay);const tModifier=modifier||animDefaults.modifier;const tComposition=isUnd(composition)&&targetsLength>=K?compositionTypes.none:!isUnd(composition)?composition:animDefaults.composition;const animInlineStyles={};const absoluteOffsetTime=this._offset+(parent?parent._offset:0);let iterationDuration=NaN;let iterationDelay=NaN;let animationAnimationLength=0;let shouldTriggerRender=0;for(let targetIndex=0;targetIndex<targetsLength;targetIndex++){const target=parsedTargets[targetIndex];const ti=index||targetIndex;const tl=length||targetsLength;let lastTransformGroupIndex=NaN;let lastTransformGroupLength=NaN;for(let p in params){if(isKey(p)){const tweenType=getTweenType(target,p);const propName=sanitizePropertyName(p,target,tweenType);let propValue=params[p];const isPropValueArray=isArr(propValue);if(fastSet&&!isPropValueArray){fastSetValuesArray[0]=propValue;fastSetValuesArray[1]=propValue;propValue=fastSetValuesArray}if(isPropValueArray){const arrayLength=propValue.length;const isNotObjectValue=!isObj(propValue[0]);if(arrayLength===2&&isNotObjectValue){keyObjectTarget.to=propValue;keyframesTargetArray[0]=keyObjectTarget;keyframes=keyframesTargetArray}else if(arrayLength>2&&isNotObjectValue){keyframes=[];propValue.forEach(((v,i)=>{if(!i){fastSetValuesArray[0]=v}else if(i===1){fastSetValuesArray[1]=v;keyframes.push(fastSetValuesArray)}else{keyframes.push(v)}}))}else{keyframes=propValue}}else{keyframesTargetArray[0]=propValue;keyframes=keyframesTargetArray}let siblings=null;let prevTween=null;let firstTweenChangeStartTime=NaN;let lastTweenChangeEndTime=0;let tweenIndex=0;for(let l=keyframes.length;tweenIndex<l;tweenIndex++){const keyframe=keyframes[tweenIndex];if(isObj(keyframe)){key=keyframe}else{keyObjectTarget.to=keyframe;key=keyObjectTarget}toFunctionStore.func=null;const computedToValue=getFunctionValue(key.to,target,ti,tl,toFunctionStore);let tweenToValue;if(isObj(computedToValue)&&!isUnd(computedToValue.to)){key=computedToValue;tweenToValue=computedToValue.to}else{tweenToValue=computedToValue}const tweenFromValue=getFunctionValue(key.from,target,ti,tl);const keyEasing=key.ease;const hasSpring=!isUnd(keyEasing)&&!isUnd(keyEasing.ease);const tweenEasing=hasSpring?keyEasing.ease:keyEasing||tEasing;const tweenDuration=hasSpring?keyEasing.duration:getFunctionValue(setValue(key.duration,l>1?getFunctionValue(tDuration,target,ti,tl)/l:tDuration),target,ti,tl);const tweenDelay=getFunctionValue(setValue(key.delay,!tweenIndex?tDelay:0),target,ti,tl);const computedComposition=getFunctionValue(setValue(key.composition,tComposition),target,ti,tl);const tweenComposition=isNum(computedComposition)?computedComposition:compositionTypes[computedComposition];const tweenModifier=key.modifier||tModifier;const hasFromvalue=!isUnd(tweenFromValue);const hasToValue=!isUnd(tweenToValue);const isFromToArray=isArr(tweenToValue);const isFromToValue=isFromToArray||hasFromvalue&&hasToValue;const tweenStartTime=prevTween?lastTweenChangeEndTime+tweenDelay:tweenDelay;const absoluteStartTime=absoluteOffsetTime+tweenStartTime;if(!shouldTriggerRender&&(hasFromvalue||isFromToArray))shouldTriggerRender=1;let prevSibling=prevTween;if(tweenComposition!==compositionTypes.none){if(!siblings)siblings=getTweenSiblings(target,propName);let nextSibling=siblings._head;while(nextSibling&&!nextSibling._isOverridden&&nextSibling._absoluteStartTime<=absoluteStartTime){prevSibling=nextSibling;nextSibling=nextSibling._nextRep;if(nextSibling&&nextSibling._absoluteStartTime>=absoluteStartTime){while(nextSibling){overrideTween(nextSibling);nextSibling=nextSibling._nextRep}}}}if(isFromToValue){decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[0],target,ti,tl):tweenFromValue,fromTargetObject);decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[1],target,ti,tl,toFunctionStore):tweenToValue,toTargetObject);if(fromTargetObject.t===valueTypes.NUMBER){if(prevSibling){if(prevSibling._valueType===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=prevSibling._unit}}else{decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=decomposedOriginalValue.u}}}}else{if(hasToValue){decomposeRawValue(tweenToValue,toTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,toTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),toTargetObject)}}if(hasFromvalue){decomposeRawValue(tweenFromValue,fromTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,fromTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),fromTargetObject)}}}if(fromTargetObject.o){fromTargetObject.n=getRelativeValue(!prevSibling?decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue).n:prevSibling._toNumber,fromTargetObject.n,fromTargetObject.o)}if(toTargetObject.o){toTargetObject.n=getRelativeValue(fromTargetObject.n,toTargetObject.n,toTargetObject.o)}if(fromTargetObject.t!==toTargetObject.t){if(fromTargetObject.t===valueTypes.COMPLEX||toTargetObject.t===valueTypes.COMPLEX){const complexValue=fromTargetObject.t===valueTypes.COMPLEX?fromTargetObject:toTargetObject;const notComplexValue=fromTargetObject.t===valueTypes.COMPLEX?toTargetObject:fromTargetObject;notComplexValue.t=valueTypes.COMPLEX;notComplexValue.s=cloneArray(complexValue.s);notComplexValue.d=complexValue.d.map((()=>notComplexValue.n))}else if(fromTargetObject.t===valueTypes.UNIT||toTargetObject.t===valueTypes.UNIT){const unitValue=fromTargetObject.t===valueTypes.UNIT?fromTargetObject:toTargetObject;const notUnitValue=fromTargetObject.t===valueTypes.UNIT?toTargetObject:fromTargetObject;notUnitValue.t=valueTypes.UNIT;notUnitValue.u=unitValue.u}else if(fromTargetObject.t===valueTypes.COLOR||toTargetObject.t===valueTypes.COLOR){const colorValue=fromTargetObject.t===valueTypes.COLOR?fromTargetObject:toTargetObject;const notColorValue=fromTargetObject.t===valueTypes.COLOR?toTargetObject:fromTargetObject;notColorValue.t=valueTypes.COLOR;notColorValue.s=colorValue.s;notColorValue.d=[0,0,0,1]}}if(fromTargetObject.u!==toTargetObject.u){let valueToConvert=toTargetObject.u?fromTargetObject:toTargetObject;valueToConvert=convertValueUnit(target,valueToConvert,toTargetObject.u?toTargetObject.u:fromTargetObject.u,false)}if(toTargetObject.d&&fromTargetObject.d&&toTargetObject.d.length!==fromTargetObject.d.length){const longestValue=fromTargetObject.d.length>toTargetObject.d.length?fromTargetObject:toTargetObject;const shortestValue=longestValue===fromTargetObject?toTargetObject:fromTargetObject;shortestValue.d=longestValue.d.map(((_,i)=>isUnd(shortestValue.d[i])?0:shortestValue.d[i]));shortestValue.s=cloneArray(longestValue.s)}const tweenUpdateDuration=round(+tweenDuration||minValue,12);const tween={parent:this,id:tweenId++,property:propName,target:target,_value:null,_func:toFunctionStore.func,_ease:parseEasings(tweenEasing),_fromNumbers:cloneArray(fromTargetObject.d),_toNumbers:cloneArray(toTargetObject.d),_strings:cloneArray(toTargetObject.s),_fromNumber:fromTargetObject.n,_toNumber:toTargetObject.n,_numbers:cloneArray(fromTargetObject.d),_number:fromTargetObject.n,_unit:toTargetObject.u,_modifier:tweenModifier,_currentTime:0,_startTime:tweenStartTime,_delay:+tweenDelay,_updateDuration:tweenUpdateDuration,_changeDuration:tweenUpdateDuration,_absoluteStartTime:absoluteStartTime,_tweenType:tweenType,_valueType:toTargetObject.t,_composition:tweenComposition,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};if(tweenComposition!==compositionTypes.none){composeTween(tween,siblings)}if(isNaN(firstTweenChangeStartTime)){firstTweenChangeStartTime=tween._startTime}lastTweenChangeEndTime=round(tweenStartTime+tweenUpdateDuration,12);prevTween=tween;animationAnimationLength++;addChild(this,tween)}if(isNaN(iterationDelay)||firstTweenChangeStartTime<iterationDelay){iterationDelay=firstTweenChangeStartTime}if(isNaN(iterationDuration)||lastTweenChangeEndTime>iterationDuration){iterationDuration=lastTweenChangeEndTime}if(tweenType===tweenTypes.TRANSFORM){lastTransformGroupIndex=animationAnimationLength-tweenIndex;lastTransformGroupLength=animationAnimationLength}}}if(!isNaN(lastTransformGroupIndex)){let i=0;forEachChildren(this,(tween=>{if(i>=lastTransformGroupIndex&&i<lastTransformGroupLength){tween._renderTransforms=1;if(tween._composition===compositionTypes.blend){forEachChildren(additive.animation,(additiveTween=>{if(additiveTween.id===tween.id){additiveTween._renderTransforms=1}}))}}i++}))}}if(!targetsLength){console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`)}if(iterationDelay){forEachChildren(this,(tween=>{if(!(tween._startTime-tween._delay)){tween._delay-=iterationDelay}tween._startTime-=iterationDelay}));iterationDuration-=iterationDelay}else{iterationDelay=0}if(!iterationDuration){iterationDuration=minValue;this.iterationCount=0}this.targets=parsedTargets;this.duration=iterationDuration===minValue?minValue:clampInfinity((iterationDuration+this._loopDelay)*this.iterationCount-this._loopDelay)||minValue;this.onRender=onRender||animDefaults.onRender;this._ease=animEase;this._delay=iterationDelay;this.iterationDuration=iterationDuration;this._inlineStyles=animInlineStyles;if(!this._autoplay&&shouldTriggerRender)this.onRender(this)}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;forEachChildren(this,(tween=>{tween._updateDuration=normalizeTime(tween._updateDuration*timeScale);tween._changeDuration=normalizeTime(tween._changeDuration*timeScale);tween._currentTime*=timeScale;tween._startTime*=timeScale;tween._absoluteStartTime*=timeScale}));return super.stretch(newDuration)}refresh(){forEachChildren(this,(tween=>{const ogValue=getOriginalAnimatableValue(tween.target,tween.property,tween._tweenType);decomposeRawValue(ogValue,decomposedOriginalValue);tween._fromNumbers=cloneArray(decomposedOriginalValue.d);tween._fromNumber=decomposedOriginalValue.n;if(tween._func){decomposeRawValue(tween._func(),toTargetObject);tween._toNumbers=cloneArray(toTargetObject.d);tween._strings=cloneArray(toTargetObject.s);tween._toNumber=toTargetObject.n}}));return this}revert(){super.revert();return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const animate=(targets,parameters)=>new JSAnimation(targets,parameters,null,0,false).init();const easingToLinear=(fn,samples=100)=>{const points=[];for(let i=0;i<=samples;i++)points.push(fn(i/samples));return`linear(${points.join(", ")})`};const WAAPIEasesLookups={in:"ease-in",out:"ease-out",inOut:"ease-in-out"};const WAAPIeases=(()=>{const list={};for(let type in easeTypes)list[type]=a=>easeTypes[type](easeInPower(a));return list})();const parseWAAPIEasing=ease=>{let parsedEase=WAAPIEasesLookups[ease];if(parsedEase)return parsedEase;parsedEase="linear";if(isStr(ease)){if(stringStartsWith(ease,"linear")||stringStartsWith(ease,"cubic-")||stringStartsWith(ease,"steps")||stringStartsWith(ease,"ease")){parsedEase=ease}else if(stringStartsWith(ease,"cubicB")){parsedEase=toLowerCase(ease)}else{const parsed=parseEaseString(ease,WAAPIeases,WAAPIEasesLookups);if(isFnc(parsed))parsedEase=parsed===none?"linear":easingToLinear(parsed)}WAAPIEasesLookups[ease]=parsedEase}else if(isFnc(ease)){const easing=easingToLinear(ease);if(easing)parsedEase=easing}else if(ease.ease){parsedEase=easingToLinear(ease.ease)}return parsedEase};const transformsShorthands=["x","y","z"];const commonDefaultPXProperties=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...transformsShorthands];const validIndividualTransforms=[...transformsShorthands,...validTransforms.filter((t=>["X","Y","Z"].some((axis=>t.endsWith(axis)))))];let transformsPropertiesRegistered=isBrowser&&(isUnd(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const registerTransformsProperties=()=>{if(transformsPropertiesRegistered)return;validTransforms.forEach((t=>{const isSkew=stringStartsWith(t,"skew");const isScale=stringStartsWith(t,"scale");const isRotate=stringStartsWith(t,"rotate");const isTranslate=stringStartsWith(t,"translate");const isAngle=isRotate||isSkew;const syntax=isAngle?"<angle>":isScale?"<number>":isTranslate?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:syntax,inherits:false,initialValue:isTranslate?"0px":isAngle?"0deg":isScale?"1":"0"})}catch{}}));transformsPropertiesRegistered=true};const WAAPIAnimationsLookups={_head:null,_tail:null};const removeWAAPIAnimation=($el,property,parent)=>{let nextLookup=WAAPIAnimationsLookups._head;while(nextLookup){const next=nextLookup._next;const matchTarget=nextLookup.$el===$el;const matchProperty=!property||nextLookup.property===property;const matchParent=!parent||nextLookup.parent===parent;if(matchTarget&&matchProperty&&matchParent){const anim=nextLookup.animation;try{anim.commitStyles()}catch{}anim.cancel();removeChild(WAAPIAnimationsLookups,nextLookup);const lookupParent=nextLookup.parent;if(lookupParent){lookupParent._completed++;if(lookupParent.animations.length===lookupParent._completed){lookupParent.completed=true;if(!lookupParent.muteCallbacks){lookupParent.paused=true;lookupParent.onComplete(lookupParent);lookupParent._resolve(lookupParent)}}}}nextLookup=next}};const addWAAPIAnimation=(parent,$el,property,keyframes,params)=>{const animation=$el.animate(keyframes,params);const animTotalDuration=params.delay+ +params.duration*params.iterations;animation.playbackRate=parent._speed;if(parent.paused)animation.pause();if(parent.duration<animTotalDuration){parent.duration=animTotalDuration;parent.controlAnimation=animation}parent.animations.push(animation);removeWAAPIAnimation($el,property);addChild(WAAPIAnimationsLookups,{parent:parent,animation:animation,$el:$el,property:property,_next:null,_prev:null});const handleRemove=()=>{removeWAAPIAnimation($el,property,parent)};animation.onremove=handleRemove;animation.onfinish=handleRemove;return animation};const normalizeTweenValue=(propName,value,$el,i,targetsLength)=>{let v=getFunctionValue(value,$el,i,targetsLength);if(!isNum(v))return v;if(commonDefaultPXProperties.includes(propName)||stringStartsWith(propName,"translate"))return`${v}px`;if(stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew"))return`${v}deg`;return`${v}`};const parseIndividualTweenValue=($el,propName,from,to,i,targetsLength)=>{let tweenValue="0";const computedTo=!isUnd(to)?normalizeTweenValue(propName,to,$el,i,targetsLength):getComputedStyle($el)[propName];if(!isUnd(from)){const computedFrom=normalizeTweenValue(propName,from,$el,i,targetsLength);tweenValue=[computedFrom,computedTo]}else{tweenValue=isArr(to)?to.map((v=>normalizeTweenValue(propName,v,$el,i,targetsLength))):computedTo}return tweenValue};class WAAPIAnimation{constructor(targets,params){if(globals.scope)globals.scope.revertibles.push(this);registerTransformsProperties();const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;if(!targetsLength){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=ease.ease&&ease;const autoplay=setValue(params.autoplay,globals.defaults.autoplay);const scroll=autoplay&&autoplay.link?autoplay:false;const alternate=params.alternate&&params.alternate===true;const reversed=params.reversed&&params.reversed===true;const loop=setValue(params.loop,globals.defaults.loop);const iterations=loop===true||loop===Infinity?Infinity:isNum(loop)?loop+1:1;const direction=alternate?reversed?"alternate-reverse":"alternate":reversed?"reverse":"normal";const fill="forwards";const easing=parseWAAPIEasing(ease);const timeScale=globals.timeScale===1?1:K;this.targets=parsedTargets;this.animations=[];this.controlAnimation=null;this.onComplete=params.onComplete||noop;this.duration=0;this.muteCallbacks=false;this.completed=false;this.paused=!autoplay||scroll!==false;this.reversed=reversed;this.autoplay=autoplay;this._speed=setValue(params.playbackRate,globals.defaults.playbackRate);this._resolve=noop;this._completed=0;this._inlineStyles=parsedTargets.map(($el=>$el.getAttribute("style")));parsedTargets.forEach((($el,i)=>{const cachedTransforms=$el[transformsSymbol];const hasIndividualTransforms=validIndividualTransforms.some((t=>params.hasOwnProperty(t)));const duration=(spring?spring.duration:getFunctionValue(setValue(params.duration,globals.defaults.duration),$el,i,targetsLength))*timeScale;const delay=getFunctionValue(setValue(params.delay,globals.defaults.delay),$el,i,targetsLength)*timeScale;const composite=setValue(params.composition,"replace");for(let name in params){if(!isKey(name))continue;const keyframes={};const tweenParams={iterations:iterations,direction:direction,fill:fill,easing:easing,duration:duration,delay:delay,composite:composite};const propertyValue=params[name];const individualTransformProperty=hasIndividualTransforms?validTransforms.includes(name)?name:shortTransforms.get(name):false;let parsedPropertyValue;if(isObj(propertyValue)){const tweenOptions=propertyValue;const tweenOptionsEase=setValue(tweenOptions.ease,ease);const tweenOptionsSpring=tweenOptionsEase.ease&&tweenOptionsEase;const to=tweenOptions.to;const from=tweenOptions.from;tweenParams.duration=(tweenOptionsSpring?tweenOptionsSpring.duration:getFunctionValue(setValue(tweenOptions.duration,duration),$el,i,targetsLength))*timeScale;tweenParams.delay=getFunctionValue(setValue(tweenOptions.delay,delay),$el,i,targetsLength)*timeScale;tweenParams.composite=setValue(tweenOptions.composition,composite);tweenParams.easing=parseWAAPIEasing(tweenOptionsEase);parsedPropertyValue=parseIndividualTweenValue($el,name,from,to,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parseIndividualTweenValue($el,name,from,to,i,targetsLength)}addWAAPIAnimation(this,$el,name,keyframes,tweenParams);if(!isUnd(from)){if(!individualTransformProperty){$el.style[name]=keyframes[name][0]}else{const key=`--${individualTransformProperty}`;$el.style.setProperty(key,keyframes[key][0])}}}else{parsedPropertyValue=isArr(propertyValue)?propertyValue.map((v=>normalizeTweenValue(name,v,$el,i,targetsLength))):normalizeTweenValue(name,propertyValue,$el,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parsedPropertyValue}addWAAPIAnimation(this,$el,name,keyframes,tweenParams)}}if(hasIndividualTransforms){let transforms=emptyString;for(let t in cachedTransforms){transforms+=`${transformsFragmentStrings[t]}var(--${t})) `}$el.style.transform=transforms}}));if(scroll){this.autoplay.link(this)}}forEach(callback){const cb=isStr(callback)?a=>a[callback]():callback;this.animations.forEach(cb);return this}get speed(){return this._speed}set speed(speed){this._speed=+speed;this.forEach((anim=>anim.playbackRate=speed))}get currentTime(){const controlAnimation=this.controlAnimation;const timeScale=globals.timeScale;return this.completed?this.duration:controlAnimation?+controlAnimation.currentTime*(timeScale===1?1:timeScale):0}set currentTime(time){const t=time*(globals.timeScale===1?1:K);this.forEach((anim=>{if(t>=this.duration)anim.play();anim.currentTime=t}))}get progress(){return this.currentTime/this.duration}set progress(progress){this.forEach((anim=>anim.currentTime=progress*this.duration||0))}resume(){if(!this.paused)return this;this.paused=false;return this.forEach("play")}pause(){if(this.paused)return this;this.paused=true;return this.forEach("pause")}alternate(){this.reversed=!this.reversed;this.forEach("reverse");if(this.paused)this.forEach("pause");return this}play(){if(this.reversed)this.alternate();return this.resume()}reverse(){if(!this.reversed)this.alternate();return this.resume()}seek(time,muteCallbacks=false){if(muteCallbacks)this.muteCallbacks=true;if(time<this.duration)this.completed=false;this.currentTime=time;this.muteCallbacks=false;if(this.paused)this.pause();return this}restart(){this.completed=false;return this.seek(0,true).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){this.forEach("cancel");return this.pause()}revert(){this.cancel();this.targets.forEach((($el,i)=>$el.setAttribute("style",this._inlineStyles[i])));return this}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const waapi={animate:(targets,params)=>new WAAPIAnimation(targets,params),convertEase:easingToLinear};const sync=(callback=noop)=>new Timer({duration:1*globals.timeScale,onComplete:callback},null,0).resume();function getTargetValue(targetSelector,propName,unit){const targets=registerTargets(targetSelector);if(!targets.length)return;const[target]=targets;const tweenType=getTweenType(target,propName);const normalizePropName=sanitizePropertyName(propName,target,tweenType);let originalValue=getOriginalAnimatableValue(target,normalizePropName);if(isUnd(unit)){return originalValue}else{decomposeRawValue(originalValue,decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.NUMBER||decomposedOriginalValue.t===valueTypes.UNIT){if(unit===false){return decomposedOriginalValue.n}else{const convertedValue=convertValueUnit(target,decomposedOriginalValue,unit,false);return`${round(convertedValue.n,globals.precision)}${convertedValue.u}`}}}}const setTargetValues=(targets,parameters)=>{if(isUnd(parameters))return;parameters.duration=minValue;parameters.composition=setValue(parameters.composition,compositionTypes.none);return new JSAnimation(targets,parameters,null,0,true).resume()};const removeTargetsFromAnimation=(targetsArray,animation,propertyName)=>{let tweensMatchesTargets=false;forEachChildren(animation,(tween=>{const tweenTarget=tween.target;if(targetsArray.includes(tweenTarget)){const tweenName=tween.property;const tweenType=tween._tweenType;const normalizePropName=sanitizePropertyName(propertyName,tweenTarget,tweenType);if(!normalizePropName||normalizePropName&&normalizePropName===tweenName){if(tween.parent._tail===tween&&tween._tweenType===tweenTypes.TRANSFORM&&tween._prev&&tween._prev._tweenType===tweenTypes.TRANSFORM){tween._prev._renderTransforms=1}removeChild(animation,tween);removeTweenSliblings(tween);tweensMatchesTargets=true}}}),true);return tweensMatchesTargets};const remove=(targets,renderable,propertyName)=>{const targetsArray=parseTargets(targets);const parent=renderable?renderable:engine;const waapiAnimation=renderable&&renderable.controlAnimation&&renderable;for(let i=0,l=targetsArray.length;i<l;i++){const $el=targetsArray[i];removeWAAPIAnimation($el,propertyName,waapiAnimation)}let removeMatches;if(parent._hasChildren){let iterationDuration=0;forEachChildren(parent,(child=>{if(!child._hasChildren){removeMatches=removeTargetsFromAnimation(targetsArray,child,propertyName);if(removeMatches&&!child._head){child.cancel();removeChild(parent,child)}else{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>iterationDuration){iterationDuration=childDur}}}if(child._head){remove(targets,child,propertyName)}else{child._hasChildren=false}}),true);if(!isUnd(parent.iterationDuration)){parent.iterationDuration=iterationDuration}}else{removeMatches=removeTargetsFromAnimation(targetsArray,parent,propertyName)}if(removeMatches&&!parent._head){parent._hasChildren=false;if(parent.cancel)parent.cancel()}return targetsArray};const random=(min,max,decimalLength)=>{const m=10**(decimalLength||0);return floor((Math.random()*(max-min+1/m)+min)*m)/m};const randomPick=items=>items[random(0,items.length-1)];const shuffle=items=>{let m=items.length,t,i;while(m){i=random(0,--m);t=items[m];items[m]=items[i];items[i]=t}return items};const roundPad=(v,decimalLength)=>(+v).toFixed(decimalLength);const padStart=(v,totalLength,padString)=>`${v}`.padStart(totalLength,padString);const padEnd=(v,totalLength,padString)=>`${v}`.padEnd(totalLength,padString);const wrap=(v,min,max)=>((v-min)%(max-min)+(max-min))%(max-min)+min;const mapRange=(value,inLow,inHigh,outLow,outHigh)=>outLow+(value-inLow)/(inHigh-inLow)*(outHigh-outLow);const degToRad=degrees=>degrees*PI/180;const radToDeg=radians=>radians*180/PI;const lerp=(start,end,amount,renderable)=>{let dt=K/globals.defaults.frameRate;if(renderable!==false){const ticker=renderable||engine._hasChildren&&engine;if(ticker&&ticker.deltaTime){dt=ticker.deltaTime}}const t=1-Math.exp(-amount*dt*.1);return!amount?start:amount===1?end:(1-t)*start+t*end};const curry=(fn,last=0)=>(...args)=>last?v=>fn(...args,v):v=>fn(v,...args);const chain=fn=>(...args)=>{const result=fn(...args);return new Proxy(noop,{apply:(_,__,[v])=>result(v),get:(_,prop)=>chain(((...nextArgs)=>{const nextResult=utils[prop](...nextArgs);return v=>nextResult(result(v))}))})};const makeChainable=(fn,right=0)=>(...args)=>(args.length<fn.length?chain(curry(fn,right)):fn)(...args);const utils={$:registerTargets,get:getTargetValue,set:setTargetValues,remove:remove,cleanInlineStyles:cleanInlineStyles,random:random,randomPick:randomPick,shuffle:shuffle,lerp:lerp,sync:sync,clamp:makeChainable(clamp),round:makeChainable(round),snap:makeChainable(snap),wrap:makeChainable(wrap),interpolate:makeChainable(interpolate,1),mapRange:makeChainable(mapRange),roundPad:makeChainable(roundPad),padStart:makeChainable(padStart),padEnd:makeChainable(padEnd),degToRad:makeChainable(degToRad),radToDeg:makeChainable(radToDeg)};const getPrevChildOffset=(timeline,timePosition)=>{if(stringStartsWith(timePosition,"<")){const goToPrevAnimationOffset=timePosition[1]==="<";const prevAnimation=timeline._tail;const prevOffset=prevAnimation?prevAnimation._offset+prevAnimation._delay:0;return goToPrevAnimationOffset?prevOffset:prevOffset+prevAnimation.duration}};const parseTimelinePosition=(timeline,timePosition)=>{let tlDuration=timeline.iterationDuration;if(tlDuration===minValue)tlDuration=0;if(isUnd(timePosition))return tlDuration;if(isNum(+timePosition))return+timePosition;const timePosStr=timePosition;const tlLabels=timeline?timeline.labels:null;const hasLabels=!isNil(tlLabels);const prevOffset=getPrevChildOffset(timeline,timePosStr);const hasSibling=!isUnd(prevOffset);const matchedRelativeOperator=relativeValuesExecRgx.exec(timePosStr);if(matchedRelativeOperator){const fullOperator=matchedRelativeOperator[0];const split=timePosStr.split(fullOperator);const labelOffset=hasLabels&&split[0]?tlLabels[split[0]]:tlDuration;const parsedOffset=hasSibling?prevOffset:hasLabels?labelOffset:tlDuration;const parsedNumericalOffset=+split[1];return getRelativeValue(parsedOffset,parsedNumericalOffset,fullOperator[0])}else{return hasSibling?prevOffset:hasLabels?!isUnd(tlLabels[timePosStr])?tlLabels[timePosStr]:tlDuration:tlDuration}};function getTimelineTotalDuration(tl){return clampInfinity((tl.iterationDuration+tl._loopDelay)*tl.iterationCount-tl._loopDelay)||minValue}function addTlChild(childParams,tl,timePosition,targets,index,length){const isSetter=isNum(childParams.duration)&&childParams.duration<=minValue;const adjustedPosition=isSetter?timePosition-minValue:timePosition;tick(tl,adjustedPosition,1,1,tickModes.AUTO);const tlChild=targets?new JSAnimation(targets,childParams,tl,adjustedPosition,false,index,length):new Timer(childParams,tl,adjustedPosition);tlChild.init(1);addChild(tl,tlChild);forEachChildren(tl,(child=>{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>tl.iterationDuration)tl.iterationDuration=childDur}));tl.duration=getTimelineTotalDuration(tl);return tl}class Timeline extends Timer{constructor(parameters={}){super(parameters,null,0);this.duration=0;this.labels={};const defaultsParams=parameters.defaults;const globalDefaults=globals.defaults;this.defaults=defaultsParams?mergeObjects(defaultsParams,globalDefaults):globalDefaults;this.onRender=parameters.onRender||globalDefaults.onRender;const tlPlaybackEase=setValue(parameters.playbackEase,globalDefaults.playbackEase);this._ease=tlPlaybackEase?parseEasings(tlPlaybackEase):null;this.iterationDuration=0}add(a1,a2,a3){const isAnim=isObj(a2);const isTimer=isObj(a1);if(isAnim||isTimer){this._hasChildren=true;if(isAnim){const childParams=a2;if(isFnc(a3)){const staggeredPosition=a3;const parsedTargetsArray=parseTargets(a1);const tlDuration=this.duration;const tlIterationDuration=this.iterationDuration;const id=childParams.id;let i=0;const parsedLength=parsedTargetsArray.length;parsedTargetsArray.forEach((target=>{const staggeredChildParams={...childParams};this.duration=tlDuration;this.iterationDuration=tlIterationDuration;if(!isUnd(id))staggeredChildParams.id=id+"-"+i;addTlChild(staggeredChildParams,this,staggeredPosition(target,i,parsedLength,this),target,i,parsedLength);i++}))}else{addTlChild(childParams,this,parseTimelinePosition(this,a3),a1)}}else{addTlChild(a1,this,parseTimelinePosition(this,a2))}return this.init(1)}}sync(synced,position){if(isUnd(synced)||synced&&isUnd(synced.pause))return this;synced.pause();const duration=+(synced.effect?synced.effect.getTiming().duration:synced.duration);return this.add(synced,{currentTime:[0,duration],duration:duration,ease:"linear"},position)}set(targets,parameters,position){if(isUnd(parameters))return this;parameters.duration=minValue;parameters.composition=compositionTypes.replace;return this.add(targets,parameters,position)}call(callback,position){if(isUnd(callback)||callback&&!isFnc(callback))return this;return this.add({duration:0,onComplete:()=>callback(this)},position)}label(labelName,position){if(isUnd(labelName)||labelName&&!isStr(labelName))return this;this.labels[labelName]=parseTimelinePosition(this,position);return this}remove(targets,propertyName){remove(targets,this,propertyName);return this}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;const labels=this.labels;forEachChildren(this,(child=>child.stretch(child.duration*timeScale)));for(let labelName in labels)labels[labelName]*=timeScale;return super.stretch(newDuration)}refresh(){forEachChildren(this,(child=>{if(child.refresh)child.refresh()}));return this}revert(){super.revert();forEachChildren(this,(child=>child.revert),true);return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const createTimeline=parameters=>new Timeline(parameters).init();class Animatable{constructor(targets,parameters){if(globals.scope)globals.scope.revertibles.push(this);const globalParams={};const properties={};this.targets=[];this.animations={};if(isUnd(targets)||isUnd(parameters))return;for(let propName in parameters){const paramValue=parameters[propName];if(isKey(propName)){properties[propName]=paramValue}else{globalParams[propName]=paramValue}}for(let propName in properties){const propValue=properties[propName];const isObjValue=isObj(propValue);let propParams={};let to="+=0";if(isObjValue){const unit=propValue.unit;if(isStr(unit))to+=unit}else{propParams.duration=propValue}propParams[propName]=isObjValue?mergeObjects({to:to},propValue):to;const animParams=mergeObjects(globalParams,propParams);animParams.composition=compositionTypes.replace;animParams.autoplay=false;const animation=this.animations[propName]=new JSAnimation(targets,animParams,null,0,false).init();if(!this.targets.length)this.targets.push(...animation.targets);this[propName]=(to,duration,ease)=>{const tween=animation._head;if(isUnd(to)&&tween){const numbers=tween._numbers;if(numbers&&numbers.length){return numbers}else{return tween._modifier(tween._number)}}else{forEachChildren(animation,(tween=>{if(isArr(to)){for(let i=0,l=to.length;i<l;i++){if(!isUnd(tween._numbers[i])){tween._fromNumbers[i]=tween._modifier(tween._numbers[i]);tween._toNumbers[i]=to[i]}}}else{tween._fromNumber=tween._modifier(tween._number);tween._toNumber=to}if(!isUnd(ease))tween._ease=parseEasings(ease);tween._currentTime=0}));if(!isUnd(duration))animation.stretch(duration);animation.reset(1).resume();return this}}}}revert(){for(let propName in this.animations){this[propName]=noop;this.animations[propName].revert()}this.animations={};this.targets.length=0;return this}}const createAnimatable=(targets,parameters)=>new Animatable(targets,parameters);class Spring{constructor(parameters={}){this.timeStep=.02;this.restThreshold=5e-4;this.restDuration=200;this.maxDuration=6e4;this.maxRestSteps=this.restDuration/this.timeStep/K;this.maxIterations=this.maxDuration/this.timeStep/K;this.m=clamp(setValue(parameters.mass,1),0,K);this.s=clamp(setValue(parameters.stiffness,100),1,K);this.d=clamp(setValue(parameters.damping,10),.1,K);this.v=clamp(setValue(parameters.velocity,0),-1e3,K);this.w0=0;this.zeta=0;this.wd=0;this.b=0;this.solverDuration=0;this.duration=0;this.compute();this.ease=t=>t===0||t===1?t:this.solve(t*this.solverDuration)}solve(time){const{zeta:zeta,w0:w0,wd:wd,b:b}=this;let t=time;if(zeta<1){t=exp(-t*zeta*w0)*(1*cos(wd*t)+b*sin(wd*t))}else{t=(1+b*t)*exp(-t*w0)}return 1-t}compute(){const{maxRestSteps:maxRestSteps,maxIterations:maxIterations,restThreshold:restThreshold,timeStep:timeStep,m:m,d:d,s:s,v:v}=this;const w0=this.w0=clamp(sqrt(s/m),minValue,K);const zeta=this.zeta=d/(2*sqrt(s*m));const wd=this.wd=zeta<1?w0*sqrt(1-zeta*zeta):0;this.b=zeta<1?(zeta*w0+-v)/wd:-v+w0;let solverTime=0;let restSteps=0;let iterations=0;while(restSteps<maxRestSteps&&iterations<maxIterations){if(abs(1-this.solve(solverTime))<restThreshold){restSteps++}else{restSteps=0}this.solverDuration=solverTime;solverTime+=timeStep;iterations++}this.duration=round(this.solverDuration*K,0)*globals.timeScale}get mass(){return this.m}set mass(v){this.m=clamp(setValue(v,1),0,K);this.compute()}get stiffness(){return this.s}set stiffness(v){this.s=clamp(setValue(v,100),1,K);this.compute()}get damping(){return this.d}set damping(v){this.d=clamp(setValue(v,10),.1,K);this.compute()}get velocity(){return this.v}set velocity(v){this.v=clamp(setValue(v,0),-1e3,K);this.compute()}}const createSpring=parameters=>new Spring(parameters);const preventDefault=e=>{if(e.cancelable)e.preventDefault()};class DOMProxy{constructor(el){this.el=el;this.zIndex=0;this.parentElement=null;this.classList={add:noop,remove:noop}}get x(){return this.el.x||0}set x(v){this.el.x=v}get y(){return this.el.y||0}set y(v){this.el.y=v}get width(){return this.el.width||0}set width(v){this.el.width=v}get height(){return this.el.height||0}set height(v){this.el.height=v}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Transforms{constructor($el){this.$el=$el;this.inlineTransforms=[];this.point=new DOMPoint;this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(x,y){this.point.x=x;this.point.y=y;return this.point.matrixTransform(this.inversedMatrix)}traverseUp(cb){let $el=this.$el.parentElement,i=0;while($el&&$el!==doc){cb($el,i);$el=$el.parentElement;i++}}getMatrix(){const matrix=new DOMMatrix;this.traverseUp(($el=>{const transformValue=getComputedStyle($el).transform;if(transformValue){const elMatrix=new DOMMatrix(transformValue);matrix.preMultiplySelf(elMatrix)}}));return matrix}remove(){this.traverseUp((($el,i)=>{this.inlineTransforms[i]=$el.style.transform;$el.style.transform="none"}))}revert(){this.traverseUp((($el,i)=>{const ct=this.inlineTransforms[i];if(ct===""){$el.style.removeProperty("transform")}else{$el.style.transform=ct}}))}}const parseDraggableFunctionParameter=(value,draggable)=>value&&isFnc(value)?value(draggable):value;let zIndex=0;class Draggable{constructor(target,parameters={}){if(!target)return;if(globals.scope)globals.scope.revertibles.push(this);const paramX=parameters.x;const paramY=parameters.y;const trigger=parameters.trigger;const modifier=parameters.modifier;const ease=parameters.releaseEase;const customEase=ease&&parseEasings(ease);const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const xProp=isObj(paramX)&&!isUnd(paramX.mapTo)?paramX.mapTo:"translateX";const yProp=isObj(paramY)&&!isUnd(paramY.mapTo)?paramY.mapTo:"translateY";const container=parseDraggableFunctionParameter(parameters.container,this);this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.$target=isObj(target)?new DOMProxy(target):parseTargets(target)[0];this.$trigger=parseTargets(trigger?trigger:target)[0];this.fixed=getTargetValue(this.$target,"position")==="fixed";this.isFinePointer=true;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.maxVelocity=0;this.minVelocity=0;this.velocityMultiplier=0;this.cursor=false;this.releaseXSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseYSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseEase=customEase||eases.outQuint;this.hasReleaseSpring=hasSpring;this.onGrab=parameters.onGrab||noop;this.onDrag=parameters.onDrag||noop;this.onRelease=parameters.onRelease||noop;this.onUpdate=parameters.onUpdate||noop;this.onSettle=parameters.onSettle||noop;this.onSnap=parameters.onSnap||noop;this.onResize=parameters.onResize||noop;this.onAfterResize=parameters.onAfterResize||noop;this.disabled=[0,0];const animatableParams={};if(modifier)animatableParams.modifier=modifier;if(isUnd(paramX)||paramX===true){animatableParams[xProp]=0}else if(isObj(paramX)){const paramXObject=paramX;const animatableXParams={};if(paramXObject.modifier)animatableXParams.modifier=paramXObject.modifier;if(paramXObject.composition)animatableXParams.composition=paramXObject.composition;animatableParams[xProp]=animatableXParams}else if(paramX===false){animatableParams[xProp]=0;this.disabled[0]=1}if(isUnd(paramY)||paramY===true){animatableParams[yProp]=0}else if(isObj(paramY)){const paramYObject=paramY;const animatableYParams={};if(paramYObject.modifier)animatableYParams.modifier=paramYObject.modifier;if(paramYObject.composition)animatableYParams.composition=paramYObject.composition;animatableParams[yProp]=animatableYParams}else if(paramY===false){animatableParams[yProp]=0;this.disabled[1]=1}this.animate=new Animatable(this.$target,animatableParams);this.xProp=xProp;this.yProp=yProp;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=[-1e12,maxValue,maxValue,-1e12];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=now();this.velocity=0;this.angle=0;this.cursorStyles=null;this.triggerStyles=null;this.bodyStyles=null;this.targetStyles=null;this.touchActionStyles=null;this.transforms=new Transforms(this.$target);this.overshootCoords={x:0,y:0};this.overshootXTicker=new Timer({autoplay:false},null,0).init();this.overshootYTicker=new Timer({autoplay:false},null,0).init();this.updateTicker=new Timer({autoplay:false},null,0).init();this.overshootXTicker.onUpdate=()=>{if(this.disabled[0])return;this.updated=true;this.manual=true;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootXTicker.onComplete=()=>{if(this.disabled[0])return;this.manual=false;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootYTicker.onUpdate=()=>{if(this.disabled[1])return;this.updated=true;this.manual=true;this.animate[this.yProp](this.overshootCoords.y,0)};this.overshootYTicker.onComplete=()=>{if(this.disabled[1])return;this.manual=false;this.animate[this.yProp](this.overshootCoords.y,0)};this.updateTicker.onUpdate=()=>this.update();this.contained=!isUnd(container);this.manual=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.enabled=false;this.initialized=false;this.activeProp=this.disabled[1]?xProp:yProp;this.animate.animations[this.activeProp].onRender=()=>{const hasUpdated=this.updated;const hasMoved=this.grabbed&&hasUpdated;const hasReleased=!hasMoved&&this.released;const x=this.x;const y=this.y;const dx=x-this.coords[2];const dy=y-this.coords[3];this.deltaX=dx;this.deltaY=dy;this.coords[2]=x;this.coords[3]=y;if(hasUpdated){this.onUpdate(this)}if(!hasReleased){this.updated=false}else{this.computeVelocity(dx,dy);this.angle=atan2(dy,dx)}};this.animate.animations[this.activeProp].onComplete=()=>{if(!this.grabbed&&this.released){this.released=false}if(!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 Timer({autoplay:false,duration:150*globals.timeScale,onComplete:()=>{this.onResize(this);this.refresh();this.onAfterResize(this)}}).init();this.parameters=parameters;this.resizeObserver=new ResizeObserver((()=>{if(this.initialized){this.resizeTicker.restart()}else{this.initialized=true}}));this.enable();this.refresh();this.resizeObserver.observe(this.$container);if(!isObj(target))this.resizeObserver.observe(this.$target)}computeVelocity(dx,dy){const prevTime=this.velocityTime;const curTime=now();const elapsed=curTime-prevTime;if(elapsed<17)return this.velocity;this.velocityTime=curTime;const velocityStack=this.velocityStack;const vMul=this.velocityMultiplier;const minV=this.minVelocity;const maxV=this.maxVelocity;const vi=this.velocityStackIndex;velocityStack[vi]=round(clamp(sqrt(dx*dx+dy*dy)/elapsed*vMul,minV,maxV),5);const velocity=max(velocityStack[0],velocityStack[1],velocityStack[2]);this.velocity=velocity;this.velocityStackIndex=(vi+1)%3;return velocity}setX(x,muteUpdateCallback=false){if(this.disabled[0])return;const v=round(x,5);this.overshootXTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destX=v;this.snapped[0]=snap(v,this.snapX);this.animate[this.xProp](v,0);this.manual=false;return this}setY(y,muteUpdateCallback=false){if(this.disabled[1])return;const v=round(y,5);this.overshootYTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destY=v;this.snapped[1]=snap(v,this.snapY);this.animate[this.yProp](v,0);this.manual=false;return this}get x(){return round(this.animate[this.xProp](),globals.precision)}set x(x){this.setX(x,false)}get y(){return round(this.animate[this.yProp](),globals.precision)}set y(y){this.setY(y,false)}get progressX(){return mapRange(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(x){this.setX(mapRange(x,0,1,this.containerBounds[3],this.containerBounds[1]),false)}get progressY(){return mapRange(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(y){this.setY(mapRange(y,0,1,this.containerBounds[0],this.containerBounds[2]),false)}updateScrollCoords(){const sx=round(this.useWin?win.scrollX:this.$container.scrollLeft,0);const sy=round(this.useWin?win.scrollY:this.$container.scrollTop,0);const[cpt,cpr,cpb,cpl]=this.containerPadding;const threshold=this.scrollThreshold;this.scroll.x=sx;this.scroll.y=sy;this.scrollBounds[0]=sy-this.targetBounds[0]+cpt-threshold;this.scrollBounds[1]=sx-this.targetBounds[1]-cpr+threshold;this.scrollBounds[2]=sy-this.targetBounds[2]-cpb+threshold;this.scrollBounds[3]=sx-this.targetBounds[3]+cpl-threshold}updateBoundingValues(){const $container=this.$container;const cx=this.x;const cy=this.y;const cx2=this.coords[2];const cy2=this.coords[3];this.coords[2]=0;this.coords[3]=0;this.setX(0,true);this.setY(0,true);this.transforms.remove();const iw=this.window[0]=win.innerWidth;const ih=this.window[1]=win.innerHeight;const uw=this.useWin;const sw=$container.scrollWidth;const sh=$container.scrollHeight;const fx=this.fixed;const transformContainerRect=$container.getBoundingClientRect();const[cpt,cpr,cpb,cpl]=this.containerPadding;this.dragArea[0]=uw?0:transformContainerRect.left;this.dragArea[1]=uw?0:transformContainerRect.top;this.scrollView[0]=uw?clamp(sw,iw,sw):sw;this.scrollView[1]=uw?clamp(sh,ih,sh):sh;this.updateScrollCoords();const{width:width,height:height,left:left,top:top,right:right,bottom:bottom}=$container.getBoundingClientRect();this.dragArea[2]=round(uw?clamp(width,iw,iw):width,0);this.dragArea[3]=round(uw?clamp(height,ih,ih):height,0);const containerOverflow=getTargetValue($container,"overflow");const visibleOverflow=containerOverflow==="visible";const hiddenOverflow=containerOverflow==="hidden";this.canScroll=fx?false:this.contained&&($container===doc.body&&visibleOverflow||!hiddenOverflow&&!visibleOverflow)&&(sw>this.dragArea[2]+cpl-cpr||sh>this.dragArea[3]+cpt-cpb)&&(!this.containerArray||this.containerArray&&!isArr(this.containerArray));if(this.contained){const sx=this.scroll.x;const sy=this.scroll.y;const canScroll=this.canScroll;const targetRect=this.$target.getBoundingClientRect();const hiddenLeft=canScroll?uw?0:$container.scrollLeft:0;const hiddenTop=canScroll?uw?0:$container.scrollTop:0;const hiddenRight=canScroll?this.scrollView[0]-hiddenLeft-width:0;const hiddenBottom=canScroll?this.scrollView[1]-hiddenTop-height:0;this.targetBounds[0]=round(targetRect.top+sy-(uw?0:top),0);this.targetBounds[1]=round(targetRect.right+sx-(uw?iw:right),0);this.targetBounds[2]=round(targetRect.bottom+sy-(uw?ih:bottom),0);this.targetBounds[3]=round(targetRect.left+sx-(uw?0:left),0);if(this.containerArray){this.containerBounds[0]=this.containerArray[0]+cpt;this.containerBounds[1]=this.containerArray[1]-cpr;this.containerBounds[2]=this.containerArray[2]-cpb;this.containerBounds[3]=this.containerArray[3]+cpl}else{this.containerBounds[0]=-round(targetRect.top-(fx?clamp(top,0,ih):top)+hiddenTop-cpt,0);this.containerBounds[1]=-round(targetRect.right-(fx?clamp(right,0,iw):right)-hiddenRight+cpr,0);this.containerBounds[2]=-round(targetRect.bottom-(fx?clamp(bottom,0,ih):bottom)-hiddenBottom+cpb,0);this.containerBounds[3]=-round(targetRect.left-(fx?clamp(left,0,iw):left)+hiddenLeft-cpl,0)}}this.transforms.revert();this.coords[2]=cx2;this.coords[3]=cy2;this.setX(cx,true);this.setY(cy,true)}isOutOfBounds(bounds,x,y){if(!this.contained)return 0;const[bt,br,bb,bl]=bounds;const[dx,dy]=this.disabled;const obx=!dx&&x<bl||!dx&&x>br;const oby=!dy&&y<bt||!dy&&y>bb;return obx&&!oby?1:!obx&&oby?2:obx&&oby?3:0}refresh(){const params=this.parameters;const paramX=params.x;const paramY=params.y;const container=parseDraggableFunctionParameter(params.container,this);const cp=parseDraggableFunctionParameter(params.containerPadding,this)||0;const containerPadding=isArr(cp)?cp:[cp,cp,cp,cp];const cx=this.x;const cy=this.y;const parsedCursorStyles=parseDraggableFunctionParameter(params.cursor,this);const cursorStyles={onHover:"grab",onGrab:"grabbing"};if(parsedCursorStyles){const{onHover:onHover,onGrab:onGrab}=parsedCursorStyles;if(onHover)cursorStyles.onHover=onHover;if(onGrab)cursorStyles.onGrab=onGrab}this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.isFinePointer=matchMedia("(pointer:fine)").matches;this.containerPadding=setValue(containerPadding,[0,0,0,0]);this.containerFriction=clamp(setValue(parseDraggableFunctionParameter(params.containerFriction,this),.8),0,1);this.releaseContainerFriction=clamp(setValue(parseDraggableFunctionParameter(params.releaseContainerFriction,this),this.containerFriction),0,1);this.snapX=parseDraggableFunctionParameter(isObj(paramX)&&!isUnd(paramX.snap)?paramX.snap:params.snap,this);this.snapY=parseDraggableFunctionParameter(isObj(paramY)&&!isUnd(paramY.snap)?paramY.snap:params.snap,this);this.scrollSpeed=setValue(parseDraggableFunctionParameter(params.scrollSpeed,this),1.5);this.scrollThreshold=setValue(parseDraggableFunctionParameter(params.scrollThreshold,this),20);this.dragSpeed=setValue(parseDraggableFunctionParameter(params.dragSpeed,this),1);this.minVelocity=setValue(parseDraggableFunctionParameter(params.minVelocity,this),0);this.maxVelocity=setValue(parseDraggableFunctionParameter(params.maxVelocity,this),50);this.velocityMultiplier=setValue(parseDraggableFunctionParameter(params.velocityMultiplier,this),1);this.cursor=parsedCursorStyles===false?false:cursorStyles;this.updateBoundingValues();const[bt,br,bb,bl]=this.containerBounds;this.setX(clamp(cx,bl,br),true);this.setY(clamp(cy,bt,bb),true)}update(){this.updateScrollCoords();if(this.canScroll){const[cpt,cpr,cpb,cpl]=this.containerPadding;const[sw,sh]=this.scrollView;const daw=this.dragArea[2];const dah=this.dragArea[3];const csx=this.scroll.x;const csy=this.scroll.y;const nsw=this.$container.scrollWidth;const nsh=this.$container.scrollHeight;const csw=this.useWin?clamp(nsw,this.window[0],nsw):nsw;const csh=this.useWin?clamp(nsh,this.window[1],nsh):nsh;const swd=sw-csw;const shd=sh-csh;if(this.dragged&&swd>0){this.coords[0]-=swd;this.scrollView[0]=csw}if(this.dragged&&shd>0){this.coords[1]-=shd;this.scrollView[1]=csh}const s=this.scrollSpeed*10;const threshold=this.scrollThreshold;const[x,y]=this.coords;const[st,sr,sb,sl]=this.scrollBounds;const t=round(clamp((y-st+cpt)/threshold,-1,0)*s,0);const r=round(clamp((x-sr-cpr)/threshold,0,1)*s,0);const b=round(clamp((y-sb-cpb)/threshold,0,1)*s,0);const l=round(clamp((x-sl+cpl)/threshold,-1,0)*s,0);if(t||b||l||r){const[nx,ny]=this.disabled;let scrollX=csx;let scrollY=csy;if(!nx){scrollX=round(clamp(csx+(l||r),0,sw-daw),0);this.coords[0]-=csx-scrollX}if(!ny){scrollY=round(clamp(csy+(t||b),0,sh-dah),0);this.coords[1]-=csy-scrollY}if(this.useWin){this.$scrollContainer.scrollBy(-(csx-scrollX),-(csy-scrollY))}else{this.$scrollContainer.scrollTo(scrollX,scrollY)}}}const[ct,cr,cb,cl]=this.containerBounds;const[px1,py1,px2,py2,px3,py3]=this.pointer;this.coords[0]+=(px1-px3)*this.dragSpeed;this.coords[1]+=(py1-py3)*this.dragSpeed;this.pointer[4]=px1;this.pointer[5]=py1;const[cx,cy]=this.coords;const[sx,sy]=this.snapped;const cf=(1-this.containerFriction)*this.dragSpeed;this.setX(cx>cr?cr+(cx-cr)*cf:cx<cl?cl+(cx-cl)*cf:cx,false);this.setY(cy>cb?cb+(cy-cb)*cf:cy<ct?ct+(cy-ct)*cf:cy,false);this.computeVelocity(px1-px3,py1-py3);this.angle=atan2(py1-py2,px1-px2);const[nsx,nsy]=this.snapped;if(nsx!==sx&&this.snapX||nsy!==sy&&this.snapY){this.onSnap(this)}}stop(){this.updateTicker.pause();this.overshootXTicker.pause();this.overshootYTicker.pause();for(let prop in this.animate.animations)this.animate.animations[prop].pause();remove(this,null,"x");remove(this,null,"y");remove(this,null,"progressX");remove(this,null,"progressY");remove(this.scroll);remove(this.overshootCoords);return this}scrollInView(duration,gap=0,ease=eases.inOutQuad){this.updateScrollCoords();const x=this.destX;const y=this.destY;const scroll=this.scroll;const scrollBounds=this.scrollBounds;const canScroll=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(scrollBounds,x,y)){const[st,sr,sb,sl]=scrollBounds;const t=round(clamp(y-st,-1e12,0),0);const r=round(clamp(x-sr,0,maxValue),0);const b=round(clamp(y-sb,0,maxValue),0);const l=round(clamp(x-sl,-1e12,0),0);new JSAnimation(scroll,{x:round(scroll.x+(l?l-gap:r?r+gap:0),0),y:round(scroll.y+(t?t-gap:b?b+gap:0),0),duration:isUnd(duration)?350*globals.timeScale:duration,ease:ease,onUpdate:()=>{this.canScroll=false;this.$scrollContainer.scrollTo(scroll.x,scroll.y)}}).init().then((()=>{this.canScroll=canScroll}))}return this}handleHover(){if(this.isFinePointer&&this.cursor&&!this.cursorStyles){this.cursorStyles=setTargetValues(this.$trigger,{cursor:this.cursor.onHover})}}animateInView(duration,gap=0,ease=eases.inOutQuad){this.stop();this.updateBoundingValues();const x=this.x;const y=this.y;const[cpt,cpr,cpb,cpl]=this.containerPadding;const bt=this.scroll.y-this.targetBounds[0]+cpt+gap;const br=this.scroll.x-this.targetBounds[1]-cpr-gap;const bb=this.scroll.y-this.targetBounds[2]-cpb-gap;const bl=this.scroll.x-this.targetBounds[3]+cpl+gap;const ob=this.isOutOfBounds([bt,br,bb,bl],x,y);if(ob){const[disabledX,disabledY]=this.disabled;const destX=clamp(snap(x,this.snapX),bl,br);const destY=clamp(snap(y,this.snapY),bt,bb);const dur=isUnd(duration)?350*globals.timeScale:duration;if(!disabledX&&(ob===1||ob===3))this.animate[this.xProp](destX,dur,ease);if(!disabledY&&(ob===2||ob===3))this.animate[this.yProp](destY,dur,ease)}return this}handleDown(e){const $eTarget=e.target;if(this.grabbed||$eTarget.type==="range")return;e.stopPropagation();this.grabbed=true;this.released=false;this.stop();this.updateBoundingValues();const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const[ct,cr,cb,cl]=this.containerBounds;const cf=(1-this.containerFriction)*this.dragSpeed;const cx=this.x;const cy=this.y;this.coords[0]=this.coords[2]=!cf?cx:cx>cr?cr+(cx-cr)/cf:cx<cl?cl+(cx-cl)/cf:cx;this.coords[1]=this.coords[3]=!cf?cy:cy>cb?cb+(cy-cb)/cf:cy<ct?ct+(cy-ct)/cf:cy;this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y;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;if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}const z=getTargetValue(this.$target,"zIndex",false);zIndex=(z>zIndex?z:zIndex)+1;this.targetStyles=setTargetValues(this.$target,{zIndex:zIndex});if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.isFinePointer&&this.cursor){this.bodyStyles=setTargetValues(doc.body,{cursor:this.cursor.onGrab})}this.scrollInView(100,0,eases.out(3));this.onGrab(this);doc.addEventListener("touchmove",this);doc.addEventListener("touchend",this);doc.addEventListener("touchcancel",this);doc.addEventListener("mousemove",this);doc.addEventListener("mouseup",this);doc.addEventListener("selectstart",this)}handleMove(e){if(!this.grabbed)return;const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const movedX=x-this.pointer[6];const movedY=y-this.pointer[7];let $parent=e.target;let isAtTop=false;let isAtBottom=false;let canTouchScroll=false;while(touches&&$parent&&$parent!==this.$trigger){const overflowY=getTargetValue($parent,"overflow-y");if(overflowY!=="hidden"&&overflowY!=="visible"){const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=$parent;if(scrollHeight>clientHeight){canTouchScroll=true;isAtTop=scrollTop<=3;isAtBottom=scrollTop>=scrollHeight-clientHeight-3;break}}$parent=$parent.parentNode}if(canTouchScroll&&(!isAtTop&&!isAtBottom||isAtTop&&movedY<0||isAtBottom&&movedY>0)){this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y}else{preventDefault(e);if(!this.triggerStyles)this.triggerStyles=setTargetValues(this.$trigger,{pointerEvents:"none"});this.$trigger.addEventListener("touchstart",preventDefault,{passive:false});this.$trigger.addEventListener("touchmove",preventDefault,{passive:false});this.$trigger.addEventListener("touchend",preventDefault);if(!this.disabled[0]&&abs(movedX)>3||!this.disabled[1]&&abs(movedY)>3){this.updateTicker.resume();this.pointer[2]=this.pointer[0];this.pointer[3]=this.pointer[1];this.pointer[0]=x;this.pointer[1]=y;this.dragged=true;this.released=false;this.onDrag(this)}}}handleUp(){if(!this.grabbed)return;this.updateTicker.pause();if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}const[disabledX,disabledY]=this.disabled;const[px1,py1,px2,py2,px3,py3]=this.pointer;const[ct,cr,cb,cl]=this.containerBounds;const[sx,sy]=this.snapped;const springX=this.releaseXSpring;const springY=this.releaseYSpring;const releaseEase=this.releaseEase;const hasReleaseSpring=this.hasReleaseSpring;const overshootCoords=this.overshootCoords;const cx=this.x;const cy=this.y;const pv=this.computeVelocity(px1-px3,py1-py3);const pa=this.angle=atan2(py1-py2,px1-px2);const ds=pv*150;const cf=(1-this.releaseContainerFriction)*this.dragSpeed;const nx=cx+cos(pa)*ds;const ny=cy+sin(pa)*ds;const bx=nx>cr?cr+(nx-cr)*cf:nx<cl?cl+(nx-cl)*cf:nx;const by=ny>cb?cb+(ny-cb)*cf:ny<ct?ct+(ny-ct)*cf:ny;const dx=this.destX=clamp(round(snap(bx,this.snapX),5),cl,cr);const dy=this.destY=clamp(round(snap(by,this.snapY),5),ct,cb);const ob=this.isOutOfBounds(this.containerBounds,nx,ny);let durationX=0;let durationY=0;let easeX=releaseEase;let easeY=releaseEase;let longestReleaseDuration=0;overshootCoords.x=cx;overshootCoords.y=cy;if(!disabledX){const directionX=dx===cr?cx>cr?-1:1:cx<cl?-1:1;const distanceX=round(cx-dx,0);springX.velocity=disabledY&&hasReleaseSpring?distanceX?ds*directionX/abs(distanceX):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springX;durationX=cx===dx?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeX=ease;if(durationX>longestReleaseDuration)longestReleaseDuration=durationX}if(!disabledY){const directionY=dy===cb?cy>cb?-1:1:cy<ct?-1:1;const distanceY=round(cy-dy,0);springY.velocity=disabledX&&hasReleaseSpring?distanceY?ds*directionY/abs(distanceY):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springY;durationY=cy===dy?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeY=ease;if(durationY>longestReleaseDuration)longestReleaseDuration=durationY}if(!hasReleaseSpring&&ob&&cf&&(durationX||durationY)){const composition=compositionTypes.blend;new JSAnimation(overshootCoords,{x:{to:bx,duration:durationX*.65},y:{to:by,duration:durationY*.65},ease:releaseEase,composition:composition}).init();new JSAnimation(overshootCoords,{x:{to:dx,duration:durationX},y:{to:dy,duration:durationY},ease:releaseEase,composition:composition}).init();this.overshootXTicker.stretch(durationX).restart();this.overshootYTicker.stretch(durationY).restart()}else{if(!disabledX)this.animate[this.xProp](dx,durationX,easeX);if(!disabledY)this.animate[this.yProp](dy,durationY,easeY)}this.scrollInView(longestReleaseDuration,this.scrollThreshold,releaseEase);let hasSnapped=false;if(dx!==sx){this.snapped[0]=dx;if(this.snapX)hasSnapped=true}if(dy!==sy&&this.snapY){this.snapped[1]=dy;if(this.snapY)hasSnapped=true}if(hasSnapped)this.onSnap(this);this.grabbed=false;this.dragged=false;this.updated=true;this.released=true;this.onRelease(this);this.$trigger.removeEventListener("touchstart",preventDefault);this.$trigger.removeEventListener("touchmove",preventDefault);this.$trigger.removeEventListener("touchend",preventDefault);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this)}reset(){this.stop();this.resizeTicker.pause();this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.setX(0,true);this.setY(0,true);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;return this}enable(){if(!this.enabled){this.enabled=true;this.$target.classList.remove("is-disabled");this.touchActionStyles=setTargetValues(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"});this.$trigger.addEventListener("touchstart",this,{passive:true});this.$trigger.addEventListener("mousedown",this,{passive:true});this.$trigger.addEventListener("mouseenter",this)}return this}disable(){this.enabled=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.touchActionStyles.revert();if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}this.stop();this.$target.classList.add("is-disabled");this.$trigger.removeEventListener("touchstart",this);this.$trigger.removeEventListener("mousedown",this);this.$trigger.removeEventListener("mouseenter",this);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this);return this}revert(){this.reset();this.disable();this.$target.classList.remove("is-disabled");this.updateTicker.revert();this.overshootXTicker.revert();this.overshootYTicker.revert();this.resizeTicker.revert();this.animate.revert();return this}handleEvent(e){switch(e.type){case"mousedown":this.handleDown(e);break;case"touchstart":this.handleDown(e);break;case"mousemove":this.handleMove(e);break;case"touchmove":this.handleMove(e);break;case"mouseup":this.handleUp();break;case"touchend":this.handleUp();break;case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":preventDefault(e);break}}}const createDraggable=(target,parameters)=>new Draggable(target,parameters);class Scope{constructor(parameters={}){if(globals.scope)globals.scope.revertibles.push(this);const rootParam=parameters.root;let root=doc;if(rootParam){root=rootParam.current||rootParam.nativeElement||parseTargets(rootParam)[0]||doc}const scopeDefaults=parameters.defaults;const globalDefault=globals.defaults;const mediaQueries=parameters.mediaQueries;this.defaults=scopeDefaults?mergeObjects(scopeDefaults,globalDefault):globalDefault;this.root=root;this.constructors=[];this.revertConstructors=[];this.revertibles=[];this.methods={};this.matches={};this.mediaQueryLists={};this.data={};if(mediaQueries){for(let mq in mediaQueries){const _mq=win.matchMedia(mediaQueries[mq]);this.mediaQueryLists[mq]=_mq;_mq.addEventListener("change",this)}}}execute(cb){let activeScope=globals.scope;let activeRoot=globals.root;let activeDefaults=globals.defaults;globals.scope=this;globals.root=this.root;globals.defaults=this.defaults;const mqs=this.mediaQueryLists;for(let mq in mqs)this.matches[mq]=mqs[mq].matches;const returned=cb(this);globals.scope=activeScope;globals.root=activeRoot;globals.defaults=activeDefaults;return returned}refresh(){this.execute((()=>{let i=this.revertibles.length;let y=this.revertConstructors.length;while(i--)this.revertibles[i].revert();while(y--)this.revertConstructors[y](this);this.revertibles.length=0;this.revertConstructors.length=0;this.constructors.forEach((constructor=>{const revertConstructor=constructor(this);if(revertConstructor){this.revertConstructors.push(revertConstructor)}}))}));return this}add(a1,a2){if(isFnc(a1)){const constructor=a1;this.constructors.push(constructor);this.execute((()=>{const revertConstructor=constructor(this);if(revertConstructor){this.revertConstructors.push(revertConstructor)}}))}else{this.methods[a1]=(...args)=>this.execute((()=>a2(...args)))}return this}handleEvent(e){switch(e.type){case"change":this.refresh();break}}revert(){const revertibles=this.revertibles;const revertConstructors=this.revertConstructors;const mqs=this.mediaQueryLists;let i=revertibles.length;let y=revertConstructors.length;while(i--)revertibles[i].revert();while(y--)revertConstructors[y](this);for(let mq in mqs)mqs[mq].removeEventListener("change",this);revertibles.length=0;revertConstructors.length=0;this.constructors.length=0;this.matches={};this.methods={};this.mediaQueryLists={};this.data={}}}const createScope=params=>new Scope(params);const getMaxViewHeight=()=>{const $el=document.createElement("div");doc.body.appendChild($el);$el.style.height="100lvh";const height=$el.offsetHeight;doc.body.removeChild($el);return height};const parseScrollObserverFunctionParameter=(value,scroller)=>value&&isFnc(value)?value(scroller):value;const scrollContainers=new Map;class ScrollContainer{constructor($el){this.element=$el;this.useWin=this.element===doc.body;this.winWidth=0;this.winHeight=0;this.width=0;this.height=0;this.left=0;this.top=0;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=false;this.backwardY=false;this.scrollTicker=new Timer({autoplay:false,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const backwards=this.backwardX||this.backwardY;forEachChildren(this,(child=>child.handleScroll()),backwards)},onComplete:()=>this.dataTimer.pause()}).init();this.dataTimer=new Timer({autoplay:false,frameRate:30,onUpdate:self=>{const dt=self.deltaTime;const px=this.prevScrollX;const py=this.prevScrollY;const nx=this.scrollX;const ny=this.scrollY;const dx=px-nx;const dy=py-ny;this.prevScrollX=nx;this.prevScrollY=ny;if(dx)this.backwardX=px>nx;if(dy)this.backwardY=py>ny;this.velocity=round(dt>0?Math.sqrt(dx*dx+dy*dy)/dt:0,5)}}).init();this.resizeTicker=new Timer({autoplay:false,duration:250*globals.timeScale,onComplete:()=>{this.updateWindowBounds();this.refreshScrollObservers();this.handleScroll()}}).init();this.wakeTicker=new Timer({autoplay:false,duration:500*globals.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?win:this.element).addEventListener("scroll",this,false)}updateScrollCoords(){const useWin=this.useWin;const $el=this.element;this.scrollX=round(useWin?win.scrollX:$el.scrollLeft,0);this.scrollY=round(useWin?win.scrollY:$el.scrollTop,0)}updateWindowBounds(){this.winWidth=win.innerWidth;this.winHeight=getMaxViewHeight()}updateBounds(){const style=getComputedStyle(this.element);const $el=this.element;this.scrollWidth=$el.scrollWidth+parseFloat(style.marginLeft)+parseFloat(style.marginRight);this.scrollHeight=$el.scrollHeight+parseFloat(style.marginTop)+parseFloat(style.marginBottom);this.updateWindowBounds();let width,height;if(this.useWin){width=this.winWidth;height=this.winHeight}else{const elRect=$el.getBoundingClientRect();width=elRect.width;height=elRect.height;this.top=elRect.top;this.left=elRect.left}this.width=width;this.height=height}refreshScrollObservers(){forEachChildren(this,(child=>{if(child._debug){child.removeDebug()}}));this.updateBounds();forEachChildren(this,(child=>{child.refresh();if(child._debug){child.debug()}}))}refresh(){this.updateWindowBounds();this.updateBounds();this.refreshScrollObservers();this.handleScroll()}handleScroll(){this.updateScrollCoords();this.wakeTicker.restart()}handleEvent(e){switch(e.type){case"scroll":this.handleScroll();break}}revert(){this.scrollTicker.cancel();this.dataTimer.cancel();this.resizeTicker.cancel();this.wakeTicker.cancel();this.resizeObserver.unobserve(this.element);(this.useWin?win:this.element).removeEventListener("scroll",this);scrollContainers.delete(this.element)}}const registerAndGetScrollContainer=target=>{const $el=target?parseTargets(target)[0]||doc.body:doc.body;let scrollContainer=scrollContainers.get($el);if(!scrollContainer){scrollContainer=new ScrollContainer($el);scrollContainers.set($el,scrollContainer)}return scrollContainer};const convertValueToPx=($el,v,size,under,over)=>{const clampMin=v==="min";const clampMax=v==="max";const value=v==="top"||v==="left"||v==="start"||clampMin?0:v==="bottom"||v==="right"||v==="end"||clampMax?"100%":v==="center"?"50%":v;const{n:n,u:u}=decomposeRawValue(value,decomposedOriginalValue);let px=n;if(u==="%"){px=n/100*size}else if(u){px=convertValueUnit($el,decomposedOriginalValue,"px",true).n}if(clampMax&&under<0)px+=under;if(clampMin&&over>0)px+=over;return px};const parseBoundValue=($el,v,size,under,over)=>{let value;if(isStr(v)){const matchedOperator=relativeValuesExecRgx.exec(v);if(matchedOperator){const splitter=matchedOperator[0];const operator=splitter[0];const splitted=v.split(splitter);const clampMin=splitted[0]==="min";const clampMax=splitted[0]==="max";const valueAPx=convertValueToPx($el,splitted[0],size,under,over);const valueBPx=convertValueToPx($el,splitted[1],size,under,over);if(clampMin){const min=getRelativeValue(convertValueToPx($el,"min",size),valueBPx,operator);value=min<valueAPx?valueAPx:min}else if(clampMax){const max=getRelativeValue(convertValueToPx($el,"max",size),valueBPx,operator);value=max>valueAPx?valueAPx:max}else{value=getRelativeValue(valueAPx,valueBPx,operator)}}else{value=convertValueToPx($el,v,size,under,over)}}else{value=v}return round(value,0)};const getAnimationDomTarget=linked=>{let $linkedTarget;const linkedTargets=linked.targets;for(let i=0,l=linkedTargets.length;i<l;i++){const target=linkedTargets[i];if(target[isDomSymbol]){$linkedTarget=target;break}}return $linkedTarget};let scrollerIndex=0;const debugColors=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ScrollObserver{constructor(parameters={}){if(globals.scope)globals.scope.revertibles.push(this);const syncMode=setValue(parameters.sync,"play pause");const ease=syncMode?parseEasings(syncMode):null;const isLinear=syncMode&&(syncMode==="linear"||syncMode===none);const isEase=syncMode&&!(ease===none&&!isLinear);const isSmooth=syncMode&&(isNum(syncMode)||syncMode===true||isLinear);const isMethods=syncMode&&(isStr(syncMode)&&!isEase&&!isSmooth);const syncMethods=isMethods?syncMode.split(" ").map((m=>()=>{const linked=this.linked;return linked&&linked[m]?linked[m]():null})):null;const biDirSync=isMethods&&syncMethods.length>2;this.index=scrollerIndex++;this.id=!isUnd(parameters.id)?parameters.id:this.index;this.container=registerAndGetScrollContainer(parameters.container);this.target=null;this.linked=null;this.repeat=null;this.horizontal=null;this.enter=null;this.leave=null;this.sync=isEase||isSmooth||!!syncMethods;this.syncEase=isEase?ease:null;this.syncSmooth=isSmooth?syncMode===true||isLinear?1:syncMode:null;this.onSyncEnter=syncMethods&&!biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeave=syncMethods&&!biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterForward=syncMethods&&biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeaveForward=syncMethods&&biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterBackward=syncMethods&&biDirSync&&syncMethods[2]?syncMethods[2]:noop;this.onSyncLeaveBackward=syncMethods&&biDirSync&&syncMethods[3]?syncMethods[3]:noop;this.onEnter=parameters.onEnter||noop;this.onLeave=parameters.onLeave||noop;this.onEnterForward=parameters.onEnterForward||noop;this.onLeaveForward=parameters.onLeaveForward||noop;this.onEnterBackward=parameters.onEnterBackward||noop;this.onLeaveBackward=parameters.onLeaveBackward||noop;this.onUpdate=parameters.onUpdate||noop;this.onSyncComplete=parameters.onSyncComplete||noop;this.reverted=false;this.completed=false;this.began=false;this.isInView=false;this.forceEnter=false;this.hasEntered=false;this.offsets=[];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=parameters;this._debug=setValue(parameters.debug,false);this._next=null;this._prev=null;addChild(this.container,this);sync((()=>{if(this.reverted)return;if(!this.target){const target=parseTargets(parameters.target)[0];this.target=target||doc.body;this.refresh()}if(this._debug)this.debug()}))}link(linked){if(linked){linked.pause();this.linked=linked;if(!this._params.target){let $linkedTarget;if(!isUnd(linked.targets)){$linkedTarget=getAnimationDomTarget(linked)}else{forEachChildren(linked,(child=>{if(child.targets&&!$linkedTarget){$linkedTarget=getAnimationDomTarget(child)}}))}this.target=$linkedTarget||doc.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 p=(this.scroll-this.offsetStart)/this.distance;return p===Infinity||isNaN(p)?0:round(clamp(p,0,1),6)}refresh(){this.reverted=false;const params=this._params;this.repeat=setValue(parseScrollObserverFunctionParameter(params.repeat,this),true);this.horizontal=setValue(parseScrollObserverFunctionParameter(params.axis,this),"y")==="x";this.enter=setValue(parseScrollObserverFunctionParameter(params.enter,this),"end start");this.leave=setValue(parseScrollObserverFunctionParameter(params.leave,this),"start end");this.updateBounds();this.handleScroll();return this}removeDebug(){if(this.$debug){this.$debug.parentNode.removeChild(this.$debug);this.$debug=null}if(this.debugStyles){this.debugStyles.revert();this.$debug=null}return this}debug(){this.removeDebug();const container=this.container;const isHori=this.horizontal;const $existingDebug=container.element.querySelector(":scope > .animejs-onscroll-debug");const $debug=doc.createElement("div");const $thresholds=doc.createElement("div");const $triggers=doc.createElement("div");const color=debugColors[this.index%debugColors.length];const useWin=container.useWin;const containerWidth=useWin?container.winWidth:container.width;const containerHeight=useWin?container.winHeight:container.height;const scrollWidth=container.scrollWidth;const scrollHeight=container.scrollHeight;const size=this.container.width>360?320:260;const offLeft=isHori?0:10;const offTop=isHori?10:0;const half=isHori?24:size/2;const labelHeight=isHori?half:15;const labelWidth=isHori?60:half;const labelSize=isHori?labelWidth:labelHeight;const repeat=isHori?"repeat-x":"repeat-y";const gradientOffset=v=>isHori?"0px "+v+"px":v+"px"+" 2px";const lineCSS=c=>`linear-gradient(${isHori?90:0}deg, ${c} 2px, transparent 1px)`;const baseCSS=(p,l,t,w,h)=>`position:${p};left:${l}px;top:${t}px;width:${w}px;height:${h}px;`;$debug.style.cssText=`${baseCSS("absolute",offLeft,offTop,isHori?scrollWidth:size,isHori?size:scrollHeight)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `;$thresholds.style.cssText=`${baseCSS("sticky",0,0,isHori?containerWidth:half,isHori?half:containerHeight)}`;if(!$existingDebug){$thresholds.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(half-10)} / ${isHori?"100px 100px":"100px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(half-10)} / ${isHori?"10px 10px":"10px 10px"} ${repeat};\n `}$triggers.style.cssText=`${baseCSS("relative",0,0,isHori?scrollWidth:half,isHori?half:scrollHeight)}`;if(!$existingDebug){$triggers.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(0)} / ${isHori?"100px 10px":"10px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(0)} / ${isHori?"10px 0px":"0px 10px"} ${repeat};\n `}const labels=[" enter: "," leave: "];this.coords.forEach(((v,i)=>{const isView=i>1;const value=(isView?0:this.offset)+v;const isTail=i%2;const isFirst=value<labelSize;const isOver=value>(isView?isHori?containerWidth:containerHeight:isHori?scrollWidth:scrollHeight)-labelSize;const isFlip=(isView?isTail&&!isFirst:!isTail&&!isFirst)||isOver;const $label=doc.createElement("div");const $text=doc.createElement("div");const dirProp=isHori?isFlip?"right":"left":isFlip?"bottom":"top";const flipOffset=isFlip?(isHori?labelWidth:labelHeight)+(!isView?isHori?-1:-2:isHori?-1:isOver?0:-2):!isView?isHori?1:0:isHori?1:0;$text.innerHTML=`${this.id}${labels[isTail]}${this.thresholds[i]}`;$label.style.cssText=`${baseCSS("absolute",0,0,labelWidth,labelHeight)}\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n justify-content: flex-${isView?"start":"end"};\n align-items: flex-${isFlip?"end":"start"};\n border-${dirProp}: 2px ${isTail?"solid":"solid"} ${color};\n `;$text.style.cssText=`\n overflow: hidden;\n max-width: ${size/2-10}px;\n height: ${labelHeight};\n margin-${isHori?isFlip?"right":"left":isFlip?"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: ${isHori&&isFlip||!isHori&&!isView?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${isTail?color:"rgba(0,0,0,.75)"};\n background-color: ${isTail?"rgba(0,0,0,.65)":color};\n border: 2px solid ${isTail?color:"transparent"};\n border-${isHori?isFlip?"top-left":"top-right":isFlip?"top-left":"bottom-left"}-radius: 5px;\n border-${isHori?isFlip?"bottom-left":"bottom-right":isFlip?"top-right":"bottom-right"}-radius: 5px;\n `;$label.appendChild($text);let position=value-flipOffset+(isHori?1:0);$label.style[isHori?"left":"top"]=`${position}px`;(isView?$thresholds:$triggers).appendChild($label)}));$debug.appendChild($thresholds);$debug.appendChild($triggers);container.element.appendChild($debug);if(!$existingDebug)$debug.classList.add("animejs-onscroll-debug");this.$debug=$debug;const containerPosition=getTargetValue(container.element,"position");if(containerPosition==="static"){this.debugStyles=setTargetValues(container.element,{position:"relative "})}}updateBounds(){if(this._debug){this.removeDebug()}let stickys;const $target=this.target;const container=this.container;const isHori=this.horizontal;const linked=this.linked;let linkedTime;let $el=$target;let offsetX=0;let offsetY=0;let $offsetParent=$el;if(linked){linkedTime=linked.currentTime;linked.seek(0,true)}const isContainerStatic=getTargetValue(container.element,"position")==="static"?setTargetValues(container.element,{position:"relative "}):false;while($el&&$el!==container.element&&$el!==doc.body){const isSticky=getTargetValue($el,"position")==="sticky"?setTargetValues($el,{position:"static"}):false;if($el===$offsetParent){offsetX+=$el.offsetLeft||0;offsetY+=$el.offsetTop||0;$offsetParent=$el.offsetParent}$el=$el.parentElement;if(isSticky){if(!stickys)stickys=[];stickys.push(isSticky)}}if(isContainerStatic)isContainerStatic.revert();const offset=isHori?offsetX:offsetY;const targetSize=isHori?$target.offsetWidth:$target.offsetHeight;const containerSize=isHori?container.width:container.height;const scrollSize=isHori?container.scrollWidth:container.scrollHeight;const maxScroll=scrollSize-containerSize;const enter=this.enter;const leave=this.leave;let enterTarget="start";let leaveTarget="end";let enterContainer="end";let leaveContainer="start";if(isStr(enter)){const splitted=enter.split(" ");enterContainer=splitted[0];enterTarget=splitted.length>1?splitted[1]:enterTarget}else if(isObj(enter)){const e=enter;if(!isUnd(e.container))enterContainer=e.container;if(!isUnd(e.target))enterTarget=e.target}else if(isNum(enter)){enterContainer=enter}if(isStr(leave)){const splitted=leave.split(" ");leaveContainer=splitted[0];leaveTarget=splitted.length>1?splitted[1]:leaveTarget}else if(isObj(leave)){const t=leave;if(!isUnd(t.container))leaveContainer=t.container;if(!isUnd(t.target))leaveTarget=t.target}else if(isNum(leave)){leaveContainer=leave}const parsedEnterTarget=parseBoundValue($target,enterTarget,targetSize);const parsedLeaveTarget=parseBoundValue($target,leaveTarget,targetSize);const under=parsedEnterTarget+offset-containerSize;const over=parsedLeaveTarget+offset-maxScroll;const parsedEnterContainer=parseBoundValue($target,enterContainer,containerSize,under,over);const parsedLeaveContainer=parseBoundValue($target,leaveContainer,containerSize,under,over);const offsetStart=parsedEnterTarget+offset-parsedEnterContainer;const offsetEnd=parsedLeaveTarget+offset-parsedLeaveContainer;const scrollDelta=offsetEnd-offsetStart;this.offsets[0]=offsetX;this.offsets[1]=offsetY;this.offset=offset;this.offsetStart=offsetStart;this.offsetEnd=offsetEnd;this.distance=scrollDelta<=0?0:scrollDelta;this.thresholds=[enterTarget,leaveTarget,enterContainer,leaveContainer];this.coords=[parsedEnterTarget,parsedLeaveTarget,parsedEnterContainer,parsedLeaveContainer];if(stickys){stickys.forEach((sticky=>sticky.revert()))}if(linked){linked.seek(linkedTime,true)}if(this._debug){this.debug()}}handleScroll(){const linked=this.linked;const sync=this.sync;const syncEase=this.syncEase;const syncSmooth=this.syncSmooth;const shouldSeek=linked&&(syncEase||syncSmooth);const isHori=this.horizontal;const container=this.container;const scroll=this.scroll;const isBefore=scroll<=this.offsetStart;const isAfter=scroll>=this.offsetEnd;const isInView=!isBefore&&!isAfter;const isOnTheEdge=scroll===this.offsetStart||scroll===this.offsetEnd;const forceEnter=!this.hasEntered&&isOnTheEdge;const $debug=this._debug&&this.$debug;let hasUpdated=false;let syncCompleted=false;let p=this.progress;if(isBefore&&this.began){this.began=false}if(p>0&&!this.began){this.began=true}if(shouldSeek){const lp=linked.progress;if(syncSmooth&&isNum(syncSmooth)){if(syncSmooth<1){const step=1e-4;const snap=lp<p&&p===1?step:lp>p&&!p?-1e-4:0;p=round(lerp(lp,p,interpolate(.01,.2,syncSmooth),false)+snap,6)}}else if(syncEase){p=syncEase(p)}hasUpdated=p!==this.prevProgress;syncCompleted=lp===1;if(hasUpdated&&!syncCompleted&&(syncSmooth&&lp)){container.wakeTicker.restart()}}if($debug){const sticky=isHori?container.scrollY:container.scrollX;$debug.style[isHori?"top":"left"]=sticky+10+"px"}if(isInView&&!this.isInView||forceEnter&&!this.forceEnter&&!this.hasEntered){if(isInView)this.isInView=true;if(!this.forceEnter||!this.hasEntered){if($debug&&isInView)$debug.style.zIndex=`${this.container.zIndex++}`;this.onSyncEnter(this);this.onEnter(this);if(this.backward){this.onSyncEnterBackward(this);this.onEnterBackward(this)}else{this.onSyncEnterForward(this);this.onEnterForward(this)}this.hasEntered=true;if(forceEnter)this.forceEnter=true}else if(isInView){this.forceEnter=false}}if(isInView||!isInView&&this.isInView){hasUpdated=true}if(hasUpdated){if(shouldSeek)linked.seek(linked.duration*p);this.onUpdate(this)}if(!isInView&&this.isInView){this.isInView=false;this.onSyncLeave(this);this.onLeave(this);if(this.backward){this.onSyncLeaveBackward(this);this.onLeaveBackward(this)}else{this.onSyncLeaveForward(this);this.onLeaveForward(this)}if(sync&&!syncSmooth){syncCompleted=true}}if(p>=1&&this.began&&!this.completed&&(sync&&syncCompleted||!sync)){if(sync){this.onSyncComplete(this)}this.completed=true;if(!this.repeat&&!linked||!this.repeat&&linked&&linked.completed){this.revert()}}if(p<1&&this.completed){this.completed=false}this.prevProgress=p}revert(){if(this.reverted)return;const container=this.container;removeChild(container,this);if(!container._head){container.revert()}if(this._debug){this.removeDebug()}this.reverted=true;return this}}const onScroll=(parameters={})=>new ScrollObserver(parameters);const stagger=(val,params={})=>{let values=[];let maxValue=0;const from=params.from;const reversed=params.reversed;const ease=params.ease;const hasEasing=!isUnd(ease);const hasSpring=hasEasing&&!isUnd(ease.ease);const staggerEase=hasSpring?ease.ease:hasEasing?parseEasings(ease):null;const grid=params.grid;const axis=params.axis;const fromFirst=isUnd(from)||from===0||from==="first";const fromCenter=from==="center";const fromLast=from==="last";const isRange=isArr(val);const val1=isRange?parseNumber(val[0]):parseNumber(val);const val2=isRange?parseNumber(val[1]):0;const unitMatch=unitsExecRgx.exec((isRange?val[1]:val)+emptyString);const start=params.start||0+(isRange?val1:0);let fromIndex=fromFirst?0:isNum(from)?from:0;return(_,i,t,tl)=>{if(fromCenter)fromIndex=(t-1)/2;if(fromLast)fromIndex=t-1;if(!values.length){for(let index=0;index<t;index++){if(!grid){values.push(abs(fromIndex-index))}else{const fromX=!fromCenter?fromIndex%grid[0]:(grid[0]-1)/2;const fromY=!fromCenter?floor(fromIndex/grid[0]):(grid[1]-1)/2;const toX=index%grid[0];const toY=floor(index/grid[0]);const distanceX=fromX-toX;const distanceY=fromY-toY;let value=sqrt(distanceX*distanceX+distanceY*distanceY);if(axis==="x")value=-distanceX;if(axis==="y")value=-distanceY;values.push(value)}maxValue=max(...values)}if(staggerEase)values=values.map((val=>staggerEase(val/maxValue)*maxValue));if(reversed)values=values.map((val=>axis?val<0?val*-1:-val:abs(maxValue-val)))}const spacing=isRange?(val2-val1)/maxValue:val1;const offset=tl?parseTimelinePosition(tl,isUnd(params.start)?tl.iterationDuration:start):start;let output=offset+(spacing*round(values[i],2)||0);if(params.modifier)output=params.modifier(output);if(unitMatch)output=`${output}${unitMatch[2]}`;return output}};exports.Animatable=Animatable;exports.Draggable=Draggable;exports.JSAnimation=JSAnimation;exports.Scope=Scope;exports.ScrollObserver=ScrollObserver;exports.Spring=Spring;exports.Timeline=Timeline;exports.Timer=Timer;exports.WAAPIAnimation=WAAPIAnimation;exports.animate=animate;exports.createAnimatable=createAnimatable;exports.createDraggable=createDraggable;exports.createScope=createScope;exports.createSpring=createSpring;exports.createTimeline=createTimeline;exports.createTimer=createTimer;exports.eases=eases;exports.engine=engine;exports.onScroll=onScroll;exports.scrollContainers=scrollContainers;exports.stagger=stagger;exports.svg=svg;exports.utils=utils;exports.waapi=waapi;return exports}({});
+var anime=function(exports){"use strict";const isBrowser=typeof window!=="undefined";const win=isBrowser?window:null;const doc=isBrowser?document:null;const tweenTypes={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4};const valueTypes={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3};const tickModes={NONE:0,AUTO:1,FORCE:2};const compositionTypes={replace:0,none:1,blend:2};const isRegisteredTargetSymbol=Symbol();const isDomSymbol=Symbol();const isSvgSymbol=Symbol();const transformsSymbol=Symbol();const morphPointsSymbol=Symbol();const proxyTargetSymbol=Symbol();const minValue=1e-11;const maxValue=1e12;const K=1e3;const maxFps=120;const emptyString="";const shortTransforms=(()=>{const map=new Map;map.set("x","translateX");map.set("y","translateY");map.set("z","translateZ");return map})();const validTransforms=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"];const transformsFragmentStrings=validTransforms.reduce(((a,v)=>({...a,[v]:v+"("})),{});const noop=()=>{};const hexTestRgx=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;const rgbExecRgx=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;const rgbaExecRgx=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const hslExecRgx=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;const hslaExecRgx=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const digitWithExponentRgx=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;const unitsExecRgx=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx=/([a-z])([A-Z])/g;const transformsExecRgx=/(\w+)(\([^)]+\)+)/g;const relativeValuesExecRgx=/(\*=|\+=|-=)/;const defaults={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:maxFps,loop:0,reversed:false,alternate:false,autoplay:true,duration:K,delay:0,loopDelay:0,ease:"out(2)",composition:compositionTypes.replace,modifier:v=>v,onBegin:noop,onBeforeUpdate:noop,onUpdate:noop,onLoop:noop,onPause:noop,onComplete:noop,onRender:noop};const scope={current:null,root:doc};const globals={defaults:defaults,precision:4,timeScale:1,tickThreshold:200};const globalVersions={version:"4.1.0",engine:null};if(isBrowser){if(!win.AnimeJS)win.AnimeJS=[];win.AnimeJS.push(globalVersions)}const toLowerCase=str=>str.replace(lowerCaseRgx,"$1-$2").toLowerCase();const stringStartsWith=(str,sub)=>str.indexOf(sub)===0;const now=Date.now;const isArr=Array.isArray;const isObj=a=>a&&a.constructor===Object;const isNum=a=>typeof a==="number"&&!isNaN(a);const isStr=a=>typeof a==="string";const isFnc=a=>typeof a==="function";const isUnd=a=>typeof a==="undefined";const isNil=a=>isUnd(a)||a===null;const isSvg=a=>isBrowser&&a instanceof SVGElement;const isHex=a=>hexTestRgx.test(a);const isRgb=a=>stringStartsWith(a,"rgb");const isHsl=a=>stringStartsWith(a,"hsl");const isCol=a=>isHex(a)||isRgb(a)||isHsl(a);const isKey=a=>!globals.defaults.hasOwnProperty(a);const parseNumber=str=>isStr(str)?parseFloat(str):str;const pow=Math.pow;const sqrt=Math.sqrt;const sin=Math.sin;const cos=Math.cos;const abs=Math.abs;const exp=Math.exp;const ceil=Math.ceil;const floor=Math.floor;const asin=Math.asin;const max=Math.max;const atan2=Math.atan2;const PI=Math.PI;const _round=Math.round;const clamp=(v,min,max)=>v<min?min:v>max?max:v;const powCache={};const round=(v,decimalLength)=>{if(decimalLength<0)return v;if(!decimalLength)return _round(v);let p=powCache[decimalLength];if(!p)p=powCache[decimalLength]=10**decimalLength;return _round(v*p)/p};const snap=(v,increment)=>isArr(increment)?increment.reduce(((closest,cv)=>abs(cv-v)<abs(closest-v)?cv:closest)):increment?_round(v/increment)*increment:v;const interpolate=(start,end,progress)=>start+(end-start)*progress;const random=(min,max,decimalLength)=>{const m=10**(decimalLength||0);return floor((Math.random()*(max-min+1/m)+min)*m)/m};const shuffle=items=>{let m=items.length,t,i;while(m){i=random(0,--m);t=items[m];items[m]=items[i];items[i]=t}return items};const clampInfinity=v=>v===Infinity?maxValue:v===-Infinity?-1e12:v;const normalizeTime=v=>v<=minValue?minValue:clampInfinity(round(v,11));const cloneArray=a=>isArr(a)?[...a]:a;const mergeObjects=(o1,o2)=>{const merged={...o1};for(let p in o2){const o1p=o1[p];merged[p]=isUnd(o1p)?o2[p]:o1p}return merged};const forEachChildren=(parent,callback,reverse,prevProp="_prev",nextProp="_next")=>{let next=parent._head;let adjustedNextProp=nextProp;if(reverse){next=parent._tail;adjustedNextProp=prevProp}while(next){const currentNext=next[adjustedNextProp];callback(next);next=currentNext}};const removeChild=(parent,child,prevProp="_prev",nextProp="_next")=>{const prev=child[prevProp];const next=child[nextProp];prev?prev[nextProp]=next:parent._head=next;next?next[prevProp]=prev:parent._tail=prev;child[prevProp]=null;child[nextProp]=null};const addChild=(parent,child,sortMethod,prevProp="_prev",nextProp="_next")=>{let prev=parent._tail;while(prev&&sortMethod&&sortMethod(prev,child))prev=prev[prevProp];const next=prev?prev[nextProp]:parent._head;prev?prev[nextProp]=child:parent._head=child;next?next[prevProp]=child:parent._tail=child;child[prevProp]=prev;child[nextProp]=next};const createRefreshable=constructor=>{let tracked;return(...args)=>{let currentIteration,currentIterationProgress,reversed,alternate;if(tracked){currentIteration=tracked.currentIteration;currentIterationProgress=tracked.iterationProgress;reversed=tracked.reversed;alternate=tracked._alternate;tracked.revert()}const cleanup=constructor(...args);if(cleanup&&!isFnc(cleanup)&&cleanup.revert)tracked=cleanup;if(!isUnd(currentIterationProgress)){tracked.currentIteration=currentIteration;tracked.iterationProgress=(alternate?!(currentIteration%2)?reversed:!reversed:reversed)?1-currentIterationProgress:currentIterationProgress}return cleanup||noop}};class Clock{constructor(initTime=0){this.deltaTime=0;this._currentTime=initTime;this._elapsedTime=initTime;this._startTime=initTime;this._lastTime=initTime;this._scheduledTime=0;this._frameDuration=round(K/maxFps,0);this._fps=maxFps;this._speed=1;this._hasChildren=false;this._head=null;this._tail=null}get fps(){return this._fps}set fps(frameRate){const previousFrameDuration=this._frameDuration;const fr=+frameRate;const fps=fr<minValue?minValue:fr;const frameDuration=round(K/fps,0);this._fps=fps;this._frameDuration=frameDuration;this._scheduledTime+=frameDuration-previousFrameDuration}get speed(){return this._speed}set speed(playbackRate){const pbr=+playbackRate;this._speed=pbr<minValue?minValue:pbr}requestTick(time){const scheduledTime=this._scheduledTime;const elapsedTime=this._elapsedTime;this._elapsedTime+=time-elapsedTime;if(elapsedTime<scheduledTime)return tickModes.NONE;const frameDuration=this._frameDuration;const frameDelta=elapsedTime-scheduledTime;this._scheduledTime+=frameDelta<frameDuration?frameDuration:frameDelta;return tickModes.AUTO}computeDeltaTime(time){const delta=time-this._lastTime;this.deltaTime=delta;this._lastTime=time;return delta}}const render=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const parent=tickable.parent;const duration=tickable.duration;const completed=tickable.completed;const iterationDuration=tickable.iterationDuration;const iterationCount=tickable.iterationCount;const _currentIteration=tickable._currentIteration;const _loopDelay=tickable._loopDelay;const _reversed=tickable._reversed;const _alternate=tickable._alternate;const _hasChildren=tickable._hasChildren;const tickableDelay=tickable._delay;const tickablePrevAbsoluteTime=tickable._currentTime;const tickableEndTime=tickableDelay+iterationDuration;const tickableAbsoluteTime=time-tickableDelay;const tickablePrevTime=clamp(tickablePrevAbsoluteTime,-tickableDelay,duration);const tickableCurrentTime=clamp(tickableAbsoluteTime,-tickableDelay,duration);const deltaTime=tickableAbsoluteTime-tickablePrevAbsoluteTime;const isCurrentTimeAboveZero=tickableCurrentTime>0;const isCurrentTimeEqualOrAboveDuration=tickableCurrentTime>=duration;const isSetter=duration<=minValue;const forcedTick=tickMode===tickModes.FORCE;let isOdd=0;let iterationElapsedTime=tickableAbsoluteTime;let hasRendered=0;if(iterationCount>1){const currentIteration=~~(tickableCurrentTime/(iterationDuration+(isCurrentTimeEqualOrAboveDuration?0:_loopDelay)));tickable._currentIteration=clamp(currentIteration,0,iterationCount);if(isCurrentTimeEqualOrAboveDuration)tickable._currentIteration--;isOdd=tickable._currentIteration%2;iterationElapsedTime=tickableCurrentTime%(iterationDuration+_loopDelay)||0}const isReversed=_reversed^(_alternate&&isOdd);const _ease=tickable._ease;let iterationTime=isCurrentTimeEqualOrAboveDuration?isReversed?0:duration:isReversed?iterationDuration-iterationElapsedTime:iterationElapsedTime;if(_ease)iterationTime=iterationDuration*_ease(iterationTime/iterationDuration)||0;const isRunningBackwards=(parent?parent.backwards:tickableAbsoluteTime<tickablePrevAbsoluteTime)?!isReversed:!!isReversed;tickable._currentTime=tickableAbsoluteTime;tickable._iterationTime=iterationTime;tickable.backwards=isRunningBackwards;if(isCurrentTimeAboveZero&&!tickable.began){tickable.began=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onBegin(tickable)}}else if(tickableAbsoluteTime<=0){tickable.began=false}if(!muteCallbacks&&!_hasChildren&&isCurrentTimeAboveZero&&tickable._currentIteration!==_currentIteration){tickable.onLoop(tickable)}if(forcedTick||tickMode===tickModes.AUTO&&(time>=tickableDelay&&time<=tickableEndTime||time<=tickableDelay&&tickablePrevTime>tickableDelay||time>=tickableEndTime&&tickablePrevTime!==duration)||iterationTime>=tickableEndTime&&tickablePrevTime!==duration||iterationTime<=tickableDelay&&tickablePrevTime>0||time<=tickablePrevTime&&tickablePrevTime===duration&&completed||isCurrentTimeEqualOrAboveDuration&&!completed&&isSetter){if(isCurrentTimeAboveZero){tickable.computeDeltaTime(tickablePrevTime);if(!muteCallbacks)tickable.onBeforeUpdate(tickable)}if(!_hasChildren){const forcedRender=forcedTick||(isRunningBackwards?deltaTime*-1:deltaTime)>=globals.tickThreshold;const absoluteTime=tickable._offset+(parent?parent._offset:0)+tickableDelay+iterationTime;let tween=tickable._head;let tweenTarget;let tweenStyle;let tweenTargetTransforms;let tweenTargetTransformsProperties;let tweenTransformsNeedUpdate=0;while(tween){const tweenComposition=tween._composition;const tweenCurrentTime=tween._currentTime;const tweenChangeDuration=tween._changeDuration;const tweenAbsEndTime=tween._absoluteStartTime+tween._changeDuration;const tweenNextRep=tween._nextRep;const tweenPrevRep=tween._prevRep;const tweenHasComposition=tweenComposition!==compositionTypes.none;if((forcedRender||(tweenCurrentTime!==tweenChangeDuration||absoluteTime<=tweenAbsEndTime+(tweenNextRep?tweenNextRep._delay:0))&&(tweenCurrentTime!==0||absoluteTime>=tween._absoluteStartTime))&&(!tweenHasComposition||!tween._isOverridden&&(!tween._isOverlapped||absoluteTime<=tweenAbsEndTime)&&(!tweenNextRep||(tweenNextRep._isOverridden||absoluteTime<=tweenNextRep._absoluteStartTime))&&(!tweenPrevRep||(tweenPrevRep._isOverridden||absoluteTime>=tweenPrevRep._absoluteStartTime+tweenPrevRep._changeDuration+tween._delay)))){const tweenNewTime=tween._currentTime=clamp(iterationTime-tween._startTime,0,tweenChangeDuration);const tweenProgress=tween._ease(tweenNewTime/tween._updateDuration);const tweenModifier=tween._modifier;const tweenValueType=tween._valueType;const tweenType=tween._tweenType;const tweenIsObject=tweenType===tweenTypes.OBJECT;const tweenIsNumber=tweenValueType===valueTypes.NUMBER;const tweenPrecision=tweenIsNumber&&tweenIsObject||tweenProgress===0||tweenProgress===1?-1:globals.precision;let value;let number;if(tweenIsNumber){value=number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision))}else if(tweenValueType===valueTypes.UNIT){number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision));value=`${number}${tween._unit}`}else if(tweenValueType===valueTypes.COLOR){const fn=tween._fromNumbers;const tn=tween._toNumbers;const r=round(clamp(tweenModifier(interpolate(fn[0],tn[0],tweenProgress)),0,255),0);const g=round(clamp(tweenModifier(interpolate(fn[1],tn[1],tweenProgress)),0,255),0);const b=round(clamp(tweenModifier(interpolate(fn[2],tn[2],tweenProgress)),0,255),0);const a=clamp(tweenModifier(round(interpolate(fn[3],tn[3],tweenProgress),tweenPrecision)),0,1);value=`rgba(${r},${g},${b},${a})`;if(tweenHasComposition){const ns=tween._numbers;ns[0]=r;ns[1]=g;ns[2]=b;ns[3]=a}}else if(tweenValueType===valueTypes.COMPLEX){value=tween._strings[0];for(let j=0,l=tween._toNumbers.length;j<l;j++){const n=tweenModifier(round(interpolate(tween._fromNumbers[j],tween._toNumbers[j],tweenProgress),tweenPrecision));const s=tween._strings[j+1];value+=`${s?n+s:n}`;if(tweenHasComposition){tween._numbers[j]=n}}}if(tweenHasComposition){tween._number=number}if(!internalRender&&tweenComposition!==compositionTypes.blend){const tweenProperty=tween.property;tweenTarget=tween.target;if(tweenIsObject){tweenTarget[tweenProperty]=value}else if(tweenType===tweenTypes.ATTRIBUTE){tweenTarget.setAttribute(tweenProperty,value)}else{tweenStyle=tweenTarget.style;if(tweenType===tweenTypes.TRANSFORM){if(tweenTarget!==tweenTargetTransforms){tweenTargetTransforms=tweenTarget;tweenTargetTransformsProperties=tweenTarget[transformsSymbol]}tweenTargetTransformsProperties[tweenProperty]=value;tweenTransformsNeedUpdate=1}else if(tweenType===tweenTypes.CSS){tweenStyle[tweenProperty]=value}else if(tweenType===tweenTypes.CSS_VAR){tweenStyle.setProperty(tweenProperty,value)}}if(isCurrentTimeAboveZero)hasRendered=1}else{tween._value=value}}if(tweenTransformsNeedUpdate&&tween._renderTransforms){let str=emptyString;for(let key in tweenTargetTransformsProperties){str+=`${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `}tweenStyle.transform=str;tweenTransformsNeedUpdate=0}tween=tween._next}if(!muteCallbacks&&hasRendered){tickable.onRender(tickable)}}if(!muteCallbacks&&isCurrentTimeAboveZero){tickable.onUpdate(tickable)}}if(parent&&isSetter){if(!muteCallbacks&&(parent.began&&!isRunningBackwards&&tickableAbsoluteTime>=duration&&!completed||isRunningBackwards&&tickableAbsoluteTime<=minValue&&completed)){tickable.onComplete(tickable);tickable.completed=!isRunningBackwards}}else if(isCurrentTimeAboveZero&&isCurrentTimeEqualOrAboveDuration){if(iterationCount===Infinity){tickable._startTime+=tickable.duration}else if(tickable._currentIteration>=iterationCount-1){tickable.paused=true;if(!completed&&!_hasChildren){tickable.completed=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onComplete(tickable);tickable._resolve(tickable)}}}}else{tickable.completed=false}return hasRendered};const tick=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const _currentIteration=tickable._currentIteration;render(tickable,time,muteCallbacks,internalRender,tickMode);if(tickable._hasChildren){const tl=tickable;const tlIsRunningBackwards=tl.backwards;const tlChildrenTime=internalRender?time:tl._iterationTime;const tlCildrenTickTime=now();let tlChildrenHasRendered=0;let tlChildrenHaveCompleted=true;if(!internalRender&&tl._currentIteration!==_currentIteration){const tlIterationDuration=tl.iterationDuration;forEachChildren(tl,(child=>{if(!tlIsRunningBackwards){if(!child.completed&&!child.backwards&&child._currentTime<child.iterationDuration){render(child,tlIterationDuration,muteCallbacks,1,tickModes.FORCE)}child.began=false;child.completed=false}else{const childDuration=child.duration;const childStartTime=child._offset+child._delay;const childEndTime=childStartTime+childDuration;if(!muteCallbacks&&childDuration<=minValue&&(!childStartTime||childEndTime===tlIterationDuration)){child.onComplete(child)}}}));if(!muteCallbacks)tl.onLoop(tl)}forEachChildren(tl,(child=>{const childTime=round((tlChildrenTime-child._offset)*child._speed,12);const childTickMode=child._fps<tl._fps?child.requestTick(tlCildrenTickTime):tickMode;tlChildrenHasRendered+=render(child,childTime,muteCallbacks,internalRender,childTickMode);if(!child.completed&&tlChildrenHaveCompleted)tlChildrenHaveCompleted=false}),tlIsRunningBackwards);if(!muteCallbacks&&tlChildrenHasRendered)tl.onRender(tl);if(tlChildrenHaveCompleted&&tl._currentTime>=tl.duration){tl.paused=true;if(!tl.completed){tl.completed=true;if(!muteCallbacks){tl.onComplete(tl);tl._resolve(tl)}}}}};const additive={animation:null,update:noop};const addAdditiveAnimation=lookups=>{let animation=additive.animation;if(!animation){animation={duration:minValue,computeDeltaTime:noop,_offset:0,_delay:0,_head:null,_tail:null};additive.animation=animation;additive.update=()=>{lookups.forEach((propertyAnimation=>{for(let propertyName in propertyAnimation){const tweens=propertyAnimation[propertyName];const lookupTween=tweens._head;if(lookupTween){const valueType=lookupTween._valueType;const additiveValues=valueType===valueTypes.COMPLEX||valueType===valueTypes.COLOR?cloneArray(lookupTween._fromNumbers):null;let additiveValue=lookupTween._fromNumber;let tween=tweens._tail;while(tween&&tween!==lookupTween){if(additiveValues){for(let i=0,l=tween._numbers.length;i<l;i++)additiveValues[i]+=tween._numbers[i]}else{additiveValue+=tween._number}tween=tween._prevAdd}lookupTween._toNumber=additiveValue;lookupTween._toNumbers=additiveValues}}}));render(animation,1,1,0,tickModes.FORCE)}}return animation};const engineTickMethod=(()=>isBrowser?requestAnimationFrame:setImmediate)();const engineCancelMethod=(()=>isBrowser?cancelAnimationFrame:clearImmediate)();class Engine extends Clock{constructor(initTime){super(initTime);this.useDefaultMainLoop=true;this.pauseOnDocumentHidden=true;this.defaults=defaults;this.paused=isBrowser&&doc.hidden?true:false;this.reqId=null}update(){const time=this._currentTime=now();if(this.requestTick(time)){this.computeDeltaTime(time);const engineSpeed=this._speed;const engineFps=this._fps;let activeTickable=this._head;while(activeTickable){const nextTickable=activeTickable._next;if(!activeTickable.paused){tick(activeTickable,(time-activeTickable._startTime)*activeTickable._speed*engineSpeed,0,0,activeTickable._fps<engineFps?activeTickable.requestTick(time):tickModes.AUTO)}else{removeChild(this,activeTickable);this._hasChildren=!!this._tail;activeTickable._running=false;if(activeTickable.completed&&!activeTickable._cancelled){activeTickable.cancel()}}activeTickable=nextTickable}additive.update()}}wake(){if(this.useDefaultMainLoop&&!this.reqId&&!this.paused){this.reqId=engineTickMethod(tickEngine)}return this}pause(){this.paused=true;return killEngine()}resume(){if(!this.paused)return;this.paused=false;forEachChildren(this,(child=>child.resetTime()));return this.wake()}get speed(){return this._speed*(globals.timeScale===1?1:K)}set speed(playbackRate){this._speed=playbackRate*globals.timeScale;forEachChildren(this,(child=>child.speed=child._speed))}get timeUnit(){return globals.timeScale===1?"ms":"s"}set timeUnit(unit){const secondsScale=.001;const isSecond=unit==="s";const newScale=isSecond?secondsScale:1;if(globals.timeScale!==newScale){globals.timeScale=newScale;globals.tickThreshold=200*newScale;const scaleFactor=isSecond?secondsScale:K;this.defaults.duration*=scaleFactor;this._speed*=scaleFactor}}get precision(){return globals.precision}set precision(precision){globals.precision=precision}}const engine=(()=>{const engine=new Engine(now());if(isBrowser){globalVersions.engine=engine;doc.addEventListener("visibilitychange",(()=>{if(!engine.pauseOnDocumentHidden)return;doc.hidden?engine.pause():engine.resume()}))}return engine})();const tickEngine=()=>{if(engine._head){engine.reqId=engineTickMethod(tickEngine);engine.update()}else{engine.reqId=0}};const killEngine=()=>{engineCancelMethod(engine.reqId);engine.reqId=0;return engine};const parseInlineTransforms=(target,propName,animationInlineStyles)=>{const inlineTransforms=target.style.transform;let inlinedStylesPropertyValue;if(inlineTransforms){const cachedTransforms=target[transformsSymbol];let t;while(t=transformsExecRgx.exec(inlineTransforms)){const inlinePropertyName=t[1];const inlinePropertyValue=t[2].slice(1,-1);cachedTransforms[inlinePropertyName]=inlinePropertyValue;if(inlinePropertyName===propName){inlinedStylesPropertyValue=inlinePropertyValue;if(animationInlineStyles){animationInlineStyles[propName]=inlinePropertyValue}}}}return inlineTransforms&&!isUnd(inlinedStylesPropertyValue)?inlinedStylesPropertyValue:stringStartsWith(propName,"scale")?"1":stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew")?"0deg":"0px"};function getNodeList(v){const n=isStr(v)?scope.root.querySelectorAll(v):v;if(n instanceof NodeList||n instanceof HTMLCollection)return n}function parseTargets(targets){if(isNil(targets))return[];if(isArr(targets)){const flattened=targets.flat(Infinity);const parsed=[];for(let i=0,l=flattened.length;i<l;i++){const item=flattened[i];if(!isNil(item)){const nodeList=getNodeList(item);if(nodeList){for(let j=0,jl=nodeList.length;j<jl;j++){const subItem=nodeList[j];if(!isNil(subItem)){let isDuplicate=false;for(let k=0,kl=parsed.length;k<kl;k++){if(parsed[k]===subItem){isDuplicate=true;break}}if(!isDuplicate){parsed.push(subItem)}}}}else{let isDuplicate=false;for(let j=0,jl=parsed.length;j<jl;j++){if(parsed[j]===item){isDuplicate=true;break}}if(!isDuplicate){parsed.push(item)}}}}return parsed}if(!isBrowser)return[targets];const nodeList=getNodeList(targets);if(nodeList)return Array.from(nodeList);return[targets]}function registerTargets(targets){const parsedTargetsArray=parseTargets(targets);const parsedTargetsLength=parsedTargetsArray.length;if(parsedTargetsLength){for(let i=0;i<parsedTargetsLength;i++){const target=parsedTargetsArray[i];if(!target[isRegisteredTargetSymbol]){target[isRegisteredTargetSymbol]=true;const isSvgType=isSvg(target);const isDom=target.nodeType||isSvgType;if(isDom){target[isDomSymbol]=true;target[isSvgSymbol]=isSvgType;target[transformsSymbol]={}}}}}return parsedTargetsArray}const getPath=path=>{const parsedTargets=parseTargets(path);const $parsedSvg=parsedTargets[0];if(!$parsedSvg||!isSvg($parsedSvg))return;return $parsedSvg};const morphTo=(path2,precision=.33)=>$path1=>{const $path2=getPath(path2);if(!$path2)return;const isPath=$path1.tagName==="path";const separator=isPath?" ":",";const previousPoints=$path1[morphPointsSymbol];if(previousPoints)$path1.setAttribute(isPath?"d":"points",previousPoints);let v1="",v2="";if(!precision){v1=$path1.getAttribute(isPath?"d":"points");v2=$path2.getAttribute(isPath?"d":"points")}else{const length1=$path1.getTotalLength();const length2=$path2.getTotalLength();const maxPoints=Math.max(Math.ceil(length1*precision),Math.ceil(length2*precision));for(let i=0;i<maxPoints;i++){const t=i/(maxPoints-1);const pointOnPath1=$path1.getPointAtLength(length1*t);const pointOnPath2=$path2.getPointAtLength(length2*t);const prefix=isPath?i===0?"M":"L":"";v1+=prefix+round(pointOnPath1.x,3)+separator+pointOnPath1.y+" ";v2+=prefix+round(pointOnPath2.x,3)+separator+pointOnPath2.y+" "}}$path1[morphPointsSymbol]=v2;return[v1,v2]};const getScaleFactor=$el=>{let scaleFactor=1;if($el&&$el.getCTM){const ctm=$el.getCTM();if(ctm){const scaleX=sqrt(ctm.a*ctm.a+ctm.b*ctm.b);const scaleY=sqrt(ctm.c*ctm.c+ctm.d*ctm.d);scaleFactor=(scaleX+scaleY)/2}}return scaleFactor};const createDrawableProxy=($el,start,end)=>{const pathLength=K;const computedStyles=getComputedStyle($el);const strokeLineCap=computedStyles.strokeLinecap;const $scalled=computedStyles.vectorEffect==="non-scaling-stroke"?$el:null;let currentCap=strokeLineCap;const proxy=new Proxy($el,{get(target,property){const value=target[property];if(property===proxyTargetSymbol)return target;if(property==="setAttribute"){return(...args)=>{if(args[0]==="draw"){const value=args[1];const values=value.split(" ");const v1=+values[0];const v2=+values[1];const scaleFactor=getScaleFactor($scalled);const os=v1*-1e3*scaleFactor;const d1=v2*pathLength*scaleFactor+os;const d2=pathLength*scaleFactor+(v1===0&&v2===1||v1===1&&v2===0?0:10*scaleFactor)-d1;if(strokeLineCap!=="butt"){const newCap=v1===v2?"butt":strokeLineCap;if(currentCap!==newCap){target.style.strokeLinecap=`${newCap}`;currentCap=newCap}}target.setAttribute("stroke-dashoffset",`${os}`);target.setAttribute("stroke-dasharray",`${d1} ${d2}`)}return Reflect.apply(value,target,args)}}if(isFnc(value)){return(...args)=>Reflect.apply(value,target,args)}else{return value}}});if($el.getAttribute("pathLength")!==`${pathLength}`){$el.setAttribute("pathLength",`${pathLength}`);proxy.setAttribute("draw",`${start} ${end}`)}return proxy};const createDrawable=(selector,start=0,end=0)=>{const els=parseTargets(selector);return els.map(($el=>createDrawableProxy($el,start,end)))};const getPathPoint=($path,progress,lookup=0)=>$path.getPointAtLength(progress+lookup>=1?progress+lookup:0);const getPathProgess=($path,pathProperty)=>$el=>{const totalLength=+$path.getTotalLength();const inSvg=$el[isSvgSymbol];const ctm=$path.getCTM();return{from:0,to:totalLength,modifier:progress=>{if(pathProperty==="a"){const p0=getPathPoint($path,progress,-1);const p1=getPathPoint($path,progress,1);return atan2(p1.y-p0.y,p1.x-p0.x)*180/PI}else{const p=getPathPoint($path,progress,0);return pathProperty==="x"?inSvg||!ctm?p.x:p.x*ctm.a+p.y*ctm.c+ctm.e:inSvg||!ctm?p.y:p.x*ctm.b+p.y*ctm.d+ctm.f}}}};const createMotionPath=path=>{const $path=getPath(path);if(!$path)return;return{translateX:getPathProgess($path,"x"),translateY:getPathProgess($path,"y"),rotate:getPathProgess($path,"a")}};const cssReservedProperties=["opacity","rotate","overflow","color"];const isValidSVGAttribute=(el,propertyName)=>{if(cssReservedProperties.includes(propertyName))return false;if(el.getAttribute(propertyName)||propertyName in el){if(propertyName==="scale"){const elParentNode=el.parentNode;return elParentNode&&elParentNode.tagName==="filter"}return true}};const svg={morphTo:morphTo,createMotionPath:createMotionPath,createDrawable:createDrawable};const rgbToRgba=rgbValue=>{const rgba=rgbExecRgx.exec(rgbValue)||rgbaExecRgx.exec(rgbValue);const a=!isUnd(rgba[4])?+rgba[4]:1;return[+rgba[1],+rgba[2],+rgba[3],a]};const hexToRgba=hexValue=>{const hexLength=hexValue.length;const isShort=hexLength===4||hexLength===5;return[+("0x"+hexValue[1]+hexValue[isShort?1:2]),+("0x"+hexValue[isShort?2:3]+hexValue[isShort?2:4]),+("0x"+hexValue[isShort?3:5]+hexValue[isShort?3:6]),hexLength===5||hexLength===9?+(+("0x"+hexValue[isShort?4:7]+hexValue[isShort?4:8])/255).toFixed(3):1]};const hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;return t<1/6?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p};const hslToRgba=hslValue=>{const hsla=hslExecRgx.exec(hslValue)||hslaExecRgx.exec(hslValue);const h=+hsla[1]/360;const s=+hsla[2]/100;const l=+hsla[3]/100;const a=!isUnd(hsla[4])?+hsla[4]:1;let r,g,b;if(s===0){r=g=b=l}else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=round(hue2rgb(p,q,h+1/3)*255,0);g=round(hue2rgb(p,q,h)*255,0);b=round(hue2rgb(p,q,h-1/3)*255,0)}return[r,g,b,a]};const convertColorStringValuesToRgbaArray=colorString=>isRgb(colorString)?rgbToRgba(colorString):isHex(colorString)?hexToRgba(colorString):isHsl(colorString)?hslToRgba(colorString):[0,0,0,1];const setValue=(targetValue,defaultValue)=>isUnd(targetValue)?defaultValue:targetValue;const getFunctionValue=(value,target,index,total,store)=>{if(isFnc(value)){const func=()=>{const computed=value(target,index,total);return!isNaN(+computed)?+computed:computed||0};if(store){store.func=func}return func()}else{return value}};const getTweenType=(target,prop)=>!target[isDomSymbol]?tweenTypes.OBJECT:target[isSvgSymbol]&&isValidSVGAttribute(target,prop)?tweenTypes.ATTRIBUTE:validTransforms.includes(prop)||shortTransforms.get(prop)?tweenTypes.TRANSFORM:stringStartsWith(prop,"--")?tweenTypes.CSS_VAR:prop in target.style?tweenTypes.CSS:prop in target?tweenTypes.OBJECT:tweenTypes.ATTRIBUTE;const getCSSValue=(target,propName,animationInlineStyles)=>{const inlineStyles=target.style[propName];if(inlineStyles&&animationInlineStyles){animationInlineStyles[propName]=inlineStyles}const value=inlineStyles||getComputedStyle(target[proxyTargetSymbol]||target).getPropertyValue(propName);return value==="auto"?"0":value};const getOriginalAnimatableValue=(target,propName,tweenType,animationInlineStyles)=>{const type=!isUnd(tweenType)?tweenType:getTweenType(target,propName);return type===tweenTypes.OBJECT?target[propName]||0:type===tweenTypes.ATTRIBUTE?target.getAttribute(propName):type===tweenTypes.TRANSFORM?parseInlineTransforms(target,propName,animationInlineStyles):type===tweenTypes.CSS_VAR?getCSSValue(target,propName,animationInlineStyles).trimStart():getCSSValue(target,propName,animationInlineStyles)};const getRelativeValue=(x,y,operator)=>operator==="-"?x-y:operator==="+"?x+y:x*y;const createDecomposedValueTargetObject=()=>({t:valueTypes.NUMBER,n:0,u:null,o:null,d:null,s:null});const decomposeRawValue=(rawValue,targetObject)=>{targetObject.t=valueTypes.NUMBER;targetObject.n=0;targetObject.u=null;targetObject.o=null;targetObject.d=null;targetObject.s=null;if(!rawValue)return targetObject;const num=+rawValue;if(!isNaN(num)){targetObject.n=num;return targetObject}else{let str=rawValue;if(str[1]==="="){targetObject.o=str[0];str=str.slice(2)}const unitMatch=str.includes(" ")?false:unitsExecRgx.exec(str);if(unitMatch){targetObject.t=valueTypes.UNIT;targetObject.n=+unitMatch[1];targetObject.u=unitMatch[2];return targetObject}else if(targetObject.o){targetObject.n=+str;return targetObject}else if(isCol(str)){targetObject.t=valueTypes.COLOR;targetObject.d=convertColorStringValuesToRgbaArray(str);return targetObject}else{const matchedNumbers=str.match(digitWithExponentRgx);targetObject.t=valueTypes.COMPLEX;targetObject.d=matchedNumbers?matchedNumbers.map(Number):[];targetObject.s=str.split(digitWithExponentRgx)||[];return targetObject}}};const decomposeTweenValue=(tween,targetObject)=>{targetObject.t=tween._valueType;targetObject.n=tween._toNumber;targetObject.u=tween._unit;targetObject.o=null;targetObject.d=cloneArray(tween._toNumbers);targetObject.s=cloneArray(tween._strings);return targetObject};const decomposedOriginalValue=createDecomposedValueTargetObject();const lookups={_rep:new WeakMap,_add:new Map};const getTweenSiblings=(target,property,lookup="_rep")=>{const lookupMap=lookups[lookup];let targetLookup=lookupMap.get(target);if(!targetLookup){targetLookup={};lookupMap.set(target,targetLookup)}return targetLookup[property]?targetLookup[property]:targetLookup[property]={_head:null,_tail:null}};const addTweenSortMethod=(p,c)=>p._isOverridden||p._absoluteStartTime>c._absoluteStartTime;const overrideTween=tween=>{tween._isOverlapped=1;tween._isOverridden=1;tween._changeDuration=minValue;tween._currentTime=minValue};const composeTween=(tween,siblings)=>{const tweenCompositionType=tween._composition;if(tweenCompositionType===compositionTypes.replace){const tweenAbsStartTime=tween._absoluteStartTime;addChild(siblings,tween,addTweenSortMethod,"_prevRep","_nextRep");const prevSibling=tween._prevRep;if(prevSibling){const prevParent=prevSibling.parent;const prevAbsEndTime=prevSibling._absoluteStartTime+prevSibling._changeDuration;if(tween.parent.id!==prevParent.id&&prevParent.iterationCount>1&&prevAbsEndTime+(prevParent.duration-prevParent.iterationDuration)>tweenAbsStartTime){overrideTween(prevSibling);let prevPrevSibling=prevSibling._prevRep;while(prevPrevSibling&&prevPrevSibling.parent.id===prevParent.id){overrideTween(prevPrevSibling);prevPrevSibling=prevPrevSibling._prevRep}}const absoluteUpdateStartTime=tweenAbsStartTime-tween._delay;if(prevAbsEndTime>absoluteUpdateStartTime){const prevChangeStartTime=prevSibling._startTime;const prevTLOffset=prevAbsEndTime-(prevChangeStartTime+prevSibling._updateDuration);prevSibling._changeDuration=absoluteUpdateStartTime-prevTLOffset-prevChangeStartTime;prevSibling._currentTime=prevSibling._changeDuration;prevSibling._isOverlapped=1;if(prevSibling._changeDuration<minValue){overrideTween(prevSibling)}}let pausePrevParentAnimation=true;forEachChildren(prevParent,(t=>{if(!t._isOverlapped)pausePrevParentAnimation=false}));if(pausePrevParentAnimation){const prevParentTL=prevParent.parent;if(prevParentTL){let pausePrevParentTL=true;forEachChildren(prevParentTL,(a=>{if(a!==prevParent){forEachChildren(a,(t=>{if(!t._isOverlapped)pausePrevParentTL=false}))}}));if(pausePrevParentTL){prevParentTL.cancel()}}else{prevParent.cancel()}}}}else if(tweenCompositionType===compositionTypes.blend){const additiveTweenSiblings=getTweenSiblings(tween.target,tween.property,"_add");const additiveAnimation=addAdditiveAnimation(lookups._add);let lookupTween=additiveTweenSiblings._head;if(!lookupTween){lookupTween={...tween};lookupTween._composition=compositionTypes.replace;lookupTween._updateDuration=minValue;lookupTween._startTime=0;lookupTween._numbers=cloneArray(tween._fromNumbers);lookupTween._number=0;lookupTween._next=null;lookupTween._prev=null;addChild(additiveTweenSiblings,lookupTween);addChild(additiveAnimation,lookupTween)}const toNumber=tween._toNumber;tween._fromNumber=lookupTween._fromNumber-toNumber;tween._toNumber=0;tween._numbers=cloneArray(tween._fromNumbers);tween._number=0;lookupTween._fromNumber=toNumber;if(tween._toNumbers){const toNumbers=cloneArray(tween._toNumbers);if(toNumbers){toNumbers.forEach(((value,i)=>{tween._fromNumbers[i]=lookupTween._fromNumbers[i]-value;tween._toNumbers[i]=0}))}lookupTween._fromNumbers=toNumbers}addChild(additiveTweenSiblings,tween,null,"_prevAdd","_nextAdd")}return tween};const removeTweenSliblings=tween=>{const tweenComposition=tween._composition;if(tweenComposition!==compositionTypes.none){const tweenTarget=tween.target;const tweenProperty=tween.property;const replaceTweensLookup=lookups._rep;const replaceTargetProps=replaceTweensLookup.get(tweenTarget);const tweenReplaceSiblings=replaceTargetProps[tweenProperty];removeChild(tweenReplaceSiblings,tween,"_prevRep","_nextRep");if(tweenComposition===compositionTypes.blend){const addTweensLookup=lookups._add;const addTargetProps=addTweensLookup.get(tweenTarget);if(!addTargetProps)return;const additiveTweenSiblings=addTargetProps[tweenProperty];const additiveAnimation=additive.animation;removeChild(additiveTweenSiblings,tween,"_prevAdd","_nextAdd");const lookupTween=additiveTweenSiblings._head;if(lookupTween&&lookupTween===additiveTweenSiblings._tail){removeChild(additiveTweenSiblings,lookupTween,"_prevAdd","_nextAdd");removeChild(additiveAnimation,lookupTween);let shouldClean=true;for(let prop in addTargetProps){if(addTargetProps[prop]._head){shouldClean=false;break}}if(shouldClean){addTweensLookup.delete(tweenTarget)}}}}return tween};const resetTimerProperties=timer=>{timer.paused=true;timer.began=false;timer.completed=false;return timer};const reviveTimer=timer=>{if(!timer._cancelled)return timer;if(timer._hasChildren){forEachChildren(timer,reviveTimer)}else{forEachChildren(timer,(tween=>{if(tween._composition!==compositionTypes.none){composeTween(tween,getTweenSiblings(tween.target,tween.property))}}))}timer._cancelled=0;return timer};let timerId=0;class Timer extends Clock{constructor(parameters={},parent=null,parentPosition=0){super(0);const{id:id,delay:delay,duration:duration,reversed:reversed,alternate:alternate,loop:loop,loopDelay:loopDelay,autoplay:autoplay,frameRate:frameRate,playbackRate:playbackRate,onComplete:onComplete,onLoop:onLoop,onPause:onPause,onBegin:onBegin,onBeforeUpdate:onBeforeUpdate,onUpdate:onUpdate}=parameters;if(scope.current)scope.current.register(this);const timerInitTime=parent?0:engine._elapsedTime;const timerDefaults=parent?parent.defaults:globals.defaults;const timerDelay=isFnc(delay)||isUnd(delay)?timerDefaults.delay:+delay;const timerDuration=isFnc(duration)||isUnd(duration)?Infinity:+duration;const timerLoop=setValue(loop,timerDefaults.loop);const timerLoopDelay=setValue(loopDelay,timerDefaults.loopDelay);const timerIterationCount=timerLoop===true||timerLoop===Infinity||timerLoop<0?Infinity:timerLoop+1;let offsetPosition=0;if(parent){offsetPosition=parentPosition}else{let startTime=now();if(engine.paused){engine.requestTick(startTime);startTime=engine._elapsedTime}offsetPosition=startTime-engine._startTime}this.id=!isUnd(id)?id:++timerId;this.parent=parent;this.duration=clampInfinity((timerDuration+timerLoopDelay)*timerIterationCount-timerLoopDelay)||minValue;this.backwards=false;this.paused=true;this.began=false;this.completed=false;this.onBegin=onBegin||timerDefaults.onBegin;this.onBeforeUpdate=onBeforeUpdate||timerDefaults.onBeforeUpdate;this.onUpdate=onUpdate||timerDefaults.onUpdate;this.onLoop=onLoop||timerDefaults.onLoop;this.onPause=onPause||timerDefaults.onPause;this.onComplete=onComplete||timerDefaults.onComplete;this.iterationDuration=timerDuration;this.iterationCount=timerIterationCount;this._autoplay=parent?false:setValue(autoplay,timerDefaults.autoplay);this._offset=offsetPosition;this._delay=timerDelay;this._loopDelay=timerLoopDelay;this._iterationTime=0;this._currentIteration=0;this._resolve=noop;this._running=false;this._reversed=+setValue(reversed,timerDefaults.reversed);this._reverse=this._reversed;this._cancelled=0;this._alternate=setValue(alternate,timerDefaults.alternate);this._prev=null;this._next=null;this._elapsedTime=timerInitTime;this._startTime=timerInitTime;this._lastTime=timerInitTime;this._fps=setValue(frameRate,timerDefaults.frameRate);this._speed=setValue(playbackRate,timerDefaults.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(cancelled){cancelled?this.cancel():this.reset(1).play()}get currentTime(){return clamp(round(this._currentTime,globals.precision),-this._delay,this.duration)}set currentTime(time){const paused=this.paused;this.pause().seek(+time);if(!paused)this.resume()}get iterationCurrentTime(){return round(this._iterationTime,globals.precision)}set iterationCurrentTime(time){this.currentTime=this.iterationDuration*this._currentIteration+time}get progress(){return clamp(round(this._currentTime/this.duration,10),0,1)}set progress(progress){this.currentTime=this.duration*progress}get iterationProgress(){return clamp(round(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(progress){const iterationDuration=this.iterationDuration;this.currentTime=iterationDuration*this._currentIteration+iterationDuration*progress}get currentIteration(){return this._currentIteration}set currentIteration(iterationCount){this.currentTime=this.iterationDuration*clamp(+iterationCount,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(reverse){reverse?this.reverse():this.play()}get speed(){return super.speed}set speed(playbackRate){super.speed=playbackRate;this.resetTime()}reset(internalRender=0){reviveTimer(this);if(this._reversed&&!this._reverse)this.reversed=false;this._iterationTime=this.iterationDuration;tick(this,0,1,internalRender,tickModes.FORCE);resetTimerProperties(this);if(this._hasChildren){forEachChildren(this,resetTimerProperties)}return this}init(internalRender=0){this.fps=this._fps;this.speed=this._speed;if(!internalRender&&this._hasChildren){tick(this,this.duration,1,internalRender,tickModes.FORCE)}this.reset(internalRender);const autoplay=this._autoplay;if(autoplay===true){this.resume()}else if(autoplay&&!isUnd(autoplay.linked)){autoplay.link(this)}return this}resetTime(){const timeScale=1/(this._speed*engine._speed);this._startTime=now()-(this._currentTime+this._delay)*timeScale;return this}pause(){if(this.paused)return this;this.paused=true;this.onPause(this);return this}resume(){if(!this.paused)return this;this.paused=false;if(this.duration<=minValue&&!this._hasChildren){tick(this,minValue,0,0,tickModes.FORCE)}else{if(!this._running){addChild(engine,this);engine._hasChildren=true;this._running=true}this.resetTime();this._startTime-=12;engine.wake()}return this}restart(){return this.reset(0).resume()}seek(time,muteCallbacks=0,internalRender=0){reviveTimer(this);this.completed=false;const isPaused=this.paused;this.paused=true;tick(this,time+this._delay,~~muteCallbacks,~~internalRender,tickModes.AUTO);return isPaused?this:this.resume()}alternate(){const reversed=this._reversed;const count=this.iterationCount;const duration=this.iterationDuration;const iterations=count===Infinity?floor(maxValue/duration):count;this._reversed=+(this._alternate&&!(iterations%2)?reversed:!reversed);if(count===Infinity){this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress}else{this.seek(duration*iterations-this._currentTime)}this.resetTime();return this}play(){if(this._reversed)this.alternate();return this.resume()}reverse(){if(!this._reversed)this.alternate();return this.resume()}cancel(){if(this._hasChildren){forEachChildren(this,(child=>child.cancel()),true)}else{forEachChildren(this,removeTweenSliblings)}this._cancelled=1;return this.pause()}stretch(newDuration){const currentDuration=this.duration;const normlizedDuration=normalizeTime(newDuration);if(currentDuration===normlizedDuration)return this;const timeScale=newDuration/currentDuration;const isSetter=newDuration<=minValue;this.duration=isSetter?minValue:normlizedDuration;this.iterationDuration=isSetter?minValue:normalizeTime(this.iterationDuration*timeScale);this._offset*=timeScale;this._delay*=timeScale;this._loopDelay*=timeScale;return this}revert(){tick(this,0,1,0,tickModes.AUTO);const ap=this._autoplay;if(ap&&ap.linked&&ap.linked===this)ap.revert();return this.cancel()}complete(){return this.seek(this.duration).cancel()}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const createTimer=parameters=>new Timer(parameters,null,0).init();const none=t=>t;const calcBezier=(aT,aA1,aA2)=>(((1-3*aA2+3*aA1)*aT+(3*aA2-6*aA1))*aT+3*aA1)*aT;const binarySubdivide=(aX,mX1,mX2)=>{let aA=0,aB=1,currentX,currentT,i=0;do{currentT=aA+(aB-aA)/2;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0){aB=currentT}else{aA=currentT}}while(abs(currentX)>1e-7&&++i<100);return currentT};const cubicBezier=(mX1=.5,mY1=0,mX2=.5,mY2=1)=>mX1===mY1&&mX2===mY2?none:t=>t===0||t===1?t:calcBezier(binarySubdivide(t,mX1,mX2),mY1,mY2);const steps=(steps=10,fromStart)=>{const roundMethod=fromStart?ceil:floor;return t=>roundMethod(clamp(t,0,1)*steps)*(1/steps)};const linear=(...args)=>{const argsLength=args.length;if(!argsLength)return none;const totalPoints=argsLength-1;const firstArg=args[0];const lastArg=args[totalPoints];const xPoints=[0];const yPoints=[parseNumber(firstArg)];for(let i=1;i<totalPoints;i++){const arg=args[i];const splitValue=isStr(arg)?arg.trim().split(" "):[arg];const value=splitValue[0];const percent=splitValue[1];xPoints.push(!isUnd(percent)?parseNumber(percent)/100:i/totalPoints);yPoints.push(parseNumber(value))}yPoints.push(parseNumber(lastArg));xPoints.push(1);return function easeLinear(t){for(let i=1,l=xPoints.length;i<l;i++){const currentX=xPoints[i];if(t<=currentX){const prevX=xPoints[i-1];const prevY=yPoints[i-1];return prevY+(yPoints[i]-prevY)*(t-prevX)/(currentX-prevX)}}return yPoints[yPoints.length-1]}};const irregular=(length=10,randomness=1)=>{const values=[0];const total=length-1;for(let i=1;i<total;i++){const previousValue=values[i-1];const spacing=i/total;const segmentEnd=(i+1)/total;const randomVariation=spacing+(segmentEnd-spacing)*Math.random();const randomValue=spacing*(1-randomness)+randomVariation*randomness;values.push(clamp(randomValue,previousValue,1))}values.push(1);return linear(...values)};const halfPI=PI/2;const doublePI=PI*2;const easeInPower=(p=1.68)=>t=>pow(t,+p);const easeInFunctions={[emptyString]:easeInPower,Quad:easeInPower(2),Cubic:easeInPower(3),Quart:easeInPower(4),Quint:easeInPower(5),Sine:t=>1-cos(t*halfPI),Circ:t=>1-sqrt(1-t*t),Expo:t=>t?pow(2,10*t-10):0,Bounce:t=>{let pow2,b=4;while(t<((pow2=pow(2,--b))-1)/11);return 1/pow(4,3-b)-7.5625*pow((pow2*3-2)/22-t,2)},Back:(overshoot=1.70158)=>t=>(+overshoot+1)*t*t*t-+overshoot*t*t,Elastic:(amplitude=1,period=.3)=>{const a=clamp(+amplitude,1,10);const p=clamp(+period,minValue,2);const s=p/doublePI*asin(1/a);const e=doublePI/p;return t=>t===0||t===1?t:-a*pow(2,-10*(1-t))*sin((1-t-s)*e)}};const easeTypes={in:easeIn=>t=>easeIn(t),out:easeIn=>t=>1-easeIn(1-t),inOut:easeIn=>t=>t<.5?easeIn(t*2)/2:1-easeIn(t*-2+2)/2,outIn:easeIn=>t=>t<.5?(1-easeIn(1-t*2))/2:(easeIn(t*2-1)+1)/2};const parseEaseString=(string,easesFunctions,easesLookups)=>{if(easesLookups[string])return easesLookups[string];if(string.indexOf("(")<=-1){const hasParams=easeTypes[string]||string.includes("Back")||string.includes("Elastic");const parsedFn=hasParams?easesFunctions[string]():easesFunctions[string];return parsedFn?easesLookups[string]=parsedFn:none}else{const split=string.slice(0,-1).split("(");const parsedFn=easesFunctions[split[0]];return parsedFn?easesLookups[string]=parsedFn(...split[1].split(",")):none}};const eases=(()=>{const list={linear:linear,irregular:irregular,steps:steps,cubicBezier:cubicBezier};for(let type in easeTypes){for(let name in easeInFunctions){const easeIn=easeInFunctions[name];const easeType=easeTypes[type];list[type+name]=name===emptyString||name==="Back"||name==="Elastic"?(a,b)=>easeType(easeIn(a,b)):easeType(easeIn)}}return list})();const JSEasesLookups={linear:none};const parseEasings=ease=>isFnc(ease)?ease:isStr(ease)?parseEaseString(ease,eases,JSEasesLookups):none;const propertyNamesCache={};const sanitizePropertyName=(propertyName,target,tweenType)=>{if(tweenType===tweenTypes.TRANSFORM){const t=shortTransforms.get(propertyName);return t?t:propertyName}else if(tweenType===tweenTypes.CSS||tweenType===tweenTypes.ATTRIBUTE&&(isSvg(target)&&propertyName in target.style)){const cachedPropertyName=propertyNamesCache[propertyName];if(cachedPropertyName){return cachedPropertyName}else{const lowerCaseName=propertyName?toLowerCase(propertyName):propertyName;propertyNamesCache[propertyName]=lowerCaseName;return lowerCaseName}}else{return propertyName}};const angleUnitsMap={deg:1,rad:180/PI,turn:360};const convertedValuesCache={};const convertValueUnit=(el,decomposedValue,unit,force=false)=>{const currentUnit=decomposedValue.u;const currentNumber=decomposedValue.n;if(decomposedValue.t===valueTypes.UNIT&&currentUnit===unit){return decomposedValue}const cachedKey=currentNumber+currentUnit+unit;const cached=convertedValuesCache[cachedKey];if(!isUnd(cached)&&!force){decomposedValue.n=cached}else{let convertedValue;if(currentUnit in angleUnitsMap){convertedValue=currentNumber*angleUnitsMap[currentUnit]/angleUnitsMap[unit]}else{const baseline=100;const tempEl=el.cloneNode();const parentNode=el.parentNode;const parentEl=parentNode&&parentNode!==doc?parentNode:doc.body;parentEl.appendChild(tempEl);const elStyle=tempEl.style;elStyle.width=baseline+currentUnit;const currentUnitWidth=tempEl.offsetWidth||baseline;elStyle.width=baseline+unit;const newUnitWidth=tempEl.offsetWidth||baseline;const factor=currentUnitWidth/newUnitWidth;parentEl.removeChild(tempEl);convertedValue=factor*currentNumber}decomposedValue.n=convertedValue;convertedValuesCache[cachedKey]=convertedValue}decomposedValue.t===valueTypes.UNIT;decomposedValue.u=unit;return decomposedValue};const cleanInlineStyles=renderable=>{if(renderable._hasChildren){forEachChildren(renderable,cleanInlineStyles,true)}else{const animation=renderable;animation.pause();forEachChildren(animation,(tween=>{const tweenProperty=tween.property;const tweenTarget=tween.target;if(tweenTarget[isDomSymbol]){const targetStyle=tweenTarget.style;const originalInlinedValue=animation._inlineStyles[tweenProperty];if(tween._tweenType===tweenTypes.TRANSFORM){const cachedTransforms=tweenTarget[transformsSymbol];if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){delete cachedTransforms[tweenProperty]}else{cachedTransforms[tweenProperty]=originalInlinedValue}if(tween._renderTransforms){if(!Object.keys(cachedTransforms).length){targetStyle.removeProperty("transform")}else{let str=emptyString;for(let key in cachedTransforms){str+=transformsFragmentStrings[key]+cachedTransforms[key]+") "}targetStyle.transform=str}}}else{if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){targetStyle.removeProperty(tweenProperty)}else{targetStyle[tweenProperty]=originalInlinedValue}}if(animation._tail===tween){animation.targets.forEach((t=>{if(t.getAttribute&&t.getAttribute("style")===emptyString){t.removeAttribute("style")}}))}}}))}return renderable};const fromTargetObject=createDecomposedValueTargetObject();const toTargetObject=createDecomposedValueTargetObject();const toFunctionStore={func:null};const keyframesTargetArray=[null];const fastSetValuesArray=[null,null];const keyObjectTarget={to:null};let tweenId=0;let keyframes;let key;const generateKeyframes=(keyframes,parameters)=>{const properties={};if(isArr(keyframes)){const propertyNames=[].concat(...keyframes.map((key=>Object.keys(key)))).filter(isKey);for(let i=0,l=propertyNames.length;i<l;i++){const propName=propertyNames[i];const propArray=keyframes.map((key=>{const newKey={};for(let p in key){const keyValue=key[p];if(isKey(p)){if(p===propName){newKey.to=keyValue}}else{newKey[p]=keyValue}}return newKey}));properties[propName]=propArray}}else{const totalDuration=setValue(parameters.duration,globals.defaults.duration);const keys=Object.keys(keyframes).map((key=>({o:parseFloat(key)/100,p:keyframes[key]}))).sort(((a,b)=>a.o-b.o));keys.forEach((key=>{const offset=key.o;const prop=key.p;for(let name in prop){if(isKey(name)){let propArray=properties[name];if(!propArray)propArray=properties[name]=[];const duration=offset*totalDuration;let length=propArray.length;let prevKey=propArray[length-1];const keyObj={to:prop[name]};let durProgress=0;for(let i=0;i<length;i++){durProgress+=propArray[i].duration}if(length===1){keyObj.from=prevKey.to}if(prop.ease){keyObj.ease=prop.ease}keyObj.duration=duration-(length?durProgress:0);propArray.push(keyObj)}}return key}));for(let name in properties){const propArray=properties[name];let prevEase;for(let i=0,l=propArray.length;i<l;i++){const prop=propArray[i];const currentEase=prop.ease;prop.ease=prevEase?prevEase:undefined;prevEase=currentEase}if(!propArray[0].duration){propArray.shift()}}}return properties};class JSAnimation extends Timer{constructor(targets,parameters,parent,parentPosition,fastSet=false,index=0,length=0){super(parameters,parent,parentPosition);const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;const kfParams=parameters.keyframes;const params=kfParams?mergeObjects(generateKeyframes(kfParams,parameters),parameters):parameters;const{delay:delay,duration:duration,ease:ease,playbackEase:playbackEase,modifier:modifier,composition:composition,onRender:onRender}=params;const animDefaults=parent?parent.defaults:globals.defaults;const animaPlaybackEase=setValue(playbackEase,animDefaults.playbackEase);const animEase=animaPlaybackEase?parseEasings(animaPlaybackEase):null;const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const tEasing=hasSpring?ease.ease:setValue(ease,animEase?"linear":animDefaults.ease);const tDuration=hasSpring?ease.duration:setValue(duration,animDefaults.duration);const tDelay=setValue(delay,animDefaults.delay);const tModifier=modifier||animDefaults.modifier;const tComposition=isUnd(composition)&&targetsLength>=K?compositionTypes.none:!isUnd(composition)?composition:animDefaults.composition;const animInlineStyles={};const absoluteOffsetTime=this._offset+(parent?parent._offset:0);let iterationDuration=NaN;let iterationDelay=NaN;let animationAnimationLength=0;let shouldTriggerRender=0;for(let targetIndex=0;targetIndex<targetsLength;targetIndex++){const target=parsedTargets[targetIndex];const ti=index||targetIndex;const tl=length||targetsLength;let lastTransformGroupIndex=NaN;let lastTransformGroupLength=NaN;for(let p in params){if(isKey(p)){const tweenType=getTweenType(target,p);const propName=sanitizePropertyName(p,target,tweenType);let propValue=params[p];const isPropValueArray=isArr(propValue);if(fastSet&&!isPropValueArray){fastSetValuesArray[0]=propValue;fastSetValuesArray[1]=propValue;propValue=fastSetValuesArray}if(isPropValueArray){const arrayLength=propValue.length;const isNotObjectValue=!isObj(propValue[0]);if(arrayLength===2&&isNotObjectValue){keyObjectTarget.to=propValue;keyframesTargetArray[0]=keyObjectTarget;keyframes=keyframesTargetArray}else if(arrayLength>2&&isNotObjectValue){keyframes=[];propValue.forEach(((v,i)=>{if(!i){fastSetValuesArray[0]=v}else if(i===1){fastSetValuesArray[1]=v;keyframes.push(fastSetValuesArray)}else{keyframes.push(v)}}))}else{keyframes=propValue}}else{keyframesTargetArray[0]=propValue;keyframes=keyframesTargetArray}let siblings=null;let prevTween=null;let firstTweenChangeStartTime=NaN;let lastTweenChangeEndTime=0;let tweenIndex=0;for(let l=keyframes.length;tweenIndex<l;tweenIndex++){const keyframe=keyframes[tweenIndex];if(isObj(keyframe)){key=keyframe}else{keyObjectTarget.to=keyframe;key=keyObjectTarget}toFunctionStore.func=null;const computedToValue=getFunctionValue(key.to,target,ti,tl,toFunctionStore);let tweenToValue;if(isObj(computedToValue)&&!isUnd(computedToValue.to)){key=computedToValue;tweenToValue=computedToValue.to}else{tweenToValue=computedToValue}const tweenFromValue=getFunctionValue(key.from,target,ti,tl);const keyEasing=key.ease;const hasSpring=!isUnd(keyEasing)&&!isUnd(keyEasing.ease);const tweenEasing=hasSpring?keyEasing.ease:keyEasing||tEasing;const tweenDuration=hasSpring?keyEasing.duration:getFunctionValue(setValue(key.duration,l>1?getFunctionValue(tDuration,target,ti,tl)/l:tDuration),target,ti,tl);const tweenDelay=getFunctionValue(setValue(key.delay,!tweenIndex?tDelay:0),target,ti,tl);const computedComposition=getFunctionValue(setValue(key.composition,tComposition),target,ti,tl);const tweenComposition=isNum(computedComposition)?computedComposition:compositionTypes[computedComposition];const tweenModifier=key.modifier||tModifier;const hasFromvalue=!isUnd(tweenFromValue);const hasToValue=!isUnd(tweenToValue);const isFromToArray=isArr(tweenToValue);const isFromToValue=isFromToArray||hasFromvalue&&hasToValue;const tweenStartTime=prevTween?lastTweenChangeEndTime+tweenDelay:tweenDelay;const absoluteStartTime=absoluteOffsetTime+tweenStartTime;if(!shouldTriggerRender&&(hasFromvalue||isFromToArray))shouldTriggerRender=1;let prevSibling=prevTween;if(tweenComposition!==compositionTypes.none){if(!siblings)siblings=getTweenSiblings(target,propName);let nextSibling=siblings._head;while(nextSibling&&!nextSibling._isOverridden&&nextSibling._absoluteStartTime<=absoluteStartTime){prevSibling=nextSibling;nextSibling=nextSibling._nextRep;if(nextSibling&&nextSibling._absoluteStartTime>=absoluteStartTime){while(nextSibling){overrideTween(nextSibling);nextSibling=nextSibling._nextRep}}}}if(isFromToValue){decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[0],target,ti,tl):tweenFromValue,fromTargetObject);decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[1],target,ti,tl,toFunctionStore):tweenToValue,toTargetObject);if(fromTargetObject.t===valueTypes.NUMBER){if(prevSibling){if(prevSibling._valueType===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=prevSibling._unit}}else{decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=decomposedOriginalValue.u}}}}else{if(hasToValue){decomposeRawValue(tweenToValue,toTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,toTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),toTargetObject)}}if(hasFromvalue){decomposeRawValue(tweenFromValue,fromTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,fromTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),fromTargetObject)}}}if(fromTargetObject.o){fromTargetObject.n=getRelativeValue(!prevSibling?decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue).n:prevSibling._toNumber,fromTargetObject.n,fromTargetObject.o)}if(toTargetObject.o){toTargetObject.n=getRelativeValue(fromTargetObject.n,toTargetObject.n,toTargetObject.o)}if(fromTargetObject.t!==toTargetObject.t){if(fromTargetObject.t===valueTypes.COMPLEX||toTargetObject.t===valueTypes.COMPLEX){const complexValue=fromTargetObject.t===valueTypes.COMPLEX?fromTargetObject:toTargetObject;const notComplexValue=fromTargetObject.t===valueTypes.COMPLEX?toTargetObject:fromTargetObject;notComplexValue.t=valueTypes.COMPLEX;notComplexValue.s=cloneArray(complexValue.s);notComplexValue.d=complexValue.d.map((()=>notComplexValue.n))}else if(fromTargetObject.t===valueTypes.UNIT||toTargetObject.t===valueTypes.UNIT){const unitValue=fromTargetObject.t===valueTypes.UNIT?fromTargetObject:toTargetObject;const notUnitValue=fromTargetObject.t===valueTypes.UNIT?toTargetObject:fromTargetObject;notUnitValue.t=valueTypes.UNIT;notUnitValue.u=unitValue.u}else if(fromTargetObject.t===valueTypes.COLOR||toTargetObject.t===valueTypes.COLOR){const colorValue=fromTargetObject.t===valueTypes.COLOR?fromTargetObject:toTargetObject;const notColorValue=fromTargetObject.t===valueTypes.COLOR?toTargetObject:fromTargetObject;notColorValue.t=valueTypes.COLOR;notColorValue.s=colorValue.s;notColorValue.d=[0,0,0,1]}}if(fromTargetObject.u!==toTargetObject.u){let valueToConvert=toTargetObject.u?fromTargetObject:toTargetObject;valueToConvert=convertValueUnit(target,valueToConvert,toTargetObject.u?toTargetObject.u:fromTargetObject.u,false)}if(toTargetObject.d&&fromTargetObject.d&&toTargetObject.d.length!==fromTargetObject.d.length){const longestValue=fromTargetObject.d.length>toTargetObject.d.length?fromTargetObject:toTargetObject;const shortestValue=longestValue===fromTargetObject?toTargetObject:fromTargetObject;shortestValue.d=longestValue.d.map(((_,i)=>isUnd(shortestValue.d[i])?0:shortestValue.d[i]));shortestValue.s=cloneArray(longestValue.s)}const tweenUpdateDuration=round(+tweenDuration||minValue,12);const tween={parent:this,id:tweenId++,property:propName,target:target,_value:null,_func:toFunctionStore.func,_ease:parseEasings(tweenEasing),_fromNumbers:cloneArray(fromTargetObject.d),_toNumbers:cloneArray(toTargetObject.d),_strings:cloneArray(toTargetObject.s),_fromNumber:fromTargetObject.n,_toNumber:toTargetObject.n,_numbers:cloneArray(fromTargetObject.d),_number:fromTargetObject.n,_unit:toTargetObject.u,_modifier:tweenModifier,_currentTime:0,_startTime:tweenStartTime,_delay:+tweenDelay,_updateDuration:tweenUpdateDuration,_changeDuration:tweenUpdateDuration,_absoluteStartTime:absoluteStartTime,_tweenType:tweenType,_valueType:toTargetObject.t,_composition:tweenComposition,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};if(tweenComposition!==compositionTypes.none){composeTween(tween,siblings)}if(isNaN(firstTweenChangeStartTime)){firstTweenChangeStartTime=tween._startTime}lastTweenChangeEndTime=round(tweenStartTime+tweenUpdateDuration,12);prevTween=tween;animationAnimationLength++;addChild(this,tween)}if(isNaN(iterationDelay)||firstTweenChangeStartTime<iterationDelay){iterationDelay=firstTweenChangeStartTime}if(isNaN(iterationDuration)||lastTweenChangeEndTime>iterationDuration){iterationDuration=lastTweenChangeEndTime}if(tweenType===tweenTypes.TRANSFORM){lastTransformGroupIndex=animationAnimationLength-tweenIndex;lastTransformGroupLength=animationAnimationLength}}}if(!isNaN(lastTransformGroupIndex)){let i=0;forEachChildren(this,(tween=>{if(i>=lastTransformGroupIndex&&i<lastTransformGroupLength){tween._renderTransforms=1;if(tween._composition===compositionTypes.blend){forEachChildren(additive.animation,(additiveTween=>{if(additiveTween.id===tween.id){additiveTween._renderTransforms=1}}))}}i++}))}}if(!targetsLength){console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`)}if(iterationDelay){forEachChildren(this,(tween=>{if(!(tween._startTime-tween._delay)){tween._delay-=iterationDelay}tween._startTime-=iterationDelay}));iterationDuration-=iterationDelay}else{iterationDelay=0}if(!iterationDuration){iterationDuration=minValue;this.iterationCount=0}this.targets=parsedTargets;this.duration=iterationDuration===minValue?minValue:clampInfinity((iterationDuration+this._loopDelay)*this.iterationCount-this._loopDelay)||minValue;this.onRender=onRender||animDefaults.onRender;this._ease=animEase;this._delay=iterationDelay;this.iterationDuration=iterationDuration;this._inlineStyles=animInlineStyles;if(!this._autoplay&&shouldTriggerRender)this.onRender(this)}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;forEachChildren(this,(tween=>{tween._updateDuration=normalizeTime(tween._updateDuration*timeScale);tween._changeDuration=normalizeTime(tween._changeDuration*timeScale);tween._currentTime*=timeScale;tween._startTime*=timeScale;tween._absoluteStartTime*=timeScale}));return super.stretch(newDuration)}refresh(){forEachChildren(this,(tween=>{const tweenFunc=tween._func;if(tweenFunc){const ogValue=getOriginalAnimatableValue(tween.target,tween.property,tween._tweenType);decomposeRawValue(ogValue,decomposedOriginalValue);decomposeRawValue(tweenFunc(),toTargetObject);tween._fromNumbers=cloneArray(decomposedOriginalValue.d);tween._fromNumber=decomposedOriginalValue.n;tween._toNumbers=cloneArray(toTargetObject.d);tween._strings=cloneArray(toTargetObject.s);tween._toNumber=toTargetObject.n}}));return this}revert(){super.revert();return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const animate=(targets,parameters)=>new JSAnimation(targets,parameters,null,0,false).init();const easingToLinear=(fn,samples=100)=>{const points=[];for(let i=0;i<=samples;i++)points.push(fn(i/samples));return`linear(${points.join(", ")})`};const WAAPIEasesLookups={in:"ease-in",out:"ease-out",inOut:"ease-in-out"};const WAAPIeases=(()=>{const list={};for(let type in easeTypes)list[type]=a=>easeTypes[type](easeInPower(a));return list})();const parseWAAPIEasing=ease=>{let parsedEase=WAAPIEasesLookups[ease];if(parsedEase)return parsedEase;parsedEase="linear";if(isStr(ease)){if(stringStartsWith(ease,"linear")||stringStartsWith(ease,"cubic-")||stringStartsWith(ease,"steps")||stringStartsWith(ease,"ease")){parsedEase=ease}else if(stringStartsWith(ease,"cubicB")){parsedEase=toLowerCase(ease)}else{const parsed=parseEaseString(ease,WAAPIeases,WAAPIEasesLookups);if(isFnc(parsed))parsedEase=parsed===none?"linear":easingToLinear(parsed)}WAAPIEasesLookups[ease]=parsedEase}else if(isFnc(ease)){const easing=easingToLinear(ease);if(easing)parsedEase=easing}else if(ease.ease){parsedEase=easingToLinear(ease.ease)}return parsedEase};const transformsShorthands=["x","y","z"];const commonDefaultPXProperties=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...transformsShorthands];const validIndividualTransforms=(()=>[...transformsShorthands,...validTransforms.filter((t=>["X","Y","Z"].some((axis=>t.endsWith(axis)))))])();let transformsPropertiesRegistered=null;const WAAPIAnimationsLookups={_head:null,_tail:null};const removeWAAPIAnimation=($el,property,parent)=>{let nextLookup=WAAPIAnimationsLookups._head;while(nextLookup){const next=nextLookup._next;const matchTarget=nextLookup.$el===$el;const matchProperty=!property||nextLookup.property===property;const matchParent=!parent||nextLookup.parent===parent;if(matchTarget&&matchProperty&&matchParent){const anim=nextLookup.animation;try{anim.commitStyles()}catch{}anim.cancel();removeChild(WAAPIAnimationsLookups,nextLookup);const lookupParent=nextLookup.parent;if(lookupParent){lookupParent._completed++;if(lookupParent.animations.length===lookupParent._completed){lookupParent.completed=true;if(!lookupParent.muteCallbacks){lookupParent.paused=true;lookupParent.onComplete(lookupParent);lookupParent._resolve(lookupParent)}}}}nextLookup=next}};const addWAAPIAnimation=(parent,$el,property,keyframes,params)=>{const animation=$el.animate(keyframes,params);const animTotalDuration=params.delay+ +params.duration*params.iterations;animation.playbackRate=parent._speed;if(parent.paused)animation.pause();if(parent.duration<animTotalDuration){parent.duration=animTotalDuration;parent.controlAnimation=animation}parent.animations.push(animation);removeWAAPIAnimation($el,property);addChild(WAAPIAnimationsLookups,{parent:parent,animation:animation,$el:$el,property:property,_next:null,_prev:null});const handleRemove=()=>{removeWAAPIAnimation($el,property,parent)};animation.onremove=handleRemove;animation.onfinish=handleRemove;return animation};const normalizeTweenValue=(propName,value,$el,i,targetsLength)=>{let v=getFunctionValue(value,$el,i,targetsLength);if(!isNum(v))return v;if(commonDefaultPXProperties.includes(propName)||stringStartsWith(propName,"translate"))return`${v}px`;if(stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew"))return`${v}deg`;return`${v}`};const parseIndividualTweenValue=($el,propName,from,to,i,targetsLength)=>{let tweenValue="0";const computedTo=!isUnd(to)?normalizeTweenValue(propName,to,$el,i,targetsLength):getComputedStyle($el)[propName];if(!isUnd(from)){const computedFrom=normalizeTweenValue(propName,from,$el,i,targetsLength);tweenValue=[computedFrom,computedTo]}else{tweenValue=isArr(to)?to.map((v=>normalizeTweenValue(propName,v,$el,i,targetsLength))):computedTo}return tweenValue};class WAAPIAnimation{constructor(targets,params){if(scope.current)scope.current.register(this);if(isNil(transformsPropertiesRegistered)){if(isBrowser&&(isUnd(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"))){transformsPropertiesRegistered=false}else{validTransforms.forEach((t=>{const isSkew=stringStartsWith(t,"skew");const isScale=stringStartsWith(t,"scale");const isRotate=stringStartsWith(t,"rotate");const isTranslate=stringStartsWith(t,"translate");const isAngle=isRotate||isSkew;const syntax=isAngle?"<angle>":isScale?"<number>":isTranslate?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:syntax,inherits:false,initialValue:isTranslate?"0px":isAngle?"0deg":isScale?"1":"0"})}catch{}}));transformsPropertiesRegistered=true}}const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;if(!targetsLength){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=ease.ease&&ease;const autoplay=setValue(params.autoplay,globals.defaults.autoplay);const scroll=autoplay&&autoplay.link?autoplay:false;const alternate=params.alternate&&params.alternate===true;const reversed=params.reversed&&params.reversed===true;const loop=setValue(params.loop,globals.defaults.loop);const iterations=loop===true||loop===Infinity?Infinity:isNum(loop)?loop+1:1;const direction=alternate?reversed?"alternate-reverse":"alternate":reversed?"reverse":"normal";const fill="forwards";const easing=parseWAAPIEasing(ease);const timeScale=globals.timeScale===1?1:K;this.targets=parsedTargets;this.animations=[];this.controlAnimation=null;this.onComplete=params.onComplete||noop;this.duration=0;this.muteCallbacks=false;this.completed=false;this.paused=!autoplay||scroll!==false;this.reversed=reversed;this.autoplay=autoplay;this._speed=setValue(params.playbackRate,globals.defaults.playbackRate);this._resolve=noop;this._completed=0;this._inlineStyles=parsedTargets.map(($el=>$el.getAttribute("style")));parsedTargets.forEach((($el,i)=>{const cachedTransforms=$el[transformsSymbol];const hasIndividualTransforms=validIndividualTransforms.some((t=>params.hasOwnProperty(t)));const duration=(spring?spring.duration:getFunctionValue(setValue(params.duration,globals.defaults.duration),$el,i,targetsLength))*timeScale;const delay=getFunctionValue(setValue(params.delay,globals.defaults.delay),$el,i,targetsLength)*timeScale;const composite=setValue(params.composition,"replace");for(let name in params){if(!isKey(name))continue;const keyframes={};const tweenParams={iterations:iterations,direction:direction,fill:fill,easing:easing,duration:duration,delay:delay,composite:composite};const propertyValue=params[name];const individualTransformProperty=hasIndividualTransforms?validTransforms.includes(name)?name:shortTransforms.get(name):false;let parsedPropertyValue;if(isObj(propertyValue)){const tweenOptions=propertyValue;const tweenOptionsEase=setValue(tweenOptions.ease,ease);const tweenOptionsSpring=tweenOptionsEase.ease&&tweenOptionsEase;const to=tweenOptions.to;const from=tweenOptions.from;tweenParams.duration=(tweenOptionsSpring?tweenOptionsSpring.duration:getFunctionValue(setValue(tweenOptions.duration,duration),$el,i,targetsLength))*timeScale;tweenParams.delay=getFunctionValue(setValue(tweenOptions.delay,delay),$el,i,targetsLength)*timeScale;tweenParams.composite=setValue(tweenOptions.composition,composite);tweenParams.easing=parseWAAPIEasing(tweenOptionsEase);parsedPropertyValue=parseIndividualTweenValue($el,name,from,to,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parseIndividualTweenValue($el,name,from,to,i,targetsLength)}addWAAPIAnimation(this,$el,name,keyframes,tweenParams);if(!isUnd(from)){if(!individualTransformProperty){$el.style[name]=keyframes[name][0]}else{const key=`--${individualTransformProperty}`;$el.style.setProperty(key,keyframes[key][0])}}}else{parsedPropertyValue=isArr(propertyValue)?propertyValue.map((v=>normalizeTweenValue(name,v,$el,i,targetsLength))):normalizeTweenValue(name,propertyValue,$el,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parsedPropertyValue}addWAAPIAnimation(this,$el,name,keyframes,tweenParams)}}if(hasIndividualTransforms){let transforms=emptyString;for(let t in cachedTransforms){transforms+=`${transformsFragmentStrings[t]}var(--${t})) `}$el.style.transform=transforms}}));if(scroll){this.autoplay.link(this)}}forEach(callback){const cb=isStr(callback)?a=>a[callback]():callback;this.animations.forEach(cb);return this}get speed(){return this._speed}set speed(speed){this._speed=+speed;this.forEach((anim=>anim.playbackRate=speed))}get currentTime(){const controlAnimation=this.controlAnimation;const timeScale=globals.timeScale;return this.completed?this.duration:controlAnimation?+controlAnimation.currentTime*(timeScale===1?1:timeScale):0}set currentTime(time){const t=time*(globals.timeScale===1?1:K);this.forEach((anim=>{if(t>=this.duration)anim.play();anim.currentTime=t}))}get progress(){return this.currentTime/this.duration}set progress(progress){this.forEach((anim=>anim.currentTime=progress*this.duration||0))}resume(){if(!this.paused)return this;this.paused=false;return this.forEach("play")}pause(){if(this.paused)return this;this.paused=true;return this.forEach("pause")}alternate(){this.reversed=!this.reversed;this.forEach("reverse");if(this.paused)this.forEach("pause");return this}play(){if(this.reversed)this.alternate();return this.resume()}reverse(){if(!this.reversed)this.alternate();return this.resume()}seek(time,muteCallbacks=false){if(muteCallbacks)this.muteCallbacks=true;if(time<this.duration)this.completed=false;this.currentTime=time;this.muteCallbacks=false;if(this.paused)this.pause();return this}restart(){this.completed=false;return this.seek(0,true).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){this.forEach("cancel");return this.pause()}revert(){this.cancel();this.targets.forEach((($el,i)=>$el.setAttribute("style",this._inlineStyles[i])));return this}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const waapi={animate:(targets,params)=>new WAAPIAnimation(targets,params),convertEase:easingToLinear};const sync=(callback=noop)=>new Timer({duration:1*globals.timeScale,onComplete:callback},null,0).resume();function getTargetValue(targetSelector,propName,unit){const targets=registerTargets(targetSelector);if(!targets.length)return;const[target]=targets;const tweenType=getTweenType(target,propName);const normalizePropName=sanitizePropertyName(propName,target,tweenType);let originalValue=getOriginalAnimatableValue(target,normalizePropName);if(isUnd(unit)){return originalValue}else{decomposeRawValue(originalValue,decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.NUMBER||decomposedOriginalValue.t===valueTypes.UNIT){if(unit===false){return decomposedOriginalValue.n}else{const convertedValue=convertValueUnit(target,decomposedOriginalValue,unit,false);return`${round(convertedValue.n,globals.precision)}${convertedValue.u}`}}}}const setTargetValues=(targets,parameters)=>{if(isUnd(parameters))return;parameters.duration=minValue;parameters.composition=setValue(parameters.composition,compositionTypes.none);return new JSAnimation(targets,parameters,null,0,true).resume()};const removeTargetsFromAnimation=(targetsArray,animation,propertyName)=>{let tweensMatchesTargets=false;forEachChildren(animation,(tween=>{const tweenTarget=tween.target;if(targetsArray.includes(tweenTarget)){const tweenName=tween.property;const tweenType=tween._tweenType;const normalizePropName=sanitizePropertyName(propertyName,tweenTarget,tweenType);if(!normalizePropName||normalizePropName&&normalizePropName===tweenName){if(tween.parent._tail===tween&&tween._tweenType===tweenTypes.TRANSFORM&&tween._prev&&tween._prev._tweenType===tweenTypes.TRANSFORM){tween._prev._renderTransforms=1}removeChild(animation,tween);removeTweenSliblings(tween);tweensMatchesTargets=true}}}),true);return tweensMatchesTargets};const remove=(targets,renderable,propertyName)=>{const targetsArray=parseTargets(targets);const parent=renderable?renderable:engine;const waapiAnimation=renderable&&renderable.controlAnimation&&renderable;for(let i=0,l=targetsArray.length;i<l;i++){const $el=targetsArray[i];removeWAAPIAnimation($el,propertyName,waapiAnimation)}let removeMatches;if(parent._hasChildren){let iterationDuration=0;forEachChildren(parent,(child=>{if(!child._hasChildren){removeMatches=removeTargetsFromAnimation(targetsArray,child,propertyName);if(removeMatches&&!child._head){child.cancel();removeChild(parent,child)}else{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>iterationDuration){iterationDuration=childDur}}}if(child._head){remove(targets,child,propertyName)}else{child._hasChildren=false}}),true);if(!isUnd(parent.iterationDuration)){parent.iterationDuration=iterationDuration}}else{removeMatches=removeTargetsFromAnimation(targetsArray,parent,propertyName)}if(removeMatches&&!parent._head){parent._hasChildren=false;if(parent.cancel)parent.cancel()}return targetsArray};const keepTime=createRefreshable;const randomPick=items=>items[random(0,items.length-1)];const roundPad=(v,decimalLength)=>(+v).toFixed(decimalLength);const padStart=(v,totalLength,padString)=>`${v}`.padStart(totalLength,padString);const padEnd=(v,totalLength,padString)=>`${v}`.padEnd(totalLength,padString);const wrap=(v,min,max)=>((v-min)%(max-min)+(max-min))%(max-min)+min;const mapRange=(value,inLow,inHigh,outLow,outHigh)=>outLow+(value-inLow)/(inHigh-inLow)*(outHigh-outLow);const degToRad=degrees=>degrees*PI/180;const radToDeg=radians=>radians*180/PI;const lerp=(start,end,amount,renderable)=>{let dt=K/globals.defaults.frameRate;if(renderable!==false){const ticker=renderable||engine._hasChildren&&engine;if(ticker&&ticker.deltaTime){dt=ticker.deltaTime}}const t=1-Math.exp(-amount*dt*.1);return!amount?start:amount===1?end:(1-t)*start+t*end};const curry=(fn,last=0)=>(...args)=>last?v=>fn(...args,v):v=>fn(v,...args);const chain=fn=>(...args)=>{const result=fn(...args);return new Proxy(noop,{apply:(_,__,[v])=>result(v),get:(_,prop)=>chain(((...nextArgs)=>{const nextResult=utils[prop](...nextArgs);return v=>nextResult(result(v))}))})};const makeChainable=(fn,right=0)=>(...args)=>(args.length<fn.length?chain(curry(fn,right)):fn)(...args);const utils={$:registerTargets,get:getTargetValue,set:setTargetValues,remove:remove,cleanInlineStyles:cleanInlineStyles,random:random,randomPick:randomPick,shuffle:shuffle,lerp:lerp,sync:sync,keepTime:keepTime,clamp:makeChainable(clamp),round:makeChainable(round),snap:makeChainable(snap),wrap:makeChainable(wrap),interpolate:makeChainable(interpolate,1),mapRange:makeChainable(mapRange),roundPad:makeChainable(roundPad),padStart:makeChainable(padStart),padEnd:makeChainable(padEnd),degToRad:makeChainable(degToRad),radToDeg:makeChainable(radToDeg)};const getPrevChildOffset=(timeline,timePosition)=>{if(stringStartsWith(timePosition,"<")){const goToPrevAnimationOffset=timePosition[1]==="<";const prevAnimation=timeline._tail;const prevOffset=prevAnimation?prevAnimation._offset+prevAnimation._delay:0;return goToPrevAnimationOffset?prevOffset:prevOffset+prevAnimation.duration}};const parseTimelinePosition=(timeline,timePosition)=>{let tlDuration=timeline.iterationDuration;if(tlDuration===minValue)tlDuration=0;if(isUnd(timePosition))return tlDuration;if(isNum(+timePosition))return+timePosition;const timePosStr=timePosition;const tlLabels=timeline?timeline.labels:null;const hasLabels=!isNil(tlLabels);const prevOffset=getPrevChildOffset(timeline,timePosStr);const hasSibling=!isUnd(prevOffset);const matchedRelativeOperator=relativeValuesExecRgx.exec(timePosStr);if(matchedRelativeOperator){const fullOperator=matchedRelativeOperator[0];const split=timePosStr.split(fullOperator);const labelOffset=hasLabels&&split[0]?tlLabels[split[0]]:tlDuration;const parsedOffset=hasSibling?prevOffset:hasLabels?labelOffset:tlDuration;const parsedNumericalOffset=+split[1];return getRelativeValue(parsedOffset,parsedNumericalOffset,fullOperator[0])}else{return hasSibling?prevOffset:hasLabels?!isUnd(tlLabels[timePosStr])?tlLabels[timePosStr]:tlDuration:tlDuration}};function getTimelineTotalDuration(tl){return clampInfinity((tl.iterationDuration+tl._loopDelay)*tl.iterationCount-tl._loopDelay)||minValue}function addTlChild(childParams,tl,timePosition,targets,index,length){const isSetter=isNum(childParams.duration)&&childParams.duration<=minValue;const adjustedPosition=isSetter?timePosition-minValue:timePosition;tick(tl,adjustedPosition,1,1,tickModes.AUTO);const tlChild=targets?new JSAnimation(targets,childParams,tl,adjustedPosition,false,index,length):new Timer(childParams,tl,adjustedPosition);tlChild.init(1);addChild(tl,tlChild);forEachChildren(tl,(child=>{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>tl.iterationDuration)tl.iterationDuration=childDur}));tl.duration=getTimelineTotalDuration(tl);return tl}class Timeline extends Timer{constructor(parameters={}){super(parameters,null,0);this.duration=0;this.labels={};const defaultsParams=parameters.defaults;const globalDefaults=globals.defaults;this.defaults=defaultsParams?mergeObjects(defaultsParams,globalDefaults):globalDefaults;this.onRender=parameters.onRender||globalDefaults.onRender;const tlPlaybackEase=setValue(parameters.playbackEase,globalDefaults.playbackEase);this._ease=tlPlaybackEase?parseEasings(tlPlaybackEase):null;this.iterationDuration=0}add(a1,a2,a3){const isAnim=isObj(a2);const isTimer=isObj(a1);if(isAnim||isTimer){this._hasChildren=true;if(isAnim){const childParams=a2;if(isFnc(a3)){const staggeredPosition=a3;const parsedTargetsArray=parseTargets(a1);const tlDuration=this.duration;const tlIterationDuration=this.iterationDuration;const id=childParams.id;let i=0;const parsedLength=parsedTargetsArray.length;parsedTargetsArray.forEach((target=>{const staggeredChildParams={...childParams};this.duration=tlDuration;this.iterationDuration=tlIterationDuration;if(!isUnd(id))staggeredChildParams.id=id+"-"+i;addTlChild(staggeredChildParams,this,staggeredPosition(target,i,parsedLength,this),target,i,parsedLength);i++}))}else{addTlChild(childParams,this,parseTimelinePosition(this,a3),a1)}}else{addTlChild(a1,this,parseTimelinePosition(this,a2))}return this.init(1)}}sync(synced,position){if(isUnd(synced)||synced&&isUnd(synced.pause))return this;synced.pause();const duration=+(synced.effect?synced.effect.getTiming().duration:synced.duration);return this.add(synced,{currentTime:[0,duration],duration:duration,ease:"linear"},position)}set(targets,parameters,position){if(isUnd(parameters))return this;parameters.duration=minValue;parameters.composition=compositionTypes.replace;return this.add(targets,parameters,position)}call(callback,position){if(isUnd(callback)||callback&&!isFnc(callback))return this;return this.add({duration:0,onComplete:()=>callback(this)},position)}label(labelName,position){if(isUnd(labelName)||labelName&&!isStr(labelName))return this;this.labels[labelName]=parseTimelinePosition(this,position);return this}remove(targets,propertyName){remove(targets,this,propertyName);return this}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;const labels=this.labels;forEachChildren(this,(child=>child.stretch(child.duration*timeScale)));for(let labelName in labels)labels[labelName]*=timeScale;return super.stretch(newDuration)}refresh(){forEachChildren(this,(child=>{if(child.refresh)child.refresh()}));return this}revert(){super.revert();forEachChildren(this,(child=>child.revert),true);return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const createTimeline=parameters=>new Timeline(parameters).init();class Animatable{constructor(targets,parameters){if(scope.current)scope.current.register(this);const globalParams={};const properties={};this.targets=[];this.animations={};if(isUnd(targets)||isUnd(parameters))return;for(let propName in parameters){const paramValue=parameters[propName];if(isKey(propName)){properties[propName]=paramValue}else{globalParams[propName]=paramValue}}for(let propName in properties){const propValue=properties[propName];const isObjValue=isObj(propValue);let propParams={};let to="+=0";if(isObjValue){const unit=propValue.unit;if(isStr(unit))to+=unit}else{propParams.duration=propValue}propParams[propName]=isObjValue?mergeObjects({to:to},propValue):to;const animParams=mergeObjects(globalParams,propParams);animParams.composition=compositionTypes.replace;animParams.autoplay=false;const animation=this.animations[propName]=new JSAnimation(targets,animParams,null,0,false).init();if(!this.targets.length)this.targets.push(...animation.targets);this[propName]=(to,duration,ease)=>{const tween=animation._head;if(isUnd(to)&&tween){const numbers=tween._numbers;if(numbers&&numbers.length){return numbers}else{return tween._modifier(tween._number)}}else{forEachChildren(animation,(tween=>{if(isArr(to)){for(let i=0,l=to.length;i<l;i++){if(!isUnd(tween._numbers[i])){tween._fromNumbers[i]=tween._modifier(tween._numbers[i]);tween._toNumbers[i]=to[i]}}}else{tween._fromNumber=tween._modifier(tween._number);tween._toNumber=to}if(!isUnd(ease))tween._ease=parseEasings(ease);tween._currentTime=0}));if(!isUnd(duration))animation.stretch(duration);animation.reset(1).resume();return this}}}}revert(){for(let propName in this.animations){this[propName]=noop;this.animations[propName].revert()}this.animations={};this.targets.length=0;return this}}const createAnimatable=(targets,parameters)=>new Animatable(targets,parameters);class Spring{constructor(parameters={}){this.timeStep=.02;this.restThreshold=5e-4;this.restDuration=200;this.maxDuration=6e4;this.maxRestSteps=this.restDuration/this.timeStep/K;this.maxIterations=this.maxDuration/this.timeStep/K;this.m=clamp(setValue(parameters.mass,1),0,K);this.s=clamp(setValue(parameters.stiffness,100),1,K);this.d=clamp(setValue(parameters.damping,10),.1,K);this.v=clamp(setValue(parameters.velocity,0),-1e3,K);this.w0=0;this.zeta=0;this.wd=0;this.b=0;this.solverDuration=0;this.duration=0;this.compute();this.ease=t=>t===0||t===1?t:this.solve(t*this.solverDuration)}solve(time){const{zeta:zeta,w0:w0,wd:wd,b:b}=this;let t=time;if(zeta<1){t=exp(-t*zeta*w0)*(1*cos(wd*t)+b*sin(wd*t))}else{t=(1+b*t)*exp(-t*w0)}return 1-t}compute(){const{maxRestSteps:maxRestSteps,maxIterations:maxIterations,restThreshold:restThreshold,timeStep:timeStep,m:m,d:d,s:s,v:v}=this;const w0=this.w0=clamp(sqrt(s/m),minValue,K);const zeta=this.zeta=d/(2*sqrt(s*m));const wd=this.wd=zeta<1?w0*sqrt(1-zeta*zeta):0;this.b=zeta<1?(zeta*w0+-v)/wd:-v+w0;let solverTime=0;let restSteps=0;let iterations=0;while(restSteps<maxRestSteps&&iterations<maxIterations){if(abs(1-this.solve(solverTime))<restThreshold){restSteps++}else{restSteps=0}this.solverDuration=solverTime;solverTime+=timeStep;iterations++}this.duration=round(this.solverDuration*K,0)*globals.timeScale}get mass(){return this.m}set mass(v){this.m=clamp(setValue(v,1),0,K);this.compute()}get stiffness(){return this.s}set stiffness(v){this.s=clamp(setValue(v,100),1,K);this.compute()}get damping(){return this.d}set damping(v){this.d=clamp(setValue(v,10),.1,K);this.compute()}get velocity(){return this.v}set velocity(v){this.v=clamp(setValue(v,0),-1e3,K);this.compute()}}const createSpring=parameters=>new Spring(parameters);const preventDefault=e=>{if(e.cancelable)e.preventDefault()};class DOMProxy{constructor(el){this.el=el;this.zIndex=0;this.parentElement=null;this.classList={add:noop,remove:noop}}get x(){return this.el.x||0}set x(v){this.el.x=v}get y(){return this.el.y||0}set y(v){this.el.y=v}get width(){return this.el.width||0}set width(v){this.el.width=v}get height(){return this.el.height||0}set height(v){this.el.height=v}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Transforms{constructor($el){this.$el=$el;this.inlineTransforms=[];this.point=new DOMPoint;this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(x,y){this.point.x=x;this.point.y=y;return this.point.matrixTransform(this.inversedMatrix)}traverseUp(cb){let $el=this.$el.parentElement,i=0;while($el&&$el!==doc){cb($el,i);$el=$el.parentElement;i++}}getMatrix(){const matrix=new DOMMatrix;this.traverseUp(($el=>{const transformValue=getComputedStyle($el).transform;if(transformValue){const elMatrix=new DOMMatrix(transformValue);matrix.preMultiplySelf(elMatrix)}}));return matrix}remove(){this.traverseUp((($el,i)=>{this.inlineTransforms[i]=$el.style.transform;$el.style.transform="none"}))}revert(){this.traverseUp((($el,i)=>{const ct=this.inlineTransforms[i];if(ct===""){$el.style.removeProperty("transform")}else{$el.style.transform=ct}}))}}const parseDraggableFunctionParameter=(value,draggable)=>value&&isFnc(value)?value(draggable):value;let zIndex=0;class Draggable{constructor(target,parameters={}){if(!target)return;if(scope.current)scope.current.register(this);const paramX=parameters.x;const paramY=parameters.y;const trigger=parameters.trigger;const modifier=parameters.modifier;const ease=parameters.releaseEase;const customEase=ease&&parseEasings(ease);const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const xProp=isObj(paramX)&&!isUnd(paramX.mapTo)?paramX.mapTo:"translateX";const yProp=isObj(paramY)&&!isUnd(paramY.mapTo)?paramY.mapTo:"translateY";const container=parseDraggableFunctionParameter(parameters.container,this);this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.$target=isObj(target)?new DOMProxy(target):parseTargets(target)[0];this.$trigger=parseTargets(trigger?trigger:target)[0];this.fixed=getTargetValue(this.$target,"position")==="fixed";this.isFinePointer=true;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.maxVelocity=0;this.minVelocity=0;this.velocityMultiplier=0;this.cursor=false;this.releaseXSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseYSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseEase=customEase||eases.outQuint;this.hasReleaseSpring=hasSpring;this.onGrab=parameters.onGrab||noop;this.onDrag=parameters.onDrag||noop;this.onRelease=parameters.onRelease||noop;this.onUpdate=parameters.onUpdate||noop;this.onSettle=parameters.onSettle||noop;this.onSnap=parameters.onSnap||noop;this.onResize=parameters.onResize||noop;this.onAfterResize=parameters.onAfterResize||noop;this.disabled=[0,0];const animatableParams={};if(modifier)animatableParams.modifier=modifier;if(isUnd(paramX)||paramX===true){animatableParams[xProp]=0}else if(isObj(paramX)){const paramXObject=paramX;const animatableXParams={};if(paramXObject.modifier)animatableXParams.modifier=paramXObject.modifier;if(paramXObject.composition)animatableXParams.composition=paramXObject.composition;animatableParams[xProp]=animatableXParams}else if(paramX===false){animatableParams[xProp]=0;this.disabled[0]=1}if(isUnd(paramY)||paramY===true){animatableParams[yProp]=0}else if(isObj(paramY)){const paramYObject=paramY;const animatableYParams={};if(paramYObject.modifier)animatableYParams.modifier=paramYObject.modifier;if(paramYObject.composition)animatableYParams.composition=paramYObject.composition;animatableParams[yProp]=animatableYParams}else if(paramY===false){animatableParams[yProp]=0;this.disabled[1]=1}this.animate=new Animatable(this.$target,animatableParams);this.xProp=xProp;this.yProp=yProp;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=[-1e12,maxValue,maxValue,-1e12];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=now();this.velocity=0;this.angle=0;this.cursorStyles=null;this.triggerStyles=null;this.bodyStyles=null;this.targetStyles=null;this.touchActionStyles=null;this.transforms=new Transforms(this.$target);this.overshootCoords={x:0,y:0};this.overshootXTicker=new Timer({autoplay:false},null,0).init();this.overshootYTicker=new Timer({autoplay:false},null,0).init();this.updateTicker=new Timer({autoplay:false},null,0).init();this.overshootXTicker.onUpdate=()=>{if(this.disabled[0])return;this.updated=true;this.manual=true;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootXTicker.onComplete=()=>{if(this.disabled[0])return;this.manual=false;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootYTicker.onUpdate=()=>{if(this.disabled[1])return;this.updated=true;this.manual=true;this.animate[this.yProp](this.overshootCoords.y,0)};this.overshootYTicker.onComplete=()=>{if(this.disabled[1])return;this.manual=false;this.animate[this.yProp](this.overshootCoords.y,0)};this.updateTicker.onUpdate=()=>this.update();this.contained=!isUnd(container);this.manual=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.enabled=false;this.initialized=false;this.activeProp=this.disabled[1]?xProp:yProp;this.animate.animations[this.activeProp].onRender=()=>{const hasUpdated=this.updated;const hasMoved=this.grabbed&&hasUpdated;const hasReleased=!hasMoved&&this.released;const x=this.x;const y=this.y;const dx=x-this.coords[2];const dy=y-this.coords[3];this.deltaX=dx;this.deltaY=dy;this.coords[2]=x;this.coords[3]=y;if(hasUpdated){this.onUpdate(this)}if(!hasReleased){this.updated=false}else{this.computeVelocity(dx,dy);this.angle=atan2(dy,dx)}};this.animate.animations[this.activeProp].onComplete=()=>{if(!this.grabbed&&this.released){this.released=false}if(!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 Timer({autoplay:false,duration:150*globals.timeScale,onComplete:()=>{this.onResize(this);this.refresh();this.onAfterResize(this)}}).init();this.parameters=parameters;this.resizeObserver=new ResizeObserver((()=>{if(this.initialized){this.resizeTicker.restart()}else{this.initialized=true}}));this.enable();this.refresh();this.resizeObserver.observe(this.$container);if(!isObj(target))this.resizeObserver.observe(this.$target)}computeVelocity(dx,dy){const prevTime=this.velocityTime;const curTime=now();const elapsed=curTime-prevTime;if(elapsed<17)return this.velocity;this.velocityTime=curTime;const velocityStack=this.velocityStack;const vMul=this.velocityMultiplier;const minV=this.minVelocity;const maxV=this.maxVelocity;const vi=this.velocityStackIndex;velocityStack[vi]=round(clamp(sqrt(dx*dx+dy*dy)/elapsed*vMul,minV,maxV),5);const velocity=max(velocityStack[0],velocityStack[1],velocityStack[2]);this.velocity=velocity;this.velocityStackIndex=(vi+1)%3;return velocity}setX(x,muteUpdateCallback=false){if(this.disabled[0])return;const v=round(x,5);this.overshootXTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destX=v;this.snapped[0]=snap(v,this.snapX);this.animate[this.xProp](v,0);this.manual=false;return this}setY(y,muteUpdateCallback=false){if(this.disabled[1])return;const v=round(y,5);this.overshootYTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destY=v;this.snapped[1]=snap(v,this.snapY);this.animate[this.yProp](v,0);this.manual=false;return this}get x(){return round(this.animate[this.xProp](),globals.precision)}set x(x){this.setX(x,false)}get y(){return round(this.animate[this.yProp](),globals.precision)}set y(y){this.setY(y,false)}get progressX(){return mapRange(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(x){this.setX(mapRange(x,0,1,this.containerBounds[3],this.containerBounds[1]),false)}get progressY(){return mapRange(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(y){this.setY(mapRange(y,0,1,this.containerBounds[0],this.containerBounds[2]),false)}updateScrollCoords(){const sx=round(this.useWin?win.scrollX:this.$container.scrollLeft,0);const sy=round(this.useWin?win.scrollY:this.$container.scrollTop,0);const[cpt,cpr,cpb,cpl]=this.containerPadding;const threshold=this.scrollThreshold;this.scroll.x=sx;this.scroll.y=sy;this.scrollBounds[0]=sy-this.targetBounds[0]+cpt-threshold;this.scrollBounds[1]=sx-this.targetBounds[1]-cpr+threshold;this.scrollBounds[2]=sy-this.targetBounds[2]-cpb+threshold;this.scrollBounds[3]=sx-this.targetBounds[3]+cpl-threshold}updateBoundingValues(){const $container=this.$container;const cx=this.x;const cy=this.y;const cx2=this.coords[2];const cy2=this.coords[3];this.coords[2]=0;this.coords[3]=0;this.setX(0,true);this.setY(0,true);this.transforms.remove();const iw=this.window[0]=win.innerWidth;const ih=this.window[1]=win.innerHeight;const uw=this.useWin;const sw=$container.scrollWidth;const sh=$container.scrollHeight;const fx=this.fixed;const transformContainerRect=$container.getBoundingClientRect();const[cpt,cpr,cpb,cpl]=this.containerPadding;this.dragArea[0]=uw?0:transformContainerRect.left;this.dragArea[1]=uw?0:transformContainerRect.top;this.scrollView[0]=uw?clamp(sw,iw,sw):sw;this.scrollView[1]=uw?clamp(sh,ih,sh):sh;this.updateScrollCoords();const{width:width,height:height,left:left,top:top,right:right,bottom:bottom}=$container.getBoundingClientRect();this.dragArea[2]=round(uw?clamp(width,iw,iw):width,0);this.dragArea[3]=round(uw?clamp(height,ih,ih):height,0);const containerOverflow=getTargetValue($container,"overflow");const visibleOverflow=containerOverflow==="visible";const hiddenOverflow=containerOverflow==="hidden";this.canScroll=fx?false:this.contained&&($container===doc.body&&visibleOverflow||!hiddenOverflow&&!visibleOverflow)&&(sw>this.dragArea[2]+cpl-cpr||sh>this.dragArea[3]+cpt-cpb)&&(!this.containerArray||this.containerArray&&!isArr(this.containerArray));if(this.contained){const sx=this.scroll.x;const sy=this.scroll.y;const canScroll=this.canScroll;const targetRect=this.$target.getBoundingClientRect();const hiddenLeft=canScroll?uw?0:$container.scrollLeft:0;const hiddenTop=canScroll?uw?0:$container.scrollTop:0;const hiddenRight=canScroll?this.scrollView[0]-hiddenLeft-width:0;const hiddenBottom=canScroll?this.scrollView[1]-hiddenTop-height:0;this.targetBounds[0]=round(targetRect.top+sy-(uw?0:top),0);this.targetBounds[1]=round(targetRect.right+sx-(uw?iw:right),0);this.targetBounds[2]=round(targetRect.bottom+sy-(uw?ih:bottom),0);this.targetBounds[3]=round(targetRect.left+sx-(uw?0:left),0);if(this.containerArray){this.containerBounds[0]=this.containerArray[0]+cpt;this.containerBounds[1]=this.containerArray[1]-cpr;this.containerBounds[2]=this.containerArray[2]-cpb;this.containerBounds[3]=this.containerArray[3]+cpl}else{this.containerBounds[0]=-round(targetRect.top-(fx?clamp(top,0,ih):top)+hiddenTop-cpt,0);this.containerBounds[1]=-round(targetRect.right-(fx?clamp(right,0,iw):right)-hiddenRight+cpr,0);this.containerBounds[2]=-round(targetRect.bottom-(fx?clamp(bottom,0,ih):bottom)-hiddenBottom+cpb,0);this.containerBounds[3]=-round(targetRect.left-(fx?clamp(left,0,iw):left)+hiddenLeft-cpl,0)}}this.transforms.revert();this.coords[2]=cx2;this.coords[3]=cy2;this.setX(cx,true);this.setY(cy,true)}isOutOfBounds(bounds,x,y){if(!this.contained)return 0;const[bt,br,bb,bl]=bounds;const[dx,dy]=this.disabled;const obx=!dx&&x<bl||!dx&&x>br;const oby=!dy&&y<bt||!dy&&y>bb;return obx&&!oby?1:!obx&&oby?2:obx&&oby?3:0}refresh(){const params=this.parameters;const paramX=params.x;const paramY=params.y;const container=parseDraggableFunctionParameter(params.container,this);const cp=parseDraggableFunctionParameter(params.containerPadding,this)||0;const containerPadding=isArr(cp)?cp:[cp,cp,cp,cp];const cx=this.x;const cy=this.y;const parsedCursorStyles=parseDraggableFunctionParameter(params.cursor,this);const cursorStyles={onHover:"grab",onGrab:"grabbing"};if(parsedCursorStyles){const{onHover:onHover,onGrab:onGrab}=parsedCursorStyles;if(onHover)cursorStyles.onHover=onHover;if(onGrab)cursorStyles.onGrab=onGrab}this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.isFinePointer=matchMedia("(pointer:fine)").matches;this.containerPadding=setValue(containerPadding,[0,0,0,0]);this.containerFriction=clamp(setValue(parseDraggableFunctionParameter(params.containerFriction,this),.8),0,1);this.releaseContainerFriction=clamp(setValue(parseDraggableFunctionParameter(params.releaseContainerFriction,this),this.containerFriction),0,1);this.snapX=parseDraggableFunctionParameter(isObj(paramX)&&!isUnd(paramX.snap)?paramX.snap:params.snap,this);this.snapY=parseDraggableFunctionParameter(isObj(paramY)&&!isUnd(paramY.snap)?paramY.snap:params.snap,this);this.scrollSpeed=setValue(parseDraggableFunctionParameter(params.scrollSpeed,this),1.5);this.scrollThreshold=setValue(parseDraggableFunctionParameter(params.scrollThreshold,this),20);this.dragSpeed=setValue(parseDraggableFunctionParameter(params.dragSpeed,this),1);this.minVelocity=setValue(parseDraggableFunctionParameter(params.minVelocity,this),0);this.maxVelocity=setValue(parseDraggableFunctionParameter(params.maxVelocity,this),50);this.velocityMultiplier=setValue(parseDraggableFunctionParameter(params.velocityMultiplier,this),1);this.cursor=parsedCursorStyles===false?false:cursorStyles;this.updateBoundingValues();const[bt,br,bb,bl]=this.containerBounds;this.setX(clamp(cx,bl,br),true);this.setY(clamp(cy,bt,bb),true)}update(){this.updateScrollCoords();if(this.canScroll){const[cpt,cpr,cpb,cpl]=this.containerPadding;const[sw,sh]=this.scrollView;const daw=this.dragArea[2];const dah=this.dragArea[3];const csx=this.scroll.x;const csy=this.scroll.y;const nsw=this.$container.scrollWidth;const nsh=this.$container.scrollHeight;const csw=this.useWin?clamp(nsw,this.window[0],nsw):nsw;const csh=this.useWin?clamp(nsh,this.window[1],nsh):nsh;const swd=sw-csw;const shd=sh-csh;if(this.dragged&&swd>0){this.coords[0]-=swd;this.scrollView[0]=csw}if(this.dragged&&shd>0){this.coords[1]-=shd;this.scrollView[1]=csh}const s=this.scrollSpeed*10;const threshold=this.scrollThreshold;const[x,y]=this.coords;const[st,sr,sb,sl]=this.scrollBounds;const t=round(clamp((y-st+cpt)/threshold,-1,0)*s,0);const r=round(clamp((x-sr-cpr)/threshold,0,1)*s,0);const b=round(clamp((y-sb-cpb)/threshold,0,1)*s,0);const l=round(clamp((x-sl+cpl)/threshold,-1,0)*s,0);if(t||b||l||r){const[nx,ny]=this.disabled;let scrollX=csx;let scrollY=csy;if(!nx){scrollX=round(clamp(csx+(l||r),0,sw-daw),0);this.coords[0]-=csx-scrollX}if(!ny){scrollY=round(clamp(csy+(t||b),0,sh-dah),0);this.coords[1]-=csy-scrollY}if(this.useWin){this.$scrollContainer.scrollBy(-(csx-scrollX),-(csy-scrollY))}else{this.$scrollContainer.scrollTo(scrollX,scrollY)}}}const[ct,cr,cb,cl]=this.containerBounds;const[px1,py1,px2,py2,px3,py3]=this.pointer;this.coords[0]+=(px1-px3)*this.dragSpeed;this.coords[1]+=(py1-py3)*this.dragSpeed;this.pointer[4]=px1;this.pointer[5]=py1;const[cx,cy]=this.coords;const[sx,sy]=this.snapped;const cf=(1-this.containerFriction)*this.dragSpeed;this.setX(cx>cr?cr+(cx-cr)*cf:cx<cl?cl+(cx-cl)*cf:cx,false);this.setY(cy>cb?cb+(cy-cb)*cf:cy<ct?ct+(cy-ct)*cf:cy,false);this.computeVelocity(px1-px3,py1-py3);this.angle=atan2(py1-py2,px1-px2);const[nsx,nsy]=this.snapped;if(nsx!==sx&&this.snapX||nsy!==sy&&this.snapY){this.onSnap(this)}}stop(){this.updateTicker.pause();this.overshootXTicker.pause();this.overshootYTicker.pause();for(let prop in this.animate.animations)this.animate.animations[prop].pause();remove(this,null,"x");remove(this,null,"y");remove(this,null,"progressX");remove(this,null,"progressY");remove(this.scroll);remove(this.overshootCoords);return this}scrollInView(duration,gap=0,ease=eases.inOutQuad){this.updateScrollCoords();const x=this.destX;const y=this.destY;const scroll=this.scroll;const scrollBounds=this.scrollBounds;const canScroll=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(scrollBounds,x,y)){const[st,sr,sb,sl]=scrollBounds;const t=round(clamp(y-st,-1e12,0),0);const r=round(clamp(x-sr,0,maxValue),0);const b=round(clamp(y-sb,0,maxValue),0);const l=round(clamp(x-sl,-1e12,0),0);new JSAnimation(scroll,{x:round(scroll.x+(l?l-gap:r?r+gap:0),0),y:round(scroll.y+(t?t-gap:b?b+gap:0),0),duration:isUnd(duration)?350*globals.timeScale:duration,ease:ease,onUpdate:()=>{this.canScroll=false;this.$scrollContainer.scrollTo(scroll.x,scroll.y)}}).init().then((()=>{this.canScroll=canScroll}))}return this}handleHover(){if(this.isFinePointer&&this.cursor&&!this.cursorStyles){this.cursorStyles=setTargetValues(this.$trigger,{cursor:this.cursor.onHover})}}animateInView(duration,gap=0,ease=eases.inOutQuad){this.stop();this.updateBoundingValues();const x=this.x;const y=this.y;const[cpt,cpr,cpb,cpl]=this.containerPadding;const bt=this.scroll.y-this.targetBounds[0]+cpt+gap;const br=this.scroll.x-this.targetBounds[1]-cpr-gap;const bb=this.scroll.y-this.targetBounds[2]-cpb-gap;const bl=this.scroll.x-this.targetBounds[3]+cpl+gap;const ob=this.isOutOfBounds([bt,br,bb,bl],x,y);if(ob){const[disabledX,disabledY]=this.disabled;const destX=clamp(snap(x,this.snapX),bl,br);const destY=clamp(snap(y,this.snapY),bt,bb);const dur=isUnd(duration)?350*globals.timeScale:duration;if(!disabledX&&(ob===1||ob===3))this.animate[this.xProp](destX,dur,ease);if(!disabledY&&(ob===2||ob===3))this.animate[this.yProp](destY,dur,ease)}return this}handleDown(e){const $eTarget=e.target;if(this.grabbed||$eTarget.type==="range")return;e.stopPropagation();this.grabbed=true;this.released=false;this.stop();this.updateBoundingValues();const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const[ct,cr,cb,cl]=this.containerBounds;const cf=(1-this.containerFriction)*this.dragSpeed;const cx=this.x;const cy=this.y;this.coords[0]=this.coords[2]=!cf?cx:cx>cr?cr+(cx-cr)/cf:cx<cl?cl+(cx-cl)/cf:cx;this.coords[1]=this.coords[3]=!cf?cy:cy>cb?cb+(cy-cb)/cf:cy<ct?ct+(cy-ct)/cf:cy;this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y;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;if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}const z=getTargetValue(this.$target,"zIndex",false);zIndex=(z>zIndex?z:zIndex)+1;this.targetStyles=setTargetValues(this.$target,{zIndex:zIndex});if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.isFinePointer&&this.cursor){this.bodyStyles=setTargetValues(doc.body,{cursor:this.cursor.onGrab})}this.scrollInView(100,0,eases.out(3));this.onGrab(this);doc.addEventListener("touchmove",this);doc.addEventListener("touchend",this);doc.addEventListener("touchcancel",this);doc.addEventListener("mousemove",this);doc.addEventListener("mouseup",this);doc.addEventListener("selectstart",this)}handleMove(e){if(!this.grabbed)return;const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const movedX=x-this.pointer[6];const movedY=y-this.pointer[7];let $parent=e.target;let isAtTop=false;let isAtBottom=false;let canTouchScroll=false;while(touches&&$parent&&$parent!==this.$trigger){const overflowY=getTargetValue($parent,"overflow-y");if(overflowY!=="hidden"&&overflowY!=="visible"){const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=$parent;if(scrollHeight>clientHeight){canTouchScroll=true;isAtTop=scrollTop<=3;isAtBottom=scrollTop>=scrollHeight-clientHeight-3;break}}$parent=$parent.parentNode}if(canTouchScroll&&(!isAtTop&&!isAtBottom||isAtTop&&movedY<0||isAtBottom&&movedY>0)){this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y}else{preventDefault(e);if(!this.triggerStyles)this.triggerStyles=setTargetValues(this.$trigger,{pointerEvents:"none"});this.$trigger.addEventListener("touchstart",preventDefault,{passive:false});this.$trigger.addEventListener("touchmove",preventDefault,{passive:false});this.$trigger.addEventListener("touchend",preventDefault);if(!this.disabled[0]&&abs(movedX)>3||!this.disabled[1]&&abs(movedY)>3){this.updateTicker.resume();this.pointer[2]=this.pointer[0];this.pointer[3]=this.pointer[1];this.pointer[0]=x;this.pointer[1]=y;this.dragged=true;this.released=false;this.onDrag(this)}}}handleUp(){if(!this.grabbed)return;this.updateTicker.pause();if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}const[disabledX,disabledY]=this.disabled;const[px1,py1,px2,py2,px3,py3]=this.pointer;const[ct,cr,cb,cl]=this.containerBounds;const[sx,sy]=this.snapped;const springX=this.releaseXSpring;const springY=this.releaseYSpring;const releaseEase=this.releaseEase;const hasReleaseSpring=this.hasReleaseSpring;const overshootCoords=this.overshootCoords;const cx=this.x;const cy=this.y;const pv=this.computeVelocity(px1-px3,py1-py3);const pa=this.angle=atan2(py1-py2,px1-px2);const ds=pv*150;const cf=(1-this.releaseContainerFriction)*this.dragSpeed;const nx=cx+cos(pa)*ds;const ny=cy+sin(pa)*ds;const bx=nx>cr?cr+(nx-cr)*cf:nx<cl?cl+(nx-cl)*cf:nx;const by=ny>cb?cb+(ny-cb)*cf:ny<ct?ct+(ny-ct)*cf:ny;const dx=this.destX=clamp(round(snap(bx,this.snapX),5),cl,cr);const dy=this.destY=clamp(round(snap(by,this.snapY),5),ct,cb);const ob=this.isOutOfBounds(this.containerBounds,nx,ny);let durationX=0;let durationY=0;let easeX=releaseEase;let easeY=releaseEase;let longestReleaseDuration=0;overshootCoords.x=cx;overshootCoords.y=cy;if(!disabledX){const directionX=dx===cr?cx>cr?-1:1:cx<cl?-1:1;const distanceX=round(cx-dx,0);springX.velocity=disabledY&&hasReleaseSpring?distanceX?ds*directionX/abs(distanceX):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springX;durationX=cx===dx?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeX=ease;if(durationX>longestReleaseDuration)longestReleaseDuration=durationX}if(!disabledY){const directionY=dy===cb?cy>cb?-1:1:cy<ct?-1:1;const distanceY=round(cy-dy,0);springY.velocity=disabledX&&hasReleaseSpring?distanceY?ds*directionY/abs(distanceY):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springY;durationY=cy===dy?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeY=ease;if(durationY>longestReleaseDuration)longestReleaseDuration=durationY}if(!hasReleaseSpring&&ob&&cf&&(durationX||durationY)){const composition=compositionTypes.blend;new JSAnimation(overshootCoords,{x:{to:bx,duration:durationX*.65},y:{to:by,duration:durationY*.65},ease:releaseEase,composition:composition}).init();new JSAnimation(overshootCoords,{x:{to:dx,duration:durationX},y:{to:dy,duration:durationY},ease:releaseEase,composition:composition}).init();this.overshootXTicker.stretch(durationX).restart();this.overshootYTicker.stretch(durationY).restart()}else{if(!disabledX)this.animate[this.xProp](dx,durationX,easeX);if(!disabledY)this.animate[this.yProp](dy,durationY,easeY)}this.scrollInView(longestReleaseDuration,this.scrollThreshold,releaseEase);let hasSnapped=false;if(dx!==sx){this.snapped[0]=dx;if(this.snapX)hasSnapped=true}if(dy!==sy&&this.snapY){this.snapped[1]=dy;if(this.snapY)hasSnapped=true}if(hasSnapped)this.onSnap(this);this.grabbed=false;this.dragged=false;this.updated=true;this.released=true;this.onRelease(this);this.$trigger.removeEventListener("touchstart",preventDefault);this.$trigger.removeEventListener("touchmove",preventDefault);this.$trigger.removeEventListener("touchend",preventDefault);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this)}reset(){this.stop();this.resizeTicker.pause();this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.setX(0,true);this.setY(0,true);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;return this}enable(){if(!this.enabled){this.enabled=true;this.$target.classList.remove("is-disabled");this.touchActionStyles=setTargetValues(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"});this.$trigger.addEventListener("touchstart",this,{passive:true});this.$trigger.addEventListener("mousedown",this,{passive:true});this.$trigger.addEventListener("mouseenter",this)}return this}disable(){this.enabled=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.touchActionStyles.revert();if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}this.stop();this.$target.classList.add("is-disabled");this.$trigger.removeEventListener("touchstart",this);this.$trigger.removeEventListener("mousedown",this);this.$trigger.removeEventListener("mouseenter",this);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this);return this}revert(){this.reset();this.disable();this.$target.classList.remove("is-disabled");this.updateTicker.revert();this.overshootXTicker.revert();this.overshootYTicker.revert();this.resizeTicker.revert();this.animate.revert();return this}handleEvent(e){switch(e.type){case"mousedown":this.handleDown(e);break;case"touchstart":this.handleDown(e);break;case"mousemove":this.handleMove(e);break;case"touchmove":this.handleMove(e);break;case"mouseup":this.handleUp();break;case"touchend":this.handleUp();break;case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":preventDefault(e);break}}}const createDraggable=(target,parameters)=>new Draggable(target,parameters);class Scope{constructor(parameters={}){if(scope.current)scope.current.register(this);const rootParam=parameters.root;let root=doc;if(rootParam){root=rootParam.current||rootParam.nativeElement||parseTargets(rootParam)[0]||doc}const scopeDefaults=parameters.defaults;const globalDefault=globals.defaults;const mediaQueries=parameters.mediaQueries;this.defaults=scopeDefaults?mergeObjects(scopeDefaults,globalDefault):globalDefault;this.root=root;this.constructors=[];this.revertConstructors=[];this.revertibles=[];this.constructorsOnce=[];this.revertConstructorsOnce=[];this.revertiblesOnce=[];this.once=false;this.onceIndex=0;this.methods={};this.matches={};this.mediaQueryLists={};this.data={};if(mediaQueries){for(let mq in mediaQueries){const _mq=win.matchMedia(mediaQueries[mq]);this.mediaQueryLists[mq]=_mq;_mq.addEventListener("change",this)}}}register(revertible){const store=this.once?this.revertiblesOnce:this.revertibles;store.push(revertible)}execute(cb){let activeScope=scope.current;let activeRoot=scope.root;let activeDefaults=globals.defaults;scope.current=this;scope.root=this.root;globals.defaults=this.defaults;const mqs=this.mediaQueryLists;for(let mq in mqs)this.matches[mq]=mqs[mq].matches;const returned=cb(this);scope.current=activeScope;scope.root=activeRoot;globals.defaults=activeDefaults;return returned}refresh(){this.onceIndex=0;this.execute((()=>{let i=this.revertibles.length;let y=this.revertConstructors.length;while(i--)this.revertibles[i].revert();while(y--)this.revertConstructors[y](this);this.revertibles.length=0;this.revertConstructors.length=0;this.constructors.forEach((constructor=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructors.push(revertConstructor)}}))}));return this}add(a1,a2){this.once=false;if(isFnc(a1)){const constructor=a1;this.constructors.push(constructor);this.execute((()=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructors.push(revertConstructor)}}))}else{this.methods[a1]=(...args)=>this.execute((()=>a2(...args)))}return this}addOnce(scopeConstructorCallback){this.once=true;if(isFnc(scopeConstructorCallback)){const currentIndex=this.onceIndex++;const tracked=this.constructorsOnce[currentIndex];if(tracked)return this;const constructor=scopeConstructorCallback;this.constructorsOnce[currentIndex]=constructor;this.execute((()=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructorsOnce.push(revertConstructor)}}))}return this}keepTime(cb){this.once=true;const currentIndex=this.onceIndex++;const tracked=this.constructorsOnce[currentIndex];if(isFnc(tracked))return tracked(this);const constructor=createRefreshable(cb);this.constructorsOnce[currentIndex]=constructor;let trackedTickable;this.execute((()=>{trackedTickable=constructor(this)}));return trackedTickable}handleEvent(e){switch(e.type){case"change":this.refresh();break}}revert(){const revertibles=this.revertibles;const revertConstructors=this.revertConstructors;const revertiblesOnce=this.revertiblesOnce;const revertConstructorsOnce=this.revertConstructorsOnce;const mqs=this.mediaQueryLists;let i=revertibles.length;let j=revertConstructors.length;let k=revertiblesOnce.length;let l=revertConstructorsOnce.length;while(i--)revertibles[i].revert();while(j--)revertConstructors[j](this);while(k--)revertiblesOnce[k].revert();while(l--)revertConstructorsOnce[l](this);for(let mq in mqs)mqs[mq].removeEventListener("change",this);revertibles.length=0;revertConstructors.length=0;this.constructors.length=0;revertiblesOnce.length=0;revertConstructorsOnce.length=0;this.constructorsOnce.length=0;this.onceIndex=0;this.matches={};this.methods={};this.mediaQueryLists={};this.data={}}}const createScope=params=>new Scope(params);const getMaxViewHeight=()=>{const $el=document.createElement("div");doc.body.appendChild($el);$el.style.height="100lvh";const height=$el.offsetHeight;doc.body.removeChild($el);return height};const parseScrollObserverFunctionParameter=(value,scroller)=>value&&isFnc(value)?value(scroller):value;const scrollContainers=new Map;class ScrollContainer{constructor($el){this.element=$el;this.useWin=this.element===doc.body;this.winWidth=0;this.winHeight=0;this.width=0;this.height=0;this.left=0;this.top=0;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=false;this.backwardY=false;this.scrollTicker=new Timer({autoplay:false,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const backwards=this.backwardX||this.backwardY;forEachChildren(this,(child=>child.handleScroll()),backwards)},onComplete:()=>this.dataTimer.pause()}).init();this.dataTimer=new Timer({autoplay:false,frameRate:30,onUpdate:self=>{const dt=self.deltaTime;const px=this.prevScrollX;const py=this.prevScrollY;const nx=this.scrollX;const ny=this.scrollY;const dx=px-nx;const dy=py-ny;this.prevScrollX=nx;this.prevScrollY=ny;if(dx)this.backwardX=px>nx;if(dy)this.backwardY=py>ny;this.velocity=round(dt>0?Math.sqrt(dx*dx+dy*dy)/dt:0,5)}}).init();this.resizeTicker=new Timer({autoplay:false,duration:250*globals.timeScale,onComplete:()=>{this.updateWindowBounds();this.refreshScrollObservers();this.handleScroll()}}).init();this.wakeTicker=new Timer({autoplay:false,duration:500*globals.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?win:this.element).addEventListener("scroll",this,false)}updateScrollCoords(){const useWin=this.useWin;const $el=this.element;this.scrollX=round(useWin?win.scrollX:$el.scrollLeft,0);this.scrollY=round(useWin?win.scrollY:$el.scrollTop,0)}updateWindowBounds(){this.winWidth=win.innerWidth;this.winHeight=getMaxViewHeight()}updateBounds(){const style=getComputedStyle(this.element);const $el=this.element;this.scrollWidth=$el.scrollWidth+parseFloat(style.marginLeft)+parseFloat(style.marginRight);this.scrollHeight=$el.scrollHeight+parseFloat(style.marginTop)+parseFloat(style.marginBottom);this.updateWindowBounds();let width,height;if(this.useWin){width=this.winWidth;height=this.winHeight}else{const elRect=$el.getBoundingClientRect();width=elRect.width;height=elRect.height;this.top=elRect.top;this.left=elRect.left}this.width=width;this.height=height}refreshScrollObservers(){forEachChildren(this,(child=>{if(child._debug){child.removeDebug()}}));this.updateBounds();forEachChildren(this,(child=>{child.refresh();if(child._debug){child.debug()}}))}refresh(){this.updateWindowBounds();this.updateBounds();this.refreshScrollObservers();this.handleScroll()}handleScroll(){this.updateScrollCoords();this.wakeTicker.restart()}handleEvent(e){switch(e.type){case"scroll":this.handleScroll();break}}revert(){this.scrollTicker.cancel();this.dataTimer.cancel();this.resizeTicker.cancel();this.wakeTicker.cancel();this.resizeObserver.unobserve(this.element);(this.useWin?win:this.element).removeEventListener("scroll",this);scrollContainers.delete(this.element)}}const registerAndGetScrollContainer=target=>{const $el=target?parseTargets(target)[0]||doc.body:doc.body;let scrollContainer=scrollContainers.get($el);if(!scrollContainer){scrollContainer=new ScrollContainer($el);scrollContainers.set($el,scrollContainer)}return scrollContainer};const convertValueToPx=($el,v,size,under,over)=>{const clampMin=v==="min";const clampMax=v==="max";const value=v==="top"||v==="left"||v==="start"||clampMin?0:v==="bottom"||v==="right"||v==="end"||clampMax?"100%":v==="center"?"50%":v;const{n:n,u:u}=decomposeRawValue(value,decomposedOriginalValue);let px=n;if(u==="%"){px=n/100*size}else if(u){px=convertValueUnit($el,decomposedOriginalValue,"px",true).n}if(clampMax&&under<0)px+=under;if(clampMin&&over>0)px+=over;return px};const parseBoundValue=($el,v,size,under,over)=>{let value;if(isStr(v)){const matchedOperator=relativeValuesExecRgx.exec(v);if(matchedOperator){const splitter=matchedOperator[0];const operator=splitter[0];const splitted=v.split(splitter);const clampMin=splitted[0]==="min";const clampMax=splitted[0]==="max";const valueAPx=convertValueToPx($el,splitted[0],size,under,over);const valueBPx=convertValueToPx($el,splitted[1],size,under,over);if(clampMin){const min=getRelativeValue(convertValueToPx($el,"min",size),valueBPx,operator);value=min<valueAPx?valueAPx:min}else if(clampMax){const max=getRelativeValue(convertValueToPx($el,"max",size),valueBPx,operator);value=max>valueAPx?valueAPx:max}else{value=getRelativeValue(valueAPx,valueBPx,operator)}}else{value=convertValueToPx($el,v,size,under,over)}}else{value=v}return round(value,0)};const getAnimationDomTarget=linked=>{let $linkedTarget;const linkedTargets=linked.targets;for(let i=0,l=linkedTargets.length;i<l;i++){const target=linkedTargets[i];if(target[isDomSymbol]){$linkedTarget=target;break}}return $linkedTarget};let scrollerIndex=0;const debugColors$1=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ScrollObserver{constructor(parameters={}){if(scope.current)scope.current.register(this);const syncMode=setValue(parameters.sync,"play pause");const ease=syncMode?parseEasings(syncMode):null;const isLinear=syncMode&&(syncMode==="linear"||syncMode===none);const isEase=syncMode&&!(ease===none&&!isLinear);const isSmooth=syncMode&&(isNum(syncMode)||syncMode===true||isLinear);const isMethods=syncMode&&(isStr(syncMode)&&!isEase&&!isSmooth);const syncMethods=isMethods?syncMode.split(" ").map((m=>()=>{const linked=this.linked;return linked&&linked[m]?linked[m]():null})):null;const biDirSync=isMethods&&syncMethods.length>2;this.index=scrollerIndex++;this.id=!isUnd(parameters.id)?parameters.id:this.index;this.container=registerAndGetScrollContainer(parameters.container);this.target=null;this.linked=null;this.repeat=null;this.horizontal=null;this.enter=null;this.leave=null;this.sync=isEase||isSmooth||!!syncMethods;this.syncEase=isEase?ease:null;this.syncSmooth=isSmooth?syncMode===true||isLinear?1:syncMode:null;this.onSyncEnter=syncMethods&&!biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeave=syncMethods&&!biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterForward=syncMethods&&biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeaveForward=syncMethods&&biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterBackward=syncMethods&&biDirSync&&syncMethods[2]?syncMethods[2]:noop;this.onSyncLeaveBackward=syncMethods&&biDirSync&&syncMethods[3]?syncMethods[3]:noop;this.onEnter=parameters.onEnter||noop;this.onLeave=parameters.onLeave||noop;this.onEnterForward=parameters.onEnterForward||noop;this.onLeaveForward=parameters.onLeaveForward||noop;this.onEnterBackward=parameters.onEnterBackward||noop;this.onLeaveBackward=parameters.onLeaveBackward||noop;this.onUpdate=parameters.onUpdate||noop;this.onSyncComplete=parameters.onSyncComplete||noop;this.reverted=false;this.completed=false;this.began=false;this.isInView=false;this.forceEnter=false;this.hasEntered=false;this.offsets=[];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=parameters;this._debug=setValue(parameters.debug,false);this._next=null;this._prev=null;addChild(this.container,this);sync((()=>{if(this.reverted)return;if(!this.target){const target=parseTargets(parameters.target)[0];this.target=target||doc.body;this.refresh()}if(this._debug)this.debug()}))}link(linked){if(linked){linked.pause();this.linked=linked;if(!this._params.target){let $linkedTarget;if(!isUnd(linked.targets)){$linkedTarget=getAnimationDomTarget(linked)}else{forEachChildren(linked,(child=>{if(child.targets&&!$linkedTarget){$linkedTarget=getAnimationDomTarget(child)}}))}this.target=$linkedTarget||doc.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 p=(this.scroll-this.offsetStart)/this.distance;return p===Infinity||isNaN(p)?0:round(clamp(p,0,1),6)}refresh(){this.reverted=false;const params=this._params;this.repeat=setValue(parseScrollObserverFunctionParameter(params.repeat,this),true);this.horizontal=setValue(parseScrollObserverFunctionParameter(params.axis,this),"y")==="x";this.enter=setValue(parseScrollObserverFunctionParameter(params.enter,this),"end start");this.leave=setValue(parseScrollObserverFunctionParameter(params.leave,this),"start end");this.updateBounds();this.handleScroll();return this}removeDebug(){if(this.$debug){this.$debug.parentNode.removeChild(this.$debug);this.$debug=null}if(this.debugStyles){this.debugStyles.revert();this.$debug=null}return this}debug(){this.removeDebug();const container=this.container;const isHori=this.horizontal;const $existingDebug=container.element.querySelector(":scope > .animejs-onscroll-debug");const $debug=doc.createElement("div");const $thresholds=doc.createElement("div");const $triggers=doc.createElement("div");const color=debugColors$1[this.index%debugColors$1.length];const useWin=container.useWin;const containerWidth=useWin?container.winWidth:container.width;const containerHeight=useWin?container.winHeight:container.height;const scrollWidth=container.scrollWidth;const scrollHeight=container.scrollHeight;const size=this.container.width>360?320:260;const offLeft=isHori?0:10;const offTop=isHori?10:0;const half=isHori?24:size/2;const labelHeight=isHori?half:15;const labelWidth=isHori?60:half;const labelSize=isHori?labelWidth:labelHeight;const repeat=isHori?"repeat-x":"repeat-y";const gradientOffset=v=>isHori?"0px "+v+"px":v+"px"+" 2px";const lineCSS=c=>`linear-gradient(${isHori?90:0}deg, ${c} 2px, transparent 1px)`;const baseCSS=(p,l,t,w,h)=>`position:${p};left:${l}px;top:${t}px;width:${w}px;height:${h}px;`;$debug.style.cssText=`${baseCSS("absolute",offLeft,offTop,isHori?scrollWidth:size,isHori?size:scrollHeight)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `;$thresholds.style.cssText=`${baseCSS("sticky",0,0,isHori?containerWidth:half,isHori?half:containerHeight)}`;if(!$existingDebug){$thresholds.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(half-10)} / ${isHori?"100px 100px":"100px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(half-10)} / ${isHori?"10px 10px":"10px 10px"} ${repeat};\n `}$triggers.style.cssText=`${baseCSS("relative",0,0,isHori?scrollWidth:half,isHori?half:scrollHeight)}`;if(!$existingDebug){$triggers.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(0)} / ${isHori?"100px 10px":"10px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(0)} / ${isHori?"10px 0px":"0px 10px"} ${repeat};\n `}const labels=[" enter: "," leave: "];this.coords.forEach(((v,i)=>{const isView=i>1;const value=(isView?0:this.offset)+v;const isTail=i%2;const isFirst=value<labelSize;const isOver=value>(isView?isHori?containerWidth:containerHeight:isHori?scrollWidth:scrollHeight)-labelSize;const isFlip=(isView?isTail&&!isFirst:!isTail&&!isFirst)||isOver;const $label=doc.createElement("div");const $text=doc.createElement("div");const dirProp=isHori?isFlip?"right":"left":isFlip?"bottom":"top";const flipOffset=isFlip?(isHori?labelWidth:labelHeight)+(!isView?isHori?-1:-2:isHori?-1:isOver?0:-2):!isView?isHori?1:0:isHori?1:0;$text.innerHTML=`${this.id}${labels[isTail]}${this.thresholds[i]}`;$label.style.cssText=`${baseCSS("absolute",0,0,labelWidth,labelHeight)}\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n justify-content: flex-${isView?"start":"end"};\n align-items: flex-${isFlip?"end":"start"};\n border-${dirProp}: 2px ${isTail?"solid":"solid"} ${color};\n `;$text.style.cssText=`\n overflow: hidden;\n max-width: ${size/2-10}px;\n height: ${labelHeight};\n margin-${isHori?isFlip?"right":"left":isFlip?"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: ${isHori&&isFlip||!isHori&&!isView?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${isTail?color:"rgba(0,0,0,.75)"};\n background-color: ${isTail?"rgba(0,0,0,.65)":color};\n border: 2px solid ${isTail?color:"transparent"};\n border-${isHori?isFlip?"top-left":"top-right":isFlip?"top-left":"bottom-left"}-radius: 5px;\n border-${isHori?isFlip?"bottom-left":"bottom-right":isFlip?"top-right":"bottom-right"}-radius: 5px;\n `;$label.appendChild($text);let position=value-flipOffset+(isHori?1:0);$label.style[isHori?"left":"top"]=`${position}px`;(isView?$thresholds:$triggers).appendChild($label)}));$debug.appendChild($thresholds);$debug.appendChild($triggers);container.element.appendChild($debug);if(!$existingDebug)$debug.classList.add("animejs-onscroll-debug");this.$debug=$debug;const containerPosition=getTargetValue(container.element,"position");if(containerPosition==="static"){this.debugStyles=setTargetValues(container.element,{position:"relative "})}}updateBounds(){if(this._debug){this.removeDebug()}let stickys;const $target=this.target;const container=this.container;const isHori=this.horizontal;const linked=this.linked;let linkedTime;let $el=$target;let offsetX=0;let offsetY=0;let $offsetParent=$el;if(linked){linkedTime=linked.currentTime;linked.seek(0,true)}const isContainerStatic=getTargetValue(container.element,"position")==="static"?setTargetValues(container.element,{position:"relative "}):false;while($el&&$el!==container.element&&$el!==doc.body){const isSticky=getTargetValue($el,"position")==="sticky"?setTargetValues($el,{position:"static"}):false;if($el===$offsetParent){offsetX+=$el.offsetLeft||0;offsetY+=$el.offsetTop||0;$offsetParent=$el.offsetParent}$el=$el.parentElement;if(isSticky){if(!stickys)stickys=[];stickys.push(isSticky)}}if(isContainerStatic)isContainerStatic.revert();const offset=isHori?offsetX:offsetY;const targetSize=isHori?$target.offsetWidth:$target.offsetHeight;const containerSize=isHori?container.width:container.height;const scrollSize=isHori?container.scrollWidth:container.scrollHeight;const maxScroll=scrollSize-containerSize;const enter=this.enter;const leave=this.leave;let enterTarget="start";let leaveTarget="end";let enterContainer="end";let leaveContainer="start";if(isStr(enter)){const splitted=enter.split(" ");enterContainer=splitted[0];enterTarget=splitted.length>1?splitted[1]:enterTarget}else if(isObj(enter)){const e=enter;if(!isUnd(e.container))enterContainer=e.container;if(!isUnd(e.target))enterTarget=e.target}else if(isNum(enter)){enterContainer=enter}if(isStr(leave)){const splitted=leave.split(" ");leaveContainer=splitted[0];leaveTarget=splitted.length>1?splitted[1]:leaveTarget}else if(isObj(leave)){const t=leave;if(!isUnd(t.container))leaveContainer=t.container;if(!isUnd(t.target))leaveTarget=t.target}else if(isNum(leave)){leaveContainer=leave}const parsedEnterTarget=parseBoundValue($target,enterTarget,targetSize);const parsedLeaveTarget=parseBoundValue($target,leaveTarget,targetSize);const under=parsedEnterTarget+offset-containerSize;const over=parsedLeaveTarget+offset-maxScroll;const parsedEnterContainer=parseBoundValue($target,enterContainer,containerSize,under,over);const parsedLeaveContainer=parseBoundValue($target,leaveContainer,containerSize,under,over);const offsetStart=parsedEnterTarget+offset-parsedEnterContainer;const offsetEnd=parsedLeaveTarget+offset-parsedLeaveContainer;const scrollDelta=offsetEnd-offsetStart;this.offsets[0]=offsetX;this.offsets[1]=offsetY;this.offset=offset;this.offsetStart=offsetStart;this.offsetEnd=offsetEnd;this.distance=scrollDelta<=0?0:scrollDelta;this.thresholds=[enterTarget,leaveTarget,enterContainer,leaveContainer];this.coords=[parsedEnterTarget,parsedLeaveTarget,parsedEnterContainer,parsedLeaveContainer];if(stickys){stickys.forEach((sticky=>sticky.revert()))}if(linked){linked.seek(linkedTime,true)}if(this._debug){this.debug()}}handleScroll(){const linked=this.linked;const sync=this.sync;const syncEase=this.syncEase;const syncSmooth=this.syncSmooth;const shouldSeek=linked&&(syncEase||syncSmooth);const isHori=this.horizontal;const container=this.container;const scroll=this.scroll;const isBefore=scroll<=this.offsetStart;const isAfter=scroll>=this.offsetEnd;const isInView=!isBefore&&!isAfter;const isOnTheEdge=scroll===this.offsetStart||scroll===this.offsetEnd;const forceEnter=!this.hasEntered&&isOnTheEdge;const $debug=this._debug&&this.$debug;let hasUpdated=false;let syncCompleted=false;let p=this.progress;if(isBefore&&this.began){this.began=false}if(p>0&&!this.began){this.began=true}if(shouldSeek){const lp=linked.progress;if(syncSmooth&&isNum(syncSmooth)){if(syncSmooth<1){const step=1e-4;const snap=lp<p&&p===1?step:lp>p&&!p?-1e-4:0;p=round(lerp(lp,p,interpolate(.01,.2,syncSmooth),false)+snap,6)}}else if(syncEase){p=syncEase(p)}hasUpdated=p!==this.prevProgress;syncCompleted=lp===1;if(hasUpdated&&!syncCompleted&&(syncSmooth&&lp)){container.wakeTicker.restart()}}if($debug){const sticky=isHori?container.scrollY:container.scrollX;$debug.style[isHori?"top":"left"]=sticky+10+"px"}if(isInView&&!this.isInView||forceEnter&&!this.forceEnter&&!this.hasEntered){if(isInView)this.isInView=true;if(!this.forceEnter||!this.hasEntered){if($debug&&isInView)$debug.style.zIndex=`${this.container.zIndex++}`;this.onSyncEnter(this);this.onEnter(this);if(this.backward){this.onSyncEnterBackward(this);this.onEnterBackward(this)}else{this.onSyncEnterForward(this);this.onEnterForward(this)}this.hasEntered=true;if(forceEnter)this.forceEnter=true}else if(isInView){this.forceEnter=false}}if(isInView||!isInView&&this.isInView){hasUpdated=true}if(hasUpdated){if(shouldSeek)linked.seek(linked.duration*p);this.onUpdate(this)}if(!isInView&&this.isInView){this.isInView=false;this.onSyncLeave(this);this.onLeave(this);if(this.backward){this.onSyncLeaveBackward(this);this.onLeaveBackward(this)}else{this.onSyncLeaveForward(this);this.onLeaveForward(this)}if(sync&&!syncSmooth){syncCompleted=true}}if(p>=1&&this.began&&!this.completed&&(sync&&syncCompleted||!sync)){if(sync){this.onSyncComplete(this)}this.completed=true;if(!this.repeat&&!linked||!this.repeat&&linked&&linked.completed){this.revert()}}if(p<1&&this.completed){this.completed=false}this.prevProgress=p}revert(){if(this.reverted)return;const container=this.container;removeChild(container,this);if(!container._head){container.revert()}if(this._debug){this.removeDebug()}this.reverted=true;return this}}const onScroll=(parameters={})=>new ScrollObserver(parameters);const segmenter=!isUnd(Intl)&&Intl.Segmenter;const valueRgx=/\{value\}/g;const indexRgx=/\{i\}/g;const whiteSpaceGroupRgx=/(\s+)/;const whiteSpaceRgx=/^\s+$/;const lineType="line";const wordType="word";const charType="char";const dataLine=`data-line`;let wordSegmenter=null;let graphemeSegmenter=null;let $splitTemplate=null;const isSegmentWordLike=seg=>seg.isWordLike||seg.segment===" "||isNum(+seg.segment);const setAriaHidden=$el=>$el.setAttribute("aria-hidden","true");const getAllTopLevelElements=($el,type)=>[...$el.querySelectorAll(`[data-${type}]:not([data-${type}] [data-${type}])`)];const debugColors={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"};const filterEmptyElements=$el=>{if(!$el.childElementCount&&!$el.textContent.trim()){const $parent=$el.parentElement;$el.remove();if($parent)filterEmptyElements($parent)}};const filterLineElements=($el,lineIndex,bin)=>{const dataLineAttr=$el.getAttribute(dataLine);if(dataLineAttr!==null&&+dataLineAttr!==lineIndex||$el.tagName==="BR")bin.add($el);let i=$el.childElementCount;while(i--)filterLineElements($el.children[i],lineIndex,bin);return bin};const generateTemplate=(type,params={})=>{let template=``;const classString=isStr(params.class)?` class="${params.class}"`:"";const cloneType=setValue(params.clone,false);const wrapType=setValue(params.wrap,false);const overflow=wrapType?wrapType===true?"clip":wrapType:cloneType?"clip":false;if(wrapType)template+=`<span${overflow?` style="overflow:${overflow};"`:""}>`;template+=`<span${classString}${cloneType?` style="position:relative;"`:""} data-${type}="{i}">`;if(cloneType){const left=cloneType==="left"?"-100%":cloneType==="right"?"100%":"0";const top=cloneType==="top"?"-100%":cloneType==="bottom"?"100%":"0";template+=`<span>{value}</span>`;template+=`<span inert style="position:absolute;top:${top};left:${left};white-space:nowrap;">{value}</span>`}else{template+=`{value}`}template+=`</span>`;if(wrapType)template+=`</span>`;return template};const processHTMLTemplate=(htmlTemplate,store,node,$parentFragment,type,debug,lineIndex,wordIndex,charIndex)=>{const isLine=type===lineType;const isChar=type===charType;const className=`_${type}_`;const template=isFnc(htmlTemplate)?htmlTemplate(node):htmlTemplate;const displayStyle=isLine?"block":"inline-block";$splitTemplate.innerHTML=template.replace(valueRgx,`<i class="${className}"></i>`).replace(indexRgx,`${isChar?charIndex:isLine?lineIndex:wordIndex}`);const $content=$splitTemplate.content;const $highestParent=$content.firstElementChild;const $split=$content.querySelector(`[data-${type}]`)||$highestParent;const $replacables=$content.querySelectorAll(`i.${className}`);const replacablesLength=$replacables.length;if(replacablesLength){$highestParent.style.display=displayStyle;$split.style.display=displayStyle;$split.setAttribute(dataLine,`${lineIndex}`);if(!isLine){$split.setAttribute("data-word",`${wordIndex}`);if(isChar)$split.setAttribute("data-char",`${charIndex}`)}let i=replacablesLength;while(i--){const $replace=$replacables[i];const $closestParent=$replace.parentElement;$closestParent.style.display=displayStyle;if(isLine){$closestParent.innerHTML=node.innerHTML}else{$closestParent.replaceChild(node.cloneNode(true),$replace)}}store.push($split);$parentFragment.appendChild($content)}else{console.warn(`The expression "{value}" is missing from the provided template.`)}if(debug)$highestParent.style.outline=`1px dotted ${debugColors[type]}`;return $highestParent};class TextSplitter{constructor(target,parameters={}){if(!wordSegmenter)wordSegmenter=segmenter?new segmenter([],{granularity:wordType}):{segment:text=>{const segments=[];const words=text.split(whiteSpaceGroupRgx);for(let i=0,l=words.length;i<l;i++){const segment=words[i];segments.push({segment:segment,isWordLike:!whiteSpaceRgx.test(segment)})}return segments}};if(!graphemeSegmenter)graphemeSegmenter=segmenter?new segmenter([],{granularity:"grapheme"}):{segment:text=>[...text].map((char=>({segment:char})))};if(!$splitTemplate&&isBrowser)$splitTemplate=doc.createElement("template");if(scope.current)scope.current.register(this);const{words:words,chars:chars,lines:lines,accessible:accessible,includeSpaces:includeSpaces,debug:debug}=parameters;const $target=(target=isArr(target)?target[0]:target)&&target.nodeType?target:(getNodeList(target)||[])[0];const lineParams=lines===true?{}:lines;const wordParams=words===true||isUnd(words)?{}:words;const charParams=chars===true?{}:chars;this.debug=setValue(debug,false);this.includeSpaces=setValue(includeSpaces,false);this.accessible=setValue(accessible,true);this.linesOnly=lineParams&&(!wordParams&&!charParams);this.lineTemplate=isObj(lineParams)?generateTemplate(lineType,lineParams):lineParams;this.wordTemplate=isObj(wordParams)||this.linesOnly?generateTemplate(wordType,wordParams):wordParams;this.charTemplate=isObj(charParams)?generateTemplate(charType,charParams):charParams;this.$target=$target;this.html=$target&&$target.innerHTML;this.lines=[];this.words=[];this.chars=[];this.effects=[];this.effectsCleanups=[];this.cache=null;this.ready=false;this.width=0;this.resizeTimeout=null;const handleSplit=()=>this.html&&(lineParams||wordParams||charParams)&&this.split();this.resizeObserver=new ResizeObserver((()=>{clearTimeout(this.resizeTimeout);this.resizeTimeout=setTimeout((()=>{const currentWidth=$target.offsetWidth;if(currentWidth===this.width)return;this.width=currentWidth;handleSplit()}),150)}));if(this.lineTemplate&&!this.ready){doc.fonts.ready.then(handleSplit)}else{handleSplit()}$target?this.resizeObserver.observe($target):console.warn("No Text Splitter target found.")}addEffect(effect){if(!isFnc(effect))return console.warn("Effect must return a function.");const refreshableEffect=createRefreshable(effect);this.effects.push(refreshableEffect);if(this.ready)this.effectsCleanups[this.effects.length-1]=refreshableEffect(this);return this}revert(){clearTimeout(this.resizeTimeout);this.lines.length=this.words.length=this.chars.length=0;this.resizeObserver.disconnect();this.effectsCleanups.forEach((cleanup=>isFnc(cleanup)?cleanup(this):cleanup.revert&&cleanup.revert()));this.$target.innerHTML=this.html;return this}splitNode(node){const wordTemplate=this.wordTemplate;const charTemplate=this.charTemplate;const includeSpaces=this.includeSpaces;const debug=this.debug;const nodeType=node.nodeType;if(nodeType===3){const nodeText=node.nodeValue;if(nodeText.trim()){const tempWords=[];const words=this.words;const chars=this.chars;const wordSegments=wordSegmenter.segment(nodeText);const $wordsFragment=doc.createDocumentFragment();let prevSeg=null;for(const wordSegment of wordSegments){const segment=wordSegment.segment;const isWordLike=isSegmentWordLike(wordSegment);if(!prevSeg||isWordLike&&(prevSeg&&isSegmentWordLike(prevSeg))){tempWords.push(segment)}else{const lastWordIndex=tempWords.length-1;const lastWord=tempWords[lastWordIndex];if(!lastWord.includes(" ")&&!segment.includes(" ")){tempWords[lastWordIndex]+=segment}else{tempWords.push(segment)}}prevSeg=wordSegment}for(let i=0,l=tempWords.length;i<l;i++){const word=tempWords[i];if(!word.trim()){if(i&&includeSpaces)continue;$wordsFragment.appendChild(doc.createTextNode(word))}else{const nextWord=tempWords[i+1];const hasWordFollowingSpace=includeSpaces&&nextWord&&!nextWord.trim();const wordToProcess=word;const charSegments=charTemplate?graphemeSegmenter.segment(wordToProcess):null;const $charsFragment=charTemplate?doc.createDocumentFragment():doc.createTextNode(hasWordFollowingSpace?word+" ":word);if(charTemplate){const charSegmentsArray=[...charSegments];for(let j=0,jl=charSegmentsArray.length;j<jl;j++){const charSegment=charSegmentsArray[j];const isLastChar=j===jl-1;const charText=isLastChar&&hasWordFollowingSpace?charSegment.segment+" ":charSegment.segment;const $charNode=doc.createTextNode(charText);processHTMLTemplate(charTemplate,chars,$charNode,$charsFragment,charType,debug,-1,words.length,chars.length)}}if(wordTemplate){processHTMLTemplate(wordTemplate,words,$charsFragment,$wordsFragment,wordType,debug,-1,words.length,chars.length)}else if(charTemplate){$wordsFragment.appendChild($charsFragment)}else{$wordsFragment.appendChild(doc.createTextNode(word))}if(hasWordFollowingSpace)i++}}node.parentNode.replaceChild($wordsFragment,node)}}else if(nodeType===1){const childNodes=[...node.childNodes];for(let i=0,l=childNodes.length;i<l;i++)this.splitNode(childNodes[i])}}split(clearCache=false){const $el=this.$target;const isCached=!!this.cache&&!clearCache;const lineTemplate=this.lineTemplate;const wordTemplate=this.wordTemplate;const charTemplate=this.charTemplate;const fontsReady=doc.fonts.status!=="loading";const canSplitLines=lineTemplate&&fontsReady;this.ready=!lineTemplate||fontsReady;if(!isCached){if(clearCache){$el.innerHTML=this.html;this.words.length=this.chars.length=0}this.splitNode($el);this.cache=$el.innerHTML}if(canSplitLines){this.effectsCleanups.forEach((cleanup=>isFnc(cleanup)&&cleanup(this)));if(isCached)$el.innerHTML=this.cache;this.lines.length=0;if(wordTemplate)this.words=getAllTopLevelElements($el,wordType)}if(charTemplate&&(canSplitLines||wordTemplate)){this.chars=getAllTopLevelElements($el,charType)}const elementsArray=this.words.length?this.words:this.chars;let y,linesCount=0;for(let i=0,l=elementsArray.length;i<l;i++){const $el=elementsArray[i];const{top:top,height:height}=$el.getBoundingClientRect();if(y&&top-y>height*.5)linesCount++;$el.setAttribute(dataLine,`${linesCount}`);const nested=$el.querySelectorAll(`[${dataLine}]`);let c=nested.length;while(c--)nested[c].setAttribute(dataLine,`${linesCount}`);y=top}if(canSplitLines){const linesFragment=doc.createDocumentFragment();const parents=new Set;const clones=[];for(let lineIndex=0;lineIndex<linesCount+1;lineIndex++){const $clone=$el.cloneNode(true);filterLineElements($clone,lineIndex,new Set).forEach(($el=>{const $parent=$el.parentElement;if($parent)parents.add($parent);$el.remove()}));clones.push($clone)}parents.forEach(filterEmptyElements);for(let cloneIndex=0,clonesLength=clones.length;cloneIndex<clonesLength;cloneIndex++){processHTMLTemplate(lineTemplate,this.lines,clones[cloneIndex],linesFragment,lineType,this.debug,cloneIndex)}$el.innerHTML="";$el.appendChild(linesFragment);if(wordTemplate)this.words=getAllTopLevelElements($el,wordType);if(charTemplate)this.chars=getAllTopLevelElements($el,charType)}if(this.linesOnly){const words=this.words;let w=words.length;while(w--){const $word=words[w];$word.replaceWith($word.textContent)}words.length=0}if(canSplitLines||clearCache){this.effects.forEach(((effect,i)=>this.effectsCleanups[i]=effect(this)))}if(this.accessible&&(canSplitLines||!isCached)){const $accessible=doc.createElement("span");$accessible.style.cssText=`position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;`;$accessible.innerHTML=this.html;$el.insertBefore($accessible,$el.firstChild);this.lines.forEach(setAriaHidden);this.words.forEach(setAriaHidden);this.chars.forEach(setAriaHidden)}this.width=$el.offsetWidth;return this}refresh(){this.split(true)}}const split=(target,parameters)=>new TextSplitter(target,parameters);const text={split:split};const stagger=(val,params={})=>{let values=[];let maxValue=0;const from=params.from;const reversed=params.reversed;const ease=params.ease;const hasEasing=!isUnd(ease);const hasSpring=hasEasing&&!isUnd(ease.ease);const staggerEase=hasSpring?ease.ease:hasEasing?parseEasings(ease):null;const grid=params.grid;const axis=params.axis;const customTotal=params.total;const fromFirst=isUnd(from)||from===0||from==="first";const fromCenter=from==="center";const fromLast=from==="last";const fromRandom=from==="random";const isRange=isArr(val);const useProp=params.use;const val1=isRange?parseNumber(val[0]):parseNumber(val);const val2=isRange?parseNumber(val[1]):0;const unitMatch=unitsExecRgx.exec((isRange?val[1]:val)+emptyString);const start=params.start||0+(isRange?val1:0);let fromIndex=fromFirst?0:isNum(from)?from:0;return(target,i,t,tl)=>{const[registeredTarget]=registerTargets(target);const total=isUnd(customTotal)?t:customTotal;const customIndex=!isUnd(useProp)?isFnc(useProp)?useProp(registeredTarget,i,total):getOriginalAnimatableValue(registeredTarget,useProp):false;const staggerIndex=isNum(customIndex)||isStr(customIndex)&&isNum(+customIndex)?+customIndex:i;if(fromCenter)fromIndex=(total-1)/2;if(fromLast)fromIndex=total-1;if(!values.length){for(let index=0;index<total;index++){if(!grid){values.push(abs(fromIndex-index))}else{const fromX=!fromCenter?fromIndex%grid[0]:(grid[0]-1)/2;const fromY=!fromCenter?floor(fromIndex/grid[0]):(grid[1]-1)/2;const toX=index%grid[0];const toY=floor(index/grid[0]);const distanceX=fromX-toX;const distanceY=fromY-toY;let value=sqrt(distanceX*distanceX+distanceY*distanceY);if(axis==="x")value=-distanceX;if(axis==="y")value=-distanceY;values.push(value)}maxValue=max(...values)}if(staggerEase)values=values.map((val=>staggerEase(val/maxValue)*maxValue));if(reversed)values=values.map((val=>axis?val<0?val*-1:-val:abs(maxValue-val)));if(fromRandom)values=shuffle(values)}const spacing=isRange?(val2-val1)/maxValue:val1;const offset=tl?parseTimelinePosition(tl,isUnd(params.start)?tl.iterationDuration:start):start;let output=offset+(spacing*round(values[staggerIndex],2)||0);if(params.modifier)output=params.modifier(output);if(unitMatch)output=`${output}${unitMatch[2]}`;return output}};exports.Animatable=Animatable;exports.Draggable=Draggable;exports.JSAnimation=JSAnimation;exports.Scope=Scope;exports.ScrollObserver=ScrollObserver;exports.Spring=Spring;exports.TextSplitter=TextSplitter;exports.Timeline=Timeline;exports.Timer=Timer;exports.WAAPIAnimation=WAAPIAnimation;exports.animate=animate;exports.createAnimatable=createAnimatable;exports.createDraggable=createDraggable;exports.createScope=createScope;exports.createSpring=createSpring;exports.createTimeline=createTimeline;exports.createTimer=createTimer;exports.eases=eases;exports.engine=engine;exports.onScroll=onScroll;exports.scrollContainers=scrollContainers;exports.stagger=stagger;exports.svg=svg;exports.text=text;exports.utils=utils;exports.waapi=waapi;return exports}({});
diff --git a/lib/anime.iife.min.js b/lib/anime.iife.min.js
index ea128f90..b739edfe 100644
--- a/lib/anime.iife.min.js
+++ b/lib/anime.iife.min.js
@@ -1,9 +1,9 @@
/**
* anime.js - IIFE
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
-var anime=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(),h=Symbol(),l=Symbol(),c=Symbol(),d=1e-11,u=1e12,p=1e3,m="",f=new Map;f.set("x","translateX"),f.set("y","translateY"),f.set("z","translateZ");const g=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],_=g.reduce(((t,e)=>({...t,[e]:e+"("})),{}),y=()=>{},v=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,b=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,S=/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,T=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,w=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,k=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,$=/([a-z])([A-Z])/g,E=/(\w+)(\([^)]+\)+)/g,C=/(\*=|\+=|-=)/,B={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:p,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:y,onBeforeUpdate:y,onUpdate:y,onLoop:y,onPause:y,onComplete:y,onRender:y},D={defaults:B,root:i,scope:null,precision:4,timeScale:1,tickThreshold:200},L={version:"4.0.2",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(L));const A=t=>t.replace($,"$1-$2").toLowerCase(),N=(t,e)=>0===t.indexOf(e),F=Date.now,P=Array.isArray,R=t=>t&&t.constructor===Object,Y=t=>"number"==typeof t&&!isNaN(t),X=t=>"string"==typeof t,M=t=>"function"==typeof t,O=t=>void 0===t,z=t=>O(t)||null===t,I=t=>e&&t instanceof SVGElement,W=t=>v.test(t),V=t=>N(t,"rgb"),U=t=>N(t,"hsl"),H=t=>!D.defaults.hasOwnProperty(t),q=t=>X(t)?parseFloat(t):t,Q=Math.pow,j=Math.sqrt,G=Math.sin,Z=Math.cos,J=Math.abs,K=Math.exp,tt=Math.ceil,et=Math.floor,st=Math.asin,it=Math.max,rt=Math.atan2,nt=Math.PI,ot=Math.round,at=(t,e,s)=>t<e?e:t>s?s:t,ht={},lt=(t,e)=>{if(e<0)return t;if(!e)return ot(t);let s=ht[e];return s||(s=ht[e]=10**e),ot(t*s)/s},ct=(t,e)=>P(e)?e.reduce(((e,s)=>J(s-t)<J(e-t)?s:e)):e?ot(t/e)*e:t,dt=(t,e,s)=>t+(e-t)*s,ut=t=>t===1/0?u:t===-1/0?-1e12:t,pt=t=>t<=d?d:ut(lt(t,11)),mt=t=>P(t)?[...t]:t,ft=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=O(r)?e[i]:r}return s},gt=(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}},_t=(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},yt=(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};class vt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=lt(p/120,0),this._fps=120,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<d?d:s,r=lt(p/i,0);this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<d?d:e}requestTick(t){const e=this._scheduledTime,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const bt=(t,e,s,i,n)=>{const o=t.parent,a=t.duration,l=t.completed,c=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,f=t._loopDelay,g=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,S=t._currentTime,x=b+c,T=e-b,w=at(S,-b,a),k=at(T,-b,a),$=T-S,E=k>0,C=k>=a,B=a<=d,L=2===n;let A=0,N=T,F=0;if(u>1){const e=~~(k/(c+(C?0:f)));t._currentIteration=at(e,0,u),C&&t._currentIteration--,A=t._currentIteration%2,N=k%(c+f)||0}const P=g^(y&&A),R=t._ease;let Y=C?P?0:a:P?c-N:N;R&&(Y=c*R(Y/c)||0);const X=(o?o.backwards:T<S)?!P:!!P;if(t._currentTime=T,t._iterationTime=Y,t.backwards=X,E&&!t.began?(t.began=!0,s||o&&(X||!o.began)||t.onBegin(t)):T<=0&&(t.began=!1),s||v||!E||t._currentIteration===p||t.onLoop(t),L||1===n&&(e>=b&&e<=x||e<=b&&w>b||e>=x&&w!==a)||Y>=x&&w!==a||Y<=b&&w>0||e<=w&&w===a&&l||C&&!l&&B){if(E&&(t.computeDeltaTime(w),s||t.onBeforeUpdate(t)),!v){const e=L||(X?-1*$:$)>=D.tickThreshold,n=t._offset+(o?o._offset:0)+b+Y;let a,l,c,d,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,y=u._prevRep,v=t!==r.none;if((e||(s!==o||n<=f+(g?g._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!g||g._isOverridden||n<=g._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=at(Y-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,_=0===m,y=_&&g||0===s||1===s?-1:D.precision;let b,S;if(_)b=S=n(lt(dt(u._fromNumber,u._toNumber,s),y));else if(1===m)S=n(lt(dt(u._fromNumber,u._toNumber,s),y)),b=`${S}${u._unit}`;else if(2===m){const t=u._fromNumbers,e=u._toNumbers,i=lt(at(n(dt(t[0],e[0],s)),0,255),0),r=lt(at(n(dt(t[1],e[1],s)),0,255),0),o=lt(at(n(dt(t[2],e[2],s)),0,255),0),a=at(n(lt(dt(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${a})`,v){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(lt(dt(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=S),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):(l=a.style,3===f?(a!==c&&(c=a,d=a[h]),d[t]=b,p=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),E&&(F=1)}}if(p&&u._renderTransforms){let t=m;for(let e in d)t+=`${_[e]}${d[e]}) `;l.transform=t,p=0}u=u._next}!s&&F&&t.onRender(t)}!s&&E&&t.onUpdate(t)}return o&&B?!s&&(o.began&&!X&&T>=a&&!l||X&&T<=d&&l)&&(t.onComplete(t),t.completed=!X):E&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(X||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},St=(t,e,s,i,r)=>{const n=t._currentIteration;if(bt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,h=i?e:o._iterationTime,l=F();let c=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;gt(o,(e=>{if(a){const i=e.duration,r=e._offset+e._delay;s||!(i<=d)||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)}gt(o,(t=>{const e=lt((h-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;c+=bt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),a),!s&&c&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},xt={animation:null,update:y},Tt=e?requestAnimationFrame:setImmediate,wt=e?cancelAnimationFrame:clearImmediate;class kt extends vt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=B,this.paused=!(!e||!i.hidden),this.reqId=null}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?(_t(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):St(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}xt.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=Tt(Et)),this}pause(){return this.paused=!0,Ct()}resume(){if(this.paused)return this.paused=!1,gt(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===D.timeScale?1:p)}set speed(t){this._speed=t*D.timeScale,gt(this,(t=>t.speed=t._speed))}get timeUnit(){return 1===D.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(D.timeScale!==s){D.timeScale=s,D.tickThreshold=200*s;const t=e?.001:p;this.defaults.duration*=t,this._speed*=t}}get precision(){return D.precision}set precision(t){D.precision=t}}const $t=(()=>{const t=new kt(F());return e&&(L.engine=t,i.addEventListener("visibilitychange",(()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())}))),t})(),Et=()=>{$t._head?($t.reqId=Tt(Et),$t.update()):$t.reqId=0},Ct=()=>(wt($t.reqId),$t.reqId=0,$t);function Bt(t){const e=X(t)?D.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Dt(t){if(z(t))return[];if(P(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!z(i)){const t=Bt(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(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}if(!e)return[t];const s=Bt(t);return s?Array.from(s):[t]}function Lt(t){const e=Dt(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=I(s);(s.nodeType||t)&&(s[o]=!0,s[a]=t,s[h]={})}}return e}const At=t=>{const e=Dt(t)[0];if(e&&I(e))return e},Nt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),Ft=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[a],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Nt(t,s,-1),i=Nt(t,s,1);return 180*rt(i.y-e.y,i.x-e.x)/nt}{const i=Nt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Pt=["opacity","rotate","overflow","color"],Rt={morphTo:(t,e=.33)=>s=>{const i=At(t);if(!i)return;const r="path"===s.tagName,n=r?" ":",",o=s[l];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 c=e/(l-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";a+=p+lt(d.x,3)+n+d.y+" ",h+=p+lt(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),h=i.getAttribute(r?"d":"points");return s[l]=h,[a,h]},createMotionPath:t=>{const e=At(t);if(e)return{translateX:Ft(e,"x"),translateY:Ft(e,"y"),rotate:Ft(e,"a")}},createDrawable:(t,e=0,s=0)=>Dt(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 h=new Proxy(t,{get(t,e){const s=t[e];return e===c?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],h=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(j(s.a*s.a+s.b*s.b)+j(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=h*i*l+c,u=i*l+(0===r&&1===h||1===r&&0===h?0:10*l)-d;if("butt"!==n){const e=r===h?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:M(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),h.setAttribute("draw",`${e} ${s}`)),h})(t,e,s)))},Yt=(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),Xt=(t,e)=>O(t)?e:t,Mt=(t,e,s,i,r)=>{if(M(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Ot=(t,e)=>t[o]?t[a]&&((t,e)=>{if(Pt.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:N(e,"--")?4:e in t.style?2:e in t?0:1:0,zt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[c]||t).getPropertyValue(e);return"auto"===r?"0":r},It=(t,e,s,i)=>{const r=O(s)?Ot(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[h];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&&!O(r)?r:N(e,"scale")?"1":N(e,"rotate")||N(e,"skew")?"0deg":"0px"})(t,e,i):4===r?zt(t,e,i).trimStart():zt(t,e,i)},Wt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Vt=(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(" ")&&k.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(W(r=s)||V(r)||U(r))return e.t=2,e.d=V(i=s)?(t=>{const e=b.exec(t)||S.exec(t),s=O(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):W(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):U(i)?(t=>{const e=x.exec(t)||T.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=O(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=lt(255*Yt(e,t,s+1/3),0),a=lt(255*Yt(e,t,s),0),h=lt(255*Yt(e,t,s-1/3),0)}return[o,a,h,n]})(i):[0,0,0,1],e;{const t=s.match(w);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(w)||[],e}}var i,r;return e.n=s,e},Ut=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=mt(t._toNumbers),e.s=mt(t._strings),e),Ht={t:0,n:0,u:null,o:null,d:null,s:null},qt={_rep:new WeakMap,_add:new Map},Qt=(t,e,s="_rep")=>{const i=qt[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=d,t._currentTime=d},Zt=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;yt(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);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<d&&Gt(i)}let o=!0;if(gt(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;gt(t,(t=>{t!==e&&gt(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=xt.animation;return e||(e={duration:d,computeDeltaTime:y,_offset:0,_delay:0,_head:null,_tail:null},xt.animation=e,xt.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?mt(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})(qt._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=d,i._startTime=0,i._numbers=mt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,yt(e,i),yt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=mt(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=mt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0})),i._fromNumbers=e}yt(e,t,null,"_prevAdd","_nextAdd")}return t},Jt=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=qt._rep.get(s)[i];if(_t(n,t,"_prevRep","_nextRep"),e===r.blend){const e=qt._add,r=e.get(s);if(!r)return;const n=r[i],o=xt.animation;_t(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){_t(n,a,"_prevAdd","_nextAdd"),_t(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Kt=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),te=t=>t._cancelled?(t._hasChildren?gt(t,te):gt(t,(t=>{t._composition!==r.none&&Zt(t,Qt(t.target,t.property))})),t._cancelled=0,t):t;let ee=0;class se extends vt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:h,loopDelay:l,autoplay:c,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:b}=t;D.scope&&D.scope.revertibles.push(this);const S=e?0:$t._elapsedTime,x=e?e.defaults:D.defaults,T=M(r)||O(r)?x.delay:+r,w=M(n)||O(n)?1/0:+n,k=Xt(h,x.loop),$=Xt(l,x.loopDelay),E=!0===k||k===1/0||k<0?1/0:k+1;let C=0;if(e)C=s;else{let t=F();$t.paused&&($t.requestTick(t),t=$t._elapsedTime),C=t-$t._startTime}this.id=O(i)?++ee:i,this.parent=e,this.duration=ut((w+$)*E-$)||d,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=b||x.onUpdate,this.onLoop=f||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=w,this.iterationCount=E,this._autoplay=!e&&Xt(c,x.autoplay),this._offset=C,this._delay=T,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=y,this._running=!1,this._reversed=+Xt(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Xt(a,x.alternate),this._prev=null,this._next=null,this._elapsedTime=S,this._startTime=S,this._lastTime=S,this._fps=Xt(u,x.frameRate),this._speed=Xt(p,x.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return at(lt(this._currentTime,D.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return lt(this._iterationTime,D.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return at(lt(this._currentTime/this.duration,5),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return at(lt(this._iterationTime/this.iterationDuration,5),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*at(+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=0){return te(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,St(this,0,1,t,2),Kt(this),this._hasChildren&&gt(this,Kt),this}init(t=0){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&St(this,this.duration,1,t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!O(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*$t._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<=d&&!this._hasChildren?St(this,d,0,0,2):(this._running||(yt($t,this),$t._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,$t.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){te(this),this.completed=!1;const i=this.paused;return this.paused=!0,St(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?et(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?gt(this,(t=>t.cancel()),!0):gt(this,Jt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=pt(t);if(e===s)return this;const i=t/e,r=t<=d;return this.duration=r?d:s,this.iterationDuration=r?d:pt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){St(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=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const ie=t=>t,re=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,ne=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?ie:r=>0===r||1===r?r:re(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=re(r,e,s)-t,i>0?o=r:n=r}while(J(i)>1e-7&&++a<100);return r})(r,t,s),e,i),oe=(t=10,e)=>{const s=e?tt:et;return e=>s(at(e,0,1)*t)*(1/t)},ae=(...t)=>{const e=t.length;if(!e)return ie;const s=e-1,i=t[0],r=t[s],n=[0],o=[q(i)];for(let e=1;e<s;e++){const i=t[e],r=X(i)?i.trim().split(" "):[i],a=r[0],h=r[1];n.push(O(h)?e/s:q(h)/100),o.push(q(a))}return o.push(q(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]}},he=(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(at(o,r,1))}return s.push(1),ae(...s)},le=nt/2,ce=2*nt,de=(t=1.68)=>e=>Q(e,+t),ue={[m]:de,Quad:de(2),Cubic:de(3),Quart:de(4),Quint:de(5),Sine:t=>1-Z(t*le),Circ:t=>1-j(1-t*t),Expo:t=>t?Q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=Q(2,--s))-1)/11;);return 1/Q(4,3-s)-7.5625*Q((3*e-2)/22-t,2)},Back:(t=1.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=at(+t,1,10),i=at(+e,d,2),r=i/ce*st(1/s),n=ce/i;return t=>0===t||1===t?t:-s*Q(2,-10*(1-t))*G((1-t-r)*n)}},pe={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},me=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=pe[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:ie}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):ie}},fe=(()=>{const t={linear:ae,irregular:he,steps:oe,cubicBezier:ne};for(let e in pe)for(let s in ue){const i=ue[s],r=pe[e];t[e+s]=s===m||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ge={linear:ie},_e=t=>M(t)?t:X(t)?me(t,fe,ge):ie,ye={},ve=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&I(e)&&t in e.style){const e=ye[t];if(e)return e;{const e=t?A(t):t;return ye[t]=e,e}}return t},be={deg:1,rad:180/nt,turn:360},Se={},xe=(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,h=Se[a];if(O(h)||r){let r;if(n in be)r=o*be[n]/be[s];else{const e=100,a=t.cloneNode(),h=t.parentNode,l=h&&h!==i?h:i.body;l.appendChild(a);const c=a.style;c.width=e+n;const d=a.offsetWidth||e;c.width=e+s;const u=d/(a.offsetWidth||e);l.removeChild(a),r=u*o}e.n=r,Se[a]=r}else e.n=h;return e.t,e.u=s,e},Te=t=>{if(t._hasChildren)gt(t,Te,!0);else{const e=t;e.pause(),gt(e,(t=>{const s=t.property,i=t.target;if(i[o]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[h];if(O(n)||n===m?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=m;for(let s in e)t+=_[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else O(n)||n===m?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===m&&t.removeAttribute("style")}))}}))}return t},we={t:0,n:0,u:null,o:null,d:null,s:null},ke={t:0,n:0,u:null,o:null,d:null,s:null},$e={func:null},Ee=[null],Ce=[null,null],Be={to:null};let De,Le,Ae=0;class Ne extends se{constructor(t,e,s,i,n=!1,o=0,a=0){super(e,s,i);const h=Lt(t),l=h.length,c=e.keyframes,u=c?ft(((t,e)=>{const s={};if(P(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(H);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];H(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=Xt(e.duration,D.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(H(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 c=0;for(let t=0;t<a;t++)c+=n[t].duration;1===a&&(l.from=h.to),r.ease&&(l.ease=r.ease),l.duration=o-(a?c: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})(c,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=u,S=s?s.defaults:D.defaults,x=Xt(_,S.playbackEase),T=x?_e(x):null,w=!O(g)&&!O(g.ease),k=w?g.ease:Xt(g,T?"linear":S.ease),$=w?g.duration:Xt(f,S.duration),E=Xt(m,S.delay),C=y||S.modifier,B=O(v)&&l>=p?r.none:O(v)?S.composition:v,L={},A=this._offset+(s?s._offset:0);let N=NaN,F=NaN,X=0,M=0;for(let t=0;t<l;t++){const e=h[t],i=o||t,c=a||l;let p=NaN,m=NaN;for(let t in u)if(H(t)){const o=Ot(e,t),a=ve(t,e,o);let h=u[t];const l=P(h);if(n&&!l&&(Ce[0]=h,Ce[1]=h,h=Ce),l){const t=h.length,e=!R(h[0]);2===t&&e?(Be.to=h,Ee[0]=Be,De=Ee):t>2&&e?(De=[],h.forEach(((t,e)=>{e?1===e?(Ce[1]=t,De.push(Ce)):De.push(t):Ce[0]=t}))):De=h}else Ee[0]=h,De=Ee;let f=null,g=null,_=NaN,y=0,v=0;for(let t=De.length;v<t;v++){const n=De[v];R(n)?Le=n:(Be.to=n,Le=Be),$e.func=null;const h=Mt(Le.to,e,i,c,$e);let l;R(h)&&!O(h.to)?(Le=h,l=h.to):l=h;const u=Mt(Le.from,e,i,c),p=Le.ease,m=!O(p)&&!O(p.ease),b=m?p.ease:p||k,S=m?p.duration:Mt(Xt(Le.duration,t>1?Mt($,e,i,c)/t:$),e,i,c),x=Mt(Xt(Le.delay,v?0:E),e,i,c),T=Mt(Xt(Le.composition,B),e,i,c),w=Y(T)?T:r[T],D=Le.modifier||C,N=!O(u),F=!O(l),z=P(l),I=z||N&&F,W=g?y+x:x,V=A+W;M||!N&&!z||(M=1);let U=g;if(w!==r.none){f||(f=Qt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(U=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)Gt(t),t=t._nextRep}if(I?(Vt(z?Mt(l[0],e,i,c):u,we),Vt(z?Mt(l[1],e,i,c,$e):l,ke),0===we.t&&(U?1===U._valueType&&(we.t=1,we.u=U._unit):(Vt(It(e,a,o,L),Ht),1===Ht.t&&(we.t=1,we.u=Ht.u)))):(F?Vt(l,ke):g?Ut(g,ke):Vt(s&&U&&U.parent.parent===s?U._value:It(e,a,o,L),ke),N?Vt(u,we):g?Ut(g,we):Vt(s&&U&&U.parent.parent===s?U._value:It(e,a,o,L),we)),we.o&&(we.n=Wt(U?U._toNumber:Vt(It(e,a,o,L),Ht).n,we.n,we.o)),ke.o&&(ke.n=Wt(we.n,ke.n,ke.o)),we.t!==ke.t)if(3===we.t||3===ke.t){const t=3===we.t?we:ke,e=3===we.t?ke:we;e.t=3,e.s=mt(t.s),e.d=t.d.map((()=>e.n))}else if(1===we.t||1===ke.t){const t=1===we.t?we:ke,e=1===we.t?ke:we;e.t=1,e.u=t.u}else if(2===we.t||2===ke.t){const t=2===we.t?we:ke,e=2===we.t?ke:we;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(we.u!==ke.u){let t=ke.u?we:ke;t=xe(e,t,ke.u?ke.u:we.u,!1)}if(ke.d&&we.d&&ke.d.length!==we.d.length){const t=we.d.length>ke.d.length?we:ke,e=t===we?ke:we;e.d=t.d.map(((t,s)=>O(e.d[s])?0:e.d[s])),e.s=mt(t.s)}const H=lt(+S||d,12),q={parent:this,id:Ae++,property:a,target:e,_value:null,_func:$e.func,_ease:_e(b),_fromNumbers:mt(we.d),_toNumbers:mt(ke.d),_strings:mt(ke.s),_fromNumber:we.n,_toNumber:ke.n,_numbers:mt(we.d),_number:we.n,_unit:ke.u,_modifier:D,_currentTime:0,_startTime:W,_delay:+x,_updateDuration:H,_changeDuration:H,_absoluteStartTime:V,_tweenType:o,_valueType:ke.t,_composition:w,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};w!==r.none&&Zt(q,f),isNaN(_)&&(_=q._startTime),y=lt(W+H,12),g=q,X++,yt(this,q)}(isNaN(F)||_<F)&&(F=_),(isNaN(N)||y>N)&&(N=y),3===o&&(p=X-v,m=X)}if(!isNaN(p)){let t=0;gt(this,(e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===r.blend&&gt(xt.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),F?(gt(this,(t=>{t._startTime-t._delay||(t._delay-=F),t._startTime-=F})),N-=F):F=0,N||(N=d,this.iterationCount=0),this.targets=h,this.duration=N===d?d:ut((N+this._loopDelay)*this.iterationCount-this._loopDelay)||d,this.onRender=b||S.onRender,this._ease=T,this._delay=F,this.iterationDuration=N,this._inlineStyles=L,!this._autoplay&&M&&this.onRender(this)}stretch(t){const e=this.duration;if(e===pt(t))return this;const s=t/e;return gt(this,(t=>{t._updateDuration=pt(t._updateDuration*s),t._changeDuration=pt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return gt(this,(t=>{const e=It(t.target,t.property,t._tweenType);Vt(e,Ht),t._fromNumbers=mt(Ht.d),t._fromNumber=Ht.n,t._func&&(Vt(t._func(),ke),t._toNumbers=mt(ke.d),t._strings=mt(ke.s),t._toNumber=ke.n)})),this}revert(){return super.revert(),Te(this)}then(t){return super.then(t)}}const Fe=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Pe={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Re=(()=>{const t={};for(let e in pe)t[e]=t=>pe[e](de(t));return t})(),Ye=t=>{let e=Pe[t];if(e)return e;if(e="linear",X(t)){if(N(t,"linear")||N(t,"cubic-")||N(t,"steps")||N(t,"ease"))e=t;else if(N(t,"cubicB"))e=A(t);else{const s=me(t,Re,Pe);M(s)&&(e=s===ie?"linear":Fe(s))}Pe[t]=e}else if(M(t)){const s=Fe(t);s&&(e=s)}else t.ease&&(e=Fe(t.ease));return e},Xe=["x","y","z"],Me=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Xe],Oe=[...Xe,...g.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))];let ze=e&&(O(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const Ie={_head:null,_tail:null},We=(t,e,s)=>{let i=Ie._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,a=!s||i.parent===s;if(n&&o&&a){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),_t(Ie,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},Ve=(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),We(e,s),yt(Ie,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{We(e,s,t)};return n.onremove=a,n.onfinish=a,n},Ue=(t,e,s,i,r)=>{let n=Mt(e,s,i,r);return Y(n)?Me.includes(t)||N(t,"translate")?`${n}px`:N(t,"rotate")||N(t,"skew")?`${n}deg`:`${n}`:n},He=(t,e,s,i,r,n)=>{let o="0";const a=O(i)?getComputedStyle(t)[e]:Ue(e,i,t,r,n);return o=O(s)?P(i)?i.map((s=>Ue(e,s,t,r,n))):a:[Ue(e,s,t,r,n),a],o};class qe{constructor(t,e){D.scope&&D.scope.revertibles.push(this),ze||(g.forEach((t=>{const e=N(t,"skew"),s=N(t,"scale"),i=N(t,"rotate"),r=N(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{}})),ze=!0);const s=Lt(t),i=s.length;i||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const r=Xt(e.ease,Ye(D.defaults.ease)),n=r.ease&&r,o=Xt(e.autoplay,D.defaults.autoplay),a=!(!o||!o.link)&&o,l=e.alternate&&!0===e.alternate,c=e.reversed&&!0===e.reversed,d=Xt(e.loop,D.defaults.loop),u=!0===d||d===1/0?1/0:Y(d)?d+1:1,v=l?c?"alternate-reverse":"alternate":c?"reverse":"normal",b=Ye(r),S=1===D.timeScale?1:p;this.targets=s,this.animations=[],this.controlAnimation=null,this.onComplete=e.onComplete||y,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!o||!1!==a,this.reversed=c,this.autoplay=o,this._speed=Xt(e.playbackRate,D.defaults.playbackRate),this._resolve=y,this._completed=0,this._inlineStyles=s.map((t=>t.getAttribute("style"))),s.forEach(((t,s)=>{const o=t[h],a=Oe.some((t=>e.hasOwnProperty(t))),l=(n?n.duration:Mt(Xt(e.duration,D.defaults.duration),t,s,i))*S,c=Mt(Xt(e.delay,D.defaults.delay),t,s,i)*S,d=Xt(e.composition,"replace");for(let n in e){if(!H(n))continue;const h={},p={iterations:u,direction:v,fill:"forwards",easing:b,duration:l,delay:c,composite:d},m=e[n],_=!!a&&(g.includes(n)?n:f.get(n));let y;if(R(m)){const e=m,a=Xt(e.ease,r),u=a.ease&&a,f=e.to,g=e.from;if(p.duration=(u?u.duration:Mt(Xt(e.duration,l),t,s,i))*S,p.delay=Mt(Xt(e.delay,c),t,s,i)*S,p.composite=Xt(e.composition,d),p.easing=Ye(a),y=He(t,n,g,f,s,i),_?(h[`--${_}`]=y,o[_]=y):h[n]=He(t,n,g,f,s,i),Ve(this,t,n,h,p),!O(g))if(_){const e=`--${_}`;t.style.setProperty(e,h[e][0])}else t.style[n]=h[n][0]}else y=P(m)?m.map((e=>Ue(n,e,t,s,i))):Ue(n,m,t,s,i),_?(h[`--${_}`]=y,o[_]=y):h[n]=y,Ve(this,t,n,h,p)}if(a){let e=m;for(let t in o)e+=`${_[t]}var(--${t})) `;t.style.transform=e}})),a&&this.autoplay.link(this)}forEach(t){const e=X(t)?e=>e[t]():t;return this.animations.forEach(e),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=D.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===D.timeScale?1:p);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const Qe={animate:(t,e)=>new qe(t,e),convertEase:Fe},je=(t=y)=>new se({duration:1*D.timeScale,onComplete:t},null,0).resume();function Ge(t,e,s){const i=Lt(t);if(!i.length)return;const[r]=i,n=Ot(r,e),o=ve(e,r,n);let a=It(r,o);if(O(s))return a;if(Vt(a,Ht),0===Ht.t||1===Ht.t){if(!1===s)return Ht.n;{const t=xe(r,Ht,s,!1);return`${lt(t.n,D.precision)}${t.u}`}}}const Ze=(t,e)=>{if(!O(e))return e.duration=d,e.composition=Xt(e.composition,r.none),new Ne(t,e,null,0,!0).resume()},Je=(t,e,s)=>{let i=!1;return gt(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=ve(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),_t(e,r),Jt(r),i=!0)}}),!0),i},Ke=(t,e,s)=>{const i=Dt(t),r=e||$t,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];We(e,s,n)}let o;if(r._hasChildren){let e=0;gt(r,(n=>{if(!n._hasChildren)if(o=Je(i,n,s),o&&!n._head)n.cancel(),_t(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?Ke(t,n,s):n._hasChildren=!1}),!0),O(r.iterationDuration)||(r.iterationDuration=e)}else o=Je(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},ts=(t,e,s)=>{const i=10**(s||0);return et((Math.random()*(e-t+1/i)+t)*i)/i},es=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),ss=(t,e,s,i)=>{let r=p/D.defaults.frameRate;if(!1!==i){const t=i||$t._hasChildren&&$t;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},is=t=>(...e)=>{const s=t(...e);return new Proxy(y,{apply:(t,e,[i])=>s(i),get:(t,e)=>is(((...t)=>{const i=ns[e](...t);return t=>i(s(t))}))})},rs=(t,e=0)=>(...s)=>(s.length<t.length?is(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),ns={$:Lt,get:Ge,set:Ze,remove:Ke,cleanInlineStyles:Te,random:ts,randomPick:t=>t[ts(0,t.length-1)],shuffle:t=>{let e,s,i=t.length;for(;i;)s=ts(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},lerp:ss,sync:je,clamp:rs(at),round:rs(lt),snap:rs(ct),wrap:rs(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:rs(dt,1),mapRange:rs(es),roundPad:rs(((t,e)=>(+t).toFixed(e))),padStart:rs(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:rs(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:rs((t=>t*nt/180)),radToDeg:rs((t=>180*t/nt))},os=(t,e)=>{let s=t.iterationDuration;if(s===d&&(s=0),O(e))return s;if(Y(+e))return+e;const i=e,r=t?t.labels:null,n=!z(r),o=((t,e)=>{if(N(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!O(o),h=C.exec(i);if(h){const t=h[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=a?o:n?l:s,d=+e[1];return Wt(c,d,t[0])}return a?o:n?O(r[i])?s:r[i]:s};function as(t,e,s,i,r,n){const o=Y(t.duration)&&t.duration<=d?s-d:s;St(e,o,1,1,1);const a=i?new Ne(i,t,e,o,!1,r,n):new se(t,e,o);return a.init(1),yt(e,a),gt(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return ut((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||d}(e),e}class hs extends se{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=D.defaults;this.defaults=e?ft(e,s):s,this.onRender=t.onRender||s.onRender;const i=Xt(t.playbackEase,s.playbackEase);this._ease=i?_e(i):null,this.iterationDuration=0}add(t,e,s){const i=R(e),r=R(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(M(s)){const e=s,r=Dt(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,O(a)||(s.id=a+"-"+h),as(s,this,e(t,h,l,this),t,h,l),h++}))}else as(i,this,os(this,s),t)}else as(t,this,os(this,e));return this.init(1)}}sync(t,e){if(O(t)||t&&O(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,ease:"linear"},e)}set(t,e,s){return O(e)?this:(e.duration=d,e.composition=r.replace,this.add(t,e,s))}call(t,e){return O(t)||t&&!M(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return O(t)||t&&!X(t)||(this.labels[t]=os(this,e)),this}remove(t,e){return Ke(t,this,e),this}stretch(t){const e=this.duration;if(e===pt(t))return this;const s=t/e,i=this.labels;gt(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return gt(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),gt(this,(t=>t.revert),!0),Te(this)}then(t){return super.then(t)}}class ls{constructor(t,e){D.scope&&D.scope.revertibles.push(this);const s={},i={};if(this.targets=[],this.animations={},!O(t)&&!O(e)){for(let t in e){const r=e[t];H(t)?i[t]=r:s[t]=r}for(let e in i){const n=i[e],o=R(n);let a={},h="+=0";if(o){const t=n.unit;X(t)&&(h+=t)}else a.duration=n;a[e]=o?ft({to:h},n):h;const l=ft(s,a);l.composition=r.replace,l.autoplay=!1;const c=this.animations[e]=new Ne(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(O(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return gt(c,(e=>{if(P(t))for(let s=0,i=t.length;s<i;s++)O(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;O(s)||(e._ease=_e(s)),e._currentTime=0})),O(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=y,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}class cs{constructor(t={}){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.m=at(Xt(t.mass,1),0,p),this.s=at(Xt(t.stiffness,100),1,p),this.d=at(Xt(t.damping,10),.1,p),this.v=at(Xt(t.velocity,0),-1e3,p),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?K(-n*e*s)*(1*Z(i*n)+r*G(i*n)):(1+r*n)*K(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,h=this.w0=at(j(o/r),d,p),l=this.zeta=n/(2*j(o*r)),c=this.wd=l<1?h*j(1-l*l):0;this.b=l<1?(l*h-a)/c:-a+h;let u=0,m=0,f=0;for(;m<t&&f<e;)J(1-this.solve(u))<s?m++:m=0,this.solverDuration=u,u+=i,f++;this.duration=lt(this.solverDuration*p,0)*D.timeScale}get mass(){return this.m}set mass(t){this.m=at(Xt(t,1),0,p),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=at(Xt(t,100),1,p),this.compute()}get damping(){return this.d}set damping(t){this.d=at(Xt(t,10),.1,p),this.compute()}get velocity(){return this.v}set velocity(t){this.v=at(Xt(t,0),-1e3,p),this.compute()}}const ds=t=>new cs(t),us=t=>{t.cancelable&&t.preventDefault()};class ps{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:y,remove:y}}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 ms{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 fs=(t,e)=>t&&M(t)?t(e):t;let gs=0;class _s{constructor(t,e={}){if(!t)return;D.scope&&D.scope.revertibles.push(this);const r=e.x,n=e.y,o=e.trigger,a=e.modifier,h=e.releaseEase,l=h&&_e(h),c=!O(h)&&!O(h.ease),d=R(r)&&!O(r.mapTo)?r.mapTo:"translateX",p=R(n)&&!O(n.mapTo)?n.mapTo:"translateY",m=fs(e.container,this);this.containerArray=P(m)?m:null,this.$container=m&&!this.containerArray?Dt(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=R(t)?new ps(t):Dt(t)[0],this.$trigger=Dt(o||t)[0],this.fixed="fixed"===Ge(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?h:ds({mass:Xt(e.releaseMass,1),stiffness:Xt(e.releaseStiffness,80),damping:Xt(e.releaseDamping,20)}),this.releaseYSpring=c?h:ds({mass:Xt(e.releaseMass,1),stiffness:Xt(e.releaseStiffness,80),damping:Xt(e.releaseDamping,20)}),this.releaseEase=l||fe.outQuint,this.hasReleaseSpring=c,this.onGrab=e.onGrab||y,this.onDrag=e.onDrag||y,this.onRelease=e.onRelease||y,this.onUpdate=e.onUpdate||y,this.onSettle=e.onSettle||y,this.onSnap=e.onSnap||y,this.onResize=e.onResize||y,this.onAfterResize=e.onAfterResize||y,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),O(r)||!0===r)f[d]=0;else if(R(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[d]=e}else!1===r&&(f[d]=0,this.disabled[0]=1);if(O(n)||!0===n)f[p]=0;else if(R(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 ls(this.$target,f),this.xProp=d,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=[-1e12,u,u,-1e12],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 ms(this.$target),this.overshootCoords={x:0,y:0},this.overshootXTicker=new se({autoplay:!1},null,0).init(),this.overshootYTicker=new se({autoplay:!1},null,0).init(),this.updateTicker=new se({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),this.contained=!O(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]?d:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=rt(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 se({autoplay:!1,duration:150*D.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),R(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,h=this.maxVelocity,l=this.velocityStackIndex;n[l]=lt(at(j(t*t+e*e)/r*o,a,h),5);const c=it(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=lt(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=ct(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=lt(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=ct(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return lt(this.animate[this.xProp](),D.precision)}set x(t){this.setX(t,!1)}get y(){return lt(this.animate[this.yProp](),D.precision)}set y(t){this.setY(t,!1)}get progressX(){return es(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(es(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return es(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(es(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=lt(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=lt(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,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,h=this.window[1]=s.innerHeight,l=this.useWin,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?at(c,a,c):c,this.scrollView[1]=l?at(d,h,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:S,right:x,bottom:T}=t.getBoundingClientRect();this.dragArea[2]=lt(l?at(y,a,a):y,0),this.dragArea[3]=lt(l?at(v,h,h):v,0);const w=Ge(t,"overflow"),k="visible"===w,$="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===i.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!P(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,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=lt(r.top+s-(l?0:S),0),this.targetBounds[1]=lt(r.right+e-(l?a:x),0),this.targetBounds[2]=lt(r.bottom+s-(l?h:T),0),this.targetBounds[3]=lt(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]+_):(this.containerBounds[0]=-lt(r.top-(u?at(S,0,h):S)+o-m,0),this.containerBounds[1]=-lt(r.right-(u?at(x,0,a):x)-c+f,0),this.containerBounds[2]=-lt(r.bottom-(u?at(T,0,h):T)-d+g,0),this.containerBounds[3]=-lt(r.left-(u?at(b,0,a):b)+n-_,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,h]=this.disabled,l=!a&&e<o||!a&&e>r,c=!h&&s<i||!h&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=fs(t.container,this),o=fs(t.containerPadding,this)||0,a=P(o)?o:[o,o,o,o],h=this.x,l=this.y,c=fs(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=P(n)?n:null,this.$container=n&&!this.containerArray?Dt(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=Xt(a,[0,0,0,0]),this.containerFriction=at(Xt(fs(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=at(Xt(fs(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=fs(R(e)&&!O(e.snap)?e.snap:t.snap,this),this.snapY=fs(R(r)&&!O(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Xt(fs(t.scrollSpeed,this),1.5),this.scrollThreshold=Xt(fs(t.scrollThreshold,this),20),this.dragSpeed=Xt(fs(t.dragSpeed,this),1),this.minVelocity=Xt(fs(t.minVelocity,this),0),this.maxVelocity=Xt(fs(t.maxVelocity,this),50),this.velocityMultiplier=Xt(fs(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(at(h,f,p),!0),this.setY(at(l,u,m),!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,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?at(c,this.window[0],c):c,p=this.useWin?at(d,this.window[1],d):d,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,_=this.scrollThreshold,[y,v]=this.coords,[b,S,x,T]=this.scrollBounds,w=lt(at((v-b+t)/_,-1,0)*g,0),k=lt(at((y-S-e)/_,0,1)*g,0),$=lt(at((v-x-s)/_,0,1)*g,0),E=lt(at((y-T+i)/_,-1,0)*g,0);if(w||$||E||k){const[t,e]=this.disabled;let s=h,i=l;t||(s=lt(at(h+(E||k),0,r-o),0),this.coords[0]-=h-s),e||(i=lt(at(l+(w||$),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[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-h,n-l),this.angle=rt(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.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return Ke(this,null,"x"),Ke(this,null,"y"),Ke(this,null,"progressX"),Ke(this,null,"progressY"),Ke(this.scroll),Ke(this.overshootCoords),this}scrollInView(t,e=0,s=fe.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,c,d]=o,p=lt(at(r-h,-1e12,0),0),m=lt(at(i-l,0,u),0),f=lt(at(r-c,0,u),0),g=lt(at(i-d,-1e12,0),0);new Ne(n,{x:lt(n.x+(g?g-e:m?m+e:0),0),y:lt(n.y+(p?p-e:f?f+e:0),0),duration:O(t)?350*D.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=Ze(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=fe.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,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+h+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=at(ct(i,this.snapX),u,c),a=at(ct(r,this.snapY),l,d),h=O(t)?350*D.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 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),[h,l,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/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=Ge(this.$target,"zIndex",!1);gs=(f>gs?f:gs)+1,this.targetStyles=Ze(this.$target,{zIndex:gs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Ze(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,fe.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 h=t.target,l=!1,c=!1,d=!1;for(;e&&h&&h!==this.$trigger;){const t=Ge(h,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=h;if(e>s){d=!0,l=t<=3,c=t>=e-s-3;break}}h=h.parentNode}d&&(!l&&!c||l&&a<0||c&&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):(us(t),this.triggerStyles||(this.triggerStyles=Ze(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",us,{passive:!1}),this.$trigger.addEventListener("touchmove",us,{passive:!1}),this.$trigger.addEventListener("touchend",us),(!this.disabled[0]&&J(o)>3||!this.disabled[1]&&J(a)>3)&&(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,h,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,_=this.releaseYSpring,y=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,S=this.x,x=this.y,T=this.computeVelocity(s-h,n-l),w=this.angle=rt(n-a,s-o),k=150*T,$=(1-this.releaseContainerFriction)*this.dragSpeed,E=S+Z(w)*k,C=x+G(w)*k,B=E>d?d+(E-d)*$:E<p?p+(E-p)*$:E,L=C>u?u+(C-u)*$:C<c?c+(C-c)*$:C,A=this.destX=at(lt(ct(B,this.snapX),5),p,d),N=this.destY=at(lt(ct(L,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,E,C);let P=0,R=0,Y=y,X=y,M=0;if(b.x=S,b.y=x,!t){const t=A===d?S>d?-1:1:S<p?-1:1,s=lt(S-A,0);g.velocity=e&&v?s?k*t/J(s):0:T;const{ease:i,duration:r,restDuration:n}=g;P=S===A?0:v?r:r-n*D.timeScale,v&&(Y=i),P>M&&(M=P)}if(!e){const e=N===u?x>u?-1:1:x<c?-1:1,s=lt(x-N,0);_.velocity=t&&v?s?k*e/J(s):0:T;const{ease:i,duration:r,restDuration:n}=_;R=x===N?0:v?r:r-n*D.timeScale,v&&(X=i),R>M&&(M=R)}if(!v&&F&&$&&(P||R)){const t=r.blend;new Ne(b,{x:{to:B,duration:.65*P},y:{to:L,duration:.65*R},ease:y,composition:t}).init(),new Ne(b,{x:{to:A,duration:P},y:{to:N,duration:R},ease:y,composition:t}).init(),this.overshootXTicker.stretch(P).restart(),this.overshootYTicker.stretch(R).restart()}else t||this.animate[this.xProp](A,P,Y),e||this.animate[this.yProp](N,R,X);this.scrollInView(M,this.scrollThreshold,y);let O=!1;A!==m&&(this.snapped[0]=A,this.snapX&&(O=!0)),N!==f&&this.snapY&&(this.snapped[1]=N,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",us),this.$trigger.removeEventListener("touchmove",us),this.$trigger.removeEventListener("touchend",us),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=Ze(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":us(t)}}}class ys{constructor(t={}){D.scope&&D.scope.revertibles.push(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||Dt(e)[0]||i);const n=t.defaults,o=D.defaults,a=t.mediaQueries;if(this.defaults=n?ft(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],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)}}execute(t){let e=D.scope,s=D.root,i=D.defaults;D.scope=this,D.root=this.root,D.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return D.scope=e,D.root=s,D.defaults=i,n}refresh(){return 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);e&&this.revertConstructors.push(e)}))})),this}add(t,e){if(M(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);t&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.mediaQueryLists;let i=t.length,r=e.length;for(;i--;)t[i].revert();for(;r--;)e[r](this);for(let t in s)s[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const vs=(t,e)=>t&&M(t)?t(e):t,bs=new Map;class Ss{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.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 se({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;gt(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new se({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=lt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new se({autoplay:!1,duration:250*D.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new se({autoplay:!1,duration:500*D.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=lt(t?s.scrollX:e.scrollLeft,0),this.scrollY=lt(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=document.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){gt(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),gt(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.unobserve(this.element),(this.useWin?s:this.element).removeEventListener("scroll",this),bs.delete(this.element)}}const xs=(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}=Vt(a,Ht);let c=h;return"%"===l?c=h/100*s:l&&(c=xe(t,Ht,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},Ts=(t,e,s,i,r)=>{let n;if(X(e)){const o=C.exec(e);if(o){const a=o[0],h=a[0],l=e.split(a),c="min"===l[0],d="max"===l[0],u=xs(t,l[0],s,i,r),p=xs(t,l[1],s,i,r);if(c){const e=Wt(xs(t,"min",s),p,h);n=e<u?u:e}else if(d){const e=Wt(xs(t,"max",s),p,h);n=e>u?u:e}else n=Wt(u,p,h)}else n=xs(t,e,s,i,r)}else n=e;return lt(n,0)},ws=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 ks=0;const $s=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Es{constructor(t={}){D.scope&&D.scope.revertibles.push(this);const e=Xt(t.sync,"play pause"),s=e?_e(e):null,r=e&&("linear"===e||e===ie),n=e&&!(s===ie&&!r),o=e&&(Y(e)||!0===e||r),a=e&&X(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=ks++,this.id=O(t.id)?this.index:t.id,this.container=(t=>{const e=t&&Dt(t)[0]||i.body;let s=bs.get(e);return s||(s=new Ss(e),bs.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||!!h,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=h&&!l&&h[0]?h[0]:y,this.onSyncLeave=h&&!l&&h[1]?h[1]:y,this.onSyncEnterForward=h&&l&&h[0]?h[0]:y,this.onSyncLeaveForward=h&&l&&h[1]?h[1]:y,this.onSyncEnterBackward=h&&l&&h[2]?h[2]:y,this.onSyncLeaveBackward=h&&l&&h[3]?h[3]:y,this.onEnter=t.onEnter||y,this.onLeave=t.onLeave||y,this.onEnterForward=t.onEnterForward||y,this.onLeaveForward=t.onLeaveForward||y,this.onEnterBackward=t.onEnterBackward||y,this.onLeaveBackward=t.onLeaveBackward||y,this.onUpdate=t.onUpdate||y,this.onSyncComplete=t.onSyncComplete||y,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=Xt(t.debug,!1),this._next=null,this._prev=null,yt(this.container,this),je((()=>{if(!this.reverted){if(!this.target){const e=Dt(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;O(t.targets)?gt(t,(t=>{t.targets&&!e&&(e=ws(t))})):e=ws(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:lt(at(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=Xt(vs(t.repeat,this),!0),this.horizontal="x"===Xt(vs(t.axis,this),"y"),this.enter=Xt(vs(t.enter,this),"end start"),this.leave=Xt(vs(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=$s[this.index%$s.length],h=t.useWin,l=h?t.winWidth:t.width,c=h?t.winHeight:t.height,d=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,_=e?g:15,y=e?60:g,v=e?y:_,b=e?"repeat-x":"repeat-y",S=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,T=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${T("absolute",m,f,e?d: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=`${T("sticky",0,0,e?l:g,e?g:c)}`,s||(n.style.cssText+=`background:\n ${x("#FFFF")}${S(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${S(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${T("relative",0,0,e?d:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${x("#FFFF")}${S(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${S(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const w=[" enter: "," leave: "];this.coords.forEach(((t,s)=>{const r=s>1,h=(r?0:this.offset)+t,m=s%2,f=h<v,g=h>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,S=i.createElement("div"),x=i.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?y:_)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${w[m]}${this.thresholds[s]}`,S.style.cssText=`${T("absolute",0,0,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-${k}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${_};\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 `,S.appendChild(x);let E=h-$+(e?1:0);S.style[e?"left":"top"]=`${E}px`,(r?n:o).appendChild(S)})),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Ge(t.element,"position")&&(this.debugStyles=Ze(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,h=0,l=0,c=a;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===Ge(s.element,"position")&&Ze(s.element,{position:"relative "});for(;a&&a!==s.element&&a!==i.body;){const e="sticky"===Ge(a,"position")&&Ze(a,{position:"static"});a===c&&(h+=a.offsetLeft||0,l+=a.offsetTop||0,c=a.offsetParent),a=a.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?h:l,p=r?e.offsetWidth:e.offsetHeight,m=r?s.width:s.height,f=(r?s.scrollWidth:s.scrollHeight)-m,g=this.enter,_=this.leave;let y="start",v="end",b="end",S="start";if(X(g)){const t=g.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(R(g)){const t=g;O(t.container)||(b=t.container),O(t.target)||(y=t.target)}else Y(g)&&(b=g);if(X(_)){const t=_.split(" ");S=t[0],v=t.length>1?t[1]:v}else if(R(_)){const t=_;O(t.container)||(S=t.container),O(t.target)||(v=t.target)}else Y(_)&&(S=_);const x=Ts(e,y,p),T=Ts(e,v,p),w=x+u-m,k=T+u-f,$=Ts(e,b,m,w,k),E=Ts(e,S,m,w,k),C=x+u-$,B=T+u-E,D=B-C;this.offsets[0]=h,this.offsets[1]=l,this.offset=u,this.offsetStart=C,this.offsetEnd=B,this.distance=D<=0?0:D,this.thresholds=[y,v,b,S],this.coords=[x,T,$,E],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){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,c=!h&&!l,d=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&d,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&&Y(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=lt(ss(e,g,dt(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 _t(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}return t.Animatable=ls,t.Draggable=_s,t.JSAnimation=Ne,t.Scope=ys,t.ScrollObserver=Es,t.Spring=cs,t.Timeline=hs,t.Timer=se,t.WAAPIAnimation=qe,t.animate=(t,e)=>new Ne(t,e,null,0,!1).init(),t.createAnimatable=(t,e)=>new ls(t,e),t.createDraggable=(t,e)=>new _s(t,e),t.createScope=t=>new ys(t),t.createSpring=ds,t.createTimeline=t=>new hs(t).init(),t.createTimer=t=>new se(t,null,0).init(),t.eases=fe,t.engine=$t,t.onScroll=(t={})=>new Es(t),t.scrollContainers=bs,t.stagger=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!O(o),h=a&&!O(o.ease)?o.ease:a?_e(o):null,l=e.grid,c=e.axis,d=O(r)||0===r||"first"===r,u="center"===r,p="last"===r,f=P(t),g=q(f?t[0]:t),_=f?q(t[1]):0,y=k.exec((f?t[1]:t)+m),v=e.start||0+(f?g:0);let b=d?0:Y(r)?r:0;return(t,r,o,a)=>{if(u&&(b=(o-1)/2),p&&(b=o-1),!s.length){for(let t=0;t<o;t++){if(l){const e=u?(l[0]-1)/2:b%l[0],i=u?(l[1]-1)/2:et(b/l[0]),r=e-t%l[0],n=i-et(t/l[0]);let o=j(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(J(b-t));i=it(...s)}h&&(s=s.map((t=>h(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:J(i-t))))}const d=f?(_-g)/i:g;let m=(a?os(a,O(e.start)?a.iterationDuration:v):v)+(d*lt(s[r],2)||0);return e.modifier&&(m=e.modifier(m)),y&&(m=`${m}${y[2]}`),m}},t.svg=Rt,t.utils=ns,t.waapi=Qe,t}({});
+var anime=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(),h=Symbol(),a=Symbol(),l=Symbol(),c=Symbol(),d=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","perspective","matrix","matrix3d"],_=g.reduce(((t,e)=>({...t,[e]:e+"("})),{}),y=()=>{},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,w=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,S=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,x=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,k=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,$=/([a-z])([A-Z])/g,C=/(\w+)(\([^)]+\)+)/g,E=/(\*=|\+=|-=)/,B={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:p,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:y,onBeforeUpdate:y,onUpdate:y,onLoop:y,onPause:y,onComplete:y,onRender:y},L={current:null,root:i},D={defaults:B,precision:4,timeScale:1,tickThreshold:200},A={version:"4.1.0",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(A));const N=t=>t.replace($,"$1-$2").toLowerCase(),F=(t,e)=>0===t.indexOf(e),O=Date.now,P=Array.isArray,M=t=>t&&t.constructor===Object,R=t=>"number"==typeof t&&!isNaN(t),Y=t=>"string"==typeof t,I=t=>"function"==typeof t,X=t=>void 0===t,z=t=>X(t)||null===t,W=t=>e&&t instanceof SVGElement,V=t=>v.test(t),H=t=>F(t,"rgb"),U=t=>F(t,"hsl"),q=t=>!D.defaults.hasOwnProperty(t),Q=t=>Y(t)?parseFloat(t):t,j=Math.pow,G=Math.sqrt,Z=Math.sin,J=Math.cos,K=Math.abs,tt=Math.exp,et=Math.ceil,st=Math.floor,it=Math.asin,rt=Math.max,nt=Math.atan2,ot=Math.PI,ht=Math.round,at=(t,e,s)=>t<e?e:t>s?s:t,lt={},ct=(t,e)=>{if(e<0)return t;if(!e)return ht(t);let s=lt[e];return s||(s=lt[e]=10**e),ht(t*s)/s},dt=(t,e)=>P(e)?e.reduce(((e,s)=>K(s-t)<K(e-t)?s:e)):e?ht(t/e)*e:t,ut=(t,e,s)=>t+(e-t)*s,pt=(t,e,s)=>{const i=10**(s||0);return st((Math.random()*(e-t+1/i)+t)*i)/i},mt=t=>{let e,s,i=t.length;for(;i;)s=pt(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},ft=t=>t===1/0?u:t===-1/0?-1e12:t,gt=t=>t<=d?d:ft(ct(t,11)),_t=t=>P(t)?[...t]:t,yt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=X(r)?e[i]:r}return s},vt=(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}},bt=(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},Tt=(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=>{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 h=t(...s);return h&&!I(h)&&h.revert&&(e=h),X(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),h||y}};class St{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=ct(p/120,0),this._fps=120,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<d?d:s,r=ct(p/i,0);this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<d?d:e}requestTick(t){const e=this._scheduledTime,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const xt=(t,e,s,i,n)=>{const o=t.parent,h=t.duration,l=t.completed,c=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,f=t._loopDelay,g=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,T=t._currentTime,w=b+c,S=e-b,x=at(T,-b,h),k=at(S,-b,h),$=S-T,C=k>0,E=k>=h,B=h<=d,L=2===n;let A=0,N=S,F=0;if(u>1){const e=~~(k/(c+(E?0:f)));t._currentIteration=at(e,0,u),E&&t._currentIteration--,A=t._currentIteration%2,N=k%(c+f)||0}const O=g^(y&&A),P=t._ease;let M=E?O?0:h:O?c-N:N;P&&(M=c*P(M/c)||0);const R=(o?o.backwards:S<T)?!O:!!O;if(t._currentTime=S,t._iterationTime=M,t.backwards=R,C&&!t.began?(t.began=!0,s||o&&(R||!o.began)||t.onBegin(t)):S<=0&&(t.began=!1),s||v||!C||t._currentIteration===p||t.onLoop(t),L||1===n&&(e>=b&&e<=w||e<=b&&x>b||e>=w&&x!==h)||M>=w&&x!==h||M<=b&&x>0||e<=x&&x===h&&l||E&&!l&&B){if(C&&(t.computeDeltaTime(x),s||t.onBeforeUpdate(t)),!v){const e=L||(R?-1*$:$)>=D.tickThreshold,n=t._offset+(o?o._offset:0)+b+M;let h,l,c,d,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,y=u._prevRep,v=t!==r.none;if((e||(s!==o||n<=f+(g?g._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!g||g._isOverridden||n<=g._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=at(M-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,_=0===m,y=_&&g||0===s||1===s?-1:D.precision;let b,T;if(_)b=T=n(ct(ut(u._fromNumber,u._toNumber,s),y));else if(1===m)T=n(ct(ut(u._fromNumber,u._toNumber,s),y)),b=`${T}${u._unit}`;else if(2===m){const t=u._fromNumbers,e=u._toNumbers,i=ct(at(n(ut(t[0],e[0],s)),0,255),0),r=ct(at(n(ut(t[1],e[1],s)),0,255),0),o=ct(at(n(ut(t[2],e[2],s)),0,255),0),h=at(n(ct(ut(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${h})`,v){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=h}}else if(3===m){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(ct(ut(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=T),i||t===r.blend)u._value=b;else{const t=u.property;h=u.target,g?h[t]=b:1===f?h.setAttribute(t,b):(l=h.style,3===f?(h!==c&&(c=h,d=h[a]),d[t]=b,p=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),C&&(F=1)}}if(p&&u._renderTransforms){let t=m;for(let e in d)t+=`${_[e]}${d[e]}) `;l.transform=t,p=0}u=u._next}!s&&F&&t.onRender(t)}!s&&C&&t.onUpdate(t)}return o&&B?!s&&(o.began&&!R&&S>=h&&!l||R&&S<=d&&l)&&(t.onComplete(t),t.completed=!R):C&&E?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(R||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},kt=(t,e,s,i,r)=>{const n=t._currentIteration;if(xt(t,e,s,i,r),t._hasChildren){const o=t,h=o.backwards,a=i?e:o._iterationTime,l=O();let c=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;vt(o,(e=>{if(h){const i=e.duration,r=e._offset+e._delay;s||!(i<=d)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&xt(e,t,s,1,2),e.began=!1,e.completed=!1})),s||o.onLoop(o)}vt(o,(t=>{const e=ct((a-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;c+=xt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),h),!s&&c&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},$t={animation:null,update:y},Ct=(()=>e?requestAnimationFrame:setImmediate)(),Et=(()=>e?cancelAnimationFrame:clearImmediate)();class Bt extends St{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=B,this.paused=!(!e||!i.hidden),this.reqId=null}update(){const t=this._currentTime=O();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?(bt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):kt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}$t.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=Ct(Dt)),this}pause(){return this.paused=!0,At()}resume(){if(this.paused)return this.paused=!1,vt(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===D.timeScale?1:p)}set speed(t){this._speed=t*D.timeScale,vt(this,(t=>t.speed=t._speed))}get timeUnit(){return 1===D.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(D.timeScale!==s){D.timeScale=s,D.tickThreshold=200*s;const t=e?.001:p;this.defaults.duration*=t,this._speed*=t}}get precision(){return D.precision}set precision(t){D.precision=t}}const Lt=(()=>{const t=new Bt(O());return e&&(A.engine=t,i.addEventListener("visibilitychange",(()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())}))),t})(),Dt=()=>{Lt._head?(Lt.reqId=Ct(Dt),Lt.update()):Lt.reqId=0},At=()=>(Et(Lt.reqId),Lt.reqId=0,Lt);function Nt(t){const e=Y(t)?L.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Ft(t){if(z(t))return[];if(P(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!z(i)){const t=Nt(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(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}if(!e)return[t];const s=Nt(t);return s?Array.from(s):[t]}function Ot(t){const e=Ft(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[h]=t,s[a]={})}}return e}const Pt=t=>{const e=Ft(t)[0];if(e&&W(e))return e},Mt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),Rt=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[h],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Mt(t,s,-1),i=Mt(t,s,1);return 180*nt(i.y-e.y,i.x-e.x)/ot}{const i=Mt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Yt=["opacity","rotate","overflow","color"],It={morphTo:(t,e=.33)=>s=>{const i=Pt(t);if(!i)return;const r="path"===s.tagName,n=r?" ":",",o=s[l];o&&s.setAttribute(r?"d":"points",o);let h="",a="";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 c=e/(l-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";h+=p+ct(d.x,3)+n+d.y+" ",a+=p+ct(u.x,3)+n+u.y+" "}}else h=s.getAttribute(r?"d":"points"),a=i.getAttribute(r?"d":"points");return s[l]=a,[h,a]},createMotionPath:t=>{const e=Pt(t);if(e)return{translateX:Rt(e,"x"),translateY:Rt(e,"y"),rotate:Rt(e,"a")}},createDrawable:(t,e=0,s=0)=>Ft(t).map((t=>((t,e,s)=>{const i=p,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let h=n;const a=new Proxy(t,{get(t,e){const s=t[e];return e===c?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],a=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(G(s.a*s.a+s.b*s.b)+G(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=a*i*l+c,u=i*l+(0===r&&1===a||1===r&&0===a?0:10*l)-d;if("butt"!==n){const e=r===a?"butt":n;h!==e&&(t.style.strokeLinecap=`${e}`,h=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:I(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),a.setAttribute("draw",`${e} ${s}`)),a})(t,e,s)))},Xt=(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),zt=(t,e)=>X(t)?e:t,Wt=(t,e,s,i,r)=>{if(I(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Vt=(t,e)=>t[o]?t[h]&&((t,e)=>{if(Yt.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:F(e,"--")?4:e in t.style?2:e in t?0:1:0,Ht=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[c]||t).getPropertyValue(e);return"auto"===r?"0":r},Ut=(t,e,s,i)=>{const r=X(s)?Vt(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[a];let o;for(;o=C.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:F(e,"scale")?"1":F(e,"rotate")||F(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Ht(t,e,i).trimStart():Ht(t,e,i)},qt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Qt=(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(" ")&&k.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(V(r=s)||H(r)||U(r))return e.t=2,e.d=H(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):V(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):U(i)?(t=>{const e=w.exec(t)||S.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=X(e[4])?1:+e[4];let o,h,a;if(0===i)o=h=a=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=ct(255*Xt(e,t,s+1/3),0),h=ct(255*Xt(e,t,s),0),a=ct(255*Xt(e,t,s-1/3),0)}return[o,h,a,n]})(i):[0,0,0,1],e;{const t=s.match(x);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(x)||[],e}}var i,r;return e.n=s,e},jt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=_t(t._toNumbers),e.s=_t(t._strings),e),Gt={t:0,n:0,u:null,o:null,d:null,s:null},Zt={_rep:new WeakMap,_add:new Map},Jt=(t,e,s="_rep")=>{const i=Zt[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Kt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,te=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=d,t._currentTime=d},ee=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;Tt(e,t,Kt,"_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){te(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)te(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<d&&te(i)}let o=!0;if(vt(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;vt(t,(t=>{t!==e&&vt(t,(t=>{t._isOverlapped||(s=!1)}))})),s&&t.cancel()}else e.cancel()}}}else if(s===r.blend){const e=Jt(t.target,t.property,"_add"),s=(t=>{let e=$t.animation;return e||(e={duration:d,computeDeltaTime:y,_offset:0,_delay:0,_head:null,_tail:null},$t.animation=e,$t.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?_t(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}}})),xt(e,1,1,0,2)}),e})(Zt._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=d,i._startTime=0,i._numbers=_t(t._fromNumbers),i._number=0,i._next=null,i._prev=null,Tt(e,i),Tt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=_t(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=_t(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0})),i._fromNumbers=e}Tt(e,t,null,"_prevAdd","_nextAdd")}return t},se=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=Zt._rep.get(s)[i];if(bt(n,t,"_prevRep","_nextRep"),e===r.blend){const e=Zt._add,r=e.get(s);if(!r)return;const n=r[i],o=$t.animation;bt(n,t,"_prevAdd","_nextAdd");const h=n._head;if(h&&h===n._tail){bt(n,h,"_prevAdd","_nextAdd"),bt(o,h);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},ie=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),re=t=>t._cancelled?(t._hasChildren?vt(t,re):vt(t,(t=>{t._composition!==r.none&&ee(t,Jt(t.target,t.property))})),t._cancelled=0,t):t;let ne=0;class oe extends St{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:h,loop:a,loopDelay:l,autoplay:c,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:b}=t;L.current&&L.current.register(this);const T=e?0:Lt._elapsedTime,w=e?e.defaults:D.defaults,S=I(r)||X(r)?w.delay:+r,x=I(n)||X(n)?1/0:+n,k=zt(a,w.loop),$=zt(l,w.loopDelay),C=!0===k||k===1/0||k<0?1/0:k+1;let E=0;if(e)E=s;else{let t=O();Lt.paused&&(Lt.requestTick(t),t=Lt._elapsedTime),E=t-Lt._startTime}this.id=X(i)?++ne:i,this.parent=e,this.duration=ft((x+$)*C-$)||d,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||w.onBegin,this.onBeforeUpdate=v||w.onBeforeUpdate,this.onUpdate=b||w.onUpdate,this.onLoop=f||w.onLoop,this.onPause=g||w.onPause,this.onComplete=m||w.onComplete,this.iterationDuration=x,this.iterationCount=C,this._autoplay=!e&&zt(c,w.autoplay),this._offset=E,this._delay=S,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=y,this._running=!1,this._reversed=+zt(o,w.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=zt(h,w.alternate),this._prev=null,this._next=null,this._elapsedTime=T,this._startTime=T,this._lastTime=T,this._fps=zt(u,w.frameRate),this._speed=zt(p,w.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return at(ct(this._currentTime,D.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ct(this._iterationTime,D.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return at(ct(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return at(ct(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*at(+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=0){return re(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,kt(this,0,1,t,2),ie(this),this._hasChildren&&vt(this,ie),this}init(t=0){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&kt(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*Lt._speed);return this._startTime=O()-(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<=d&&!this._hasChildren?kt(this,d,0,0,2):(this._running||(Tt(Lt,this),Lt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,Lt.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){re(this),this.completed=!1;const i=this.paused;return this.paused=!0,kt(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?st(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?vt(this,(t=>t.cancel()),!0):vt(this,se),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=gt(t);if(e===s)return this;const i=t/e,r=t<=d;return this.duration=r?d:s,this.iterationDuration=r?d:gt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){kt(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=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const he=t=>t,ae=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,le=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?he:r=>0===r||1===r?r:ae(((t,e,s)=>{let i,r,n=0,o=1,h=0;do{r=n+(o-n)/2,i=ae(r,e,s)-t,i>0?o=r:n=r}while(K(i)>1e-7&&++h<100);return r})(r,t,s),e,i),ce=(t=10,e)=>{const s=e?et:st;return e=>s(at(e,0,1)*t)*(1/t)},de=(...t)=>{const e=t.length;if(!e)return he;const s=e-1,i=t[0],r=t[s],n=[0],o=[Q(i)];for(let e=1;e<s;e++){const i=t[e],r=Y(i)?i.trim().split(" "):[i],h=r[0],a=r[1];n.push(X(a)?e/s:Q(a)/100),o.push(Q(h))}return o.push(Q(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]}},ue=(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(at(o,r,1))}return s.push(1),de(...s)},pe=ot/2,me=2*ot,fe=(t=1.68)=>e=>j(e,+t),ge={[m]:fe,Quad:fe(2),Cubic:fe(3),Quart:fe(4),Quint:fe(5),Sine:t=>1-J(t*pe),Circ:t=>1-G(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.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=at(+t,1,10),i=at(+e,d,2),r=i/me*it(1/s),n=me/i;return t=>0===t||1===t?t:-s*j(2,-10*(1-t))*Z((1-t-r)*n)}},_e={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},ye=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=_e[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:he}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):he}},ve=(()=>{const t={linear:de,irregular:ue,steps:ce,cubicBezier:le};for(let e in _e)for(let s in ge){const i=ge[s],r=_e[e];t[e+s]=s===m||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),be={linear:he},Te=t=>I(t)?t:Y(t)?ye(t,ve,be):he,we={},Se=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&W(e)&&t in e.style){const e=we[t];if(e)return e;{const e=t?N(t):t;return we[t]=e,e}}return t},xe={deg:1,rad:180/ot,turn:360},ke={},$e=(t,e,s,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===s)return e;const h=o+n+s,a=ke[h];if(X(a)||r){let r;if(n in xe)r=o*xe[n]/xe[s];else{const e=100,h=t.cloneNode(),a=t.parentNode,l=a&&a!==i?a:i.body;l.appendChild(h);const c=h.style;c.width=e+n;const d=h.offsetWidth||e;c.width=e+s;const u=d/(h.offsetWidth||e);l.removeChild(h),r=u*o}e.n=r,ke[h]=r}else e.n=a;return e.t,e.u=s,e},Ce=t=>{if(t._hasChildren)vt(t,Ce,!0);else{const e=t;e.pause(),vt(e,(t=>{const s=t.property,i=t.target;if(i[o]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[a];if(X(n)||n===m?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=m;for(let s in e)t+=_[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else X(n)||n===m?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===m&&t.removeAttribute("style")}))}}))}return t},Ee={t:0,n:0,u:null,o:null,d:null,s:null},Be={t:0,n:0,u:null,o:null,d:null,s:null},Le={func:null},De=[null],Ae=[null,null],Ne={to:null};let Fe,Oe,Pe=0;class Me extends oe{constructor(t,e,s,i,n=!1,o=0,h=0){super(e,s,i);const a=Ot(t),l=a.length,c=e.keyframes,u=c?yt(((t,e)=>{const s={};if(P(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(q);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];q(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=zt(e.duration,D.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(q(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let h=n.length,a=n[h-1];const l={to:r[t]};let c=0;for(let t=0;t<h;t++)c+=n[t].duration;1===h&&(l.from=a.to),r.ease&&(l.ease=r.ease),l.duration=o-(h?c: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})(c,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=u,T=s?s.defaults:D.defaults,w=zt(_,T.playbackEase),S=w?Te(w):null,x=!X(g)&&!X(g.ease),k=x?g.ease:zt(g,S?"linear":T.ease),$=x?g.duration:zt(f,T.duration),C=zt(m,T.delay),E=y||T.modifier,B=X(v)&&l>=p?r.none:X(v)?T.composition:v,L={},A=this._offset+(s?s._offset:0);let N=NaN,F=NaN,O=0,Y=0;for(let t=0;t<l;t++){const e=a[t],i=o||t,c=h||l;let p=NaN,m=NaN;for(let t in u)if(q(t)){const o=Vt(e,t),h=Se(t,e,o);let a=u[t];const l=P(a);if(n&&!l&&(Ae[0]=a,Ae[1]=a,a=Ae),l){const t=a.length,e=!M(a[0]);2===t&&e?(Ne.to=a,De[0]=Ne,Fe=De):t>2&&e?(Fe=[],a.forEach(((t,e)=>{e?1===e?(Ae[1]=t,Fe.push(Ae)):Fe.push(t):Ae[0]=t}))):Fe=a}else De[0]=a,Fe=De;let f=null,g=null,_=NaN,y=0,v=0;for(let t=Fe.length;v<t;v++){const n=Fe[v];M(n)?Oe=n:(Ne.to=n,Oe=Ne),Le.func=null;const a=Wt(Oe.to,e,i,c,Le);let l;M(a)&&!X(a.to)?(Oe=a,l=a.to):l=a;const u=Wt(Oe.from,e,i,c),p=Oe.ease,m=!X(p)&&!X(p.ease),b=m?p.ease:p||k,T=m?p.duration:Wt(zt(Oe.duration,t>1?Wt($,e,i,c)/t:$),e,i,c),w=Wt(zt(Oe.delay,v?0:C),e,i,c),S=Wt(zt(Oe.composition,B),e,i,c),x=R(S)?S:r[S],D=Oe.modifier||E,N=!X(u),F=!X(l),I=P(l),z=I||N&&F,W=g?y+w:w,V=A+W;Y||!N&&!I||(Y=1);let H=g;if(x!==r.none){f||(f=Jt(e,h));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(H=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)te(t),t=t._nextRep}if(z?(Qt(I?Wt(l[0],e,i,c):u,Ee),Qt(I?Wt(l[1],e,i,c,Le):l,Be),0===Ee.t&&(H?1===H._valueType&&(Ee.t=1,Ee.u=H._unit):(Qt(Ut(e,h,o,L),Gt),1===Gt.t&&(Ee.t=1,Ee.u=Gt.u)))):(F?Qt(l,Be):g?jt(g,Be):Qt(s&&H&&H.parent.parent===s?H._value:Ut(e,h,o,L),Be),N?Qt(u,Ee):g?jt(g,Ee):Qt(s&&H&&H.parent.parent===s?H._value:Ut(e,h,o,L),Ee)),Ee.o&&(Ee.n=qt(H?H._toNumber:Qt(Ut(e,h,o,L),Gt).n,Ee.n,Ee.o)),Be.o&&(Be.n=qt(Ee.n,Be.n,Be.o)),Ee.t!==Be.t)if(3===Ee.t||3===Be.t){const t=3===Ee.t?Ee:Be,e=3===Ee.t?Be:Ee;e.t=3,e.s=_t(t.s),e.d=t.d.map((()=>e.n))}else if(1===Ee.t||1===Be.t){const t=1===Ee.t?Ee:Be,e=1===Ee.t?Be:Ee;e.t=1,e.u=t.u}else if(2===Ee.t||2===Be.t){const t=2===Ee.t?Ee:Be,e=2===Ee.t?Be:Ee;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Ee.u!==Be.u){let t=Be.u?Ee:Be;t=$e(e,t,Be.u?Be.u:Ee.u,!1)}if(Be.d&&Ee.d&&Be.d.length!==Ee.d.length){const t=Ee.d.length>Be.d.length?Ee:Be,e=t===Ee?Be:Ee;e.d=t.d.map(((t,s)=>X(e.d[s])?0:e.d[s])),e.s=_t(t.s)}const U=ct(+T||d,12),q={parent:this,id:Pe++,property:h,target:e,_value:null,_func:Le.func,_ease:Te(b),_fromNumbers:_t(Ee.d),_toNumbers:_t(Be.d),_strings:_t(Be.s),_fromNumber:Ee.n,_toNumber:Be.n,_numbers:_t(Ee.d),_number:Ee.n,_unit:Be.u,_modifier:D,_currentTime:0,_startTime:W,_delay:+w,_updateDuration:U,_changeDuration:U,_absoluteStartTime:V,_tweenType:o,_valueType:Be.t,_composition:x,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};x!==r.none&&ee(q,f),isNaN(_)&&(_=q._startTime),y=ct(W+U,12),g=q,O++,Tt(this,q)}(isNaN(F)||_<F)&&(F=_),(isNaN(N)||y>N)&&(N=y),3===o&&(p=O-v,m=O)}if(!isNaN(p)){let t=0;vt(this,(e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===r.blend&&vt($t.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),F?(vt(this,(t=>{t._startTime-t._delay||(t._delay-=F),t._startTime-=F})),N-=F):F=0,N||(N=d,this.iterationCount=0),this.targets=a,this.duration=N===d?d:ft((N+this._loopDelay)*this.iterationCount-this._loopDelay)||d,this.onRender=b||T.onRender,this._ease=S,this._delay=F,this.iterationDuration=N,this._inlineStyles=L,!this._autoplay&&Y&&this.onRender(this)}stretch(t){const e=this.duration;if(e===gt(t))return this;const s=t/e;return vt(this,(t=>{t._updateDuration=gt(t._updateDuration*s),t._changeDuration=gt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return vt(this,(t=>{const e=t._func;if(e){const s=Ut(t.target,t.property,t._tweenType);Qt(s,Gt),Qt(e(),Be),t._fromNumbers=_t(Gt.d),t._fromNumber=Gt.n,t._toNumbers=_t(Be.d),t._strings=_t(Be.s),t._toNumber=Be.n}})),this}revert(){return super.revert(),Ce(this)}then(t){return super.then(t)}}const Re=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Ye={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Ie=(()=>{const t={};for(let e in _e)t[e]=t=>_e[e](fe(t));return t})(),Xe=t=>{let e=Ye[t];if(e)return e;if(e="linear",Y(t)){if(F(t,"linear")||F(t,"cubic-")||F(t,"steps")||F(t,"ease"))e=t;else if(F(t,"cubicB"))e=N(t);else{const s=ye(t,Ie,Ye);I(s)&&(e=s===he?"linear":Re(s))}Ye[t]=e}else if(I(t)){const s=Re(t);s&&(e=s)}else t.ease&&(e=Re(t.ease));return e},ze=["x","y","z"],We=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...ze],Ve=(()=>[...ze,...g.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))])();let He=null;const Ue={_head:null,_tail:null},qe=(t,e,s)=>{let i=Ue._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,h=!s||i.parent===s;if(n&&o&&h){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),bt(Ue,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},Qe=(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),Tt(Ue,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const h=()=>{qe(e,s,t)};return n.onremove=h,n.onfinish=h,n},je=(t,e,s,i,r)=>{let n=Wt(e,s,i,r);return R(n)?We.includes(t)||F(t,"translate")?`${n}px`:F(t,"rotate")||F(t,"skew")?`${n}deg`:`${n}`:n},Ge=(t,e,s,i,r,n)=>{let o="0";const h=X(i)?getComputedStyle(t)[e]:je(e,i,t,r,n);return o=X(s)?P(i)?i.map((s=>je(e,s,t,r,n))):h:[je(e,s,t,r,n),h],o};class Ze{constructor(t,s){L.current&&L.current.register(this),z(He)&&(!e||!X(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(g.forEach((t=>{const e=F(t,"skew"),s=F(t,"scale"),i=F(t,"rotate"),r=F(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{}})),He=!0):He=!1);const i=Ot(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=zt(s.ease,Xe(D.defaults.ease)),o=n.ease&&n,h=zt(s.autoplay,D.defaults.autoplay),l=!(!h||!h.link)&&h,c=s.alternate&&!0===s.alternate,d=s.reversed&&!0===s.reversed,u=zt(s.loop,D.defaults.loop),v=!0===u||u===1/0?1/0:R(u)?u+1:1,b=c?d?"alternate-reverse":"alternate":d?"reverse":"normal",T=Xe(n),w=1===D.timeScale?1:p;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||y,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!h||!1!==l,this.reversed=d,this.autoplay=h,this._speed=zt(s.playbackRate,D.defaults.playbackRate),this._resolve=y,this._completed=0,this._inlineStyles=i.map((t=>t.getAttribute("style"))),i.forEach(((t,e)=>{const i=t[a],h=Ve.some((t=>s.hasOwnProperty(t))),l=(o?o.duration:Wt(zt(s.duration,D.defaults.duration),t,e,r))*w,c=Wt(zt(s.delay,D.defaults.delay),t,e,r)*w,d=zt(s.composition,"replace");for(let o in s){if(!q(o))continue;const a={},u={iterations:v,direction:b,fill:"forwards",easing:T,duration:l,delay:c,composite:d},p=s[o],m=!!h&&(g.includes(o)?o:f.get(o));let _;if(M(p)){const s=p,h=zt(s.ease,n),f=h.ease&&h,g=s.to,y=s.from;if(u.duration=(f?f.duration:Wt(zt(s.duration,l),t,e,r))*w,u.delay=Wt(zt(s.delay,c),t,e,r)*w,u.composite=zt(s.composition,d),u.easing=Xe(h),_=Ge(t,o,y,g,e,r),m?(a[`--${m}`]=_,i[m]=_):a[o]=Ge(t,o,y,g,e,r),Qe(this,t,o,a,u),!X(y))if(m){const e=`--${m}`;t.style.setProperty(e,a[e][0])}else t.style[o]=a[o][0]}else _=P(p)?p.map((s=>je(o,s,t,e,r))):je(o,p,t,e,r),m?(a[`--${m}`]=_,i[m]=_):a[o]=_,Qe(this,t,o,a,u)}if(h){let e=m;for(let t in i)e+=`${_[t]}var(--${t})) `;t.style.transform=e}})),l&&this.autoplay.link(this)}forEach(t){const e=Y(t)?e=>e[t]():t;return this.animations.forEach(e),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=D.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===D.timeScale?1:p);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const Je={animate:(t,e)=>new Ze(t,e),convertEase:Re},Ke=(t=y)=>new oe({duration:1*D.timeScale,onComplete:t},null,0).resume();function ts(t,e,s){const i=Ot(t);if(!i.length)return;const[r]=i,n=Vt(r,e),o=Se(e,r,n);let h=Ut(r,o);if(X(s))return h;if(Qt(h,Gt),0===Gt.t||1===Gt.t){if(!1===s)return Gt.n;{const t=$e(r,Gt,s,!1);return`${ct(t.n,D.precision)}${t.u}`}}}const es=(t,e)=>{if(!X(e))return e.duration=d,e.composition=zt(e.composition,r.none),new Me(t,e,null,0,!0).resume()},ss=(t,e,s)=>{let i=!1;return vt(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,h=Se(s,n,o);(!h||h&&h===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),bt(e,r),se(r),i=!0)}}),!0),i},is=(t,e,s)=>{const i=Ft(t),r=e||Lt,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];qe(e,s,n)}let o;if(r._hasChildren){let e=0;vt(r,(n=>{if(!n._hasChildren)if(o=ss(i,n,s),o&&!n._head)n.cancel(),bt(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?is(t,n,s):n._hasChildren=!1}),!0),X(r.iterationDuration)||(r.iterationDuration=e)}else o=ss(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},rs=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),ns=(t,e,s,i)=>{let r=p/D.defaults.frameRate;if(!1!==i){const t=i||Lt._hasChildren&&Lt;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},os=t=>(...e)=>{const s=t(...e);return new Proxy(y,{apply:(t,e,[i])=>s(i),get:(t,e)=>os(((...t)=>{const i=as[e](...t);return t=>i(s(t))}))})},hs=(t,e=0)=>(...s)=>(s.length<t.length?os(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),as={$:Ot,get:ts,set:es,remove:is,cleanInlineStyles:Ce,random:pt,randomPick:t=>t[pt(0,t.length-1)],shuffle:mt,lerp:ns,sync:Ke,keepTime:wt,clamp:hs(at),round:hs(ct),snap:hs(dt),wrap:hs(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:hs(ut,1),mapRange:hs(rs),roundPad:hs(((t,e)=>(+t).toFixed(e))),padStart:hs(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:hs(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:hs((t=>t*ot/180)),radToDeg:hs((t=>180*t/ot))},ls=(t,e)=>{let s=t.iterationDuration;if(s===d&&(s=0),X(e))return s;if(R(+e))return+e;const i=e,r=t?t.labels:null,n=!z(r),o=((t,e)=>{if(F(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),h=!X(o),a=E.exec(i);if(a){const t=a[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=h?o:n?l:s,d=+e[1];return qt(c,d,t[0])}return h?o:n?X(r[i])?s:r[i]:s};function cs(t,e,s,i,r,n){const o=R(t.duration)&&t.duration<=d?s-d:s;kt(e,o,1,1,1);const h=i?new Me(i,t,e,o,!1,r,n):new oe(t,e,o);return h.init(1),Tt(e,h),vt(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return ft((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||d}(e),e}class ds extends oe{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=D.defaults;this.defaults=e?yt(e,s):s,this.onRender=t.onRender||s.onRender;const i=zt(t.playbackEase,s.playbackEase);this._ease=i?Te(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(I(s)){const e=s,r=Ft(t),n=this.duration,o=this.iterationDuration,h=i.id;let a=0;const l=r.length;r.forEach((t=>{const s={...i};this.duration=n,this.iterationDuration=o,X(h)||(s.id=h+"-"+a),cs(s,this,e(t,a,l,this),t,a,l),a++}))}else cs(i,this,ls(this,s),t)}else cs(t,this,ls(this,e));return this.init(1)}}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,ease:"linear"},e)}set(t,e,s){return X(e)?this:(e.duration=d,e.composition=r.replace,this.add(t,e,s))}call(t,e){return X(t)||t&&!I(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return X(t)||t&&!Y(t)||(this.labels[t]=ls(this,e)),this}remove(t,e){return is(t,this,e),this}stretch(t){const e=this.duration;if(e===gt(t))return this;const s=t/e,i=this.labels;vt(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return vt(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),vt(this,(t=>t.revert),!0),Ce(this)}then(t){return super.then(t)}}class us{constructor(t,e){L.current&&L.current.register(this);const s={},i={};if(this.targets=[],this.animations={},!X(t)&&!X(e)){for(let t in e){const r=e[t];q(t)?i[t]=r:s[t]=r}for(let e in i){const n=i[e],o=M(n);let h={},a="+=0";if(o){const t=n.unit;Y(t)&&(a+=t)}else h.duration=n;h[e]=o?yt({to:a},n):a;const l=yt(s,h);l.composition=r.replace,l.autoplay=!1;const c=this.animations[e]=new Me(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(X(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return vt(c,(e=>{if(P(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=Te(s)),e._currentTime=0})),X(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=y,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}class ps{constructor(t={}){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.m=at(zt(t.mass,1),0,p),this.s=at(zt(t.stiffness,100),1,p),this.d=at(zt(t.damping,10),.1,p),this.v=at(zt(t.velocity,0),-1e3,p),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?tt(-n*e*s)*(1*J(i*n)+r*Z(i*n)):(1+r*n)*tt(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:h}=this,a=this.w0=at(G(o/r),d,p),l=this.zeta=n/(2*G(o*r)),c=this.wd=l<1?a*G(1-l*l):0;this.b=l<1?(l*a-h)/c:-h+a;let u=0,m=0,f=0;for(;m<t&&f<e;)K(1-this.solve(u))<s?m++:m=0,this.solverDuration=u,u+=i,f++;this.duration=ct(this.solverDuration*p,0)*D.timeScale}get mass(){return this.m}set mass(t){this.m=at(zt(t,1),0,p),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=at(zt(t,100),1,p),this.compute()}get damping(){return this.d}set damping(t){this.d=at(zt(t,10),.1,p),this.compute()}get velocity(){return this.v}set velocity(t){this.v=at(zt(t,0),-1e3,p),this.compute()}}const ms=t=>new ps(t),fs=t=>{t.cancelable&&t.preventDefault()};class gs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:y,remove:y}}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,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 ys=(t,e)=>t&&I(t)?t(e):t;let vs=0;class bs{constructor(t,e={}){if(!t)return;L.current&&L.current.register(this);const r=e.x,n=e.y,o=e.trigger,h=e.modifier,a=e.releaseEase,l=a&&Te(a),c=!X(a)&&!X(a.ease),d=M(r)&&!X(r.mapTo)?r.mapTo:"translateX",p=M(n)&&!X(n.mapTo)?n.mapTo:"translateY",m=ys(e.container,this);this.containerArray=P(m)?m:null,this.$container=m&&!this.containerArray?Ft(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=M(t)?new gs(t):Ft(t)[0],this.$trigger=Ft(o||t)[0],this.fixed="fixed"===ts(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?a:ms({mass:zt(e.releaseMass,1),stiffness:zt(e.releaseStiffness,80),damping:zt(e.releaseDamping,20)}),this.releaseYSpring=c?a:ms({mass:zt(e.releaseMass,1),stiffness:zt(e.releaseStiffness,80),damping:zt(e.releaseDamping,20)}),this.releaseEase=l||ve.outQuint,this.hasReleaseSpring=c,this.onGrab=e.onGrab||y,this.onDrag=e.onDrag||y,this.onRelease=e.onRelease||y,this.onUpdate=e.onUpdate||y,this.onSettle=e.onSettle||y,this.onSnap=e.onSnap||y,this.onResize=e.onResize||y,this.onAfterResize=e.onAfterResize||y,this.disabled=[0,0];const f={};if(h&&(f.modifier=h),X(r)||!0===r)f[d]=0;else if(M(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[d]=e}else!1===r&&(f[d]=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 us(this.$target,f),this.xProp=d,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=[-1e12,u,u,-1e12],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=O(),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.overshootXTicker=new oe({autoplay:!1},null,0).init(),this.overshootYTicker=new oe({autoplay:!1},null,0).init(),this.updateTicker=new oe({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),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]?d:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=nt(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 oe({autoplay:!1,duration:150*D.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=O(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,h=this.minVelocity,a=this.maxVelocity,l=this.velocityStackIndex;n[l]=ct(at(G(t*t+e*e)/r*o,h,a),5);const c=rt(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=ct(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=dt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=ct(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=dt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return ct(this.animate[this.xProp](),D.precision)}set x(t){this.setX(t,!1)}get y(){return ct(this.animate[this.yProp](),D.precision)}set y(t){this.setY(t,!1)}get progressX(){return rs(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(rs(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return rs(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(rs(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=ct(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=ct(this.useWin?s.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,h=this.scrollThreshold;this.scroll.x=t,this.scroll.y=e,this.scrollBounds[0]=e-this.targetBounds[0]+i-h,this.scrollBounds[1]=t-this.targetBounds[1]-r+h,this.scrollBounds[2]=e-this.targetBounds[2]-n+h,this.scrollBounds[3]=t-this.targetBounds[3]+o-h}updateBoundingValues(){const t=this.$container,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 h=this.window[0]=s.innerWidth,a=this.window[1]=s.innerHeight,l=this.useWin,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?at(c,h,c):c,this.scrollView[1]=l?at(d,a,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:T,right:w,bottom:S}=t.getBoundingClientRect();this.dragArea[2]=ct(l?at(y,h,h):y,0),this.dragArea[3]=ct(l?at(v,a,a):v,0);const x=ts(t,"overflow"),k="visible"===x,$="hidden"===x;if(this.canScroll=!u&&this.contained&&(t===i.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!P(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,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=ct(r.top+s-(l?0:T),0),this.targetBounds[1]=ct(r.right+e-(l?h:w),0),this.targetBounds[2]=ct(r.bottom+s-(l?a:S),0),this.targetBounds[3]=ct(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]+_):(this.containerBounds[0]=-ct(r.top-(u?at(T,0,a):T)+o-m,0),this.containerBounds[1]=-ct(r.right-(u?at(w,0,h):w)-c+f,0),this.containerBounds[2]=-ct(r.bottom-(u?at(S,0,a):S)-d+g,0),this.containerBounds[3]=-ct(r.left-(u?at(b,0,h):b)+n-_,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,[h,a]=this.disabled,l=!h&&e<o||!h&&e>r,c=!a&&s<i||!a&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=ys(t.container,this),o=ys(t.containerPadding,this)||0,h=P(o)?o:[o,o,o,o],a=this.x,l=this.y,c=ys(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=P(n)?n:null,this.$container=n&&!this.containerArray?Ft(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=zt(h,[0,0,0,0]),this.containerFriction=at(zt(ys(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=at(zt(ys(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=ys(M(e)&&!X(e.snap)?e.snap:t.snap,this),this.snapY=ys(M(r)&&!X(r.snap)?r.snap:t.snap,this),this.scrollSpeed=zt(ys(t.scrollSpeed,this),1.5),this.scrollThreshold=zt(ys(t.scrollThreshold,this),20),this.dragSpeed=zt(ys(t.dragSpeed,this),1),this.minVelocity=zt(ys(t.minVelocity,this),0),this.maxVelocity=zt(ys(t.maxVelocity,this),50),this.velocityMultiplier=zt(ys(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(at(a,f,p),!0),this.setY(at(l,u,m),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],h=this.dragArea[3],a=this.scroll.x,l=this.scroll.y,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?at(c,this.window[0],c):c,p=this.useWin?at(d,this.window[1],d):d,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,_=this.scrollThreshold,[y,v]=this.coords,[b,T,w,S]=this.scrollBounds,x=ct(at((v-b+t)/_,-1,0)*g,0),k=ct(at((y-T-e)/_,0,1)*g,0),$=ct(at((v-w-s)/_,0,1)*g,0),C=ct(at((y-S+i)/_,-1,0)*g,0);if(x||$||C||k){const[t,e]=this.disabled;let s=a,i=l;t||(s=ct(at(a+(C||k),0,r-o),0),this.coords[0]-=a-s),e||(i=ct(at(l+(x||$),0,n-h),0),this.coords[1]-=l-i),this.useWin?this.$scrollContainer.scrollBy(-(a-s),-(l-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,h,a,l]=this.pointer;this.coords[0]+=(r-a)*this.dragSpeed,this.coords[1]+=(n-l)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-a,n-l),this.angle=nt(n-h,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return is(this,null,"x"),is(this,null,"y"),is(this,null,"progressX"),is(this,null,"progressY"),is(this.scroll),is(this.overshootCoords),this}scrollInView(t,e=0,s=ve.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,h=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[a,l,c,d]=o,p=ct(at(r-a,-1e12,0),0),m=ct(at(i-l,0,u),0),f=ct(at(r-c,0,u),0),g=ct(at(i-d,-1e12,0),0);new Me(n,{x:ct(n.x+(g?g-e:m?m+e:0),0),y:ct(n.y+(p?p-e:f?f+e:0),0),duration:X(t)?350*D.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then((()=>{this.canScroll=h}))}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=es(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=ve.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,h,a]=this.containerPadding,l=this.scroll.y-this.targetBounds[0]+n+e,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-h-e,u=this.scroll.x-this.targetBounds[3]+a+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=at(dt(i,this.snapX),u,c),h=at(dt(r,this.snapY),l,d),a=X(t)?350*D.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,a,s),n||2!==p&&3!==p||this.animate[this.yProp](h,a,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:h}=this.transforms.normalizePoint(r,n),[a,l,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/u:m<a?a+(m-a)/u:m:m,this.pointer[0]=o,this.pointer[1]=h,this.pointer[2]=o,this.pointer[3]=h,this.pointer[4]=o,this.pointer[5]=h,this.pointer[6]=o,this.pointer[7]=h,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=ts(this.$target,"zIndex",!1);vs=(f>vs?f:vs)+1,this.targetStyles=es(this.$target,{zIndex:vs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=es(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,ve.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],h=n-this.pointer[7];let a=t.target,l=!1,c=!1,d=!1;for(;e&&a&&a!==this.$trigger;){const t=ts(a,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=a;if(e>s){d=!0,l=t<=3,c=t>=e-s-3;break}}a=a.parentNode}d&&(!l&&!c||l&&h<0||c&&h>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):(fs(t),this.triggerStyles||(this.triggerStyles=es(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",fs,{passive:!1}),this.$trigger.addEventListener("touchmove",fs,{passive:!1}),this.$trigger.addEventListener("touchend",fs),(!this.disabled[0]&&K(o)>3||!this.disabled[1]&&K(h)>3)&&(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,h,a,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,_=this.releaseYSpring,y=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,w=this.y,S=this.computeVelocity(s-a,n-l),x=this.angle=nt(n-h,s-o),k=150*S,$=(1-this.releaseContainerFriction)*this.dragSpeed,C=T+J(x)*k,E=w+Z(x)*k,B=C>d?d+(C-d)*$:C<p?p+(C-p)*$:C,L=E>u?u+(E-u)*$:E<c?c+(E-c)*$:E,A=this.destX=at(ct(dt(B,this.snapX),5),p,d),N=this.destY=at(ct(dt(L,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,C,E);let O=0,P=0,M=y,R=y,Y=0;if(b.x=T,b.y=w,!t){const t=A===d?T>d?-1:1:T<p?-1:1,s=ct(T-A,0);g.velocity=e&&v?s?k*t/K(s):0:S;const{ease:i,duration:r,restDuration:n}=g;O=T===A?0:v?r:r-n*D.timeScale,v&&(M=i),O>Y&&(Y=O)}if(!e){const e=N===u?w>u?-1:1:w<c?-1:1,s=ct(w-N,0);_.velocity=t&&v?s?k*e/K(s):0:S;const{ease:i,duration:r,restDuration:n}=_;P=w===N?0:v?r:r-n*D.timeScale,v&&(R=i),P>Y&&(Y=P)}if(!v&&F&&$&&(O||P)){const t=r.blend;new Me(b,{x:{to:B,duration:.65*O},y:{to:L,duration:.65*P},ease:y,composition:t}).init(),new Me(b,{x:{to:A,duration:O},y:{to:N,duration:P},ease:y,composition:t}).init(),this.overshootXTicker.stretch(O).restart(),this.overshootYTicker.stretch(P).restart()}else t||this.animate[this.xProp](A,O,M),e||this.animate[this.yProp](N,P,R);this.scrollInView(Y,this.scrollThreshold,y);let I=!1;A!==m&&(this.snapped[0]=A,this.snapX&&(I=!0)),N!==f&&this.snapY&&(this.snapped[1]=N,this.snapY&&(I=!0)),I&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",fs),this.$trigger.removeEventListener("touchmove",fs),this.$trigger.removeEventListener("touchend",fs),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=es(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":fs(t)}}}class Ts{constructor(t={}){L.current&&L.current.register(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||Ft(e)[0]||i);const n=t.defaults,o=D.defaults,h=t.mediaQueries;if(this.defaults=n?yt(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={},h)for(let t in h){const e=s.matchMedia(h[t]);this.mediaQueryLists[t]=e,e.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=L.current,s=L.root,i=D.defaults;L.current=this,L.root=this.root,D.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return L.current=e,L.root=s,D.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);I(e)&&this.revertConstructors.push(e)}))})),this}add(t,e){if(this.once=!1,I(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);I(t)&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}addOnce(t){if(this.once=!0,I(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute((()=>{const t=s(this);I(t)&&this.revertConstructorsOnce.push(t)}))}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(I(s))return s(this);const i=wt(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,h=s.length,a=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;h--;)s[h].revert();for(;a--;)i[a](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 ws=(t,e)=>t&&I(t)?t(e):t,Ss=new Map;class xs{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.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 oe({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;vt(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new oe({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,h=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),h&&(this.backwardY=i>n),this.velocity=ct(e>0?Math.sqrt(o*o+h*h)/e:0,5)}}).init(),this.resizeTicker=new oe({autoplay:!1,duration:250*D.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new oe({autoplay:!1,duration:500*D.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=ct(t?s.scrollX:e.scrollLeft,0),this.scrollY=ct(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=document.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){vt(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),vt(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.unobserve(this.element),(this.useWin?s:this.element).removeEventListener("scroll",this),Ss.delete(this.element)}}const ks=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,h="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:a,u:l}=Qt(h,Gt);let c=a;return"%"===l?c=a/100*s:l&&(c=$e(t,Gt,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},$s=(t,e,s,i,r)=>{let n;if(Y(e)){const o=E.exec(e);if(o){const h=o[0],a=h[0],l=e.split(h),c="min"===l[0],d="max"===l[0],u=ks(t,l[0],s,i,r),p=ks(t,l[1],s,i,r);if(c){const e=qt(ks(t,"min",s),p,a);n=e<u?u:e}else if(d){const e=qt(ks(t,"max",s),p,a);n=e>u?u:e}else n=qt(u,p,a)}else n=ks(t,e,s,i,r)}else n=e;return ct(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 Es=0;const Bs=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Ls{constructor(t={}){L.current&&L.current.register(this);const e=zt(t.sync,"play pause"),s=e?Te(e):null,r=e&&("linear"===e||e===he),n=e&&!(s===he&&!r),o=e&&(R(e)||!0===e||r),h=e&&Y(e)&&!n&&!o,a=h?e.split(" ").map((t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null})):null,l=h&&a.length>2;this.index=Es++,this.id=X(t.id)?this.index:t.id,this.container=(t=>{const e=t&&Ft(t)[0]||i.body;let s=Ss.get(e);return s||(s=new xs(e),Ss.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||!!a,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=a&&!l&&a[0]?a[0]:y,this.onSyncLeave=a&&!l&&a[1]?a[1]:y,this.onSyncEnterForward=a&&l&&a[0]?a[0]:y,this.onSyncLeaveForward=a&&l&&a[1]?a[1]:y,this.onSyncEnterBackward=a&&l&&a[2]?a[2]:y,this.onSyncLeaveBackward=a&&l&&a[3]?a[3]:y,this.onEnter=t.onEnter||y,this.onLeave=t.onLeave||y,this.onEnterForward=t.onEnterForward||y,this.onLeaveForward=t.onLeaveForward||y,this.onEnterBackward=t.onEnterBackward||y,this.onLeaveBackward=t.onLeaveBackward||y,this.onUpdate=t.onUpdate||y,this.onSyncComplete=t.onSyncComplete||y,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=zt(t.debug,!1),this._next=null,this._prev=null,Tt(this.container,this),Ke((()=>{if(!this.reverted){if(!this.target){const e=Ft(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;X(t.targets)?vt(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:ct(at(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=zt(ws(t.repeat,this),!0),this.horizontal="x"===zt(ws(t.axis,this),"y"),this.enter=zt(ws(t.enter,this),"end start"),this.leave=zt(ws(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"),h=Bs[this.index%Bs.length],a=t.useWin,l=a?t.winWidth:t.width,c=a?t.winHeight:t.height,d=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,_=e?g:15,y=e?60:g,v=e?y:_,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",w=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?d: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?l:g,e?g:c)}`,s||(n.style.cssText+=`background:\n ${w("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${w("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${S("relative",0,0,e?d:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${w("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${w("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const x=[" enter: "," leave: "];this.coords.forEach(((t,s)=>{const r=s>1,a=(r?0:this.offset)+t,m=s%2,f=a<v,g=a>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,T=i.createElement("div"),w=i.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?y:_)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;w.innerHTML=`${this.id}${x[m]}${this.thresholds[s]}`,T.style.cssText=`${S("absolute",0,0,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-${k}: 2px solid ${h};\n `,w.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${_};\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?h:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":h};\n border: 2px solid ${m?h:"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(w);let C=a-$+(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),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===ts(t.element,"position")&&(this.debugStyles=es(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,h=e,a=0,l=0,c=h;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===ts(s.element,"position")&&es(s.element,{position:"relative "});for(;h&&h!==s.element&&h!==i.body;){const e="sticky"===ts(h,"position")&&es(h,{position:"static"});h===c&&(a+=h.offsetLeft||0,l+=h.offsetTop||0,c=h.offsetParent),h=h.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?a:l,p=r?e.offsetWidth:e.offsetHeight,m=r?s.width:s.height,f=(r?s.scrollWidth:s.scrollHeight)-m,g=this.enter,_=this.leave;let y="start",v="end",b="end",T="start";if(Y(g)){const t=g.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(M(g)){const t=g;X(t.container)||(b=t.container),X(t.target)||(y=t.target)}else R(g)&&(b=g);if(Y(_)){const t=_.split(" ");T=t[0],v=t.length>1?t[1]:v}else if(M(_)){const t=_;X(t.container)||(T=t.container),X(t.target)||(v=t.target)}else R(_)&&(T=_);const w=$s(e,y,p),S=$s(e,v,p),x=w+u-m,k=S+u-f,$=$s(e,b,m,x,k),C=$s(e,T,m,x,k),E=w+u-$,B=S+u-C,L=B-E;this.offsets[0]=a,this.offsets[1]=l,this.offset=u,this.offsetStart=E,this.offsetEnd=B,this.distance=L<=0?0:L,this.thresholds=[y,v,b,T],this.coords=[w,S,$,C],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,h=this.scroll,a=h<=this.offsetStart,l=h>=this.offsetEnd,c=!a&&!l,d=h===this.offsetStart||h===this.offsetEnd,u=!this.hasEntered&&d,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(a&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&R(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=ct(ns(e,g,ut(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 bt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}const Ds=!X(Intl)&&Intl.Segmenter,As=/\{value\}/g,Ns=/\{i\}/g,Fs=/(\s+)/,Os=/^\s+$/,Ps="line",Ms="word",Rs="char",Ys="data-line";let Is=null,Xs=null,zs=null;const Ws=t=>t.isWordLike||" "===t.segment||R(+t.segment),Vs=t=>t.setAttribute("aria-hidden","true"),Hs=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Us={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},qs=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&qs(e)}},Qs=(t,e,s)=>{const i=t.getAttribute(Ys);(null!==i&&+i!==e||"BR"===t.tagName)&&s.add(t);let r=t.childElementCount;for(;r--;)Qs(t.children[r],e,s);return s},js=(t,e={})=>{let s="";const i=Y(e.class)?` class="${e.class}"`:"",r=zt(e.clone,!1),n=zt(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},Gs=(t,e,s,i,r,n,o,h,a)=>{const l=r===Ps,c=r===Rs,d=`_${r}_`,u=I(t)?t(s):t,p=l?"block":"inline-block";zs.innerHTML=u.replace(As,`<i class="${d}"></i>`).replace(Ns,`${c?a:l?o:h}`);const m=zs.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,_=m.querySelectorAll(`i.${d}`),y=_.length;if(y){f.style.display=p,g.style.display=p,g.setAttribute(Ys,`${o}`),l||(g.setAttribute("data-word",`${h}`),c&&g.setAttribute("data-char",`${a}`));let t=y;for(;t--;){const e=_[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 ${Us[r]}`),f};class Zs{constructor(t,s={}){Is||(Is=Ds?new Ds([],{granularity:Ms}):{segment:t=>{const e=[],s=t.split(Fs);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Os.test(i)})}return e}}),Xs||(Xs=Ds?new Ds([],{granularity:"grapheme"}):{segment:t=>[...t].map((t=>({segment:t})))}),!zs&&e&&(zs=i.createElement("template")),L.current&&L.current.register(this);const{words:r,chars:n,lines:o,accessible:h,includeSpaces:a,debug:l}=s,c=(t=P(t)?t[0]:t)&&t.nodeType?t:(Nt(t)||[])[0],d=!0===o?{}:o,u=!0===r||X(r)?{}:r,p=!0===n?{}:n;this.debug=zt(l,!1),this.includeSpaces=zt(a,!1),this.accessible=zt(h,!0),this.linesOnly=d&&!u&&!p,this.lineTemplate=M(d)?js(Ps,d):d,this.wordTemplate=M(u)||this.linesOnly?js(Ms,u):u,this.charTemplate=M(p)?js(Rs,p):p,this.$target=c,this.html=c&&c.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&&(d||u||p)&&this.split();this.resizeObserver=new ResizeObserver((()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((()=>{const t=c.offsetWidth;t!==this.width&&(this.width=t,m())}),150)})),this.lineTemplate&&!this.ready?i.fonts.ready.then(m):m(),c?this.resizeObserver.observe(c):console.warn("No Text Splitter target found.")}addEffect(t){if(!I(t))return console.warn("Effect must return a function.");const e=wt(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=>I(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 h=[],a=this.words,l=this.chars,c=Is.segment(o),d=i.createDocumentFragment();let u=null;for(const t of c){const e=t.segment,s=Ws(t);if(!u||s&&u&&Ws(u))h.push(e);else{const t=h.length-1;h[t].includes(" ")||e.includes(" ")?h.push(e):h[t]+=e}u=t}for(let t=0,o=h.length;t<o;t++){const o=h[t];if(o.trim()){const c=h[t+1],u=r&&c&&!c.trim(),p=o,m=s?Xs.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],h=e===r-1&&u?o.segment+" ":o.segment,c=i.createTextNode(h);Gs(s,l,c,f,Rs,n,-1,a.length,l.length)}}e?Gs(e,a,f,d,Ms,n,-1,a.length,l.length):s?d.appendChild(f):d.appendChild(i.createTextNode(o)),u&&t++}else{if(t&&r)continue;d.appendChild(i.createTextNode(o))}}t.parentNode.replaceChild(d,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,h="loading"!==i.fonts.status,a=r&&h;this.ready=!r||h,s||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),a&&(this.effectsCleanups.forEach((t=>I(t)&&t(this))),s&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Hs(e,Ms))),o&&(a||n)&&(this.chars=Hs(e,Rs));const l=this.words.length?this.words:this.chars;let c,d=0;for(let t=0,e=l.length;t<e;t++){const e=l[t],{top:s,height:i}=e.getBoundingClientRect();c&&s-c>.5*i&&d++,e.setAttribute(Ys,`${d}`);const r=e.querySelectorAll(`[${Ys}]`);let n=r.length;for(;n--;)r[n].setAttribute(Ys,`${d}`);c=s}if(a){const t=i.createDocumentFragment(),s=new Set,h=[];for(let t=0;t<d+1;t++){const i=e.cloneNode(!0);Qs(i,t,new Set).forEach((t=>{const e=t.parentElement;e&&s.add(e),t.remove()})),h.push(i)}s.forEach(qs);for(let e=0,s=h.length;e<s;e++)Gs(r,this.lines,h[e],t,Ps,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Hs(e,Ms)),o&&(this.chars=Hs(e,Rs))}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((a||t)&&this.effects.forEach(((t,e)=>this.effectsCleanups[e]=t(this))),this.accessible&&(a||!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(Vs),this.words.forEach(Vs),this.chars.forEach(Vs)}return this.width=e.offsetWidth,this}refresh(){this.split(!0)}}const Js={split:(t,e)=>new Zs(t,e)};return t.Animatable=us,t.Draggable=bs,t.JSAnimation=Me,t.Scope=Ts,t.ScrollObserver=Ls,t.Spring=ps,t.TextSplitter=Zs,t.Timeline=ds,t.Timer=oe,t.WAAPIAnimation=Ze,t.animate=(t,e)=>new Me(t,e,null,0,!1).init(),t.createAnimatable=(t,e)=>new us(t,e),t.createDraggable=(t,e)=>new bs(t,e),t.createScope=t=>new Ts(t),t.createSpring=ms,t.createTimeline=t=>new ds(t).init(),t.createTimer=t=>new oe(t,null,0).init(),t.eases=ve,t.engine=Lt,t.onScroll=(t={})=>new Ls(t),t.scrollContainers=Ss,t.stagger=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,h=!X(o),a=h&&!X(o.ease)?o.ease:h?Te(o):null,l=e.grid,c=e.axis,d=e.total,u=X(r)||0===r||"first"===r,p="center"===r,f="last"===r,g="random"===r,_=P(t),y=e.use,v=Q(_?t[0]:t),b=_?Q(t[1]):0,T=k.exec((_?t[1]:t)+m),w=e.start||0+(_?v:0);let S=u?0:R(r)?r:0;return(t,r,o,h)=>{const[u]=Ot(t),m=X(d)?o:d,x=!X(y)&&(I(y)?y(u,r,m):Ut(u,y)),k=R(x)||Y(x)&&R(+x)?+x:r;if(p&&(S=(m-1)/2),f&&(S=m-1),!s.length){for(let t=0;t<m;t++){if(l){const e=p?(l[0]-1)/2:S%l[0],i=p?(l[1]-1)/2:st(S/l[0]),r=e-t%l[0],n=i-st(t/l[0]);let o=G(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(K(S-t));i=rt(...s)}a&&(s=s.map((t=>a(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:K(i-t)))),g&&(s=mt(s))}const $=_?(b-v)/i:v;let C=(h?ls(h,X(e.start)?h.iterationDuration:w):w)+($*ct(s[k],2)||0);return e.modifier&&(C=e.modifier(C)),T&&(C=`${C}${T[2]}`),C}},t.svg=It,t.text=Js,t.utils=as,t.waapi=Je,t}({});
diff --git a/lib/anime.min.cjs b/lib/anime.min.cjs
index ae1bd870..543f9cd1 100644
--- a/lib/anime.min.cjs
+++ b/lib/anime.min.cjs
@@ -1,9 +1,9 @@
/**
* anime.js - CJS
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
-"use strict";const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={replace:0,none:1,blend:2},r=Symbol(),n=Symbol(),o=Symbol(),a=Symbol(),h=Symbol(),l=Symbol(),c=1e-11,d=1e12,u=1e3,p="",m=new Map;m.set("x","translateX"),m.set("y","translateY"),m.set("z","translateZ");const f=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],g=f.reduce(((t,e)=>({...t,[e]:e+"("})),{}),_=()=>{},y=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,v=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,b=/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,S=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,T=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,w=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,k=/([a-z])([A-Z])/g,$=/(\w+)(\([^)]+\)+)/g,E=/(\*=|\+=|-=)/,C={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:u,delay:0,loopDelay:0,ease:"out(2)",composition:i.replace,modifier:t=>t,onBegin:_,onBeforeUpdate:_,onUpdate:_,onLoop:_,onPause:_,onComplete:_,onRender:_},B={defaults:C,root:s,scope:null,precision:4,timeScale:1,tickThreshold:200},D={version:"4.0.2",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(D));const L=t=>t.replace(k,"$1-$2").toLowerCase(),A=(t,e)=>0===t.indexOf(e),N=Date.now,F=Array.isArray,P=t=>t&&t.constructor===Object,R=t=>"number"==typeof t&&!isNaN(t),Y=t=>"string"==typeof t,X=t=>"function"==typeof t,M=t=>void 0===t,O=t=>M(t)||null===t,z=e=>t&&e instanceof SVGElement,I=t=>y.test(t),W=t=>A(t,"rgb"),V=t=>A(t,"hsl"),U=t=>!B.defaults.hasOwnProperty(t),H=t=>Y(t)?parseFloat(t):t,q=Math.pow,Q=Math.sqrt,j=Math.sin,G=Math.cos,Z=Math.abs,J=Math.exp,K=Math.ceil,tt=Math.floor,et=Math.asin,st=Math.max,it=Math.atan2,rt=Math.PI,nt=Math.round,ot=(t,e,s)=>t<e?e:t>s?s:t,at={},ht=(t,e)=>{if(e<0)return t;if(!e)return nt(t);let s=at[e];return s||(s=at[e]=10**e),nt(t*s)/s},lt=(t,e)=>F(e)?e.reduce(((e,s)=>Z(s-t)<Z(e-t)?s:e)):e?nt(t/e)*e:t,ct=(t,e,s)=>t+(e-t)*s,dt=t=>t===1/0?d:t===-1/0?-1e12:t,ut=t=>t<=c?c:dt(ht(t,11)),pt=t=>F(t)?[...t]:t,mt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=M(r)?e[i]:r}return s},ft=(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}},gt=(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},_t=(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};class yt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=ht(u/120,0),this._fps=120,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=ht(u/i,0);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,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const vt=(t,e,s,r,n)=>{const o=t.parent,h=t.duration,l=t.completed,d=t.iterationDuration,u=t.iterationCount,m=t._currentIteration,f=t._loopDelay,_=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,x=t._currentTime,S=b+d,T=e-b,w=ot(x,-b,h),k=ot(T,-b,h),$=T-x,E=k>0,C=k>=h,D=h<=c,L=2===n;let A=0,N=T,F=0;if(u>1){const e=~~(k/(d+(C?0:f)));t._currentIteration=ot(e,0,u),C&&t._currentIteration--,A=t._currentIteration%2,N=k%(d+f)||0}const P=_^(y&&A),R=t._ease;let Y=C?P?0:h:P?d-N:N;R&&(Y=d*R(Y/d)||0);const X=(o?o.backwards:T<x)?!P:!!P;if(t._currentTime=T,t._iterationTime=Y,t.backwards=X,E&&!t.began?(t.began=!0,s||o&&(X||!o.began)||t.onBegin(t)):T<=0&&(t.began=!1),s||v||!E||t._currentIteration===m||t.onLoop(t),L||1===n&&(e>=b&&e<=S||e<=b&&w>b||e>=S&&w!==h)||Y>=S&&w!==h||Y<=b&&w>0||e<=w&&w===h&&l||C&&!l&&D){if(E&&(t.computeDeltaTime(w),s||t.onBeforeUpdate(t)),!v){const e=L||(X?-1*$:$)>=B.tickThreshold,n=t._offset+(o?o._offset:0)+b+Y;let h,l,c,d,u=t._head,m=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,_=u._nextRep,y=u._prevRep,v=t!==i.none;if((e||(s!==o||n<=f+(_?_._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!_||_._isOverridden||n<=_._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=ot(Y-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,p=u._valueType,f=u._tweenType,g=0===f,_=0===p,y=_&&g||0===s||1===s?-1:B.precision;let b,x;if(_)b=x=n(ht(ct(u._fromNumber,u._toNumber,s),y));else if(1===p)x=n(ht(ct(u._fromNumber,u._toNumber,s),y)),b=`${x}${u._unit}`;else if(2===p){const t=u._fromNumbers,e=u._toNumbers,i=ht(ot(n(ct(t[0],e[0],s)),0,255),0),r=ht(ot(n(ct(t[1],e[1],s)),0,255),0),o=ht(ot(n(ct(t[2],e[2],s)),0,255),0),a=ot(n(ht(ct(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${a})`,v){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=a}}else if(3===p){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(ht(ct(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=x),r||t===i.blend)u._value=b;else{const t=u.property;h=u.target,g?h[t]=b:1===f?h.setAttribute(t,b):(l=h.style,3===f?(h!==c&&(c=h,d=h[a]),d[t]=b,m=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),E&&(F=1)}}if(m&&u._renderTransforms){let t=p;for(let e in d)t+=`${g[e]}${d[e]}) `;l.transform=t,m=0}u=u._next}!s&&F&&t.onRender(t)}!s&&E&&t.onUpdate(t)}return o&&D?!s&&(o.began&&!X&&T>=h&&!l||X&&T<=c&&l)&&(t.onComplete(t),t.completed=!X):E&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(X||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},bt=(t,e,s,i,r)=>{const n=t._currentIteration;if(vt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,h=i?e:o._iterationTime,l=N();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;ft(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&&vt(e,t,s,1,2),e.began=!1,e.completed=!1})),s||o.onLoop(o)}ft(o,(t=>{const e=ht((h-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;d+=vt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),a),!s&&d&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},xt={animation:null,update:_},St=t?requestAnimationFrame:setImmediate,Tt=t?cancelAnimationFrame:clearImmediate;class wt extends yt{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=C,this.paused=!(!t||!s.hidden),this.reqId=null}update(){const t=this._currentTime=N();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?(gt(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}xt.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=St($t)),this}pause(){return this.paused=!0,Et()}resume(){if(this.paused)return this.paused=!1,ft(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===B.timeScale?1:u)}set speed(t){this._speed=t*B.timeScale,ft(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:u;this.defaults.duration*=t,this._speed*=t}}get precision(){return B.precision}set precision(t){B.precision=t}}const kt=(()=>{const e=new wt(N());return t&&(D.engine=e,s.addEventListener("visibilitychange",(()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())}))),e})(),$t=()=>{kt._head?(kt.reqId=St($t),kt.update()):kt.reqId=0},Et=()=>(Tt(kt.reqId),kt.reqId=0,kt);function Ct(t){const e=Y(t)?B.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Bt(e){if(O(e))return[];if(F(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!O(i)){const t=Ct(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!O(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}if(!t)return[e];const s=Ct(e);return s?Array.from(s):[e]}function Dt(t){const e=Bt(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[r]){s[r]=!0;const t=z(s);(s.nodeType||t)&&(s[n]=!0,s[o]=t,s[a]={})}}return e}const Lt=t=>{const e=Bt(t)[0];if(e&&z(e))return e},At=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),Nt=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[o],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=At(t,s,-1),i=At(t,s,1);return 180*it(i.y-e.y,i.x-e.x)/rt}{const i=At(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Ft=["opacity","rotate","overflow","color"],Pt={morphTo:(t,e=.33)=>s=>{const i=Lt(t);if(!i)return;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 c=e/(h-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";a+=p+ht(d.x,3)+n+d.y+" ",l+=p+ht(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]},createMotionPath:t=>{const e=Lt(t);if(e)return{translateX:Nt(e,"x"),translateY:Nt(e,"y"),rotate:Nt(e,"a")}},createDrawable:(t,e=0,s=0)=>Bt(t).map((t=>((t,e,s)=>{const i=u,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===l?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],h=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(Q(s.a*s.a+s.b*s.b)+Q(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=h*i*l+c,u=i*l+(0===r&&1===h||1===r&&0===h?0:10*l)-d;if("butt"!==n){const e=r===h?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:X(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),h.setAttribute("draw",`${e} ${s}`)),h})(t,e,s)))},Rt=(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),Yt=(t,e)=>M(t)?e:t,Xt=(t,e,s,i,r)=>{if(X(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Mt=(t,e)=>t[n]?t[o]&&((t,e)=>{if(Ft.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:f.includes(e)||m.get(e)?3:A(e,"--")?4:e in t.style?2:e in t?0:1:0,Ot=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[l]||t).getPropertyValue(e);return"auto"===r?"0":r},zt=(t,e,s,i)=>{const r=M(s)?Mt(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[a];let o;for(;o=$.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&&!M(r)?r:A(e,"scale")?"1":A(e,"rotate")||A(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Ot(t,e,i).trimStart():Ot(t,e,i)},It=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Wt=(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(" ")&&w.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(I(r=s)||W(r)||V(r))return e.t=2,e.d=W(i=s)?(t=>{const e=v.exec(t)||b.exec(t),s=M(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):I(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):V(i)?(t=>{const e=x.exec(t)||S.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=M(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=ht(255*Rt(e,t,s+1/3),0),a=ht(255*Rt(e,t,s),0),h=ht(255*Rt(e,t,s-1/3),0)}return[o,a,h,n]})(i):[0,0,0,1],e;{const t=s.match(T);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(T)||[],e}}var i,r;return e.n=s,e},Vt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=pt(t._toNumbers),e.s=pt(t._strings),e),Ut={t:0,n:0,u:null,o:null,d:null,s:null},Ht={_rep:new WeakMap,_add:new Map},qt=(t,e,s="_rep")=>{const i=Ht[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Qt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,jt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},Gt=(t,e)=>{const s=t._composition;if(s===i.replace){const s=t._absoluteStartTime;_t(e,t,Qt,"_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){jt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)jt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<c&&jt(i)}let o=!0;if(ft(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;ft(t,(t=>{t!==e&&ft(t,(t=>{t._isOverlapped||(s=!1)}))})),s&&t.cancel()}else e.cancel()}}}else if(s===i.blend){const e=qt(t.target,t.property,"_add"),s=(t=>{let e=xt.animation;return e||(e={duration:c,computeDeltaTime:_,_offset:0,_delay:0,_head:null,_tail:null},xt.animation=e,xt.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?pt(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}}})),vt(e,1,1,0,2)}),e})(Ht._add);let r=e._head;r||(r={...t},r._composition=i.replace,r._updateDuration=c,r._startTime=0,r._numbers=pt(t._fromNumbers),r._number=0,r._next=null,r._prev=null,_t(e,r),_t(s,r));const n=t._toNumber;if(t._fromNumber=r._fromNumber-n,t._toNumber=0,t._numbers=pt(t._fromNumbers),t._number=0,r._fromNumber=n,t._toNumbers){const e=pt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=r._fromNumbers[s]-e,t._toNumbers[s]=0})),r._fromNumbers=e}_t(e,t,null,"_prevAdd","_nextAdd")}return t},Zt=t=>{const e=t._composition;if(e!==i.none){const s=t.target,r=t.property,n=Ht._rep.get(s)[r];if(gt(n,t,"_prevRep","_nextRep"),e===i.blend){const e=Ht._add,i=e.get(s);if(!i)return;const n=i[r],o=xt.animation;gt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){gt(n,a,"_prevAdd","_nextAdd"),gt(o,a);let t=!0;for(let e in i)if(i[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Jt=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),Kt=t=>t._cancelled?(t._hasChildren?ft(t,Kt):ft(t,(t=>{t._composition!==i.none&&Gt(t,qt(t.target,t.property))})),t._cancelled=0,t):t;let te=0;class ee extends yt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:h,loopDelay:l,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:b}=t;B.scope&&B.scope.revertibles.push(this);const x=e?0:kt._elapsedTime,S=e?e.defaults:B.defaults,T=X(r)||M(r)?S.delay:+r,w=X(n)||M(n)?1/0:+n,k=Yt(h,S.loop),$=Yt(l,S.loopDelay),E=!0===k||k===1/0||k<0?1/0:k+1;let C=0;if(e)C=s;else{let t=N();kt.paused&&(kt.requestTick(t),t=kt._elapsedTime),C=t-kt._startTime}this.id=M(i)?++te:i,this.parent=e,this.duration=dt((w+$)*E-$)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||S.onBegin,this.onBeforeUpdate=v||S.onBeforeUpdate,this.onUpdate=b||S.onUpdate,this.onLoop=f||S.onLoop,this.onPause=g||S.onPause,this.onComplete=m||S.onComplete,this.iterationDuration=w,this.iterationCount=E,this._autoplay=!e&&Yt(d,S.autoplay),this._offset=C,this._delay=T,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=_,this._running=!1,this._reversed=+Yt(o,S.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Yt(a,S.alternate),this._prev=null,this._next=null,this._elapsedTime=x,this._startTime=x,this._lastTime=x,this._fps=Yt(u,S.frameRate),this._speed=Yt(p,S.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return ot(ht(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 ht(this._iterationTime,B.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ot(ht(this._currentTime/this.duration,5),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ot(ht(this._iterationTime/this.iterationDuration,5),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*ot(+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=0){return Kt(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,bt(this,0,1,t,2),Jt(this),this._hasChildren&&ft(this,Jt),this}init(t=0){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&&!M(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*kt._speed);return this._startTime=N()-(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||(_t(kt,this),kt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,kt.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){Kt(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?tt(d/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?ft(this,(t=>t.cancel()),!0):ft(this,Zt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=ut(t);if(e===s)return this;const i=t/e,r=t<=c;return this.duration=r?c:s,this.iterationDuration=r?c:ut(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(){return this.seek(this.duration).cancel()}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const se=t=>t,ie=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,re=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?se:r=>0===r||1===r?r:ie(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=ie(r,e,s)-t,i>0?o=r:n=r}while(Z(i)>1e-7&&++a<100);return r})(r,t,s),e,i),ne=(t=10,e)=>{const s=e?K:tt;return e=>s(ot(e,0,1)*t)*(1/t)},oe=(...t)=>{const e=t.length;if(!e)return se;const s=e-1,i=t[0],r=t[s],n=[0],o=[H(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(M(h)?e/s:H(h)/100),o.push(H(a))}return o.push(H(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]}},ae=(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(ot(o,r,1))}return s.push(1),oe(...s)},he=rt/2,le=2*rt,ce=(t=1.68)=>e=>q(e,+t),de={[p]:ce,Quad:ce(2),Cubic:ce(3),Quart:ce(4),Quint:ce(5),Sine:t=>1-G(t*he),Circ:t=>1-Q(1-t*t),Expo:t=>t?q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=q(2,--s))-1)/11;);return 1/q(4,3-s)-7.5625*q((3*e-2)/22-t,2)},Back:(t=1.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ot(+t,1,10),i=ot(+e,c,2),r=i/le*et(1/s),n=le/i;return t=>0===t||1===t?t:-s*q(2,-10*(1-t))*j((1-t-r)*n)}},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=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=ue[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:se}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):se}},me=(()=>{const t={linear:oe,irregular:ae,steps:ne,cubicBezier:re};for(let e in ue)for(let s in de){const i=de[s],r=ue[e];t[e+s]=s===p||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),fe={linear:se},ge=t=>X(t)?t:Y(t)?pe(t,me,fe):se,_e={},ye=(t,e,s)=>{if(3===s)return m.get(t)||t;if(2===s||1===s&&z(e)&&t in e.style){const e=_e[t];if(e)return e;{const e=t?L(t):t;return _e[t]=e,e}}return t},ve={deg:1,rad:180/rt,turn:360},be={},xe=(t,e,i,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===i)return e;const a=o+n+i,h=be[a];if(M(h)||r){let r;if(n in ve)r=o*ve[n]/ve[i];else{const e=100,a=t.cloneNode(),h=t.parentNode,l=h&&h!==s?h:s.body;l.appendChild(a);const c=a.style;c.width=e+n;const d=a.offsetWidth||e;c.width=e+i;const u=d/(a.offsetWidth||e);l.removeChild(a),r=u*o}e.n=r,be[a]=r}else e.n=h;return e.t,e.u=i,e},Se=t=>{if(t._hasChildren)ft(t,Se,!0);else{const e=t;e.pause(),ft(e,(t=>{const s=t.property,i=t.target;if(i[n]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[a];if(M(n)||n===p?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=p;for(let s in e)t+=g[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else M(n)||n===p?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===p&&t.removeAttribute("style")}))}}))}return t},Te={t:0,n:0,u:null,o:null,d:null,s:null},we={t:0,n:0,u:null,o:null,d:null,s:null},ke={func:null},$e=[null],Ee=[null,null],Ce={to:null};let Be,De,Le=0;class Ae extends ee{constructor(t,e,s,r,n=!1,o=0,a=0){super(e,s,r);const h=Dt(t),l=h.length,d=e.keyframes,p=d?mt(((t,e)=>{const s={};if(F(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(U);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];U(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=Yt(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(U(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 c=0;for(let t=0;t<a;t++)c+=n[t].duration;1===a&&(l.from=h.to),r.ease&&(l.ease=r.ease),l.duration=o-(a?c: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})(d,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=p,x=s?s.defaults:B.defaults,S=Yt(_,x.playbackEase),T=S?ge(S):null,w=!M(g)&&!M(g.ease),k=w?g.ease:Yt(g,T?"linear":x.ease),$=w?g.duration:Yt(f,x.duration),E=Yt(m,x.delay),C=y||x.modifier,D=M(v)&&l>=u?i.none:M(v)?x.composition:v,L={},A=this._offset+(s?s._offset:0);let N=NaN,Y=NaN,X=0,O=0;for(let t=0;t<l;t++){const e=h[t],r=o||t,d=a||l;let u=NaN,m=NaN;for(let t in p)if(U(t)){const o=Mt(e,t),a=ye(t,e,o);let h=p[t];const l=F(h);if(n&&!l&&(Ee[0]=h,Ee[1]=h,h=Ee),l){const t=h.length,e=!P(h[0]);2===t&&e?(Ce.to=h,$e[0]=Ce,Be=$e):t>2&&e?(Be=[],h.forEach(((t,e)=>{e?1===e?(Ee[1]=t,Be.push(Ee)):Be.push(t):Ee[0]=t}))):Be=h}else $e[0]=h,Be=$e;let f=null,g=null,_=NaN,y=0,v=0;for(let t=Be.length;v<t;v++){const n=Be[v];P(n)?De=n:(Ce.to=n,De=Ce),ke.func=null;const h=Xt(De.to,e,r,d,ke);let l;P(h)&&!M(h.to)?(De=h,l=h.to):l=h;const u=Xt(De.from,e,r,d),p=De.ease,m=!M(p)&&!M(p.ease),b=m?p.ease:p||k,x=m?p.duration:Xt(Yt(De.duration,t>1?Xt($,e,r,d)/t:$),e,r,d),S=Xt(Yt(De.delay,v?0:E),e,r,d),T=Xt(Yt(De.composition,D),e,r,d),w=R(T)?T:i[T],B=De.modifier||C,N=!M(u),Y=!M(l),z=F(l),I=z||N&&Y,W=g?y+S:S,V=A+W;O||!N&&!z||(O=1);let U=g;if(w!==i.none){f||(f=qt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(U=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)jt(t),t=t._nextRep}if(I?(Wt(z?Xt(l[0],e,r,d):u,Te),Wt(z?Xt(l[1],e,r,d,ke):l,we),0===Te.t&&(U?1===U._valueType&&(Te.t=1,Te.u=U._unit):(Wt(zt(e,a,o,L),Ut),1===Ut.t&&(Te.t=1,Te.u=Ut.u)))):(Y?Wt(l,we):g?Vt(g,we):Wt(s&&U&&U.parent.parent===s?U._value:zt(e,a,o,L),we),N?Wt(u,Te):g?Vt(g,Te):Wt(s&&U&&U.parent.parent===s?U._value:zt(e,a,o,L),Te)),Te.o&&(Te.n=It(U?U._toNumber:Wt(zt(e,a,o,L),Ut).n,Te.n,Te.o)),we.o&&(we.n=It(Te.n,we.n,we.o)),Te.t!==we.t)if(3===Te.t||3===we.t){const t=3===Te.t?Te:we,e=3===Te.t?we:Te;e.t=3,e.s=pt(t.s),e.d=t.d.map((()=>e.n))}else if(1===Te.t||1===we.t){const t=1===Te.t?Te:we,e=1===Te.t?we:Te;e.t=1,e.u=t.u}else if(2===Te.t||2===we.t){const t=2===Te.t?Te:we,e=2===Te.t?we:Te;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Te.u!==we.u){let t=we.u?Te:we;t=xe(e,t,we.u?we.u:Te.u,!1)}if(we.d&&Te.d&&we.d.length!==Te.d.length){const t=Te.d.length>we.d.length?Te:we,e=t===Te?we:Te;e.d=t.d.map(((t,s)=>M(e.d[s])?0:e.d[s])),e.s=pt(t.s)}const H=ht(+x||c,12),q={parent:this,id:Le++,property:a,target:e,_value:null,_func:ke.func,_ease:ge(b),_fromNumbers:pt(Te.d),_toNumbers:pt(we.d),_strings:pt(we.s),_fromNumber:Te.n,_toNumber:we.n,_numbers:pt(Te.d),_number:Te.n,_unit:we.u,_modifier:B,_currentTime:0,_startTime:W,_delay:+S,_updateDuration:H,_changeDuration:H,_absoluteStartTime:V,_tweenType:o,_valueType:we.t,_composition:w,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};w!==i.none&&Gt(q,f),isNaN(_)&&(_=q._startTime),y=ht(W+H,12),g=q,X++,_t(this,q)}(isNaN(Y)||_<Y)&&(Y=_),(isNaN(N)||y>N)&&(N=y),3===o&&(u=X-v,m=X)}if(!isNaN(u)){let t=0;ft(this,(e=>{t>=u&&t<m&&(e._renderTransforms=1,e._composition===i.blend&&ft(xt.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),Y?(ft(this,(t=>{t._startTime-t._delay||(t._delay-=Y),t._startTime-=Y})),N-=Y):Y=0,N||(N=c,this.iterationCount=0),this.targets=h,this.duration=N===c?c:dt((N+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=b||x.onRender,this._ease=T,this._delay=Y,this.iterationDuration=N,this._inlineStyles=L,!this._autoplay&&O&&this.onRender(this)}stretch(t){const e=this.duration;if(e===ut(t))return this;const s=t/e;return ft(this,(t=>{t._updateDuration=ut(t._updateDuration*s),t._changeDuration=ut(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return ft(this,(t=>{const e=zt(t.target,t.property,t._tweenType);Wt(e,Ut),t._fromNumbers=pt(Ut.d),t._fromNumber=Ut.n,t._func&&(Wt(t._func(),we),t._toNumbers=pt(we.d),t._strings=pt(we.s),t._toNumber=we.n)})),this}revert(){return super.revert(),Se(this)}then(t){return super.then(t)}}const Ne=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Fe={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Pe=(()=>{const t={};for(let e in ue)t[e]=t=>ue[e](ce(t));return t})(),Re=t=>{let e=Fe[t];if(e)return e;if(e="linear",Y(t)){if(A(t,"linear")||A(t,"cubic-")||A(t,"steps")||A(t,"ease"))e=t;else if(A(t,"cubicB"))e=L(t);else{const s=pe(t,Pe,Fe);X(s)&&(e=s===se?"linear":Ne(s))}Fe[t]=e}else if(X(t)){const s=Ne(t);s&&(e=s)}else t.ease&&(e=Ne(t.ease));return e},Ye=["x","y","z"],Xe=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Ye],Me=[...Ye,...f.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))];let Oe=t&&(M(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const ze={_head:null,_tail:null},Ie=(t,e,s)=>{let i=ze._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,a=!s||i.parent===s;if(n&&o&&a){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),gt(ze,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},We=(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),Ie(e,s),_t(ze,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{Ie(e,s,t)};return n.onremove=a,n.onfinish=a,n},Ve=(t,e,s,i,r)=>{let n=Xt(e,s,i,r);return R(n)?Xe.includes(t)||A(t,"translate")?`${n}px`:A(t,"rotate")||A(t,"skew")?`${n}deg`:`${n}`:n},Ue=(t,e,s,i,r,n)=>{let o="0";const a=M(i)?getComputedStyle(t)[e]:Ve(e,i,t,r,n);return o=M(s)?F(i)?i.map((s=>Ve(e,s,t,r,n))):a:[Ve(e,s,t,r,n),a],o};class He{constructor(t,e){B.scope&&B.scope.revertibles.push(this),Oe||(f.forEach((t=>{const e=A(t,"skew"),s=A(t,"scale"),i=A(t,"rotate"),r=A(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{}})),Oe=!0);const s=Dt(t),i=s.length;i||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const r=Yt(e.ease,Re(B.defaults.ease)),n=r.ease&&r,o=Yt(e.autoplay,B.defaults.autoplay),h=!(!o||!o.link)&&o,l=e.alternate&&!0===e.alternate,c=e.reversed&&!0===e.reversed,d=Yt(e.loop,B.defaults.loop),y=!0===d||d===1/0?1/0:R(d)?d+1:1,v=l?c?"alternate-reverse":"alternate":c?"reverse":"normal",b=Re(r),x=1===B.timeScale?1:u;this.targets=s,this.animations=[],this.controlAnimation=null,this.onComplete=e.onComplete||_,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!o||!1!==h,this.reversed=c,this.autoplay=o,this._speed=Yt(e.playbackRate,B.defaults.playbackRate),this._resolve=_,this._completed=0,this._inlineStyles=s.map((t=>t.getAttribute("style"))),s.forEach(((t,s)=>{const o=t[a],h=Me.some((t=>e.hasOwnProperty(t))),l=(n?n.duration:Xt(Yt(e.duration,B.defaults.duration),t,s,i))*x,c=Xt(Yt(e.delay,B.defaults.delay),t,s,i)*x,d=Yt(e.composition,"replace");for(let n in e){if(!U(n))continue;const a={},u={iterations:y,direction:v,fill:"forwards",easing:b,duration:l,delay:c,composite:d},p=e[n],g=!!h&&(f.includes(n)?n:m.get(n));let _;if(P(p)){const e=p,h=Yt(e.ease,r),m=h.ease&&h,f=e.to,y=e.from;if(u.duration=(m?m.duration:Xt(Yt(e.duration,l),t,s,i))*x,u.delay=Xt(Yt(e.delay,c),t,s,i)*x,u.composite=Yt(e.composition,d),u.easing=Re(h),_=Ue(t,n,y,f,s,i),g?(a[`--${g}`]=_,o[g]=_):a[n]=Ue(t,n,y,f,s,i),We(this,t,n,a,u),!M(y))if(g){const e=`--${g}`;t.style.setProperty(e,a[e][0])}else t.style[n]=a[n][0]}else _=F(p)?p.map((e=>Ve(n,e,t,s,i))):Ve(n,p,t,s,i),g?(a[`--${g}`]=_,o[g]=_):a[n]=_,We(this,t,n,a,u)}if(h){let e=p;for(let t in o)e+=`${g[t]}var(--${t})) `;t.style.transform=e}})),h&&this.autoplay.link(this)}forEach(t){const e=Y(t)?e=>e[t]():t;return this.animations.forEach(e),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:u);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const qe={animate:(t,e)=>new He(t,e),convertEase:Ne},Qe=(t=_)=>new ee({duration:1*B.timeScale,onComplete:t},null,0).resume();function je(t,e,s){const i=Dt(t);if(!i.length)return;const[r]=i,n=Mt(r,e),o=ye(e,r,n);let a=zt(r,o);if(M(s))return a;if(Wt(a,Ut),0===Ut.t||1===Ut.t){if(!1===s)return Ut.n;{const t=xe(r,Ut,s,!1);return`${ht(t.n,B.precision)}${t.u}`}}}const Ge=(t,e)=>{if(!M(e))return e.duration=c,e.composition=Yt(e.composition,i.none),new Ae(t,e,null,0,!0).resume()},Ze=(t,e,s)=>{let i=!1;return ft(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=ye(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),gt(e,r),Zt(r),i=!0)}}),!0),i},Je=(t,e,s)=>{const i=Bt(t),r=e||kt,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];Ie(e,s,n)}let o;if(r._hasChildren){let e=0;ft(r,(n=>{if(!n._hasChildren)if(o=Ze(i,n,s),o&&!n._head)n.cancel(),gt(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?Je(t,n,s):n._hasChildren=!1}),!0),M(r.iterationDuration)||(r.iterationDuration=e)}else o=Ze(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},Ke=(t,e,s)=>{const i=10**(s||0);return tt((Math.random()*(e-t+1/i)+t)*i)/i},ts=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),es=(t,e,s,i)=>{let r=u/B.defaults.frameRate;if(!1!==i){const t=i||kt._hasChildren&&kt;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},ss=t=>(...e)=>{const s=t(...e);return new Proxy(_,{apply:(t,e,[i])=>s(i),get:(t,e)=>ss(((...t)=>{const i=rs[e](...t);return t=>i(s(t))}))})},is=(t,e=0)=>(...s)=>(s.length<t.length?ss(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),rs={$:Dt,get:je,set:Ge,remove:Je,cleanInlineStyles:Se,random:Ke,randomPick:t=>t[Ke(0,t.length-1)],shuffle:t=>{let e,s,i=t.length;for(;i;)s=Ke(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},lerp:es,sync:Qe,clamp:is(ot),round:is(ht),snap:is(lt),wrap:is(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:is(ct,1),mapRange:is(ts),roundPad:is(((t,e)=>(+t).toFixed(e))),padStart:is(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:is(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:is((t=>t*rt/180)),radToDeg:is((t=>180*t/rt))},ns=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),M(e))return s;if(R(+e))return+e;const i=e,r=t?t.labels:null,n=!O(r),o=((t,e)=>{if(A(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!M(o),h=E.exec(i);if(h){const t=h[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=a?o:n?l:s,d=+e[1];return It(c,d,t[0])}return a?o:n?M(r[i])?s:r[i]:s};function os(t,e,s,i,r,n){const o=R(t.duration)&&t.duration<=c?s-c:s;bt(e,o,1,1,1);const a=i?new Ae(i,t,e,o,!1,r,n):new ee(t,e,o);return a.init(1),_t(e,a),ft(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return dt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}class as extends ee{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=B.defaults;this.defaults=e?mt(e,s):s,this.onRender=t.onRender||s.onRender;const i=Yt(t.playbackEase,s.playbackEase);this._ease=i?ge(i):null,this.iterationDuration=0}add(t,e,s){const i=P(e),r=P(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(X(s)){const e=s,r=Bt(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,M(a)||(s.id=a+"-"+h),os(s,this,e(t,h,l,this),t,h,l),h++}))}else os(i,this,ns(this,s),t)}else os(t,this,ns(this,e));return this.init(1)}}sync(t,e){if(M(t)||t&&M(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,ease:"linear"},e)}set(t,e,s){return M(e)?this:(e.duration=c,e.composition=i.replace,this.add(t,e,s))}call(t,e){return M(t)||t&&!X(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return M(t)||t&&!Y(t)||(this.labels[t]=ns(this,e)),this}remove(t,e){return Je(t,this,e),this}stretch(t){const e=this.duration;if(e===ut(t))return this;const s=t/e,i=this.labels;ft(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return ft(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),ft(this,(t=>t.revert),!0),Se(this)}then(t){return super.then(t)}}class hs{constructor(t,e){B.scope&&B.scope.revertibles.push(this);const s={},r={};if(this.targets=[],this.animations={},!M(t)&&!M(e)){for(let t in e){const i=e[t];U(t)?r[t]=i:s[t]=i}for(let e in r){const n=r[e],o=P(n);let a={},h="+=0";if(o){const t=n.unit;Y(t)&&(h+=t)}else a.duration=n;a[e]=o?mt({to:h},n):h;const l=mt(s,a);l.composition=i.replace,l.autoplay=!1;const c=this.animations[e]=new Ae(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(M(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return ft(c,(e=>{if(F(t))for(let s=0,i=t.length;s<i;s++)M(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;M(s)||(e._ease=ge(s)),e._currentTime=0})),M(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=_,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}class ls{constructor(t={}){this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/u,this.maxIterations=this.maxDuration/this.timeStep/u,this.m=ot(Yt(t.mass,1),0,u),this.s=ot(Yt(t.stiffness,100),1,u),this.d=ot(Yt(t.damping,10),.1,u),this.v=ot(Yt(t.velocity,0),-1e3,u),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?J(-n*e*s)*(1*G(i*n)+r*j(i*n)):(1+r*n)*J(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,h=this.w0=ot(Q(o/r),c,u),l=this.zeta=n/(2*Q(o*r)),d=this.wd=l<1?h*Q(1-l*l):0;this.b=l<1?(l*h-a)/d:-a+h;let p=0,m=0,f=0;for(;m<t&&f<e;)Z(1-this.solve(p))<s?m++:m=0,this.solverDuration=p,p+=i,f++;this.duration=ht(this.solverDuration*u,0)*B.timeScale}get mass(){return this.m}set mass(t){this.m=ot(Yt(t,1),0,u),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ot(Yt(t,100),1,u),this.compute()}get damping(){return this.d}set damping(t){this.d=ot(Yt(t,10),.1,u),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ot(Yt(t,0),-1e3,u),this.compute()}}const cs=t=>new ls(t),ds=t=>{t.cancelable&&t.preventDefault()};class us{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:_,remove:_}}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 ps{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 ms=(t,e)=>t&&X(t)?t(e):t;let fs=0;class gs{constructor(t,i={}){if(!t)return;B.scope&&B.scope.revertibles.push(this);const r=i.x,n=i.y,o=i.trigger,a=i.modifier,h=i.releaseEase,l=h&&ge(h),c=!M(h)&&!M(h.ease),u=P(r)&&!M(r.mapTo)?r.mapTo:"translateX",p=P(n)&&!M(n.mapTo)?n.mapTo:"translateY",m=ms(i.container,this);this.containerArray=F(m)?m:null,this.$container=m&&!this.containerArray?Bt(m)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=P(t)?new us(t):Bt(t)[0],this.$trigger=Bt(o||t)[0],this.fixed="fixed"===je(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?h:cs({mass:Yt(i.releaseMass,1),stiffness:Yt(i.releaseStiffness,80),damping:Yt(i.releaseDamping,20)}),this.releaseYSpring=c?h:cs({mass:Yt(i.releaseMass,1),stiffness:Yt(i.releaseStiffness,80),damping:Yt(i.releaseDamping,20)}),this.releaseEase=l||me.outQuint,this.hasReleaseSpring=c,this.onGrab=i.onGrab||_,this.onDrag=i.onDrag||_,this.onRelease=i.onRelease||_,this.onUpdate=i.onUpdate||_,this.onSettle=i.onSettle||_,this.onSnap=i.onSnap||_,this.onResize=i.onResize||_,this.onAfterResize=i.onAfterResize||_,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),M(r)||!0===r)f[u]=0;else if(P(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===r&&(f[u]=0,this.disabled[0]=1);if(M(n)||!0===n)f[p]=0;else if(P(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 hs(this.$target,f),this.xProp=u,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=[-1e12,d,d,-1e12],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=N(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new ps(this.$target),this.overshootCoords={x:0,y:0},this.overshootXTicker=new ee({autoplay:!1},null,0).init(),this.overshootYTicker=new ee({autoplay:!1},null,0).init(),this.updateTicker=new ee({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),this.contained=!M(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]?u:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=it(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 ee({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),P(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=N(),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]=ht(ot(Q(t*t+e*e)/r*o,a,h),5);const c=st(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=ht(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=lt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=ht(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=lt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return ht(this.animate[this.xProp](),B.precision)}set x(t){this.setX(t,!1)}get y(){return ht(this.animate[this.yProp](),B.precision)}set y(t){this.setY(t,!1)}get progressX(){return ts(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(ts(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return ts(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(ts(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=ht(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=ht(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,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,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?ot(c,a,c):c,this.scrollView[1]=l?ot(d,h,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:x,right:S,bottom:T}=t.getBoundingClientRect();this.dragArea[2]=ht(l?ot(y,a,a):y,0),this.dragArea[3]=ht(l?ot(v,h,h):v,0);const w=je(t,"overflow"),k="visible"===w,$="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===s.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!F(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,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=ht(r.top+s-(l?0:x),0),this.targetBounds[1]=ht(r.right+e-(l?a:S),0),this.targetBounds[2]=ht(r.bottom+s-(l?h:T),0),this.targetBounds[3]=ht(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]+_):(this.containerBounds[0]=-ht(r.top-(u?ot(x,0,h):x)+o-m,0),this.containerBounds[1]=-ht(r.right-(u?ot(S,0,a):S)-c+f,0),this.containerBounds[2]=-ht(r.bottom-(u?ot(T,0,h):T)-d+g,0),this.containerBounds[3]=-ht(r.left-(u?ot(b,0,a):b)+n-_,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,c=!h&&s<i||!h&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=ms(t.container,this),o=ms(t.containerPadding,this)||0,a=F(o)?o:[o,o,o,o],h=this.x,l=this.y,c=ms(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=F(n)?n:null,this.$container=n&&!this.containerArray?Bt(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=Yt(a,[0,0,0,0]),this.containerFriction=ot(Yt(ms(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ot(Yt(ms(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=ms(P(i)&&!M(i.snap)?i.snap:t.snap,this),this.snapY=ms(P(r)&&!M(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Yt(ms(t.scrollSpeed,this),1.5),this.scrollThreshold=Yt(ms(t.scrollThreshold,this),20),this.dragSpeed=Yt(ms(t.dragSpeed,this),1),this.minVelocity=Yt(ms(t.minVelocity,this),0),this.maxVelocity=Yt(ms(t.maxVelocity,this),50),this.velocityMultiplier=Yt(ms(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(ot(h,f,p),!0),this.setY(ot(l,u,m),!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,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?ot(c,this.window[0],c):c,p=this.useWin?ot(d,this.window[1],d):d,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,_=this.scrollThreshold,[y,v]=this.coords,[b,x,S,T]=this.scrollBounds,w=ht(ot((v-b+t)/_,-1,0)*g,0),k=ht(ot((y-x-e)/_,0,1)*g,0),$=ht(ot((v-S-s)/_,0,1)*g,0),E=ht(ot((y-T+i)/_,-1,0)*g,0);if(w||$||E||k){const[t,e]=this.disabled;let s=h,i=l;t||(s=ht(ot(h+(E||k),0,r-o),0),this.coords[0]-=h-s),e||(i=ht(ot(l+(w||$),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[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-h,n-l),this.angle=it(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.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return Je(this,null,"x"),Je(this,null,"y"),Je(this,null,"progressX"),Je(this,null,"progressY"),Je(this.scroll),Je(this.overshootCoords),this}scrollInView(t,e=0,s=me.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,c,u]=o,p=ht(ot(r-h,-1e12,0),0),m=ht(ot(i-l,0,d),0),f=ht(ot(r-c,0,d),0),g=ht(ot(i-u,-1e12,0),0);new Ae(n,{x:ht(n.x+(g?g-e:m?m+e:0),0),y:ht(n.y+(p?p-e:f?f+e:0),0),duration:M(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=Ge(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=me.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,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+h+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=ot(lt(i,this.snapX),u,c),a=ot(lt(r,this.snapY),l,d),h=M(t)?350*B.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,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/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=je(this.$target,"zIndex",!1);fs=(f>fs?f:fs)+1,this.targetStyles=Ge(this.$target,{zIndex:fs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Ge(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,me.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,c=!1,d=!1;for(;e&&h&&h!==this.$trigger;){const t=je(h,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=h;if(e>s){d=!0,l=t<=3,c=t>=e-s-3;break}}h=h.parentNode}d&&(!l&&!c||l&&a<0||c&&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):(ds(t),this.triggerStyles||(this.triggerStyles=Ge(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",ds,{passive:!1}),this.$trigger.addEventListener("touchmove",ds,{passive:!1}),this.$trigger.addEventListener("touchend",ds),(!this.disabled[0]&&Z(o)>3||!this.disabled[1]&&Z(a)>3)&&(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,[r,n,o,a,h,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,_=this.releaseYSpring,y=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,x=this.x,S=this.y,T=this.computeVelocity(r-h,n-l),w=this.angle=it(n-a,r-o),k=150*T,$=(1-this.releaseContainerFriction)*this.dragSpeed,E=x+G(w)*k,C=S+j(w)*k,D=E>d?d+(E-d)*$:E<p?p+(E-p)*$:E,L=C>u?u+(C-u)*$:C<c?c+(C-c)*$:C,A=this.destX=ot(ht(lt(D,this.snapX),5),p,d),N=this.destY=ot(ht(lt(L,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,E,C);let P=0,R=0,Y=y,X=y,M=0;if(b.x=x,b.y=S,!t){const t=A===d?x>d?-1:1:x<p?-1:1,s=ht(x-A,0);g.velocity=e&&v?s?k*t/Z(s):0:T;const{ease:i,duration:r,restDuration:n}=g;P=x===A?0:v?r:r-n*B.timeScale,v&&(Y=i),P>M&&(M=P)}if(!e){const e=N===u?S>u?-1:1:S<c?-1:1,s=ht(S-N,0);_.velocity=t&&v?s?k*e/Z(s):0:T;const{ease:i,duration:r,restDuration:n}=_;R=S===N?0:v?r:r-n*B.timeScale,v&&(X=i),R>M&&(M=R)}if(!v&&F&&$&&(P||R)){const t=i.blend;new Ae(b,{x:{to:D,duration:.65*P},y:{to:L,duration:.65*R},ease:y,composition:t}).init(),new Ae(b,{x:{to:A,duration:P},y:{to:N,duration:R},ease:y,composition:t}).init(),this.overshootXTicker.stretch(P).restart(),this.overshootYTicker.stretch(R).restart()}else t||this.animate[this.xProp](A,P,Y),e||this.animate[this.yProp](N,R,X);this.scrollInView(M,this.scrollThreshold,y);let O=!1;A!==m&&(this.snapped[0]=A,this.snapX&&(O=!0)),N!==f&&this.snapY&&(this.snapped[1]=N,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",ds),this.$trigger.removeEventListener("touchmove",ds),this.$trigger.removeEventListener("touchend",ds),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=Ge(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":ds(t)}}}class _s{constructor(t={}){B.scope&&B.scope.revertibles.push(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||Bt(i)[0]||s);const n=t.defaults,o=B.defaults,a=t.mediaQueries;if(this.defaults=n?mt(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],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)}}execute(t){let e=B.scope,s=B.root,i=B.defaults;B.scope=this,B.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 B.scope=e,B.root=s,B.defaults=i,n}refresh(){return 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);e&&this.revertConstructors.push(e)}))})),this}add(t,e){if(X(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);t&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.mediaQueryLists;let i=t.length,r=e.length;for(;i--;)t[i].revert();for(;r--;)e[r](this);for(let t in s)s[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const ys=(t,e)=>t&&X(t)?t(e):t,vs=new Map;class bs{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.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 ee({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;ft(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ee({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=ht(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new ee({autoplay:!1,duration:250*B.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ee({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=ht(t?e.scrollX:s.scrollLeft,0),this.scrollY=ht(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=(()=>{const t=document.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){ft(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),ft(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.unobserve(this.element),(this.useWin?e:this.element).removeEventListener("scroll",this),vs.delete(this.element)}}const xs=(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}=Wt(a,Ut);let c=h;return"%"===l?c=h/100*s:l&&(c=xe(t,Ut,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},Ss=(t,e,s,i,r)=>{let n;if(Y(e)){const o=E.exec(e);if(o){const a=o[0],h=a[0],l=e.split(a),c="min"===l[0],d="max"===l[0],u=xs(t,l[0],s,i,r),p=xs(t,l[1],s,i,r);if(c){const e=It(xs(t,"min",s),p,h);n=e<u?u:e}else if(d){const e=It(xs(t,"max",s),p,h);n=e>u?u:e}else n=It(u,p,h)}else n=xs(t,e,s,i,r)}else n=e;return ht(n,0)},Ts=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[n]){e=i;break}}return e};let ws=0;const ks=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class $s{constructor(t={}){B.scope&&B.scope.revertibles.push(this);const e=Yt(t.sync,"play pause"),i=e?ge(e):null,r=e&&("linear"===e||e===se),n=e&&!(i===se&&!r),o=e&&(R(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=ws++,this.id=M(t.id)?this.index:t.id,this.container=(t=>{const e=t&&Bt(t)[0]||s.body;let i=vs.get(e);return i||(i=new bs(e),vs.set(e,i)),i})(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]:_,this.onSyncLeave=h&&!l&&h[1]?h[1]:_,this.onSyncEnterForward=h&&l&&h[0]?h[0]:_,this.onSyncLeaveForward=h&&l&&h[1]?h[1]:_,this.onSyncEnterBackward=h&&l&&h[2]?h[2]:_,this.onSyncLeaveBackward=h&&l&&h[3]?h[3]:_,this.onEnter=t.onEnter||_,this.onLeave=t.onLeave||_,this.onEnterForward=t.onEnterForward||_,this.onLeaveForward=t.onLeaveForward||_,this.onEnterBackward=t.onEnterBackward||_,this.onLeaveBackward=t.onLeaveBackward||_,this.onUpdate=t.onUpdate||_,this.onSyncComplete=t.onSyncComplete||_,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=Yt(t.debug,!1),this._next=null,this._prev=null,_t(this.container,this),Qe((()=>{if(!this.reverted){if(!this.target){const e=Bt(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;M(t.targets)?ft(t,(t=>{t.targets&&!e&&(e=Ts(t))})):e=Ts(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:ht(ot(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=Yt(ys(t.repeat,this),!0),this.horizontal="x"===Yt(ys(t.axis,this),"y"),this.enter=Yt(ys(t.enter,this),"end start"),this.leave=Yt(ys(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=ks[this.index%ks.length],h=t.useWin,l=h?t.winWidth:t.width,c=h?t.winHeight:t.height,d=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,_=e?g:15,y=e?60:g,v=e?y:_,b=e?"repeat-x":"repeat-y",x=t=>e?"0px "+t+"px":t+"px 2px",S=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,T=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${T("absolute",m,f,e?d: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=`${T("sticky",0,0,e?l:g,e?g:c)}`,i||(n.style.cssText+=`background:\n ${S("#FFFF")}${x(g-10)} / 100px 100px ${b},\n ${S("#FFF8")}${x(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${T("relative",0,0,e?d:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${S("#FFFF")}${x(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${S("#FFF8")}${x(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<v,g=h>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,x=s.createElement("div"),S=s.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?y:_)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;S.innerHTML=`${this.id}${w[m]}${this.thresholds[i]}`,x.style.cssText=`${T("absolute",0,0,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-${k}: 2px solid ${a};\n `,S.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${_};\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 `,x.appendChild(S);let E=h-$+(e?1:0);x.style[e?"left":"top"]=`${E}px`,(r?n:o).appendChild(x)})),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),i||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===je(t.element,"position")&&(this.debugStyles=Ge(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,h=0,l=0,c=a;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===je(i.element,"position")&&Ge(i.element,{position:"relative "});for(;a&&a!==i.element&&a!==s.body;){const e="sticky"===je(a,"position")&&Ge(a,{position:"static"});a===c&&(h+=a.offsetLeft||0,l+=a.offsetTop||0,c=a.offsetParent),a=a.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?h:l,p=r?e.offsetWidth:e.offsetHeight,m=r?i.width:i.height,f=(r?i.scrollWidth:i.scrollHeight)-m,g=this.enter,_=this.leave;let y="start",v="end",b="end",x="start";if(Y(g)){const t=g.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(P(g)){const t=g;M(t.container)||(b=t.container),M(t.target)||(y=t.target)}else R(g)&&(b=g);if(Y(_)){const t=_.split(" ");x=t[0],v=t.length>1?t[1]:v}else if(P(_)){const t=_;M(t.container)||(x=t.container),M(t.target)||(v=t.target)}else R(_)&&(x=_);const S=Ss(e,y,p),T=Ss(e,v,p),w=S+u-m,k=T+u-f,$=Ss(e,b,m,w,k),E=Ss(e,x,m,w,k),C=S+u-$,B=T+u-E,D=B-C;this.offsets[0]=h,this.offsets[1]=l,this.offset=u,this.offsetStart=C,this.offsetEnd=B,this.distance=D<=0?0:D,this.thresholds=[y,v,b,x],this.coords=[S,T,$,E],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){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,c=!h&&!l,d=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&d,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&&R(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=ht(es(e,g,ct(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 gt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}exports.Animatable=hs,exports.Draggable=gs,exports.JSAnimation=Ae,exports.Scope=_s,exports.ScrollObserver=$s,exports.Spring=ls,exports.Timeline=as,exports.Timer=ee,exports.WAAPIAnimation=He,exports.animate=(t,e)=>new Ae(t,e,null,0,!1).init(),exports.createAnimatable=(t,e)=>new hs(t,e),exports.createDraggable=(t,e)=>new gs(t,e),exports.createScope=t=>new _s(t),exports.createSpring=cs,exports.createTimeline=t=>new as(t).init(),exports.createTimer=t=>new ee(t,null,0).init(),exports.eases=me,exports.engine=kt,exports.onScroll=(t={})=>new $s(t),exports.scrollContainers=vs,exports.stagger=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!M(o),h=a&&!M(o.ease)?o.ease:a?ge(o):null,l=e.grid,c=e.axis,d=M(r)||0===r||"first"===r,u="center"===r,m="last"===r,f=F(t),g=H(f?t[0]:t),_=f?H(t[1]):0,y=w.exec((f?t[1]:t)+p),v=e.start||0+(f?g:0);let b=d?0:R(r)?r:0;return(t,r,o,a)=>{if(u&&(b=(o-1)/2),m&&(b=o-1),!s.length){for(let t=0;t<o;t++){if(l){const e=u?(l[0]-1)/2:b%l[0],i=u?(l[1]-1)/2:tt(b/l[0]),r=e-t%l[0],n=i-tt(t/l[0]);let o=Q(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(Z(b-t));i=st(...s)}h&&(s=s.map((t=>h(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:Z(i-t))))}const d=f?(_-g)/i:g;let p=(a?ns(a,M(e.start)?a.iterationDuration:v):v)+(d*ht(s[r],2)||0);return e.modifier&&(p=e.modifier(p)),y&&(p=`${p}${y[2]}`),p}},exports.svg=Pt,exports.utils=rs,exports.waapi=qe;
+"use strict";const t="undefined"!=typeof window,e=t?window:null,s=t?document:null,i={replace:0,none:1,blend:2},r=Symbol(),n=Symbol(),o=Symbol(),h=Symbol(),a=Symbol(),l=Symbol(),c=1e-11,d=1e12,u=1e3,p="",m=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),f=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],g=f.reduce(((t,e)=>({...t,[e]:e+"("})),{}),_=()=>{},y=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,v=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,b=/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,T=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,w=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,S=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,k=/([a-z])([A-Z])/g,$=/(\w+)(\([^)]+\)+)/g,C=/(\*=|\+=|-=)/,E={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:u,delay:0,loopDelay:0,ease:"out(2)",composition:i.replace,modifier:t=>t,onBegin:_,onBeforeUpdate:_,onUpdate:_,onLoop:_,onPause:_,onComplete:_,onRender:_},B={current:null,root:s},L={defaults:E,precision:4,timeScale:1,tickThreshold:200},D={version:"4.1.0",engine:null};t&&(e.AnimeJS||(e.AnimeJS=[]),e.AnimeJS.push(D));const A=t=>t.replace(k,"$1-$2").toLowerCase(),N=(t,e)=>0===t.indexOf(e),F=Date.now,O=Array.isArray,P=t=>t&&t.constructor===Object,M=t=>"number"==typeof t&&!isNaN(t),R=t=>"string"==typeof t,Y=t=>"function"==typeof t,I=t=>void 0===t,X=t=>I(t)||null===t,z=e=>t&&e instanceof SVGElement,W=t=>y.test(t),V=t=>N(t,"rgb"),H=t=>N(t,"hsl"),U=t=>!L.defaults.hasOwnProperty(t),q=t=>R(t)?parseFloat(t):t,Q=Math.pow,j=Math.sqrt,G=Math.sin,Z=Math.cos,J=Math.abs,K=Math.exp,tt=Math.ceil,et=Math.floor,st=Math.asin,it=Math.max,rt=Math.atan2,nt=Math.PI,ot=Math.round,ht=(t,e,s)=>t<e?e:t>s?s:t,at={},lt=(t,e)=>{if(e<0)return t;if(!e)return ot(t);let s=at[e];return s||(s=at[e]=10**e),ot(t*s)/s},ct=(t,e)=>O(e)?e.reduce(((e,s)=>J(s-t)<J(e-t)?s:e)):e?ot(t/e)*e:t,dt=(t,e,s)=>t+(e-t)*s,ut=(t,e,s)=>{const i=10**(s||0);return et((Math.random()*(e-t+1/i)+t)*i)/i},pt=t=>{let e,s,i=t.length;for(;i;)s=ut(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},mt=t=>t===1/0?d:t===-1/0?-1e12:t,ft=t=>t<=c?c:mt(lt(t,11)),gt=t=>O(t)?[...t]:t,_t=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=I(r)?e[i]:r}return s},yt=(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}},vt=(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},bt=(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},xt=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 h=t(...s);return h&&!Y(h)&&h.revert&&(e=h),I(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),h||_}};class Tt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=lt(u/120,0),this._fps=120,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=lt(u/i,0);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,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const wt=(t,e,s,r,n)=>{const o=t.parent,a=t.duration,l=t.completed,d=t.iterationDuration,u=t.iterationCount,m=t._currentIteration,f=t._loopDelay,_=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,x=t._currentTime,T=b+d,w=e-b,S=ht(x,-b,a),k=ht(w,-b,a),$=w-x,C=k>0,E=k>=a,B=a<=c,D=2===n;let A=0,N=w,F=0;if(u>1){const e=~~(k/(d+(E?0:f)));t._currentIteration=ht(e,0,u),E&&t._currentIteration--,A=t._currentIteration%2,N=k%(d+f)||0}const O=_^(y&&A),P=t._ease;let M=E?O?0:a:O?d-N:N;P&&(M=d*P(M/d)||0);const R=(o?o.backwards:w<x)?!O:!!O;if(t._currentTime=w,t._iterationTime=M,t.backwards=R,C&&!t.began?(t.began=!0,s||o&&(R||!o.began)||t.onBegin(t)):w<=0&&(t.began=!1),s||v||!C||t._currentIteration===m||t.onLoop(t),D||1===n&&(e>=b&&e<=T||e<=b&&S>b||e>=T&&S!==a)||M>=T&&S!==a||M<=b&&S>0||e<=S&&S===a&&l||E&&!l&&B){if(C&&(t.computeDeltaTime(S),s||t.onBeforeUpdate(t)),!v){const e=D||(R?-1*$:$)>=L.tickThreshold,n=t._offset+(o?o._offset:0)+b+M;let a,l,c,d,u=t._head,m=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,f=u._absoluteStartTime+u._changeDuration,_=u._nextRep,y=u._prevRep,v=t!==i.none;if((e||(s!==o||n<=f+(_?_._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!_||_._isOverridden||n<=_._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=ht(M-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,p=u._valueType,f=u._tweenType,g=0===f,_=0===p,y=_&&g||0===s||1===s?-1:L.precision;let b,x;if(_)b=x=n(lt(dt(u._fromNumber,u._toNumber,s),y));else if(1===p)x=n(lt(dt(u._fromNumber,u._toNumber,s),y)),b=`${x}${u._unit}`;else if(2===p){const t=u._fromNumbers,e=u._toNumbers,i=lt(ht(n(dt(t[0],e[0],s)),0,255),0),r=lt(ht(n(dt(t[1],e[1],s)),0,255),0),o=lt(ht(n(dt(t[2],e[2],s)),0,255),0),h=ht(n(lt(dt(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${h})`,v){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=h}}else if(3===p){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(lt(dt(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=x),r||t===i.blend)u._value=b;else{const t=u.property;a=u.target,g?a[t]=b:1===f?a.setAttribute(t,b):(l=a.style,3===f?(a!==c&&(c=a,d=a[h]),d[t]=b,m=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),C&&(F=1)}}if(m&&u._renderTransforms){let t=p;for(let e in d)t+=`${g[e]}${d[e]}) `;l.transform=t,m=0}u=u._next}!s&&F&&t.onRender(t)}!s&&C&&t.onUpdate(t)}return o&&B?!s&&(o.began&&!R&&w>=a&&!l||R&&w<=c&&l)&&(t.onComplete(t),t.completed=!R):C&&E?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(R||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},St=(t,e,s,i,r)=>{const n=t._currentIteration;if(wt(t,e,s,i,r),t._hasChildren){const o=t,h=o.backwards,a=i?e:o._iterationTime,l=F();let d=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;yt(o,(e=>{if(h){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&&wt(e,t,s,1,2),e.began=!1,e.completed=!1})),s||o.onLoop(o)}yt(o,(t=>{const e=lt((a-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;d+=wt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),h),!s&&d&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},kt={animation:null,update:_},$t=(()=>t?requestAnimationFrame:setImmediate)(),Ct=(()=>t?cancelAnimationFrame:clearImmediate)();class Et extends Tt{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=E,this.paused=!(!t||!s.hidden),this.reqId=null}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?(vt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):St(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}kt.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=$t(Lt)),this}pause(){return this.paused=!0,Dt()}resume(){if(this.paused)return this.paused=!1,yt(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===L.timeScale?1:u)}set speed(t){this._speed=t*L.timeScale,yt(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:u;this.defaults.duration*=t,this._speed*=t}}get precision(){return L.precision}set precision(t){L.precision=t}}const Bt=(()=>{const e=new Et(F());return t&&(D.engine=e,s.addEventListener("visibilitychange",(()=>{e.pauseOnDocumentHidden&&(s.hidden?e.pause():e.resume())}))),e})(),Lt=()=>{Bt._head?(Bt.reqId=$t(Lt),Bt.update()):Bt.reqId=0},Dt=()=>(Ct(Bt.reqId),Bt.reqId=0,Bt);function At(t){const e=R(t)?B.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Nt(e){if(X(e))return[];if(O(e)){const t=e.flat(1/0),s=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!X(i)){const t=At(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!X(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}if(!t)return[e];const s=At(e);return s?Array.from(s):[e]}function Ft(t){const e=Nt(t),s=e.length;if(s)for(let t=0;t<s;t++){const s=e[t];if(!s[r]){s[r]=!0;const t=z(s);(s.nodeType||t)&&(s[n]=!0,s[o]=t,s[h]={})}}return e}const Ot=t=>{const e=Nt(t)[0];if(e&&z(e))return e},Pt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),Mt=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[o],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Pt(t,s,-1),i=Pt(t,s,1);return 180*rt(i.y-e.y,i.x-e.x)/nt}{const i=Pt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Rt=["opacity","rotate","overflow","color"],Yt={morphTo:(t,e=.33)=>s=>{const i=Ot(t);if(!i)return;const r="path"===s.tagName,n=r?" ":",",o=s[a];o&&s.setAttribute(r?"d":"points",o);let h="",l="";if(e){const t=s.getTotalLength(),o=i.getTotalLength(),a=Math.max(Math.ceil(t*e),Math.ceil(o*e));for(let e=0;e<a;e++){const c=e/(a-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";h+=p+lt(d.x,3)+n+d.y+" ",l+=p+lt(u.x,3)+n+u.y+" "}}else h=s.getAttribute(r?"d":"points"),l=i.getAttribute(r?"d":"points");return s[a]=l,[h,l]},createMotionPath:t=>{const e=Ot(t);if(e)return{translateX:Mt(e,"x"),translateY:Mt(e,"y"),rotate:Mt(e,"a")}},createDrawable:(t,e=0,s=0)=>Nt(t).map((t=>((t,e,s)=>{const i=u,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let h=n;const a=new Proxy(t,{get(t,e){const s=t[e];return e===l?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],a=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(j(s.a*s.a+s.b*s.b)+j(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=a*i*l+c,u=i*l+(0===r&&1===a||1===r&&0===a?0:10*l)-d;if("butt"!==n){const e=r===a?"butt":n;h!==e&&(t.style.strokeLinecap=`${e}`,h=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:Y(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),a.setAttribute("draw",`${e} ${s}`)),a})(t,e,s)))},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),Xt=(t,e)=>I(t)?e:t,zt=(t,e,s,i,r)=>{if(Y(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Wt=(t,e)=>t[n]?t[o]&&((t,e)=>{if(Rt.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:f.includes(e)||m.get(e)?3:N(e,"--")?4:e in t.style?2:e in t?0:1:0,Vt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[l]||t).getPropertyValue(e);return"auto"===r?"0":r},Ht=(t,e,s,i)=>{const r=I(s)?Wt(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[h];let o;for(;o=$.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&&!I(r)?r:N(e,"scale")?"1":N(e,"rotate")||N(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Vt(t,e,i).trimStart():Vt(t,e,i)},Ut=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,qt=(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(" ")&&S.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(W(r=s)||V(r)||H(r))return e.t=2,e.d=V(i=s)?(t=>{const e=v.exec(t)||b.exec(t),s=I(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):W(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):H(i)?(t=>{const e=x.exec(t)||T.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=I(e[4])?1:+e[4];let o,h,a;if(0===i)o=h=a=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=lt(255*It(e,t,s+1/3),0),h=lt(255*It(e,t,s),0),a=lt(255*It(e,t,s-1/3),0)}return[o,h,a,n]})(i):[0,0,0,1],e;{const t=s.match(w);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(w)||[],e}}var i,r;return e.n=s,e},Qt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=gt(t._toNumbers),e.s=gt(t._strings),e),jt={t:0,n:0,u:null,o:null,d:null,s:null},Gt={_rep:new WeakMap,_add:new Map},Zt=(t,e,s="_rep")=>{const i=Gt[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,Kt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=c,t._currentTime=c},te=(t,e)=>{const s=t._composition;if(s===i.replace){const s=t._absoluteStartTime;bt(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){Kt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)Kt(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<c&&Kt(i)}let o=!0;if(yt(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;yt(t,(t=>{t!==e&&yt(t,(t=>{t._isOverlapped||(s=!1)}))})),s&&t.cancel()}else e.cancel()}}}else if(s===i.blend){const e=Zt(t.target,t.property,"_add"),s=(t=>{let e=kt.animation;return e||(e={duration:c,computeDeltaTime:_,_offset:0,_delay:0,_head:null,_tail:null},kt.animation=e,kt.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?gt(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}}})),wt(e,1,1,0,2)}),e})(Gt._add);let r=e._head;r||(r={...t},r._composition=i.replace,r._updateDuration=c,r._startTime=0,r._numbers=gt(t._fromNumbers),r._number=0,r._next=null,r._prev=null,bt(e,r),bt(s,r));const n=t._toNumber;if(t._fromNumber=r._fromNumber-n,t._toNumber=0,t._numbers=gt(t._fromNumbers),t._number=0,r._fromNumber=n,t._toNumbers){const e=gt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=r._fromNumbers[s]-e,t._toNumbers[s]=0})),r._fromNumbers=e}bt(e,t,null,"_prevAdd","_nextAdd")}return t},ee=t=>{const e=t._composition;if(e!==i.none){const s=t.target,r=t.property,n=Gt._rep.get(s)[r];if(vt(n,t,"_prevRep","_nextRep"),e===i.blend){const e=Gt._add,i=e.get(s);if(!i)return;const n=i[r],o=kt.animation;vt(n,t,"_prevAdd","_nextAdd");const h=n._head;if(h&&h===n._tail){vt(n,h,"_prevAdd","_nextAdd"),vt(o,h);let t=!0;for(let e in i)if(i[e]._head){t=!1;break}t&&e.delete(s)}}}return t},se=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),ie=t=>t._cancelled?(t._hasChildren?yt(t,ie):yt(t,(t=>{t._composition!==i.none&&te(t,Zt(t.target,t.property))})),t._cancelled=0,t):t;let re=0;class ne extends Tt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:h,loop:a,loopDelay:l,autoplay:d,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:b}=t;B.current&&B.current.register(this);const x=e?0:Bt._elapsedTime,T=e?e.defaults:L.defaults,w=Y(r)||I(r)?T.delay:+r,S=Y(n)||I(n)?1/0:+n,k=Xt(a,T.loop),$=Xt(l,T.loopDelay),C=!0===k||k===1/0||k<0?1/0:k+1;let E=0;if(e)E=s;else{let t=F();Bt.paused&&(Bt.requestTick(t),t=Bt._elapsedTime),E=t-Bt._startTime}this.id=I(i)?++re:i,this.parent=e,this.duration=mt((S+$)*C-$)||c,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||T.onBegin,this.onBeforeUpdate=v||T.onBeforeUpdate,this.onUpdate=b||T.onUpdate,this.onLoop=f||T.onLoop,this.onPause=g||T.onPause,this.onComplete=m||T.onComplete,this.iterationDuration=S,this.iterationCount=C,this._autoplay=!e&&Xt(d,T.autoplay),this._offset=E,this._delay=w,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=_,this._running=!1,this._reversed=+Xt(o,T.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Xt(h,T.alternate),this._prev=null,this._next=null,this._elapsedTime=x,this._startTime=x,this._lastTime=x,this._fps=Xt(u,T.frameRate),this._speed=Xt(p,T.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return ht(lt(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 lt(this._iterationTime,L.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return ht(lt(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return ht(lt(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*ht(+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=0){return ie(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,St(this,0,1,t,2),se(this),this._hasChildren&&yt(this,se),this}init(t=0){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&St(this,this.duration,1,t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!I(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*Bt._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?St(this,c,0,0,2):(this._running||(bt(Bt,this),Bt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,Bt.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){ie(this),this.completed=!1;const i=this.paused;return this.paused=!0,St(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?et(d/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?yt(this,(t=>t.cancel()),!0):yt(this,ee),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=ft(t);if(e===s)return this;const i=t/e,r=t<=c;return this.duration=r?c:s,this.iterationDuration=r?c:ft(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){St(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=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const oe=t=>t,he=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,ae=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?oe:r=>0===r||1===r?r:he(((t,e,s)=>{let i,r,n=0,o=1,h=0;do{r=n+(o-n)/2,i=he(r,e,s)-t,i>0?o=r:n=r}while(J(i)>1e-7&&++h<100);return r})(r,t,s),e,i),le=(t=10,e)=>{const s=e?tt:et;return e=>s(ht(e,0,1)*t)*(1/t)},ce=(...t)=>{const e=t.length;if(!e)return oe;const s=e-1,i=t[0],r=t[s],n=[0],o=[q(i)];for(let e=1;e<s;e++){const i=t[e],r=R(i)?i.trim().split(" "):[i],h=r[0],a=r[1];n.push(I(a)?e/s:q(a)/100),o.push(q(h))}return o.push(q(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]}},de=(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(ht(o,r,1))}return s.push(1),ce(...s)},ue=nt/2,pe=2*nt,me=(t=1.68)=>e=>Q(e,+t),fe={[p]:me,Quad:me(2),Cubic:me(3),Quart:me(4),Quint:me(5),Sine:t=>1-Z(t*ue),Circ:t=>1-j(1-t*t),Expo:t=>t?Q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=Q(2,--s))-1)/11;);return 1/Q(4,3-s)-7.5625*Q((3*e-2)/22-t,2)},Back:(t=1.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=ht(+t,1,10),i=ht(+e,c,2),r=i/pe*st(1/s),n=pe/i;return t=>0===t||1===t?t:-s*Q(2,-10*(1-t))*G((1-t-r)*n)}},ge={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},_e=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=ge[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:oe}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):oe}},ye=(()=>{const t={linear:ce,irregular:de,steps:le,cubicBezier:ae};for(let e in ge)for(let s in fe){const i=fe[s],r=ge[e];t[e+s]=s===p||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ve={linear:oe},be=t=>Y(t)?t:R(t)?_e(t,ye,ve):oe,xe={},Te=(t,e,s)=>{if(3===s)return m.get(t)||t;if(2===s||1===s&&z(e)&&t in e.style){const e=xe[t];if(e)return e;{const e=t?A(t):t;return xe[t]=e,e}}return t},we={deg:1,rad:180/nt,turn:360},Se={},ke=(t,e,i,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===i)return e;const h=o+n+i,a=Se[h];if(I(a)||r){let r;if(n in we)r=o*we[n]/we[i];else{const e=100,h=t.cloneNode(),a=t.parentNode,l=a&&a!==s?a:s.body;l.appendChild(h);const c=h.style;c.width=e+n;const d=h.offsetWidth||e;c.width=e+i;const u=d/(h.offsetWidth||e);l.removeChild(h),r=u*o}e.n=r,Se[h]=r}else e.n=a;return e.t,e.u=i,e},$e=t=>{if(t._hasChildren)yt(t,$e,!0);else{const e=t;e.pause(),yt(e,(t=>{const s=t.property,i=t.target;if(i[n]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[h];if(I(n)||n===p?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=p;for(let s in e)t+=g[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else I(n)||n===p?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===p&&t.removeAttribute("style")}))}}))}return t},Ce={t:0,n:0,u:null,o:null,d:null,s:null},Ee={t:0,n:0,u:null,o:null,d:null,s:null},Be={func:null},Le=[null],De=[null,null],Ae={to:null};let Ne,Fe,Oe=0;class Pe extends ne{constructor(t,e,s,r,n=!1,o=0,h=0){super(e,s,r);const a=Ft(t),l=a.length,d=e.keyframes,p=d?_t(((t,e)=>{const s={};if(O(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(U);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];U(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=Xt(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(U(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let h=n.length,a=n[h-1];const l={to:r[t]};let c=0;for(let t=0;t<h;t++)c+=n[t].duration;1===h&&(l.from=a.to),r.ease&&(l.ease=r.ease),l.duration=o-(h?c: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})(d,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=p,x=s?s.defaults:L.defaults,T=Xt(_,x.playbackEase),w=T?be(T):null,S=!I(g)&&!I(g.ease),k=S?g.ease:Xt(g,w?"linear":x.ease),$=S?g.duration:Xt(f,x.duration),C=Xt(m,x.delay),E=y||x.modifier,B=I(v)&&l>=u?i.none:I(v)?x.composition:v,D={},A=this._offset+(s?s._offset:0);let N=NaN,F=NaN,R=0,Y=0;for(let t=0;t<l;t++){const e=a[t],r=o||t,d=h||l;let u=NaN,m=NaN;for(let t in p)if(U(t)){const o=Wt(e,t),h=Te(t,e,o);let a=p[t];const l=O(a);if(n&&!l&&(De[0]=a,De[1]=a,a=De),l){const t=a.length,e=!P(a[0]);2===t&&e?(Ae.to=a,Le[0]=Ae,Ne=Le):t>2&&e?(Ne=[],a.forEach(((t,e)=>{e?1===e?(De[1]=t,Ne.push(De)):Ne.push(t):De[0]=t}))):Ne=a}else Le[0]=a,Ne=Le;let f=null,g=null,_=NaN,y=0,v=0;for(let t=Ne.length;v<t;v++){const n=Ne[v];P(n)?Fe=n:(Ae.to=n,Fe=Ae),Be.func=null;const a=zt(Fe.to,e,r,d,Be);let l;P(a)&&!I(a.to)?(Fe=a,l=a.to):l=a;const u=zt(Fe.from,e,r,d),p=Fe.ease,m=!I(p)&&!I(p.ease),b=m?p.ease:p||k,x=m?p.duration:zt(Xt(Fe.duration,t>1?zt($,e,r,d)/t:$),e,r,d),T=zt(Xt(Fe.delay,v?0:C),e,r,d),w=zt(Xt(Fe.composition,B),e,r,d),S=M(w)?w:i[w],L=Fe.modifier||E,N=!I(u),F=!I(l),X=O(l),z=X||N&&F,W=g?y+T:T,V=A+W;Y||!N&&!X||(Y=1);let H=g;if(S!==i.none){f||(f=Zt(e,h));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(H=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)Kt(t),t=t._nextRep}if(z?(qt(X?zt(l[0],e,r,d):u,Ce),qt(X?zt(l[1],e,r,d,Be):l,Ee),0===Ce.t&&(H?1===H._valueType&&(Ce.t=1,Ce.u=H._unit):(qt(Ht(e,h,o,D),jt),1===jt.t&&(Ce.t=1,Ce.u=jt.u)))):(F?qt(l,Ee):g?Qt(g,Ee):qt(s&&H&&H.parent.parent===s?H._value:Ht(e,h,o,D),Ee),N?qt(u,Ce):g?Qt(g,Ce):qt(s&&H&&H.parent.parent===s?H._value:Ht(e,h,o,D),Ce)),Ce.o&&(Ce.n=Ut(H?H._toNumber:qt(Ht(e,h,o,D),jt).n,Ce.n,Ce.o)),Ee.o&&(Ee.n=Ut(Ce.n,Ee.n,Ee.o)),Ce.t!==Ee.t)if(3===Ce.t||3===Ee.t){const t=3===Ce.t?Ce:Ee,e=3===Ce.t?Ee:Ce;e.t=3,e.s=gt(t.s),e.d=t.d.map((()=>e.n))}else if(1===Ce.t||1===Ee.t){const t=1===Ce.t?Ce:Ee,e=1===Ce.t?Ee:Ce;e.t=1,e.u=t.u}else if(2===Ce.t||2===Ee.t){const t=2===Ce.t?Ce:Ee,e=2===Ce.t?Ee:Ce;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Ce.u!==Ee.u){let t=Ee.u?Ce:Ee;t=ke(e,t,Ee.u?Ee.u:Ce.u,!1)}if(Ee.d&&Ce.d&&Ee.d.length!==Ce.d.length){const t=Ce.d.length>Ee.d.length?Ce:Ee,e=t===Ce?Ee:Ce;e.d=t.d.map(((t,s)=>I(e.d[s])?0:e.d[s])),e.s=gt(t.s)}const U=lt(+x||c,12),q={parent:this,id:Oe++,property:h,target:e,_value:null,_func:Be.func,_ease:be(b),_fromNumbers:gt(Ce.d),_toNumbers:gt(Ee.d),_strings:gt(Ee.s),_fromNumber:Ce.n,_toNumber:Ee.n,_numbers:gt(Ce.d),_number:Ce.n,_unit:Ee.u,_modifier:L,_currentTime:0,_startTime:W,_delay:+T,_updateDuration:U,_changeDuration:U,_absoluteStartTime:V,_tweenType:o,_valueType:Ee.t,_composition:S,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};S!==i.none&&te(q,f),isNaN(_)&&(_=q._startTime),y=lt(W+U,12),g=q,R++,bt(this,q)}(isNaN(F)||_<F)&&(F=_),(isNaN(N)||y>N)&&(N=y),3===o&&(u=R-v,m=R)}if(!isNaN(u)){let t=0;yt(this,(e=>{t>=u&&t<m&&(e._renderTransforms=1,e._composition===i.blend&&yt(kt.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),F?(yt(this,(t=>{t._startTime-t._delay||(t._delay-=F),t._startTime-=F})),N-=F):F=0,N||(N=c,this.iterationCount=0),this.targets=a,this.duration=N===c?c:mt((N+this._loopDelay)*this.iterationCount-this._loopDelay)||c,this.onRender=b||x.onRender,this._ease=w,this._delay=F,this.iterationDuration=N,this._inlineStyles=D,!this._autoplay&&Y&&this.onRender(this)}stretch(t){const e=this.duration;if(e===ft(t))return this;const s=t/e;return yt(this,(t=>{t._updateDuration=ft(t._updateDuration*s),t._changeDuration=ft(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return yt(this,(t=>{const e=t._func;if(e){const s=Ht(t.target,t.property,t._tweenType);qt(s,jt),qt(e(),Ee),t._fromNumbers=gt(jt.d),t._fromNumber=jt.n,t._toNumbers=gt(Ee.d),t._strings=gt(Ee.s),t._toNumber=Ee.n}})),this}revert(){return super.revert(),$e(this)}then(t){return super.then(t)}}const Me=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Re={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Ye=(()=>{const t={};for(let e in ge)t[e]=t=>ge[e](me(t));return t})(),Ie=t=>{let e=Re[t];if(e)return e;if(e="linear",R(t)){if(N(t,"linear")||N(t,"cubic-")||N(t,"steps")||N(t,"ease"))e=t;else if(N(t,"cubicB"))e=A(t);else{const s=_e(t,Ye,Re);Y(s)&&(e=s===oe?"linear":Me(s))}Re[t]=e}else if(Y(t)){const s=Me(t);s&&(e=s)}else t.ease&&(e=Me(t.ease));return e},Xe=["x","y","z"],ze=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Xe],We=(()=>[...Xe,...f.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))])();let Ve=null;const He={_head:null,_tail:null},Ue=(t,e,s)=>{let i=He._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,h=!s||i.parent===s;if(n&&o&&h){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),vt(He,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},qe=(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),Ue(e,s),bt(He,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const h=()=>{Ue(e,s,t)};return n.onremove=h,n.onfinish=h,n},Qe=(t,e,s,i,r)=>{let n=zt(e,s,i,r);return M(n)?ze.includes(t)||N(t,"translate")?`${n}px`:N(t,"rotate")||N(t,"skew")?`${n}deg`:`${n}`:n},je=(t,e,s,i,r,n)=>{let o="0";const h=I(i)?getComputedStyle(t)[e]:Qe(e,i,t,r,n);return o=I(s)?O(i)?i.map((s=>Qe(e,s,t,r,n))):h:[Qe(e,s,t,r,n),h],o};class Ge{constructor(e,s){B.current&&B.current.register(this),X(Ve)&&(!t||!I(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(f.forEach((t=>{const e=N(t,"skew"),s=N(t,"scale"),i=N(t,"rotate"),r=N(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{}})),Ve=!0):Ve=!1);const i=Ft(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=Xt(s.ease,Ie(L.defaults.ease)),o=n.ease&&n,a=Xt(s.autoplay,L.defaults.autoplay),l=!(!a||!a.link)&&a,c=s.alternate&&!0===s.alternate,d=s.reversed&&!0===s.reversed,y=Xt(s.loop,L.defaults.loop),v=!0===y||y===1/0?1/0:M(y)?y+1:1,b=c?d?"alternate-reverse":"alternate":d?"reverse":"normal",x=Ie(n),T=1===L.timeScale?1:u;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||_,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!a||!1!==l,this.reversed=d,this.autoplay=a,this._speed=Xt(s.playbackRate,L.defaults.playbackRate),this._resolve=_,this._completed=0,this._inlineStyles=i.map((t=>t.getAttribute("style"))),i.forEach(((t,e)=>{const i=t[h],a=We.some((t=>s.hasOwnProperty(t))),l=(o?o.duration:zt(Xt(s.duration,L.defaults.duration),t,e,r))*T,c=zt(Xt(s.delay,L.defaults.delay),t,e,r)*T,d=Xt(s.composition,"replace");for(let o in s){if(!U(o))continue;const h={},u={iterations:v,direction:b,fill:"forwards",easing:x,duration:l,delay:c,composite:d},p=s[o],g=!!a&&(f.includes(o)?o:m.get(o));let _;if(P(p)){const s=p,a=Xt(s.ease,n),m=a.ease&&a,f=s.to,y=s.from;if(u.duration=(m?m.duration:zt(Xt(s.duration,l),t,e,r))*T,u.delay=zt(Xt(s.delay,c),t,e,r)*T,u.composite=Xt(s.composition,d),u.easing=Ie(a),_=je(t,o,y,f,e,r),g?(h[`--${g}`]=_,i[g]=_):h[o]=je(t,o,y,f,e,r),qe(this,t,o,h,u),!I(y))if(g){const e=`--${g}`;t.style.setProperty(e,h[e][0])}else t.style[o]=h[o][0]}else _=O(p)?p.map((s=>Qe(o,s,t,e,r))):Qe(o,p,t,e,r),g?(h[`--${g}`]=_,i[g]=_):h[o]=_,qe(this,t,o,h,u)}if(a){let e=p;for(let t in i)e+=`${g[t]}var(--${t})) `;t.style.transform=e}})),l&&this.autoplay.link(this)}forEach(t){const e=R(t)?e=>e[t]():t;return this.animations.forEach(e),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:u);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const Ze={animate:(t,e)=>new Ge(t,e),convertEase:Me},Je=(t=_)=>new ne({duration:1*L.timeScale,onComplete:t},null,0).resume();function Ke(t,e,s){const i=Ft(t);if(!i.length)return;const[r]=i,n=Wt(r,e),o=Te(e,r,n);let h=Ht(r,o);if(I(s))return h;if(qt(h,jt),0===jt.t||1===jt.t){if(!1===s)return jt.n;{const t=ke(r,jt,s,!1);return`${lt(t.n,L.precision)}${t.u}`}}}const ts=(t,e)=>{if(!I(e))return e.duration=c,e.composition=Xt(e.composition,i.none),new Pe(t,e,null,0,!0).resume()},es=(t,e,s)=>{let i=!1;return yt(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,h=Te(s,n,o);(!h||h&&h===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),vt(e,r),ee(r),i=!0)}}),!0),i},ss=(t,e,s)=>{const i=Nt(t),r=e||Bt,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];Ue(e,s,n)}let o;if(r._hasChildren){let e=0;yt(r,(n=>{if(!n._hasChildren)if(o=es(i,n,s),o&&!n._head)n.cancel(),vt(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?ss(t,n,s):n._hasChildren=!1}),!0),I(r.iterationDuration)||(r.iterationDuration=e)}else o=es(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},is=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),rs=(t,e,s,i)=>{let r=u/L.defaults.frameRate;if(!1!==i){const t=i||Bt._hasChildren&&Bt;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},ns=t=>(...e)=>{const s=t(...e);return new Proxy(_,{apply:(t,e,[i])=>s(i),get:(t,e)=>ns(((...t)=>{const i=hs[e](...t);return t=>i(s(t))}))})},os=(t,e=0)=>(...s)=>(s.length<t.length?ns(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),hs={$:Ft,get:Ke,set:ts,remove:ss,cleanInlineStyles:$e,random:ut,randomPick:t=>t[ut(0,t.length-1)],shuffle:pt,lerp:rs,sync:Je,keepTime:xt,clamp:os(ht),round:os(lt),snap:os(ct),wrap:os(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:os(dt,1),mapRange:os(is),roundPad:os(((t,e)=>(+t).toFixed(e))),padStart:os(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:os(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:os((t=>t*nt/180)),radToDeg:os((t=>180*t/nt))},as=(t,e)=>{let s=t.iterationDuration;if(s===c&&(s=0),I(e))return s;if(M(+e))return+e;const i=e,r=t?t.labels:null,n=!X(r),o=((t,e)=>{if(N(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),h=!I(o),a=C.exec(i);if(a){const t=a[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=h?o:n?l:s,d=+e[1];return Ut(c,d,t[0])}return h?o:n?I(r[i])?s:r[i]:s};function ls(t,e,s,i,r,n){const o=M(t.duration)&&t.duration<=c?s-c:s;St(e,o,1,1,1);const h=i?new Pe(i,t,e,o,!1,r,n):new ne(t,e,o);return h.init(1),bt(e,h),yt(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return mt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||c}(e),e}class cs extends ne{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=L.defaults;this.defaults=e?_t(e,s):s,this.onRender=t.onRender||s.onRender;const i=Xt(t.playbackEase,s.playbackEase);this._ease=i?be(i):null,this.iterationDuration=0}add(t,e,s){const i=P(e),r=P(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(Y(s)){const e=s,r=Nt(t),n=this.duration,o=this.iterationDuration,h=i.id;let a=0;const l=r.length;r.forEach((t=>{const s={...i};this.duration=n,this.iterationDuration=o,I(h)||(s.id=h+"-"+a),ls(s,this,e(t,a,l,this),t,a,l),a++}))}else ls(i,this,as(this,s),t)}else ls(t,this,as(this,e));return this.init(1)}}sync(t,e){if(I(t)||t&&I(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,ease:"linear"},e)}set(t,e,s){return I(e)?this:(e.duration=c,e.composition=i.replace,this.add(t,e,s))}call(t,e){return I(t)||t&&!Y(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return I(t)||t&&!R(t)||(this.labels[t]=as(this,e)),this}remove(t,e){return ss(t,this,e),this}stretch(t){const e=this.duration;if(e===ft(t))return this;const s=t/e,i=this.labels;yt(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return yt(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),yt(this,(t=>t.revert),!0),$e(this)}then(t){return super.then(t)}}class ds{constructor(t,e){B.current&&B.current.register(this);const s={},r={};if(this.targets=[],this.animations={},!I(t)&&!I(e)){for(let t in e){const i=e[t];U(t)?r[t]=i:s[t]=i}for(let e in r){const n=r[e],o=P(n);let h={},a="+=0";if(o){const t=n.unit;R(t)&&(a+=t)}else h.duration=n;h[e]=o?_t({to:a},n):a;const l=_t(s,h);l.composition=i.replace,l.autoplay=!1;const c=this.animations[e]=new Pe(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(I(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return yt(c,(e=>{if(O(t))for(let s=0,i=t.length;s<i;s++)I(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;I(s)||(e._ease=be(s)),e._currentTime=0})),I(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=_,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}class us{constructor(t={}){this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/u,this.maxIterations=this.maxDuration/this.timeStep/u,this.m=ht(Xt(t.mass,1),0,u),this.s=ht(Xt(t.stiffness,100),1,u),this.d=ht(Xt(t.damping,10),.1,u),this.v=ht(Xt(t.velocity,0),-1e3,u),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?K(-n*e*s)*(1*Z(i*n)+r*G(i*n)):(1+r*n)*K(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:h}=this,a=this.w0=ht(j(o/r),c,u),l=this.zeta=n/(2*j(o*r)),d=this.wd=l<1?a*j(1-l*l):0;this.b=l<1?(l*a-h)/d:-h+a;let p=0,m=0,f=0;for(;m<t&&f<e;)J(1-this.solve(p))<s?m++:m=0,this.solverDuration=p,p+=i,f++;this.duration=lt(this.solverDuration*u,0)*L.timeScale}get mass(){return this.m}set mass(t){this.m=ht(Xt(t,1),0,u),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=ht(Xt(t,100),1,u),this.compute()}get damping(){return this.d}set damping(t){this.d=ht(Xt(t,10),.1,u),this.compute()}get velocity(){return this.v}set velocity(t){this.v=ht(Xt(t,0),-1e3,u),this.compute()}}const ps=t=>new us(t),ms=t=>{t.cancelable&&t.preventDefault()};class fs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:_,remove:_}}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 gs{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 _s=(t,e)=>t&&Y(t)?t(e):t;let ys=0;class vs{constructor(t,i={}){if(!t)return;B.current&&B.current.register(this);const r=i.x,n=i.y,o=i.trigger,h=i.modifier,a=i.releaseEase,l=a&&be(a),c=!I(a)&&!I(a.ease),u=P(r)&&!I(r.mapTo)?r.mapTo:"translateX",p=P(n)&&!I(n.mapTo)?n.mapTo:"translateY",m=_s(i.container,this);this.containerArray=O(m)?m:null,this.$container=m&&!this.containerArray?Nt(m)[0]:s.body,this.useWin=this.$container===s.body,this.$scrollContainer=this.useWin?e:this.$container,this.$target=P(t)?new fs(t):Nt(t)[0],this.$trigger=Nt(o||t)[0],this.fixed="fixed"===Ke(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?a:ps({mass:Xt(i.releaseMass,1),stiffness:Xt(i.releaseStiffness,80),damping:Xt(i.releaseDamping,20)}),this.releaseYSpring=c?a:ps({mass:Xt(i.releaseMass,1),stiffness:Xt(i.releaseStiffness,80),damping:Xt(i.releaseDamping,20)}),this.releaseEase=l||ye.outQuint,this.hasReleaseSpring=c,this.onGrab=i.onGrab||_,this.onDrag=i.onDrag||_,this.onRelease=i.onRelease||_,this.onUpdate=i.onUpdate||_,this.onSettle=i.onSettle||_,this.onSnap=i.onSnap||_,this.onResize=i.onResize||_,this.onAfterResize=i.onAfterResize||_,this.disabled=[0,0];const f={};if(h&&(f.modifier=h),I(r)||!0===r)f[u]=0;else if(P(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===r&&(f[u]=0,this.disabled[0]=1);if(I(n)||!0===n)f[p]=0;else if(P(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 ds(this.$target,f),this.xProp=u,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=[-1e12,d,d,-1e12],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 gs(this.$target),this.overshootCoords={x:0,y:0},this.overshootXTicker=new ne({autoplay:!1},null,0).init(),this.overshootYTicker=new ne({autoplay:!1},null,0).init(),this.updateTicker=new ne({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),this.contained=!I(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]?u:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=rt(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 ne({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),P(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,h=this.minVelocity,a=this.maxVelocity,l=this.velocityStackIndex;n[l]=lt(ht(j(t*t+e*e)/r*o,h,a),5);const c=it(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=lt(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=ct(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=lt(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=ct(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return lt(this.animate[this.xProp](),L.precision)}set x(t){this.setX(t,!1)}get y(){return lt(this.animate[this.yProp](),L.precision)}set y(t){this.setY(t,!1)}get progressX(){return is(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(is(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return is(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(is(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=lt(this.useWin?e.scrollX:this.$container.scrollLeft,0),s=lt(this.useWin?e.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,h=this.scrollThreshold;this.scroll.x=t,this.scroll.y=s,this.scrollBounds[0]=s-this.targetBounds[0]+i-h,this.scrollBounds[1]=t-this.targetBounds[1]-r+h,this.scrollBounds[2]=s-this.targetBounds[2]-n+h,this.scrollBounds[3]=t-this.targetBounds[3]+o-h}updateBoundingValues(){const t=this.$container,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 h=this.window[0]=e.innerWidth,a=this.window[1]=e.innerHeight,l=this.useWin,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?ht(c,h,c):c,this.scrollView[1]=l?ht(d,a,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:x,right:T,bottom:w}=t.getBoundingClientRect();this.dragArea[2]=lt(l?ht(y,h,h):y,0),this.dragArea[3]=lt(l?ht(v,a,a):v,0);const S=Ke(t,"overflow"),k="visible"===S,$="hidden"===S;if(this.canScroll=!u&&this.contained&&(t===s.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!O(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,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=lt(r.top+s-(l?0:x),0),this.targetBounds[1]=lt(r.right+e-(l?h:T),0),this.targetBounds[2]=lt(r.bottom+s-(l?a:w),0),this.targetBounds[3]=lt(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]+_):(this.containerBounds[0]=-lt(r.top-(u?ht(x,0,a):x)+o-m,0),this.containerBounds[1]=-lt(r.right-(u?ht(T,0,h):T)-c+f,0),this.containerBounds[2]=-lt(r.bottom-(u?ht(w,0,a):w)-d+g,0),this.containerBounds[3]=-lt(r.left-(u?ht(b,0,h):b)+n-_,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,[h,a]=this.disabled,l=!h&&e<o||!h&&e>r,c=!a&&s<i||!a&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,i=t.x,r=t.y,n=_s(t.container,this),o=_s(t.containerPadding,this)||0,h=O(o)?o:[o,o,o,o],a=this.x,l=this.y,c=_s(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=O(n)?n:null,this.$container=n&&!this.containerArray?Nt(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=Xt(h,[0,0,0,0]),this.containerFriction=ht(Xt(_s(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=ht(Xt(_s(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=_s(P(i)&&!I(i.snap)?i.snap:t.snap,this),this.snapY=_s(P(r)&&!I(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Xt(_s(t.scrollSpeed,this),1.5),this.scrollThreshold=Xt(_s(t.scrollThreshold,this),20),this.dragSpeed=Xt(_s(t.dragSpeed,this),1),this.minVelocity=Xt(_s(t.minVelocity,this),0),this.maxVelocity=Xt(_s(t.maxVelocity,this),50),this.velocityMultiplier=Xt(_s(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(ht(a,f,p),!0),this.setY(ht(l,u,m),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],h=this.dragArea[3],a=this.scroll.x,l=this.scroll.y,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?ht(c,this.window[0],c):c,p=this.useWin?ht(d,this.window[1],d):d,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,_=this.scrollThreshold,[y,v]=this.coords,[b,x,T,w]=this.scrollBounds,S=lt(ht((v-b+t)/_,-1,0)*g,0),k=lt(ht((y-x-e)/_,0,1)*g,0),$=lt(ht((v-T-s)/_,0,1)*g,0),C=lt(ht((y-w+i)/_,-1,0)*g,0);if(S||$||C||k){const[t,e]=this.disabled;let s=a,i=l;t||(s=lt(ht(a+(C||k),0,r-o),0),this.coords[0]-=a-s),e||(i=lt(ht(l+(S||$),0,n-h),0),this.coords[1]-=l-i),this.useWin?this.$scrollContainer.scrollBy(-(a-s),-(l-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,h,a,l]=this.pointer;this.coords[0]+=(r-a)*this.dragSpeed,this.coords[1]+=(n-l)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-a,n-l),this.angle=rt(n-h,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return ss(this,null,"x"),ss(this,null,"y"),ss(this,null,"progressX"),ss(this,null,"progressY"),ss(this.scroll),ss(this.overshootCoords),this}scrollInView(t,e=0,s=ye.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,h=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[a,l,c,u]=o,p=lt(ht(r-a,-1e12,0),0),m=lt(ht(i-l,0,d),0),f=lt(ht(r-c,0,d),0),g=lt(ht(i-u,-1e12,0),0);new Pe(n,{x:lt(n.x+(g?g-e:m?m+e:0),0),y:lt(n.y+(p?p-e:f?f+e:0),0),duration:I(t)?350*L.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then((()=>{this.canScroll=h}))}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=ts(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=ye.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,h,a]=this.containerPadding,l=this.scroll.y-this.targetBounds[0]+n+e,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-h-e,u=this.scroll.x-this.targetBounds[3]+a+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=ht(ct(i,this.snapX),u,c),h=ht(ct(r,this.snapY),l,d),a=I(t)?350*L.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,a,s),n||2!==p&&3!==p||this.animate[this.yProp](h,a,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:h}=this.transforms.normalizePoint(r,n),[a,l,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/u:m<a?a+(m-a)/u:m:m,this.pointer[0]=o,this.pointer[1]=h,this.pointer[2]=o,this.pointer[3]=h,this.pointer[4]=o,this.pointer[5]=h,this.pointer[6]=o,this.pointer[7]=h,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=Ke(this.$target,"zIndex",!1);ys=(f>ys?f:ys)+1,this.targetStyles=ts(this.$target,{zIndex:ys}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=ts(s.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,ye.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],h=n-this.pointer[7];let a=t.target,l=!1,c=!1,d=!1;for(;e&&a&&a!==this.$trigger;){const t=Ke(a,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=a;if(e>s){d=!0,l=t<=3,c=t>=e-s-3;break}}a=a.parentNode}d&&(!l&&!c||l&&h<0||c&&h>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):(ms(t),this.triggerStyles||(this.triggerStyles=ts(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",ms,{passive:!1}),this.$trigger.addEventListener("touchmove",ms,{passive:!1}),this.$trigger.addEventListener("touchend",ms),(!this.disabled[0]&&J(o)>3||!this.disabled[1]&&J(h)>3)&&(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,[r,n,o,h,a,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,_=this.releaseYSpring,y=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,x=this.x,T=this.y,w=this.computeVelocity(r-a,n-l),S=this.angle=rt(n-h,r-o),k=150*w,$=(1-this.releaseContainerFriction)*this.dragSpeed,C=x+Z(S)*k,E=T+G(S)*k,B=C>d?d+(C-d)*$:C<p?p+(C-p)*$:C,D=E>u?u+(E-u)*$:E<c?c+(E-c)*$:E,A=this.destX=ht(lt(ct(B,this.snapX),5),p,d),N=this.destY=ht(lt(ct(D,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,C,E);let O=0,P=0,M=y,R=y,Y=0;if(b.x=x,b.y=T,!t){const t=A===d?x>d?-1:1:x<p?-1:1,s=lt(x-A,0);g.velocity=e&&v?s?k*t/J(s):0:w;const{ease:i,duration:r,restDuration:n}=g;O=x===A?0:v?r:r-n*L.timeScale,v&&(M=i),O>Y&&(Y=O)}if(!e){const e=N===u?T>u?-1:1:T<c?-1:1,s=lt(T-N,0);_.velocity=t&&v?s?k*e/J(s):0:w;const{ease:i,duration:r,restDuration:n}=_;P=T===N?0:v?r:r-n*L.timeScale,v&&(R=i),P>Y&&(Y=P)}if(!v&&F&&$&&(O||P)){const t=i.blend;new Pe(b,{x:{to:B,duration:.65*O},y:{to:D,duration:.65*P},ease:y,composition:t}).init(),new Pe(b,{x:{to:A,duration:O},y:{to:N,duration:P},ease:y,composition:t}).init(),this.overshootXTicker.stretch(O).restart(),this.overshootYTicker.stretch(P).restart()}else t||this.animate[this.xProp](A,O,M),e||this.animate[this.yProp](N,P,R);this.scrollInView(Y,this.scrollThreshold,y);let I=!1;A!==m&&(this.snapped[0]=A,this.snapX&&(I=!0)),N!==f&&this.snapY&&(this.snapped[1]=N,this.snapY&&(I=!0)),I&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",ms),this.$trigger.removeEventListener("touchmove",ms),this.$trigger.removeEventListener("touchend",ms),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=ts(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":ms(t)}}}class bs{constructor(t={}){B.current&&B.current.register(this);const i=t.root;let r=s;i&&(r=i.current||i.nativeElement||Nt(i)[0]||s);const n=t.defaults,o=L.defaults,h=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={},h)for(let t in h){const s=e.matchMedia(h[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);Y(e)&&this.revertConstructors.push(e)}))})),this}add(t,e){if(this.once=!1,Y(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);Y(t)&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}addOnce(t){if(this.once=!0,Y(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute((()=>{const t=s(this);Y(t)&&this.revertConstructorsOnce.push(t)}))}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(Y(s))return s(this);const i=xt(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,h=s.length,a=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;h--;)s[h].revert();for(;a--;)i[a](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 xs=(t,e)=>t&&Y(t)?t(e):t,Ts=new Map;class ws{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.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 ne({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;yt(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new ne({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,h=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),h&&(this.backwardY=i>n),this.velocity=lt(e>0?Math.sqrt(o*o+h*h)/e:0,5)}}).init(),this.resizeTicker=new ne({autoplay:!1,duration:250*L.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new ne({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=lt(t?e.scrollX:s.scrollLeft,0),this.scrollY=lt(t?e.scrollY:s.scrollTop,0)}updateWindowBounds(){this.winWidth=e.innerWidth,this.winHeight=(()=>{const t=document.createElement("div");s.body.appendChild(t),t.style.height="100lvh";const e=t.offsetHeight;return s.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){yt(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),yt(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.unobserve(this.element),(this.useWin?e:this.element).removeEventListener("scroll",this),Ts.delete(this.element)}}const Ss=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,h="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:a,u:l}=qt(h,jt);let c=a;return"%"===l?c=a/100*s:l&&(c=ke(t,jt,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},ks=(t,e,s,i,r)=>{let n;if(R(e)){const o=C.exec(e);if(o){const h=o[0],a=h[0],l=e.split(h),c="min"===l[0],d="max"===l[0],u=Ss(t,l[0],s,i,r),p=Ss(t,l[1],s,i,r);if(c){const e=Ut(Ss(t,"min",s),p,a);n=e<u?u:e}else if(d){const e=Ut(Ss(t,"max",s),p,a);n=e>u?u:e}else n=Ut(u,p,a)}else n=Ss(t,e,s,i,r)}else n=e;return lt(n,0)},$s=t=>{let e;const s=t.targets;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i[n]){e=i;break}}return e};let Cs=0;const Es=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Bs{constructor(t={}){B.current&&B.current.register(this);const e=Xt(t.sync,"play pause"),i=e?be(e):null,r=e&&("linear"===e||e===oe),n=e&&!(i===oe&&!r),o=e&&(M(e)||!0===e||r),h=e&&R(e)&&!n&&!o,a=h?e.split(" ").map((t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null})):null,l=h&&a.length>2;this.index=Cs++,this.id=I(t.id)?this.index:t.id,this.container=(t=>{const e=t&&Nt(t)[0]||s.body;let i=Ts.get(e);return i||(i=new ws(e),Ts.set(e,i)),i})(t.container),this.target=null,this.linked=null,this.repeat=null,this.horizontal=null,this.enter=null,this.leave=null,this.sync=n||o||!!a,this.syncEase=n?i:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=a&&!l&&a[0]?a[0]:_,this.onSyncLeave=a&&!l&&a[1]?a[1]:_,this.onSyncEnterForward=a&&l&&a[0]?a[0]:_,this.onSyncLeaveForward=a&&l&&a[1]?a[1]:_,this.onSyncEnterBackward=a&&l&&a[2]?a[2]:_,this.onSyncLeaveBackward=a&&l&&a[3]?a[3]:_,this.onEnter=t.onEnter||_,this.onLeave=t.onLeave||_,this.onEnterForward=t.onEnterForward||_,this.onLeaveForward=t.onLeaveForward||_,this.onEnterBackward=t.onEnterBackward||_,this.onLeaveBackward=t.onLeaveBackward||_,this.onUpdate=t.onUpdate||_,this.onSyncComplete=t.onSyncComplete||_,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=Xt(t.debug,!1),this._next=null,this._prev=null,bt(this.container,this),Je((()=>{if(!this.reverted){if(!this.target){const e=Nt(t.target)[0];this.target=e||s.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;I(t.targets)?yt(t,(t=>{t.targets&&!e&&(e=$s(t))})):e=$s(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:lt(ht(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=Xt(xs(t.repeat,this),!0),this.horizontal="x"===Xt(xs(t.axis,this),"y"),this.enter=Xt(xs(t.enter,this),"end start"),this.leave=Xt(xs(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"),h=Es[this.index%Es.length],a=t.useWin,l=a?t.winWidth:t.width,c=a?t.winHeight:t.height,d=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,_=e?g:15,y=e?60:g,v=e?y:_,b=e?"repeat-x":"repeat-y",x=t=>e?"0px "+t+"px":t+"px 2px",T=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?d: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?l:g,e?g:c)}`,i||(n.style.cssText+=`background:\n ${T("#FFFF")}${x(g-10)} / 100px 100px ${b},\n ${T("#FFF8")}${x(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${w("relative",0,0,e?d:g,e?g:u)}`,i||(o.style.cssText+=`background:\n ${T("#FFFF")}${x(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${T("#FFF8")}${x(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const S=[" enter: "," leave: "];this.coords.forEach(((t,i)=>{const r=i>1,a=(r?0:this.offset)+t,m=i%2,f=a<v,g=a>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,x=s.createElement("div"),T=s.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?y:_)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;T.innerHTML=`${this.id}${S[m]}${this.thresholds[i]}`,x.style.cssText=`${w("absolute",0,0,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-${k}: 2px solid ${h};\n `,T.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${_};\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?h:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":h};\n border: 2px solid ${m?h:"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 `,x.appendChild(T);let C=a-$+(e?1:0);x.style[e?"left":"top"]=`${C}px`,(r?n:o).appendChild(x)})),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),i||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Ke(t.element,"position")&&(this.debugStyles=ts(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,h=e,a=0,l=0,c=h;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===Ke(i.element,"position")&&ts(i.element,{position:"relative "});for(;h&&h!==i.element&&h!==s.body;){const e="sticky"===Ke(h,"position")&&ts(h,{position:"static"});h===c&&(a+=h.offsetLeft||0,l+=h.offsetTop||0,c=h.offsetParent),h=h.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?a:l,p=r?e.offsetWidth:e.offsetHeight,m=r?i.width:i.height,f=(r?i.scrollWidth:i.scrollHeight)-m,g=this.enter,_=this.leave;let y="start",v="end",b="end",x="start";if(R(g)){const t=g.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(P(g)){const t=g;I(t.container)||(b=t.container),I(t.target)||(y=t.target)}else M(g)&&(b=g);if(R(_)){const t=_.split(" ");x=t[0],v=t.length>1?t[1]:v}else if(P(_)){const t=_;I(t.container)||(x=t.container),I(t.target)||(v=t.target)}else M(_)&&(x=_);const T=ks(e,y,p),w=ks(e,v,p),S=T+u-m,k=w+u-f,$=ks(e,b,m,S,k),C=ks(e,x,m,S,k),E=T+u-$,B=w+u-C,L=B-E;this.offsets[0]=a,this.offsets[1]=l,this.offset=u,this.offsetStart=E,this.offsetEnd=B,this.distance=L<=0?0:L,this.thresholds=[y,v,b,x],this.coords=[T,w,$,C],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,h=this.scroll,a=h<=this.offsetStart,l=h>=this.offsetEnd,c=!a&&!l,d=h===this.offsetStart||h===this.offsetEnd,u=!this.hasEntered&&d,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(a&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&M(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=lt(rs(e,g,dt(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 vt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}const Ls=!I(Intl)&&Intl.Segmenter,Ds=/\{value\}/g,As=/\{i\}/g,Ns=/(\s+)/,Fs=/^\s+$/,Os="line",Ps="word",Ms="char",Rs="data-line";let Ys=null,Is=null,Xs=null;const zs=t=>t.isWordLike||" "===t.segment||M(+t.segment),Ws=t=>t.setAttribute("aria-hidden","true"),Vs=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Hs={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},Us=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&Us(e)}},qs=(t,e,s)=>{const i=t.getAttribute(Rs);(null!==i&&+i!==e||"BR"===t.tagName)&&s.add(t);let r=t.childElementCount;for(;r--;)qs(t.children[r],e,s);return s},Qs=(t,e={})=>{let s="";const i=R(e.class)?` class="${e.class}"`:"",r=Xt(e.clone,!1),n=Xt(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},js=(t,e,s,i,r,n,o,h,a)=>{const l=r===Os,c=r===Ms,d=`_${r}_`,u=Y(t)?t(s):t,p=l?"block":"inline-block";Xs.innerHTML=u.replace(Ds,`<i class="${d}"></i>`).replace(As,`${c?a:l?o:h}`);const m=Xs.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,_=m.querySelectorAll(`i.${d}`),y=_.length;if(y){f.style.display=p,g.style.display=p,g.setAttribute(Rs,`${o}`),l||(g.setAttribute("data-word",`${h}`),c&&g.setAttribute("data-char",`${a}`));let t=y;for(;t--;){const e=_[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 ${Hs[r]}`),f};class Gs{constructor(e,i={}){Ys||(Ys=Ls?new Ls([],{granularity:Ps}):{segment:t=>{const e=[],s=t.split(Ns);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Fs.test(i)})}return e}}),Is||(Is=Ls?new Ls([],{granularity:"grapheme"}):{segment:t=>[...t].map((t=>({segment:t})))}),!Xs&&t&&(Xs=s.createElement("template")),B.current&&B.current.register(this);const{words:r,chars:n,lines:o,accessible:h,includeSpaces:a,debug:l}=i,c=(e=O(e)?e[0]:e)&&e.nodeType?e:(At(e)||[])[0],d=!0===o?{}:o,u=!0===r||I(r)?{}:r,p=!0===n?{}:n;this.debug=Xt(l,!1),this.includeSpaces=Xt(a,!1),this.accessible=Xt(h,!0),this.linesOnly=d&&!u&&!p,this.lineTemplate=P(d)?Qs(Os,d):d,this.wordTemplate=P(u)||this.linesOnly?Qs(Ps,u):u,this.charTemplate=P(p)?Qs(Ms,p):p,this.$target=c,this.html=c&&c.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&&(d||u||p)&&this.split();this.resizeObserver=new ResizeObserver((()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((()=>{const t=c.offsetWidth;t!==this.width&&(this.width=t,m())}),150)})),this.lineTemplate&&!this.ready?s.fonts.ready.then(m):m(),c?this.resizeObserver.observe(c):console.warn("No Text Splitter target found.")}addEffect(t){if(!Y(t))return console.warn("Effect must return a function.");const e=xt(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=>Y(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 h=[],a=this.words,l=this.chars,c=Ys.segment(o),d=s.createDocumentFragment();let u=null;for(const t of c){const e=t.segment,s=zs(t);if(!u||s&&u&&zs(u))h.push(e);else{const t=h.length-1;h[t].includes(" ")||e.includes(" ")?h.push(e):h[t]+=e}u=t}for(let t=0,o=h.length;t<o;t++){const o=h[t];if(o.trim()){const c=h[t+1],u=r&&c&&!c.trim(),p=o,m=i?Is.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],h=e===r-1&&u?o.segment+" ":o.segment,c=s.createTextNode(h);js(i,l,c,f,Ms,n,-1,a.length,l.length)}}e?js(e,a,f,d,Ps,n,-1,a.length,l.length):i?d.appendChild(f):d.appendChild(s.createTextNode(o)),u&&t++}else{if(t&&r)continue;d.appendChild(s.createTextNode(o))}}t.parentNode.replaceChild(d,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,h="loading"!==s.fonts.status,a=r&&h;this.ready=!r||h,i||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),a&&(this.effectsCleanups.forEach((t=>Y(t)&&t(this))),i&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Vs(e,Ps))),o&&(a||n)&&(this.chars=Vs(e,Ms));const l=this.words.length?this.words:this.chars;let c,d=0;for(let t=0,e=l.length;t<e;t++){const e=l[t],{top:s,height:i}=e.getBoundingClientRect();c&&s-c>.5*i&&d++,e.setAttribute(Rs,`${d}`);const r=e.querySelectorAll(`[${Rs}]`);let n=r.length;for(;n--;)r[n].setAttribute(Rs,`${d}`);c=s}if(a){const t=s.createDocumentFragment(),i=new Set,h=[];for(let t=0;t<d+1;t++){const s=e.cloneNode(!0);qs(s,t,new Set).forEach((t=>{const e=t.parentElement;e&&i.add(e),t.remove()})),h.push(s)}i.forEach(Us);for(let e=0,s=h.length;e<s;e++)js(r,this.lines,h[e],t,Os,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Vs(e,Ps)),o&&(this.chars=Vs(e,Ms))}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((a||t)&&this.effects.forEach(((t,e)=>this.effectsCleanups[e]=t(this))),this.accessible&&(a||!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(Ws),this.words.forEach(Ws),this.chars.forEach(Ws)}return this.width=e.offsetWidth,this}refresh(){this.split(!0)}}const Zs={split:(t,e)=>new Gs(t,e)};exports.Animatable=ds,exports.Draggable=vs,exports.JSAnimation=Pe,exports.Scope=bs,exports.ScrollObserver=Bs,exports.Spring=us,exports.TextSplitter=Gs,exports.Timeline=cs,exports.Timer=ne,exports.WAAPIAnimation=Ge,exports.animate=(t,e)=>new Pe(t,e,null,0,!1).init(),exports.createAnimatable=(t,e)=>new ds(t,e),exports.createDraggable=(t,e)=>new vs(t,e),exports.createScope=t=>new bs(t),exports.createSpring=ps,exports.createTimeline=t=>new cs(t).init(),exports.createTimer=t=>new ne(t,null,0).init(),exports.eases=ye,exports.engine=Bt,exports.onScroll=(t={})=>new Bs(t),exports.scrollContainers=Ts,exports.stagger=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,h=!I(o),a=h&&!I(o.ease)?o.ease:h?be(o):null,l=e.grid,c=e.axis,d=e.total,u=I(r)||0===r||"first"===r,m="center"===r,f="last"===r,g="random"===r,_=O(t),y=e.use,v=q(_?t[0]:t),b=_?q(t[1]):0,x=S.exec((_?t[1]:t)+p),T=e.start||0+(_?v:0);let w=u?0:M(r)?r:0;return(t,r,o,h)=>{const[u]=Ft(t),p=I(d)?o:d,S=!I(y)&&(Y(y)?y(u,r,p):Ht(u,y)),k=M(S)||R(S)&&M(+S)?+S:r;if(m&&(w=(p-1)/2),f&&(w=p-1),!s.length){for(let t=0;t<p;t++){if(l){const e=m?(l[0]-1)/2:w%l[0],i=m?(l[1]-1)/2:et(w/l[0]),r=e-t%l[0],n=i-et(t/l[0]);let o=j(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(J(w-t));i=it(...s)}a&&(s=s.map((t=>a(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:J(i-t)))),g&&(s=pt(s))}const $=_?(b-v)/i:v;let C=(h?as(h,I(e.start)?h.iterationDuration:T):T)+($*lt(s[k],2)||0);return e.modifier&&(C=e.modifier(C)),x&&(C=`${C}${x[2]}`),C}},exports.svg=Yt,exports.text=Zs,exports.utils=hs,exports.waapi=Ze;
diff --git a/lib/anime.umd.js b/lib/anime.umd.js
index 7ffaa07c..8307f75c 100644
--- a/lib/anime.umd.js
+++ b/lib/anime.umd.js
@@ -1,9 +1,9 @@
/**
* anime.js - UMD
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
-(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.anime={}))})(this,(function(exports){"use strict";const isBrowser=typeof window!=="undefined";const win=isBrowser?window:null;const doc=isBrowser?document:null;const tweenTypes={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4};const valueTypes={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3};const tickModes={NONE:0,AUTO:1,FORCE:2};const compositionTypes={replace:0,none:1,blend:2};const isRegisteredTargetSymbol=Symbol();const isDomSymbol=Symbol();const isSvgSymbol=Symbol();const transformsSymbol=Symbol();const morphPointsSymbol=Symbol();const proxyTargetSymbol=Symbol();const minValue=1e-11;const maxValue=1e12;const K=1e3;const maxFps=120;const emptyString="";const shortTransforms=new Map;shortTransforms.set("x","translateX");shortTransforms.set("y","translateY");shortTransforms.set("z","translateZ");const validTransforms=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"];const transformsFragmentStrings=validTransforms.reduce(((a,v)=>({...a,[v]:v+"("})),{});const noop=()=>{};const hexTestRgx=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;const rgbExecRgx=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;const rgbaExecRgx=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const hslExecRgx=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;const hslaExecRgx=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const digitWithExponentRgx=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;const unitsExecRgx=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx=/([a-z])([A-Z])/g;const transformsExecRgx=/(\w+)(\([^)]+\)+)/g;const relativeValuesExecRgx=/(\*=|\+=|-=)/;const defaults={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:maxFps,loop:0,reversed:false,alternate:false,autoplay:true,duration:K,delay:0,loopDelay:0,ease:"out(2)",composition:compositionTypes.replace,modifier:v=>v,onBegin:noop,onBeforeUpdate:noop,onUpdate:noop,onLoop:noop,onPause:noop,onComplete:noop,onRender:noop};const globals={defaults:defaults,root:doc,scope:null,precision:4,timeScale:1,tickThreshold:200};const globalVersions={version:"4.0.2",engine:null};if(isBrowser){if(!win.AnimeJS)win.AnimeJS=[];win.AnimeJS.push(globalVersions)}const toLowerCase=str=>str.replace(lowerCaseRgx,"$1-$2").toLowerCase();const stringStartsWith=(str,sub)=>str.indexOf(sub)===0;const now=Date.now;const isArr=Array.isArray;const isObj=a=>a&&a.constructor===Object;const isNum=a=>typeof a==="number"&&!isNaN(a);const isStr=a=>typeof a==="string";const isFnc=a=>typeof a==="function";const isUnd=a=>typeof a==="undefined";const isNil=a=>isUnd(a)||a===null;const isSvg=a=>isBrowser&&a instanceof SVGElement;const isHex=a=>hexTestRgx.test(a);const isRgb=a=>stringStartsWith(a,"rgb");const isHsl=a=>stringStartsWith(a,"hsl");const isCol=a=>isHex(a)||isRgb(a)||isHsl(a);const isKey=a=>!globals.defaults.hasOwnProperty(a);const parseNumber=str=>isStr(str)?parseFloat(str):str;const pow=Math.pow;const sqrt=Math.sqrt;const sin=Math.sin;const cos=Math.cos;const abs=Math.abs;const exp=Math.exp;const ceil=Math.ceil;const floor=Math.floor;const asin=Math.asin;const max=Math.max;const atan2=Math.atan2;const PI=Math.PI;const _round=Math.round;const clamp=(v,min,max)=>v<min?min:v>max?max:v;const powCache={};const round=(v,decimalLength)=>{if(decimalLength<0)return v;if(!decimalLength)return _round(v);let p=powCache[decimalLength];if(!p)p=powCache[decimalLength]=10**decimalLength;return _round(v*p)/p};const snap=(v,increment)=>isArr(increment)?increment.reduce(((closest,cv)=>abs(cv-v)<abs(closest-v)?cv:closest)):increment?_round(v/increment)*increment:v;const interpolate=(start,end,progress)=>start+(end-start)*progress;const clampInfinity=v=>v===Infinity?maxValue:v===-Infinity?-1e12:v;const normalizeTime=v=>v<=minValue?minValue:clampInfinity(round(v,11));const cloneArray=a=>isArr(a)?[...a]:a;const mergeObjects=(o1,o2)=>{const merged={...o1};for(let p in o2){const o1p=o1[p];merged[p]=isUnd(o1p)?o2[p]:o1p}return merged};const forEachChildren=(parent,callback,reverse,prevProp="_prev",nextProp="_next")=>{let next=parent._head;let adjustedNextProp=nextProp;if(reverse){next=parent._tail;adjustedNextProp=prevProp}while(next){const currentNext=next[adjustedNextProp];callback(next);next=currentNext}};const removeChild=(parent,child,prevProp="_prev",nextProp="_next")=>{const prev=child[prevProp];const next=child[nextProp];prev?prev[nextProp]=next:parent._head=next;next?next[prevProp]=prev:parent._tail=prev;child[prevProp]=null;child[nextProp]=null};const addChild=(parent,child,sortMethod,prevProp="_prev",nextProp="_next")=>{let prev=parent._tail;while(prev&&sortMethod&&sortMethod(prev,child))prev=prev[prevProp];const next=prev?prev[nextProp]:parent._head;prev?prev[nextProp]=child:parent._head=child;next?next[prevProp]=child:parent._tail=child;child[prevProp]=prev;child[nextProp]=next};class Clock{constructor(initTime=0){this.deltaTime=0;this._currentTime=initTime;this._elapsedTime=initTime;this._startTime=initTime;this._lastTime=initTime;this._scheduledTime=0;this._frameDuration=round(K/maxFps,0);this._fps=maxFps;this._speed=1;this._hasChildren=false;this._head=null;this._tail=null}get fps(){return this._fps}set fps(frameRate){const previousFrameDuration=this._frameDuration;const fr=+frameRate;const fps=fr<minValue?minValue:fr;const frameDuration=round(K/fps,0);this._fps=fps;this._frameDuration=frameDuration;this._scheduledTime+=frameDuration-previousFrameDuration}get speed(){return this._speed}set speed(playbackRate){const pbr=+playbackRate;this._speed=pbr<minValue?minValue:pbr}requestTick(time){const scheduledTime=this._scheduledTime;const elapsedTime=this._elapsedTime;this._elapsedTime+=time-elapsedTime;if(elapsedTime<scheduledTime)return tickModes.NONE;const frameDuration=this._frameDuration;const frameDelta=elapsedTime-scheduledTime;this._scheduledTime+=frameDelta<frameDuration?frameDuration:frameDelta;return tickModes.AUTO}computeDeltaTime(time){const delta=time-this._lastTime;this.deltaTime=delta;this._lastTime=time;return delta}}const render=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const parent=tickable.parent;const duration=tickable.duration;const completed=tickable.completed;const iterationDuration=tickable.iterationDuration;const iterationCount=tickable.iterationCount;const _currentIteration=tickable._currentIteration;const _loopDelay=tickable._loopDelay;const _reversed=tickable._reversed;const _alternate=tickable._alternate;const _hasChildren=tickable._hasChildren;const tickableDelay=tickable._delay;const tickablePrevAbsoluteTime=tickable._currentTime;const tickableEndTime=tickableDelay+iterationDuration;const tickableAbsoluteTime=time-tickableDelay;const tickablePrevTime=clamp(tickablePrevAbsoluteTime,-tickableDelay,duration);const tickableCurrentTime=clamp(tickableAbsoluteTime,-tickableDelay,duration);const deltaTime=tickableAbsoluteTime-tickablePrevAbsoluteTime;const isCurrentTimeAboveZero=tickableCurrentTime>0;const isCurrentTimeEqualOrAboveDuration=tickableCurrentTime>=duration;const isSetter=duration<=minValue;const forcedTick=tickMode===tickModes.FORCE;let isOdd=0;let iterationElapsedTime=tickableAbsoluteTime;let hasRendered=0;if(iterationCount>1){const currentIteration=~~(tickableCurrentTime/(iterationDuration+(isCurrentTimeEqualOrAboveDuration?0:_loopDelay)));tickable._currentIteration=clamp(currentIteration,0,iterationCount);if(isCurrentTimeEqualOrAboveDuration)tickable._currentIteration--;isOdd=tickable._currentIteration%2;iterationElapsedTime=tickableCurrentTime%(iterationDuration+_loopDelay)||0}const isReversed=_reversed^(_alternate&&isOdd);const _ease=tickable._ease;let iterationTime=isCurrentTimeEqualOrAboveDuration?isReversed?0:duration:isReversed?iterationDuration-iterationElapsedTime:iterationElapsedTime;if(_ease)iterationTime=iterationDuration*_ease(iterationTime/iterationDuration)||0;const isRunningBackwards=(parent?parent.backwards:tickableAbsoluteTime<tickablePrevAbsoluteTime)?!isReversed:!!isReversed;tickable._currentTime=tickableAbsoluteTime;tickable._iterationTime=iterationTime;tickable.backwards=isRunningBackwards;if(isCurrentTimeAboveZero&&!tickable.began){tickable.began=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onBegin(tickable)}}else if(tickableAbsoluteTime<=0){tickable.began=false}if(!muteCallbacks&&!_hasChildren&&isCurrentTimeAboveZero&&tickable._currentIteration!==_currentIteration){tickable.onLoop(tickable)}if(forcedTick||tickMode===tickModes.AUTO&&(time>=tickableDelay&&time<=tickableEndTime||time<=tickableDelay&&tickablePrevTime>tickableDelay||time>=tickableEndTime&&tickablePrevTime!==duration)||iterationTime>=tickableEndTime&&tickablePrevTime!==duration||iterationTime<=tickableDelay&&tickablePrevTime>0||time<=tickablePrevTime&&tickablePrevTime===duration&&completed||isCurrentTimeEqualOrAboveDuration&&!completed&&isSetter){if(isCurrentTimeAboveZero){tickable.computeDeltaTime(tickablePrevTime);if(!muteCallbacks)tickable.onBeforeUpdate(tickable)}if(!_hasChildren){const forcedRender=forcedTick||(isRunningBackwards?deltaTime*-1:deltaTime)>=globals.tickThreshold;const absoluteTime=tickable._offset+(parent?parent._offset:0)+tickableDelay+iterationTime;let tween=tickable._head;let tweenTarget;let tweenStyle;let tweenTargetTransforms;let tweenTargetTransformsProperties;let tweenTransformsNeedUpdate=0;while(tween){const tweenComposition=tween._composition;const tweenCurrentTime=tween._currentTime;const tweenChangeDuration=tween._changeDuration;const tweenAbsEndTime=tween._absoluteStartTime+tween._changeDuration;const tweenNextRep=tween._nextRep;const tweenPrevRep=tween._prevRep;const tweenHasComposition=tweenComposition!==compositionTypes.none;if((forcedRender||(tweenCurrentTime!==tweenChangeDuration||absoluteTime<=tweenAbsEndTime+(tweenNextRep?tweenNextRep._delay:0))&&(tweenCurrentTime!==0||absoluteTime>=tween._absoluteStartTime))&&(!tweenHasComposition||!tween._isOverridden&&(!tween._isOverlapped||absoluteTime<=tweenAbsEndTime)&&(!tweenNextRep||(tweenNextRep._isOverridden||absoluteTime<=tweenNextRep._absoluteStartTime))&&(!tweenPrevRep||(tweenPrevRep._isOverridden||absoluteTime>=tweenPrevRep._absoluteStartTime+tweenPrevRep._changeDuration+tween._delay)))){const tweenNewTime=tween._currentTime=clamp(iterationTime-tween._startTime,0,tweenChangeDuration);const tweenProgress=tween._ease(tweenNewTime/tween._updateDuration);const tweenModifier=tween._modifier;const tweenValueType=tween._valueType;const tweenType=tween._tweenType;const tweenIsObject=tweenType===tweenTypes.OBJECT;const tweenIsNumber=tweenValueType===valueTypes.NUMBER;const tweenPrecision=tweenIsNumber&&tweenIsObject||tweenProgress===0||tweenProgress===1?-1:globals.precision;let value;let number;if(tweenIsNumber){value=number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision))}else if(tweenValueType===valueTypes.UNIT){number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision));value=`${number}${tween._unit}`}else if(tweenValueType===valueTypes.COLOR){const fn=tween._fromNumbers;const tn=tween._toNumbers;const r=round(clamp(tweenModifier(interpolate(fn[0],tn[0],tweenProgress)),0,255),0);const g=round(clamp(tweenModifier(interpolate(fn[1],tn[1],tweenProgress)),0,255),0);const b=round(clamp(tweenModifier(interpolate(fn[2],tn[2],tweenProgress)),0,255),0);const a=clamp(tweenModifier(round(interpolate(fn[3],tn[3],tweenProgress),tweenPrecision)),0,1);value=`rgba(${r},${g},${b},${a})`;if(tweenHasComposition){const ns=tween._numbers;ns[0]=r;ns[1]=g;ns[2]=b;ns[3]=a}}else if(tweenValueType===valueTypes.COMPLEX){value=tween._strings[0];for(let j=0,l=tween._toNumbers.length;j<l;j++){const n=tweenModifier(round(interpolate(tween._fromNumbers[j],tween._toNumbers[j],tweenProgress),tweenPrecision));const s=tween._strings[j+1];value+=`${s?n+s:n}`;if(tweenHasComposition){tween._numbers[j]=n}}}if(tweenHasComposition){tween._number=number}if(!internalRender&&tweenComposition!==compositionTypes.blend){const tweenProperty=tween.property;tweenTarget=tween.target;if(tweenIsObject){tweenTarget[tweenProperty]=value}else if(tweenType===tweenTypes.ATTRIBUTE){tweenTarget.setAttribute(tweenProperty,value)}else{tweenStyle=tweenTarget.style;if(tweenType===tweenTypes.TRANSFORM){if(tweenTarget!==tweenTargetTransforms){tweenTargetTransforms=tweenTarget;tweenTargetTransformsProperties=tweenTarget[transformsSymbol]}tweenTargetTransformsProperties[tweenProperty]=value;tweenTransformsNeedUpdate=1}else if(tweenType===tweenTypes.CSS){tweenStyle[tweenProperty]=value}else if(tweenType===tweenTypes.CSS_VAR){tweenStyle.setProperty(tweenProperty,value)}}if(isCurrentTimeAboveZero)hasRendered=1}else{tween._value=value}}if(tweenTransformsNeedUpdate&&tween._renderTransforms){let str=emptyString;for(let key in tweenTargetTransformsProperties){str+=`${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `}tweenStyle.transform=str;tweenTransformsNeedUpdate=0}tween=tween._next}if(!muteCallbacks&&hasRendered){tickable.onRender(tickable)}}if(!muteCallbacks&&isCurrentTimeAboveZero){tickable.onUpdate(tickable)}}if(parent&&isSetter){if(!muteCallbacks&&(parent.began&&!isRunningBackwards&&tickableAbsoluteTime>=duration&&!completed||isRunningBackwards&&tickableAbsoluteTime<=minValue&&completed)){tickable.onComplete(tickable);tickable.completed=!isRunningBackwards}}else if(isCurrentTimeAboveZero&&isCurrentTimeEqualOrAboveDuration){if(iterationCount===Infinity){tickable._startTime+=tickable.duration}else if(tickable._currentIteration>=iterationCount-1){tickable.paused=true;if(!completed&&!_hasChildren){tickable.completed=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onComplete(tickable);tickable._resolve(tickable)}}}}else{tickable.completed=false}return hasRendered};const tick=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const _currentIteration=tickable._currentIteration;render(tickable,time,muteCallbacks,internalRender,tickMode);if(tickable._hasChildren){const tl=tickable;const tlIsRunningBackwards=tl.backwards;const tlChildrenTime=internalRender?time:tl._iterationTime;const tlCildrenTickTime=now();let tlChildrenHasRendered=0;let tlChildrenHaveCompleted=true;if(!internalRender&&tl._currentIteration!==_currentIteration){const tlIterationDuration=tl.iterationDuration;forEachChildren(tl,(child=>{if(!tlIsRunningBackwards){if(!child.completed&&!child.backwards&&child._currentTime<child.iterationDuration){render(child,tlIterationDuration,muteCallbacks,1,tickModes.FORCE)}child.began=false;child.completed=false}else{const childDuration=child.duration;const childStartTime=child._offset+child._delay;const childEndTime=childStartTime+childDuration;if(!muteCallbacks&&childDuration<=minValue&&(!childStartTime||childEndTime===tlIterationDuration)){child.onComplete(child)}}}));if(!muteCallbacks)tl.onLoop(tl)}forEachChildren(tl,(child=>{const childTime=round((tlChildrenTime-child._offset)*child._speed,12);const childTickMode=child._fps<tl._fps?child.requestTick(tlCildrenTickTime):tickMode;tlChildrenHasRendered+=render(child,childTime,muteCallbacks,internalRender,childTickMode);if(!child.completed&&tlChildrenHaveCompleted)tlChildrenHaveCompleted=false}),tlIsRunningBackwards);if(!muteCallbacks&&tlChildrenHasRendered)tl.onRender(tl);if(tlChildrenHaveCompleted&&tl._currentTime>=tl.duration){tl.paused=true;if(!tl.completed){tl.completed=true;if(!muteCallbacks){tl.onComplete(tl);tl._resolve(tl)}}}}};const additive={animation:null,update:noop};const addAdditiveAnimation=lookups=>{let animation=additive.animation;if(!animation){animation={duration:minValue,computeDeltaTime:noop,_offset:0,_delay:0,_head:null,_tail:null};additive.animation=animation;additive.update=()=>{lookups.forEach((propertyAnimation=>{for(let propertyName in propertyAnimation){const tweens=propertyAnimation[propertyName];const lookupTween=tweens._head;if(lookupTween){const valueType=lookupTween._valueType;const additiveValues=valueType===valueTypes.COMPLEX||valueType===valueTypes.COLOR?cloneArray(lookupTween._fromNumbers):null;let additiveValue=lookupTween._fromNumber;let tween=tweens._tail;while(tween&&tween!==lookupTween){if(additiveValues){for(let i=0,l=tween._numbers.length;i<l;i++)additiveValues[i]+=tween._numbers[i]}else{additiveValue+=tween._number}tween=tween._prevAdd}lookupTween._toNumber=additiveValue;lookupTween._toNumbers=additiveValues}}}));render(animation,1,1,0,tickModes.FORCE)}}return animation};const engineTickMethod=isBrowser?requestAnimationFrame:setImmediate;const engineCancelMethod=isBrowser?cancelAnimationFrame:clearImmediate;class Engine extends Clock{constructor(initTime){super(initTime);this.useDefaultMainLoop=true;this.pauseOnDocumentHidden=true;this.defaults=defaults;this.paused=isBrowser&&doc.hidden?true:false;this.reqId=null}update(){const time=this._currentTime=now();if(this.requestTick(time)){this.computeDeltaTime(time);const engineSpeed=this._speed;const engineFps=this._fps;let activeTickable=this._head;while(activeTickable){const nextTickable=activeTickable._next;if(!activeTickable.paused){tick(activeTickable,(time-activeTickable._startTime)*activeTickable._speed*engineSpeed,0,0,activeTickable._fps<engineFps?activeTickable.requestTick(time):tickModes.AUTO)}else{removeChild(this,activeTickable);this._hasChildren=!!this._tail;activeTickable._running=false;if(activeTickable.completed&&!activeTickable._cancelled){activeTickable.cancel()}}activeTickable=nextTickable}additive.update()}}wake(){if(this.useDefaultMainLoop&&!this.reqId&&!this.paused){this.reqId=engineTickMethod(tickEngine)}return this}pause(){this.paused=true;return killEngine()}resume(){if(!this.paused)return;this.paused=false;forEachChildren(this,(child=>child.resetTime()));return this.wake()}get speed(){return this._speed*(globals.timeScale===1?1:K)}set speed(playbackRate){this._speed=playbackRate*globals.timeScale;forEachChildren(this,(child=>child.speed=child._speed))}get timeUnit(){return globals.timeScale===1?"ms":"s"}set timeUnit(unit){const secondsScale=.001;const isSecond=unit==="s";const newScale=isSecond?secondsScale:1;if(globals.timeScale!==newScale){globals.timeScale=newScale;globals.tickThreshold=200*newScale;const scaleFactor=isSecond?secondsScale:K;this.defaults.duration*=scaleFactor;this._speed*=scaleFactor}}get precision(){return globals.precision}set precision(precision){globals.precision=precision}}const engine=(()=>{const engine=new Engine(now());if(isBrowser){globalVersions.engine=engine;doc.addEventListener("visibilitychange",(()=>{if(!engine.pauseOnDocumentHidden)return;doc.hidden?engine.pause():engine.resume()}))}return engine})();const tickEngine=()=>{if(engine._head){engine.reqId=engineTickMethod(tickEngine);engine.update()}else{engine.reqId=0}};const killEngine=()=>{engineCancelMethod(engine.reqId);engine.reqId=0;return engine};const parseInlineTransforms=(target,propName,animationInlineStyles)=>{const inlineTransforms=target.style.transform;let inlinedStylesPropertyValue;if(inlineTransforms){const cachedTransforms=target[transformsSymbol];let t;while(t=transformsExecRgx.exec(inlineTransforms)){const inlinePropertyName=t[1];const inlinePropertyValue=t[2].slice(1,-1);cachedTransforms[inlinePropertyName]=inlinePropertyValue;if(inlinePropertyName===propName){inlinedStylesPropertyValue=inlinePropertyValue;if(animationInlineStyles){animationInlineStyles[propName]=inlinePropertyValue}}}}return inlineTransforms&&!isUnd(inlinedStylesPropertyValue)?inlinedStylesPropertyValue:stringStartsWith(propName,"scale")?"1":stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew")?"0deg":"0px"};function getNodeList(v){const n=isStr(v)?globals.root.querySelectorAll(v):v;if(n instanceof NodeList||n instanceof HTMLCollection)return n}function parseTargets(targets){if(isNil(targets))return[];if(isArr(targets)){const flattened=targets.flat(Infinity);const parsed=[];for(let i=0,l=flattened.length;i<l;i++){const item=flattened[i];if(!isNil(item)){const nodeList=getNodeList(item);if(nodeList){for(let j=0,jl=nodeList.length;j<jl;j++){const subItem=nodeList[j];if(!isNil(subItem)){let isDuplicate=false;for(let k=0,kl=parsed.length;k<kl;k++){if(parsed[k]===subItem){isDuplicate=true;break}}if(!isDuplicate){parsed.push(subItem)}}}}else{let isDuplicate=false;for(let j=0,jl=parsed.length;j<jl;j++){if(parsed[j]===item){isDuplicate=true;break}}if(!isDuplicate){parsed.push(item)}}}}return parsed}if(!isBrowser)return[targets];const nodeList=getNodeList(targets);if(nodeList)return Array.from(nodeList);return[targets]}function registerTargets(targets){const parsedTargetsArray=parseTargets(targets);const parsedTargetsLength=parsedTargetsArray.length;if(parsedTargetsLength){for(let i=0;i<parsedTargetsLength;i++){const target=parsedTargetsArray[i];if(!target[isRegisteredTargetSymbol]){target[isRegisteredTargetSymbol]=true;const isSvgType=isSvg(target);const isDom=target.nodeType||isSvgType;if(isDom){target[isDomSymbol]=true;target[isSvgSymbol]=isSvgType;target[transformsSymbol]={}}}}}return parsedTargetsArray}const getPath=path=>{const parsedTargets=parseTargets(path);const $parsedSvg=parsedTargets[0];if(!$parsedSvg||!isSvg($parsedSvg))return;return $parsedSvg};const morphTo=(path2,precision=.33)=>$path1=>{const $path2=getPath(path2);if(!$path2)return;const isPath=$path1.tagName==="path";const separator=isPath?" ":",";const previousPoints=$path1[morphPointsSymbol];if(previousPoints)$path1.setAttribute(isPath?"d":"points",previousPoints);let v1="",v2="";if(!precision){v1=$path1.getAttribute(isPath?"d":"points");v2=$path2.getAttribute(isPath?"d":"points")}else{const length1=$path1.getTotalLength();const length2=$path2.getTotalLength();const maxPoints=Math.max(Math.ceil(length1*precision),Math.ceil(length2*precision));for(let i=0;i<maxPoints;i++){const t=i/(maxPoints-1);const pointOnPath1=$path1.getPointAtLength(length1*t);const pointOnPath2=$path2.getPointAtLength(length2*t);const prefix=isPath?i===0?"M":"L":"";v1+=prefix+round(pointOnPath1.x,3)+separator+pointOnPath1.y+" ";v2+=prefix+round(pointOnPath2.x,3)+separator+pointOnPath2.y+" "}}$path1[morphPointsSymbol]=v2;return[v1,v2]};const getScaleFactor=$el=>{let scaleFactor=1;if($el&&$el.getCTM){const ctm=$el.getCTM();if(ctm){const scaleX=sqrt(ctm.a*ctm.a+ctm.b*ctm.b);const scaleY=sqrt(ctm.c*ctm.c+ctm.d*ctm.d);scaleFactor=(scaleX+scaleY)/2}}return scaleFactor};const createDrawableProxy=($el,start,end)=>{const pathLength=K;const computedStyles=getComputedStyle($el);const strokeLineCap=computedStyles.strokeLinecap;const $scalled=computedStyles.vectorEffect==="non-scaling-stroke"?$el:null;let currentCap=strokeLineCap;const proxy=new Proxy($el,{get(target,property){const value=target[property];if(property===proxyTargetSymbol)return target;if(property==="setAttribute"){return(...args)=>{if(args[0]==="draw"){const value=args[1];const values=value.split(" ");const v1=+values[0];const v2=+values[1];const scaleFactor=getScaleFactor($scalled);const os=v1*-1e3*scaleFactor;const d1=v2*pathLength*scaleFactor+os;const d2=pathLength*scaleFactor+(v1===0&&v2===1||v1===1&&v2===0?0:10*scaleFactor)-d1;if(strokeLineCap!=="butt"){const newCap=v1===v2?"butt":strokeLineCap;if(currentCap!==newCap){target.style.strokeLinecap=`${newCap}`;currentCap=newCap}}target.setAttribute("stroke-dashoffset",`${os}`);target.setAttribute("stroke-dasharray",`${d1} ${d2}`)}return Reflect.apply(value,target,args)}}if(isFnc(value)){return(...args)=>Reflect.apply(value,target,args)}else{return value}}});if($el.getAttribute("pathLength")!==`${pathLength}`){$el.setAttribute("pathLength",`${pathLength}`);proxy.setAttribute("draw",`${start} ${end}`)}return proxy};const createDrawable=(selector,start=0,end=0)=>{const els=parseTargets(selector);return els.map(($el=>createDrawableProxy($el,start,end)))};const getPathPoint=($path,progress,lookup=0)=>$path.getPointAtLength(progress+lookup>=1?progress+lookup:0);const getPathProgess=($path,pathProperty)=>$el=>{const totalLength=+$path.getTotalLength();const inSvg=$el[isSvgSymbol];const ctm=$path.getCTM();return{from:0,to:totalLength,modifier:progress=>{if(pathProperty==="a"){const p0=getPathPoint($path,progress,-1);const p1=getPathPoint($path,progress,1);return atan2(p1.y-p0.y,p1.x-p0.x)*180/PI}else{const p=getPathPoint($path,progress,0);return pathProperty==="x"?inSvg||!ctm?p.x:p.x*ctm.a+p.y*ctm.c+ctm.e:inSvg||!ctm?p.y:p.x*ctm.b+p.y*ctm.d+ctm.f}}}};const createMotionPath=path=>{const $path=getPath(path);if(!$path)return;return{translateX:getPathProgess($path,"x"),translateY:getPathProgess($path,"y"),rotate:getPathProgess($path,"a")}};const cssReservedProperties=["opacity","rotate","overflow","color"];const isValidSVGAttribute=(el,propertyName)=>{if(cssReservedProperties.includes(propertyName))return false;if(el.getAttribute(propertyName)||propertyName in el){if(propertyName==="scale"){const elParentNode=el.parentNode;return elParentNode&&elParentNode.tagName==="filter"}return true}};const svg={morphTo:morphTo,createMotionPath:createMotionPath,createDrawable:createDrawable};const rgbToRgba=rgbValue=>{const rgba=rgbExecRgx.exec(rgbValue)||rgbaExecRgx.exec(rgbValue);const a=!isUnd(rgba[4])?+rgba[4]:1;return[+rgba[1],+rgba[2],+rgba[3],a]};const hexToRgba=hexValue=>{const hexLength=hexValue.length;const isShort=hexLength===4||hexLength===5;return[+("0x"+hexValue[1]+hexValue[isShort?1:2]),+("0x"+hexValue[isShort?2:3]+hexValue[isShort?2:4]),+("0x"+hexValue[isShort?3:5]+hexValue[isShort?3:6]),hexLength===5||hexLength===9?+(+("0x"+hexValue[isShort?4:7]+hexValue[isShort?4:8])/255).toFixed(3):1]};const hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;return t<1/6?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p};const hslToRgba=hslValue=>{const hsla=hslExecRgx.exec(hslValue)||hslaExecRgx.exec(hslValue);const h=+hsla[1]/360;const s=+hsla[2]/100;const l=+hsla[3]/100;const a=!isUnd(hsla[4])?+hsla[4]:1;let r,g,b;if(s===0){r=g=b=l}else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=round(hue2rgb(p,q,h+1/3)*255,0);g=round(hue2rgb(p,q,h)*255,0);b=round(hue2rgb(p,q,h-1/3)*255,0)}return[r,g,b,a]};const convertColorStringValuesToRgbaArray=colorString=>isRgb(colorString)?rgbToRgba(colorString):isHex(colorString)?hexToRgba(colorString):isHsl(colorString)?hslToRgba(colorString):[0,0,0,1];const setValue=(targetValue,defaultValue)=>isUnd(targetValue)?defaultValue:targetValue;const getFunctionValue=(value,target,index,total,store)=>{if(isFnc(value)){const func=()=>{const computed=value(target,index,total);return!isNaN(+computed)?+computed:computed||0};if(store){store.func=func}return func()}else{return value}};const getTweenType=(target,prop)=>!target[isDomSymbol]?tweenTypes.OBJECT:target[isSvgSymbol]&&isValidSVGAttribute(target,prop)?tweenTypes.ATTRIBUTE:validTransforms.includes(prop)||shortTransforms.get(prop)?tweenTypes.TRANSFORM:stringStartsWith(prop,"--")?tweenTypes.CSS_VAR:prop in target.style?tweenTypes.CSS:prop in target?tweenTypes.OBJECT:tweenTypes.ATTRIBUTE;const getCSSValue=(target,propName,animationInlineStyles)=>{const inlineStyles=target.style[propName];if(inlineStyles&&animationInlineStyles){animationInlineStyles[propName]=inlineStyles}const value=inlineStyles||getComputedStyle(target[proxyTargetSymbol]||target).getPropertyValue(propName);return value==="auto"?"0":value};const getOriginalAnimatableValue=(target,propName,tweenType,animationInlineStyles)=>{const type=!isUnd(tweenType)?tweenType:getTweenType(target,propName);return type===tweenTypes.OBJECT?target[propName]||0:type===tweenTypes.ATTRIBUTE?target.getAttribute(propName):type===tweenTypes.TRANSFORM?parseInlineTransforms(target,propName,animationInlineStyles):type===tweenTypes.CSS_VAR?getCSSValue(target,propName,animationInlineStyles).trimStart():getCSSValue(target,propName,animationInlineStyles)};const getRelativeValue=(x,y,operator)=>operator==="-"?x-y:operator==="+"?x+y:x*y;const createDecomposedValueTargetObject=()=>({t:valueTypes.NUMBER,n:0,u:null,o:null,d:null,s:null});const decomposeRawValue=(rawValue,targetObject)=>{targetObject.t=valueTypes.NUMBER;targetObject.n=0;targetObject.u=null;targetObject.o=null;targetObject.d=null;targetObject.s=null;if(!rawValue)return targetObject;const num=+rawValue;if(!isNaN(num)){targetObject.n=num;return targetObject}else{let str=rawValue;if(str[1]==="="){targetObject.o=str[0];str=str.slice(2)}const unitMatch=str.includes(" ")?false:unitsExecRgx.exec(str);if(unitMatch){targetObject.t=valueTypes.UNIT;targetObject.n=+unitMatch[1];targetObject.u=unitMatch[2];return targetObject}else if(targetObject.o){targetObject.n=+str;return targetObject}else if(isCol(str)){targetObject.t=valueTypes.COLOR;targetObject.d=convertColorStringValuesToRgbaArray(str);return targetObject}else{const matchedNumbers=str.match(digitWithExponentRgx);targetObject.t=valueTypes.COMPLEX;targetObject.d=matchedNumbers?matchedNumbers.map(Number):[];targetObject.s=str.split(digitWithExponentRgx)||[];return targetObject}}};const decomposeTweenValue=(tween,targetObject)=>{targetObject.t=tween._valueType;targetObject.n=tween._toNumber;targetObject.u=tween._unit;targetObject.o=null;targetObject.d=cloneArray(tween._toNumbers);targetObject.s=cloneArray(tween._strings);return targetObject};const decomposedOriginalValue=createDecomposedValueTargetObject();const lookups={_rep:new WeakMap,_add:new Map};const getTweenSiblings=(target,property,lookup="_rep")=>{const lookupMap=lookups[lookup];let targetLookup=lookupMap.get(target);if(!targetLookup){targetLookup={};lookupMap.set(target,targetLookup)}return targetLookup[property]?targetLookup[property]:targetLookup[property]={_head:null,_tail:null}};const addTweenSortMethod=(p,c)=>p._isOverridden||p._absoluteStartTime>c._absoluteStartTime;const overrideTween=tween=>{tween._isOverlapped=1;tween._isOverridden=1;tween._changeDuration=minValue;tween._currentTime=minValue};const composeTween=(tween,siblings)=>{const tweenCompositionType=tween._composition;if(tweenCompositionType===compositionTypes.replace){const tweenAbsStartTime=tween._absoluteStartTime;addChild(siblings,tween,addTweenSortMethod,"_prevRep","_nextRep");const prevSibling=tween._prevRep;if(prevSibling){const prevParent=prevSibling.parent;const prevAbsEndTime=prevSibling._absoluteStartTime+prevSibling._changeDuration;if(tween.parent.id!==prevParent.id&&prevParent.iterationCount>1&&prevAbsEndTime+(prevParent.duration-prevParent.iterationDuration)>tweenAbsStartTime){overrideTween(prevSibling);let prevPrevSibling=prevSibling._prevRep;while(prevPrevSibling&&prevPrevSibling.parent.id===prevParent.id){overrideTween(prevPrevSibling);prevPrevSibling=prevPrevSibling._prevRep}}const absoluteUpdateStartTime=tweenAbsStartTime-tween._delay;if(prevAbsEndTime>absoluteUpdateStartTime){const prevChangeStartTime=prevSibling._startTime;const prevTLOffset=prevAbsEndTime-(prevChangeStartTime+prevSibling._updateDuration);prevSibling._changeDuration=absoluteUpdateStartTime-prevTLOffset-prevChangeStartTime;prevSibling._currentTime=prevSibling._changeDuration;prevSibling._isOverlapped=1;if(prevSibling._changeDuration<minValue){overrideTween(prevSibling)}}let pausePrevParentAnimation=true;forEachChildren(prevParent,(t=>{if(!t._isOverlapped)pausePrevParentAnimation=false}));if(pausePrevParentAnimation){const prevParentTL=prevParent.parent;if(prevParentTL){let pausePrevParentTL=true;forEachChildren(prevParentTL,(a=>{if(a!==prevParent){forEachChildren(a,(t=>{if(!t._isOverlapped)pausePrevParentTL=false}))}}));if(pausePrevParentTL){prevParentTL.cancel()}}else{prevParent.cancel()}}}}else if(tweenCompositionType===compositionTypes.blend){const additiveTweenSiblings=getTweenSiblings(tween.target,tween.property,"_add");const additiveAnimation=addAdditiveAnimation(lookups._add);let lookupTween=additiveTweenSiblings._head;if(!lookupTween){lookupTween={...tween};lookupTween._composition=compositionTypes.replace;lookupTween._updateDuration=minValue;lookupTween._startTime=0;lookupTween._numbers=cloneArray(tween._fromNumbers);lookupTween._number=0;lookupTween._next=null;lookupTween._prev=null;addChild(additiveTweenSiblings,lookupTween);addChild(additiveAnimation,lookupTween)}const toNumber=tween._toNumber;tween._fromNumber=lookupTween._fromNumber-toNumber;tween._toNumber=0;tween._numbers=cloneArray(tween._fromNumbers);tween._number=0;lookupTween._fromNumber=toNumber;if(tween._toNumbers){const toNumbers=cloneArray(tween._toNumbers);if(toNumbers){toNumbers.forEach(((value,i)=>{tween._fromNumbers[i]=lookupTween._fromNumbers[i]-value;tween._toNumbers[i]=0}))}lookupTween._fromNumbers=toNumbers}addChild(additiveTweenSiblings,tween,null,"_prevAdd","_nextAdd")}return tween};const removeTweenSliblings=tween=>{const tweenComposition=tween._composition;if(tweenComposition!==compositionTypes.none){const tweenTarget=tween.target;const tweenProperty=tween.property;const replaceTweensLookup=lookups._rep;const replaceTargetProps=replaceTweensLookup.get(tweenTarget);const tweenReplaceSiblings=replaceTargetProps[tweenProperty];removeChild(tweenReplaceSiblings,tween,"_prevRep","_nextRep");if(tweenComposition===compositionTypes.blend){const addTweensLookup=lookups._add;const addTargetProps=addTweensLookup.get(tweenTarget);if(!addTargetProps)return;const additiveTweenSiblings=addTargetProps[tweenProperty];const additiveAnimation=additive.animation;removeChild(additiveTweenSiblings,tween,"_prevAdd","_nextAdd");const lookupTween=additiveTweenSiblings._head;if(lookupTween&&lookupTween===additiveTweenSiblings._tail){removeChild(additiveTweenSiblings,lookupTween,"_prevAdd","_nextAdd");removeChild(additiveAnimation,lookupTween);let shouldClean=true;for(let prop in addTargetProps){if(addTargetProps[prop]._head){shouldClean=false;break}}if(shouldClean){addTweensLookup.delete(tweenTarget)}}}}return tween};const resetTimerProperties=timer=>{timer.paused=true;timer.began=false;timer.completed=false;return timer};const reviveTimer=timer=>{if(!timer._cancelled)return timer;if(timer._hasChildren){forEachChildren(timer,reviveTimer)}else{forEachChildren(timer,(tween=>{if(tween._composition!==compositionTypes.none){composeTween(tween,getTweenSiblings(tween.target,tween.property))}}))}timer._cancelled=0;return timer};let timerId=0;class Timer extends Clock{constructor(parameters={},parent=null,parentPosition=0){super(0);const{id:id,delay:delay,duration:duration,reversed:reversed,alternate:alternate,loop:loop,loopDelay:loopDelay,autoplay:autoplay,frameRate:frameRate,playbackRate:playbackRate,onComplete:onComplete,onLoop:onLoop,onPause:onPause,onBegin:onBegin,onBeforeUpdate:onBeforeUpdate,onUpdate:onUpdate}=parameters;if(globals.scope)globals.scope.revertibles.push(this);const timerInitTime=parent?0:engine._elapsedTime;const timerDefaults=parent?parent.defaults:globals.defaults;const timerDelay=isFnc(delay)||isUnd(delay)?timerDefaults.delay:+delay;const timerDuration=isFnc(duration)||isUnd(duration)?Infinity:+duration;const timerLoop=setValue(loop,timerDefaults.loop);const timerLoopDelay=setValue(loopDelay,timerDefaults.loopDelay);const timerIterationCount=timerLoop===true||timerLoop===Infinity||timerLoop<0?Infinity:timerLoop+1;let offsetPosition=0;if(parent){offsetPosition=parentPosition}else{let startTime=now();if(engine.paused){engine.requestTick(startTime);startTime=engine._elapsedTime}offsetPosition=startTime-engine._startTime}this.id=!isUnd(id)?id:++timerId;this.parent=parent;this.duration=clampInfinity((timerDuration+timerLoopDelay)*timerIterationCount-timerLoopDelay)||minValue;this.backwards=false;this.paused=true;this.began=false;this.completed=false;this.onBegin=onBegin||timerDefaults.onBegin;this.onBeforeUpdate=onBeforeUpdate||timerDefaults.onBeforeUpdate;this.onUpdate=onUpdate||timerDefaults.onUpdate;this.onLoop=onLoop||timerDefaults.onLoop;this.onPause=onPause||timerDefaults.onPause;this.onComplete=onComplete||timerDefaults.onComplete;this.iterationDuration=timerDuration;this.iterationCount=timerIterationCount;this._autoplay=parent?false:setValue(autoplay,timerDefaults.autoplay);this._offset=offsetPosition;this._delay=timerDelay;this._loopDelay=timerLoopDelay;this._iterationTime=0;this._currentIteration=0;this._resolve=noop;this._running=false;this._reversed=+setValue(reversed,timerDefaults.reversed);this._reverse=this._reversed;this._cancelled=0;this._alternate=setValue(alternate,timerDefaults.alternate);this._prev=null;this._next=null;this._elapsedTime=timerInitTime;this._startTime=timerInitTime;this._lastTime=timerInitTime;this._fps=setValue(frameRate,timerDefaults.frameRate);this._speed=setValue(playbackRate,timerDefaults.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(cancelled){cancelled?this.cancel():this.reset(1).play()}get currentTime(){return clamp(round(this._currentTime,globals.precision),-this._delay,this.duration)}set currentTime(time){const paused=this.paused;this.pause().seek(+time);if(!paused)this.resume()}get iterationCurrentTime(){return round(this._iterationTime,globals.precision)}set iterationCurrentTime(time){this.currentTime=this.iterationDuration*this._currentIteration+time}get progress(){return clamp(round(this._currentTime/this.duration,5),0,1)}set progress(progress){this.currentTime=this.duration*progress}get iterationProgress(){return clamp(round(this._iterationTime/this.iterationDuration,5),0,1)}set iterationProgress(progress){const iterationDuration=this.iterationDuration;this.currentTime=iterationDuration*this._currentIteration+iterationDuration*progress}get currentIteration(){return this._currentIteration}set currentIteration(iterationCount){this.currentTime=this.iterationDuration*clamp(+iterationCount,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(reverse){reverse?this.reverse():this.play()}get speed(){return super.speed}set speed(playbackRate){super.speed=playbackRate;this.resetTime()}reset(internalRender=0){reviveTimer(this);if(this._reversed&&!this._reverse)this.reversed=false;this._iterationTime=this.iterationDuration;tick(this,0,1,internalRender,tickModes.FORCE);resetTimerProperties(this);if(this._hasChildren){forEachChildren(this,resetTimerProperties)}return this}init(internalRender=0){this.fps=this._fps;this.speed=this._speed;if(!internalRender&&this._hasChildren){tick(this,this.duration,1,internalRender,tickModes.FORCE)}this.reset(internalRender);const autoplay=this._autoplay;if(autoplay===true){this.resume()}else if(autoplay&&!isUnd(autoplay.linked)){autoplay.link(this)}return this}resetTime(){const timeScale=1/(this._speed*engine._speed);this._startTime=now()-(this._currentTime+this._delay)*timeScale;return this}pause(){if(this.paused)return this;this.paused=true;this.onPause(this);return this}resume(){if(!this.paused)return this;this.paused=false;if(this.duration<=minValue&&!this._hasChildren){tick(this,minValue,0,0,tickModes.FORCE)}else{if(!this._running){addChild(engine,this);engine._hasChildren=true;this._running=true}this.resetTime();this._startTime-=12;engine.wake()}return this}restart(){return this.reset(0).resume()}seek(time,muteCallbacks=0,internalRender=0){reviveTimer(this);this.completed=false;const isPaused=this.paused;this.paused=true;tick(this,time+this._delay,~~muteCallbacks,~~internalRender,tickModes.AUTO);return isPaused?this:this.resume()}alternate(){const reversed=this._reversed;const count=this.iterationCount;const duration=this.iterationDuration;const iterations=count===Infinity?floor(maxValue/duration):count;this._reversed=+(this._alternate&&!(iterations%2)?reversed:!reversed);if(count===Infinity){this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress}else{this.seek(duration*iterations-this._currentTime)}this.resetTime();return this}play(){if(this._reversed)this.alternate();return this.resume()}reverse(){if(!this._reversed)this.alternate();return this.resume()}cancel(){if(this._hasChildren){forEachChildren(this,(child=>child.cancel()),true)}else{forEachChildren(this,removeTweenSliblings)}this._cancelled=1;return this.pause()}stretch(newDuration){const currentDuration=this.duration;const normlizedDuration=normalizeTime(newDuration);if(currentDuration===normlizedDuration)return this;const timeScale=newDuration/currentDuration;const isSetter=newDuration<=minValue;this.duration=isSetter?minValue:normlizedDuration;this.iterationDuration=isSetter?minValue:normalizeTime(this.iterationDuration*timeScale);this._offset*=timeScale;this._delay*=timeScale;this._loopDelay*=timeScale;return this}revert(){tick(this,0,1,0,tickModes.AUTO);const ap=this._autoplay;if(ap&&ap.linked&&ap.linked===this)ap.revert();return this.cancel()}complete(){return this.seek(this.duration).cancel()}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const createTimer=parameters=>new Timer(parameters,null,0).init();const none=t=>t;const calcBezier=(aT,aA1,aA2)=>(((1-3*aA2+3*aA1)*aT+(3*aA2-6*aA1))*aT+3*aA1)*aT;const binarySubdivide=(aX,mX1,mX2)=>{let aA=0,aB=1,currentX,currentT,i=0;do{currentT=aA+(aB-aA)/2;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0){aB=currentT}else{aA=currentT}}while(abs(currentX)>1e-7&&++i<100);return currentT};const cubicBezier=(mX1=.5,mY1=0,mX2=.5,mY2=1)=>mX1===mY1&&mX2===mY2?none:t=>t===0||t===1?t:calcBezier(binarySubdivide(t,mX1,mX2),mY1,mY2);const steps=(steps=10,fromStart)=>{const roundMethod=fromStart?ceil:floor;return t=>roundMethod(clamp(t,0,1)*steps)*(1/steps)};const linear=(...args)=>{const argsLength=args.length;if(!argsLength)return none;const totalPoints=argsLength-1;const firstArg=args[0];const lastArg=args[totalPoints];const xPoints=[0];const yPoints=[parseNumber(firstArg)];for(let i=1;i<totalPoints;i++){const arg=args[i];const splitValue=isStr(arg)?arg.trim().split(" "):[arg];const value=splitValue[0];const percent=splitValue[1];xPoints.push(!isUnd(percent)?parseNumber(percent)/100:i/totalPoints);yPoints.push(parseNumber(value))}yPoints.push(parseNumber(lastArg));xPoints.push(1);return function easeLinear(t){for(let i=1,l=xPoints.length;i<l;i++){const currentX=xPoints[i];if(t<=currentX){const prevX=xPoints[i-1];const prevY=yPoints[i-1];return prevY+(yPoints[i]-prevY)*(t-prevX)/(currentX-prevX)}}return yPoints[yPoints.length-1]}};const irregular=(length=10,randomness=1)=>{const values=[0];const total=length-1;for(let i=1;i<total;i++){const previousValue=values[i-1];const spacing=i/total;const segmentEnd=(i+1)/total;const randomVariation=spacing+(segmentEnd-spacing)*Math.random();const randomValue=spacing*(1-randomness)+randomVariation*randomness;values.push(clamp(randomValue,previousValue,1))}values.push(1);return linear(...values)};const halfPI=PI/2;const doublePI=PI*2;const easeInPower=(p=1.68)=>t=>pow(t,+p);const easeInFunctions={[emptyString]:easeInPower,Quad:easeInPower(2),Cubic:easeInPower(3),Quart:easeInPower(4),Quint:easeInPower(5),Sine:t=>1-cos(t*halfPI),Circ:t=>1-sqrt(1-t*t),Expo:t=>t?pow(2,10*t-10):0,Bounce:t=>{let pow2,b=4;while(t<((pow2=pow(2,--b))-1)/11);return 1/pow(4,3-b)-7.5625*pow((pow2*3-2)/22-t,2)},Back:(overshoot=1.70158)=>t=>(+overshoot+1)*t*t*t-+overshoot*t*t,Elastic:(amplitude=1,period=.3)=>{const a=clamp(+amplitude,1,10);const p=clamp(+period,minValue,2);const s=p/doublePI*asin(1/a);const e=doublePI/p;return t=>t===0||t===1?t:-a*pow(2,-10*(1-t))*sin((1-t-s)*e)}};const easeTypes={in:easeIn=>t=>easeIn(t),out:easeIn=>t=>1-easeIn(1-t),inOut:easeIn=>t=>t<.5?easeIn(t*2)/2:1-easeIn(t*-2+2)/2,outIn:easeIn=>t=>t<.5?(1-easeIn(1-t*2))/2:(easeIn(t*2-1)+1)/2};const parseEaseString=(string,easesFunctions,easesLookups)=>{if(easesLookups[string])return easesLookups[string];if(string.indexOf("(")<=-1){const hasParams=easeTypes[string]||string.includes("Back")||string.includes("Elastic");const parsedFn=hasParams?easesFunctions[string]():easesFunctions[string];return parsedFn?easesLookups[string]=parsedFn:none}else{const split=string.slice(0,-1).split("(");const parsedFn=easesFunctions[split[0]];return parsedFn?easesLookups[string]=parsedFn(...split[1].split(",")):none}};const eases=(()=>{const list={linear:linear,irregular:irregular,steps:steps,cubicBezier:cubicBezier};for(let type in easeTypes){for(let name in easeInFunctions){const easeIn=easeInFunctions[name];const easeType=easeTypes[type];list[type+name]=name===emptyString||name==="Back"||name==="Elastic"?(a,b)=>easeType(easeIn(a,b)):easeType(easeIn)}}return list})();const JSEasesLookups={linear:none};const parseEasings=ease=>isFnc(ease)?ease:isStr(ease)?parseEaseString(ease,eases,JSEasesLookups):none;const propertyNamesCache={};const sanitizePropertyName=(propertyName,target,tweenType)=>{if(tweenType===tweenTypes.TRANSFORM){const t=shortTransforms.get(propertyName);return t?t:propertyName}else if(tweenType===tweenTypes.CSS||tweenType===tweenTypes.ATTRIBUTE&&(isSvg(target)&&propertyName in target.style)){const cachedPropertyName=propertyNamesCache[propertyName];if(cachedPropertyName){return cachedPropertyName}else{const lowerCaseName=propertyName?toLowerCase(propertyName):propertyName;propertyNamesCache[propertyName]=lowerCaseName;return lowerCaseName}}else{return propertyName}};const angleUnitsMap={deg:1,rad:180/PI,turn:360};const convertedValuesCache={};const convertValueUnit=(el,decomposedValue,unit,force=false)=>{const currentUnit=decomposedValue.u;const currentNumber=decomposedValue.n;if(decomposedValue.t===valueTypes.UNIT&&currentUnit===unit){return decomposedValue}const cachedKey=currentNumber+currentUnit+unit;const cached=convertedValuesCache[cachedKey];if(!isUnd(cached)&&!force){decomposedValue.n=cached}else{let convertedValue;if(currentUnit in angleUnitsMap){convertedValue=currentNumber*angleUnitsMap[currentUnit]/angleUnitsMap[unit]}else{const baseline=100;const tempEl=el.cloneNode();const parentNode=el.parentNode;const parentEl=parentNode&&parentNode!==doc?parentNode:doc.body;parentEl.appendChild(tempEl);const elStyle=tempEl.style;elStyle.width=baseline+currentUnit;const currentUnitWidth=tempEl.offsetWidth||baseline;elStyle.width=baseline+unit;const newUnitWidth=tempEl.offsetWidth||baseline;const factor=currentUnitWidth/newUnitWidth;parentEl.removeChild(tempEl);convertedValue=factor*currentNumber}decomposedValue.n=convertedValue;convertedValuesCache[cachedKey]=convertedValue}decomposedValue.t===valueTypes.UNIT;decomposedValue.u=unit;return decomposedValue};const cleanInlineStyles=renderable=>{if(renderable._hasChildren){forEachChildren(renderable,cleanInlineStyles,true)}else{const animation=renderable;animation.pause();forEachChildren(animation,(tween=>{const tweenProperty=tween.property;const tweenTarget=tween.target;if(tweenTarget[isDomSymbol]){const targetStyle=tweenTarget.style;const originalInlinedValue=animation._inlineStyles[tweenProperty];if(tween._tweenType===tweenTypes.TRANSFORM){const cachedTransforms=tweenTarget[transformsSymbol];if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){delete cachedTransforms[tweenProperty]}else{cachedTransforms[tweenProperty]=originalInlinedValue}if(tween._renderTransforms){if(!Object.keys(cachedTransforms).length){targetStyle.removeProperty("transform")}else{let str=emptyString;for(let key in cachedTransforms){str+=transformsFragmentStrings[key]+cachedTransforms[key]+") "}targetStyle.transform=str}}}else{if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){targetStyle.removeProperty(tweenProperty)}else{targetStyle[tweenProperty]=originalInlinedValue}}if(animation._tail===tween){animation.targets.forEach((t=>{if(t.getAttribute&&t.getAttribute("style")===emptyString){t.removeAttribute("style")}}))}}}))}return renderable};const fromTargetObject=createDecomposedValueTargetObject();const toTargetObject=createDecomposedValueTargetObject();const toFunctionStore={func:null};const keyframesTargetArray=[null];const fastSetValuesArray=[null,null];const keyObjectTarget={to:null};let tweenId=0;let keyframes;let key;const generateKeyframes=(keyframes,parameters)=>{const properties={};if(isArr(keyframes)){const propertyNames=[].concat(...keyframes.map((key=>Object.keys(key)))).filter(isKey);for(let i=0,l=propertyNames.length;i<l;i++){const propName=propertyNames[i];const propArray=keyframes.map((key=>{const newKey={};for(let p in key){const keyValue=key[p];if(isKey(p)){if(p===propName){newKey.to=keyValue}}else{newKey[p]=keyValue}}return newKey}));properties[propName]=propArray}}else{const totalDuration=setValue(parameters.duration,globals.defaults.duration);const keys=Object.keys(keyframes).map((key=>({o:parseFloat(key)/100,p:keyframes[key]}))).sort(((a,b)=>a.o-b.o));keys.forEach((key=>{const offset=key.o;const prop=key.p;for(let name in prop){if(isKey(name)){let propArray=properties[name];if(!propArray)propArray=properties[name]=[];const duration=offset*totalDuration;let length=propArray.length;let prevKey=propArray[length-1];const keyObj={to:prop[name]};let durProgress=0;for(let i=0;i<length;i++){durProgress+=propArray[i].duration}if(length===1){keyObj.from=prevKey.to}if(prop.ease){keyObj.ease=prop.ease}keyObj.duration=duration-(length?durProgress:0);propArray.push(keyObj)}}return key}));for(let name in properties){const propArray=properties[name];let prevEase;for(let i=0,l=propArray.length;i<l;i++){const prop=propArray[i];const currentEase=prop.ease;prop.ease=prevEase?prevEase:undefined;prevEase=currentEase}if(!propArray[0].duration){propArray.shift()}}}return properties};class JSAnimation extends Timer{constructor(targets,parameters,parent,parentPosition,fastSet=false,index=0,length=0){super(parameters,parent,parentPosition);const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;const kfParams=parameters.keyframes;const params=kfParams?mergeObjects(generateKeyframes(kfParams,parameters),parameters):parameters;const{delay:delay,duration:duration,ease:ease,playbackEase:playbackEase,modifier:modifier,composition:composition,onRender:onRender}=params;const animDefaults=parent?parent.defaults:globals.defaults;const animaPlaybackEase=setValue(playbackEase,animDefaults.playbackEase);const animEase=animaPlaybackEase?parseEasings(animaPlaybackEase):null;const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const tEasing=hasSpring?ease.ease:setValue(ease,animEase?"linear":animDefaults.ease);const tDuration=hasSpring?ease.duration:setValue(duration,animDefaults.duration);const tDelay=setValue(delay,animDefaults.delay);const tModifier=modifier||animDefaults.modifier;const tComposition=isUnd(composition)&&targetsLength>=K?compositionTypes.none:!isUnd(composition)?composition:animDefaults.composition;const animInlineStyles={};const absoluteOffsetTime=this._offset+(parent?parent._offset:0);let iterationDuration=NaN;let iterationDelay=NaN;let animationAnimationLength=0;let shouldTriggerRender=0;for(let targetIndex=0;targetIndex<targetsLength;targetIndex++){const target=parsedTargets[targetIndex];const ti=index||targetIndex;const tl=length||targetsLength;let lastTransformGroupIndex=NaN;let lastTransformGroupLength=NaN;for(let p in params){if(isKey(p)){const tweenType=getTweenType(target,p);const propName=sanitizePropertyName(p,target,tweenType);let propValue=params[p];const isPropValueArray=isArr(propValue);if(fastSet&&!isPropValueArray){fastSetValuesArray[0]=propValue;fastSetValuesArray[1]=propValue;propValue=fastSetValuesArray}if(isPropValueArray){const arrayLength=propValue.length;const isNotObjectValue=!isObj(propValue[0]);if(arrayLength===2&&isNotObjectValue){keyObjectTarget.to=propValue;keyframesTargetArray[0]=keyObjectTarget;keyframes=keyframesTargetArray}else if(arrayLength>2&&isNotObjectValue){keyframes=[];propValue.forEach(((v,i)=>{if(!i){fastSetValuesArray[0]=v}else if(i===1){fastSetValuesArray[1]=v;keyframes.push(fastSetValuesArray)}else{keyframes.push(v)}}))}else{keyframes=propValue}}else{keyframesTargetArray[0]=propValue;keyframes=keyframesTargetArray}let siblings=null;let prevTween=null;let firstTweenChangeStartTime=NaN;let lastTweenChangeEndTime=0;let tweenIndex=0;for(let l=keyframes.length;tweenIndex<l;tweenIndex++){const keyframe=keyframes[tweenIndex];if(isObj(keyframe)){key=keyframe}else{keyObjectTarget.to=keyframe;key=keyObjectTarget}toFunctionStore.func=null;const computedToValue=getFunctionValue(key.to,target,ti,tl,toFunctionStore);let tweenToValue;if(isObj(computedToValue)&&!isUnd(computedToValue.to)){key=computedToValue;tweenToValue=computedToValue.to}else{tweenToValue=computedToValue}const tweenFromValue=getFunctionValue(key.from,target,ti,tl);const keyEasing=key.ease;const hasSpring=!isUnd(keyEasing)&&!isUnd(keyEasing.ease);const tweenEasing=hasSpring?keyEasing.ease:keyEasing||tEasing;const tweenDuration=hasSpring?keyEasing.duration:getFunctionValue(setValue(key.duration,l>1?getFunctionValue(tDuration,target,ti,tl)/l:tDuration),target,ti,tl);const tweenDelay=getFunctionValue(setValue(key.delay,!tweenIndex?tDelay:0),target,ti,tl);const computedComposition=getFunctionValue(setValue(key.composition,tComposition),target,ti,tl);const tweenComposition=isNum(computedComposition)?computedComposition:compositionTypes[computedComposition];const tweenModifier=key.modifier||tModifier;const hasFromvalue=!isUnd(tweenFromValue);const hasToValue=!isUnd(tweenToValue);const isFromToArray=isArr(tweenToValue);const isFromToValue=isFromToArray||hasFromvalue&&hasToValue;const tweenStartTime=prevTween?lastTweenChangeEndTime+tweenDelay:tweenDelay;const absoluteStartTime=absoluteOffsetTime+tweenStartTime;if(!shouldTriggerRender&&(hasFromvalue||isFromToArray))shouldTriggerRender=1;let prevSibling=prevTween;if(tweenComposition!==compositionTypes.none){if(!siblings)siblings=getTweenSiblings(target,propName);let nextSibling=siblings._head;while(nextSibling&&!nextSibling._isOverridden&&nextSibling._absoluteStartTime<=absoluteStartTime){prevSibling=nextSibling;nextSibling=nextSibling._nextRep;if(nextSibling&&nextSibling._absoluteStartTime>=absoluteStartTime){while(nextSibling){overrideTween(nextSibling);nextSibling=nextSibling._nextRep}}}}if(isFromToValue){decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[0],target,ti,tl):tweenFromValue,fromTargetObject);decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[1],target,ti,tl,toFunctionStore):tweenToValue,toTargetObject);if(fromTargetObject.t===valueTypes.NUMBER){if(prevSibling){if(prevSibling._valueType===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=prevSibling._unit}}else{decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=decomposedOriginalValue.u}}}}else{if(hasToValue){decomposeRawValue(tweenToValue,toTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,toTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),toTargetObject)}}if(hasFromvalue){decomposeRawValue(tweenFromValue,fromTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,fromTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),fromTargetObject)}}}if(fromTargetObject.o){fromTargetObject.n=getRelativeValue(!prevSibling?decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue).n:prevSibling._toNumber,fromTargetObject.n,fromTargetObject.o)}if(toTargetObject.o){toTargetObject.n=getRelativeValue(fromTargetObject.n,toTargetObject.n,toTargetObject.o)}if(fromTargetObject.t!==toTargetObject.t){if(fromTargetObject.t===valueTypes.COMPLEX||toTargetObject.t===valueTypes.COMPLEX){const complexValue=fromTargetObject.t===valueTypes.COMPLEX?fromTargetObject:toTargetObject;const notComplexValue=fromTargetObject.t===valueTypes.COMPLEX?toTargetObject:fromTargetObject;notComplexValue.t=valueTypes.COMPLEX;notComplexValue.s=cloneArray(complexValue.s);notComplexValue.d=complexValue.d.map((()=>notComplexValue.n))}else if(fromTargetObject.t===valueTypes.UNIT||toTargetObject.t===valueTypes.UNIT){const unitValue=fromTargetObject.t===valueTypes.UNIT?fromTargetObject:toTargetObject;const notUnitValue=fromTargetObject.t===valueTypes.UNIT?toTargetObject:fromTargetObject;notUnitValue.t=valueTypes.UNIT;notUnitValue.u=unitValue.u}else if(fromTargetObject.t===valueTypes.COLOR||toTargetObject.t===valueTypes.COLOR){const colorValue=fromTargetObject.t===valueTypes.COLOR?fromTargetObject:toTargetObject;const notColorValue=fromTargetObject.t===valueTypes.COLOR?toTargetObject:fromTargetObject;notColorValue.t=valueTypes.COLOR;notColorValue.s=colorValue.s;notColorValue.d=[0,0,0,1]}}if(fromTargetObject.u!==toTargetObject.u){let valueToConvert=toTargetObject.u?fromTargetObject:toTargetObject;valueToConvert=convertValueUnit(target,valueToConvert,toTargetObject.u?toTargetObject.u:fromTargetObject.u,false)}if(toTargetObject.d&&fromTargetObject.d&&toTargetObject.d.length!==fromTargetObject.d.length){const longestValue=fromTargetObject.d.length>toTargetObject.d.length?fromTargetObject:toTargetObject;const shortestValue=longestValue===fromTargetObject?toTargetObject:fromTargetObject;shortestValue.d=longestValue.d.map(((_,i)=>isUnd(shortestValue.d[i])?0:shortestValue.d[i]));shortestValue.s=cloneArray(longestValue.s)}const tweenUpdateDuration=round(+tweenDuration||minValue,12);const tween={parent:this,id:tweenId++,property:propName,target:target,_value:null,_func:toFunctionStore.func,_ease:parseEasings(tweenEasing),_fromNumbers:cloneArray(fromTargetObject.d),_toNumbers:cloneArray(toTargetObject.d),_strings:cloneArray(toTargetObject.s),_fromNumber:fromTargetObject.n,_toNumber:toTargetObject.n,_numbers:cloneArray(fromTargetObject.d),_number:fromTargetObject.n,_unit:toTargetObject.u,_modifier:tweenModifier,_currentTime:0,_startTime:tweenStartTime,_delay:+tweenDelay,_updateDuration:tweenUpdateDuration,_changeDuration:tweenUpdateDuration,_absoluteStartTime:absoluteStartTime,_tweenType:tweenType,_valueType:toTargetObject.t,_composition:tweenComposition,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};if(tweenComposition!==compositionTypes.none){composeTween(tween,siblings)}if(isNaN(firstTweenChangeStartTime)){firstTweenChangeStartTime=tween._startTime}lastTweenChangeEndTime=round(tweenStartTime+tweenUpdateDuration,12);prevTween=tween;animationAnimationLength++;addChild(this,tween)}if(isNaN(iterationDelay)||firstTweenChangeStartTime<iterationDelay){iterationDelay=firstTweenChangeStartTime}if(isNaN(iterationDuration)||lastTweenChangeEndTime>iterationDuration){iterationDuration=lastTweenChangeEndTime}if(tweenType===tweenTypes.TRANSFORM){lastTransformGroupIndex=animationAnimationLength-tweenIndex;lastTransformGroupLength=animationAnimationLength}}}if(!isNaN(lastTransformGroupIndex)){let i=0;forEachChildren(this,(tween=>{if(i>=lastTransformGroupIndex&&i<lastTransformGroupLength){tween._renderTransforms=1;if(tween._composition===compositionTypes.blend){forEachChildren(additive.animation,(additiveTween=>{if(additiveTween.id===tween.id){additiveTween._renderTransforms=1}}))}}i++}))}}if(!targetsLength){console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`)}if(iterationDelay){forEachChildren(this,(tween=>{if(!(tween._startTime-tween._delay)){tween._delay-=iterationDelay}tween._startTime-=iterationDelay}));iterationDuration-=iterationDelay}else{iterationDelay=0}if(!iterationDuration){iterationDuration=minValue;this.iterationCount=0}this.targets=parsedTargets;this.duration=iterationDuration===minValue?minValue:clampInfinity((iterationDuration+this._loopDelay)*this.iterationCount-this._loopDelay)||minValue;this.onRender=onRender||animDefaults.onRender;this._ease=animEase;this._delay=iterationDelay;this.iterationDuration=iterationDuration;this._inlineStyles=animInlineStyles;if(!this._autoplay&&shouldTriggerRender)this.onRender(this)}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;forEachChildren(this,(tween=>{tween._updateDuration=normalizeTime(tween._updateDuration*timeScale);tween._changeDuration=normalizeTime(tween._changeDuration*timeScale);tween._currentTime*=timeScale;tween._startTime*=timeScale;tween._absoluteStartTime*=timeScale}));return super.stretch(newDuration)}refresh(){forEachChildren(this,(tween=>{const ogValue=getOriginalAnimatableValue(tween.target,tween.property,tween._tweenType);decomposeRawValue(ogValue,decomposedOriginalValue);tween._fromNumbers=cloneArray(decomposedOriginalValue.d);tween._fromNumber=decomposedOriginalValue.n;if(tween._func){decomposeRawValue(tween._func(),toTargetObject);tween._toNumbers=cloneArray(toTargetObject.d);tween._strings=cloneArray(toTargetObject.s);tween._toNumber=toTargetObject.n}}));return this}revert(){super.revert();return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const animate=(targets,parameters)=>new JSAnimation(targets,parameters,null,0,false).init();const easingToLinear=(fn,samples=100)=>{const points=[];for(let i=0;i<=samples;i++)points.push(fn(i/samples));return`linear(${points.join(", ")})`};const WAAPIEasesLookups={in:"ease-in",out:"ease-out",inOut:"ease-in-out"};const WAAPIeases=(()=>{const list={};for(let type in easeTypes)list[type]=a=>easeTypes[type](easeInPower(a));return list})();const parseWAAPIEasing=ease=>{let parsedEase=WAAPIEasesLookups[ease];if(parsedEase)return parsedEase;parsedEase="linear";if(isStr(ease)){if(stringStartsWith(ease,"linear")||stringStartsWith(ease,"cubic-")||stringStartsWith(ease,"steps")||stringStartsWith(ease,"ease")){parsedEase=ease}else if(stringStartsWith(ease,"cubicB")){parsedEase=toLowerCase(ease)}else{const parsed=parseEaseString(ease,WAAPIeases,WAAPIEasesLookups);if(isFnc(parsed))parsedEase=parsed===none?"linear":easingToLinear(parsed)}WAAPIEasesLookups[ease]=parsedEase}else if(isFnc(ease)){const easing=easingToLinear(ease);if(easing)parsedEase=easing}else if(ease.ease){parsedEase=easingToLinear(ease.ease)}return parsedEase};const transformsShorthands=["x","y","z"];const commonDefaultPXProperties=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...transformsShorthands];const validIndividualTransforms=[...transformsShorthands,...validTransforms.filter((t=>["X","Y","Z"].some((axis=>t.endsWith(axis)))))];let transformsPropertiesRegistered=isBrowser&&(isUnd(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const registerTransformsProperties=()=>{if(transformsPropertiesRegistered)return;validTransforms.forEach((t=>{const isSkew=stringStartsWith(t,"skew");const isScale=stringStartsWith(t,"scale");const isRotate=stringStartsWith(t,"rotate");const isTranslate=stringStartsWith(t,"translate");const isAngle=isRotate||isSkew;const syntax=isAngle?"<angle>":isScale?"<number>":isTranslate?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:syntax,inherits:false,initialValue:isTranslate?"0px":isAngle?"0deg":isScale?"1":"0"})}catch{}}));transformsPropertiesRegistered=true};const WAAPIAnimationsLookups={_head:null,_tail:null};const removeWAAPIAnimation=($el,property,parent)=>{let nextLookup=WAAPIAnimationsLookups._head;while(nextLookup){const next=nextLookup._next;const matchTarget=nextLookup.$el===$el;const matchProperty=!property||nextLookup.property===property;const matchParent=!parent||nextLookup.parent===parent;if(matchTarget&&matchProperty&&matchParent){const anim=nextLookup.animation;try{anim.commitStyles()}catch{}anim.cancel();removeChild(WAAPIAnimationsLookups,nextLookup);const lookupParent=nextLookup.parent;if(lookupParent){lookupParent._completed++;if(lookupParent.animations.length===lookupParent._completed){lookupParent.completed=true;if(!lookupParent.muteCallbacks){lookupParent.paused=true;lookupParent.onComplete(lookupParent);lookupParent._resolve(lookupParent)}}}}nextLookup=next}};const addWAAPIAnimation=(parent,$el,property,keyframes,params)=>{const animation=$el.animate(keyframes,params);const animTotalDuration=params.delay+ +params.duration*params.iterations;animation.playbackRate=parent._speed;if(parent.paused)animation.pause();if(parent.duration<animTotalDuration){parent.duration=animTotalDuration;parent.controlAnimation=animation}parent.animations.push(animation);removeWAAPIAnimation($el,property);addChild(WAAPIAnimationsLookups,{parent:parent,animation:animation,$el:$el,property:property,_next:null,_prev:null});const handleRemove=()=>{removeWAAPIAnimation($el,property,parent)};animation.onremove=handleRemove;animation.onfinish=handleRemove;return animation};const normalizeTweenValue=(propName,value,$el,i,targetsLength)=>{let v=getFunctionValue(value,$el,i,targetsLength);if(!isNum(v))return v;if(commonDefaultPXProperties.includes(propName)||stringStartsWith(propName,"translate"))return`${v}px`;if(stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew"))return`${v}deg`;return`${v}`};const parseIndividualTweenValue=($el,propName,from,to,i,targetsLength)=>{let tweenValue="0";const computedTo=!isUnd(to)?normalizeTweenValue(propName,to,$el,i,targetsLength):getComputedStyle($el)[propName];if(!isUnd(from)){const computedFrom=normalizeTweenValue(propName,from,$el,i,targetsLength);tweenValue=[computedFrom,computedTo]}else{tweenValue=isArr(to)?to.map((v=>normalizeTweenValue(propName,v,$el,i,targetsLength))):computedTo}return tweenValue};class WAAPIAnimation{constructor(targets,params){if(globals.scope)globals.scope.revertibles.push(this);registerTransformsProperties();const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;if(!targetsLength){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=ease.ease&&ease;const autoplay=setValue(params.autoplay,globals.defaults.autoplay);const scroll=autoplay&&autoplay.link?autoplay:false;const alternate=params.alternate&&params.alternate===true;const reversed=params.reversed&&params.reversed===true;const loop=setValue(params.loop,globals.defaults.loop);const iterations=loop===true||loop===Infinity?Infinity:isNum(loop)?loop+1:1;const direction=alternate?reversed?"alternate-reverse":"alternate":reversed?"reverse":"normal";const fill="forwards";const easing=parseWAAPIEasing(ease);const timeScale=globals.timeScale===1?1:K;this.targets=parsedTargets;this.animations=[];this.controlAnimation=null;this.onComplete=params.onComplete||noop;this.duration=0;this.muteCallbacks=false;this.completed=false;this.paused=!autoplay||scroll!==false;this.reversed=reversed;this.autoplay=autoplay;this._speed=setValue(params.playbackRate,globals.defaults.playbackRate);this._resolve=noop;this._completed=0;this._inlineStyles=parsedTargets.map(($el=>$el.getAttribute("style")));parsedTargets.forEach((($el,i)=>{const cachedTransforms=$el[transformsSymbol];const hasIndividualTransforms=validIndividualTransforms.some((t=>params.hasOwnProperty(t)));const duration=(spring?spring.duration:getFunctionValue(setValue(params.duration,globals.defaults.duration),$el,i,targetsLength))*timeScale;const delay=getFunctionValue(setValue(params.delay,globals.defaults.delay),$el,i,targetsLength)*timeScale;const composite=setValue(params.composition,"replace");for(let name in params){if(!isKey(name))continue;const keyframes={};const tweenParams={iterations:iterations,direction:direction,fill:fill,easing:easing,duration:duration,delay:delay,composite:composite};const propertyValue=params[name];const individualTransformProperty=hasIndividualTransforms?validTransforms.includes(name)?name:shortTransforms.get(name):false;let parsedPropertyValue;if(isObj(propertyValue)){const tweenOptions=propertyValue;const tweenOptionsEase=setValue(tweenOptions.ease,ease);const tweenOptionsSpring=tweenOptionsEase.ease&&tweenOptionsEase;const to=tweenOptions.to;const from=tweenOptions.from;tweenParams.duration=(tweenOptionsSpring?tweenOptionsSpring.duration:getFunctionValue(setValue(tweenOptions.duration,duration),$el,i,targetsLength))*timeScale;tweenParams.delay=getFunctionValue(setValue(tweenOptions.delay,delay),$el,i,targetsLength)*timeScale;tweenParams.composite=setValue(tweenOptions.composition,composite);tweenParams.easing=parseWAAPIEasing(tweenOptionsEase);parsedPropertyValue=parseIndividualTweenValue($el,name,from,to,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parseIndividualTweenValue($el,name,from,to,i,targetsLength)}addWAAPIAnimation(this,$el,name,keyframes,tweenParams);if(!isUnd(from)){if(!individualTransformProperty){$el.style[name]=keyframes[name][0]}else{const key=`--${individualTransformProperty}`;$el.style.setProperty(key,keyframes[key][0])}}}else{parsedPropertyValue=isArr(propertyValue)?propertyValue.map((v=>normalizeTweenValue(name,v,$el,i,targetsLength))):normalizeTweenValue(name,propertyValue,$el,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parsedPropertyValue}addWAAPIAnimation(this,$el,name,keyframes,tweenParams)}}if(hasIndividualTransforms){let transforms=emptyString;for(let t in cachedTransforms){transforms+=`${transformsFragmentStrings[t]}var(--${t})) `}$el.style.transform=transforms}}));if(scroll){this.autoplay.link(this)}}forEach(callback){const cb=isStr(callback)?a=>a[callback]():callback;this.animations.forEach(cb);return this}get speed(){return this._speed}set speed(speed){this._speed=+speed;this.forEach((anim=>anim.playbackRate=speed))}get currentTime(){const controlAnimation=this.controlAnimation;const timeScale=globals.timeScale;return this.completed?this.duration:controlAnimation?+controlAnimation.currentTime*(timeScale===1?1:timeScale):0}set currentTime(time){const t=time*(globals.timeScale===1?1:K);this.forEach((anim=>{if(t>=this.duration)anim.play();anim.currentTime=t}))}get progress(){return this.currentTime/this.duration}set progress(progress){this.forEach((anim=>anim.currentTime=progress*this.duration||0))}resume(){if(!this.paused)return this;this.paused=false;return this.forEach("play")}pause(){if(this.paused)return this;this.paused=true;return this.forEach("pause")}alternate(){this.reversed=!this.reversed;this.forEach("reverse");if(this.paused)this.forEach("pause");return this}play(){if(this.reversed)this.alternate();return this.resume()}reverse(){if(!this.reversed)this.alternate();return this.resume()}seek(time,muteCallbacks=false){if(muteCallbacks)this.muteCallbacks=true;if(time<this.duration)this.completed=false;this.currentTime=time;this.muteCallbacks=false;if(this.paused)this.pause();return this}restart(){this.completed=false;return this.seek(0,true).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){this.forEach("cancel");return this.pause()}revert(){this.cancel();this.targets.forEach((($el,i)=>$el.setAttribute("style",this._inlineStyles[i])));return this}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const waapi={animate:(targets,params)=>new WAAPIAnimation(targets,params),convertEase:easingToLinear};const sync=(callback=noop)=>new Timer({duration:1*globals.timeScale,onComplete:callback},null,0).resume();function getTargetValue(targetSelector,propName,unit){const targets=registerTargets(targetSelector);if(!targets.length)return;const[target]=targets;const tweenType=getTweenType(target,propName);const normalizePropName=sanitizePropertyName(propName,target,tweenType);let originalValue=getOriginalAnimatableValue(target,normalizePropName);if(isUnd(unit)){return originalValue}else{decomposeRawValue(originalValue,decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.NUMBER||decomposedOriginalValue.t===valueTypes.UNIT){if(unit===false){return decomposedOriginalValue.n}else{const convertedValue=convertValueUnit(target,decomposedOriginalValue,unit,false);return`${round(convertedValue.n,globals.precision)}${convertedValue.u}`}}}}const setTargetValues=(targets,parameters)=>{if(isUnd(parameters))return;parameters.duration=minValue;parameters.composition=setValue(parameters.composition,compositionTypes.none);return new JSAnimation(targets,parameters,null,0,true).resume()};const removeTargetsFromAnimation=(targetsArray,animation,propertyName)=>{let tweensMatchesTargets=false;forEachChildren(animation,(tween=>{const tweenTarget=tween.target;if(targetsArray.includes(tweenTarget)){const tweenName=tween.property;const tweenType=tween._tweenType;const normalizePropName=sanitizePropertyName(propertyName,tweenTarget,tweenType);if(!normalizePropName||normalizePropName&&normalizePropName===tweenName){if(tween.parent._tail===tween&&tween._tweenType===tweenTypes.TRANSFORM&&tween._prev&&tween._prev._tweenType===tweenTypes.TRANSFORM){tween._prev._renderTransforms=1}removeChild(animation,tween);removeTweenSliblings(tween);tweensMatchesTargets=true}}}),true);return tweensMatchesTargets};const remove=(targets,renderable,propertyName)=>{const targetsArray=parseTargets(targets);const parent=renderable?renderable:engine;const waapiAnimation=renderable&&renderable.controlAnimation&&renderable;for(let i=0,l=targetsArray.length;i<l;i++){const $el=targetsArray[i];removeWAAPIAnimation($el,propertyName,waapiAnimation)}let removeMatches;if(parent._hasChildren){let iterationDuration=0;forEachChildren(parent,(child=>{if(!child._hasChildren){removeMatches=removeTargetsFromAnimation(targetsArray,child,propertyName);if(removeMatches&&!child._head){child.cancel();removeChild(parent,child)}else{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>iterationDuration){iterationDuration=childDur}}}if(child._head){remove(targets,child,propertyName)}else{child._hasChildren=false}}),true);if(!isUnd(parent.iterationDuration)){parent.iterationDuration=iterationDuration}}else{removeMatches=removeTargetsFromAnimation(targetsArray,parent,propertyName)}if(removeMatches&&!parent._head){parent._hasChildren=false;if(parent.cancel)parent.cancel()}return targetsArray};const random=(min,max,decimalLength)=>{const m=10**(decimalLength||0);return floor((Math.random()*(max-min+1/m)+min)*m)/m};const randomPick=items=>items[random(0,items.length-1)];const shuffle=items=>{let m=items.length,t,i;while(m){i=random(0,--m);t=items[m];items[m]=items[i];items[i]=t}return items};const roundPad=(v,decimalLength)=>(+v).toFixed(decimalLength);const padStart=(v,totalLength,padString)=>`${v}`.padStart(totalLength,padString);const padEnd=(v,totalLength,padString)=>`${v}`.padEnd(totalLength,padString);const wrap=(v,min,max)=>((v-min)%(max-min)+(max-min))%(max-min)+min;const mapRange=(value,inLow,inHigh,outLow,outHigh)=>outLow+(value-inLow)/(inHigh-inLow)*(outHigh-outLow);const degToRad=degrees=>degrees*PI/180;const radToDeg=radians=>radians*180/PI;const lerp=(start,end,amount,renderable)=>{let dt=K/globals.defaults.frameRate;if(renderable!==false){const ticker=renderable||engine._hasChildren&&engine;if(ticker&&ticker.deltaTime){dt=ticker.deltaTime}}const t=1-Math.exp(-amount*dt*.1);return!amount?start:amount===1?end:(1-t)*start+t*end};const curry=(fn,last=0)=>(...args)=>last?v=>fn(...args,v):v=>fn(v,...args);const chain=fn=>(...args)=>{const result=fn(...args);return new Proxy(noop,{apply:(_,__,[v])=>result(v),get:(_,prop)=>chain(((...nextArgs)=>{const nextResult=utils[prop](...nextArgs);return v=>nextResult(result(v))}))})};const makeChainable=(fn,right=0)=>(...args)=>(args.length<fn.length?chain(curry(fn,right)):fn)(...args);const utils={$:registerTargets,get:getTargetValue,set:setTargetValues,remove:remove,cleanInlineStyles:cleanInlineStyles,random:random,randomPick:randomPick,shuffle:shuffle,lerp:lerp,sync:sync,clamp:makeChainable(clamp),round:makeChainable(round),snap:makeChainable(snap),wrap:makeChainable(wrap),interpolate:makeChainable(interpolate,1),mapRange:makeChainable(mapRange),roundPad:makeChainable(roundPad),padStart:makeChainable(padStart),padEnd:makeChainable(padEnd),degToRad:makeChainable(degToRad),radToDeg:makeChainable(radToDeg)};const getPrevChildOffset=(timeline,timePosition)=>{if(stringStartsWith(timePosition,"<")){const goToPrevAnimationOffset=timePosition[1]==="<";const prevAnimation=timeline._tail;const prevOffset=prevAnimation?prevAnimation._offset+prevAnimation._delay:0;return goToPrevAnimationOffset?prevOffset:prevOffset+prevAnimation.duration}};const parseTimelinePosition=(timeline,timePosition)=>{let tlDuration=timeline.iterationDuration;if(tlDuration===minValue)tlDuration=0;if(isUnd(timePosition))return tlDuration;if(isNum(+timePosition))return+timePosition;const timePosStr=timePosition;const tlLabels=timeline?timeline.labels:null;const hasLabels=!isNil(tlLabels);const prevOffset=getPrevChildOffset(timeline,timePosStr);const hasSibling=!isUnd(prevOffset);const matchedRelativeOperator=relativeValuesExecRgx.exec(timePosStr);if(matchedRelativeOperator){const fullOperator=matchedRelativeOperator[0];const split=timePosStr.split(fullOperator);const labelOffset=hasLabels&&split[0]?tlLabels[split[0]]:tlDuration;const parsedOffset=hasSibling?prevOffset:hasLabels?labelOffset:tlDuration;const parsedNumericalOffset=+split[1];return getRelativeValue(parsedOffset,parsedNumericalOffset,fullOperator[0])}else{return hasSibling?prevOffset:hasLabels?!isUnd(tlLabels[timePosStr])?tlLabels[timePosStr]:tlDuration:tlDuration}};function getTimelineTotalDuration(tl){return clampInfinity((tl.iterationDuration+tl._loopDelay)*tl.iterationCount-tl._loopDelay)||minValue}function addTlChild(childParams,tl,timePosition,targets,index,length){const isSetter=isNum(childParams.duration)&&childParams.duration<=minValue;const adjustedPosition=isSetter?timePosition-minValue:timePosition;tick(tl,adjustedPosition,1,1,tickModes.AUTO);const tlChild=targets?new JSAnimation(targets,childParams,tl,adjustedPosition,false,index,length):new Timer(childParams,tl,adjustedPosition);tlChild.init(1);addChild(tl,tlChild);forEachChildren(tl,(child=>{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>tl.iterationDuration)tl.iterationDuration=childDur}));tl.duration=getTimelineTotalDuration(tl);return tl}class Timeline extends Timer{constructor(parameters={}){super(parameters,null,0);this.duration=0;this.labels={};const defaultsParams=parameters.defaults;const globalDefaults=globals.defaults;this.defaults=defaultsParams?mergeObjects(defaultsParams,globalDefaults):globalDefaults;this.onRender=parameters.onRender||globalDefaults.onRender;const tlPlaybackEase=setValue(parameters.playbackEase,globalDefaults.playbackEase);this._ease=tlPlaybackEase?parseEasings(tlPlaybackEase):null;this.iterationDuration=0}add(a1,a2,a3){const isAnim=isObj(a2);const isTimer=isObj(a1);if(isAnim||isTimer){this._hasChildren=true;if(isAnim){const childParams=a2;if(isFnc(a3)){const staggeredPosition=a3;const parsedTargetsArray=parseTargets(a1);const tlDuration=this.duration;const tlIterationDuration=this.iterationDuration;const id=childParams.id;let i=0;const parsedLength=parsedTargetsArray.length;parsedTargetsArray.forEach((target=>{const staggeredChildParams={...childParams};this.duration=tlDuration;this.iterationDuration=tlIterationDuration;if(!isUnd(id))staggeredChildParams.id=id+"-"+i;addTlChild(staggeredChildParams,this,staggeredPosition(target,i,parsedLength,this),target,i,parsedLength);i++}))}else{addTlChild(childParams,this,parseTimelinePosition(this,a3),a1)}}else{addTlChild(a1,this,parseTimelinePosition(this,a2))}return this.init(1)}}sync(synced,position){if(isUnd(synced)||synced&&isUnd(synced.pause))return this;synced.pause();const duration=+(synced.effect?synced.effect.getTiming().duration:synced.duration);return this.add(synced,{currentTime:[0,duration],duration:duration,ease:"linear"},position)}set(targets,parameters,position){if(isUnd(parameters))return this;parameters.duration=minValue;parameters.composition=compositionTypes.replace;return this.add(targets,parameters,position)}call(callback,position){if(isUnd(callback)||callback&&!isFnc(callback))return this;return this.add({duration:0,onComplete:()=>callback(this)},position)}label(labelName,position){if(isUnd(labelName)||labelName&&!isStr(labelName))return this;this.labels[labelName]=parseTimelinePosition(this,position);return this}remove(targets,propertyName){remove(targets,this,propertyName);return this}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;const labels=this.labels;forEachChildren(this,(child=>child.stretch(child.duration*timeScale)));for(let labelName in labels)labels[labelName]*=timeScale;return super.stretch(newDuration)}refresh(){forEachChildren(this,(child=>{if(child.refresh)child.refresh()}));return this}revert(){super.revert();forEachChildren(this,(child=>child.revert),true);return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const createTimeline=parameters=>new Timeline(parameters).init();class Animatable{constructor(targets,parameters){if(globals.scope)globals.scope.revertibles.push(this);const globalParams={};const properties={};this.targets=[];this.animations={};if(isUnd(targets)||isUnd(parameters))return;for(let propName in parameters){const paramValue=parameters[propName];if(isKey(propName)){properties[propName]=paramValue}else{globalParams[propName]=paramValue}}for(let propName in properties){const propValue=properties[propName];const isObjValue=isObj(propValue);let propParams={};let to="+=0";if(isObjValue){const unit=propValue.unit;if(isStr(unit))to+=unit}else{propParams.duration=propValue}propParams[propName]=isObjValue?mergeObjects({to:to},propValue):to;const animParams=mergeObjects(globalParams,propParams);animParams.composition=compositionTypes.replace;animParams.autoplay=false;const animation=this.animations[propName]=new JSAnimation(targets,animParams,null,0,false).init();if(!this.targets.length)this.targets.push(...animation.targets);this[propName]=(to,duration,ease)=>{const tween=animation._head;if(isUnd(to)&&tween){const numbers=tween._numbers;if(numbers&&numbers.length){return numbers}else{return tween._modifier(tween._number)}}else{forEachChildren(animation,(tween=>{if(isArr(to)){for(let i=0,l=to.length;i<l;i++){if(!isUnd(tween._numbers[i])){tween._fromNumbers[i]=tween._modifier(tween._numbers[i]);tween._toNumbers[i]=to[i]}}}else{tween._fromNumber=tween._modifier(tween._number);tween._toNumber=to}if(!isUnd(ease))tween._ease=parseEasings(ease);tween._currentTime=0}));if(!isUnd(duration))animation.stretch(duration);animation.reset(1).resume();return this}}}}revert(){for(let propName in this.animations){this[propName]=noop;this.animations[propName].revert()}this.animations={};this.targets.length=0;return this}}const createAnimatable=(targets,parameters)=>new Animatable(targets,parameters);class Spring{constructor(parameters={}){this.timeStep=.02;this.restThreshold=5e-4;this.restDuration=200;this.maxDuration=6e4;this.maxRestSteps=this.restDuration/this.timeStep/K;this.maxIterations=this.maxDuration/this.timeStep/K;this.m=clamp(setValue(parameters.mass,1),0,K);this.s=clamp(setValue(parameters.stiffness,100),1,K);this.d=clamp(setValue(parameters.damping,10),.1,K);this.v=clamp(setValue(parameters.velocity,0),-1e3,K);this.w0=0;this.zeta=0;this.wd=0;this.b=0;this.solverDuration=0;this.duration=0;this.compute();this.ease=t=>t===0||t===1?t:this.solve(t*this.solverDuration)}solve(time){const{zeta:zeta,w0:w0,wd:wd,b:b}=this;let t=time;if(zeta<1){t=exp(-t*zeta*w0)*(1*cos(wd*t)+b*sin(wd*t))}else{t=(1+b*t)*exp(-t*w0)}return 1-t}compute(){const{maxRestSteps:maxRestSteps,maxIterations:maxIterations,restThreshold:restThreshold,timeStep:timeStep,m:m,d:d,s:s,v:v}=this;const w0=this.w0=clamp(sqrt(s/m),minValue,K);const zeta=this.zeta=d/(2*sqrt(s*m));const wd=this.wd=zeta<1?w0*sqrt(1-zeta*zeta):0;this.b=zeta<1?(zeta*w0+-v)/wd:-v+w0;let solverTime=0;let restSteps=0;let iterations=0;while(restSteps<maxRestSteps&&iterations<maxIterations){if(abs(1-this.solve(solverTime))<restThreshold){restSteps++}else{restSteps=0}this.solverDuration=solverTime;solverTime+=timeStep;iterations++}this.duration=round(this.solverDuration*K,0)*globals.timeScale}get mass(){return this.m}set mass(v){this.m=clamp(setValue(v,1),0,K);this.compute()}get stiffness(){return this.s}set stiffness(v){this.s=clamp(setValue(v,100),1,K);this.compute()}get damping(){return this.d}set damping(v){this.d=clamp(setValue(v,10),.1,K);this.compute()}get velocity(){return this.v}set velocity(v){this.v=clamp(setValue(v,0),-1e3,K);this.compute()}}const createSpring=parameters=>new Spring(parameters);const preventDefault=e=>{if(e.cancelable)e.preventDefault()};class DOMProxy{constructor(el){this.el=el;this.zIndex=0;this.parentElement=null;this.classList={add:noop,remove:noop}}get x(){return this.el.x||0}set x(v){this.el.x=v}get y(){return this.el.y||0}set y(v){this.el.y=v}get width(){return this.el.width||0}set width(v){this.el.width=v}get height(){return this.el.height||0}set height(v){this.el.height=v}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Transforms{constructor($el){this.$el=$el;this.inlineTransforms=[];this.point=new DOMPoint;this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(x,y){this.point.x=x;this.point.y=y;return this.point.matrixTransform(this.inversedMatrix)}traverseUp(cb){let $el=this.$el.parentElement,i=0;while($el&&$el!==doc){cb($el,i);$el=$el.parentElement;i++}}getMatrix(){const matrix=new DOMMatrix;this.traverseUp(($el=>{const transformValue=getComputedStyle($el).transform;if(transformValue){const elMatrix=new DOMMatrix(transformValue);matrix.preMultiplySelf(elMatrix)}}));return matrix}remove(){this.traverseUp((($el,i)=>{this.inlineTransforms[i]=$el.style.transform;$el.style.transform="none"}))}revert(){this.traverseUp((($el,i)=>{const ct=this.inlineTransforms[i];if(ct===""){$el.style.removeProperty("transform")}else{$el.style.transform=ct}}))}}const parseDraggableFunctionParameter=(value,draggable)=>value&&isFnc(value)?value(draggable):value;let zIndex=0;class Draggable{constructor(target,parameters={}){if(!target)return;if(globals.scope)globals.scope.revertibles.push(this);const paramX=parameters.x;const paramY=parameters.y;const trigger=parameters.trigger;const modifier=parameters.modifier;const ease=parameters.releaseEase;const customEase=ease&&parseEasings(ease);const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const xProp=isObj(paramX)&&!isUnd(paramX.mapTo)?paramX.mapTo:"translateX";const yProp=isObj(paramY)&&!isUnd(paramY.mapTo)?paramY.mapTo:"translateY";const container=parseDraggableFunctionParameter(parameters.container,this);this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.$target=isObj(target)?new DOMProxy(target):parseTargets(target)[0];this.$trigger=parseTargets(trigger?trigger:target)[0];this.fixed=getTargetValue(this.$target,"position")==="fixed";this.isFinePointer=true;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.maxVelocity=0;this.minVelocity=0;this.velocityMultiplier=0;this.cursor=false;this.releaseXSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseYSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseEase=customEase||eases.outQuint;this.hasReleaseSpring=hasSpring;this.onGrab=parameters.onGrab||noop;this.onDrag=parameters.onDrag||noop;this.onRelease=parameters.onRelease||noop;this.onUpdate=parameters.onUpdate||noop;this.onSettle=parameters.onSettle||noop;this.onSnap=parameters.onSnap||noop;this.onResize=parameters.onResize||noop;this.onAfterResize=parameters.onAfterResize||noop;this.disabled=[0,0];const animatableParams={};if(modifier)animatableParams.modifier=modifier;if(isUnd(paramX)||paramX===true){animatableParams[xProp]=0}else if(isObj(paramX)){const paramXObject=paramX;const animatableXParams={};if(paramXObject.modifier)animatableXParams.modifier=paramXObject.modifier;if(paramXObject.composition)animatableXParams.composition=paramXObject.composition;animatableParams[xProp]=animatableXParams}else if(paramX===false){animatableParams[xProp]=0;this.disabled[0]=1}if(isUnd(paramY)||paramY===true){animatableParams[yProp]=0}else if(isObj(paramY)){const paramYObject=paramY;const animatableYParams={};if(paramYObject.modifier)animatableYParams.modifier=paramYObject.modifier;if(paramYObject.composition)animatableYParams.composition=paramYObject.composition;animatableParams[yProp]=animatableYParams}else if(paramY===false){animatableParams[yProp]=0;this.disabled[1]=1}this.animate=new Animatable(this.$target,animatableParams);this.xProp=xProp;this.yProp=yProp;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=[-1e12,maxValue,maxValue,-1e12];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=now();this.velocity=0;this.angle=0;this.cursorStyles=null;this.triggerStyles=null;this.bodyStyles=null;this.targetStyles=null;this.touchActionStyles=null;this.transforms=new Transforms(this.$target);this.overshootCoords={x:0,y:0};this.overshootXTicker=new Timer({autoplay:false},null,0).init();this.overshootYTicker=new Timer({autoplay:false},null,0).init();this.updateTicker=new Timer({autoplay:false},null,0).init();this.overshootXTicker.onUpdate=()=>{if(this.disabled[0])return;this.updated=true;this.manual=true;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootXTicker.onComplete=()=>{if(this.disabled[0])return;this.manual=false;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootYTicker.onUpdate=()=>{if(this.disabled[1])return;this.updated=true;this.manual=true;this.animate[this.yProp](this.overshootCoords.y,0)};this.overshootYTicker.onComplete=()=>{if(this.disabled[1])return;this.manual=false;this.animate[this.yProp](this.overshootCoords.y,0)};this.updateTicker.onUpdate=()=>this.update();this.contained=!isUnd(container);this.manual=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.enabled=false;this.initialized=false;this.activeProp=this.disabled[1]?xProp:yProp;this.animate.animations[this.activeProp].onRender=()=>{const hasUpdated=this.updated;const hasMoved=this.grabbed&&hasUpdated;const hasReleased=!hasMoved&&this.released;const x=this.x;const y=this.y;const dx=x-this.coords[2];const dy=y-this.coords[3];this.deltaX=dx;this.deltaY=dy;this.coords[2]=x;this.coords[3]=y;if(hasUpdated){this.onUpdate(this)}if(!hasReleased){this.updated=false}else{this.computeVelocity(dx,dy);this.angle=atan2(dy,dx)}};this.animate.animations[this.activeProp].onComplete=()=>{if(!this.grabbed&&this.released){this.released=false}if(!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 Timer({autoplay:false,duration:150*globals.timeScale,onComplete:()=>{this.onResize(this);this.refresh();this.onAfterResize(this)}}).init();this.parameters=parameters;this.resizeObserver=new ResizeObserver((()=>{if(this.initialized){this.resizeTicker.restart()}else{this.initialized=true}}));this.enable();this.refresh();this.resizeObserver.observe(this.$container);if(!isObj(target))this.resizeObserver.observe(this.$target)}computeVelocity(dx,dy){const prevTime=this.velocityTime;const curTime=now();const elapsed=curTime-prevTime;if(elapsed<17)return this.velocity;this.velocityTime=curTime;const velocityStack=this.velocityStack;const vMul=this.velocityMultiplier;const minV=this.minVelocity;const maxV=this.maxVelocity;const vi=this.velocityStackIndex;velocityStack[vi]=round(clamp(sqrt(dx*dx+dy*dy)/elapsed*vMul,minV,maxV),5);const velocity=max(velocityStack[0],velocityStack[1],velocityStack[2]);this.velocity=velocity;this.velocityStackIndex=(vi+1)%3;return velocity}setX(x,muteUpdateCallback=false){if(this.disabled[0])return;const v=round(x,5);this.overshootXTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destX=v;this.snapped[0]=snap(v,this.snapX);this.animate[this.xProp](v,0);this.manual=false;return this}setY(y,muteUpdateCallback=false){if(this.disabled[1])return;const v=round(y,5);this.overshootYTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destY=v;this.snapped[1]=snap(v,this.snapY);this.animate[this.yProp](v,0);this.manual=false;return this}get x(){return round(this.animate[this.xProp](),globals.precision)}set x(x){this.setX(x,false)}get y(){return round(this.animate[this.yProp](),globals.precision)}set y(y){this.setY(y,false)}get progressX(){return mapRange(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(x){this.setX(mapRange(x,0,1,this.containerBounds[3],this.containerBounds[1]),false)}get progressY(){return mapRange(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(y){this.setY(mapRange(y,0,1,this.containerBounds[0],this.containerBounds[2]),false)}updateScrollCoords(){const sx=round(this.useWin?win.scrollX:this.$container.scrollLeft,0);const sy=round(this.useWin?win.scrollY:this.$container.scrollTop,0);const[cpt,cpr,cpb,cpl]=this.containerPadding;const threshold=this.scrollThreshold;this.scroll.x=sx;this.scroll.y=sy;this.scrollBounds[0]=sy-this.targetBounds[0]+cpt-threshold;this.scrollBounds[1]=sx-this.targetBounds[1]-cpr+threshold;this.scrollBounds[2]=sy-this.targetBounds[2]-cpb+threshold;this.scrollBounds[3]=sx-this.targetBounds[3]+cpl-threshold}updateBoundingValues(){const $container=this.$container;const cx=this.x;const cy=this.y;const cx2=this.coords[2];const cy2=this.coords[3];this.coords[2]=0;this.coords[3]=0;this.setX(0,true);this.setY(0,true);this.transforms.remove();const iw=this.window[0]=win.innerWidth;const ih=this.window[1]=win.innerHeight;const uw=this.useWin;const sw=$container.scrollWidth;const sh=$container.scrollHeight;const fx=this.fixed;const transformContainerRect=$container.getBoundingClientRect();const[cpt,cpr,cpb,cpl]=this.containerPadding;this.dragArea[0]=uw?0:transformContainerRect.left;this.dragArea[1]=uw?0:transformContainerRect.top;this.scrollView[0]=uw?clamp(sw,iw,sw):sw;this.scrollView[1]=uw?clamp(sh,ih,sh):sh;this.updateScrollCoords();const{width:width,height:height,left:left,top:top,right:right,bottom:bottom}=$container.getBoundingClientRect();this.dragArea[2]=round(uw?clamp(width,iw,iw):width,0);this.dragArea[3]=round(uw?clamp(height,ih,ih):height,0);const containerOverflow=getTargetValue($container,"overflow");const visibleOverflow=containerOverflow==="visible";const hiddenOverflow=containerOverflow==="hidden";this.canScroll=fx?false:this.contained&&($container===doc.body&&visibleOverflow||!hiddenOverflow&&!visibleOverflow)&&(sw>this.dragArea[2]+cpl-cpr||sh>this.dragArea[3]+cpt-cpb)&&(!this.containerArray||this.containerArray&&!isArr(this.containerArray));if(this.contained){const sx=this.scroll.x;const sy=this.scroll.y;const canScroll=this.canScroll;const targetRect=this.$target.getBoundingClientRect();const hiddenLeft=canScroll?uw?0:$container.scrollLeft:0;const hiddenTop=canScroll?uw?0:$container.scrollTop:0;const hiddenRight=canScroll?this.scrollView[0]-hiddenLeft-width:0;const hiddenBottom=canScroll?this.scrollView[1]-hiddenTop-height:0;this.targetBounds[0]=round(targetRect.top+sy-(uw?0:top),0);this.targetBounds[1]=round(targetRect.right+sx-(uw?iw:right),0);this.targetBounds[2]=round(targetRect.bottom+sy-(uw?ih:bottom),0);this.targetBounds[3]=round(targetRect.left+sx-(uw?0:left),0);if(this.containerArray){this.containerBounds[0]=this.containerArray[0]+cpt;this.containerBounds[1]=this.containerArray[1]-cpr;this.containerBounds[2]=this.containerArray[2]-cpb;this.containerBounds[3]=this.containerArray[3]+cpl}else{this.containerBounds[0]=-round(targetRect.top-(fx?clamp(top,0,ih):top)+hiddenTop-cpt,0);this.containerBounds[1]=-round(targetRect.right-(fx?clamp(right,0,iw):right)-hiddenRight+cpr,0);this.containerBounds[2]=-round(targetRect.bottom-(fx?clamp(bottom,0,ih):bottom)-hiddenBottom+cpb,0);this.containerBounds[3]=-round(targetRect.left-(fx?clamp(left,0,iw):left)+hiddenLeft-cpl,0)}}this.transforms.revert();this.coords[2]=cx2;this.coords[3]=cy2;this.setX(cx,true);this.setY(cy,true)}isOutOfBounds(bounds,x,y){if(!this.contained)return 0;const[bt,br,bb,bl]=bounds;const[dx,dy]=this.disabled;const obx=!dx&&x<bl||!dx&&x>br;const oby=!dy&&y<bt||!dy&&y>bb;return obx&&!oby?1:!obx&&oby?2:obx&&oby?3:0}refresh(){const params=this.parameters;const paramX=params.x;const paramY=params.y;const container=parseDraggableFunctionParameter(params.container,this);const cp=parseDraggableFunctionParameter(params.containerPadding,this)||0;const containerPadding=isArr(cp)?cp:[cp,cp,cp,cp];const cx=this.x;const cy=this.y;const parsedCursorStyles=parseDraggableFunctionParameter(params.cursor,this);const cursorStyles={onHover:"grab",onGrab:"grabbing"};if(parsedCursorStyles){const{onHover:onHover,onGrab:onGrab}=parsedCursorStyles;if(onHover)cursorStyles.onHover=onHover;if(onGrab)cursorStyles.onGrab=onGrab}this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.isFinePointer=matchMedia("(pointer:fine)").matches;this.containerPadding=setValue(containerPadding,[0,0,0,0]);this.containerFriction=clamp(setValue(parseDraggableFunctionParameter(params.containerFriction,this),.8),0,1);this.releaseContainerFriction=clamp(setValue(parseDraggableFunctionParameter(params.releaseContainerFriction,this),this.containerFriction),0,1);this.snapX=parseDraggableFunctionParameter(isObj(paramX)&&!isUnd(paramX.snap)?paramX.snap:params.snap,this);this.snapY=parseDraggableFunctionParameter(isObj(paramY)&&!isUnd(paramY.snap)?paramY.snap:params.snap,this);this.scrollSpeed=setValue(parseDraggableFunctionParameter(params.scrollSpeed,this),1.5);this.scrollThreshold=setValue(parseDraggableFunctionParameter(params.scrollThreshold,this),20);this.dragSpeed=setValue(parseDraggableFunctionParameter(params.dragSpeed,this),1);this.minVelocity=setValue(parseDraggableFunctionParameter(params.minVelocity,this),0);this.maxVelocity=setValue(parseDraggableFunctionParameter(params.maxVelocity,this),50);this.velocityMultiplier=setValue(parseDraggableFunctionParameter(params.velocityMultiplier,this),1);this.cursor=parsedCursorStyles===false?false:cursorStyles;this.updateBoundingValues();const[bt,br,bb,bl]=this.containerBounds;this.setX(clamp(cx,bl,br),true);this.setY(clamp(cy,bt,bb),true)}update(){this.updateScrollCoords();if(this.canScroll){const[cpt,cpr,cpb,cpl]=this.containerPadding;const[sw,sh]=this.scrollView;const daw=this.dragArea[2];const dah=this.dragArea[3];const csx=this.scroll.x;const csy=this.scroll.y;const nsw=this.$container.scrollWidth;const nsh=this.$container.scrollHeight;const csw=this.useWin?clamp(nsw,this.window[0],nsw):nsw;const csh=this.useWin?clamp(nsh,this.window[1],nsh):nsh;const swd=sw-csw;const shd=sh-csh;if(this.dragged&&swd>0){this.coords[0]-=swd;this.scrollView[0]=csw}if(this.dragged&&shd>0){this.coords[1]-=shd;this.scrollView[1]=csh}const s=this.scrollSpeed*10;const threshold=this.scrollThreshold;const[x,y]=this.coords;const[st,sr,sb,sl]=this.scrollBounds;const t=round(clamp((y-st+cpt)/threshold,-1,0)*s,0);const r=round(clamp((x-sr-cpr)/threshold,0,1)*s,0);const b=round(clamp((y-sb-cpb)/threshold,0,1)*s,0);const l=round(clamp((x-sl+cpl)/threshold,-1,0)*s,0);if(t||b||l||r){const[nx,ny]=this.disabled;let scrollX=csx;let scrollY=csy;if(!nx){scrollX=round(clamp(csx+(l||r),0,sw-daw),0);this.coords[0]-=csx-scrollX}if(!ny){scrollY=round(clamp(csy+(t||b),0,sh-dah),0);this.coords[1]-=csy-scrollY}if(this.useWin){this.$scrollContainer.scrollBy(-(csx-scrollX),-(csy-scrollY))}else{this.$scrollContainer.scrollTo(scrollX,scrollY)}}}const[ct,cr,cb,cl]=this.containerBounds;const[px1,py1,px2,py2,px3,py3]=this.pointer;this.coords[0]+=(px1-px3)*this.dragSpeed;this.coords[1]+=(py1-py3)*this.dragSpeed;this.pointer[4]=px1;this.pointer[5]=py1;const[cx,cy]=this.coords;const[sx,sy]=this.snapped;const cf=(1-this.containerFriction)*this.dragSpeed;this.setX(cx>cr?cr+(cx-cr)*cf:cx<cl?cl+(cx-cl)*cf:cx,false);this.setY(cy>cb?cb+(cy-cb)*cf:cy<ct?ct+(cy-ct)*cf:cy,false);this.computeVelocity(px1-px3,py1-py3);this.angle=atan2(py1-py2,px1-px2);const[nsx,nsy]=this.snapped;if(nsx!==sx&&this.snapX||nsy!==sy&&this.snapY){this.onSnap(this)}}stop(){this.updateTicker.pause();this.overshootXTicker.pause();this.overshootYTicker.pause();for(let prop in this.animate.animations)this.animate.animations[prop].pause();remove(this,null,"x");remove(this,null,"y");remove(this,null,"progressX");remove(this,null,"progressY");remove(this.scroll);remove(this.overshootCoords);return this}scrollInView(duration,gap=0,ease=eases.inOutQuad){this.updateScrollCoords();const x=this.destX;const y=this.destY;const scroll=this.scroll;const scrollBounds=this.scrollBounds;const canScroll=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(scrollBounds,x,y)){const[st,sr,sb,sl]=scrollBounds;const t=round(clamp(y-st,-1e12,0),0);const r=round(clamp(x-sr,0,maxValue),0);const b=round(clamp(y-sb,0,maxValue),0);const l=round(clamp(x-sl,-1e12,0),0);new JSAnimation(scroll,{x:round(scroll.x+(l?l-gap:r?r+gap:0),0),y:round(scroll.y+(t?t-gap:b?b+gap:0),0),duration:isUnd(duration)?350*globals.timeScale:duration,ease:ease,onUpdate:()=>{this.canScroll=false;this.$scrollContainer.scrollTo(scroll.x,scroll.y)}}).init().then((()=>{this.canScroll=canScroll}))}return this}handleHover(){if(this.isFinePointer&&this.cursor&&!this.cursorStyles){this.cursorStyles=setTargetValues(this.$trigger,{cursor:this.cursor.onHover})}}animateInView(duration,gap=0,ease=eases.inOutQuad){this.stop();this.updateBoundingValues();const x=this.x;const y=this.y;const[cpt,cpr,cpb,cpl]=this.containerPadding;const bt=this.scroll.y-this.targetBounds[0]+cpt+gap;const br=this.scroll.x-this.targetBounds[1]-cpr-gap;const bb=this.scroll.y-this.targetBounds[2]-cpb-gap;const bl=this.scroll.x-this.targetBounds[3]+cpl+gap;const ob=this.isOutOfBounds([bt,br,bb,bl],x,y);if(ob){const[disabledX,disabledY]=this.disabled;const destX=clamp(snap(x,this.snapX),bl,br);const destY=clamp(snap(y,this.snapY),bt,bb);const dur=isUnd(duration)?350*globals.timeScale:duration;if(!disabledX&&(ob===1||ob===3))this.animate[this.xProp](destX,dur,ease);if(!disabledY&&(ob===2||ob===3))this.animate[this.yProp](destY,dur,ease)}return this}handleDown(e){const $eTarget=e.target;if(this.grabbed||$eTarget.type==="range")return;e.stopPropagation();this.grabbed=true;this.released=false;this.stop();this.updateBoundingValues();const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const[ct,cr,cb,cl]=this.containerBounds;const cf=(1-this.containerFriction)*this.dragSpeed;const cx=this.x;const cy=this.y;this.coords[0]=this.coords[2]=!cf?cx:cx>cr?cr+(cx-cr)/cf:cx<cl?cl+(cx-cl)/cf:cx;this.coords[1]=this.coords[3]=!cf?cy:cy>cb?cb+(cy-cb)/cf:cy<ct?ct+(cy-ct)/cf:cy;this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y;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;if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}const z=getTargetValue(this.$target,"zIndex",false);zIndex=(z>zIndex?z:zIndex)+1;this.targetStyles=setTargetValues(this.$target,{zIndex:zIndex});if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.isFinePointer&&this.cursor){this.bodyStyles=setTargetValues(doc.body,{cursor:this.cursor.onGrab})}this.scrollInView(100,0,eases.out(3));this.onGrab(this);doc.addEventListener("touchmove",this);doc.addEventListener("touchend",this);doc.addEventListener("touchcancel",this);doc.addEventListener("mousemove",this);doc.addEventListener("mouseup",this);doc.addEventListener("selectstart",this)}handleMove(e){if(!this.grabbed)return;const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const movedX=x-this.pointer[6];const movedY=y-this.pointer[7];let $parent=e.target;let isAtTop=false;let isAtBottom=false;let canTouchScroll=false;while(touches&&$parent&&$parent!==this.$trigger){const overflowY=getTargetValue($parent,"overflow-y");if(overflowY!=="hidden"&&overflowY!=="visible"){const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=$parent;if(scrollHeight>clientHeight){canTouchScroll=true;isAtTop=scrollTop<=3;isAtBottom=scrollTop>=scrollHeight-clientHeight-3;break}}$parent=$parent.parentNode}if(canTouchScroll&&(!isAtTop&&!isAtBottom||isAtTop&&movedY<0||isAtBottom&&movedY>0)){this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y}else{preventDefault(e);if(!this.triggerStyles)this.triggerStyles=setTargetValues(this.$trigger,{pointerEvents:"none"});this.$trigger.addEventListener("touchstart",preventDefault,{passive:false});this.$trigger.addEventListener("touchmove",preventDefault,{passive:false});this.$trigger.addEventListener("touchend",preventDefault);if(!this.disabled[0]&&abs(movedX)>3||!this.disabled[1]&&abs(movedY)>3){this.updateTicker.resume();this.pointer[2]=this.pointer[0];this.pointer[3]=this.pointer[1];this.pointer[0]=x;this.pointer[1]=y;this.dragged=true;this.released=false;this.onDrag(this)}}}handleUp(){if(!this.grabbed)return;this.updateTicker.pause();if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}const[disabledX,disabledY]=this.disabled;const[px1,py1,px2,py2,px3,py3]=this.pointer;const[ct,cr,cb,cl]=this.containerBounds;const[sx,sy]=this.snapped;const springX=this.releaseXSpring;const springY=this.releaseYSpring;const releaseEase=this.releaseEase;const hasReleaseSpring=this.hasReleaseSpring;const overshootCoords=this.overshootCoords;const cx=this.x;const cy=this.y;const pv=this.computeVelocity(px1-px3,py1-py3);const pa=this.angle=atan2(py1-py2,px1-px2);const ds=pv*150;const cf=(1-this.releaseContainerFriction)*this.dragSpeed;const nx=cx+cos(pa)*ds;const ny=cy+sin(pa)*ds;const bx=nx>cr?cr+(nx-cr)*cf:nx<cl?cl+(nx-cl)*cf:nx;const by=ny>cb?cb+(ny-cb)*cf:ny<ct?ct+(ny-ct)*cf:ny;const dx=this.destX=clamp(round(snap(bx,this.snapX),5),cl,cr);const dy=this.destY=clamp(round(snap(by,this.snapY),5),ct,cb);const ob=this.isOutOfBounds(this.containerBounds,nx,ny);let durationX=0;let durationY=0;let easeX=releaseEase;let easeY=releaseEase;let longestReleaseDuration=0;overshootCoords.x=cx;overshootCoords.y=cy;if(!disabledX){const directionX=dx===cr?cx>cr?-1:1:cx<cl?-1:1;const distanceX=round(cx-dx,0);springX.velocity=disabledY&&hasReleaseSpring?distanceX?ds*directionX/abs(distanceX):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springX;durationX=cx===dx?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeX=ease;if(durationX>longestReleaseDuration)longestReleaseDuration=durationX}if(!disabledY){const directionY=dy===cb?cy>cb?-1:1:cy<ct?-1:1;const distanceY=round(cy-dy,0);springY.velocity=disabledX&&hasReleaseSpring?distanceY?ds*directionY/abs(distanceY):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springY;durationY=cy===dy?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeY=ease;if(durationY>longestReleaseDuration)longestReleaseDuration=durationY}if(!hasReleaseSpring&&ob&&cf&&(durationX||durationY)){const composition=compositionTypes.blend;new JSAnimation(overshootCoords,{x:{to:bx,duration:durationX*.65},y:{to:by,duration:durationY*.65},ease:releaseEase,composition:composition}).init();new JSAnimation(overshootCoords,{x:{to:dx,duration:durationX},y:{to:dy,duration:durationY},ease:releaseEase,composition:composition}).init();this.overshootXTicker.stretch(durationX).restart();this.overshootYTicker.stretch(durationY).restart()}else{if(!disabledX)this.animate[this.xProp](dx,durationX,easeX);if(!disabledY)this.animate[this.yProp](dy,durationY,easeY)}this.scrollInView(longestReleaseDuration,this.scrollThreshold,releaseEase);let hasSnapped=false;if(dx!==sx){this.snapped[0]=dx;if(this.snapX)hasSnapped=true}if(dy!==sy&&this.snapY){this.snapped[1]=dy;if(this.snapY)hasSnapped=true}if(hasSnapped)this.onSnap(this);this.grabbed=false;this.dragged=false;this.updated=true;this.released=true;this.onRelease(this);this.$trigger.removeEventListener("touchstart",preventDefault);this.$trigger.removeEventListener("touchmove",preventDefault);this.$trigger.removeEventListener("touchend",preventDefault);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this)}reset(){this.stop();this.resizeTicker.pause();this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.setX(0,true);this.setY(0,true);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;return this}enable(){if(!this.enabled){this.enabled=true;this.$target.classList.remove("is-disabled");this.touchActionStyles=setTargetValues(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"});this.$trigger.addEventListener("touchstart",this,{passive:true});this.$trigger.addEventListener("mousedown",this,{passive:true});this.$trigger.addEventListener("mouseenter",this)}return this}disable(){this.enabled=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.touchActionStyles.revert();if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}this.stop();this.$target.classList.add("is-disabled");this.$trigger.removeEventListener("touchstart",this);this.$trigger.removeEventListener("mousedown",this);this.$trigger.removeEventListener("mouseenter",this);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this);return this}revert(){this.reset();this.disable();this.$target.classList.remove("is-disabled");this.updateTicker.revert();this.overshootXTicker.revert();this.overshootYTicker.revert();this.resizeTicker.revert();this.animate.revert();return this}handleEvent(e){switch(e.type){case"mousedown":this.handleDown(e);break;case"touchstart":this.handleDown(e);break;case"mousemove":this.handleMove(e);break;case"touchmove":this.handleMove(e);break;case"mouseup":this.handleUp();break;case"touchend":this.handleUp();break;case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":preventDefault(e);break}}}const createDraggable=(target,parameters)=>new Draggable(target,parameters);class Scope{constructor(parameters={}){if(globals.scope)globals.scope.revertibles.push(this);const rootParam=parameters.root;let root=doc;if(rootParam){root=rootParam.current||rootParam.nativeElement||parseTargets(rootParam)[0]||doc}const scopeDefaults=parameters.defaults;const globalDefault=globals.defaults;const mediaQueries=parameters.mediaQueries;this.defaults=scopeDefaults?mergeObjects(scopeDefaults,globalDefault):globalDefault;this.root=root;this.constructors=[];this.revertConstructors=[];this.revertibles=[];this.methods={};this.matches={};this.mediaQueryLists={};this.data={};if(mediaQueries){for(let mq in mediaQueries){const _mq=win.matchMedia(mediaQueries[mq]);this.mediaQueryLists[mq]=_mq;_mq.addEventListener("change",this)}}}execute(cb){let activeScope=globals.scope;let activeRoot=globals.root;let activeDefaults=globals.defaults;globals.scope=this;globals.root=this.root;globals.defaults=this.defaults;const mqs=this.mediaQueryLists;for(let mq in mqs)this.matches[mq]=mqs[mq].matches;const returned=cb(this);globals.scope=activeScope;globals.root=activeRoot;globals.defaults=activeDefaults;return returned}refresh(){this.execute((()=>{let i=this.revertibles.length;let y=this.revertConstructors.length;while(i--)this.revertibles[i].revert();while(y--)this.revertConstructors[y](this);this.revertibles.length=0;this.revertConstructors.length=0;this.constructors.forEach((constructor=>{const revertConstructor=constructor(this);if(revertConstructor){this.revertConstructors.push(revertConstructor)}}))}));return this}add(a1,a2){if(isFnc(a1)){const constructor=a1;this.constructors.push(constructor);this.execute((()=>{const revertConstructor=constructor(this);if(revertConstructor){this.revertConstructors.push(revertConstructor)}}))}else{this.methods[a1]=(...args)=>this.execute((()=>a2(...args)))}return this}handleEvent(e){switch(e.type){case"change":this.refresh();break}}revert(){const revertibles=this.revertibles;const revertConstructors=this.revertConstructors;const mqs=this.mediaQueryLists;let i=revertibles.length;let y=revertConstructors.length;while(i--)revertibles[i].revert();while(y--)revertConstructors[y](this);for(let mq in mqs)mqs[mq].removeEventListener("change",this);revertibles.length=0;revertConstructors.length=0;this.constructors.length=0;this.matches={};this.methods={};this.mediaQueryLists={};this.data={}}}const createScope=params=>new Scope(params);const getMaxViewHeight=()=>{const $el=document.createElement("div");doc.body.appendChild($el);$el.style.height="100lvh";const height=$el.offsetHeight;doc.body.removeChild($el);return height};const parseScrollObserverFunctionParameter=(value,scroller)=>value&&isFnc(value)?value(scroller):value;const scrollContainers=new Map;class ScrollContainer{constructor($el){this.element=$el;this.useWin=this.element===doc.body;this.winWidth=0;this.winHeight=0;this.width=0;this.height=0;this.left=0;this.top=0;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=false;this.backwardY=false;this.scrollTicker=new Timer({autoplay:false,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const backwards=this.backwardX||this.backwardY;forEachChildren(this,(child=>child.handleScroll()),backwards)},onComplete:()=>this.dataTimer.pause()}).init();this.dataTimer=new Timer({autoplay:false,frameRate:30,onUpdate:self=>{const dt=self.deltaTime;const px=this.prevScrollX;const py=this.prevScrollY;const nx=this.scrollX;const ny=this.scrollY;const dx=px-nx;const dy=py-ny;this.prevScrollX=nx;this.prevScrollY=ny;if(dx)this.backwardX=px>nx;if(dy)this.backwardY=py>ny;this.velocity=round(dt>0?Math.sqrt(dx*dx+dy*dy)/dt:0,5)}}).init();this.resizeTicker=new Timer({autoplay:false,duration:250*globals.timeScale,onComplete:()=>{this.updateWindowBounds();this.refreshScrollObservers();this.handleScroll()}}).init();this.wakeTicker=new Timer({autoplay:false,duration:500*globals.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?win:this.element).addEventListener("scroll",this,false)}updateScrollCoords(){const useWin=this.useWin;const $el=this.element;this.scrollX=round(useWin?win.scrollX:$el.scrollLeft,0);this.scrollY=round(useWin?win.scrollY:$el.scrollTop,0)}updateWindowBounds(){this.winWidth=win.innerWidth;this.winHeight=getMaxViewHeight()}updateBounds(){const style=getComputedStyle(this.element);const $el=this.element;this.scrollWidth=$el.scrollWidth+parseFloat(style.marginLeft)+parseFloat(style.marginRight);this.scrollHeight=$el.scrollHeight+parseFloat(style.marginTop)+parseFloat(style.marginBottom);this.updateWindowBounds();let width,height;if(this.useWin){width=this.winWidth;height=this.winHeight}else{const elRect=$el.getBoundingClientRect();width=elRect.width;height=elRect.height;this.top=elRect.top;this.left=elRect.left}this.width=width;this.height=height}refreshScrollObservers(){forEachChildren(this,(child=>{if(child._debug){child.removeDebug()}}));this.updateBounds();forEachChildren(this,(child=>{child.refresh();if(child._debug){child.debug()}}))}refresh(){this.updateWindowBounds();this.updateBounds();this.refreshScrollObservers();this.handleScroll()}handleScroll(){this.updateScrollCoords();this.wakeTicker.restart()}handleEvent(e){switch(e.type){case"scroll":this.handleScroll();break}}revert(){this.scrollTicker.cancel();this.dataTimer.cancel();this.resizeTicker.cancel();this.wakeTicker.cancel();this.resizeObserver.unobserve(this.element);(this.useWin?win:this.element).removeEventListener("scroll",this);scrollContainers.delete(this.element)}}const registerAndGetScrollContainer=target=>{const $el=target?parseTargets(target)[0]||doc.body:doc.body;let scrollContainer=scrollContainers.get($el);if(!scrollContainer){scrollContainer=new ScrollContainer($el);scrollContainers.set($el,scrollContainer)}return scrollContainer};const convertValueToPx=($el,v,size,under,over)=>{const clampMin=v==="min";const clampMax=v==="max";const value=v==="top"||v==="left"||v==="start"||clampMin?0:v==="bottom"||v==="right"||v==="end"||clampMax?"100%":v==="center"?"50%":v;const{n:n,u:u}=decomposeRawValue(value,decomposedOriginalValue);let px=n;if(u==="%"){px=n/100*size}else if(u){px=convertValueUnit($el,decomposedOriginalValue,"px",true).n}if(clampMax&&under<0)px+=under;if(clampMin&&over>0)px+=over;return px};const parseBoundValue=($el,v,size,under,over)=>{let value;if(isStr(v)){const matchedOperator=relativeValuesExecRgx.exec(v);if(matchedOperator){const splitter=matchedOperator[0];const operator=splitter[0];const splitted=v.split(splitter);const clampMin=splitted[0]==="min";const clampMax=splitted[0]==="max";const valueAPx=convertValueToPx($el,splitted[0],size,under,over);const valueBPx=convertValueToPx($el,splitted[1],size,under,over);if(clampMin){const min=getRelativeValue(convertValueToPx($el,"min",size),valueBPx,operator);value=min<valueAPx?valueAPx:min}else if(clampMax){const max=getRelativeValue(convertValueToPx($el,"max",size),valueBPx,operator);value=max>valueAPx?valueAPx:max}else{value=getRelativeValue(valueAPx,valueBPx,operator)}}else{value=convertValueToPx($el,v,size,under,over)}}else{value=v}return round(value,0)};const getAnimationDomTarget=linked=>{let $linkedTarget;const linkedTargets=linked.targets;for(let i=0,l=linkedTargets.length;i<l;i++){const target=linkedTargets[i];if(target[isDomSymbol]){$linkedTarget=target;break}}return $linkedTarget};let scrollerIndex=0;const debugColors=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ScrollObserver{constructor(parameters={}){if(globals.scope)globals.scope.revertibles.push(this);const syncMode=setValue(parameters.sync,"play pause");const ease=syncMode?parseEasings(syncMode):null;const isLinear=syncMode&&(syncMode==="linear"||syncMode===none);const isEase=syncMode&&!(ease===none&&!isLinear);const isSmooth=syncMode&&(isNum(syncMode)||syncMode===true||isLinear);const isMethods=syncMode&&(isStr(syncMode)&&!isEase&&!isSmooth);const syncMethods=isMethods?syncMode.split(" ").map((m=>()=>{const linked=this.linked;return linked&&linked[m]?linked[m]():null})):null;const biDirSync=isMethods&&syncMethods.length>2;this.index=scrollerIndex++;this.id=!isUnd(parameters.id)?parameters.id:this.index;this.container=registerAndGetScrollContainer(parameters.container);this.target=null;this.linked=null;this.repeat=null;this.horizontal=null;this.enter=null;this.leave=null;this.sync=isEase||isSmooth||!!syncMethods;this.syncEase=isEase?ease:null;this.syncSmooth=isSmooth?syncMode===true||isLinear?1:syncMode:null;this.onSyncEnter=syncMethods&&!biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeave=syncMethods&&!biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterForward=syncMethods&&biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeaveForward=syncMethods&&biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterBackward=syncMethods&&biDirSync&&syncMethods[2]?syncMethods[2]:noop;this.onSyncLeaveBackward=syncMethods&&biDirSync&&syncMethods[3]?syncMethods[3]:noop;this.onEnter=parameters.onEnter||noop;this.onLeave=parameters.onLeave||noop;this.onEnterForward=parameters.onEnterForward||noop;this.onLeaveForward=parameters.onLeaveForward||noop;this.onEnterBackward=parameters.onEnterBackward||noop;this.onLeaveBackward=parameters.onLeaveBackward||noop;this.onUpdate=parameters.onUpdate||noop;this.onSyncComplete=parameters.onSyncComplete||noop;this.reverted=false;this.completed=false;this.began=false;this.isInView=false;this.forceEnter=false;this.hasEntered=false;this.offsets=[];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=parameters;this._debug=setValue(parameters.debug,false);this._next=null;this._prev=null;addChild(this.container,this);sync((()=>{if(this.reverted)return;if(!this.target){const target=parseTargets(parameters.target)[0];this.target=target||doc.body;this.refresh()}if(this._debug)this.debug()}))}link(linked){if(linked){linked.pause();this.linked=linked;if(!this._params.target){let $linkedTarget;if(!isUnd(linked.targets)){$linkedTarget=getAnimationDomTarget(linked)}else{forEachChildren(linked,(child=>{if(child.targets&&!$linkedTarget){$linkedTarget=getAnimationDomTarget(child)}}))}this.target=$linkedTarget||doc.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 p=(this.scroll-this.offsetStart)/this.distance;return p===Infinity||isNaN(p)?0:round(clamp(p,0,1),6)}refresh(){this.reverted=false;const params=this._params;this.repeat=setValue(parseScrollObserverFunctionParameter(params.repeat,this),true);this.horizontal=setValue(parseScrollObserverFunctionParameter(params.axis,this),"y")==="x";this.enter=setValue(parseScrollObserverFunctionParameter(params.enter,this),"end start");this.leave=setValue(parseScrollObserverFunctionParameter(params.leave,this),"start end");this.updateBounds();this.handleScroll();return this}removeDebug(){if(this.$debug){this.$debug.parentNode.removeChild(this.$debug);this.$debug=null}if(this.debugStyles){this.debugStyles.revert();this.$debug=null}return this}debug(){this.removeDebug();const container=this.container;const isHori=this.horizontal;const $existingDebug=container.element.querySelector(":scope > .animejs-onscroll-debug");const $debug=doc.createElement("div");const $thresholds=doc.createElement("div");const $triggers=doc.createElement("div");const color=debugColors[this.index%debugColors.length];const useWin=container.useWin;const containerWidth=useWin?container.winWidth:container.width;const containerHeight=useWin?container.winHeight:container.height;const scrollWidth=container.scrollWidth;const scrollHeight=container.scrollHeight;const size=this.container.width>360?320:260;const offLeft=isHori?0:10;const offTop=isHori?10:0;const half=isHori?24:size/2;const labelHeight=isHori?half:15;const labelWidth=isHori?60:half;const labelSize=isHori?labelWidth:labelHeight;const repeat=isHori?"repeat-x":"repeat-y";const gradientOffset=v=>isHori?"0px "+v+"px":v+"px"+" 2px";const lineCSS=c=>`linear-gradient(${isHori?90:0}deg, ${c} 2px, transparent 1px)`;const baseCSS=(p,l,t,w,h)=>`position:${p};left:${l}px;top:${t}px;width:${w}px;height:${h}px;`;$debug.style.cssText=`${baseCSS("absolute",offLeft,offTop,isHori?scrollWidth:size,isHori?size:scrollHeight)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `;$thresholds.style.cssText=`${baseCSS("sticky",0,0,isHori?containerWidth:half,isHori?half:containerHeight)}`;if(!$existingDebug){$thresholds.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(half-10)} / ${isHori?"100px 100px":"100px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(half-10)} / ${isHori?"10px 10px":"10px 10px"} ${repeat};\n `}$triggers.style.cssText=`${baseCSS("relative",0,0,isHori?scrollWidth:half,isHori?half:scrollHeight)}`;if(!$existingDebug){$triggers.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(0)} / ${isHori?"100px 10px":"10px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(0)} / ${isHori?"10px 0px":"0px 10px"} ${repeat};\n `}const labels=[" enter: "," leave: "];this.coords.forEach(((v,i)=>{const isView=i>1;const value=(isView?0:this.offset)+v;const isTail=i%2;const isFirst=value<labelSize;const isOver=value>(isView?isHori?containerWidth:containerHeight:isHori?scrollWidth:scrollHeight)-labelSize;const isFlip=(isView?isTail&&!isFirst:!isTail&&!isFirst)||isOver;const $label=doc.createElement("div");const $text=doc.createElement("div");const dirProp=isHori?isFlip?"right":"left":isFlip?"bottom":"top";const flipOffset=isFlip?(isHori?labelWidth:labelHeight)+(!isView?isHori?-1:-2:isHori?-1:isOver?0:-2):!isView?isHori?1:0:isHori?1:0;$text.innerHTML=`${this.id}${labels[isTail]}${this.thresholds[i]}`;$label.style.cssText=`${baseCSS("absolute",0,0,labelWidth,labelHeight)}\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n justify-content: flex-${isView?"start":"end"};\n align-items: flex-${isFlip?"end":"start"};\n border-${dirProp}: 2px ${isTail?"solid":"solid"} ${color};\n `;$text.style.cssText=`\n overflow: hidden;\n max-width: ${size/2-10}px;\n height: ${labelHeight};\n margin-${isHori?isFlip?"right":"left":isFlip?"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: ${isHori&&isFlip||!isHori&&!isView?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${isTail?color:"rgba(0,0,0,.75)"};\n background-color: ${isTail?"rgba(0,0,0,.65)":color};\n border: 2px solid ${isTail?color:"transparent"};\n border-${isHori?isFlip?"top-left":"top-right":isFlip?"top-left":"bottom-left"}-radius: 5px;\n border-${isHori?isFlip?"bottom-left":"bottom-right":isFlip?"top-right":"bottom-right"}-radius: 5px;\n `;$label.appendChild($text);let position=value-flipOffset+(isHori?1:0);$label.style[isHori?"left":"top"]=`${position}px`;(isView?$thresholds:$triggers).appendChild($label)}));$debug.appendChild($thresholds);$debug.appendChild($triggers);container.element.appendChild($debug);if(!$existingDebug)$debug.classList.add("animejs-onscroll-debug");this.$debug=$debug;const containerPosition=getTargetValue(container.element,"position");if(containerPosition==="static"){this.debugStyles=setTargetValues(container.element,{position:"relative "})}}updateBounds(){if(this._debug){this.removeDebug()}let stickys;const $target=this.target;const container=this.container;const isHori=this.horizontal;const linked=this.linked;let linkedTime;let $el=$target;let offsetX=0;let offsetY=0;let $offsetParent=$el;if(linked){linkedTime=linked.currentTime;linked.seek(0,true)}const isContainerStatic=getTargetValue(container.element,"position")==="static"?setTargetValues(container.element,{position:"relative "}):false;while($el&&$el!==container.element&&$el!==doc.body){const isSticky=getTargetValue($el,"position")==="sticky"?setTargetValues($el,{position:"static"}):false;if($el===$offsetParent){offsetX+=$el.offsetLeft||0;offsetY+=$el.offsetTop||0;$offsetParent=$el.offsetParent}$el=$el.parentElement;if(isSticky){if(!stickys)stickys=[];stickys.push(isSticky)}}if(isContainerStatic)isContainerStatic.revert();const offset=isHori?offsetX:offsetY;const targetSize=isHori?$target.offsetWidth:$target.offsetHeight;const containerSize=isHori?container.width:container.height;const scrollSize=isHori?container.scrollWidth:container.scrollHeight;const maxScroll=scrollSize-containerSize;const enter=this.enter;const leave=this.leave;let enterTarget="start";let leaveTarget="end";let enterContainer="end";let leaveContainer="start";if(isStr(enter)){const splitted=enter.split(" ");enterContainer=splitted[0];enterTarget=splitted.length>1?splitted[1]:enterTarget}else if(isObj(enter)){const e=enter;if(!isUnd(e.container))enterContainer=e.container;if(!isUnd(e.target))enterTarget=e.target}else if(isNum(enter)){enterContainer=enter}if(isStr(leave)){const splitted=leave.split(" ");leaveContainer=splitted[0];leaveTarget=splitted.length>1?splitted[1]:leaveTarget}else if(isObj(leave)){const t=leave;if(!isUnd(t.container))leaveContainer=t.container;if(!isUnd(t.target))leaveTarget=t.target}else if(isNum(leave)){leaveContainer=leave}const parsedEnterTarget=parseBoundValue($target,enterTarget,targetSize);const parsedLeaveTarget=parseBoundValue($target,leaveTarget,targetSize);const under=parsedEnterTarget+offset-containerSize;const over=parsedLeaveTarget+offset-maxScroll;const parsedEnterContainer=parseBoundValue($target,enterContainer,containerSize,under,over);const parsedLeaveContainer=parseBoundValue($target,leaveContainer,containerSize,under,over);const offsetStart=parsedEnterTarget+offset-parsedEnterContainer;const offsetEnd=parsedLeaveTarget+offset-parsedLeaveContainer;const scrollDelta=offsetEnd-offsetStart;this.offsets[0]=offsetX;this.offsets[1]=offsetY;this.offset=offset;this.offsetStart=offsetStart;this.offsetEnd=offsetEnd;this.distance=scrollDelta<=0?0:scrollDelta;this.thresholds=[enterTarget,leaveTarget,enterContainer,leaveContainer];this.coords=[parsedEnterTarget,parsedLeaveTarget,parsedEnterContainer,parsedLeaveContainer];if(stickys){stickys.forEach((sticky=>sticky.revert()))}if(linked){linked.seek(linkedTime,true)}if(this._debug){this.debug()}}handleScroll(){const linked=this.linked;const sync=this.sync;const syncEase=this.syncEase;const syncSmooth=this.syncSmooth;const shouldSeek=linked&&(syncEase||syncSmooth);const isHori=this.horizontal;const container=this.container;const scroll=this.scroll;const isBefore=scroll<=this.offsetStart;const isAfter=scroll>=this.offsetEnd;const isInView=!isBefore&&!isAfter;const isOnTheEdge=scroll===this.offsetStart||scroll===this.offsetEnd;const forceEnter=!this.hasEntered&&isOnTheEdge;const $debug=this._debug&&this.$debug;let hasUpdated=false;let syncCompleted=false;let p=this.progress;if(isBefore&&this.began){this.began=false}if(p>0&&!this.began){this.began=true}if(shouldSeek){const lp=linked.progress;if(syncSmooth&&isNum(syncSmooth)){if(syncSmooth<1){const step=1e-4;const snap=lp<p&&p===1?step:lp>p&&!p?-1e-4:0;p=round(lerp(lp,p,interpolate(.01,.2,syncSmooth),false)+snap,6)}}else if(syncEase){p=syncEase(p)}hasUpdated=p!==this.prevProgress;syncCompleted=lp===1;if(hasUpdated&&!syncCompleted&&(syncSmooth&&lp)){container.wakeTicker.restart()}}if($debug){const sticky=isHori?container.scrollY:container.scrollX;$debug.style[isHori?"top":"left"]=sticky+10+"px"}if(isInView&&!this.isInView||forceEnter&&!this.forceEnter&&!this.hasEntered){if(isInView)this.isInView=true;if(!this.forceEnter||!this.hasEntered){if($debug&&isInView)$debug.style.zIndex=`${this.container.zIndex++}`;this.onSyncEnter(this);this.onEnter(this);if(this.backward){this.onSyncEnterBackward(this);this.onEnterBackward(this)}else{this.onSyncEnterForward(this);this.onEnterForward(this)}this.hasEntered=true;if(forceEnter)this.forceEnter=true}else if(isInView){this.forceEnter=false}}if(isInView||!isInView&&this.isInView){hasUpdated=true}if(hasUpdated){if(shouldSeek)linked.seek(linked.duration*p);this.onUpdate(this)}if(!isInView&&this.isInView){this.isInView=false;this.onSyncLeave(this);this.onLeave(this);if(this.backward){this.onSyncLeaveBackward(this);this.onLeaveBackward(this)}else{this.onSyncLeaveForward(this);this.onLeaveForward(this)}if(sync&&!syncSmooth){syncCompleted=true}}if(p>=1&&this.began&&!this.completed&&(sync&&syncCompleted||!sync)){if(sync){this.onSyncComplete(this)}this.completed=true;if(!this.repeat&&!linked||!this.repeat&&linked&&linked.completed){this.revert()}}if(p<1&&this.completed){this.completed=false}this.prevProgress=p}revert(){if(this.reverted)return;const container=this.container;removeChild(container,this);if(!container._head){container.revert()}if(this._debug){this.removeDebug()}this.reverted=true;return this}}const onScroll=(parameters={})=>new ScrollObserver(parameters);const stagger=(val,params={})=>{let values=[];let maxValue=0;const from=params.from;const reversed=params.reversed;const ease=params.ease;const hasEasing=!isUnd(ease);const hasSpring=hasEasing&&!isUnd(ease.ease);const staggerEase=hasSpring?ease.ease:hasEasing?parseEasings(ease):null;const grid=params.grid;const axis=params.axis;const fromFirst=isUnd(from)||from===0||from==="first";const fromCenter=from==="center";const fromLast=from==="last";const isRange=isArr(val);const val1=isRange?parseNumber(val[0]):parseNumber(val);const val2=isRange?parseNumber(val[1]):0;const unitMatch=unitsExecRgx.exec((isRange?val[1]:val)+emptyString);const start=params.start||0+(isRange?val1:0);let fromIndex=fromFirst?0:isNum(from)?from:0;return(_,i,t,tl)=>{if(fromCenter)fromIndex=(t-1)/2;if(fromLast)fromIndex=t-1;if(!values.length){for(let index=0;index<t;index++){if(!grid){values.push(abs(fromIndex-index))}else{const fromX=!fromCenter?fromIndex%grid[0]:(grid[0]-1)/2;const fromY=!fromCenter?floor(fromIndex/grid[0]):(grid[1]-1)/2;const toX=index%grid[0];const toY=floor(index/grid[0]);const distanceX=fromX-toX;const distanceY=fromY-toY;let value=sqrt(distanceX*distanceX+distanceY*distanceY);if(axis==="x")value=-distanceX;if(axis==="y")value=-distanceY;values.push(value)}maxValue=max(...values)}if(staggerEase)values=values.map((val=>staggerEase(val/maxValue)*maxValue));if(reversed)values=values.map((val=>axis?val<0?val*-1:-val:abs(maxValue-val)))}const spacing=isRange?(val2-val1)/maxValue:val1;const offset=tl?parseTimelinePosition(tl,isUnd(params.start)?tl.iterationDuration:start):start;let output=offset+(spacing*round(values[i],2)||0);if(params.modifier)output=params.modifier(output);if(unitMatch)output=`${output}${unitMatch[2]}`;return output}};exports.Animatable=Animatable;exports.Draggable=Draggable;exports.JSAnimation=JSAnimation;exports.Scope=Scope;exports.ScrollObserver=ScrollObserver;exports.Spring=Spring;exports.Timeline=Timeline;exports.Timer=Timer;exports.WAAPIAnimation=WAAPIAnimation;exports.animate=animate;exports.createAnimatable=createAnimatable;exports.createDraggable=createDraggable;exports.createScope=createScope;exports.createSpring=createSpring;exports.createTimeline=createTimeline;exports.createTimer=createTimer;exports.eases=eases;exports.engine=engine;exports.onScroll=onScroll;exports.scrollContainers=scrollContainers;exports.stagger=stagger;exports.svg=svg;exports.utils=utils;exports.waapi=waapi}));
+(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.anime={}))})(this,(function(exports){"use strict";const isBrowser=typeof window!=="undefined";const win=isBrowser?window:null;const doc=isBrowser?document:null;const tweenTypes={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4};const valueTypes={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3};const tickModes={NONE:0,AUTO:1,FORCE:2};const compositionTypes={replace:0,none:1,blend:2};const isRegisteredTargetSymbol=Symbol();const isDomSymbol=Symbol();const isSvgSymbol=Symbol();const transformsSymbol=Symbol();const morphPointsSymbol=Symbol();const proxyTargetSymbol=Symbol();const minValue=1e-11;const maxValue=1e12;const K=1e3;const maxFps=120;const emptyString="";const shortTransforms=(()=>{const map=new Map;map.set("x","translateX");map.set("y","translateY");map.set("z","translateZ");return map})();const validTransforms=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"];const transformsFragmentStrings=validTransforms.reduce(((a,v)=>({...a,[v]:v+"("})),{});const noop=()=>{};const hexTestRgx=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;const rgbExecRgx=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;const rgbaExecRgx=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const hslExecRgx=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;const hslaExecRgx=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;const digitWithExponentRgx=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;const unitsExecRgx=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;const lowerCaseRgx=/([a-z])([A-Z])/g;const transformsExecRgx=/(\w+)(\([^)]+\)+)/g;const relativeValuesExecRgx=/(\*=|\+=|-=)/;const defaults={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:maxFps,loop:0,reversed:false,alternate:false,autoplay:true,duration:K,delay:0,loopDelay:0,ease:"out(2)",composition:compositionTypes.replace,modifier:v=>v,onBegin:noop,onBeforeUpdate:noop,onUpdate:noop,onLoop:noop,onPause:noop,onComplete:noop,onRender:noop};const scope={current:null,root:doc};const globals={defaults:defaults,precision:4,timeScale:1,tickThreshold:200};const globalVersions={version:"4.1.0",engine:null};if(isBrowser){if(!win.AnimeJS)win.AnimeJS=[];win.AnimeJS.push(globalVersions)}const toLowerCase=str=>str.replace(lowerCaseRgx,"$1-$2").toLowerCase();const stringStartsWith=(str,sub)=>str.indexOf(sub)===0;const now=Date.now;const isArr=Array.isArray;const isObj=a=>a&&a.constructor===Object;const isNum=a=>typeof a==="number"&&!isNaN(a);const isStr=a=>typeof a==="string";const isFnc=a=>typeof a==="function";const isUnd=a=>typeof a==="undefined";const isNil=a=>isUnd(a)||a===null;const isSvg=a=>isBrowser&&a instanceof SVGElement;const isHex=a=>hexTestRgx.test(a);const isRgb=a=>stringStartsWith(a,"rgb");const isHsl=a=>stringStartsWith(a,"hsl");const isCol=a=>isHex(a)||isRgb(a)||isHsl(a);const isKey=a=>!globals.defaults.hasOwnProperty(a);const parseNumber=str=>isStr(str)?parseFloat(str):str;const pow=Math.pow;const sqrt=Math.sqrt;const sin=Math.sin;const cos=Math.cos;const abs=Math.abs;const exp=Math.exp;const ceil=Math.ceil;const floor=Math.floor;const asin=Math.asin;const max=Math.max;const atan2=Math.atan2;const PI=Math.PI;const _round=Math.round;const clamp=(v,min,max)=>v<min?min:v>max?max:v;const powCache={};const round=(v,decimalLength)=>{if(decimalLength<0)return v;if(!decimalLength)return _round(v);let p=powCache[decimalLength];if(!p)p=powCache[decimalLength]=10**decimalLength;return _round(v*p)/p};const snap=(v,increment)=>isArr(increment)?increment.reduce(((closest,cv)=>abs(cv-v)<abs(closest-v)?cv:closest)):increment?_round(v/increment)*increment:v;const interpolate=(start,end,progress)=>start+(end-start)*progress;const random=(min,max,decimalLength)=>{const m=10**(decimalLength||0);return floor((Math.random()*(max-min+1/m)+min)*m)/m};const shuffle=items=>{let m=items.length,t,i;while(m){i=random(0,--m);t=items[m];items[m]=items[i];items[i]=t}return items};const clampInfinity=v=>v===Infinity?maxValue:v===-Infinity?-1e12:v;const normalizeTime=v=>v<=minValue?minValue:clampInfinity(round(v,11));const cloneArray=a=>isArr(a)?[...a]:a;const mergeObjects=(o1,o2)=>{const merged={...o1};for(let p in o2){const o1p=o1[p];merged[p]=isUnd(o1p)?o2[p]:o1p}return merged};const forEachChildren=(parent,callback,reverse,prevProp="_prev",nextProp="_next")=>{let next=parent._head;let adjustedNextProp=nextProp;if(reverse){next=parent._tail;adjustedNextProp=prevProp}while(next){const currentNext=next[adjustedNextProp];callback(next);next=currentNext}};const removeChild=(parent,child,prevProp="_prev",nextProp="_next")=>{const prev=child[prevProp];const next=child[nextProp];prev?prev[nextProp]=next:parent._head=next;next?next[prevProp]=prev:parent._tail=prev;child[prevProp]=null;child[nextProp]=null};const addChild=(parent,child,sortMethod,prevProp="_prev",nextProp="_next")=>{let prev=parent._tail;while(prev&&sortMethod&&sortMethod(prev,child))prev=prev[prevProp];const next=prev?prev[nextProp]:parent._head;prev?prev[nextProp]=child:parent._head=child;next?next[prevProp]=child:parent._tail=child;child[prevProp]=prev;child[nextProp]=next};const createRefreshable=constructor=>{let tracked;return(...args)=>{let currentIteration,currentIterationProgress,reversed,alternate;if(tracked){currentIteration=tracked.currentIteration;currentIterationProgress=tracked.iterationProgress;reversed=tracked.reversed;alternate=tracked._alternate;tracked.revert()}const cleanup=constructor(...args);if(cleanup&&!isFnc(cleanup)&&cleanup.revert)tracked=cleanup;if(!isUnd(currentIterationProgress)){tracked.currentIteration=currentIteration;tracked.iterationProgress=(alternate?!(currentIteration%2)?reversed:!reversed:reversed)?1-currentIterationProgress:currentIterationProgress}return cleanup||noop}};class Clock{constructor(initTime=0){this.deltaTime=0;this._currentTime=initTime;this._elapsedTime=initTime;this._startTime=initTime;this._lastTime=initTime;this._scheduledTime=0;this._frameDuration=round(K/maxFps,0);this._fps=maxFps;this._speed=1;this._hasChildren=false;this._head=null;this._tail=null}get fps(){return this._fps}set fps(frameRate){const previousFrameDuration=this._frameDuration;const fr=+frameRate;const fps=fr<minValue?minValue:fr;const frameDuration=round(K/fps,0);this._fps=fps;this._frameDuration=frameDuration;this._scheduledTime+=frameDuration-previousFrameDuration}get speed(){return this._speed}set speed(playbackRate){const pbr=+playbackRate;this._speed=pbr<minValue?minValue:pbr}requestTick(time){const scheduledTime=this._scheduledTime;const elapsedTime=this._elapsedTime;this._elapsedTime+=time-elapsedTime;if(elapsedTime<scheduledTime)return tickModes.NONE;const frameDuration=this._frameDuration;const frameDelta=elapsedTime-scheduledTime;this._scheduledTime+=frameDelta<frameDuration?frameDuration:frameDelta;return tickModes.AUTO}computeDeltaTime(time){const delta=time-this._lastTime;this.deltaTime=delta;this._lastTime=time;return delta}}const render=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const parent=tickable.parent;const duration=tickable.duration;const completed=tickable.completed;const iterationDuration=tickable.iterationDuration;const iterationCount=tickable.iterationCount;const _currentIteration=tickable._currentIteration;const _loopDelay=tickable._loopDelay;const _reversed=tickable._reversed;const _alternate=tickable._alternate;const _hasChildren=tickable._hasChildren;const tickableDelay=tickable._delay;const tickablePrevAbsoluteTime=tickable._currentTime;const tickableEndTime=tickableDelay+iterationDuration;const tickableAbsoluteTime=time-tickableDelay;const tickablePrevTime=clamp(tickablePrevAbsoluteTime,-tickableDelay,duration);const tickableCurrentTime=clamp(tickableAbsoluteTime,-tickableDelay,duration);const deltaTime=tickableAbsoluteTime-tickablePrevAbsoluteTime;const isCurrentTimeAboveZero=tickableCurrentTime>0;const isCurrentTimeEqualOrAboveDuration=tickableCurrentTime>=duration;const isSetter=duration<=minValue;const forcedTick=tickMode===tickModes.FORCE;let isOdd=0;let iterationElapsedTime=tickableAbsoluteTime;let hasRendered=0;if(iterationCount>1){const currentIteration=~~(tickableCurrentTime/(iterationDuration+(isCurrentTimeEqualOrAboveDuration?0:_loopDelay)));tickable._currentIteration=clamp(currentIteration,0,iterationCount);if(isCurrentTimeEqualOrAboveDuration)tickable._currentIteration--;isOdd=tickable._currentIteration%2;iterationElapsedTime=tickableCurrentTime%(iterationDuration+_loopDelay)||0}const isReversed=_reversed^(_alternate&&isOdd);const _ease=tickable._ease;let iterationTime=isCurrentTimeEqualOrAboveDuration?isReversed?0:duration:isReversed?iterationDuration-iterationElapsedTime:iterationElapsedTime;if(_ease)iterationTime=iterationDuration*_ease(iterationTime/iterationDuration)||0;const isRunningBackwards=(parent?parent.backwards:tickableAbsoluteTime<tickablePrevAbsoluteTime)?!isReversed:!!isReversed;tickable._currentTime=tickableAbsoluteTime;tickable._iterationTime=iterationTime;tickable.backwards=isRunningBackwards;if(isCurrentTimeAboveZero&&!tickable.began){tickable.began=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onBegin(tickable)}}else if(tickableAbsoluteTime<=0){tickable.began=false}if(!muteCallbacks&&!_hasChildren&&isCurrentTimeAboveZero&&tickable._currentIteration!==_currentIteration){tickable.onLoop(tickable)}if(forcedTick||tickMode===tickModes.AUTO&&(time>=tickableDelay&&time<=tickableEndTime||time<=tickableDelay&&tickablePrevTime>tickableDelay||time>=tickableEndTime&&tickablePrevTime!==duration)||iterationTime>=tickableEndTime&&tickablePrevTime!==duration||iterationTime<=tickableDelay&&tickablePrevTime>0||time<=tickablePrevTime&&tickablePrevTime===duration&&completed||isCurrentTimeEqualOrAboveDuration&&!completed&&isSetter){if(isCurrentTimeAboveZero){tickable.computeDeltaTime(tickablePrevTime);if(!muteCallbacks)tickable.onBeforeUpdate(tickable)}if(!_hasChildren){const forcedRender=forcedTick||(isRunningBackwards?deltaTime*-1:deltaTime)>=globals.tickThreshold;const absoluteTime=tickable._offset+(parent?parent._offset:0)+tickableDelay+iterationTime;let tween=tickable._head;let tweenTarget;let tweenStyle;let tweenTargetTransforms;let tweenTargetTransformsProperties;let tweenTransformsNeedUpdate=0;while(tween){const tweenComposition=tween._composition;const tweenCurrentTime=tween._currentTime;const tweenChangeDuration=tween._changeDuration;const tweenAbsEndTime=tween._absoluteStartTime+tween._changeDuration;const tweenNextRep=tween._nextRep;const tweenPrevRep=tween._prevRep;const tweenHasComposition=tweenComposition!==compositionTypes.none;if((forcedRender||(tweenCurrentTime!==tweenChangeDuration||absoluteTime<=tweenAbsEndTime+(tweenNextRep?tweenNextRep._delay:0))&&(tweenCurrentTime!==0||absoluteTime>=tween._absoluteStartTime))&&(!tweenHasComposition||!tween._isOverridden&&(!tween._isOverlapped||absoluteTime<=tweenAbsEndTime)&&(!tweenNextRep||(tweenNextRep._isOverridden||absoluteTime<=tweenNextRep._absoluteStartTime))&&(!tweenPrevRep||(tweenPrevRep._isOverridden||absoluteTime>=tweenPrevRep._absoluteStartTime+tweenPrevRep._changeDuration+tween._delay)))){const tweenNewTime=tween._currentTime=clamp(iterationTime-tween._startTime,0,tweenChangeDuration);const tweenProgress=tween._ease(tweenNewTime/tween._updateDuration);const tweenModifier=tween._modifier;const tweenValueType=tween._valueType;const tweenType=tween._tweenType;const tweenIsObject=tweenType===tweenTypes.OBJECT;const tweenIsNumber=tweenValueType===valueTypes.NUMBER;const tweenPrecision=tweenIsNumber&&tweenIsObject||tweenProgress===0||tweenProgress===1?-1:globals.precision;let value;let number;if(tweenIsNumber){value=number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision))}else if(tweenValueType===valueTypes.UNIT){number=tweenModifier(round(interpolate(tween._fromNumber,tween._toNumber,tweenProgress),tweenPrecision));value=`${number}${tween._unit}`}else if(tweenValueType===valueTypes.COLOR){const fn=tween._fromNumbers;const tn=tween._toNumbers;const r=round(clamp(tweenModifier(interpolate(fn[0],tn[0],tweenProgress)),0,255),0);const g=round(clamp(tweenModifier(interpolate(fn[1],tn[1],tweenProgress)),0,255),0);const b=round(clamp(tweenModifier(interpolate(fn[2],tn[2],tweenProgress)),0,255),0);const a=clamp(tweenModifier(round(interpolate(fn[3],tn[3],tweenProgress),tweenPrecision)),0,1);value=`rgba(${r},${g},${b},${a})`;if(tweenHasComposition){const ns=tween._numbers;ns[0]=r;ns[1]=g;ns[2]=b;ns[3]=a}}else if(tweenValueType===valueTypes.COMPLEX){value=tween._strings[0];for(let j=0,l=tween._toNumbers.length;j<l;j++){const n=tweenModifier(round(interpolate(tween._fromNumbers[j],tween._toNumbers[j],tweenProgress),tweenPrecision));const s=tween._strings[j+1];value+=`${s?n+s:n}`;if(tweenHasComposition){tween._numbers[j]=n}}}if(tweenHasComposition){tween._number=number}if(!internalRender&&tweenComposition!==compositionTypes.blend){const tweenProperty=tween.property;tweenTarget=tween.target;if(tweenIsObject){tweenTarget[tweenProperty]=value}else if(tweenType===tweenTypes.ATTRIBUTE){tweenTarget.setAttribute(tweenProperty,value)}else{tweenStyle=tweenTarget.style;if(tweenType===tweenTypes.TRANSFORM){if(tweenTarget!==tweenTargetTransforms){tweenTargetTransforms=tweenTarget;tweenTargetTransformsProperties=tweenTarget[transformsSymbol]}tweenTargetTransformsProperties[tweenProperty]=value;tweenTransformsNeedUpdate=1}else if(tweenType===tweenTypes.CSS){tweenStyle[tweenProperty]=value}else if(tweenType===tweenTypes.CSS_VAR){tweenStyle.setProperty(tweenProperty,value)}}if(isCurrentTimeAboveZero)hasRendered=1}else{tween._value=value}}if(tweenTransformsNeedUpdate&&tween._renderTransforms){let str=emptyString;for(let key in tweenTargetTransformsProperties){str+=`${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `}tweenStyle.transform=str;tweenTransformsNeedUpdate=0}tween=tween._next}if(!muteCallbacks&&hasRendered){tickable.onRender(tickable)}}if(!muteCallbacks&&isCurrentTimeAboveZero){tickable.onUpdate(tickable)}}if(parent&&isSetter){if(!muteCallbacks&&(parent.began&&!isRunningBackwards&&tickableAbsoluteTime>=duration&&!completed||isRunningBackwards&&tickableAbsoluteTime<=minValue&&completed)){tickable.onComplete(tickable);tickable.completed=!isRunningBackwards}}else if(isCurrentTimeAboveZero&&isCurrentTimeEqualOrAboveDuration){if(iterationCount===Infinity){tickable._startTime+=tickable.duration}else if(tickable._currentIteration>=iterationCount-1){tickable.paused=true;if(!completed&&!_hasChildren){tickable.completed=true;if(!muteCallbacks&&!(parent&&(isRunningBackwards||!parent.began))){tickable.onComplete(tickable);tickable._resolve(tickable)}}}}else{tickable.completed=false}return hasRendered};const tick=(tickable,time,muteCallbacks,internalRender,tickMode)=>{const _currentIteration=tickable._currentIteration;render(tickable,time,muteCallbacks,internalRender,tickMode);if(tickable._hasChildren){const tl=tickable;const tlIsRunningBackwards=tl.backwards;const tlChildrenTime=internalRender?time:tl._iterationTime;const tlCildrenTickTime=now();let tlChildrenHasRendered=0;let tlChildrenHaveCompleted=true;if(!internalRender&&tl._currentIteration!==_currentIteration){const tlIterationDuration=tl.iterationDuration;forEachChildren(tl,(child=>{if(!tlIsRunningBackwards){if(!child.completed&&!child.backwards&&child._currentTime<child.iterationDuration){render(child,tlIterationDuration,muteCallbacks,1,tickModes.FORCE)}child.began=false;child.completed=false}else{const childDuration=child.duration;const childStartTime=child._offset+child._delay;const childEndTime=childStartTime+childDuration;if(!muteCallbacks&&childDuration<=minValue&&(!childStartTime||childEndTime===tlIterationDuration)){child.onComplete(child)}}}));if(!muteCallbacks)tl.onLoop(tl)}forEachChildren(tl,(child=>{const childTime=round((tlChildrenTime-child._offset)*child._speed,12);const childTickMode=child._fps<tl._fps?child.requestTick(tlCildrenTickTime):tickMode;tlChildrenHasRendered+=render(child,childTime,muteCallbacks,internalRender,childTickMode);if(!child.completed&&tlChildrenHaveCompleted)tlChildrenHaveCompleted=false}),tlIsRunningBackwards);if(!muteCallbacks&&tlChildrenHasRendered)tl.onRender(tl);if(tlChildrenHaveCompleted&&tl._currentTime>=tl.duration){tl.paused=true;if(!tl.completed){tl.completed=true;if(!muteCallbacks){tl.onComplete(tl);tl._resolve(tl)}}}}};const additive={animation:null,update:noop};const addAdditiveAnimation=lookups=>{let animation=additive.animation;if(!animation){animation={duration:minValue,computeDeltaTime:noop,_offset:0,_delay:0,_head:null,_tail:null};additive.animation=animation;additive.update=()=>{lookups.forEach((propertyAnimation=>{for(let propertyName in propertyAnimation){const tweens=propertyAnimation[propertyName];const lookupTween=tweens._head;if(lookupTween){const valueType=lookupTween._valueType;const additiveValues=valueType===valueTypes.COMPLEX||valueType===valueTypes.COLOR?cloneArray(lookupTween._fromNumbers):null;let additiveValue=lookupTween._fromNumber;let tween=tweens._tail;while(tween&&tween!==lookupTween){if(additiveValues){for(let i=0,l=tween._numbers.length;i<l;i++)additiveValues[i]+=tween._numbers[i]}else{additiveValue+=tween._number}tween=tween._prevAdd}lookupTween._toNumber=additiveValue;lookupTween._toNumbers=additiveValues}}}));render(animation,1,1,0,tickModes.FORCE)}}return animation};const engineTickMethod=(()=>isBrowser?requestAnimationFrame:setImmediate)();const engineCancelMethod=(()=>isBrowser?cancelAnimationFrame:clearImmediate)();class Engine extends Clock{constructor(initTime){super(initTime);this.useDefaultMainLoop=true;this.pauseOnDocumentHidden=true;this.defaults=defaults;this.paused=isBrowser&&doc.hidden?true:false;this.reqId=null}update(){const time=this._currentTime=now();if(this.requestTick(time)){this.computeDeltaTime(time);const engineSpeed=this._speed;const engineFps=this._fps;let activeTickable=this._head;while(activeTickable){const nextTickable=activeTickable._next;if(!activeTickable.paused){tick(activeTickable,(time-activeTickable._startTime)*activeTickable._speed*engineSpeed,0,0,activeTickable._fps<engineFps?activeTickable.requestTick(time):tickModes.AUTO)}else{removeChild(this,activeTickable);this._hasChildren=!!this._tail;activeTickable._running=false;if(activeTickable.completed&&!activeTickable._cancelled){activeTickable.cancel()}}activeTickable=nextTickable}additive.update()}}wake(){if(this.useDefaultMainLoop&&!this.reqId&&!this.paused){this.reqId=engineTickMethod(tickEngine)}return this}pause(){this.paused=true;return killEngine()}resume(){if(!this.paused)return;this.paused=false;forEachChildren(this,(child=>child.resetTime()));return this.wake()}get speed(){return this._speed*(globals.timeScale===1?1:K)}set speed(playbackRate){this._speed=playbackRate*globals.timeScale;forEachChildren(this,(child=>child.speed=child._speed))}get timeUnit(){return globals.timeScale===1?"ms":"s"}set timeUnit(unit){const secondsScale=.001;const isSecond=unit==="s";const newScale=isSecond?secondsScale:1;if(globals.timeScale!==newScale){globals.timeScale=newScale;globals.tickThreshold=200*newScale;const scaleFactor=isSecond?secondsScale:K;this.defaults.duration*=scaleFactor;this._speed*=scaleFactor}}get precision(){return globals.precision}set precision(precision){globals.precision=precision}}const engine=(()=>{const engine=new Engine(now());if(isBrowser){globalVersions.engine=engine;doc.addEventListener("visibilitychange",(()=>{if(!engine.pauseOnDocumentHidden)return;doc.hidden?engine.pause():engine.resume()}))}return engine})();const tickEngine=()=>{if(engine._head){engine.reqId=engineTickMethod(tickEngine);engine.update()}else{engine.reqId=0}};const killEngine=()=>{engineCancelMethod(engine.reqId);engine.reqId=0;return engine};const parseInlineTransforms=(target,propName,animationInlineStyles)=>{const inlineTransforms=target.style.transform;let inlinedStylesPropertyValue;if(inlineTransforms){const cachedTransforms=target[transformsSymbol];let t;while(t=transformsExecRgx.exec(inlineTransforms)){const inlinePropertyName=t[1];const inlinePropertyValue=t[2].slice(1,-1);cachedTransforms[inlinePropertyName]=inlinePropertyValue;if(inlinePropertyName===propName){inlinedStylesPropertyValue=inlinePropertyValue;if(animationInlineStyles){animationInlineStyles[propName]=inlinePropertyValue}}}}return inlineTransforms&&!isUnd(inlinedStylesPropertyValue)?inlinedStylesPropertyValue:stringStartsWith(propName,"scale")?"1":stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew")?"0deg":"0px"};function getNodeList(v){const n=isStr(v)?scope.root.querySelectorAll(v):v;if(n instanceof NodeList||n instanceof HTMLCollection)return n}function parseTargets(targets){if(isNil(targets))return[];if(isArr(targets)){const flattened=targets.flat(Infinity);const parsed=[];for(let i=0,l=flattened.length;i<l;i++){const item=flattened[i];if(!isNil(item)){const nodeList=getNodeList(item);if(nodeList){for(let j=0,jl=nodeList.length;j<jl;j++){const subItem=nodeList[j];if(!isNil(subItem)){let isDuplicate=false;for(let k=0,kl=parsed.length;k<kl;k++){if(parsed[k]===subItem){isDuplicate=true;break}}if(!isDuplicate){parsed.push(subItem)}}}}else{let isDuplicate=false;for(let j=0,jl=parsed.length;j<jl;j++){if(parsed[j]===item){isDuplicate=true;break}}if(!isDuplicate){parsed.push(item)}}}}return parsed}if(!isBrowser)return[targets];const nodeList=getNodeList(targets);if(nodeList)return Array.from(nodeList);return[targets]}function registerTargets(targets){const parsedTargetsArray=parseTargets(targets);const parsedTargetsLength=parsedTargetsArray.length;if(parsedTargetsLength){for(let i=0;i<parsedTargetsLength;i++){const target=parsedTargetsArray[i];if(!target[isRegisteredTargetSymbol]){target[isRegisteredTargetSymbol]=true;const isSvgType=isSvg(target);const isDom=target.nodeType||isSvgType;if(isDom){target[isDomSymbol]=true;target[isSvgSymbol]=isSvgType;target[transformsSymbol]={}}}}}return parsedTargetsArray}const getPath=path=>{const parsedTargets=parseTargets(path);const $parsedSvg=parsedTargets[0];if(!$parsedSvg||!isSvg($parsedSvg))return;return $parsedSvg};const morphTo=(path2,precision=.33)=>$path1=>{const $path2=getPath(path2);if(!$path2)return;const isPath=$path1.tagName==="path";const separator=isPath?" ":",";const previousPoints=$path1[morphPointsSymbol];if(previousPoints)$path1.setAttribute(isPath?"d":"points",previousPoints);let v1="",v2="";if(!precision){v1=$path1.getAttribute(isPath?"d":"points");v2=$path2.getAttribute(isPath?"d":"points")}else{const length1=$path1.getTotalLength();const length2=$path2.getTotalLength();const maxPoints=Math.max(Math.ceil(length1*precision),Math.ceil(length2*precision));for(let i=0;i<maxPoints;i++){const t=i/(maxPoints-1);const pointOnPath1=$path1.getPointAtLength(length1*t);const pointOnPath2=$path2.getPointAtLength(length2*t);const prefix=isPath?i===0?"M":"L":"";v1+=prefix+round(pointOnPath1.x,3)+separator+pointOnPath1.y+" ";v2+=prefix+round(pointOnPath2.x,3)+separator+pointOnPath2.y+" "}}$path1[morphPointsSymbol]=v2;return[v1,v2]};const getScaleFactor=$el=>{let scaleFactor=1;if($el&&$el.getCTM){const ctm=$el.getCTM();if(ctm){const scaleX=sqrt(ctm.a*ctm.a+ctm.b*ctm.b);const scaleY=sqrt(ctm.c*ctm.c+ctm.d*ctm.d);scaleFactor=(scaleX+scaleY)/2}}return scaleFactor};const createDrawableProxy=($el,start,end)=>{const pathLength=K;const computedStyles=getComputedStyle($el);const strokeLineCap=computedStyles.strokeLinecap;const $scalled=computedStyles.vectorEffect==="non-scaling-stroke"?$el:null;let currentCap=strokeLineCap;const proxy=new Proxy($el,{get(target,property){const value=target[property];if(property===proxyTargetSymbol)return target;if(property==="setAttribute"){return(...args)=>{if(args[0]==="draw"){const value=args[1];const values=value.split(" ");const v1=+values[0];const v2=+values[1];const scaleFactor=getScaleFactor($scalled);const os=v1*-1e3*scaleFactor;const d1=v2*pathLength*scaleFactor+os;const d2=pathLength*scaleFactor+(v1===0&&v2===1||v1===1&&v2===0?0:10*scaleFactor)-d1;if(strokeLineCap!=="butt"){const newCap=v1===v2?"butt":strokeLineCap;if(currentCap!==newCap){target.style.strokeLinecap=`${newCap}`;currentCap=newCap}}target.setAttribute("stroke-dashoffset",`${os}`);target.setAttribute("stroke-dasharray",`${d1} ${d2}`)}return Reflect.apply(value,target,args)}}if(isFnc(value)){return(...args)=>Reflect.apply(value,target,args)}else{return value}}});if($el.getAttribute("pathLength")!==`${pathLength}`){$el.setAttribute("pathLength",`${pathLength}`);proxy.setAttribute("draw",`${start} ${end}`)}return proxy};const createDrawable=(selector,start=0,end=0)=>{const els=parseTargets(selector);return els.map(($el=>createDrawableProxy($el,start,end)))};const getPathPoint=($path,progress,lookup=0)=>$path.getPointAtLength(progress+lookup>=1?progress+lookup:0);const getPathProgess=($path,pathProperty)=>$el=>{const totalLength=+$path.getTotalLength();const inSvg=$el[isSvgSymbol];const ctm=$path.getCTM();return{from:0,to:totalLength,modifier:progress=>{if(pathProperty==="a"){const p0=getPathPoint($path,progress,-1);const p1=getPathPoint($path,progress,1);return atan2(p1.y-p0.y,p1.x-p0.x)*180/PI}else{const p=getPathPoint($path,progress,0);return pathProperty==="x"?inSvg||!ctm?p.x:p.x*ctm.a+p.y*ctm.c+ctm.e:inSvg||!ctm?p.y:p.x*ctm.b+p.y*ctm.d+ctm.f}}}};const createMotionPath=path=>{const $path=getPath(path);if(!$path)return;return{translateX:getPathProgess($path,"x"),translateY:getPathProgess($path,"y"),rotate:getPathProgess($path,"a")}};const cssReservedProperties=["opacity","rotate","overflow","color"];const isValidSVGAttribute=(el,propertyName)=>{if(cssReservedProperties.includes(propertyName))return false;if(el.getAttribute(propertyName)||propertyName in el){if(propertyName==="scale"){const elParentNode=el.parentNode;return elParentNode&&elParentNode.tagName==="filter"}return true}};const svg={morphTo:morphTo,createMotionPath:createMotionPath,createDrawable:createDrawable};const rgbToRgba=rgbValue=>{const rgba=rgbExecRgx.exec(rgbValue)||rgbaExecRgx.exec(rgbValue);const a=!isUnd(rgba[4])?+rgba[4]:1;return[+rgba[1],+rgba[2],+rgba[3],a]};const hexToRgba=hexValue=>{const hexLength=hexValue.length;const isShort=hexLength===4||hexLength===5;return[+("0x"+hexValue[1]+hexValue[isShort?1:2]),+("0x"+hexValue[isShort?2:3]+hexValue[isShort?2:4]),+("0x"+hexValue[isShort?3:5]+hexValue[isShort?3:6]),hexLength===5||hexLength===9?+(+("0x"+hexValue[isShort?4:7]+hexValue[isShort?4:8])/255).toFixed(3):1]};const hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;return t<1/6?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p};const hslToRgba=hslValue=>{const hsla=hslExecRgx.exec(hslValue)||hslaExecRgx.exec(hslValue);const h=+hsla[1]/360;const s=+hsla[2]/100;const l=+hsla[3]/100;const a=!isUnd(hsla[4])?+hsla[4]:1;let r,g,b;if(s===0){r=g=b=l}else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=round(hue2rgb(p,q,h+1/3)*255,0);g=round(hue2rgb(p,q,h)*255,0);b=round(hue2rgb(p,q,h-1/3)*255,0)}return[r,g,b,a]};const convertColorStringValuesToRgbaArray=colorString=>isRgb(colorString)?rgbToRgba(colorString):isHex(colorString)?hexToRgba(colorString):isHsl(colorString)?hslToRgba(colorString):[0,0,0,1];const setValue=(targetValue,defaultValue)=>isUnd(targetValue)?defaultValue:targetValue;const getFunctionValue=(value,target,index,total,store)=>{if(isFnc(value)){const func=()=>{const computed=value(target,index,total);return!isNaN(+computed)?+computed:computed||0};if(store){store.func=func}return func()}else{return value}};const getTweenType=(target,prop)=>!target[isDomSymbol]?tweenTypes.OBJECT:target[isSvgSymbol]&&isValidSVGAttribute(target,prop)?tweenTypes.ATTRIBUTE:validTransforms.includes(prop)||shortTransforms.get(prop)?tweenTypes.TRANSFORM:stringStartsWith(prop,"--")?tweenTypes.CSS_VAR:prop in target.style?tweenTypes.CSS:prop in target?tweenTypes.OBJECT:tweenTypes.ATTRIBUTE;const getCSSValue=(target,propName,animationInlineStyles)=>{const inlineStyles=target.style[propName];if(inlineStyles&&animationInlineStyles){animationInlineStyles[propName]=inlineStyles}const value=inlineStyles||getComputedStyle(target[proxyTargetSymbol]||target).getPropertyValue(propName);return value==="auto"?"0":value};const getOriginalAnimatableValue=(target,propName,tweenType,animationInlineStyles)=>{const type=!isUnd(tweenType)?tweenType:getTweenType(target,propName);return type===tweenTypes.OBJECT?target[propName]||0:type===tweenTypes.ATTRIBUTE?target.getAttribute(propName):type===tweenTypes.TRANSFORM?parseInlineTransforms(target,propName,animationInlineStyles):type===tweenTypes.CSS_VAR?getCSSValue(target,propName,animationInlineStyles).trimStart():getCSSValue(target,propName,animationInlineStyles)};const getRelativeValue=(x,y,operator)=>operator==="-"?x-y:operator==="+"?x+y:x*y;const createDecomposedValueTargetObject=()=>({t:valueTypes.NUMBER,n:0,u:null,o:null,d:null,s:null});const decomposeRawValue=(rawValue,targetObject)=>{targetObject.t=valueTypes.NUMBER;targetObject.n=0;targetObject.u=null;targetObject.o=null;targetObject.d=null;targetObject.s=null;if(!rawValue)return targetObject;const num=+rawValue;if(!isNaN(num)){targetObject.n=num;return targetObject}else{let str=rawValue;if(str[1]==="="){targetObject.o=str[0];str=str.slice(2)}const unitMatch=str.includes(" ")?false:unitsExecRgx.exec(str);if(unitMatch){targetObject.t=valueTypes.UNIT;targetObject.n=+unitMatch[1];targetObject.u=unitMatch[2];return targetObject}else if(targetObject.o){targetObject.n=+str;return targetObject}else if(isCol(str)){targetObject.t=valueTypes.COLOR;targetObject.d=convertColorStringValuesToRgbaArray(str);return targetObject}else{const matchedNumbers=str.match(digitWithExponentRgx);targetObject.t=valueTypes.COMPLEX;targetObject.d=matchedNumbers?matchedNumbers.map(Number):[];targetObject.s=str.split(digitWithExponentRgx)||[];return targetObject}}};const decomposeTweenValue=(tween,targetObject)=>{targetObject.t=tween._valueType;targetObject.n=tween._toNumber;targetObject.u=tween._unit;targetObject.o=null;targetObject.d=cloneArray(tween._toNumbers);targetObject.s=cloneArray(tween._strings);return targetObject};const decomposedOriginalValue=createDecomposedValueTargetObject();const lookups={_rep:new WeakMap,_add:new Map};const getTweenSiblings=(target,property,lookup="_rep")=>{const lookupMap=lookups[lookup];let targetLookup=lookupMap.get(target);if(!targetLookup){targetLookup={};lookupMap.set(target,targetLookup)}return targetLookup[property]?targetLookup[property]:targetLookup[property]={_head:null,_tail:null}};const addTweenSortMethod=(p,c)=>p._isOverridden||p._absoluteStartTime>c._absoluteStartTime;const overrideTween=tween=>{tween._isOverlapped=1;tween._isOverridden=1;tween._changeDuration=minValue;tween._currentTime=minValue};const composeTween=(tween,siblings)=>{const tweenCompositionType=tween._composition;if(tweenCompositionType===compositionTypes.replace){const tweenAbsStartTime=tween._absoluteStartTime;addChild(siblings,tween,addTweenSortMethod,"_prevRep","_nextRep");const prevSibling=tween._prevRep;if(prevSibling){const prevParent=prevSibling.parent;const prevAbsEndTime=prevSibling._absoluteStartTime+prevSibling._changeDuration;if(tween.parent.id!==prevParent.id&&prevParent.iterationCount>1&&prevAbsEndTime+(prevParent.duration-prevParent.iterationDuration)>tweenAbsStartTime){overrideTween(prevSibling);let prevPrevSibling=prevSibling._prevRep;while(prevPrevSibling&&prevPrevSibling.parent.id===prevParent.id){overrideTween(prevPrevSibling);prevPrevSibling=prevPrevSibling._prevRep}}const absoluteUpdateStartTime=tweenAbsStartTime-tween._delay;if(prevAbsEndTime>absoluteUpdateStartTime){const prevChangeStartTime=prevSibling._startTime;const prevTLOffset=prevAbsEndTime-(prevChangeStartTime+prevSibling._updateDuration);prevSibling._changeDuration=absoluteUpdateStartTime-prevTLOffset-prevChangeStartTime;prevSibling._currentTime=prevSibling._changeDuration;prevSibling._isOverlapped=1;if(prevSibling._changeDuration<minValue){overrideTween(prevSibling)}}let pausePrevParentAnimation=true;forEachChildren(prevParent,(t=>{if(!t._isOverlapped)pausePrevParentAnimation=false}));if(pausePrevParentAnimation){const prevParentTL=prevParent.parent;if(prevParentTL){let pausePrevParentTL=true;forEachChildren(prevParentTL,(a=>{if(a!==prevParent){forEachChildren(a,(t=>{if(!t._isOverlapped)pausePrevParentTL=false}))}}));if(pausePrevParentTL){prevParentTL.cancel()}}else{prevParent.cancel()}}}}else if(tweenCompositionType===compositionTypes.blend){const additiveTweenSiblings=getTweenSiblings(tween.target,tween.property,"_add");const additiveAnimation=addAdditiveAnimation(lookups._add);let lookupTween=additiveTweenSiblings._head;if(!lookupTween){lookupTween={...tween};lookupTween._composition=compositionTypes.replace;lookupTween._updateDuration=minValue;lookupTween._startTime=0;lookupTween._numbers=cloneArray(tween._fromNumbers);lookupTween._number=0;lookupTween._next=null;lookupTween._prev=null;addChild(additiveTweenSiblings,lookupTween);addChild(additiveAnimation,lookupTween)}const toNumber=tween._toNumber;tween._fromNumber=lookupTween._fromNumber-toNumber;tween._toNumber=0;tween._numbers=cloneArray(tween._fromNumbers);tween._number=0;lookupTween._fromNumber=toNumber;if(tween._toNumbers){const toNumbers=cloneArray(tween._toNumbers);if(toNumbers){toNumbers.forEach(((value,i)=>{tween._fromNumbers[i]=lookupTween._fromNumbers[i]-value;tween._toNumbers[i]=0}))}lookupTween._fromNumbers=toNumbers}addChild(additiveTweenSiblings,tween,null,"_prevAdd","_nextAdd")}return tween};const removeTweenSliblings=tween=>{const tweenComposition=tween._composition;if(tweenComposition!==compositionTypes.none){const tweenTarget=tween.target;const tweenProperty=tween.property;const replaceTweensLookup=lookups._rep;const replaceTargetProps=replaceTweensLookup.get(tweenTarget);const tweenReplaceSiblings=replaceTargetProps[tweenProperty];removeChild(tweenReplaceSiblings,tween,"_prevRep","_nextRep");if(tweenComposition===compositionTypes.blend){const addTweensLookup=lookups._add;const addTargetProps=addTweensLookup.get(tweenTarget);if(!addTargetProps)return;const additiveTweenSiblings=addTargetProps[tweenProperty];const additiveAnimation=additive.animation;removeChild(additiveTweenSiblings,tween,"_prevAdd","_nextAdd");const lookupTween=additiveTweenSiblings._head;if(lookupTween&&lookupTween===additiveTweenSiblings._tail){removeChild(additiveTweenSiblings,lookupTween,"_prevAdd","_nextAdd");removeChild(additiveAnimation,lookupTween);let shouldClean=true;for(let prop in addTargetProps){if(addTargetProps[prop]._head){shouldClean=false;break}}if(shouldClean){addTweensLookup.delete(tweenTarget)}}}}return tween};const resetTimerProperties=timer=>{timer.paused=true;timer.began=false;timer.completed=false;return timer};const reviveTimer=timer=>{if(!timer._cancelled)return timer;if(timer._hasChildren){forEachChildren(timer,reviveTimer)}else{forEachChildren(timer,(tween=>{if(tween._composition!==compositionTypes.none){composeTween(tween,getTweenSiblings(tween.target,tween.property))}}))}timer._cancelled=0;return timer};let timerId=0;class Timer extends Clock{constructor(parameters={},parent=null,parentPosition=0){super(0);const{id:id,delay:delay,duration:duration,reversed:reversed,alternate:alternate,loop:loop,loopDelay:loopDelay,autoplay:autoplay,frameRate:frameRate,playbackRate:playbackRate,onComplete:onComplete,onLoop:onLoop,onPause:onPause,onBegin:onBegin,onBeforeUpdate:onBeforeUpdate,onUpdate:onUpdate}=parameters;if(scope.current)scope.current.register(this);const timerInitTime=parent?0:engine._elapsedTime;const timerDefaults=parent?parent.defaults:globals.defaults;const timerDelay=isFnc(delay)||isUnd(delay)?timerDefaults.delay:+delay;const timerDuration=isFnc(duration)||isUnd(duration)?Infinity:+duration;const timerLoop=setValue(loop,timerDefaults.loop);const timerLoopDelay=setValue(loopDelay,timerDefaults.loopDelay);const timerIterationCount=timerLoop===true||timerLoop===Infinity||timerLoop<0?Infinity:timerLoop+1;let offsetPosition=0;if(parent){offsetPosition=parentPosition}else{let startTime=now();if(engine.paused){engine.requestTick(startTime);startTime=engine._elapsedTime}offsetPosition=startTime-engine._startTime}this.id=!isUnd(id)?id:++timerId;this.parent=parent;this.duration=clampInfinity((timerDuration+timerLoopDelay)*timerIterationCount-timerLoopDelay)||minValue;this.backwards=false;this.paused=true;this.began=false;this.completed=false;this.onBegin=onBegin||timerDefaults.onBegin;this.onBeforeUpdate=onBeforeUpdate||timerDefaults.onBeforeUpdate;this.onUpdate=onUpdate||timerDefaults.onUpdate;this.onLoop=onLoop||timerDefaults.onLoop;this.onPause=onPause||timerDefaults.onPause;this.onComplete=onComplete||timerDefaults.onComplete;this.iterationDuration=timerDuration;this.iterationCount=timerIterationCount;this._autoplay=parent?false:setValue(autoplay,timerDefaults.autoplay);this._offset=offsetPosition;this._delay=timerDelay;this._loopDelay=timerLoopDelay;this._iterationTime=0;this._currentIteration=0;this._resolve=noop;this._running=false;this._reversed=+setValue(reversed,timerDefaults.reversed);this._reverse=this._reversed;this._cancelled=0;this._alternate=setValue(alternate,timerDefaults.alternate);this._prev=null;this._next=null;this._elapsedTime=timerInitTime;this._startTime=timerInitTime;this._lastTime=timerInitTime;this._fps=setValue(frameRate,timerDefaults.frameRate);this._speed=setValue(playbackRate,timerDefaults.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(cancelled){cancelled?this.cancel():this.reset(1).play()}get currentTime(){return clamp(round(this._currentTime,globals.precision),-this._delay,this.duration)}set currentTime(time){const paused=this.paused;this.pause().seek(+time);if(!paused)this.resume()}get iterationCurrentTime(){return round(this._iterationTime,globals.precision)}set iterationCurrentTime(time){this.currentTime=this.iterationDuration*this._currentIteration+time}get progress(){return clamp(round(this._currentTime/this.duration,10),0,1)}set progress(progress){this.currentTime=this.duration*progress}get iterationProgress(){return clamp(round(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(progress){const iterationDuration=this.iterationDuration;this.currentTime=iterationDuration*this._currentIteration+iterationDuration*progress}get currentIteration(){return this._currentIteration}set currentIteration(iterationCount){this.currentTime=this.iterationDuration*clamp(+iterationCount,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(reverse){reverse?this.reverse():this.play()}get speed(){return super.speed}set speed(playbackRate){super.speed=playbackRate;this.resetTime()}reset(internalRender=0){reviveTimer(this);if(this._reversed&&!this._reverse)this.reversed=false;this._iterationTime=this.iterationDuration;tick(this,0,1,internalRender,tickModes.FORCE);resetTimerProperties(this);if(this._hasChildren){forEachChildren(this,resetTimerProperties)}return this}init(internalRender=0){this.fps=this._fps;this.speed=this._speed;if(!internalRender&&this._hasChildren){tick(this,this.duration,1,internalRender,tickModes.FORCE)}this.reset(internalRender);const autoplay=this._autoplay;if(autoplay===true){this.resume()}else if(autoplay&&!isUnd(autoplay.linked)){autoplay.link(this)}return this}resetTime(){const timeScale=1/(this._speed*engine._speed);this._startTime=now()-(this._currentTime+this._delay)*timeScale;return this}pause(){if(this.paused)return this;this.paused=true;this.onPause(this);return this}resume(){if(!this.paused)return this;this.paused=false;if(this.duration<=minValue&&!this._hasChildren){tick(this,minValue,0,0,tickModes.FORCE)}else{if(!this._running){addChild(engine,this);engine._hasChildren=true;this._running=true}this.resetTime();this._startTime-=12;engine.wake()}return this}restart(){return this.reset(0).resume()}seek(time,muteCallbacks=0,internalRender=0){reviveTimer(this);this.completed=false;const isPaused=this.paused;this.paused=true;tick(this,time+this._delay,~~muteCallbacks,~~internalRender,tickModes.AUTO);return isPaused?this:this.resume()}alternate(){const reversed=this._reversed;const count=this.iterationCount;const duration=this.iterationDuration;const iterations=count===Infinity?floor(maxValue/duration):count;this._reversed=+(this._alternate&&!(iterations%2)?reversed:!reversed);if(count===Infinity){this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress}else{this.seek(duration*iterations-this._currentTime)}this.resetTime();return this}play(){if(this._reversed)this.alternate();return this.resume()}reverse(){if(!this._reversed)this.alternate();return this.resume()}cancel(){if(this._hasChildren){forEachChildren(this,(child=>child.cancel()),true)}else{forEachChildren(this,removeTweenSliblings)}this._cancelled=1;return this.pause()}stretch(newDuration){const currentDuration=this.duration;const normlizedDuration=normalizeTime(newDuration);if(currentDuration===normlizedDuration)return this;const timeScale=newDuration/currentDuration;const isSetter=newDuration<=minValue;this.duration=isSetter?minValue:normlizedDuration;this.iterationDuration=isSetter?minValue:normalizeTime(this.iterationDuration*timeScale);this._offset*=timeScale;this._delay*=timeScale;this._loopDelay*=timeScale;return this}revert(){tick(this,0,1,0,tickModes.AUTO);const ap=this._autoplay;if(ap&&ap.linked&&ap.linked===this)ap.revert();return this.cancel()}complete(){return this.seek(this.duration).cancel()}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const createTimer=parameters=>new Timer(parameters,null,0).init();const none=t=>t;const calcBezier=(aT,aA1,aA2)=>(((1-3*aA2+3*aA1)*aT+(3*aA2-6*aA1))*aT+3*aA1)*aT;const binarySubdivide=(aX,mX1,mX2)=>{let aA=0,aB=1,currentX,currentT,i=0;do{currentT=aA+(aB-aA)/2;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0){aB=currentT}else{aA=currentT}}while(abs(currentX)>1e-7&&++i<100);return currentT};const cubicBezier=(mX1=.5,mY1=0,mX2=.5,mY2=1)=>mX1===mY1&&mX2===mY2?none:t=>t===0||t===1?t:calcBezier(binarySubdivide(t,mX1,mX2),mY1,mY2);const steps=(steps=10,fromStart)=>{const roundMethod=fromStart?ceil:floor;return t=>roundMethod(clamp(t,0,1)*steps)*(1/steps)};const linear=(...args)=>{const argsLength=args.length;if(!argsLength)return none;const totalPoints=argsLength-1;const firstArg=args[0];const lastArg=args[totalPoints];const xPoints=[0];const yPoints=[parseNumber(firstArg)];for(let i=1;i<totalPoints;i++){const arg=args[i];const splitValue=isStr(arg)?arg.trim().split(" "):[arg];const value=splitValue[0];const percent=splitValue[1];xPoints.push(!isUnd(percent)?parseNumber(percent)/100:i/totalPoints);yPoints.push(parseNumber(value))}yPoints.push(parseNumber(lastArg));xPoints.push(1);return function easeLinear(t){for(let i=1,l=xPoints.length;i<l;i++){const currentX=xPoints[i];if(t<=currentX){const prevX=xPoints[i-1];const prevY=yPoints[i-1];return prevY+(yPoints[i]-prevY)*(t-prevX)/(currentX-prevX)}}return yPoints[yPoints.length-1]}};const irregular=(length=10,randomness=1)=>{const values=[0];const total=length-1;for(let i=1;i<total;i++){const previousValue=values[i-1];const spacing=i/total;const segmentEnd=(i+1)/total;const randomVariation=spacing+(segmentEnd-spacing)*Math.random();const randomValue=spacing*(1-randomness)+randomVariation*randomness;values.push(clamp(randomValue,previousValue,1))}values.push(1);return linear(...values)};const halfPI=PI/2;const doublePI=PI*2;const easeInPower=(p=1.68)=>t=>pow(t,+p);const easeInFunctions={[emptyString]:easeInPower,Quad:easeInPower(2),Cubic:easeInPower(3),Quart:easeInPower(4),Quint:easeInPower(5),Sine:t=>1-cos(t*halfPI),Circ:t=>1-sqrt(1-t*t),Expo:t=>t?pow(2,10*t-10):0,Bounce:t=>{let pow2,b=4;while(t<((pow2=pow(2,--b))-1)/11);return 1/pow(4,3-b)-7.5625*pow((pow2*3-2)/22-t,2)},Back:(overshoot=1.70158)=>t=>(+overshoot+1)*t*t*t-+overshoot*t*t,Elastic:(amplitude=1,period=.3)=>{const a=clamp(+amplitude,1,10);const p=clamp(+period,minValue,2);const s=p/doublePI*asin(1/a);const e=doublePI/p;return t=>t===0||t===1?t:-a*pow(2,-10*(1-t))*sin((1-t-s)*e)}};const easeTypes={in:easeIn=>t=>easeIn(t),out:easeIn=>t=>1-easeIn(1-t),inOut:easeIn=>t=>t<.5?easeIn(t*2)/2:1-easeIn(t*-2+2)/2,outIn:easeIn=>t=>t<.5?(1-easeIn(1-t*2))/2:(easeIn(t*2-1)+1)/2};const parseEaseString=(string,easesFunctions,easesLookups)=>{if(easesLookups[string])return easesLookups[string];if(string.indexOf("(")<=-1){const hasParams=easeTypes[string]||string.includes("Back")||string.includes("Elastic");const parsedFn=hasParams?easesFunctions[string]():easesFunctions[string];return parsedFn?easesLookups[string]=parsedFn:none}else{const split=string.slice(0,-1).split("(");const parsedFn=easesFunctions[split[0]];return parsedFn?easesLookups[string]=parsedFn(...split[1].split(",")):none}};const eases=(()=>{const list={linear:linear,irregular:irregular,steps:steps,cubicBezier:cubicBezier};for(let type in easeTypes){for(let name in easeInFunctions){const easeIn=easeInFunctions[name];const easeType=easeTypes[type];list[type+name]=name===emptyString||name==="Back"||name==="Elastic"?(a,b)=>easeType(easeIn(a,b)):easeType(easeIn)}}return list})();const JSEasesLookups={linear:none};const parseEasings=ease=>isFnc(ease)?ease:isStr(ease)?parseEaseString(ease,eases,JSEasesLookups):none;const propertyNamesCache={};const sanitizePropertyName=(propertyName,target,tweenType)=>{if(tweenType===tweenTypes.TRANSFORM){const t=shortTransforms.get(propertyName);return t?t:propertyName}else if(tweenType===tweenTypes.CSS||tweenType===tweenTypes.ATTRIBUTE&&(isSvg(target)&&propertyName in target.style)){const cachedPropertyName=propertyNamesCache[propertyName];if(cachedPropertyName){return cachedPropertyName}else{const lowerCaseName=propertyName?toLowerCase(propertyName):propertyName;propertyNamesCache[propertyName]=lowerCaseName;return lowerCaseName}}else{return propertyName}};const angleUnitsMap={deg:1,rad:180/PI,turn:360};const convertedValuesCache={};const convertValueUnit=(el,decomposedValue,unit,force=false)=>{const currentUnit=decomposedValue.u;const currentNumber=decomposedValue.n;if(decomposedValue.t===valueTypes.UNIT&&currentUnit===unit){return decomposedValue}const cachedKey=currentNumber+currentUnit+unit;const cached=convertedValuesCache[cachedKey];if(!isUnd(cached)&&!force){decomposedValue.n=cached}else{let convertedValue;if(currentUnit in angleUnitsMap){convertedValue=currentNumber*angleUnitsMap[currentUnit]/angleUnitsMap[unit]}else{const baseline=100;const tempEl=el.cloneNode();const parentNode=el.parentNode;const parentEl=parentNode&&parentNode!==doc?parentNode:doc.body;parentEl.appendChild(tempEl);const elStyle=tempEl.style;elStyle.width=baseline+currentUnit;const currentUnitWidth=tempEl.offsetWidth||baseline;elStyle.width=baseline+unit;const newUnitWidth=tempEl.offsetWidth||baseline;const factor=currentUnitWidth/newUnitWidth;parentEl.removeChild(tempEl);convertedValue=factor*currentNumber}decomposedValue.n=convertedValue;convertedValuesCache[cachedKey]=convertedValue}decomposedValue.t===valueTypes.UNIT;decomposedValue.u=unit;return decomposedValue};const cleanInlineStyles=renderable=>{if(renderable._hasChildren){forEachChildren(renderable,cleanInlineStyles,true)}else{const animation=renderable;animation.pause();forEachChildren(animation,(tween=>{const tweenProperty=tween.property;const tweenTarget=tween.target;if(tweenTarget[isDomSymbol]){const targetStyle=tweenTarget.style;const originalInlinedValue=animation._inlineStyles[tweenProperty];if(tween._tweenType===tweenTypes.TRANSFORM){const cachedTransforms=tweenTarget[transformsSymbol];if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){delete cachedTransforms[tweenProperty]}else{cachedTransforms[tweenProperty]=originalInlinedValue}if(tween._renderTransforms){if(!Object.keys(cachedTransforms).length){targetStyle.removeProperty("transform")}else{let str=emptyString;for(let key in cachedTransforms){str+=transformsFragmentStrings[key]+cachedTransforms[key]+") "}targetStyle.transform=str}}}else{if(isUnd(originalInlinedValue)||originalInlinedValue===emptyString){targetStyle.removeProperty(tweenProperty)}else{targetStyle[tweenProperty]=originalInlinedValue}}if(animation._tail===tween){animation.targets.forEach((t=>{if(t.getAttribute&&t.getAttribute("style")===emptyString){t.removeAttribute("style")}}))}}}))}return renderable};const fromTargetObject=createDecomposedValueTargetObject();const toTargetObject=createDecomposedValueTargetObject();const toFunctionStore={func:null};const keyframesTargetArray=[null];const fastSetValuesArray=[null,null];const keyObjectTarget={to:null};let tweenId=0;let keyframes;let key;const generateKeyframes=(keyframes,parameters)=>{const properties={};if(isArr(keyframes)){const propertyNames=[].concat(...keyframes.map((key=>Object.keys(key)))).filter(isKey);for(let i=0,l=propertyNames.length;i<l;i++){const propName=propertyNames[i];const propArray=keyframes.map((key=>{const newKey={};for(let p in key){const keyValue=key[p];if(isKey(p)){if(p===propName){newKey.to=keyValue}}else{newKey[p]=keyValue}}return newKey}));properties[propName]=propArray}}else{const totalDuration=setValue(parameters.duration,globals.defaults.duration);const keys=Object.keys(keyframes).map((key=>({o:parseFloat(key)/100,p:keyframes[key]}))).sort(((a,b)=>a.o-b.o));keys.forEach((key=>{const offset=key.o;const prop=key.p;for(let name in prop){if(isKey(name)){let propArray=properties[name];if(!propArray)propArray=properties[name]=[];const duration=offset*totalDuration;let length=propArray.length;let prevKey=propArray[length-1];const keyObj={to:prop[name]};let durProgress=0;for(let i=0;i<length;i++){durProgress+=propArray[i].duration}if(length===1){keyObj.from=prevKey.to}if(prop.ease){keyObj.ease=prop.ease}keyObj.duration=duration-(length?durProgress:0);propArray.push(keyObj)}}return key}));for(let name in properties){const propArray=properties[name];let prevEase;for(let i=0,l=propArray.length;i<l;i++){const prop=propArray[i];const currentEase=prop.ease;prop.ease=prevEase?prevEase:undefined;prevEase=currentEase}if(!propArray[0].duration){propArray.shift()}}}return properties};class JSAnimation extends Timer{constructor(targets,parameters,parent,parentPosition,fastSet=false,index=0,length=0){super(parameters,parent,parentPosition);const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;const kfParams=parameters.keyframes;const params=kfParams?mergeObjects(generateKeyframes(kfParams,parameters),parameters):parameters;const{delay:delay,duration:duration,ease:ease,playbackEase:playbackEase,modifier:modifier,composition:composition,onRender:onRender}=params;const animDefaults=parent?parent.defaults:globals.defaults;const animaPlaybackEase=setValue(playbackEase,animDefaults.playbackEase);const animEase=animaPlaybackEase?parseEasings(animaPlaybackEase):null;const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const tEasing=hasSpring?ease.ease:setValue(ease,animEase?"linear":animDefaults.ease);const tDuration=hasSpring?ease.duration:setValue(duration,animDefaults.duration);const tDelay=setValue(delay,animDefaults.delay);const tModifier=modifier||animDefaults.modifier;const tComposition=isUnd(composition)&&targetsLength>=K?compositionTypes.none:!isUnd(composition)?composition:animDefaults.composition;const animInlineStyles={};const absoluteOffsetTime=this._offset+(parent?parent._offset:0);let iterationDuration=NaN;let iterationDelay=NaN;let animationAnimationLength=0;let shouldTriggerRender=0;for(let targetIndex=0;targetIndex<targetsLength;targetIndex++){const target=parsedTargets[targetIndex];const ti=index||targetIndex;const tl=length||targetsLength;let lastTransformGroupIndex=NaN;let lastTransformGroupLength=NaN;for(let p in params){if(isKey(p)){const tweenType=getTweenType(target,p);const propName=sanitizePropertyName(p,target,tweenType);let propValue=params[p];const isPropValueArray=isArr(propValue);if(fastSet&&!isPropValueArray){fastSetValuesArray[0]=propValue;fastSetValuesArray[1]=propValue;propValue=fastSetValuesArray}if(isPropValueArray){const arrayLength=propValue.length;const isNotObjectValue=!isObj(propValue[0]);if(arrayLength===2&&isNotObjectValue){keyObjectTarget.to=propValue;keyframesTargetArray[0]=keyObjectTarget;keyframes=keyframesTargetArray}else if(arrayLength>2&&isNotObjectValue){keyframes=[];propValue.forEach(((v,i)=>{if(!i){fastSetValuesArray[0]=v}else if(i===1){fastSetValuesArray[1]=v;keyframes.push(fastSetValuesArray)}else{keyframes.push(v)}}))}else{keyframes=propValue}}else{keyframesTargetArray[0]=propValue;keyframes=keyframesTargetArray}let siblings=null;let prevTween=null;let firstTweenChangeStartTime=NaN;let lastTweenChangeEndTime=0;let tweenIndex=0;for(let l=keyframes.length;tweenIndex<l;tweenIndex++){const keyframe=keyframes[tweenIndex];if(isObj(keyframe)){key=keyframe}else{keyObjectTarget.to=keyframe;key=keyObjectTarget}toFunctionStore.func=null;const computedToValue=getFunctionValue(key.to,target,ti,tl,toFunctionStore);let tweenToValue;if(isObj(computedToValue)&&!isUnd(computedToValue.to)){key=computedToValue;tweenToValue=computedToValue.to}else{tweenToValue=computedToValue}const tweenFromValue=getFunctionValue(key.from,target,ti,tl);const keyEasing=key.ease;const hasSpring=!isUnd(keyEasing)&&!isUnd(keyEasing.ease);const tweenEasing=hasSpring?keyEasing.ease:keyEasing||tEasing;const tweenDuration=hasSpring?keyEasing.duration:getFunctionValue(setValue(key.duration,l>1?getFunctionValue(tDuration,target,ti,tl)/l:tDuration),target,ti,tl);const tweenDelay=getFunctionValue(setValue(key.delay,!tweenIndex?tDelay:0),target,ti,tl);const computedComposition=getFunctionValue(setValue(key.composition,tComposition),target,ti,tl);const tweenComposition=isNum(computedComposition)?computedComposition:compositionTypes[computedComposition];const tweenModifier=key.modifier||tModifier;const hasFromvalue=!isUnd(tweenFromValue);const hasToValue=!isUnd(tweenToValue);const isFromToArray=isArr(tweenToValue);const isFromToValue=isFromToArray||hasFromvalue&&hasToValue;const tweenStartTime=prevTween?lastTweenChangeEndTime+tweenDelay:tweenDelay;const absoluteStartTime=absoluteOffsetTime+tweenStartTime;if(!shouldTriggerRender&&(hasFromvalue||isFromToArray))shouldTriggerRender=1;let prevSibling=prevTween;if(tweenComposition!==compositionTypes.none){if(!siblings)siblings=getTweenSiblings(target,propName);let nextSibling=siblings._head;while(nextSibling&&!nextSibling._isOverridden&&nextSibling._absoluteStartTime<=absoluteStartTime){prevSibling=nextSibling;nextSibling=nextSibling._nextRep;if(nextSibling&&nextSibling._absoluteStartTime>=absoluteStartTime){while(nextSibling){overrideTween(nextSibling);nextSibling=nextSibling._nextRep}}}}if(isFromToValue){decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[0],target,ti,tl):tweenFromValue,fromTargetObject);decomposeRawValue(isFromToArray?getFunctionValue(tweenToValue[1],target,ti,tl,toFunctionStore):tweenToValue,toTargetObject);if(fromTargetObject.t===valueTypes.NUMBER){if(prevSibling){if(prevSibling._valueType===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=prevSibling._unit}}else{decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.UNIT){fromTargetObject.t=valueTypes.UNIT;fromTargetObject.u=decomposedOriginalValue.u}}}}else{if(hasToValue){decomposeRawValue(tweenToValue,toTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,toTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),toTargetObject)}}if(hasFromvalue){decomposeRawValue(tweenFromValue,fromTargetObject)}else{if(prevTween){decomposeTweenValue(prevTween,fromTargetObject)}else{decomposeRawValue(parent&&prevSibling&&prevSibling.parent.parent===parent?prevSibling._value:getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),fromTargetObject)}}}if(fromTargetObject.o){fromTargetObject.n=getRelativeValue(!prevSibling?decomposeRawValue(getOriginalAnimatableValue(target,propName,tweenType,animInlineStyles),decomposedOriginalValue).n:prevSibling._toNumber,fromTargetObject.n,fromTargetObject.o)}if(toTargetObject.o){toTargetObject.n=getRelativeValue(fromTargetObject.n,toTargetObject.n,toTargetObject.o)}if(fromTargetObject.t!==toTargetObject.t){if(fromTargetObject.t===valueTypes.COMPLEX||toTargetObject.t===valueTypes.COMPLEX){const complexValue=fromTargetObject.t===valueTypes.COMPLEX?fromTargetObject:toTargetObject;const notComplexValue=fromTargetObject.t===valueTypes.COMPLEX?toTargetObject:fromTargetObject;notComplexValue.t=valueTypes.COMPLEX;notComplexValue.s=cloneArray(complexValue.s);notComplexValue.d=complexValue.d.map((()=>notComplexValue.n))}else if(fromTargetObject.t===valueTypes.UNIT||toTargetObject.t===valueTypes.UNIT){const unitValue=fromTargetObject.t===valueTypes.UNIT?fromTargetObject:toTargetObject;const notUnitValue=fromTargetObject.t===valueTypes.UNIT?toTargetObject:fromTargetObject;notUnitValue.t=valueTypes.UNIT;notUnitValue.u=unitValue.u}else if(fromTargetObject.t===valueTypes.COLOR||toTargetObject.t===valueTypes.COLOR){const colorValue=fromTargetObject.t===valueTypes.COLOR?fromTargetObject:toTargetObject;const notColorValue=fromTargetObject.t===valueTypes.COLOR?toTargetObject:fromTargetObject;notColorValue.t=valueTypes.COLOR;notColorValue.s=colorValue.s;notColorValue.d=[0,0,0,1]}}if(fromTargetObject.u!==toTargetObject.u){let valueToConvert=toTargetObject.u?fromTargetObject:toTargetObject;valueToConvert=convertValueUnit(target,valueToConvert,toTargetObject.u?toTargetObject.u:fromTargetObject.u,false)}if(toTargetObject.d&&fromTargetObject.d&&toTargetObject.d.length!==fromTargetObject.d.length){const longestValue=fromTargetObject.d.length>toTargetObject.d.length?fromTargetObject:toTargetObject;const shortestValue=longestValue===fromTargetObject?toTargetObject:fromTargetObject;shortestValue.d=longestValue.d.map(((_,i)=>isUnd(shortestValue.d[i])?0:shortestValue.d[i]));shortestValue.s=cloneArray(longestValue.s)}const tweenUpdateDuration=round(+tweenDuration||minValue,12);const tween={parent:this,id:tweenId++,property:propName,target:target,_value:null,_func:toFunctionStore.func,_ease:parseEasings(tweenEasing),_fromNumbers:cloneArray(fromTargetObject.d),_toNumbers:cloneArray(toTargetObject.d),_strings:cloneArray(toTargetObject.s),_fromNumber:fromTargetObject.n,_toNumber:toTargetObject.n,_numbers:cloneArray(fromTargetObject.d),_number:fromTargetObject.n,_unit:toTargetObject.u,_modifier:tweenModifier,_currentTime:0,_startTime:tweenStartTime,_delay:+tweenDelay,_updateDuration:tweenUpdateDuration,_changeDuration:tweenUpdateDuration,_absoluteStartTime:absoluteStartTime,_tweenType:tweenType,_valueType:toTargetObject.t,_composition:tweenComposition,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};if(tweenComposition!==compositionTypes.none){composeTween(tween,siblings)}if(isNaN(firstTweenChangeStartTime)){firstTweenChangeStartTime=tween._startTime}lastTweenChangeEndTime=round(tweenStartTime+tweenUpdateDuration,12);prevTween=tween;animationAnimationLength++;addChild(this,tween)}if(isNaN(iterationDelay)||firstTweenChangeStartTime<iterationDelay){iterationDelay=firstTweenChangeStartTime}if(isNaN(iterationDuration)||lastTweenChangeEndTime>iterationDuration){iterationDuration=lastTweenChangeEndTime}if(tweenType===tweenTypes.TRANSFORM){lastTransformGroupIndex=animationAnimationLength-tweenIndex;lastTransformGroupLength=animationAnimationLength}}}if(!isNaN(lastTransformGroupIndex)){let i=0;forEachChildren(this,(tween=>{if(i>=lastTransformGroupIndex&&i<lastTransformGroupLength){tween._renderTransforms=1;if(tween._composition===compositionTypes.blend){forEachChildren(additive.animation,(additiveTween=>{if(additiveTween.id===tween.id){additiveTween._renderTransforms=1}}))}}i++}))}}if(!targetsLength){console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`)}if(iterationDelay){forEachChildren(this,(tween=>{if(!(tween._startTime-tween._delay)){tween._delay-=iterationDelay}tween._startTime-=iterationDelay}));iterationDuration-=iterationDelay}else{iterationDelay=0}if(!iterationDuration){iterationDuration=minValue;this.iterationCount=0}this.targets=parsedTargets;this.duration=iterationDuration===minValue?minValue:clampInfinity((iterationDuration+this._loopDelay)*this.iterationCount-this._loopDelay)||minValue;this.onRender=onRender||animDefaults.onRender;this._ease=animEase;this._delay=iterationDelay;this.iterationDuration=iterationDuration;this._inlineStyles=animInlineStyles;if(!this._autoplay&&shouldTriggerRender)this.onRender(this)}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;forEachChildren(this,(tween=>{tween._updateDuration=normalizeTime(tween._updateDuration*timeScale);tween._changeDuration=normalizeTime(tween._changeDuration*timeScale);tween._currentTime*=timeScale;tween._startTime*=timeScale;tween._absoluteStartTime*=timeScale}));return super.stretch(newDuration)}refresh(){forEachChildren(this,(tween=>{const tweenFunc=tween._func;if(tweenFunc){const ogValue=getOriginalAnimatableValue(tween.target,tween.property,tween._tweenType);decomposeRawValue(ogValue,decomposedOriginalValue);decomposeRawValue(tweenFunc(),toTargetObject);tween._fromNumbers=cloneArray(decomposedOriginalValue.d);tween._fromNumber=decomposedOriginalValue.n;tween._toNumbers=cloneArray(toTargetObject.d);tween._strings=cloneArray(toTargetObject.s);tween._toNumber=toTargetObject.n}}));return this}revert(){super.revert();return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const animate=(targets,parameters)=>new JSAnimation(targets,parameters,null,0,false).init();const easingToLinear=(fn,samples=100)=>{const points=[];for(let i=0;i<=samples;i++)points.push(fn(i/samples));return`linear(${points.join(", ")})`};const WAAPIEasesLookups={in:"ease-in",out:"ease-out",inOut:"ease-in-out"};const WAAPIeases=(()=>{const list={};for(let type in easeTypes)list[type]=a=>easeTypes[type](easeInPower(a));return list})();const parseWAAPIEasing=ease=>{let parsedEase=WAAPIEasesLookups[ease];if(parsedEase)return parsedEase;parsedEase="linear";if(isStr(ease)){if(stringStartsWith(ease,"linear")||stringStartsWith(ease,"cubic-")||stringStartsWith(ease,"steps")||stringStartsWith(ease,"ease")){parsedEase=ease}else if(stringStartsWith(ease,"cubicB")){parsedEase=toLowerCase(ease)}else{const parsed=parseEaseString(ease,WAAPIeases,WAAPIEasesLookups);if(isFnc(parsed))parsedEase=parsed===none?"linear":easingToLinear(parsed)}WAAPIEasesLookups[ease]=parsedEase}else if(isFnc(ease)){const easing=easingToLinear(ease);if(easing)parsedEase=easing}else if(ease.ease){parsedEase=easingToLinear(ease.ease)}return parsedEase};const transformsShorthands=["x","y","z"];const commonDefaultPXProperties=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...transformsShorthands];const validIndividualTransforms=(()=>[...transformsShorthands,...validTransforms.filter((t=>["X","Y","Z"].some((axis=>t.endsWith(axis)))))])();let transformsPropertiesRegistered=null;const WAAPIAnimationsLookups={_head:null,_tail:null};const removeWAAPIAnimation=($el,property,parent)=>{let nextLookup=WAAPIAnimationsLookups._head;while(nextLookup){const next=nextLookup._next;const matchTarget=nextLookup.$el===$el;const matchProperty=!property||nextLookup.property===property;const matchParent=!parent||nextLookup.parent===parent;if(matchTarget&&matchProperty&&matchParent){const anim=nextLookup.animation;try{anim.commitStyles()}catch{}anim.cancel();removeChild(WAAPIAnimationsLookups,nextLookup);const lookupParent=nextLookup.parent;if(lookupParent){lookupParent._completed++;if(lookupParent.animations.length===lookupParent._completed){lookupParent.completed=true;if(!lookupParent.muteCallbacks){lookupParent.paused=true;lookupParent.onComplete(lookupParent);lookupParent._resolve(lookupParent)}}}}nextLookup=next}};const addWAAPIAnimation=(parent,$el,property,keyframes,params)=>{const animation=$el.animate(keyframes,params);const animTotalDuration=params.delay+ +params.duration*params.iterations;animation.playbackRate=parent._speed;if(parent.paused)animation.pause();if(parent.duration<animTotalDuration){parent.duration=animTotalDuration;parent.controlAnimation=animation}parent.animations.push(animation);removeWAAPIAnimation($el,property);addChild(WAAPIAnimationsLookups,{parent:parent,animation:animation,$el:$el,property:property,_next:null,_prev:null});const handleRemove=()=>{removeWAAPIAnimation($el,property,parent)};animation.onremove=handleRemove;animation.onfinish=handleRemove;return animation};const normalizeTweenValue=(propName,value,$el,i,targetsLength)=>{let v=getFunctionValue(value,$el,i,targetsLength);if(!isNum(v))return v;if(commonDefaultPXProperties.includes(propName)||stringStartsWith(propName,"translate"))return`${v}px`;if(stringStartsWith(propName,"rotate")||stringStartsWith(propName,"skew"))return`${v}deg`;return`${v}`};const parseIndividualTweenValue=($el,propName,from,to,i,targetsLength)=>{let tweenValue="0";const computedTo=!isUnd(to)?normalizeTweenValue(propName,to,$el,i,targetsLength):getComputedStyle($el)[propName];if(!isUnd(from)){const computedFrom=normalizeTweenValue(propName,from,$el,i,targetsLength);tweenValue=[computedFrom,computedTo]}else{tweenValue=isArr(to)?to.map((v=>normalizeTweenValue(propName,v,$el,i,targetsLength))):computedTo}return tweenValue};class WAAPIAnimation{constructor(targets,params){if(scope.current)scope.current.register(this);if(isNil(transformsPropertiesRegistered)){if(isBrowser&&(isUnd(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"))){transformsPropertiesRegistered=false}else{validTransforms.forEach((t=>{const isSkew=stringStartsWith(t,"skew");const isScale=stringStartsWith(t,"scale");const isRotate=stringStartsWith(t,"rotate");const isTranslate=stringStartsWith(t,"translate");const isAngle=isRotate||isSkew;const syntax=isAngle?"<angle>":isScale?"<number>":isTranslate?"<length-percentage>":"*";try{CSS.registerProperty({name:"--"+t,syntax:syntax,inherits:false,initialValue:isTranslate?"0px":isAngle?"0deg":isScale?"1":"0"})}catch{}}));transformsPropertiesRegistered=true}}const parsedTargets=registerTargets(targets);const targetsLength=parsedTargets.length;if(!targetsLength){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=ease.ease&&ease;const autoplay=setValue(params.autoplay,globals.defaults.autoplay);const scroll=autoplay&&autoplay.link?autoplay:false;const alternate=params.alternate&&params.alternate===true;const reversed=params.reversed&&params.reversed===true;const loop=setValue(params.loop,globals.defaults.loop);const iterations=loop===true||loop===Infinity?Infinity:isNum(loop)?loop+1:1;const direction=alternate?reversed?"alternate-reverse":"alternate":reversed?"reverse":"normal";const fill="forwards";const easing=parseWAAPIEasing(ease);const timeScale=globals.timeScale===1?1:K;this.targets=parsedTargets;this.animations=[];this.controlAnimation=null;this.onComplete=params.onComplete||noop;this.duration=0;this.muteCallbacks=false;this.completed=false;this.paused=!autoplay||scroll!==false;this.reversed=reversed;this.autoplay=autoplay;this._speed=setValue(params.playbackRate,globals.defaults.playbackRate);this._resolve=noop;this._completed=0;this._inlineStyles=parsedTargets.map(($el=>$el.getAttribute("style")));parsedTargets.forEach((($el,i)=>{const cachedTransforms=$el[transformsSymbol];const hasIndividualTransforms=validIndividualTransforms.some((t=>params.hasOwnProperty(t)));const duration=(spring?spring.duration:getFunctionValue(setValue(params.duration,globals.defaults.duration),$el,i,targetsLength))*timeScale;const delay=getFunctionValue(setValue(params.delay,globals.defaults.delay),$el,i,targetsLength)*timeScale;const composite=setValue(params.composition,"replace");for(let name in params){if(!isKey(name))continue;const keyframes={};const tweenParams={iterations:iterations,direction:direction,fill:fill,easing:easing,duration:duration,delay:delay,composite:composite};const propertyValue=params[name];const individualTransformProperty=hasIndividualTransforms?validTransforms.includes(name)?name:shortTransforms.get(name):false;let parsedPropertyValue;if(isObj(propertyValue)){const tweenOptions=propertyValue;const tweenOptionsEase=setValue(tweenOptions.ease,ease);const tweenOptionsSpring=tweenOptionsEase.ease&&tweenOptionsEase;const to=tweenOptions.to;const from=tweenOptions.from;tweenParams.duration=(tweenOptionsSpring?tweenOptionsSpring.duration:getFunctionValue(setValue(tweenOptions.duration,duration),$el,i,targetsLength))*timeScale;tweenParams.delay=getFunctionValue(setValue(tweenOptions.delay,delay),$el,i,targetsLength)*timeScale;tweenParams.composite=setValue(tweenOptions.composition,composite);tweenParams.easing=parseWAAPIEasing(tweenOptionsEase);parsedPropertyValue=parseIndividualTweenValue($el,name,from,to,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parseIndividualTweenValue($el,name,from,to,i,targetsLength)}addWAAPIAnimation(this,$el,name,keyframes,tweenParams);if(!isUnd(from)){if(!individualTransformProperty){$el.style[name]=keyframes[name][0]}else{const key=`--${individualTransformProperty}`;$el.style.setProperty(key,keyframes[key][0])}}}else{parsedPropertyValue=isArr(propertyValue)?propertyValue.map((v=>normalizeTweenValue(name,v,$el,i,targetsLength))):normalizeTweenValue(name,propertyValue,$el,i,targetsLength);if(individualTransformProperty){keyframes[`--${individualTransformProperty}`]=parsedPropertyValue;cachedTransforms[individualTransformProperty]=parsedPropertyValue}else{keyframes[name]=parsedPropertyValue}addWAAPIAnimation(this,$el,name,keyframes,tweenParams)}}if(hasIndividualTransforms){let transforms=emptyString;for(let t in cachedTransforms){transforms+=`${transformsFragmentStrings[t]}var(--${t})) `}$el.style.transform=transforms}}));if(scroll){this.autoplay.link(this)}}forEach(callback){const cb=isStr(callback)?a=>a[callback]():callback;this.animations.forEach(cb);return this}get speed(){return this._speed}set speed(speed){this._speed=+speed;this.forEach((anim=>anim.playbackRate=speed))}get currentTime(){const controlAnimation=this.controlAnimation;const timeScale=globals.timeScale;return this.completed?this.duration:controlAnimation?+controlAnimation.currentTime*(timeScale===1?1:timeScale):0}set currentTime(time){const t=time*(globals.timeScale===1?1:K);this.forEach((anim=>{if(t>=this.duration)anim.play();anim.currentTime=t}))}get progress(){return this.currentTime/this.duration}set progress(progress){this.forEach((anim=>anim.currentTime=progress*this.duration||0))}resume(){if(!this.paused)return this;this.paused=false;return this.forEach("play")}pause(){if(this.paused)return this;this.paused=true;return this.forEach("pause")}alternate(){this.reversed=!this.reversed;this.forEach("reverse");if(this.paused)this.forEach("pause");return this}play(){if(this.reversed)this.alternate();return this.resume()}reverse(){if(!this.reversed)this.alternate();return this.resume()}seek(time,muteCallbacks=false){if(muteCallbacks)this.muteCallbacks=true;if(time<this.duration)this.completed=false;this.currentTime=time;this.muteCallbacks=false;if(this.paused)this.pause();return this}restart(){this.completed=false;return this.seek(0,true).resume()}commitStyles(){return this.forEach("commitStyles")}complete(){return this.seek(this.duration)}cancel(){this.forEach("cancel");return this.pause()}revert(){this.cancel();this.targets.forEach((($el,i)=>$el.setAttribute("style",this._inlineStyles[i])));return this}then(callback=noop){const then=this.then;const onResolve=()=>{this.then=null;callback(this);this.then=then;this._resolve=noop};return new Promise((r=>{this._resolve=()=>r(onResolve());if(this.completed)this._resolve();return this}))}}const waapi={animate:(targets,params)=>new WAAPIAnimation(targets,params),convertEase:easingToLinear};const sync=(callback=noop)=>new Timer({duration:1*globals.timeScale,onComplete:callback},null,0).resume();function getTargetValue(targetSelector,propName,unit){const targets=registerTargets(targetSelector);if(!targets.length)return;const[target]=targets;const tweenType=getTweenType(target,propName);const normalizePropName=sanitizePropertyName(propName,target,tweenType);let originalValue=getOriginalAnimatableValue(target,normalizePropName);if(isUnd(unit)){return originalValue}else{decomposeRawValue(originalValue,decomposedOriginalValue);if(decomposedOriginalValue.t===valueTypes.NUMBER||decomposedOriginalValue.t===valueTypes.UNIT){if(unit===false){return decomposedOriginalValue.n}else{const convertedValue=convertValueUnit(target,decomposedOriginalValue,unit,false);return`${round(convertedValue.n,globals.precision)}${convertedValue.u}`}}}}const setTargetValues=(targets,parameters)=>{if(isUnd(parameters))return;parameters.duration=minValue;parameters.composition=setValue(parameters.composition,compositionTypes.none);return new JSAnimation(targets,parameters,null,0,true).resume()};const removeTargetsFromAnimation=(targetsArray,animation,propertyName)=>{let tweensMatchesTargets=false;forEachChildren(animation,(tween=>{const tweenTarget=tween.target;if(targetsArray.includes(tweenTarget)){const tweenName=tween.property;const tweenType=tween._tweenType;const normalizePropName=sanitizePropertyName(propertyName,tweenTarget,tweenType);if(!normalizePropName||normalizePropName&&normalizePropName===tweenName){if(tween.parent._tail===tween&&tween._tweenType===tweenTypes.TRANSFORM&&tween._prev&&tween._prev._tweenType===tweenTypes.TRANSFORM){tween._prev._renderTransforms=1}removeChild(animation,tween);removeTweenSliblings(tween);tweensMatchesTargets=true}}}),true);return tweensMatchesTargets};const remove=(targets,renderable,propertyName)=>{const targetsArray=parseTargets(targets);const parent=renderable?renderable:engine;const waapiAnimation=renderable&&renderable.controlAnimation&&renderable;for(let i=0,l=targetsArray.length;i<l;i++){const $el=targetsArray[i];removeWAAPIAnimation($el,propertyName,waapiAnimation)}let removeMatches;if(parent._hasChildren){let iterationDuration=0;forEachChildren(parent,(child=>{if(!child._hasChildren){removeMatches=removeTargetsFromAnimation(targetsArray,child,propertyName);if(removeMatches&&!child._head){child.cancel();removeChild(parent,child)}else{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>iterationDuration){iterationDuration=childDur}}}if(child._head){remove(targets,child,propertyName)}else{child._hasChildren=false}}),true);if(!isUnd(parent.iterationDuration)){parent.iterationDuration=iterationDuration}}else{removeMatches=removeTargetsFromAnimation(targetsArray,parent,propertyName)}if(removeMatches&&!parent._head){parent._hasChildren=false;if(parent.cancel)parent.cancel()}return targetsArray};const keepTime=createRefreshable;const randomPick=items=>items[random(0,items.length-1)];const roundPad=(v,decimalLength)=>(+v).toFixed(decimalLength);const padStart=(v,totalLength,padString)=>`${v}`.padStart(totalLength,padString);const padEnd=(v,totalLength,padString)=>`${v}`.padEnd(totalLength,padString);const wrap=(v,min,max)=>((v-min)%(max-min)+(max-min))%(max-min)+min;const mapRange=(value,inLow,inHigh,outLow,outHigh)=>outLow+(value-inLow)/(inHigh-inLow)*(outHigh-outLow);const degToRad=degrees=>degrees*PI/180;const radToDeg=radians=>radians*180/PI;const lerp=(start,end,amount,renderable)=>{let dt=K/globals.defaults.frameRate;if(renderable!==false){const ticker=renderable||engine._hasChildren&&engine;if(ticker&&ticker.deltaTime){dt=ticker.deltaTime}}const t=1-Math.exp(-amount*dt*.1);return!amount?start:amount===1?end:(1-t)*start+t*end};const curry=(fn,last=0)=>(...args)=>last?v=>fn(...args,v):v=>fn(v,...args);const chain=fn=>(...args)=>{const result=fn(...args);return new Proxy(noop,{apply:(_,__,[v])=>result(v),get:(_,prop)=>chain(((...nextArgs)=>{const nextResult=utils[prop](...nextArgs);return v=>nextResult(result(v))}))})};const makeChainable=(fn,right=0)=>(...args)=>(args.length<fn.length?chain(curry(fn,right)):fn)(...args);const utils={$:registerTargets,get:getTargetValue,set:setTargetValues,remove:remove,cleanInlineStyles:cleanInlineStyles,random:random,randomPick:randomPick,shuffle:shuffle,lerp:lerp,sync:sync,keepTime:keepTime,clamp:makeChainable(clamp),round:makeChainable(round),snap:makeChainable(snap),wrap:makeChainable(wrap),interpolate:makeChainable(interpolate,1),mapRange:makeChainable(mapRange),roundPad:makeChainable(roundPad),padStart:makeChainable(padStart),padEnd:makeChainable(padEnd),degToRad:makeChainable(degToRad),radToDeg:makeChainable(radToDeg)};const getPrevChildOffset=(timeline,timePosition)=>{if(stringStartsWith(timePosition,"<")){const goToPrevAnimationOffset=timePosition[1]==="<";const prevAnimation=timeline._tail;const prevOffset=prevAnimation?prevAnimation._offset+prevAnimation._delay:0;return goToPrevAnimationOffset?prevOffset:prevOffset+prevAnimation.duration}};const parseTimelinePosition=(timeline,timePosition)=>{let tlDuration=timeline.iterationDuration;if(tlDuration===minValue)tlDuration=0;if(isUnd(timePosition))return tlDuration;if(isNum(+timePosition))return+timePosition;const timePosStr=timePosition;const tlLabels=timeline?timeline.labels:null;const hasLabels=!isNil(tlLabels);const prevOffset=getPrevChildOffset(timeline,timePosStr);const hasSibling=!isUnd(prevOffset);const matchedRelativeOperator=relativeValuesExecRgx.exec(timePosStr);if(matchedRelativeOperator){const fullOperator=matchedRelativeOperator[0];const split=timePosStr.split(fullOperator);const labelOffset=hasLabels&&split[0]?tlLabels[split[0]]:tlDuration;const parsedOffset=hasSibling?prevOffset:hasLabels?labelOffset:tlDuration;const parsedNumericalOffset=+split[1];return getRelativeValue(parsedOffset,parsedNumericalOffset,fullOperator[0])}else{return hasSibling?prevOffset:hasLabels?!isUnd(tlLabels[timePosStr])?tlLabels[timePosStr]:tlDuration:tlDuration}};function getTimelineTotalDuration(tl){return clampInfinity((tl.iterationDuration+tl._loopDelay)*tl.iterationCount-tl._loopDelay)||minValue}function addTlChild(childParams,tl,timePosition,targets,index,length){const isSetter=isNum(childParams.duration)&&childParams.duration<=minValue;const adjustedPosition=isSetter?timePosition-minValue:timePosition;tick(tl,adjustedPosition,1,1,tickModes.AUTO);const tlChild=targets?new JSAnimation(targets,childParams,tl,adjustedPosition,false,index,length):new Timer(childParams,tl,adjustedPosition);tlChild.init(1);addChild(tl,tlChild);forEachChildren(tl,(child=>{const childTLOffset=child._offset+child._delay;const childDur=childTLOffset+child.duration;if(childDur>tl.iterationDuration)tl.iterationDuration=childDur}));tl.duration=getTimelineTotalDuration(tl);return tl}class Timeline extends Timer{constructor(parameters={}){super(parameters,null,0);this.duration=0;this.labels={};const defaultsParams=parameters.defaults;const globalDefaults=globals.defaults;this.defaults=defaultsParams?mergeObjects(defaultsParams,globalDefaults):globalDefaults;this.onRender=parameters.onRender||globalDefaults.onRender;const tlPlaybackEase=setValue(parameters.playbackEase,globalDefaults.playbackEase);this._ease=tlPlaybackEase?parseEasings(tlPlaybackEase):null;this.iterationDuration=0}add(a1,a2,a3){const isAnim=isObj(a2);const isTimer=isObj(a1);if(isAnim||isTimer){this._hasChildren=true;if(isAnim){const childParams=a2;if(isFnc(a3)){const staggeredPosition=a3;const parsedTargetsArray=parseTargets(a1);const tlDuration=this.duration;const tlIterationDuration=this.iterationDuration;const id=childParams.id;let i=0;const parsedLength=parsedTargetsArray.length;parsedTargetsArray.forEach((target=>{const staggeredChildParams={...childParams};this.duration=tlDuration;this.iterationDuration=tlIterationDuration;if(!isUnd(id))staggeredChildParams.id=id+"-"+i;addTlChild(staggeredChildParams,this,staggeredPosition(target,i,parsedLength,this),target,i,parsedLength);i++}))}else{addTlChild(childParams,this,parseTimelinePosition(this,a3),a1)}}else{addTlChild(a1,this,parseTimelinePosition(this,a2))}return this.init(1)}}sync(synced,position){if(isUnd(synced)||synced&&isUnd(synced.pause))return this;synced.pause();const duration=+(synced.effect?synced.effect.getTiming().duration:synced.duration);return this.add(synced,{currentTime:[0,duration],duration:duration,ease:"linear"},position)}set(targets,parameters,position){if(isUnd(parameters))return this;parameters.duration=minValue;parameters.composition=compositionTypes.replace;return this.add(targets,parameters,position)}call(callback,position){if(isUnd(callback)||callback&&!isFnc(callback))return this;return this.add({duration:0,onComplete:()=>callback(this)},position)}label(labelName,position){if(isUnd(labelName)||labelName&&!isStr(labelName))return this;this.labels[labelName]=parseTimelinePosition(this,position);return this}remove(targets,propertyName){remove(targets,this,propertyName);return this}stretch(newDuration){const currentDuration=this.duration;if(currentDuration===normalizeTime(newDuration))return this;const timeScale=newDuration/currentDuration;const labels=this.labels;forEachChildren(this,(child=>child.stretch(child.duration*timeScale)));for(let labelName in labels)labels[labelName]*=timeScale;return super.stretch(newDuration)}refresh(){forEachChildren(this,(child=>{if(child.refresh)child.refresh()}));return this}revert(){super.revert();forEachChildren(this,(child=>child.revert),true);return cleanInlineStyles(this)}then(callback){return super.then(callback)}}const createTimeline=parameters=>new Timeline(parameters).init();class Animatable{constructor(targets,parameters){if(scope.current)scope.current.register(this);const globalParams={};const properties={};this.targets=[];this.animations={};if(isUnd(targets)||isUnd(parameters))return;for(let propName in parameters){const paramValue=parameters[propName];if(isKey(propName)){properties[propName]=paramValue}else{globalParams[propName]=paramValue}}for(let propName in properties){const propValue=properties[propName];const isObjValue=isObj(propValue);let propParams={};let to="+=0";if(isObjValue){const unit=propValue.unit;if(isStr(unit))to+=unit}else{propParams.duration=propValue}propParams[propName]=isObjValue?mergeObjects({to:to},propValue):to;const animParams=mergeObjects(globalParams,propParams);animParams.composition=compositionTypes.replace;animParams.autoplay=false;const animation=this.animations[propName]=new JSAnimation(targets,animParams,null,0,false).init();if(!this.targets.length)this.targets.push(...animation.targets);this[propName]=(to,duration,ease)=>{const tween=animation._head;if(isUnd(to)&&tween){const numbers=tween._numbers;if(numbers&&numbers.length){return numbers}else{return tween._modifier(tween._number)}}else{forEachChildren(animation,(tween=>{if(isArr(to)){for(let i=0,l=to.length;i<l;i++){if(!isUnd(tween._numbers[i])){tween._fromNumbers[i]=tween._modifier(tween._numbers[i]);tween._toNumbers[i]=to[i]}}}else{tween._fromNumber=tween._modifier(tween._number);tween._toNumber=to}if(!isUnd(ease))tween._ease=parseEasings(ease);tween._currentTime=0}));if(!isUnd(duration))animation.stretch(duration);animation.reset(1).resume();return this}}}}revert(){for(let propName in this.animations){this[propName]=noop;this.animations[propName].revert()}this.animations={};this.targets.length=0;return this}}const createAnimatable=(targets,parameters)=>new Animatable(targets,parameters);class Spring{constructor(parameters={}){this.timeStep=.02;this.restThreshold=5e-4;this.restDuration=200;this.maxDuration=6e4;this.maxRestSteps=this.restDuration/this.timeStep/K;this.maxIterations=this.maxDuration/this.timeStep/K;this.m=clamp(setValue(parameters.mass,1),0,K);this.s=clamp(setValue(parameters.stiffness,100),1,K);this.d=clamp(setValue(parameters.damping,10),.1,K);this.v=clamp(setValue(parameters.velocity,0),-1e3,K);this.w0=0;this.zeta=0;this.wd=0;this.b=0;this.solverDuration=0;this.duration=0;this.compute();this.ease=t=>t===0||t===1?t:this.solve(t*this.solverDuration)}solve(time){const{zeta:zeta,w0:w0,wd:wd,b:b}=this;let t=time;if(zeta<1){t=exp(-t*zeta*w0)*(1*cos(wd*t)+b*sin(wd*t))}else{t=(1+b*t)*exp(-t*w0)}return 1-t}compute(){const{maxRestSteps:maxRestSteps,maxIterations:maxIterations,restThreshold:restThreshold,timeStep:timeStep,m:m,d:d,s:s,v:v}=this;const w0=this.w0=clamp(sqrt(s/m),minValue,K);const zeta=this.zeta=d/(2*sqrt(s*m));const wd=this.wd=zeta<1?w0*sqrt(1-zeta*zeta):0;this.b=zeta<1?(zeta*w0+-v)/wd:-v+w0;let solverTime=0;let restSteps=0;let iterations=0;while(restSteps<maxRestSteps&&iterations<maxIterations){if(abs(1-this.solve(solverTime))<restThreshold){restSteps++}else{restSteps=0}this.solverDuration=solverTime;solverTime+=timeStep;iterations++}this.duration=round(this.solverDuration*K,0)*globals.timeScale}get mass(){return this.m}set mass(v){this.m=clamp(setValue(v,1),0,K);this.compute()}get stiffness(){return this.s}set stiffness(v){this.s=clamp(setValue(v,100),1,K);this.compute()}get damping(){return this.d}set damping(v){this.d=clamp(setValue(v,10),.1,K);this.compute()}get velocity(){return this.v}set velocity(v){this.v=clamp(setValue(v,0),-1e3,K);this.compute()}}const createSpring=parameters=>new Spring(parameters);const preventDefault=e=>{if(e.cancelable)e.preventDefault()};class DOMProxy{constructor(el){this.el=el;this.zIndex=0;this.parentElement=null;this.classList={add:noop,remove:noop}}get x(){return this.el.x||0}set x(v){this.el.x=v}get y(){return this.el.y||0}set y(v){this.el.y=v}get width(){return this.el.width||0}set width(v){this.el.width=v}get height(){return this.el.height||0}set height(v){this.el.height=v}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class Transforms{constructor($el){this.$el=$el;this.inlineTransforms=[];this.point=new DOMPoint;this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(x,y){this.point.x=x;this.point.y=y;return this.point.matrixTransform(this.inversedMatrix)}traverseUp(cb){let $el=this.$el.parentElement,i=0;while($el&&$el!==doc){cb($el,i);$el=$el.parentElement;i++}}getMatrix(){const matrix=new DOMMatrix;this.traverseUp(($el=>{const transformValue=getComputedStyle($el).transform;if(transformValue){const elMatrix=new DOMMatrix(transformValue);matrix.preMultiplySelf(elMatrix)}}));return matrix}remove(){this.traverseUp((($el,i)=>{this.inlineTransforms[i]=$el.style.transform;$el.style.transform="none"}))}revert(){this.traverseUp((($el,i)=>{const ct=this.inlineTransforms[i];if(ct===""){$el.style.removeProperty("transform")}else{$el.style.transform=ct}}))}}const parseDraggableFunctionParameter=(value,draggable)=>value&&isFnc(value)?value(draggable):value;let zIndex=0;class Draggable{constructor(target,parameters={}){if(!target)return;if(scope.current)scope.current.register(this);const paramX=parameters.x;const paramY=parameters.y;const trigger=parameters.trigger;const modifier=parameters.modifier;const ease=parameters.releaseEase;const customEase=ease&&parseEasings(ease);const hasSpring=!isUnd(ease)&&!isUnd(ease.ease);const xProp=isObj(paramX)&&!isUnd(paramX.mapTo)?paramX.mapTo:"translateX";const yProp=isObj(paramY)&&!isUnd(paramY.mapTo)?paramY.mapTo:"translateY";const container=parseDraggableFunctionParameter(parameters.container,this);this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.$target=isObj(target)?new DOMProxy(target):parseTargets(target)[0];this.$trigger=parseTargets(trigger?trigger:target)[0];this.fixed=getTargetValue(this.$target,"position")==="fixed";this.isFinePointer=true;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.maxVelocity=0;this.minVelocity=0;this.velocityMultiplier=0;this.cursor=false;this.releaseXSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseYSpring=hasSpring?ease:createSpring({mass:setValue(parameters.releaseMass,1),stiffness:setValue(parameters.releaseStiffness,80),damping:setValue(parameters.releaseDamping,20)});this.releaseEase=customEase||eases.outQuint;this.hasReleaseSpring=hasSpring;this.onGrab=parameters.onGrab||noop;this.onDrag=parameters.onDrag||noop;this.onRelease=parameters.onRelease||noop;this.onUpdate=parameters.onUpdate||noop;this.onSettle=parameters.onSettle||noop;this.onSnap=parameters.onSnap||noop;this.onResize=parameters.onResize||noop;this.onAfterResize=parameters.onAfterResize||noop;this.disabled=[0,0];const animatableParams={};if(modifier)animatableParams.modifier=modifier;if(isUnd(paramX)||paramX===true){animatableParams[xProp]=0}else if(isObj(paramX)){const paramXObject=paramX;const animatableXParams={};if(paramXObject.modifier)animatableXParams.modifier=paramXObject.modifier;if(paramXObject.composition)animatableXParams.composition=paramXObject.composition;animatableParams[xProp]=animatableXParams}else if(paramX===false){animatableParams[xProp]=0;this.disabled[0]=1}if(isUnd(paramY)||paramY===true){animatableParams[yProp]=0}else if(isObj(paramY)){const paramYObject=paramY;const animatableYParams={};if(paramYObject.modifier)animatableYParams.modifier=paramYObject.modifier;if(paramYObject.composition)animatableYParams.composition=paramYObject.composition;animatableParams[yProp]=animatableYParams}else if(paramY===false){animatableParams[yProp]=0;this.disabled[1]=1}this.animate=new Animatable(this.$target,animatableParams);this.xProp=xProp;this.yProp=yProp;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=[-1e12,maxValue,maxValue,-1e12];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=now();this.velocity=0;this.angle=0;this.cursorStyles=null;this.triggerStyles=null;this.bodyStyles=null;this.targetStyles=null;this.touchActionStyles=null;this.transforms=new Transforms(this.$target);this.overshootCoords={x:0,y:0};this.overshootXTicker=new Timer({autoplay:false},null,0).init();this.overshootYTicker=new Timer({autoplay:false},null,0).init();this.updateTicker=new Timer({autoplay:false},null,0).init();this.overshootXTicker.onUpdate=()=>{if(this.disabled[0])return;this.updated=true;this.manual=true;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootXTicker.onComplete=()=>{if(this.disabled[0])return;this.manual=false;this.animate[this.xProp](this.overshootCoords.x,0)};this.overshootYTicker.onUpdate=()=>{if(this.disabled[1])return;this.updated=true;this.manual=true;this.animate[this.yProp](this.overshootCoords.y,0)};this.overshootYTicker.onComplete=()=>{if(this.disabled[1])return;this.manual=false;this.animate[this.yProp](this.overshootCoords.y,0)};this.updateTicker.onUpdate=()=>this.update();this.contained=!isUnd(container);this.manual=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.enabled=false;this.initialized=false;this.activeProp=this.disabled[1]?xProp:yProp;this.animate.animations[this.activeProp].onRender=()=>{const hasUpdated=this.updated;const hasMoved=this.grabbed&&hasUpdated;const hasReleased=!hasMoved&&this.released;const x=this.x;const y=this.y;const dx=x-this.coords[2];const dy=y-this.coords[3];this.deltaX=dx;this.deltaY=dy;this.coords[2]=x;this.coords[3]=y;if(hasUpdated){this.onUpdate(this)}if(!hasReleased){this.updated=false}else{this.computeVelocity(dx,dy);this.angle=atan2(dy,dx)}};this.animate.animations[this.activeProp].onComplete=()=>{if(!this.grabbed&&this.released){this.released=false}if(!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 Timer({autoplay:false,duration:150*globals.timeScale,onComplete:()=>{this.onResize(this);this.refresh();this.onAfterResize(this)}}).init();this.parameters=parameters;this.resizeObserver=new ResizeObserver((()=>{if(this.initialized){this.resizeTicker.restart()}else{this.initialized=true}}));this.enable();this.refresh();this.resizeObserver.observe(this.$container);if(!isObj(target))this.resizeObserver.observe(this.$target)}computeVelocity(dx,dy){const prevTime=this.velocityTime;const curTime=now();const elapsed=curTime-prevTime;if(elapsed<17)return this.velocity;this.velocityTime=curTime;const velocityStack=this.velocityStack;const vMul=this.velocityMultiplier;const minV=this.minVelocity;const maxV=this.maxVelocity;const vi=this.velocityStackIndex;velocityStack[vi]=round(clamp(sqrt(dx*dx+dy*dy)/elapsed*vMul,minV,maxV),5);const velocity=max(velocityStack[0],velocityStack[1],velocityStack[2]);this.velocity=velocity;this.velocityStackIndex=(vi+1)%3;return velocity}setX(x,muteUpdateCallback=false){if(this.disabled[0])return;const v=round(x,5);this.overshootXTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destX=v;this.snapped[0]=snap(v,this.snapX);this.animate[this.xProp](v,0);this.manual=false;return this}setY(y,muteUpdateCallback=false){if(this.disabled[1])return;const v=round(y,5);this.overshootYTicker.pause();this.manual=true;this.updated=!muteUpdateCallback;this.destY=v;this.snapped[1]=snap(v,this.snapY);this.animate[this.yProp](v,0);this.manual=false;return this}get x(){return round(this.animate[this.xProp](),globals.precision)}set x(x){this.setX(x,false)}get y(){return round(this.animate[this.yProp](),globals.precision)}set y(y){this.setY(y,false)}get progressX(){return mapRange(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(x){this.setX(mapRange(x,0,1,this.containerBounds[3],this.containerBounds[1]),false)}get progressY(){return mapRange(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(y){this.setY(mapRange(y,0,1,this.containerBounds[0],this.containerBounds[2]),false)}updateScrollCoords(){const sx=round(this.useWin?win.scrollX:this.$container.scrollLeft,0);const sy=round(this.useWin?win.scrollY:this.$container.scrollTop,0);const[cpt,cpr,cpb,cpl]=this.containerPadding;const threshold=this.scrollThreshold;this.scroll.x=sx;this.scroll.y=sy;this.scrollBounds[0]=sy-this.targetBounds[0]+cpt-threshold;this.scrollBounds[1]=sx-this.targetBounds[1]-cpr+threshold;this.scrollBounds[2]=sy-this.targetBounds[2]-cpb+threshold;this.scrollBounds[3]=sx-this.targetBounds[3]+cpl-threshold}updateBoundingValues(){const $container=this.$container;const cx=this.x;const cy=this.y;const cx2=this.coords[2];const cy2=this.coords[3];this.coords[2]=0;this.coords[3]=0;this.setX(0,true);this.setY(0,true);this.transforms.remove();const iw=this.window[0]=win.innerWidth;const ih=this.window[1]=win.innerHeight;const uw=this.useWin;const sw=$container.scrollWidth;const sh=$container.scrollHeight;const fx=this.fixed;const transformContainerRect=$container.getBoundingClientRect();const[cpt,cpr,cpb,cpl]=this.containerPadding;this.dragArea[0]=uw?0:transformContainerRect.left;this.dragArea[1]=uw?0:transformContainerRect.top;this.scrollView[0]=uw?clamp(sw,iw,sw):sw;this.scrollView[1]=uw?clamp(sh,ih,sh):sh;this.updateScrollCoords();const{width:width,height:height,left:left,top:top,right:right,bottom:bottom}=$container.getBoundingClientRect();this.dragArea[2]=round(uw?clamp(width,iw,iw):width,0);this.dragArea[3]=round(uw?clamp(height,ih,ih):height,0);const containerOverflow=getTargetValue($container,"overflow");const visibleOverflow=containerOverflow==="visible";const hiddenOverflow=containerOverflow==="hidden";this.canScroll=fx?false:this.contained&&($container===doc.body&&visibleOverflow||!hiddenOverflow&&!visibleOverflow)&&(sw>this.dragArea[2]+cpl-cpr||sh>this.dragArea[3]+cpt-cpb)&&(!this.containerArray||this.containerArray&&!isArr(this.containerArray));if(this.contained){const sx=this.scroll.x;const sy=this.scroll.y;const canScroll=this.canScroll;const targetRect=this.$target.getBoundingClientRect();const hiddenLeft=canScroll?uw?0:$container.scrollLeft:0;const hiddenTop=canScroll?uw?0:$container.scrollTop:0;const hiddenRight=canScroll?this.scrollView[0]-hiddenLeft-width:0;const hiddenBottom=canScroll?this.scrollView[1]-hiddenTop-height:0;this.targetBounds[0]=round(targetRect.top+sy-(uw?0:top),0);this.targetBounds[1]=round(targetRect.right+sx-(uw?iw:right),0);this.targetBounds[2]=round(targetRect.bottom+sy-(uw?ih:bottom),0);this.targetBounds[3]=round(targetRect.left+sx-(uw?0:left),0);if(this.containerArray){this.containerBounds[0]=this.containerArray[0]+cpt;this.containerBounds[1]=this.containerArray[1]-cpr;this.containerBounds[2]=this.containerArray[2]-cpb;this.containerBounds[3]=this.containerArray[3]+cpl}else{this.containerBounds[0]=-round(targetRect.top-(fx?clamp(top,0,ih):top)+hiddenTop-cpt,0);this.containerBounds[1]=-round(targetRect.right-(fx?clamp(right,0,iw):right)-hiddenRight+cpr,0);this.containerBounds[2]=-round(targetRect.bottom-(fx?clamp(bottom,0,ih):bottom)-hiddenBottom+cpb,0);this.containerBounds[3]=-round(targetRect.left-(fx?clamp(left,0,iw):left)+hiddenLeft-cpl,0)}}this.transforms.revert();this.coords[2]=cx2;this.coords[3]=cy2;this.setX(cx,true);this.setY(cy,true)}isOutOfBounds(bounds,x,y){if(!this.contained)return 0;const[bt,br,bb,bl]=bounds;const[dx,dy]=this.disabled;const obx=!dx&&x<bl||!dx&&x>br;const oby=!dy&&y<bt||!dy&&y>bb;return obx&&!oby?1:!obx&&oby?2:obx&&oby?3:0}refresh(){const params=this.parameters;const paramX=params.x;const paramY=params.y;const container=parseDraggableFunctionParameter(params.container,this);const cp=parseDraggableFunctionParameter(params.containerPadding,this)||0;const containerPadding=isArr(cp)?cp:[cp,cp,cp,cp];const cx=this.x;const cy=this.y;const parsedCursorStyles=parseDraggableFunctionParameter(params.cursor,this);const cursorStyles={onHover:"grab",onGrab:"grabbing"};if(parsedCursorStyles){const{onHover:onHover,onGrab:onGrab}=parsedCursorStyles;if(onHover)cursorStyles.onHover=onHover;if(onGrab)cursorStyles.onGrab=onGrab}this.containerArray=isArr(container)?container:null;this.$container=container&&!this.containerArray?parseTargets(container)[0]:doc.body;this.useWin=this.$container===doc.body;this.$scrollContainer=this.useWin?win:this.$container;this.isFinePointer=matchMedia("(pointer:fine)").matches;this.containerPadding=setValue(containerPadding,[0,0,0,0]);this.containerFriction=clamp(setValue(parseDraggableFunctionParameter(params.containerFriction,this),.8),0,1);this.releaseContainerFriction=clamp(setValue(parseDraggableFunctionParameter(params.releaseContainerFriction,this),this.containerFriction),0,1);this.snapX=parseDraggableFunctionParameter(isObj(paramX)&&!isUnd(paramX.snap)?paramX.snap:params.snap,this);this.snapY=parseDraggableFunctionParameter(isObj(paramY)&&!isUnd(paramY.snap)?paramY.snap:params.snap,this);this.scrollSpeed=setValue(parseDraggableFunctionParameter(params.scrollSpeed,this),1.5);this.scrollThreshold=setValue(parseDraggableFunctionParameter(params.scrollThreshold,this),20);this.dragSpeed=setValue(parseDraggableFunctionParameter(params.dragSpeed,this),1);this.minVelocity=setValue(parseDraggableFunctionParameter(params.minVelocity,this),0);this.maxVelocity=setValue(parseDraggableFunctionParameter(params.maxVelocity,this),50);this.velocityMultiplier=setValue(parseDraggableFunctionParameter(params.velocityMultiplier,this),1);this.cursor=parsedCursorStyles===false?false:cursorStyles;this.updateBoundingValues();const[bt,br,bb,bl]=this.containerBounds;this.setX(clamp(cx,bl,br),true);this.setY(clamp(cy,bt,bb),true)}update(){this.updateScrollCoords();if(this.canScroll){const[cpt,cpr,cpb,cpl]=this.containerPadding;const[sw,sh]=this.scrollView;const daw=this.dragArea[2];const dah=this.dragArea[3];const csx=this.scroll.x;const csy=this.scroll.y;const nsw=this.$container.scrollWidth;const nsh=this.$container.scrollHeight;const csw=this.useWin?clamp(nsw,this.window[0],nsw):nsw;const csh=this.useWin?clamp(nsh,this.window[1],nsh):nsh;const swd=sw-csw;const shd=sh-csh;if(this.dragged&&swd>0){this.coords[0]-=swd;this.scrollView[0]=csw}if(this.dragged&&shd>0){this.coords[1]-=shd;this.scrollView[1]=csh}const s=this.scrollSpeed*10;const threshold=this.scrollThreshold;const[x,y]=this.coords;const[st,sr,sb,sl]=this.scrollBounds;const t=round(clamp((y-st+cpt)/threshold,-1,0)*s,0);const r=round(clamp((x-sr-cpr)/threshold,0,1)*s,0);const b=round(clamp((y-sb-cpb)/threshold,0,1)*s,0);const l=round(clamp((x-sl+cpl)/threshold,-1,0)*s,0);if(t||b||l||r){const[nx,ny]=this.disabled;let scrollX=csx;let scrollY=csy;if(!nx){scrollX=round(clamp(csx+(l||r),0,sw-daw),0);this.coords[0]-=csx-scrollX}if(!ny){scrollY=round(clamp(csy+(t||b),0,sh-dah),0);this.coords[1]-=csy-scrollY}if(this.useWin){this.$scrollContainer.scrollBy(-(csx-scrollX),-(csy-scrollY))}else{this.$scrollContainer.scrollTo(scrollX,scrollY)}}}const[ct,cr,cb,cl]=this.containerBounds;const[px1,py1,px2,py2,px3,py3]=this.pointer;this.coords[0]+=(px1-px3)*this.dragSpeed;this.coords[1]+=(py1-py3)*this.dragSpeed;this.pointer[4]=px1;this.pointer[5]=py1;const[cx,cy]=this.coords;const[sx,sy]=this.snapped;const cf=(1-this.containerFriction)*this.dragSpeed;this.setX(cx>cr?cr+(cx-cr)*cf:cx<cl?cl+(cx-cl)*cf:cx,false);this.setY(cy>cb?cb+(cy-cb)*cf:cy<ct?ct+(cy-ct)*cf:cy,false);this.computeVelocity(px1-px3,py1-py3);this.angle=atan2(py1-py2,px1-px2);const[nsx,nsy]=this.snapped;if(nsx!==sx&&this.snapX||nsy!==sy&&this.snapY){this.onSnap(this)}}stop(){this.updateTicker.pause();this.overshootXTicker.pause();this.overshootYTicker.pause();for(let prop in this.animate.animations)this.animate.animations[prop].pause();remove(this,null,"x");remove(this,null,"y");remove(this,null,"progressX");remove(this,null,"progressY");remove(this.scroll);remove(this.overshootCoords);return this}scrollInView(duration,gap=0,ease=eases.inOutQuad){this.updateScrollCoords();const x=this.destX;const y=this.destY;const scroll=this.scroll;const scrollBounds=this.scrollBounds;const canScroll=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(scrollBounds,x,y)){const[st,sr,sb,sl]=scrollBounds;const t=round(clamp(y-st,-1e12,0),0);const r=round(clamp(x-sr,0,maxValue),0);const b=round(clamp(y-sb,0,maxValue),0);const l=round(clamp(x-sl,-1e12,0),0);new JSAnimation(scroll,{x:round(scroll.x+(l?l-gap:r?r+gap:0),0),y:round(scroll.y+(t?t-gap:b?b+gap:0),0),duration:isUnd(duration)?350*globals.timeScale:duration,ease:ease,onUpdate:()=>{this.canScroll=false;this.$scrollContainer.scrollTo(scroll.x,scroll.y)}}).init().then((()=>{this.canScroll=canScroll}))}return this}handleHover(){if(this.isFinePointer&&this.cursor&&!this.cursorStyles){this.cursorStyles=setTargetValues(this.$trigger,{cursor:this.cursor.onHover})}}animateInView(duration,gap=0,ease=eases.inOutQuad){this.stop();this.updateBoundingValues();const x=this.x;const y=this.y;const[cpt,cpr,cpb,cpl]=this.containerPadding;const bt=this.scroll.y-this.targetBounds[0]+cpt+gap;const br=this.scroll.x-this.targetBounds[1]-cpr-gap;const bb=this.scroll.y-this.targetBounds[2]-cpb-gap;const bl=this.scroll.x-this.targetBounds[3]+cpl+gap;const ob=this.isOutOfBounds([bt,br,bb,bl],x,y);if(ob){const[disabledX,disabledY]=this.disabled;const destX=clamp(snap(x,this.snapX),bl,br);const destY=clamp(snap(y,this.snapY),bt,bb);const dur=isUnd(duration)?350*globals.timeScale:duration;if(!disabledX&&(ob===1||ob===3))this.animate[this.xProp](destX,dur,ease);if(!disabledY&&(ob===2||ob===3))this.animate[this.yProp](destY,dur,ease)}return this}handleDown(e){const $eTarget=e.target;if(this.grabbed||$eTarget.type==="range")return;e.stopPropagation();this.grabbed=true;this.released=false;this.stop();this.updateBoundingValues();const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const[ct,cr,cb,cl]=this.containerBounds;const cf=(1-this.containerFriction)*this.dragSpeed;const cx=this.x;const cy=this.y;this.coords[0]=this.coords[2]=!cf?cx:cx>cr?cr+(cx-cr)/cf:cx<cl?cl+(cx-cl)/cf:cx;this.coords[1]=this.coords[3]=!cf?cy:cy>cb?cb+(cy-cb)/cf:cy<ct?ct+(cy-ct)/cf:cy;this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y;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;if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}const z=getTargetValue(this.$target,"zIndex",false);zIndex=(z>zIndex?z:zIndex)+1;this.targetStyles=setTargetValues(this.$target,{zIndex:zIndex});if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.isFinePointer&&this.cursor){this.bodyStyles=setTargetValues(doc.body,{cursor:this.cursor.onGrab})}this.scrollInView(100,0,eases.out(3));this.onGrab(this);doc.addEventListener("touchmove",this);doc.addEventListener("touchend",this);doc.addEventListener("touchcancel",this);doc.addEventListener("mousemove",this);doc.addEventListener("mouseup",this);doc.addEventListener("selectstart",this)}handleMove(e){if(!this.grabbed)return;const touches=e.changedTouches;const eventX=touches?touches[0].clientX:e.clientX;const eventY=touches?touches[0].clientY:e.clientY;const{x:x,y:y}=this.transforms.normalizePoint(eventX,eventY);const movedX=x-this.pointer[6];const movedY=y-this.pointer[7];let $parent=e.target;let isAtTop=false;let isAtBottom=false;let canTouchScroll=false;while(touches&&$parent&&$parent!==this.$trigger){const overflowY=getTargetValue($parent,"overflow-y");if(overflowY!=="hidden"&&overflowY!=="visible"){const{scrollTop:scrollTop,scrollHeight:scrollHeight,clientHeight:clientHeight}=$parent;if(scrollHeight>clientHeight){canTouchScroll=true;isAtTop=scrollTop<=3;isAtBottom=scrollTop>=scrollHeight-clientHeight-3;break}}$parent=$parent.parentNode}if(canTouchScroll&&(!isAtTop&&!isAtBottom||isAtTop&&movedY<0||isAtBottom&&movedY>0)){this.pointer[0]=x;this.pointer[1]=y;this.pointer[2]=x;this.pointer[3]=y;this.pointer[4]=x;this.pointer[5]=y;this.pointer[6]=x;this.pointer[7]=y}else{preventDefault(e);if(!this.triggerStyles)this.triggerStyles=setTargetValues(this.$trigger,{pointerEvents:"none"});this.$trigger.addEventListener("touchstart",preventDefault,{passive:false});this.$trigger.addEventListener("touchmove",preventDefault,{passive:false});this.$trigger.addEventListener("touchend",preventDefault);if(!this.disabled[0]&&abs(movedX)>3||!this.disabled[1]&&abs(movedY)>3){this.updateTicker.resume();this.pointer[2]=this.pointer[0];this.pointer[3]=this.pointer[1];this.pointer[0]=x;this.pointer[1]=y;this.dragged=true;this.released=false;this.onDrag(this)}}}handleUp(){if(!this.grabbed)return;this.updateTicker.pause();if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}const[disabledX,disabledY]=this.disabled;const[px1,py1,px2,py2,px3,py3]=this.pointer;const[ct,cr,cb,cl]=this.containerBounds;const[sx,sy]=this.snapped;const springX=this.releaseXSpring;const springY=this.releaseYSpring;const releaseEase=this.releaseEase;const hasReleaseSpring=this.hasReleaseSpring;const overshootCoords=this.overshootCoords;const cx=this.x;const cy=this.y;const pv=this.computeVelocity(px1-px3,py1-py3);const pa=this.angle=atan2(py1-py2,px1-px2);const ds=pv*150;const cf=(1-this.releaseContainerFriction)*this.dragSpeed;const nx=cx+cos(pa)*ds;const ny=cy+sin(pa)*ds;const bx=nx>cr?cr+(nx-cr)*cf:nx<cl?cl+(nx-cl)*cf:nx;const by=ny>cb?cb+(ny-cb)*cf:ny<ct?ct+(ny-ct)*cf:ny;const dx=this.destX=clamp(round(snap(bx,this.snapX),5),cl,cr);const dy=this.destY=clamp(round(snap(by,this.snapY),5),ct,cb);const ob=this.isOutOfBounds(this.containerBounds,nx,ny);let durationX=0;let durationY=0;let easeX=releaseEase;let easeY=releaseEase;let longestReleaseDuration=0;overshootCoords.x=cx;overshootCoords.y=cy;if(!disabledX){const directionX=dx===cr?cx>cr?-1:1:cx<cl?-1:1;const distanceX=round(cx-dx,0);springX.velocity=disabledY&&hasReleaseSpring?distanceX?ds*directionX/abs(distanceX):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springX;durationX=cx===dx?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeX=ease;if(durationX>longestReleaseDuration)longestReleaseDuration=durationX}if(!disabledY){const directionY=dy===cb?cy>cb?-1:1:cy<ct?-1:1;const distanceY=round(cy-dy,0);springY.velocity=disabledX&&hasReleaseSpring?distanceY?ds*directionY/abs(distanceY):0:pv;const{ease:ease,duration:duration,restDuration:restDuration}=springY;durationY=cy===dy?0:hasReleaseSpring?duration:duration-restDuration*globals.timeScale;if(hasReleaseSpring)easeY=ease;if(durationY>longestReleaseDuration)longestReleaseDuration=durationY}if(!hasReleaseSpring&&ob&&cf&&(durationX||durationY)){const composition=compositionTypes.blend;new JSAnimation(overshootCoords,{x:{to:bx,duration:durationX*.65},y:{to:by,duration:durationY*.65},ease:releaseEase,composition:composition}).init();new JSAnimation(overshootCoords,{x:{to:dx,duration:durationX},y:{to:dy,duration:durationY},ease:releaseEase,composition:composition}).init();this.overshootXTicker.stretch(durationX).restart();this.overshootYTicker.stretch(durationY).restart()}else{if(!disabledX)this.animate[this.xProp](dx,durationX,easeX);if(!disabledY)this.animate[this.yProp](dy,durationY,easeY)}this.scrollInView(longestReleaseDuration,this.scrollThreshold,releaseEase);let hasSnapped=false;if(dx!==sx){this.snapped[0]=dx;if(this.snapX)hasSnapped=true}if(dy!==sy&&this.snapY){this.snapped[1]=dy;if(this.snapY)hasSnapped=true}if(hasSnapped)this.onSnap(this);this.grabbed=false;this.dragged=false;this.updated=true;this.released=true;this.onRelease(this);this.$trigger.removeEventListener("touchstart",preventDefault);this.$trigger.removeEventListener("touchmove",preventDefault);this.$trigger.removeEventListener("touchend",preventDefault);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this)}reset(){this.stop();this.resizeTicker.pause();this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.setX(0,true);this.setY(0,true);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;return this}enable(){if(!this.enabled){this.enabled=true;this.$target.classList.remove("is-disabled");this.touchActionStyles=setTargetValues(this.$trigger,{touchAction:this.disabled[0]?"pan-x":this.disabled[1]?"pan-y":"none"});this.$trigger.addEventListener("touchstart",this,{passive:true});this.$trigger.addEventListener("mousedown",this,{passive:true});this.$trigger.addEventListener("mouseenter",this)}return this}disable(){this.enabled=false;this.grabbed=false;this.dragged=false;this.updated=false;this.released=false;this.canScroll=false;this.touchActionStyles.revert();if(this.cursorStyles){this.cursorStyles.revert();this.cursorStyles=null}if(this.triggerStyles){this.triggerStyles.revert();this.triggerStyles=null}if(this.bodyStyles){this.bodyStyles.revert();this.bodyStyles=null}if(this.targetStyles){this.targetStyles.revert();this.targetStyles=null}this.stop();this.$target.classList.add("is-disabled");this.$trigger.removeEventListener("touchstart",this);this.$trigger.removeEventListener("mousedown",this);this.$trigger.removeEventListener("mouseenter",this);doc.removeEventListener("touchmove",this);doc.removeEventListener("touchend",this);doc.removeEventListener("touchcancel",this);doc.removeEventListener("mousemove",this);doc.removeEventListener("mouseup",this);doc.removeEventListener("selectstart",this);return this}revert(){this.reset();this.disable();this.$target.classList.remove("is-disabled");this.updateTicker.revert();this.overshootXTicker.revert();this.overshootYTicker.revert();this.resizeTicker.revert();this.animate.revert();return this}handleEvent(e){switch(e.type){case"mousedown":this.handleDown(e);break;case"touchstart":this.handleDown(e);break;case"mousemove":this.handleMove(e);break;case"touchmove":this.handleMove(e);break;case"mouseup":this.handleUp();break;case"touchend":this.handleUp();break;case"touchcancel":this.handleUp();break;case"mouseenter":this.handleHover();break;case"selectstart":preventDefault(e);break}}}const createDraggable=(target,parameters)=>new Draggable(target,parameters);class Scope{constructor(parameters={}){if(scope.current)scope.current.register(this);const rootParam=parameters.root;let root=doc;if(rootParam){root=rootParam.current||rootParam.nativeElement||parseTargets(rootParam)[0]||doc}const scopeDefaults=parameters.defaults;const globalDefault=globals.defaults;const mediaQueries=parameters.mediaQueries;this.defaults=scopeDefaults?mergeObjects(scopeDefaults,globalDefault):globalDefault;this.root=root;this.constructors=[];this.revertConstructors=[];this.revertibles=[];this.constructorsOnce=[];this.revertConstructorsOnce=[];this.revertiblesOnce=[];this.once=false;this.onceIndex=0;this.methods={};this.matches={};this.mediaQueryLists={};this.data={};if(mediaQueries){for(let mq in mediaQueries){const _mq=win.matchMedia(mediaQueries[mq]);this.mediaQueryLists[mq]=_mq;_mq.addEventListener("change",this)}}}register(revertible){const store=this.once?this.revertiblesOnce:this.revertibles;store.push(revertible)}execute(cb){let activeScope=scope.current;let activeRoot=scope.root;let activeDefaults=globals.defaults;scope.current=this;scope.root=this.root;globals.defaults=this.defaults;const mqs=this.mediaQueryLists;for(let mq in mqs)this.matches[mq]=mqs[mq].matches;const returned=cb(this);scope.current=activeScope;scope.root=activeRoot;globals.defaults=activeDefaults;return returned}refresh(){this.onceIndex=0;this.execute((()=>{let i=this.revertibles.length;let y=this.revertConstructors.length;while(i--)this.revertibles[i].revert();while(y--)this.revertConstructors[y](this);this.revertibles.length=0;this.revertConstructors.length=0;this.constructors.forEach((constructor=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructors.push(revertConstructor)}}))}));return this}add(a1,a2){this.once=false;if(isFnc(a1)){const constructor=a1;this.constructors.push(constructor);this.execute((()=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructors.push(revertConstructor)}}))}else{this.methods[a1]=(...args)=>this.execute((()=>a2(...args)))}return this}addOnce(scopeConstructorCallback){this.once=true;if(isFnc(scopeConstructorCallback)){const currentIndex=this.onceIndex++;const tracked=this.constructorsOnce[currentIndex];if(tracked)return this;const constructor=scopeConstructorCallback;this.constructorsOnce[currentIndex]=constructor;this.execute((()=>{const revertConstructor=constructor(this);if(isFnc(revertConstructor)){this.revertConstructorsOnce.push(revertConstructor)}}))}return this}keepTime(cb){this.once=true;const currentIndex=this.onceIndex++;const tracked=this.constructorsOnce[currentIndex];if(isFnc(tracked))return tracked(this);const constructor=createRefreshable(cb);this.constructorsOnce[currentIndex]=constructor;let trackedTickable;this.execute((()=>{trackedTickable=constructor(this)}));return trackedTickable}handleEvent(e){switch(e.type){case"change":this.refresh();break}}revert(){const revertibles=this.revertibles;const revertConstructors=this.revertConstructors;const revertiblesOnce=this.revertiblesOnce;const revertConstructorsOnce=this.revertConstructorsOnce;const mqs=this.mediaQueryLists;let i=revertibles.length;let j=revertConstructors.length;let k=revertiblesOnce.length;let l=revertConstructorsOnce.length;while(i--)revertibles[i].revert();while(j--)revertConstructors[j](this);while(k--)revertiblesOnce[k].revert();while(l--)revertConstructorsOnce[l](this);for(let mq in mqs)mqs[mq].removeEventListener("change",this);revertibles.length=0;revertConstructors.length=0;this.constructors.length=0;revertiblesOnce.length=0;revertConstructorsOnce.length=0;this.constructorsOnce.length=0;this.onceIndex=0;this.matches={};this.methods={};this.mediaQueryLists={};this.data={}}}const createScope=params=>new Scope(params);const getMaxViewHeight=()=>{const $el=document.createElement("div");doc.body.appendChild($el);$el.style.height="100lvh";const height=$el.offsetHeight;doc.body.removeChild($el);return height};const parseScrollObserverFunctionParameter=(value,scroller)=>value&&isFnc(value)?value(scroller):value;const scrollContainers=new Map;class ScrollContainer{constructor($el){this.element=$el;this.useWin=this.element===doc.body;this.winWidth=0;this.winHeight=0;this.width=0;this.height=0;this.left=0;this.top=0;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=false;this.backwardY=false;this.scrollTicker=new Timer({autoplay:false,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const backwards=this.backwardX||this.backwardY;forEachChildren(this,(child=>child.handleScroll()),backwards)},onComplete:()=>this.dataTimer.pause()}).init();this.dataTimer=new Timer({autoplay:false,frameRate:30,onUpdate:self=>{const dt=self.deltaTime;const px=this.prevScrollX;const py=this.prevScrollY;const nx=this.scrollX;const ny=this.scrollY;const dx=px-nx;const dy=py-ny;this.prevScrollX=nx;this.prevScrollY=ny;if(dx)this.backwardX=px>nx;if(dy)this.backwardY=py>ny;this.velocity=round(dt>0?Math.sqrt(dx*dx+dy*dy)/dt:0,5)}}).init();this.resizeTicker=new Timer({autoplay:false,duration:250*globals.timeScale,onComplete:()=>{this.updateWindowBounds();this.refreshScrollObservers();this.handleScroll()}}).init();this.wakeTicker=new Timer({autoplay:false,duration:500*globals.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?win:this.element).addEventListener("scroll",this,false)}updateScrollCoords(){const useWin=this.useWin;const $el=this.element;this.scrollX=round(useWin?win.scrollX:$el.scrollLeft,0);this.scrollY=round(useWin?win.scrollY:$el.scrollTop,0)}updateWindowBounds(){this.winWidth=win.innerWidth;this.winHeight=getMaxViewHeight()}updateBounds(){const style=getComputedStyle(this.element);const $el=this.element;this.scrollWidth=$el.scrollWidth+parseFloat(style.marginLeft)+parseFloat(style.marginRight);this.scrollHeight=$el.scrollHeight+parseFloat(style.marginTop)+parseFloat(style.marginBottom);this.updateWindowBounds();let width,height;if(this.useWin){width=this.winWidth;height=this.winHeight}else{const elRect=$el.getBoundingClientRect();width=elRect.width;height=elRect.height;this.top=elRect.top;this.left=elRect.left}this.width=width;this.height=height}refreshScrollObservers(){forEachChildren(this,(child=>{if(child._debug){child.removeDebug()}}));this.updateBounds();forEachChildren(this,(child=>{child.refresh();if(child._debug){child.debug()}}))}refresh(){this.updateWindowBounds();this.updateBounds();this.refreshScrollObservers();this.handleScroll()}handleScroll(){this.updateScrollCoords();this.wakeTicker.restart()}handleEvent(e){switch(e.type){case"scroll":this.handleScroll();break}}revert(){this.scrollTicker.cancel();this.dataTimer.cancel();this.resizeTicker.cancel();this.wakeTicker.cancel();this.resizeObserver.unobserve(this.element);(this.useWin?win:this.element).removeEventListener("scroll",this);scrollContainers.delete(this.element)}}const registerAndGetScrollContainer=target=>{const $el=target?parseTargets(target)[0]||doc.body:doc.body;let scrollContainer=scrollContainers.get($el);if(!scrollContainer){scrollContainer=new ScrollContainer($el);scrollContainers.set($el,scrollContainer)}return scrollContainer};const convertValueToPx=($el,v,size,under,over)=>{const clampMin=v==="min";const clampMax=v==="max";const value=v==="top"||v==="left"||v==="start"||clampMin?0:v==="bottom"||v==="right"||v==="end"||clampMax?"100%":v==="center"?"50%":v;const{n:n,u:u}=decomposeRawValue(value,decomposedOriginalValue);let px=n;if(u==="%"){px=n/100*size}else if(u){px=convertValueUnit($el,decomposedOriginalValue,"px",true).n}if(clampMax&&under<0)px+=under;if(clampMin&&over>0)px+=over;return px};const parseBoundValue=($el,v,size,under,over)=>{let value;if(isStr(v)){const matchedOperator=relativeValuesExecRgx.exec(v);if(matchedOperator){const splitter=matchedOperator[0];const operator=splitter[0];const splitted=v.split(splitter);const clampMin=splitted[0]==="min";const clampMax=splitted[0]==="max";const valueAPx=convertValueToPx($el,splitted[0],size,under,over);const valueBPx=convertValueToPx($el,splitted[1],size,under,over);if(clampMin){const min=getRelativeValue(convertValueToPx($el,"min",size),valueBPx,operator);value=min<valueAPx?valueAPx:min}else if(clampMax){const max=getRelativeValue(convertValueToPx($el,"max",size),valueBPx,operator);value=max>valueAPx?valueAPx:max}else{value=getRelativeValue(valueAPx,valueBPx,operator)}}else{value=convertValueToPx($el,v,size,under,over)}}else{value=v}return round(value,0)};const getAnimationDomTarget=linked=>{let $linkedTarget;const linkedTargets=linked.targets;for(let i=0,l=linkedTargets.length;i<l;i++){const target=linkedTargets[i];if(target[isDomSymbol]){$linkedTarget=target;break}}return $linkedTarget};let scrollerIndex=0;const debugColors$1=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class ScrollObserver{constructor(parameters={}){if(scope.current)scope.current.register(this);const syncMode=setValue(parameters.sync,"play pause");const ease=syncMode?parseEasings(syncMode):null;const isLinear=syncMode&&(syncMode==="linear"||syncMode===none);const isEase=syncMode&&!(ease===none&&!isLinear);const isSmooth=syncMode&&(isNum(syncMode)||syncMode===true||isLinear);const isMethods=syncMode&&(isStr(syncMode)&&!isEase&&!isSmooth);const syncMethods=isMethods?syncMode.split(" ").map((m=>()=>{const linked=this.linked;return linked&&linked[m]?linked[m]():null})):null;const biDirSync=isMethods&&syncMethods.length>2;this.index=scrollerIndex++;this.id=!isUnd(parameters.id)?parameters.id:this.index;this.container=registerAndGetScrollContainer(parameters.container);this.target=null;this.linked=null;this.repeat=null;this.horizontal=null;this.enter=null;this.leave=null;this.sync=isEase||isSmooth||!!syncMethods;this.syncEase=isEase?ease:null;this.syncSmooth=isSmooth?syncMode===true||isLinear?1:syncMode:null;this.onSyncEnter=syncMethods&&!biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeave=syncMethods&&!biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterForward=syncMethods&&biDirSync&&syncMethods[0]?syncMethods[0]:noop;this.onSyncLeaveForward=syncMethods&&biDirSync&&syncMethods[1]?syncMethods[1]:noop;this.onSyncEnterBackward=syncMethods&&biDirSync&&syncMethods[2]?syncMethods[2]:noop;this.onSyncLeaveBackward=syncMethods&&biDirSync&&syncMethods[3]?syncMethods[3]:noop;this.onEnter=parameters.onEnter||noop;this.onLeave=parameters.onLeave||noop;this.onEnterForward=parameters.onEnterForward||noop;this.onLeaveForward=parameters.onLeaveForward||noop;this.onEnterBackward=parameters.onEnterBackward||noop;this.onLeaveBackward=parameters.onLeaveBackward||noop;this.onUpdate=parameters.onUpdate||noop;this.onSyncComplete=parameters.onSyncComplete||noop;this.reverted=false;this.completed=false;this.began=false;this.isInView=false;this.forceEnter=false;this.hasEntered=false;this.offsets=[];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=parameters;this._debug=setValue(parameters.debug,false);this._next=null;this._prev=null;addChild(this.container,this);sync((()=>{if(this.reverted)return;if(!this.target){const target=parseTargets(parameters.target)[0];this.target=target||doc.body;this.refresh()}if(this._debug)this.debug()}))}link(linked){if(linked){linked.pause();this.linked=linked;if(!this._params.target){let $linkedTarget;if(!isUnd(linked.targets)){$linkedTarget=getAnimationDomTarget(linked)}else{forEachChildren(linked,(child=>{if(child.targets&&!$linkedTarget){$linkedTarget=getAnimationDomTarget(child)}}))}this.target=$linkedTarget||doc.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 p=(this.scroll-this.offsetStart)/this.distance;return p===Infinity||isNaN(p)?0:round(clamp(p,0,1),6)}refresh(){this.reverted=false;const params=this._params;this.repeat=setValue(parseScrollObserverFunctionParameter(params.repeat,this),true);this.horizontal=setValue(parseScrollObserverFunctionParameter(params.axis,this),"y")==="x";this.enter=setValue(parseScrollObserverFunctionParameter(params.enter,this),"end start");this.leave=setValue(parseScrollObserverFunctionParameter(params.leave,this),"start end");this.updateBounds();this.handleScroll();return this}removeDebug(){if(this.$debug){this.$debug.parentNode.removeChild(this.$debug);this.$debug=null}if(this.debugStyles){this.debugStyles.revert();this.$debug=null}return this}debug(){this.removeDebug();const container=this.container;const isHori=this.horizontal;const $existingDebug=container.element.querySelector(":scope > .animejs-onscroll-debug");const $debug=doc.createElement("div");const $thresholds=doc.createElement("div");const $triggers=doc.createElement("div");const color=debugColors$1[this.index%debugColors$1.length];const useWin=container.useWin;const containerWidth=useWin?container.winWidth:container.width;const containerHeight=useWin?container.winHeight:container.height;const scrollWidth=container.scrollWidth;const scrollHeight=container.scrollHeight;const size=this.container.width>360?320:260;const offLeft=isHori?0:10;const offTop=isHori?10:0;const half=isHori?24:size/2;const labelHeight=isHori?half:15;const labelWidth=isHori?60:half;const labelSize=isHori?labelWidth:labelHeight;const repeat=isHori?"repeat-x":"repeat-y";const gradientOffset=v=>isHori?"0px "+v+"px":v+"px"+" 2px";const lineCSS=c=>`linear-gradient(${isHori?90:0}deg, ${c} 2px, transparent 1px)`;const baseCSS=(p,l,t,w,h)=>`position:${p};left:${l}px;top:${t}px;width:${w}px;height:${h}px;`;$debug.style.cssText=`${baseCSS("absolute",offLeft,offTop,isHori?scrollWidth:size,isHori?size:scrollHeight)}\n pointer-events: none;\n z-index: ${this.container.zIndex++};\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n filter: drop-shadow(0px 1px 0px rgba(0,0,0,.75));\n `;$thresholds.style.cssText=`${baseCSS("sticky",0,0,isHori?containerWidth:half,isHori?half:containerHeight)}`;if(!$existingDebug){$thresholds.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(half-10)} / ${isHori?"100px 100px":"100px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(half-10)} / ${isHori?"10px 10px":"10px 10px"} ${repeat};\n `}$triggers.style.cssText=`${baseCSS("relative",0,0,isHori?scrollWidth:half,isHori?half:scrollHeight)}`;if(!$existingDebug){$triggers.style.cssText+=`background:\n ${lineCSS("#FFFF")}${gradientOffset(0)} / ${isHori?"100px 10px":"10px 100px"} ${repeat},\n ${lineCSS("#FFF8")}${gradientOffset(0)} / ${isHori?"10px 0px":"0px 10px"} ${repeat};\n `}const labels=[" enter: "," leave: "];this.coords.forEach(((v,i)=>{const isView=i>1;const value=(isView?0:this.offset)+v;const isTail=i%2;const isFirst=value<labelSize;const isOver=value>(isView?isHori?containerWidth:containerHeight:isHori?scrollWidth:scrollHeight)-labelSize;const isFlip=(isView?isTail&&!isFirst:!isTail&&!isFirst)||isOver;const $label=doc.createElement("div");const $text=doc.createElement("div");const dirProp=isHori?isFlip?"right":"left":isFlip?"bottom":"top";const flipOffset=isFlip?(isHori?labelWidth:labelHeight)+(!isView?isHori?-1:-2:isHori?-1:isOver?0:-2):!isView?isHori?1:0:isHori?1:0;$text.innerHTML=`${this.id}${labels[isTail]}${this.thresholds[i]}`;$label.style.cssText=`${baseCSS("absolute",0,0,labelWidth,labelHeight)}\n display: flex;\n flex-direction: ${isHori?"column":"row"};\n justify-content: flex-${isView?"start":"end"};\n align-items: flex-${isFlip?"end":"start"};\n border-${dirProp}: 2px ${isTail?"solid":"solid"} ${color};\n `;$text.style.cssText=`\n overflow: hidden;\n max-width: ${size/2-10}px;\n height: ${labelHeight};\n margin-${isHori?isFlip?"right":"left":isFlip?"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: ${isHori&&isFlip||!isHori&&!isView?"right":"left"};\n white-space: pre;\n text-overflow: ellipsis;\n color: ${isTail?color:"rgba(0,0,0,.75)"};\n background-color: ${isTail?"rgba(0,0,0,.65)":color};\n border: 2px solid ${isTail?color:"transparent"};\n border-${isHori?isFlip?"top-left":"top-right":isFlip?"top-left":"bottom-left"}-radius: 5px;\n border-${isHori?isFlip?"bottom-left":"bottom-right":isFlip?"top-right":"bottom-right"}-radius: 5px;\n `;$label.appendChild($text);let position=value-flipOffset+(isHori?1:0);$label.style[isHori?"left":"top"]=`${position}px`;(isView?$thresholds:$triggers).appendChild($label)}));$debug.appendChild($thresholds);$debug.appendChild($triggers);container.element.appendChild($debug);if(!$existingDebug)$debug.classList.add("animejs-onscroll-debug");this.$debug=$debug;const containerPosition=getTargetValue(container.element,"position");if(containerPosition==="static"){this.debugStyles=setTargetValues(container.element,{position:"relative "})}}updateBounds(){if(this._debug){this.removeDebug()}let stickys;const $target=this.target;const container=this.container;const isHori=this.horizontal;const linked=this.linked;let linkedTime;let $el=$target;let offsetX=0;let offsetY=0;let $offsetParent=$el;if(linked){linkedTime=linked.currentTime;linked.seek(0,true)}const isContainerStatic=getTargetValue(container.element,"position")==="static"?setTargetValues(container.element,{position:"relative "}):false;while($el&&$el!==container.element&&$el!==doc.body){const isSticky=getTargetValue($el,"position")==="sticky"?setTargetValues($el,{position:"static"}):false;if($el===$offsetParent){offsetX+=$el.offsetLeft||0;offsetY+=$el.offsetTop||0;$offsetParent=$el.offsetParent}$el=$el.parentElement;if(isSticky){if(!stickys)stickys=[];stickys.push(isSticky)}}if(isContainerStatic)isContainerStatic.revert();const offset=isHori?offsetX:offsetY;const targetSize=isHori?$target.offsetWidth:$target.offsetHeight;const containerSize=isHori?container.width:container.height;const scrollSize=isHori?container.scrollWidth:container.scrollHeight;const maxScroll=scrollSize-containerSize;const enter=this.enter;const leave=this.leave;let enterTarget="start";let leaveTarget="end";let enterContainer="end";let leaveContainer="start";if(isStr(enter)){const splitted=enter.split(" ");enterContainer=splitted[0];enterTarget=splitted.length>1?splitted[1]:enterTarget}else if(isObj(enter)){const e=enter;if(!isUnd(e.container))enterContainer=e.container;if(!isUnd(e.target))enterTarget=e.target}else if(isNum(enter)){enterContainer=enter}if(isStr(leave)){const splitted=leave.split(" ");leaveContainer=splitted[0];leaveTarget=splitted.length>1?splitted[1]:leaveTarget}else if(isObj(leave)){const t=leave;if(!isUnd(t.container))leaveContainer=t.container;if(!isUnd(t.target))leaveTarget=t.target}else if(isNum(leave)){leaveContainer=leave}const parsedEnterTarget=parseBoundValue($target,enterTarget,targetSize);const parsedLeaveTarget=parseBoundValue($target,leaveTarget,targetSize);const under=parsedEnterTarget+offset-containerSize;const over=parsedLeaveTarget+offset-maxScroll;const parsedEnterContainer=parseBoundValue($target,enterContainer,containerSize,under,over);const parsedLeaveContainer=parseBoundValue($target,leaveContainer,containerSize,under,over);const offsetStart=parsedEnterTarget+offset-parsedEnterContainer;const offsetEnd=parsedLeaveTarget+offset-parsedLeaveContainer;const scrollDelta=offsetEnd-offsetStart;this.offsets[0]=offsetX;this.offsets[1]=offsetY;this.offset=offset;this.offsetStart=offsetStart;this.offsetEnd=offsetEnd;this.distance=scrollDelta<=0?0:scrollDelta;this.thresholds=[enterTarget,leaveTarget,enterContainer,leaveContainer];this.coords=[parsedEnterTarget,parsedLeaveTarget,parsedEnterContainer,parsedLeaveContainer];if(stickys){stickys.forEach((sticky=>sticky.revert()))}if(linked){linked.seek(linkedTime,true)}if(this._debug){this.debug()}}handleScroll(){const linked=this.linked;const sync=this.sync;const syncEase=this.syncEase;const syncSmooth=this.syncSmooth;const shouldSeek=linked&&(syncEase||syncSmooth);const isHori=this.horizontal;const container=this.container;const scroll=this.scroll;const isBefore=scroll<=this.offsetStart;const isAfter=scroll>=this.offsetEnd;const isInView=!isBefore&&!isAfter;const isOnTheEdge=scroll===this.offsetStart||scroll===this.offsetEnd;const forceEnter=!this.hasEntered&&isOnTheEdge;const $debug=this._debug&&this.$debug;let hasUpdated=false;let syncCompleted=false;let p=this.progress;if(isBefore&&this.began){this.began=false}if(p>0&&!this.began){this.began=true}if(shouldSeek){const lp=linked.progress;if(syncSmooth&&isNum(syncSmooth)){if(syncSmooth<1){const step=1e-4;const snap=lp<p&&p===1?step:lp>p&&!p?-1e-4:0;p=round(lerp(lp,p,interpolate(.01,.2,syncSmooth),false)+snap,6)}}else if(syncEase){p=syncEase(p)}hasUpdated=p!==this.prevProgress;syncCompleted=lp===1;if(hasUpdated&&!syncCompleted&&(syncSmooth&&lp)){container.wakeTicker.restart()}}if($debug){const sticky=isHori?container.scrollY:container.scrollX;$debug.style[isHori?"top":"left"]=sticky+10+"px"}if(isInView&&!this.isInView||forceEnter&&!this.forceEnter&&!this.hasEntered){if(isInView)this.isInView=true;if(!this.forceEnter||!this.hasEntered){if($debug&&isInView)$debug.style.zIndex=`${this.container.zIndex++}`;this.onSyncEnter(this);this.onEnter(this);if(this.backward){this.onSyncEnterBackward(this);this.onEnterBackward(this)}else{this.onSyncEnterForward(this);this.onEnterForward(this)}this.hasEntered=true;if(forceEnter)this.forceEnter=true}else if(isInView){this.forceEnter=false}}if(isInView||!isInView&&this.isInView){hasUpdated=true}if(hasUpdated){if(shouldSeek)linked.seek(linked.duration*p);this.onUpdate(this)}if(!isInView&&this.isInView){this.isInView=false;this.onSyncLeave(this);this.onLeave(this);if(this.backward){this.onSyncLeaveBackward(this);this.onLeaveBackward(this)}else{this.onSyncLeaveForward(this);this.onLeaveForward(this)}if(sync&&!syncSmooth){syncCompleted=true}}if(p>=1&&this.began&&!this.completed&&(sync&&syncCompleted||!sync)){if(sync){this.onSyncComplete(this)}this.completed=true;if(!this.repeat&&!linked||!this.repeat&&linked&&linked.completed){this.revert()}}if(p<1&&this.completed){this.completed=false}this.prevProgress=p}revert(){if(this.reverted)return;const container=this.container;removeChild(container,this);if(!container._head){container.revert()}if(this._debug){this.removeDebug()}this.reverted=true;return this}}const onScroll=(parameters={})=>new ScrollObserver(parameters);const segmenter=!isUnd(Intl)&&Intl.Segmenter;const valueRgx=/\{value\}/g;const indexRgx=/\{i\}/g;const whiteSpaceGroupRgx=/(\s+)/;const whiteSpaceRgx=/^\s+$/;const lineType="line";const wordType="word";const charType="char";const dataLine=`data-line`;let wordSegmenter=null;let graphemeSegmenter=null;let $splitTemplate=null;const isSegmentWordLike=seg=>seg.isWordLike||seg.segment===" "||isNum(+seg.segment);const setAriaHidden=$el=>$el.setAttribute("aria-hidden","true");const getAllTopLevelElements=($el,type)=>[...$el.querySelectorAll(`[data-${type}]:not([data-${type}] [data-${type}])`)];const debugColors={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"};const filterEmptyElements=$el=>{if(!$el.childElementCount&&!$el.textContent.trim()){const $parent=$el.parentElement;$el.remove();if($parent)filterEmptyElements($parent)}};const filterLineElements=($el,lineIndex,bin)=>{const dataLineAttr=$el.getAttribute(dataLine);if(dataLineAttr!==null&&+dataLineAttr!==lineIndex||$el.tagName==="BR")bin.add($el);let i=$el.childElementCount;while(i--)filterLineElements($el.children[i],lineIndex,bin);return bin};const generateTemplate=(type,params={})=>{let template=``;const classString=isStr(params.class)?` class="${params.class}"`:"";const cloneType=setValue(params.clone,false);const wrapType=setValue(params.wrap,false);const overflow=wrapType?wrapType===true?"clip":wrapType:cloneType?"clip":false;if(wrapType)template+=`<span${overflow?` style="overflow:${overflow};"`:""}>`;template+=`<span${classString}${cloneType?` style="position:relative;"`:""} data-${type}="{i}">`;if(cloneType){const left=cloneType==="left"?"-100%":cloneType==="right"?"100%":"0";const top=cloneType==="top"?"-100%":cloneType==="bottom"?"100%":"0";template+=`<span>{value}</span>`;template+=`<span inert style="position:absolute;top:${top};left:${left};white-space:nowrap;">{value}</span>`}else{template+=`{value}`}template+=`</span>`;if(wrapType)template+=`</span>`;return template};const processHTMLTemplate=(htmlTemplate,store,node,$parentFragment,type,debug,lineIndex,wordIndex,charIndex)=>{const isLine=type===lineType;const isChar=type===charType;const className=`_${type}_`;const template=isFnc(htmlTemplate)?htmlTemplate(node):htmlTemplate;const displayStyle=isLine?"block":"inline-block";$splitTemplate.innerHTML=template.replace(valueRgx,`<i class="${className}"></i>`).replace(indexRgx,`${isChar?charIndex:isLine?lineIndex:wordIndex}`);const $content=$splitTemplate.content;const $highestParent=$content.firstElementChild;const $split=$content.querySelector(`[data-${type}]`)||$highestParent;const $replacables=$content.querySelectorAll(`i.${className}`);const replacablesLength=$replacables.length;if(replacablesLength){$highestParent.style.display=displayStyle;$split.style.display=displayStyle;$split.setAttribute(dataLine,`${lineIndex}`);if(!isLine){$split.setAttribute("data-word",`${wordIndex}`);if(isChar)$split.setAttribute("data-char",`${charIndex}`)}let i=replacablesLength;while(i--){const $replace=$replacables[i];const $closestParent=$replace.parentElement;$closestParent.style.display=displayStyle;if(isLine){$closestParent.innerHTML=node.innerHTML}else{$closestParent.replaceChild(node.cloneNode(true),$replace)}}store.push($split);$parentFragment.appendChild($content)}else{console.warn(`The expression "{value}" is missing from the provided template.`)}if(debug)$highestParent.style.outline=`1px dotted ${debugColors[type]}`;return $highestParent};class TextSplitter{constructor(target,parameters={}){if(!wordSegmenter)wordSegmenter=segmenter?new segmenter([],{granularity:wordType}):{segment:text=>{const segments=[];const words=text.split(whiteSpaceGroupRgx);for(let i=0,l=words.length;i<l;i++){const segment=words[i];segments.push({segment:segment,isWordLike:!whiteSpaceRgx.test(segment)})}return segments}};if(!graphemeSegmenter)graphemeSegmenter=segmenter?new segmenter([],{granularity:"grapheme"}):{segment:text=>[...text].map((char=>({segment:char})))};if(!$splitTemplate&&isBrowser)$splitTemplate=doc.createElement("template");if(scope.current)scope.current.register(this);const{words:words,chars:chars,lines:lines,accessible:accessible,includeSpaces:includeSpaces,debug:debug}=parameters;const $target=(target=isArr(target)?target[0]:target)&&target.nodeType?target:(getNodeList(target)||[])[0];const lineParams=lines===true?{}:lines;const wordParams=words===true||isUnd(words)?{}:words;const charParams=chars===true?{}:chars;this.debug=setValue(debug,false);this.includeSpaces=setValue(includeSpaces,false);this.accessible=setValue(accessible,true);this.linesOnly=lineParams&&(!wordParams&&!charParams);this.lineTemplate=isObj(lineParams)?generateTemplate(lineType,lineParams):lineParams;this.wordTemplate=isObj(wordParams)||this.linesOnly?generateTemplate(wordType,wordParams):wordParams;this.charTemplate=isObj(charParams)?generateTemplate(charType,charParams):charParams;this.$target=$target;this.html=$target&&$target.innerHTML;this.lines=[];this.words=[];this.chars=[];this.effects=[];this.effectsCleanups=[];this.cache=null;this.ready=false;this.width=0;this.resizeTimeout=null;const handleSplit=()=>this.html&&(lineParams||wordParams||charParams)&&this.split();this.resizeObserver=new ResizeObserver((()=>{clearTimeout(this.resizeTimeout);this.resizeTimeout=setTimeout((()=>{const currentWidth=$target.offsetWidth;if(currentWidth===this.width)return;this.width=currentWidth;handleSplit()}),150)}));if(this.lineTemplate&&!this.ready){doc.fonts.ready.then(handleSplit)}else{handleSplit()}$target?this.resizeObserver.observe($target):console.warn("No Text Splitter target found.")}addEffect(effect){if(!isFnc(effect))return console.warn("Effect must return a function.");const refreshableEffect=createRefreshable(effect);this.effects.push(refreshableEffect);if(this.ready)this.effectsCleanups[this.effects.length-1]=refreshableEffect(this);return this}revert(){clearTimeout(this.resizeTimeout);this.lines.length=this.words.length=this.chars.length=0;this.resizeObserver.disconnect();this.effectsCleanups.forEach((cleanup=>isFnc(cleanup)?cleanup(this):cleanup.revert&&cleanup.revert()));this.$target.innerHTML=this.html;return this}splitNode(node){const wordTemplate=this.wordTemplate;const charTemplate=this.charTemplate;const includeSpaces=this.includeSpaces;const debug=this.debug;const nodeType=node.nodeType;if(nodeType===3){const nodeText=node.nodeValue;if(nodeText.trim()){const tempWords=[];const words=this.words;const chars=this.chars;const wordSegments=wordSegmenter.segment(nodeText);const $wordsFragment=doc.createDocumentFragment();let prevSeg=null;for(const wordSegment of wordSegments){const segment=wordSegment.segment;const isWordLike=isSegmentWordLike(wordSegment);if(!prevSeg||isWordLike&&(prevSeg&&isSegmentWordLike(prevSeg))){tempWords.push(segment)}else{const lastWordIndex=tempWords.length-1;const lastWord=tempWords[lastWordIndex];if(!lastWord.includes(" ")&&!segment.includes(" ")){tempWords[lastWordIndex]+=segment}else{tempWords.push(segment)}}prevSeg=wordSegment}for(let i=0,l=tempWords.length;i<l;i++){const word=tempWords[i];if(!word.trim()){if(i&&includeSpaces)continue;$wordsFragment.appendChild(doc.createTextNode(word))}else{const nextWord=tempWords[i+1];const hasWordFollowingSpace=includeSpaces&&nextWord&&!nextWord.trim();const wordToProcess=word;const charSegments=charTemplate?graphemeSegmenter.segment(wordToProcess):null;const $charsFragment=charTemplate?doc.createDocumentFragment():doc.createTextNode(hasWordFollowingSpace?word+" ":word);if(charTemplate){const charSegmentsArray=[...charSegments];for(let j=0,jl=charSegmentsArray.length;j<jl;j++){const charSegment=charSegmentsArray[j];const isLastChar=j===jl-1;const charText=isLastChar&&hasWordFollowingSpace?charSegment.segment+" ":charSegment.segment;const $charNode=doc.createTextNode(charText);processHTMLTemplate(charTemplate,chars,$charNode,$charsFragment,charType,debug,-1,words.length,chars.length)}}if(wordTemplate){processHTMLTemplate(wordTemplate,words,$charsFragment,$wordsFragment,wordType,debug,-1,words.length,chars.length)}else if(charTemplate){$wordsFragment.appendChild($charsFragment)}else{$wordsFragment.appendChild(doc.createTextNode(word))}if(hasWordFollowingSpace)i++}}node.parentNode.replaceChild($wordsFragment,node)}}else if(nodeType===1){const childNodes=[...node.childNodes];for(let i=0,l=childNodes.length;i<l;i++)this.splitNode(childNodes[i])}}split(clearCache=false){const $el=this.$target;const isCached=!!this.cache&&!clearCache;const lineTemplate=this.lineTemplate;const wordTemplate=this.wordTemplate;const charTemplate=this.charTemplate;const fontsReady=doc.fonts.status!=="loading";const canSplitLines=lineTemplate&&fontsReady;this.ready=!lineTemplate||fontsReady;if(!isCached){if(clearCache){$el.innerHTML=this.html;this.words.length=this.chars.length=0}this.splitNode($el);this.cache=$el.innerHTML}if(canSplitLines){this.effectsCleanups.forEach((cleanup=>isFnc(cleanup)&&cleanup(this)));if(isCached)$el.innerHTML=this.cache;this.lines.length=0;if(wordTemplate)this.words=getAllTopLevelElements($el,wordType)}if(charTemplate&&(canSplitLines||wordTemplate)){this.chars=getAllTopLevelElements($el,charType)}const elementsArray=this.words.length?this.words:this.chars;let y,linesCount=0;for(let i=0,l=elementsArray.length;i<l;i++){const $el=elementsArray[i];const{top:top,height:height}=$el.getBoundingClientRect();if(y&&top-y>height*.5)linesCount++;$el.setAttribute(dataLine,`${linesCount}`);const nested=$el.querySelectorAll(`[${dataLine}]`);let c=nested.length;while(c--)nested[c].setAttribute(dataLine,`${linesCount}`);y=top}if(canSplitLines){const linesFragment=doc.createDocumentFragment();const parents=new Set;const clones=[];for(let lineIndex=0;lineIndex<linesCount+1;lineIndex++){const $clone=$el.cloneNode(true);filterLineElements($clone,lineIndex,new Set).forEach(($el=>{const $parent=$el.parentElement;if($parent)parents.add($parent);$el.remove()}));clones.push($clone)}parents.forEach(filterEmptyElements);for(let cloneIndex=0,clonesLength=clones.length;cloneIndex<clonesLength;cloneIndex++){processHTMLTemplate(lineTemplate,this.lines,clones[cloneIndex],linesFragment,lineType,this.debug,cloneIndex)}$el.innerHTML="";$el.appendChild(linesFragment);if(wordTemplate)this.words=getAllTopLevelElements($el,wordType);if(charTemplate)this.chars=getAllTopLevelElements($el,charType)}if(this.linesOnly){const words=this.words;let w=words.length;while(w--){const $word=words[w];$word.replaceWith($word.textContent)}words.length=0}if(canSplitLines||clearCache){this.effects.forEach(((effect,i)=>this.effectsCleanups[i]=effect(this)))}if(this.accessible&&(canSplitLines||!isCached)){const $accessible=doc.createElement("span");$accessible.style.cssText=`position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;`;$accessible.innerHTML=this.html;$el.insertBefore($accessible,$el.firstChild);this.lines.forEach(setAriaHidden);this.words.forEach(setAriaHidden);this.chars.forEach(setAriaHidden)}this.width=$el.offsetWidth;return this}refresh(){this.split(true)}}const split=(target,parameters)=>new TextSplitter(target,parameters);const text={split:split};const stagger=(val,params={})=>{let values=[];let maxValue=0;const from=params.from;const reversed=params.reversed;const ease=params.ease;const hasEasing=!isUnd(ease);const hasSpring=hasEasing&&!isUnd(ease.ease);const staggerEase=hasSpring?ease.ease:hasEasing?parseEasings(ease):null;const grid=params.grid;const axis=params.axis;const customTotal=params.total;const fromFirst=isUnd(from)||from===0||from==="first";const fromCenter=from==="center";const fromLast=from==="last";const fromRandom=from==="random";const isRange=isArr(val);const useProp=params.use;const val1=isRange?parseNumber(val[0]):parseNumber(val);const val2=isRange?parseNumber(val[1]):0;const unitMatch=unitsExecRgx.exec((isRange?val[1]:val)+emptyString);const start=params.start||0+(isRange?val1:0);let fromIndex=fromFirst?0:isNum(from)?from:0;return(target,i,t,tl)=>{const[registeredTarget]=registerTargets(target);const total=isUnd(customTotal)?t:customTotal;const customIndex=!isUnd(useProp)?isFnc(useProp)?useProp(registeredTarget,i,total):getOriginalAnimatableValue(registeredTarget,useProp):false;const staggerIndex=isNum(customIndex)||isStr(customIndex)&&isNum(+customIndex)?+customIndex:i;if(fromCenter)fromIndex=(total-1)/2;if(fromLast)fromIndex=total-1;if(!values.length){for(let index=0;index<total;index++){if(!grid){values.push(abs(fromIndex-index))}else{const fromX=!fromCenter?fromIndex%grid[0]:(grid[0]-1)/2;const fromY=!fromCenter?floor(fromIndex/grid[0]):(grid[1]-1)/2;const toX=index%grid[0];const toY=floor(index/grid[0]);const distanceX=fromX-toX;const distanceY=fromY-toY;let value=sqrt(distanceX*distanceX+distanceY*distanceY);if(axis==="x")value=-distanceX;if(axis==="y")value=-distanceY;values.push(value)}maxValue=max(...values)}if(staggerEase)values=values.map((val=>staggerEase(val/maxValue)*maxValue));if(reversed)values=values.map((val=>axis?val<0?val*-1:-val:abs(maxValue-val)));if(fromRandom)values=shuffle(values)}const spacing=isRange?(val2-val1)/maxValue:val1;const offset=tl?parseTimelinePosition(tl,isUnd(params.start)?tl.iterationDuration:start):start;let output=offset+(spacing*round(values[staggerIndex],2)||0);if(params.modifier)output=params.modifier(output);if(unitMatch)output=`${output}${unitMatch[2]}`;return output}};exports.Animatable=Animatable;exports.Draggable=Draggable;exports.JSAnimation=JSAnimation;exports.Scope=Scope;exports.ScrollObserver=ScrollObserver;exports.Spring=Spring;exports.TextSplitter=TextSplitter;exports.Timeline=Timeline;exports.Timer=Timer;exports.WAAPIAnimation=WAAPIAnimation;exports.animate=animate;exports.createAnimatable=createAnimatable;exports.createDraggable=createDraggable;exports.createScope=createScope;exports.createSpring=createSpring;exports.createTimeline=createTimeline;exports.createTimer=createTimer;exports.eases=eases;exports.engine=engine;exports.onScroll=onScroll;exports.scrollContainers=scrollContainers;exports.stagger=stagger;exports.svg=svg;exports.text=text;exports.utils=utils;exports.waapi=waapi}));
diff --git a/lib/anime.umd.min.js b/lib/anime.umd.min.js
index 451c3248..ca9c4b9c 100644
--- a/lib/anime.umd.min.js
+++ b/lib/anime.umd.min.js
@@ -1,9 +1,9 @@
/**
* anime.js - UMD
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
* @see https://animejs.com
*/
-!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(),h=Symbol(),l=Symbol(),c=Symbol(),d=1e-11,u=1e12,p=1e3,m="",f=new Map;f.set("x","translateX"),f.set("y","translateY"),f.set("z","translateZ");const g=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],_=g.reduce(((t,e)=>({...t,[e]:e+"("})),{}),y=()=>{},v=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,b=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,S=/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,T=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,w=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,k=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,$=/([a-z])([A-Z])/g,E=/(\w+)(\([^)]+\)+)/g,C=/(\*=|\+=|-=)/,B={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:p,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:y,onBeforeUpdate:y,onUpdate:y,onLoop:y,onPause:y,onComplete:y,onRender:y},D={defaults:B,root:i,scope:null,precision:4,timeScale:1,tickThreshold:200},L={version:"4.0.2",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(L));const A=t=>t.replace($,"$1-$2").toLowerCase(),N=(t,e)=>0===t.indexOf(e),F=Date.now,P=Array.isArray,R=t=>t&&t.constructor===Object,Y=t=>"number"==typeof t&&!isNaN(t),X=t=>"string"==typeof t,M=t=>"function"==typeof t,O=t=>void 0===t,z=t=>O(t)||null===t,I=t=>e&&t instanceof SVGElement,W=t=>v.test(t),V=t=>N(t,"rgb"),U=t=>N(t,"hsl"),H=t=>!D.defaults.hasOwnProperty(t),q=t=>X(t)?parseFloat(t):t,Q=Math.pow,j=Math.sqrt,G=Math.sin,Z=Math.cos,J=Math.abs,K=Math.exp,tt=Math.ceil,et=Math.floor,st=Math.asin,it=Math.max,rt=Math.atan2,nt=Math.PI,ot=Math.round,at=(t,e,s)=>t<e?e:t>s?s:t,ht={},lt=(t,e)=>{if(e<0)return t;if(!e)return ot(t);let s=ht[e];return s||(s=ht[e]=10**e),ot(t*s)/s},ct=(t,e)=>P(e)?e.reduce(((e,s)=>J(s-t)<J(e-t)?s:e)):e?ot(t/e)*e:t,dt=(t,e,s)=>t+(e-t)*s,ut=t=>t===1/0?u:t===-1/0?-1e12:t,pt=t=>t<=d?d:ut(lt(t,11)),mt=t=>P(t)?[...t]:t,ft=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=O(r)?e[i]:r}return s},gt=(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}},_t=(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},yt=(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};class vt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=lt(p/120,0),this._fps=120,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<d?d:s,r=lt(p/i,0);this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<d?d:e}requestTick(t){const e=this._scheduledTime,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const bt=(t,e,s,i,n)=>{const o=t.parent,a=t.duration,l=t.completed,c=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,f=t._loopDelay,g=t._reversed,y=t._alternate,v=t._hasChildren,b=t._delay,S=t._currentTime,x=b+c,T=e-b,w=at(S,-b,a),k=at(T,-b,a),$=T-S,E=k>0,C=k>=a,B=a<=d,L=2===n;let A=0,N=T,F=0;if(u>1){const e=~~(k/(c+(C?0:f)));t._currentIteration=at(e,0,u),C&&t._currentIteration--,A=t._currentIteration%2,N=k%(c+f)||0}const P=g^(y&&A),R=t._ease;let Y=C?P?0:a:P?c-N:N;R&&(Y=c*R(Y/c)||0);const X=(o?o.backwards:T<S)?!P:!!P;if(t._currentTime=T,t._iterationTime=Y,t.backwards=X,E&&!t.began?(t.began=!0,s||o&&(X||!o.began)||t.onBegin(t)):T<=0&&(t.began=!1),s||v||!E||t._currentIteration===p||t.onLoop(t),L||1===n&&(e>=b&&e<=x||e<=b&&w>b||e>=x&&w!==a)||Y>=x&&w!==a||Y<=b&&w>0||e<=w&&w===a&&l||C&&!l&&B){if(E&&(t.computeDeltaTime(w),s||t.onBeforeUpdate(t)),!v){const e=L||(X?-1*$:$)>=D.tickThreshold,n=t._offset+(o?o._offset:0)+b+Y;let a,l,c,d,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,y=u._prevRep,v=t!==r.none;if((e||(s!==o||n<=f+(g?g._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!g||g._isOverridden||n<=g._absoluteStartTime)&&(!y||y._isOverridden||n>=y._absoluteStartTime+y._changeDuration+u._delay))){const e=u._currentTime=at(Y-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,_=0===m,y=_&&g||0===s||1===s?-1:D.precision;let b,S;if(_)b=S=n(lt(dt(u._fromNumber,u._toNumber,s),y));else if(1===m)S=n(lt(dt(u._fromNumber,u._toNumber,s),y)),b=`${S}${u._unit}`;else if(2===m){const t=u._fromNumbers,e=u._toNumbers,i=lt(at(n(dt(t[0],e[0],s)),0,255),0),r=lt(at(n(dt(t[1],e[1],s)),0,255),0),o=lt(at(n(dt(t[2],e[2],s)),0,255),0),a=at(n(lt(dt(t[3],e[3],s),y)),0,1);if(b=`rgba(${i},${r},${o},${a})`,v){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(lt(dt(u._fromNumbers[t],u._toNumbers[t],s),y)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=S),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):(l=a.style,3===f?(a!==c&&(c=a,d=a[h]),d[t]=b,p=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),E&&(F=1)}}if(p&&u._renderTransforms){let t=m;for(let e in d)t+=`${_[e]}${d[e]}) `;l.transform=t,p=0}u=u._next}!s&&F&&t.onRender(t)}!s&&E&&t.onUpdate(t)}return o&&B?!s&&(o.began&&!X&&T>=a&&!l||X&&T<=d&&l)&&(t.onComplete(t),t.completed=!X):E&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(X||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},St=(t,e,s,i,r)=>{const n=t._currentIteration;if(bt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,h=i?e:o._iterationTime,l=F();let c=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;gt(o,(e=>{if(a){const i=e.duration,r=e._offset+e._delay;s||!(i<=d)||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)}gt(o,(t=>{const e=lt((h-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;c+=bt(t,e,s,i,n),!t.completed&&u&&(u=!1)}),a),!s&&c&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},xt={animation:null,update:y},Tt=e?requestAnimationFrame:setImmediate,wt=e?cancelAnimationFrame:clearImmediate;class kt extends vt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=B,this.paused=!(!e||!i.hidden),this.reqId=null}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?(_t(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):St(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}xt.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=Tt(Et)),this}pause(){return this.paused=!0,Ct()}resume(){if(this.paused)return this.paused=!1,gt(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===D.timeScale?1:p)}set speed(t){this._speed=t*D.timeScale,gt(this,(t=>t.speed=t._speed))}get timeUnit(){return 1===D.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(D.timeScale!==s){D.timeScale=s,D.tickThreshold=200*s;const t=e?.001:p;this.defaults.duration*=t,this._speed*=t}}get precision(){return D.precision}set precision(t){D.precision=t}}const $t=(()=>{const t=new kt(F());return e&&(L.engine=t,i.addEventListener("visibilitychange",(()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())}))),t})(),Et=()=>{$t._head?($t.reqId=Tt(Et),$t.update()):$t.reqId=0},Ct=()=>(wt($t.reqId),$t.reqId=0,$t);function Bt(t){const e=X(t)?D.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Dt(t){if(z(t))return[];if(P(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!z(i)){const t=Bt(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(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}if(!e)return[t];const s=Bt(t);return s?Array.from(s):[t]}function Lt(t){const e=Dt(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=I(s);(s.nodeType||t)&&(s[o]=!0,s[a]=t,s[h]={})}}return e}const At=t=>{const e=Dt(t)[0];if(e&&I(e))return e},Nt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),Ft=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[a],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Nt(t,s,-1),i=Nt(t,s,1);return 180*rt(i.y-e.y,i.x-e.x)/nt}{const i=Nt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Pt=["opacity","rotate","overflow","color"],Rt={morphTo:(t,e=.33)=>s=>{const i=At(t);if(!i)return;const r="path"===s.tagName,n=r?" ":",",o=s[l];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 c=e/(l-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";a+=p+lt(d.x,3)+n+d.y+" ",h+=p+lt(u.x,3)+n+u.y+" "}}else a=s.getAttribute(r?"d":"points"),h=i.getAttribute(r?"d":"points");return s[l]=h,[a,h]},createMotionPath:t=>{const e=At(t);if(e)return{translateX:Ft(e,"x"),translateY:Ft(e,"y"),rotate:Ft(e,"a")}},createDrawable:(t,e=0,s=0)=>Dt(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 h=new Proxy(t,{get(t,e){const s=t[e];return e===c?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],h=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(j(s.a*s.a+s.b*s.b)+j(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=h*i*l+c,u=i*l+(0===r&&1===h||1===r&&0===h?0:10*l)-d;if("butt"!==n){const e=r===h?"butt":n;a!==e&&(t.style.strokeLinecap=`${e}`,a=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:M(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),h.setAttribute("draw",`${e} ${s}`)),h})(t,e,s)))},Yt=(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),Xt=(t,e)=>O(t)?e:t,Mt=(t,e,s,i,r)=>{if(M(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Ot=(t,e)=>t[o]?t[a]&&((t,e)=>{if(Pt.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:N(e,"--")?4:e in t.style?2:e in t?0:1:0,zt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[c]||t).getPropertyValue(e);return"auto"===r?"0":r},It=(t,e,s,i)=>{const r=O(s)?Ot(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[h];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&&!O(r)?r:N(e,"scale")?"1":N(e,"rotate")||N(e,"skew")?"0deg":"0px"})(t,e,i):4===r?zt(t,e,i).trimStart():zt(t,e,i)},Wt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Vt=(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(" ")&&k.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(W(r=s)||V(r)||U(r))return e.t=2,e.d=V(i=s)?(t=>{const e=b.exec(t)||S.exec(t),s=O(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(i):W(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):U(i)?(t=>{const e=x.exec(t)||T.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=O(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=lt(255*Yt(e,t,s+1/3),0),a=lt(255*Yt(e,t,s),0),h=lt(255*Yt(e,t,s-1/3),0)}return[o,a,h,n]})(i):[0,0,0,1],e;{const t=s.match(w);return e.t=3,e.d=t?t.map(Number):[],e.s=s.split(w)||[],e}}var i,r;return e.n=s,e},Ut=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=mt(t._toNumbers),e.s=mt(t._strings),e),Ht={t:0,n:0,u:null,o:null,d:null,s:null},qt={_rep:new WeakMap,_add:new Map},Qt=(t,e,s="_rep")=>{const i=qt[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=d,t._currentTime=d},Zt=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;yt(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);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<d&&Gt(i)}let o=!0;if(gt(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;gt(t,(t=>{t!==e&&gt(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=xt.animation;return e||(e={duration:d,computeDeltaTime:y,_offset:0,_delay:0,_head:null,_tail:null},xt.animation=e,xt.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?mt(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})(qt._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=d,i._startTime=0,i._numbers=mt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,yt(e,i),yt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=mt(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=mt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0})),i._fromNumbers=e}yt(e,t,null,"_prevAdd","_nextAdd")}return t},Jt=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=qt._rep.get(s)[i];if(_t(n,t,"_prevRep","_nextRep"),e===r.blend){const e=qt._add,r=e.get(s);if(!r)return;const n=r[i],o=xt.animation;_t(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){_t(n,a,"_prevAdd","_nextAdd"),_t(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},Kt=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),te=t=>t._cancelled?(t._hasChildren?gt(t,te):gt(t,(t=>{t._composition!==r.none&&Zt(t,Qt(t.target,t.property))})),t._cancelled=0,t):t;let ee=0;class se extends vt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:h,loopDelay:l,autoplay:c,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:b}=t;D.scope&&D.scope.revertibles.push(this);const S=e?0:$t._elapsedTime,x=e?e.defaults:D.defaults,T=M(r)||O(r)?x.delay:+r,w=M(n)||O(n)?1/0:+n,k=Xt(h,x.loop),$=Xt(l,x.loopDelay),E=!0===k||k===1/0||k<0?1/0:k+1;let C=0;if(e)C=s;else{let t=F();$t.paused&&($t.requestTick(t),t=$t._elapsedTime),C=t-$t._startTime}this.id=O(i)?++ee:i,this.parent=e,this.duration=ut((w+$)*E-$)||d,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=b||x.onUpdate,this.onLoop=f||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=w,this.iterationCount=E,this._autoplay=!e&&Xt(c,x.autoplay),this._offset=C,this._delay=T,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=y,this._running=!1,this._reversed=+Xt(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Xt(a,x.alternate),this._prev=null,this._next=null,this._elapsedTime=S,this._startTime=S,this._lastTime=S,this._fps=Xt(u,x.frameRate),this._speed=Xt(p,x.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return at(lt(this._currentTime,D.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return lt(this._iterationTime,D.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return at(lt(this._currentTime/this.duration,5),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return at(lt(this._iterationTime/this.iterationDuration,5),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*at(+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=0){return te(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,St(this,0,1,t,2),Kt(this),this._hasChildren&&gt(this,Kt),this}init(t=0){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&St(this,this.duration,1,t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!O(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*$t._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<=d&&!this._hasChildren?St(this,d,0,0,2):(this._running||(yt($t,this),$t._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,$t.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){te(this),this.completed=!1;const i=this.paused;return this.paused=!0,St(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?et(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?gt(this,(t=>t.cancel()),!0):gt(this,Jt),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=pt(t);if(e===s)return this;const i=t/e,r=t<=d;return this.duration=r?d:s,this.iterationDuration=r?d:pt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){St(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=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const ie=t=>t,re=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,ne=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?ie:r=>0===r||1===r?r:re(((t,e,s)=>{let i,r,n=0,o=1,a=0;do{r=n+(o-n)/2,i=re(r,e,s)-t,i>0?o=r:n=r}while(J(i)>1e-7&&++a<100);return r})(r,t,s),e,i),oe=(t=10,e)=>{const s=e?tt:et;return e=>s(at(e,0,1)*t)*(1/t)},ae=(...t)=>{const e=t.length;if(!e)return ie;const s=e-1,i=t[0],r=t[s],n=[0],o=[q(i)];for(let e=1;e<s;e++){const i=t[e],r=X(i)?i.trim().split(" "):[i],a=r[0],h=r[1];n.push(O(h)?e/s:q(h)/100),o.push(q(a))}return o.push(q(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]}},he=(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(at(o,r,1))}return s.push(1),ae(...s)},le=nt/2,ce=2*nt,de=(t=1.68)=>e=>Q(e,+t),ue={[m]:de,Quad:de(2),Cubic:de(3),Quart:de(4),Quint:de(5),Sine:t=>1-Z(t*le),Circ:t=>1-j(1-t*t),Expo:t=>t?Q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=Q(2,--s))-1)/11;);return 1/Q(4,3-s)-7.5625*Q((3*e-2)/22-t,2)},Back:(t=1.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=at(+t,1,10),i=at(+e,d,2),r=i/ce*st(1/s),n=ce/i;return t=>0===t||1===t?t:-s*Q(2,-10*(1-t))*G((1-t-r)*n)}},pe={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},me=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=pe[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:ie}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):ie}},fe=(()=>{const t={linear:ae,irregular:he,steps:oe,cubicBezier:ne};for(let e in pe)for(let s in ue){const i=ue[s],r=pe[e];t[e+s]=s===m||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),ge={linear:ie},_e=t=>M(t)?t:X(t)?me(t,fe,ge):ie,ye={},ve=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&I(e)&&t in e.style){const e=ye[t];if(e)return e;{const e=t?A(t):t;return ye[t]=e,e}}return t},be={deg:1,rad:180/nt,turn:360},Se={},xe=(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,h=Se[a];if(O(h)||r){let r;if(n in be)r=o*be[n]/be[s];else{const e=100,a=t.cloneNode(),h=t.parentNode,l=h&&h!==i?h:i.body;l.appendChild(a);const c=a.style;c.width=e+n;const d=a.offsetWidth||e;c.width=e+s;const u=d/(a.offsetWidth||e);l.removeChild(a),r=u*o}e.n=r,Se[a]=r}else e.n=h;return e.t,e.u=s,e},Te=t=>{if(t._hasChildren)gt(t,Te,!0);else{const e=t;e.pause(),gt(e,(t=>{const s=t.property,i=t.target;if(i[o]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[h];if(O(n)||n===m?delete e[s]:e[s]=n,t._renderTransforms)if(Object.keys(e).length){let t=m;for(let s in e)t+=_[s]+e[s]+") ";r.transform=t}else r.removeProperty("transform")}else O(n)||n===m?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===m&&t.removeAttribute("style")}))}}))}return t},we={t:0,n:0,u:null,o:null,d:null,s:null},ke={t:0,n:0,u:null,o:null,d:null,s:null},$e={func:null},Ee=[null],Ce=[null,null],Be={to:null};let De,Le,Ae=0;class Ne extends se{constructor(t,e,s,i,n=!1,o=0,a=0){super(e,s,i);const h=Lt(t),l=h.length,c=e.keyframes,u=c?ft(((t,e)=>{const s={};if(P(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(H);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];H(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=Xt(e.duration,D.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(H(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 c=0;for(let t=0;t<a;t++)c+=n[t].duration;1===a&&(l.from=h.to),r.ease&&(l.ease=r.ease),l.duration=o-(a?c: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})(c,e),e):e,{delay:m,duration:f,ease:g,playbackEase:_,modifier:y,composition:v,onRender:b}=u,S=s?s.defaults:D.defaults,x=Xt(_,S.playbackEase),T=x?_e(x):null,w=!O(g)&&!O(g.ease),k=w?g.ease:Xt(g,T?"linear":S.ease),$=w?g.duration:Xt(f,S.duration),E=Xt(m,S.delay),C=y||S.modifier,B=O(v)&&l>=p?r.none:O(v)?S.composition:v,L={},A=this._offset+(s?s._offset:0);let N=NaN,F=NaN,X=0,M=0;for(let t=0;t<l;t++){const e=h[t],i=o||t,c=a||l;let p=NaN,m=NaN;for(let t in u)if(H(t)){const o=Ot(e,t),a=ve(t,e,o);let h=u[t];const l=P(h);if(n&&!l&&(Ce[0]=h,Ce[1]=h,h=Ce),l){const t=h.length,e=!R(h[0]);2===t&&e?(Be.to=h,Ee[0]=Be,De=Ee):t>2&&e?(De=[],h.forEach(((t,e)=>{e?1===e?(Ce[1]=t,De.push(Ce)):De.push(t):Ce[0]=t}))):De=h}else Ee[0]=h,De=Ee;let f=null,g=null,_=NaN,y=0,v=0;for(let t=De.length;v<t;v++){const n=De[v];R(n)?Le=n:(Be.to=n,Le=Be),$e.func=null;const h=Mt(Le.to,e,i,c,$e);let l;R(h)&&!O(h.to)?(Le=h,l=h.to):l=h;const u=Mt(Le.from,e,i,c),p=Le.ease,m=!O(p)&&!O(p.ease),b=m?p.ease:p||k,S=m?p.duration:Mt(Xt(Le.duration,t>1?Mt($,e,i,c)/t:$),e,i,c),x=Mt(Xt(Le.delay,v?0:E),e,i,c),T=Mt(Xt(Le.composition,B),e,i,c),w=Y(T)?T:r[T],D=Le.modifier||C,N=!O(u),F=!O(l),z=P(l),I=z||N&&F,W=g?y+x:x,V=A+W;M||!N&&!z||(M=1);let U=g;if(w!==r.none){f||(f=Qt(e,a));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(U=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)Gt(t),t=t._nextRep}if(I?(Vt(z?Mt(l[0],e,i,c):u,we),Vt(z?Mt(l[1],e,i,c,$e):l,ke),0===we.t&&(U?1===U._valueType&&(we.t=1,we.u=U._unit):(Vt(It(e,a,o,L),Ht),1===Ht.t&&(we.t=1,we.u=Ht.u)))):(F?Vt(l,ke):g?Ut(g,ke):Vt(s&&U&&U.parent.parent===s?U._value:It(e,a,o,L),ke),N?Vt(u,we):g?Ut(g,we):Vt(s&&U&&U.parent.parent===s?U._value:It(e,a,o,L),we)),we.o&&(we.n=Wt(U?U._toNumber:Vt(It(e,a,o,L),Ht).n,we.n,we.o)),ke.o&&(ke.n=Wt(we.n,ke.n,ke.o)),we.t!==ke.t)if(3===we.t||3===ke.t){const t=3===we.t?we:ke,e=3===we.t?ke:we;e.t=3,e.s=mt(t.s),e.d=t.d.map((()=>e.n))}else if(1===we.t||1===ke.t){const t=1===we.t?we:ke,e=1===we.t?ke:we;e.t=1,e.u=t.u}else if(2===we.t||2===ke.t){const t=2===we.t?we:ke,e=2===we.t?ke:we;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(we.u!==ke.u){let t=ke.u?we:ke;t=xe(e,t,ke.u?ke.u:we.u,!1)}if(ke.d&&we.d&&ke.d.length!==we.d.length){const t=we.d.length>ke.d.length?we:ke,e=t===we?ke:we;e.d=t.d.map(((t,s)=>O(e.d[s])?0:e.d[s])),e.s=mt(t.s)}const H=lt(+S||d,12),q={parent:this,id:Ae++,property:a,target:e,_value:null,_func:$e.func,_ease:_e(b),_fromNumbers:mt(we.d),_toNumbers:mt(ke.d),_strings:mt(ke.s),_fromNumber:we.n,_toNumber:ke.n,_numbers:mt(we.d),_number:we.n,_unit:ke.u,_modifier:D,_currentTime:0,_startTime:W,_delay:+x,_updateDuration:H,_changeDuration:H,_absoluteStartTime:V,_tweenType:o,_valueType:ke.t,_composition:w,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};w!==r.none&&Zt(q,f),isNaN(_)&&(_=q._startTime),y=lt(W+H,12),g=q,X++,yt(this,q)}(isNaN(F)||_<F)&&(F=_),(isNaN(N)||y>N)&&(N=y),3===o&&(p=X-v,m=X)}if(!isNaN(p)){let t=0;gt(this,(e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===r.blend&&gt(xt.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),F?(gt(this,(t=>{t._startTime-t._delay||(t._delay-=F),t._startTime-=F})),N-=F):F=0,N||(N=d,this.iterationCount=0),this.targets=h,this.duration=N===d?d:ut((N+this._loopDelay)*this.iterationCount-this._loopDelay)||d,this.onRender=b||S.onRender,this._ease=T,this._delay=F,this.iterationDuration=N,this._inlineStyles=L,!this._autoplay&&M&&this.onRender(this)}stretch(t){const e=this.duration;if(e===pt(t))return this;const s=t/e;return gt(this,(t=>{t._updateDuration=pt(t._updateDuration*s),t._changeDuration=pt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return gt(this,(t=>{const e=It(t.target,t.property,t._tweenType);Vt(e,Ht),t._fromNumbers=mt(Ht.d),t._fromNumber=Ht.n,t._func&&(Vt(t._func(),ke),t._toNumbers=mt(ke.d),t._strings=mt(ke.s),t._toNumber=ke.n)})),this}revert(){return super.revert(),Te(this)}then(t){return super.then(t)}}const Fe=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Pe={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Re=(()=>{const t={};for(let e in pe)t[e]=t=>pe[e](de(t));return t})(),Ye=t=>{let e=Pe[t];if(e)return e;if(e="linear",X(t)){if(N(t,"linear")||N(t,"cubic-")||N(t,"steps")||N(t,"ease"))e=t;else if(N(t,"cubicB"))e=A(t);else{const s=me(t,Re,Pe);M(s)&&(e=s===ie?"linear":Fe(s))}Pe[t]=e}else if(M(t)){const s=Fe(t);s&&(e=s)}else t.ease&&(e=Fe(t.ease));return e},Xe=["x","y","z"],Me=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...Xe],Oe=[...Xe,...g.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))];let ze=e&&(O(CSS)||!Object.hasOwnProperty.call(CSS,"registerProperty"));const Ie={_head:null,_tail:null},We=(t,e,s)=>{let i=Ie._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,a=!s||i.parent===s;if(n&&o&&a){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),_t(Ie,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},Ve=(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),We(e,s),yt(Ie,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>{We(e,s,t)};return n.onremove=a,n.onfinish=a,n},Ue=(t,e,s,i,r)=>{let n=Mt(e,s,i,r);return Y(n)?Me.includes(t)||N(t,"translate")?`${n}px`:N(t,"rotate")||N(t,"skew")?`${n}deg`:`${n}`:n},He=(t,e,s,i,r,n)=>{let o="0";const a=O(i)?getComputedStyle(t)[e]:Ue(e,i,t,r,n);return o=O(s)?P(i)?i.map((s=>Ue(e,s,t,r,n))):a:[Ue(e,s,t,r,n),a],o};class qe{constructor(t,e){D.scope&&D.scope.revertibles.push(this),ze||(g.forEach((t=>{const e=N(t,"skew"),s=N(t,"scale"),i=N(t,"rotate"),r=N(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{}})),ze=!0);const s=Lt(t),i=s.length;i||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation.");const r=Xt(e.ease,Ye(D.defaults.ease)),n=r.ease&&r,o=Xt(e.autoplay,D.defaults.autoplay),a=!(!o||!o.link)&&o,l=e.alternate&&!0===e.alternate,c=e.reversed&&!0===e.reversed,d=Xt(e.loop,D.defaults.loop),u=!0===d||d===1/0?1/0:Y(d)?d+1:1,v=l?c?"alternate-reverse":"alternate":c?"reverse":"normal",b=Ye(r),S=1===D.timeScale?1:p;this.targets=s,this.animations=[],this.controlAnimation=null,this.onComplete=e.onComplete||y,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!o||!1!==a,this.reversed=c,this.autoplay=o,this._speed=Xt(e.playbackRate,D.defaults.playbackRate),this._resolve=y,this._completed=0,this._inlineStyles=s.map((t=>t.getAttribute("style"))),s.forEach(((t,s)=>{const o=t[h],a=Oe.some((t=>e.hasOwnProperty(t))),l=(n?n.duration:Mt(Xt(e.duration,D.defaults.duration),t,s,i))*S,c=Mt(Xt(e.delay,D.defaults.delay),t,s,i)*S,d=Xt(e.composition,"replace");for(let n in e){if(!H(n))continue;const h={},p={iterations:u,direction:v,fill:"forwards",easing:b,duration:l,delay:c,composite:d},m=e[n],_=!!a&&(g.includes(n)?n:f.get(n));let y;if(R(m)){const e=m,a=Xt(e.ease,r),u=a.ease&&a,f=e.to,g=e.from;if(p.duration=(u?u.duration:Mt(Xt(e.duration,l),t,s,i))*S,p.delay=Mt(Xt(e.delay,c),t,s,i)*S,p.composite=Xt(e.composition,d),p.easing=Ye(a),y=He(t,n,g,f,s,i),_?(h[`--${_}`]=y,o[_]=y):h[n]=He(t,n,g,f,s,i),Ve(this,t,n,h,p),!O(g))if(_){const e=`--${_}`;t.style.setProperty(e,h[e][0])}else t.style[n]=h[n][0]}else y=P(m)?m.map((e=>Ue(n,e,t,s,i))):Ue(n,m,t,s,i),_?(h[`--${_}`]=y,o[_]=y):h[n]=y,Ve(this,t,n,h,p)}if(a){let e=m;for(let t in o)e+=`${_[t]}var(--${t})) `;t.style.transform=e}})),a&&this.autoplay.link(this)}forEach(t){const e=X(t)?e=>e[t]():t;return this.animations.forEach(e),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=D.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===D.timeScale?1:p);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=y){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=y};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const Qe={animate:(t,e)=>new qe(t,e),convertEase:Fe},je=(t=y)=>new se({duration:1*D.timeScale,onComplete:t},null,0).resume();function Ge(t,e,s){const i=Lt(t);if(!i.length)return;const[r]=i,n=Ot(r,e),o=ve(e,r,n);let a=It(r,o);if(O(s))return a;if(Vt(a,Ht),0===Ht.t||1===Ht.t){if(!1===s)return Ht.n;{const t=xe(r,Ht,s,!1);return`${lt(t.n,D.precision)}${t.u}`}}}const Ze=(t,e)=>{if(!O(e))return e.duration=d,e.composition=Xt(e.composition,r.none),new Ne(t,e,null,0,!0).resume()},Je=(t,e,s)=>{let i=!1;return gt(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=ve(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),_t(e,r),Jt(r),i=!0)}}),!0),i},Ke=(t,e,s)=>{const i=Dt(t),r=e||$t,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];We(e,s,n)}let o;if(r._hasChildren){let e=0;gt(r,(n=>{if(!n._hasChildren)if(o=Je(i,n,s),o&&!n._head)n.cancel(),_t(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?Ke(t,n,s):n._hasChildren=!1}),!0),O(r.iterationDuration)||(r.iterationDuration=e)}else o=Je(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},ts=(t,e,s)=>{const i=10**(s||0);return et((Math.random()*(e-t+1/i)+t)*i)/i},es=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),ss=(t,e,s,i)=>{let r=p/D.defaults.frameRate;if(!1!==i){const t=i||$t._hasChildren&&$t;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},is=t=>(...e)=>{const s=t(...e);return new Proxy(y,{apply:(t,e,[i])=>s(i),get:(t,e)=>is(((...t)=>{const i=ns[e](...t);return t=>i(s(t))}))})},rs=(t,e=0)=>(...s)=>(s.length<t.length?is(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),ns={$:Lt,get:Ge,set:Ze,remove:Ke,cleanInlineStyles:Te,random:ts,randomPick:t=>t[ts(0,t.length-1)],shuffle:t=>{let e,s,i=t.length;for(;i;)s=ts(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},lerp:ss,sync:je,clamp:rs(at),round:rs(lt),snap:rs(ct),wrap:rs(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:rs(dt,1),mapRange:rs(es),roundPad:rs(((t,e)=>(+t).toFixed(e))),padStart:rs(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:rs(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:rs((t=>t*nt/180)),radToDeg:rs((t=>180*t/nt))},os=(t,e)=>{let s=t.iterationDuration;if(s===d&&(s=0),O(e))return s;if(Y(+e))return+e;const i=e,r=t?t.labels:null,n=!z(r),o=((t,e)=>{if(N(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!O(o),h=C.exec(i);if(h){const t=h[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=a?o:n?l:s,d=+e[1];return Wt(c,d,t[0])}return a?o:n?O(r[i])?s:r[i]:s};function as(t,e,s,i,r,n){const o=Y(t.duration)&&t.duration<=d?s-d:s;St(e,o,1,1,1);const a=i?new Ne(i,t,e,o,!1,r,n):new se(t,e,o);return a.init(1),yt(e,a),gt(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return ut((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||d}(e),e}class hs extends se{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=D.defaults;this.defaults=e?ft(e,s):s,this.onRender=t.onRender||s.onRender;const i=Xt(t.playbackEase,s.playbackEase);this._ease=i?_e(i):null,this.iterationDuration=0}add(t,e,s){const i=R(e),r=R(t);if(i||r){if(this._hasChildren=!0,i){const i=e;if(M(s)){const e=s,r=Dt(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,O(a)||(s.id=a+"-"+h),as(s,this,e(t,h,l,this),t,h,l),h++}))}else as(i,this,os(this,s),t)}else as(t,this,os(this,e));return this.init(1)}}sync(t,e){if(O(t)||t&&O(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,ease:"linear"},e)}set(t,e,s){return O(e)?this:(e.duration=d,e.composition=r.replace,this.add(t,e,s))}call(t,e){return O(t)||t&&!M(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return O(t)||t&&!X(t)||(this.labels[t]=os(this,e)),this}remove(t,e){return Ke(t,this,e),this}stretch(t){const e=this.duration;if(e===pt(t))return this;const s=t/e,i=this.labels;gt(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return gt(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),gt(this,(t=>t.revert),!0),Te(this)}then(t){return super.then(t)}}class ls{constructor(t,e){D.scope&&D.scope.revertibles.push(this);const s={},i={};if(this.targets=[],this.animations={},!O(t)&&!O(e)){for(let t in e){const r=e[t];H(t)?i[t]=r:s[t]=r}for(let e in i){const n=i[e],o=R(n);let a={},h="+=0";if(o){const t=n.unit;X(t)&&(h+=t)}else a.duration=n;a[e]=o?ft({to:h},n):h;const l=ft(s,a);l.composition=r.replace,l.autoplay=!1;const c=this.animations[e]=new Ne(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(O(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return gt(c,(e=>{if(P(t))for(let s=0,i=t.length;s<i;s++)O(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;O(s)||(e._ease=_e(s)),e._currentTime=0})),O(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=y,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}class cs{constructor(t={}){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.m=at(Xt(t.mass,1),0,p),this.s=at(Xt(t.stiffness,100),1,p),this.d=at(Xt(t.damping,10),.1,p),this.v=at(Xt(t.velocity,0),-1e3,p),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?K(-n*e*s)*(1*Z(i*n)+r*G(i*n)):(1+r*n)*K(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,h=this.w0=at(j(o/r),d,p),l=this.zeta=n/(2*j(o*r)),c=this.wd=l<1?h*j(1-l*l):0;this.b=l<1?(l*h-a)/c:-a+h;let u=0,m=0,f=0;for(;m<t&&f<e;)J(1-this.solve(u))<s?m++:m=0,this.solverDuration=u,u+=i,f++;this.duration=lt(this.solverDuration*p,0)*D.timeScale}get mass(){return this.m}set mass(t){this.m=at(Xt(t,1),0,p),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=at(Xt(t,100),1,p),this.compute()}get damping(){return this.d}set damping(t){this.d=at(Xt(t,10),.1,p),this.compute()}get velocity(){return this.v}set velocity(t){this.v=at(Xt(t,0),-1e3,p),this.compute()}}const ds=t=>new cs(t),us=t=>{t.cancelable&&t.preventDefault()};class ps{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:y,remove:y}}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 ms{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 fs=(t,e)=>t&&M(t)?t(e):t;let gs=0;class _s{constructor(t,e={}){if(!t)return;D.scope&&D.scope.revertibles.push(this);const r=e.x,n=e.y,o=e.trigger,a=e.modifier,h=e.releaseEase,l=h&&_e(h),c=!O(h)&&!O(h.ease),d=R(r)&&!O(r.mapTo)?r.mapTo:"translateX",p=R(n)&&!O(n.mapTo)?n.mapTo:"translateY",m=fs(e.container,this);this.containerArray=P(m)?m:null,this.$container=m&&!this.containerArray?Dt(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=R(t)?new ps(t):Dt(t)[0],this.$trigger=Dt(o||t)[0],this.fixed="fixed"===Ge(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?h:ds({mass:Xt(e.releaseMass,1),stiffness:Xt(e.releaseStiffness,80),damping:Xt(e.releaseDamping,20)}),this.releaseYSpring=c?h:ds({mass:Xt(e.releaseMass,1),stiffness:Xt(e.releaseStiffness,80),damping:Xt(e.releaseDamping,20)}),this.releaseEase=l||fe.outQuint,this.hasReleaseSpring=c,this.onGrab=e.onGrab||y,this.onDrag=e.onDrag||y,this.onRelease=e.onRelease||y,this.onUpdate=e.onUpdate||y,this.onSettle=e.onSettle||y,this.onSnap=e.onSnap||y,this.onResize=e.onResize||y,this.onAfterResize=e.onAfterResize||y,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),O(r)||!0===r)f[d]=0;else if(R(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[d]=e}else!1===r&&(f[d]=0,this.disabled[0]=1);if(O(n)||!0===n)f[p]=0;else if(R(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 ls(this.$target,f),this.xProp=d,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=[-1e12,u,u,-1e12],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 ms(this.$target),this.overshootCoords={x:0,y:0},this.overshootXTicker=new se({autoplay:!1},null,0).init(),this.overshootYTicker=new se({autoplay:!1},null,0).init(),this.updateTicker=new se({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),this.contained=!O(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]?d:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=rt(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 se({autoplay:!1,duration:150*D.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),R(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,h=this.maxVelocity,l=this.velocityStackIndex;n[l]=lt(at(j(t*t+e*e)/r*o,a,h),5);const c=it(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=lt(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=ct(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=lt(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=ct(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return lt(this.animate[this.xProp](),D.precision)}set x(t){this.setX(t,!1)}get y(){return lt(this.animate[this.yProp](),D.precision)}set y(t){this.setY(t,!1)}get progressX(){return es(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(es(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return es(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(es(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=lt(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=lt(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,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,h=this.window[1]=s.innerHeight,l=this.useWin,c=t.scrollWidth,d=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,_]=this.containerPadding;this.dragArea[0]=l?0:p.left,this.dragArea[1]=l?0:p.top,this.scrollView[0]=l?at(c,a,c):c,this.scrollView[1]=l?at(d,h,d):d,this.updateScrollCoords();const{width:y,height:v,left:b,top:S,right:x,bottom:T}=t.getBoundingClientRect();this.dragArea[2]=lt(l?at(y,a,a):y,0),this.dragArea[3]=lt(l?at(v,h,h):v,0);const w=Ge(t,"overflow"),k="visible"===w,$="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===i.body&&k||!$&&!k)&&(c>this.dragArea[2]+_-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!P(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,c=i?this.scrollView[0]-n-y:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=lt(r.top+s-(l?0:S),0),this.targetBounds[1]=lt(r.right+e-(l?a:x),0),this.targetBounds[2]=lt(r.bottom+s-(l?h:T),0),this.targetBounds[3]=lt(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]+_):(this.containerBounds[0]=-lt(r.top-(u?at(S,0,h):S)+o-m,0),this.containerBounds[1]=-lt(r.right-(u?at(x,0,a):x)-c+f,0),this.containerBounds[2]=-lt(r.bottom-(u?at(T,0,h):T)-d+g,0),this.containerBounds[3]=-lt(r.left-(u?at(b,0,a):b)+n-_,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,h]=this.disabled,l=!a&&e<o||!a&&e>r,c=!h&&s<i||!h&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=fs(t.container,this),o=fs(t.containerPadding,this)||0,a=P(o)?o:[o,o,o,o],h=this.x,l=this.y,c=fs(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=P(n)?n:null,this.$container=n&&!this.containerArray?Dt(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=Xt(a,[0,0,0,0]),this.containerFriction=at(Xt(fs(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=at(Xt(fs(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=fs(R(e)&&!O(e.snap)?e.snap:t.snap,this),this.snapY=fs(R(r)&&!O(r.snap)?r.snap:t.snap,this),this.scrollSpeed=Xt(fs(t.scrollSpeed,this),1.5),this.scrollThreshold=Xt(fs(t.scrollThreshold,this),20),this.dragSpeed=Xt(fs(t.dragSpeed,this),1),this.minVelocity=Xt(fs(t.minVelocity,this),0),this.maxVelocity=Xt(fs(t.maxVelocity,this),50),this.velocityMultiplier=Xt(fs(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(at(h,f,p),!0),this.setY(at(l,u,m),!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,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?at(c,this.window[0],c):c,p=this.useWin?at(d,this.window[1],d):d,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,_=this.scrollThreshold,[y,v]=this.coords,[b,S,x,T]=this.scrollBounds,w=lt(at((v-b+t)/_,-1,0)*g,0),k=lt(at((y-S-e)/_,0,1)*g,0),$=lt(at((v-x-s)/_,0,1)*g,0),E=lt(at((y-T+i)/_,-1,0)*g,0);if(w||$||E||k){const[t,e]=this.disabled;let s=h,i=l;t||(s=lt(at(h+(E||k),0,r-o),0),this.coords[0]-=h-s),e||(i=lt(at(l+(w||$),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[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-h,n-l),this.angle=rt(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.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return Ke(this,null,"x"),Ke(this,null,"y"),Ke(this,null,"progressX"),Ke(this,null,"progressY"),Ke(this.scroll),Ke(this.overshootCoords),this}scrollInView(t,e=0,s=fe.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,c,d]=o,p=lt(at(r-h,-1e12,0),0),m=lt(at(i-l,0,u),0),f=lt(at(r-c,0,u),0),g=lt(at(i-d,-1e12,0),0);new Ne(n,{x:lt(n.x+(g?g-e:m?m+e:0),0),y:lt(n.y+(p?p-e:f?f+e:0),0),duration:O(t)?350*D.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=Ze(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=fe.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,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-a-e,u=this.scroll.x-this.targetBounds[3]+h+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=at(ct(i,this.snapX),u,c),a=at(ct(r,this.snapY),l,d),h=O(t)?350*D.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 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),[h,l,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/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=Ge(this.$target,"zIndex",!1);gs=(f>gs?f:gs)+1,this.targetStyles=Ze(this.$target,{zIndex:gs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=Ze(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,fe.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 h=t.target,l=!1,c=!1,d=!1;for(;e&&h&&h!==this.$trigger;){const t=Ge(h,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=h;if(e>s){d=!0,l=t<=3,c=t>=e-s-3;break}}h=h.parentNode}d&&(!l&&!c||l&&a<0||c&&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):(us(t),this.triggerStyles||(this.triggerStyles=Ze(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",us,{passive:!1}),this.$trigger.addEventListener("touchmove",us,{passive:!1}),this.$trigger.addEventListener("touchend",us),(!this.disabled[0]&&J(o)>3||!this.disabled[1]&&J(a)>3)&&(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,h,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,_=this.releaseYSpring,y=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,S=this.x,x=this.y,T=this.computeVelocity(s-h,n-l),w=this.angle=rt(n-a,s-o),k=150*T,$=(1-this.releaseContainerFriction)*this.dragSpeed,E=S+Z(w)*k,C=x+G(w)*k,B=E>d?d+(E-d)*$:E<p?p+(E-p)*$:E,L=C>u?u+(C-u)*$:C<c?c+(C-c)*$:C,A=this.destX=at(lt(ct(B,this.snapX),5),p,d),N=this.destY=at(lt(ct(L,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,E,C);let P=0,R=0,Y=y,X=y,M=0;if(b.x=S,b.y=x,!t){const t=A===d?S>d?-1:1:S<p?-1:1,s=lt(S-A,0);g.velocity=e&&v?s?k*t/J(s):0:T;const{ease:i,duration:r,restDuration:n}=g;P=S===A?0:v?r:r-n*D.timeScale,v&&(Y=i),P>M&&(M=P)}if(!e){const e=N===u?x>u?-1:1:x<c?-1:1,s=lt(x-N,0);_.velocity=t&&v?s?k*e/J(s):0:T;const{ease:i,duration:r,restDuration:n}=_;R=x===N?0:v?r:r-n*D.timeScale,v&&(X=i),R>M&&(M=R)}if(!v&&F&&$&&(P||R)){const t=r.blend;new Ne(b,{x:{to:B,duration:.65*P},y:{to:L,duration:.65*R},ease:y,composition:t}).init(),new Ne(b,{x:{to:A,duration:P},y:{to:N,duration:R},ease:y,composition:t}).init(),this.overshootXTicker.stretch(P).restart(),this.overshootYTicker.stretch(R).restart()}else t||this.animate[this.xProp](A,P,Y),e||this.animate[this.yProp](N,R,X);this.scrollInView(M,this.scrollThreshold,y);let O=!1;A!==m&&(this.snapped[0]=A,this.snapX&&(O=!0)),N!==f&&this.snapY&&(this.snapped[1]=N,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",us),this.$trigger.removeEventListener("touchmove",us),this.$trigger.removeEventListener("touchend",us),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=Ze(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":us(t)}}}class ys{constructor(t={}){D.scope&&D.scope.revertibles.push(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||Dt(e)[0]||i);const n=t.defaults,o=D.defaults,a=t.mediaQueries;if(this.defaults=n?ft(n,o):o,this.root=r,this.constructors=[],this.revertConstructors=[],this.revertibles=[],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)}}execute(t){let e=D.scope,s=D.root,i=D.defaults;D.scope=this,D.root=this.root,D.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return D.scope=e,D.root=s,D.defaults=i,n}refresh(){return 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);e&&this.revertConstructors.push(e)}))})),this}add(t,e){if(M(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);t&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}handleEvent(t){"change"===t.type&&this.refresh()}revert(){const t=this.revertibles,e=this.revertConstructors,s=this.mediaQueryLists;let i=t.length,r=e.length;for(;i--;)t[i].revert();for(;r--;)e[r](this);for(let t in s)s[t].removeEventListener("change",this);t.length=0,e.length=0,this.constructors.length=0,this.matches={},this.methods={},this.mediaQueryLists={},this.data={}}}const vs=(t,e)=>t&&M(t)?t(e):t,bs=new Map;class Ss{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.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 se({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;gt(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new se({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=lt(e>0?Math.sqrt(o*o+a*a)/e:0,5)}}).init(),this.resizeTicker=new se({autoplay:!1,duration:250*D.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new se({autoplay:!1,duration:500*D.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=lt(t?s.scrollX:e.scrollLeft,0),this.scrollY=lt(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=document.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){gt(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),gt(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.unobserve(this.element),(this.useWin?s:this.element).removeEventListener("scroll",this),bs.delete(this.element)}}const xs=(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}=Vt(a,Ht);let c=h;return"%"===l?c=h/100*s:l&&(c=xe(t,Ht,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},Ts=(t,e,s,i,r)=>{let n;if(X(e)){const o=C.exec(e);if(o){const a=o[0],h=a[0],l=e.split(a),c="min"===l[0],d="max"===l[0],u=xs(t,l[0],s,i,r),p=xs(t,l[1],s,i,r);if(c){const e=Wt(xs(t,"min",s),p,h);n=e<u?u:e}else if(d){const e=Wt(xs(t,"max",s),p,h);n=e>u?u:e}else n=Wt(u,p,h)}else n=xs(t,e,s,i,r)}else n=e;return lt(n,0)},ws=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 ks=0;const $s=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Es{constructor(t={}){D.scope&&D.scope.revertibles.push(this);const e=Xt(t.sync,"play pause"),s=e?_e(e):null,r=e&&("linear"===e||e===ie),n=e&&!(s===ie&&!r),o=e&&(Y(e)||!0===e||r),a=e&&X(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=ks++,this.id=O(t.id)?this.index:t.id,this.container=(t=>{const e=t&&Dt(t)[0]||i.body;let s=bs.get(e);return s||(s=new Ss(e),bs.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||!!h,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=h&&!l&&h[0]?h[0]:y,this.onSyncLeave=h&&!l&&h[1]?h[1]:y,this.onSyncEnterForward=h&&l&&h[0]?h[0]:y,this.onSyncLeaveForward=h&&l&&h[1]?h[1]:y,this.onSyncEnterBackward=h&&l&&h[2]?h[2]:y,this.onSyncLeaveBackward=h&&l&&h[3]?h[3]:y,this.onEnter=t.onEnter||y,this.onLeave=t.onLeave||y,this.onEnterForward=t.onEnterForward||y,this.onLeaveForward=t.onLeaveForward||y,this.onEnterBackward=t.onEnterBackward||y,this.onLeaveBackward=t.onLeaveBackward||y,this.onUpdate=t.onUpdate||y,this.onSyncComplete=t.onSyncComplete||y,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=Xt(t.debug,!1),this._next=null,this._prev=null,yt(this.container,this),je((()=>{if(!this.reverted){if(!this.target){const e=Dt(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;O(t.targets)?gt(t,(t=>{t.targets&&!e&&(e=ws(t))})):e=ws(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:lt(at(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=Xt(vs(t.repeat,this),!0),this.horizontal="x"===Xt(vs(t.axis,this),"y"),this.enter=Xt(vs(t.enter,this),"end start"),this.leave=Xt(vs(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=$s[this.index%$s.length],h=t.useWin,l=h?t.winWidth:t.width,c=h?t.winHeight:t.height,d=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,_=e?g:15,y=e?60:g,v=e?y:_,b=e?"repeat-x":"repeat-y",S=t=>e?"0px "+t+"px":t+"px 2px",x=t=>`linear-gradient(${e?90:0}deg, ${t} 2px, transparent 1px)`,T=(t,e,s,i,r)=>`position:${t};left:${e}px;top:${s}px;width:${i}px;height:${r}px;`;r.style.cssText=`${T("absolute",m,f,e?d: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=`${T("sticky",0,0,e?l:g,e?g:c)}`,s||(n.style.cssText+=`background:\n ${x("#FFFF")}${S(g-10)} / 100px 100px ${b},\n ${x("#FFF8")}${S(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${T("relative",0,0,e?d:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${x("#FFFF")}${S(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${x("#FFF8")}${S(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const w=[" enter: "," leave: "];this.coords.forEach(((t,s)=>{const r=s>1,h=(r?0:this.offset)+t,m=s%2,f=h<v,g=h>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,S=i.createElement("div"),x=i.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?y:_)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;x.innerHTML=`${this.id}${w[m]}${this.thresholds[s]}`,S.style.cssText=`${T("absolute",0,0,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-${k}: 2px solid ${a};\n `,x.style.cssText=`\n overflow: hidden;\n max-width: ${p/2-10}px;\n height: ${_};\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 `,S.appendChild(x);let E=h-$+(e?1:0);S.style[e?"left":"top"]=`${E}px`,(r?n:o).appendChild(S)})),r.appendChild(n),r.appendChild(o),t.element.appendChild(r),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===Ge(t.element,"position")&&(this.debugStyles=Ze(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,h=0,l=0,c=a;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===Ge(s.element,"position")&&Ze(s.element,{position:"relative "});for(;a&&a!==s.element&&a!==i.body;){const e="sticky"===Ge(a,"position")&&Ze(a,{position:"static"});a===c&&(h+=a.offsetLeft||0,l+=a.offsetTop||0,c=a.offsetParent),a=a.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?h:l,p=r?e.offsetWidth:e.offsetHeight,m=r?s.width:s.height,f=(r?s.scrollWidth:s.scrollHeight)-m,g=this.enter,_=this.leave;let y="start",v="end",b="end",S="start";if(X(g)){const t=g.split(" ");b=t[0],y=t.length>1?t[1]:y}else if(R(g)){const t=g;O(t.container)||(b=t.container),O(t.target)||(y=t.target)}else Y(g)&&(b=g);if(X(_)){const t=_.split(" ");S=t[0],v=t.length>1?t[1]:v}else if(R(_)){const t=_;O(t.container)||(S=t.container),O(t.target)||(v=t.target)}else Y(_)&&(S=_);const x=Ts(e,y,p),T=Ts(e,v,p),w=x+u-m,k=T+u-f,$=Ts(e,b,m,w,k),E=Ts(e,S,m,w,k),C=x+u-$,B=T+u-E,D=B-C;this.offsets[0]=h,this.offsets[1]=l,this.offset=u,this.offsetStart=C,this.offsetEnd=B,this.distance=D<=0?0:D,this.thresholds=[y,v,b,S],this.coords=[x,T,$,E],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){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,c=!h&&!l,d=a===this.offsetStart||a===this.offsetEnd,u=!this.hasEntered&&d,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&&Y(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=lt(ss(e,g,dt(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 _t(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}t.Animatable=ls,t.Draggable=_s,t.JSAnimation=Ne,t.Scope=ys,t.ScrollObserver=Es,t.Spring=cs,t.Timeline=hs,t.Timer=se,t.WAAPIAnimation=qe,t.animate=(t,e)=>new Ne(t,e,null,0,!1).init(),t.createAnimatable=(t,e)=>new ls(t,e),t.createDraggable=(t,e)=>new _s(t,e),t.createScope=t=>new ys(t),t.createSpring=ds,t.createTimeline=t=>new hs(t).init(),t.createTimer=t=>new se(t,null,0).init(),t.eases=fe,t.engine=$t,t.onScroll=(t={})=>new Es(t),t.scrollContainers=bs,t.stagger=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,a=!O(o),h=a&&!O(o.ease)?o.ease:a?_e(o):null,l=e.grid,c=e.axis,d=O(r)||0===r||"first"===r,u="center"===r,p="last"===r,f=P(t),g=q(f?t[0]:t),_=f?q(t[1]):0,y=k.exec((f?t[1]:t)+m),v=e.start||0+(f?g:0);let b=d?0:Y(r)?r:0;return(t,r,o,a)=>{if(u&&(b=(o-1)/2),p&&(b=o-1),!s.length){for(let t=0;t<o;t++){if(l){const e=u?(l[0]-1)/2:b%l[0],i=u?(l[1]-1)/2:et(b/l[0]),r=e-t%l[0],n=i-et(t/l[0]);let o=j(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(J(b-t));i=it(...s)}h&&(s=s.map((t=>h(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:J(i-t))))}const d=f?(_-g)/i:g;let m=(a?os(a,O(e.start)?a.iterationDuration:v):v)+(d*lt(s[r],2)||0);return e.modifier&&(m=e.modifier(m)),y&&(m=`${m}${y[2]}`),m}},t.svg=Rt,t.utils=ns,t.waapi=Qe}));
+!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(),h=Symbol(),a=Symbol(),l=Symbol(),c=Symbol(),d=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","perspective","matrix","matrix3d"],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,w=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,x=/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,k=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,$=/([a-z])([A-Z])/g,C=/(\w+)(\([^)]+\)+)/g,E=/(\*=|\+=|-=)/,B={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:120,loop:0,reversed:!1,alternate:!1,autoplay:!0,duration:p,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:_,onBeforeUpdate:_,onUpdate:_,onLoop:_,onPause:_,onComplete:_,onRender:_},L={current:null,root:i},D={defaults:B,precision:4,timeScale:1,tickThreshold:200},A={version:"4.1.0",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(A));const N=t=>t.replace($,"$1-$2").toLowerCase(),F=(t,e)=>0===t.indexOf(e),O=Date.now,P=Array.isArray,M=t=>t&&t.constructor===Object,R=t=>"number"==typeof t&&!isNaN(t),Y=t=>"string"==typeof t,I=t=>"function"==typeof t,X=t=>void 0===t,z=t=>X(t)||null===t,W=t=>e&&t instanceof SVGElement,V=t=>v.test(t),H=t=>F(t,"rgb"),U=t=>F(t,"hsl"),q=t=>!D.defaults.hasOwnProperty(t),Q=t=>Y(t)?parseFloat(t):t,j=Math.pow,G=Math.sqrt,Z=Math.sin,J=Math.cos,K=Math.abs,tt=Math.exp,et=Math.ceil,st=Math.floor,it=Math.asin,rt=Math.max,nt=Math.atan2,ot=Math.PI,ht=Math.round,at=(t,e,s)=>t<e?e:t>s?s:t,lt={},ct=(t,e)=>{if(e<0)return t;if(!e)return ht(t);let s=lt[e];return s||(s=lt[e]=10**e),ht(t*s)/s},dt=(t,e)=>P(e)?e.reduce(((e,s)=>K(s-t)<K(e-t)?s:e)):e?ht(t/e)*e:t,ut=(t,e,s)=>t+(e-t)*s,pt=(t,e,s)=>{const i=10**(s||0);return st((Math.random()*(e-t+1/i)+t)*i)/i},mt=t=>{let e,s,i=t.length;for(;i;)s=pt(0,--i),e=t[i],t[i]=t[s],t[s]=e;return t},ft=t=>t===1/0?u:t===-1/0?-1e12:t,gt=t=>t<=d?d:ft(ct(t,11)),yt=t=>P(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},vt=(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}},bt=(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},Tt=(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=>{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 h=t(...s);return h&&!I(h)&&h.revert&&(e=h),X(r)||(e.currentIteration=i,e.iterationProgress=(o&&i%2?!n:n)?1-r:r),h||_}};class xt{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._elapsedTime=t,this._startTime=t,this._lastTime=t,this._scheduledTime=0,this._frameDuration=ct(p/120,0),this._fps=120,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<d?d:s,r=ct(p/i,0);this._fps=i,this._frameDuration=r,this._scheduledTime+=r-e}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<d?d:e}requestTick(t){const e=this._scheduledTime,s=this._elapsedTime;if(this._elapsedTime+=t-s,s<e)return 0;const i=this._frameDuration,r=s-e;return this._scheduledTime+=r<i?i:r,1}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const St=(t,e,s,i,n)=>{const o=t.parent,h=t.duration,l=t.completed,c=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,f=t._loopDelay,g=t._reversed,_=t._alternate,v=t._hasChildren,b=t._delay,T=t._currentTime,w=b+c,x=e-b,S=at(T,-b,h),k=at(x,-b,h),$=x-T,C=k>0,E=k>=h,B=h<=d,L=2===n;let A=0,N=x,F=0;if(u>1){const e=~~(k/(c+(E?0:f)));t._currentIteration=at(e,0,u),E&&t._currentIteration--,A=t._currentIteration%2,N=k%(c+f)||0}const O=g^(_&&A),P=t._ease;let M=E?O?0:h:O?c-N:N;P&&(M=c*P(M/c)||0);const R=(o?o.backwards:x<T)?!O:!!O;if(t._currentTime=x,t._iterationTime=M,t.backwards=R,C&&!t.began?(t.began=!0,s||o&&(R||!o.began)||t.onBegin(t)):x<=0&&(t.began=!1),s||v||!C||t._currentIteration===p||t.onLoop(t),L||1===n&&(e>=b&&e<=w||e<=b&&S>b||e>=w&&S!==h)||M>=w&&S!==h||M<=b&&S>0||e<=S&&S===h&&l||E&&!l&&B){if(C&&(t.computeDeltaTime(S),s||t.onBeforeUpdate(t)),!v){const e=L||(R?-1*$:$)>=D.tickThreshold,n=t._offset+(o?o._offset:0)+b+M;let h,l,c,d,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,_=u._prevRep,v=t!==r.none;if((e||(s!==o||n<=f+(g?g._delay:0))&&(0!==s||n>=u._absoluteStartTime))&&(!v||!u._isOverridden&&(!u._isOverlapped||n<=f)&&(!g||g._isOverridden||n<=g._absoluteStartTime)&&(!_||_._isOverridden||n>=_._absoluteStartTime+_._changeDuration+u._delay))){const e=u._currentTime=at(M-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,_=y&&g||0===s||1===s?-1:D.precision;let b,T;if(y)b=T=n(ct(ut(u._fromNumber,u._toNumber,s),_));else if(1===m)T=n(ct(ut(u._fromNumber,u._toNumber,s),_)),b=`${T}${u._unit}`;else if(2===m){const t=u._fromNumbers,e=u._toNumbers,i=ct(at(n(ut(t[0],e[0],s)),0,255),0),r=ct(at(n(ut(t[1],e[1],s)),0,255),0),o=ct(at(n(ut(t[2],e[2],s)),0,255),0),h=at(n(ct(ut(t[3],e[3],s),_)),0,1);if(b=`rgba(${i},${r},${o},${h})`,v){const t=u._numbers;t[0]=i,t[1]=r,t[2]=o,t[3]=h}}else if(3===m){b=u._strings[0];for(let t=0,e=u._toNumbers.length;t<e;t++){const e=n(ct(ut(u._fromNumbers[t],u._toNumbers[t],s),_)),i=u._strings[t+1];b+=`${i?e+i:e}`,v&&(u._numbers[t]=e)}}if(v&&(u._number=T),i||t===r.blend)u._value=b;else{const t=u.property;h=u.target,g?h[t]=b:1===f?h.setAttribute(t,b):(l=h.style,3===f?(h!==c&&(c=h,d=h[a]),d[t]=b,p=1):2===f?l[t]=b:4===f&&l.setProperty(t,b)),C&&(F=1)}}if(p&&u._renderTransforms){let t=m;for(let e in d)t+=`${y[e]}${d[e]}) `;l.transform=t,p=0}u=u._next}!s&&F&&t.onRender(t)}!s&&C&&t.onUpdate(t)}return o&&B?!s&&(o.began&&!R&&x>=h&&!l||R&&x<=d&&l)&&(t.onComplete(t),t.completed=!R):C&&E?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,l||v||(t.completed=!0,s||o&&(R||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,F},kt=(t,e,s,i,r)=>{const n=t._currentIteration;if(St(t,e,s,i,r),t._hasChildren){const o=t,h=o.backwards,a=i?e:o._iterationTime,l=O();let c=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;vt(o,(e=>{if(h){const i=e.duration,r=e._offset+e._delay;s||!(i<=d)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&St(e,t,s,1,2),e.began=!1,e.completed=!1})),s||o.onLoop(o)}vt(o,(t=>{const e=ct((a-t._offset)*t._speed,12),n=t._fps<o._fps?t.requestTick(l):r;c+=St(t,e,s,i,n),!t.completed&&u&&(u=!1)}),h),!s&&c&&o.onRender(o),u&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},$t={animation:null,update:_},Ct=(()=>e?requestAnimationFrame:setImmediate)(),Et=(()=>e?cancelAnimationFrame:clearImmediate)();class Bt extends xt{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=B,this.paused=!(!e||!i.hidden),this.reqId=null}update(){const t=this._currentTime=O();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?(bt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):kt(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}$t.update()}}wake(){return!this.useDefaultMainLoop||this.reqId||this.paused||(this.reqId=Ct(Dt)),this}pause(){return this.paused=!0,At()}resume(){if(this.paused)return this.paused=!1,vt(this,(t=>t.resetTime())),this.wake()}get speed(){return this._speed*(1===D.timeScale?1:p)}set speed(t){this._speed=t*D.timeScale,vt(this,(t=>t.speed=t._speed))}get timeUnit(){return 1===D.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(D.timeScale!==s){D.timeScale=s,D.tickThreshold=200*s;const t=e?.001:p;this.defaults.duration*=t,this._speed*=t}}get precision(){return D.precision}set precision(t){D.precision=t}}const Lt=(()=>{const t=new Bt(O());return e&&(A.engine=t,i.addEventListener("visibilitychange",(()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())}))),t})(),Dt=()=>{Lt._head?(Lt.reqId=Ct(Dt),Lt.update()):Lt.reqId=0},At=()=>(Et(Lt.reqId),Lt.reqId=0,Lt);function Nt(t){const e=Y(t)?L.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function Ft(t){if(z(t))return[];if(P(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!z(i)){const t=Nt(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!z(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}if(!e)return[t];const s=Nt(t);return s?Array.from(s):[t]}function Ot(t){const e=Ft(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[h]=t,s[a]={})}}return e}const Pt=t=>{const e=Ft(t)[0];if(e&&W(e))return e},Mt=(t,e,s=0)=>t.getPointAtLength(e+s>=1?e+s:0),Rt=(t,e)=>s=>{const i=+t.getTotalLength(),r=s[h],n=t.getCTM();return{from:0,to:i,modifier:s=>{if("a"===e){const e=Mt(t,s,-1),i=Mt(t,s,1);return 180*nt(i.y-e.y,i.x-e.x)/ot}{const i=Mt(t,s,0);return"x"===e?r||!n?i.x:i.x*n.a+i.y*n.c+n.e:r||!n?i.y:i.x*n.b+i.y*n.d+n.f}}}},Yt=["opacity","rotate","overflow","color"],It={morphTo:(t,e=.33)=>s=>{const i=Pt(t);if(!i)return;const r="path"===s.tagName,n=r?" ":",",o=s[l];o&&s.setAttribute(r?"d":"points",o);let h="",a="";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 c=e/(l-1),d=s.getPointAtLength(t*c),u=i.getPointAtLength(o*c),p=r?0===e?"M":"L":"";h+=p+ct(d.x,3)+n+d.y+" ",a+=p+ct(u.x,3)+n+u.y+" "}}else h=s.getAttribute(r?"d":"points"),a=i.getAttribute(r?"d":"points");return s[l]=a,[h,a]},createMotionPath:t=>{const e=Pt(t);if(e)return{translateX:Rt(e,"x"),translateY:Rt(e,"y"),rotate:Rt(e,"a")}},createDrawable:(t,e=0,s=0)=>Ft(t).map((t=>((t,e,s)=>{const i=p,r=getComputedStyle(t),n=r.strokeLinecap,o="non-scaling-stroke"===r.vectorEffect?t:null;let h=n;const a=new Proxy(t,{get(t,e){const s=t[e];return e===c?t:"setAttribute"===e?(...e)=>{if("draw"===e[0]){const s=e[1].split(" "),r=+s[0],a=+s[1],l=(t=>{let e=1;if(t&&t.getCTM){const s=t.getCTM();s&&(e=(G(s.a*s.a+s.b*s.b)+G(s.c*s.c+s.d*s.d))/2)}return e})(o),c=-1e3*r*l,d=a*i*l+c,u=i*l+(0===r&&1===a||1===r&&0===a?0:10*l)-d;if("butt"!==n){const e=r===a?"butt":n;h!==e&&(t.style.strokeLinecap=`${e}`,h=e)}t.setAttribute("stroke-dashoffset",`${c}`),t.setAttribute("stroke-dasharray",`${d} ${u}`)}return Reflect.apply(s,t,e)}:I(s)?(...e)=>Reflect.apply(s,t,e):s}});return"1000"!==t.getAttribute("pathLength")&&(t.setAttribute("pathLength","1000"),a.setAttribute("draw",`${e} ${s}`)),a})(t,e,s)))},Xt=(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),zt=(t,e)=>X(t)?e:t,Wt=(t,e,s,i,r)=>{if(I(t)){const n=()=>{const r=t(e,s,i);return isNaN(+r)?r||0:+r};return r&&(r.func=n),n()}return t},Vt=(t,e)=>t[o]?t[h]&&((t,e)=>{if(Yt.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:F(e,"--")?4:e in t.style?2:e in t?0:1:0,Ht=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[c]||t).getPropertyValue(e);return"auto"===r?"0":r},Ut=(t,e,s,i)=>{const r=X(s)?Vt(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[a];let o;for(;o=C.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:F(e,"scale")?"1":F(e,"rotate")||F(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Ht(t,e,i).trimStart():Ht(t,e,i)},qt=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,Qt=(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(" ")&&k.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(V(r=s)||H(r)||U(r))return e.t=2,e.d=H(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):V(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):U(i)?(t=>{const e=w.exec(t)||x.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=X(e[4])?1:+e[4];let o,h,a;if(0===i)o=h=a=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=ct(255*Xt(e,t,s+1/3),0),h=ct(255*Xt(e,t,s),0),a=ct(255*Xt(e,t,s-1/3),0)}return[o,h,a,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},jt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=yt(t._toNumbers),e.s=yt(t._strings),e),Gt={t:0,n:0,u:null,o:null,d:null,s:null},Zt={_rep:new WeakMap,_add:new Map},Jt=(t,e,s="_rep")=>{const i=Zt[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Kt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,te=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=d,t._currentTime=d},ee=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;Tt(e,t,Kt,"_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){te(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)te(t),t=t._prevRep}const n=s-t._delay;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration);i._changeDuration=n-e-t,i._currentTime=i._changeDuration,i._isOverlapped=1,i._changeDuration<d&&te(i)}let o=!0;if(vt(e,(t=>{t._isOverlapped||(o=!1)})),o){const t=e.parent;if(t){let s=!0;vt(t,(t=>{t!==e&&vt(t,(t=>{t._isOverlapped||(s=!1)}))})),s&&t.cancel()}else e.cancel()}}}else if(s===r.blend){const e=Jt(t.target,t.property,"_add"),s=(t=>{let e=$t.animation;return e||(e={duration:d,computeDeltaTime:_,_offset:0,_delay:0,_head:null,_tail:null},$t.animation=e,$t.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?yt(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}}})),St(e,1,1,0,2)}),e})(Zt._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=d,i._startTime=0,i._numbers=yt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,Tt(e,i),Tt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=yt(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers){const e=yt(t._toNumbers);e&&e.forEach(((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0})),i._fromNumbers=e}Tt(e,t,null,"_prevAdd","_nextAdd")}return t},se=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=Zt._rep.get(s)[i];if(bt(n,t,"_prevRep","_nextRep"),e===r.blend){const e=Zt._add,r=e.get(s);if(!r)return;const n=r[i],o=$t.animation;bt(n,t,"_prevAdd","_nextAdd");const h=n._head;if(h&&h===n._tail){bt(n,h,"_prevAdd","_nextAdd"),bt(o,h);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},ie=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),re=t=>t._cancelled?(t._hasChildren?vt(t,re):vt(t,(t=>{t._composition!==r.none&&ee(t,Jt(t.target,t.property))})),t._cancelled=0,t):t;let ne=0;class oe extends xt{constructor(t={},e=null,s=0){super(0);const{id:i,delay:r,duration:n,reversed:o,alternate:h,loop:a,loopDelay:l,autoplay:c,frameRate:u,playbackRate:p,onComplete:m,onLoop:f,onPause:g,onBegin:y,onBeforeUpdate:v,onUpdate:b}=t;L.current&&L.current.register(this);const T=e?0:Lt._elapsedTime,w=e?e.defaults:D.defaults,x=I(r)||X(r)?w.delay:+r,S=I(n)||X(n)?1/0:+n,k=zt(a,w.loop),$=zt(l,w.loopDelay),C=!0===k||k===1/0||k<0?1/0:k+1;let E=0;if(e)E=s;else{let t=O();Lt.paused&&(Lt.requestTick(t),t=Lt._elapsedTime),E=t-Lt._startTime}this.id=X(i)?++ne:i,this.parent=e,this.duration=ft((S+$)*C-$)||d,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=y||w.onBegin,this.onBeforeUpdate=v||w.onBeforeUpdate,this.onUpdate=b||w.onUpdate,this.onLoop=f||w.onLoop,this.onPause=g||w.onPause,this.onComplete=m||w.onComplete,this.iterationDuration=S,this.iterationCount=C,this._autoplay=!e&&zt(c,w.autoplay),this._offset=E,this._delay=x,this._loopDelay=$,this._iterationTime=0,this._currentIteration=0,this._resolve=_,this._running=!1,this._reversed=+zt(o,w.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=zt(h,w.alternate),this._prev=null,this._next=null,this._elapsedTime=T,this._startTime=T,this._lastTime=T,this._fps=zt(u,w.frameRate),this._speed=zt(p,w.playbackRate)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(1).play()}get currentTime(){return at(ct(this._currentTime,D.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return ct(this._iterationTime,D.precision)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return at(ct(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return at(ct(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*at(+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=0){return re(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,kt(this,0,1,t,2),ie(this),this._hasChildren&&vt(this,ie),this}init(t=0){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&kt(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*Lt._speed);return this._startTime=O()-(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<=d&&!this._hasChildren?kt(this,d,0,0,2):(this._running||(Tt(Lt,this),Lt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,Lt.wake()),this):this}restart(){return this.reset(0).resume()}seek(t,e=0,s=0){re(this),this.completed=!1;const i=this.paused;return this.paused=!0,kt(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?st(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?vt(this,(t=>t.cancel()),!0):vt(this,se),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=gt(t);if(e===s)return this;const i=t/e,r=t<=d;return this.duration=r?d:s,this.iterationDuration=r?d:gt(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){kt(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=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const he=t=>t,ae=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,le=(t=.5,e=0,s=.5,i=1)=>t===e&&s===i?he:r=>0===r||1===r?r:ae(((t,e,s)=>{let i,r,n=0,o=1,h=0;do{r=n+(o-n)/2,i=ae(r,e,s)-t,i>0?o=r:n=r}while(K(i)>1e-7&&++h<100);return r})(r,t,s),e,i),ce=(t=10,e)=>{const s=e?et:st;return e=>s(at(e,0,1)*t)*(1/t)},de=(...t)=>{const e=t.length;if(!e)return he;const s=e-1,i=t[0],r=t[s],n=[0],o=[Q(i)];for(let e=1;e<s;e++){const i=t[e],r=Y(i)?i.trim().split(" "):[i],h=r[0],a=r[1];n.push(X(a)?e/s:Q(a)/100),o.push(Q(h))}return o.push(Q(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]}},ue=(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(at(o,r,1))}return s.push(1),de(...s)},pe=ot/2,me=2*ot,fe=(t=1.68)=>e=>j(e,+t),ge={[m]:fe,Quad:fe(2),Cubic:fe(3),Quart:fe(4),Quint:fe(5),Sine:t=>1-J(t*pe),Circ:t=>1-G(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.70158)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=at(+t,1,10),i=at(+e,d,2),r=i/me*it(1/s),n=me/i;return t=>0===t||1===t?t:-s*j(2,-10*(1-t))*Z((1-t-r)*n)}},ye={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},_e=(t,e,s)=>{if(s[t])return s[t];if(t.indexOf("(")<=-1){const i=ye[t]||t.includes("Back")||t.includes("Elastic")?e[t]():e[t];return i?s[t]=i:he}{const i=t.slice(0,-1).split("("),r=e[i[0]];return r?s[t]=r(...i[1].split(",")):he}},ve=(()=>{const t={linear:de,irregular:ue,steps:ce,cubicBezier:le};for(let e in ye)for(let s in ge){const i=ge[s],r=ye[e];t[e+s]=s===m||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),be={linear:he},Te=t=>I(t)?t:Y(t)?_e(t,ve,be):he,we={},xe=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&W(e)&&t in e.style){const e=we[t];if(e)return e;{const e=t?N(t):t;return we[t]=e,e}}return t},Se={deg:1,rad:180/ot,turn:360},ke={},$e=(t,e,s,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===s)return e;const h=o+n+s,a=ke[h];if(X(a)||r){let r;if(n in Se)r=o*Se[n]/Se[s];else{const e=100,h=t.cloneNode(),a=t.parentNode,l=a&&a!==i?a:i.body;l.appendChild(h);const c=h.style;c.width=e+n;const d=h.offsetWidth||e;c.width=e+s;const u=d/(h.offsetWidth||e);l.removeChild(h),r=u*o}e.n=r,ke[h]=r}else e.n=a;return e.t,e.u=s,e},Ce=t=>{if(t._hasChildren)vt(t,Ce,!0);else{const e=t;e.pause(),vt(e,(t=>{const s=t.property,i=t.target;if(i[o]){const r=i.style,n=e._inlineStyles[s];if(3===t._tweenType){const e=i[a];if(X(n)||n===m?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 X(n)||n===m?r.removeProperty(s):r[s]=n;e._tail===t&&e.targets.forEach((t=>{t.getAttribute&&t.getAttribute("style")===m&&t.removeAttribute("style")}))}}))}return t},Ee={t:0,n:0,u:null,o:null,d:null,s:null},Be={t:0,n:0,u:null,o:null,d:null,s:null},Le={func:null},De=[null],Ae=[null,null],Ne={to:null};let Fe,Oe,Pe=0;class Me extends oe{constructor(t,e,s,i,n=!1,o=0,h=0){super(e,s,i);const a=Ot(t),l=a.length,c=e.keyframes,u=c?_t(((t,e)=>{const s={};if(P(t)){const e=[].concat(...t.map((t=>Object.keys(t)))).filter(q);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];q(s)?s===r&&(e.to=i):e[s]=i}return e}));s[r]=n}}else{const i=zt(e.duration,D.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(q(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let h=n.length,a=n[h-1];const l={to:r[t]};let c=0;for(let t=0;t<h;t++)c+=n[t].duration;1===h&&(l.from=a.to),r.ease&&(l.ease=r.ease),l.duration=o-(h?c: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})(c,e),e):e,{delay:m,duration:f,ease:g,playbackEase:y,modifier:_,composition:v,onRender:b}=u,T=s?s.defaults:D.defaults,w=zt(y,T.playbackEase),x=w?Te(w):null,S=!X(g)&&!X(g.ease),k=S?g.ease:zt(g,x?"linear":T.ease),$=S?g.duration:zt(f,T.duration),C=zt(m,T.delay),E=_||T.modifier,B=X(v)&&l>=p?r.none:X(v)?T.composition:v,L={},A=this._offset+(s?s._offset:0);let N=NaN,F=NaN,O=0,Y=0;for(let t=0;t<l;t++){const e=a[t],i=o||t,c=h||l;let p=NaN,m=NaN;for(let t in u)if(q(t)){const o=Vt(e,t),h=xe(t,e,o);let a=u[t];const l=P(a);if(n&&!l&&(Ae[0]=a,Ae[1]=a,a=Ae),l){const t=a.length,e=!M(a[0]);2===t&&e?(Ne.to=a,De[0]=Ne,Fe=De):t>2&&e?(Fe=[],a.forEach(((t,e)=>{e?1===e?(Ae[1]=t,Fe.push(Ae)):Fe.push(t):Ae[0]=t}))):Fe=a}else De[0]=a,Fe=De;let f=null,g=null,y=NaN,_=0,v=0;for(let t=Fe.length;v<t;v++){const n=Fe[v];M(n)?Oe=n:(Ne.to=n,Oe=Ne),Le.func=null;const a=Wt(Oe.to,e,i,c,Le);let l;M(a)&&!X(a.to)?(Oe=a,l=a.to):l=a;const u=Wt(Oe.from,e,i,c),p=Oe.ease,m=!X(p)&&!X(p.ease),b=m?p.ease:p||k,T=m?p.duration:Wt(zt(Oe.duration,t>1?Wt($,e,i,c)/t:$),e,i,c),w=Wt(zt(Oe.delay,v?0:C),e,i,c),x=Wt(zt(Oe.composition,B),e,i,c),S=R(x)?x:r[x],D=Oe.modifier||E,N=!X(u),F=!X(l),I=P(l),z=I||N&&F,W=g?_+w:w,V=A+W;Y||!N&&!I||(Y=1);let H=g;if(S!==r.none){f||(f=Jt(e,h));let t=f._head;for(;t&&!t._isOverridden&&t._absoluteStartTime<=V;)if(H=t,t=t._nextRep,t&&t._absoluteStartTime>=V)for(;t;)te(t),t=t._nextRep}if(z?(Qt(I?Wt(l[0],e,i,c):u,Ee),Qt(I?Wt(l[1],e,i,c,Le):l,Be),0===Ee.t&&(H?1===H._valueType&&(Ee.t=1,Ee.u=H._unit):(Qt(Ut(e,h,o,L),Gt),1===Gt.t&&(Ee.t=1,Ee.u=Gt.u)))):(F?Qt(l,Be):g?jt(g,Be):Qt(s&&H&&H.parent.parent===s?H._value:Ut(e,h,o,L),Be),N?Qt(u,Ee):g?jt(g,Ee):Qt(s&&H&&H.parent.parent===s?H._value:Ut(e,h,o,L),Ee)),Ee.o&&(Ee.n=qt(H?H._toNumber:Qt(Ut(e,h,o,L),Gt).n,Ee.n,Ee.o)),Be.o&&(Be.n=qt(Ee.n,Be.n,Be.o)),Ee.t!==Be.t)if(3===Ee.t||3===Be.t){const t=3===Ee.t?Ee:Be,e=3===Ee.t?Be:Ee;e.t=3,e.s=yt(t.s),e.d=t.d.map((()=>e.n))}else if(1===Ee.t||1===Be.t){const t=1===Ee.t?Ee:Be,e=1===Ee.t?Be:Ee;e.t=1,e.u=t.u}else if(2===Ee.t||2===Be.t){const t=2===Ee.t?Ee:Be,e=2===Ee.t?Be:Ee;e.t=2,e.s=t.s,e.d=[0,0,0,1]}if(Ee.u!==Be.u){let t=Be.u?Ee:Be;t=$e(e,t,Be.u?Be.u:Ee.u,!1)}if(Be.d&&Ee.d&&Be.d.length!==Ee.d.length){const t=Ee.d.length>Be.d.length?Ee:Be,e=t===Ee?Be:Ee;e.d=t.d.map(((t,s)=>X(e.d[s])?0:e.d[s])),e.s=yt(t.s)}const U=ct(+T||d,12),q={parent:this,id:Pe++,property:h,target:e,_value:null,_func:Le.func,_ease:Te(b),_fromNumbers:yt(Ee.d),_toNumbers:yt(Be.d),_strings:yt(Be.s),_fromNumber:Ee.n,_toNumber:Be.n,_numbers:yt(Ee.d),_number:Ee.n,_unit:Be.u,_modifier:D,_currentTime:0,_startTime:W,_delay:+w,_updateDuration:U,_changeDuration:U,_absoluteStartTime:V,_tweenType:o,_valueType:Be.t,_composition:S,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};S!==r.none&&ee(q,f),isNaN(y)&&(y=q._startTime),_=ct(W+U,12),g=q,O++,Tt(this,q)}(isNaN(F)||y<F)&&(F=y),(isNaN(N)||_>N)&&(N=_),3===o&&(p=O-v,m=O)}if(!isNaN(p)){let t=0;vt(this,(e=>{t>=p&&t<m&&(e._renderTransforms=1,e._composition===r.blend&&vt($t.animation,(t=>{t.id===e.id&&(t._renderTransforms=1)}))),t++}))}}l||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),F?(vt(this,(t=>{t._startTime-t._delay||(t._delay-=F),t._startTime-=F})),N-=F):F=0,N||(N=d,this.iterationCount=0),this.targets=a,this.duration=N===d?d:ft((N+this._loopDelay)*this.iterationCount-this._loopDelay)||d,this.onRender=b||T.onRender,this._ease=x,this._delay=F,this.iterationDuration=N,this._inlineStyles=L,!this._autoplay&&Y&&this.onRender(this)}stretch(t){const e=this.duration;if(e===gt(t))return this;const s=t/e;return vt(this,(t=>{t._updateDuration=gt(t._updateDuration*s),t._changeDuration=gt(t._changeDuration*s),t._currentTime*=s,t._startTime*=s,t._absoluteStartTime*=s})),super.stretch(t)}refresh(){return vt(this,(t=>{const e=t._func;if(e){const s=Ut(t.target,t.property,t._tweenType);Qt(s,Gt),Qt(e(),Be),t._fromNumbers=yt(Gt.d),t._fromNumber=Gt.n,t._toNumbers=yt(Be.d),t._strings=yt(Be.s),t._toNumber=Be.n}})),this}revert(){return super.revert(),Ce(this)}then(t){return super.then(t)}}const Re=(t,e=100)=>{const s=[];for(let i=0;i<=e;i++)s.push(t(i/e));return`linear(${s.join(", ")})`},Ye={in:"ease-in",out:"ease-out",inOut:"ease-in-out"},Ie=(()=>{const t={};for(let e in ye)t[e]=t=>ye[e](fe(t));return t})(),Xe=t=>{let e=Ye[t];if(e)return e;if(e="linear",Y(t)){if(F(t,"linear")||F(t,"cubic-")||F(t,"steps")||F(t,"ease"))e=t;else if(F(t,"cubicB"))e=N(t);else{const s=_e(t,Ie,Ye);I(s)&&(e=s===he?"linear":Re(s))}Ye[t]=e}else if(I(t)){const s=Re(t);s&&(e=s)}else t.ease&&(e=Re(t.ease));return e},ze=["x","y","z"],We=["perspective","width","height","margin","padding","top","right","bottom","left","borderWidth","fontSize","borderRadius",...ze],Ve=(()=>[...ze,...g.filter((t=>["X","Y","Z"].some((e=>t.endsWith(e)))))])();let He=null;const Ue={_head:null,_tail:null},qe=(t,e,s)=>{let i=Ue._head;for(;i;){const r=i._next,n=i.$el===t,o=!e||i.property===e,h=!s||i.parent===s;if(n&&o&&h){const t=i.animation;try{t.commitStyles()}catch{}t.cancel(),bt(Ue,i);const e=i.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.muteCallbacks||(e.paused=!0,e.onComplete(e),e._resolve(e))))}i=r}},Qe=(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),Tt(Ue,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const h=()=>{qe(e,s,t)};return n.onremove=h,n.onfinish=h,n},je=(t,e,s,i,r)=>{let n=Wt(e,s,i,r);return R(n)?We.includes(t)||F(t,"translate")?`${n}px`:F(t,"rotate")||F(t,"skew")?`${n}deg`:`${n}`:n},Ge=(t,e,s,i,r,n)=>{let o="0";const h=X(i)?getComputedStyle(t)[e]:je(e,i,t,r,n);return o=X(s)?P(i)?i.map((s=>je(e,s,t,r,n))):h:[je(e,s,t,r,n),h],o};class Ze{constructor(t,s){L.current&&L.current.register(this),z(He)&&(!e||!X(CSS)&&Object.hasOwnProperty.call(CSS,"registerProperty")?(g.forEach((t=>{const e=F(t,"skew"),s=F(t,"scale"),i=F(t,"rotate"),r=F(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{}})),He=!0):He=!1);const i=Ot(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=zt(s.ease,Xe(D.defaults.ease)),o=n.ease&&n,h=zt(s.autoplay,D.defaults.autoplay),l=!(!h||!h.link)&&h,c=s.alternate&&!0===s.alternate,d=s.reversed&&!0===s.reversed,u=zt(s.loop,D.defaults.loop),v=!0===u||u===1/0?1/0:R(u)?u+1:1,b=c?d?"alternate-reverse":"alternate":d?"reverse":"normal",T=Xe(n),w=1===D.timeScale?1:p;this.targets=i,this.animations=[],this.controlAnimation=null,this.onComplete=s.onComplete||_,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!h||!1!==l,this.reversed=d,this.autoplay=h,this._speed=zt(s.playbackRate,D.defaults.playbackRate),this._resolve=_,this._completed=0,this._inlineStyles=i.map((t=>t.getAttribute("style"))),i.forEach(((t,e)=>{const i=t[a],h=Ve.some((t=>s.hasOwnProperty(t))),l=(o?o.duration:Wt(zt(s.duration,D.defaults.duration),t,e,r))*w,c=Wt(zt(s.delay,D.defaults.delay),t,e,r)*w,d=zt(s.composition,"replace");for(let o in s){if(!q(o))continue;const a={},u={iterations:v,direction:b,fill:"forwards",easing:T,duration:l,delay:c,composite:d},p=s[o],m=!!h&&(g.includes(o)?o:f.get(o));let y;if(M(p)){const s=p,h=zt(s.ease,n),f=h.ease&&h,g=s.to,_=s.from;if(u.duration=(f?f.duration:Wt(zt(s.duration,l),t,e,r))*w,u.delay=Wt(zt(s.delay,c),t,e,r)*w,u.composite=zt(s.composition,d),u.easing=Xe(h),y=Ge(t,o,_,g,e,r),m?(a[`--${m}`]=y,i[m]=y):a[o]=Ge(t,o,_,g,e,r),Qe(this,t,o,a,u),!X(_))if(m){const e=`--${m}`;t.style.setProperty(e,a[e][0])}else t.style[o]=a[o][0]}else y=P(p)?p.map((s=>je(o,s,t,e,r))):je(o,p,t,e,r),m?(a[`--${m}`]=y,i[m]=y):a[o]=y,Qe(this,t,o,a,u)}if(h){let e=m;for(let t in i)e+=`${y[t]}var(--${t})) `;t.style.transform=e}})),l&&this.autoplay.link(this)}forEach(t){const e=Y(t)?e=>e[t]():t;return this.animations.forEach(e),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=D.timeScale;return this.completed?this.duration:t?+t.currentTime*(1===e?1:e):0}set currentTime(t){const e=t*(1===D.timeScale?1:p);this.forEach((t=>{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.forEach("cancel"),this.pause()}revert(){return this.cancel(),this.targets.forEach(((t,e)=>t.setAttribute("style",this._inlineStyles[e]))),this}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise((t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this)))}}const Je={animate:(t,e)=>new Ze(t,e),convertEase:Re},Ke=(t=_)=>new oe({duration:1*D.timeScale,onComplete:t},null,0).resume();function ts(t,e,s){const i=Ot(t);if(!i.length)return;const[r]=i,n=Vt(r,e),o=xe(e,r,n);let h=Ut(r,o);if(X(s))return h;if(Qt(h,Gt),0===Gt.t||1===Gt.t){if(!1===s)return Gt.n;{const t=$e(r,Gt,s,!1);return`${ct(t.n,D.precision)}${t.u}`}}}const es=(t,e)=>{if(!X(e))return e.duration=d,e.composition=zt(e.composition,r.none),new Me(t,e,null,0,!0).resume()},ss=(t,e,s)=>{let i=!1;return vt(e,(r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,h=xe(s,n,o);(!h||h&&h===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),bt(e,r),se(r),i=!0)}}),!0),i},is=(t,e,s)=>{const i=Ft(t),r=e||Lt,n=e&&e.controlAnimation&&e;for(let t=0,e=i.length;t<e;t++){const e=i[t];qe(e,s,n)}let o;if(r._hasChildren){let e=0;vt(r,(n=>{if(!n._hasChildren)if(o=ss(i,n,s),o&&!n._head)n.cancel(),bt(r,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?is(t,n,s):n._hasChildren=!1}),!0),X(r.iterationDuration)||(r.iterationDuration=e)}else o=ss(i,r,s);return o&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel()),i},rs=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i),ns=(t,e,s,i)=>{let r=p/D.defaults.frameRate;if(!1!==i){const t=i||Lt._hasChildren&&Lt;t&&t.deltaTime&&(r=t.deltaTime)}const n=1-Math.exp(-s*r*.1);return s?1===s?e:(1-n)*t+n*e:t},os=t=>(...e)=>{const s=t(...e);return new Proxy(_,{apply:(t,e,[i])=>s(i),get:(t,e)=>os(((...t)=>{const i=as[e](...t);return t=>i(s(t))}))})},hs=(t,e=0)=>(...s)=>(s.length<t.length?os(((t,e=0)=>(...s)=>e?e=>t(...s,e):e=>t(e,...s))(t,e)):t)(...s),as={$:Ot,get:ts,set:es,remove:is,cleanInlineStyles:Ce,random:pt,randomPick:t=>t[pt(0,t.length-1)],shuffle:mt,lerp:ns,sync:Ke,keepTime:wt,clamp:hs(at),round:hs(ct),snap:hs(dt),wrap:hs(((t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e)),interpolate:hs(ut,1),mapRange:hs(rs),roundPad:hs(((t,e)=>(+t).toFixed(e))),padStart:hs(((t,e,s)=>`${t}`.padStart(e,s))),padEnd:hs(((t,e,s)=>`${t}`.padEnd(e,s))),degToRad:hs((t=>t*ot/180)),radToDeg:hs((t=>180*t/ot))},ls=(t,e)=>{let s=t.iterationDuration;if(s===d&&(s=0),X(e))return s;if(R(+e))return+e;const i=e,r=t?t.labels:null,n=!z(r),o=((t,e)=>{if(F(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),h=!X(o),a=E.exec(i);if(a){const t=a[0],e=i.split(t),l=n&&e[0]?r[e[0]]:s,c=h?o:n?l:s,d=+e[1];return qt(c,d,t[0])}return h?o:n?X(r[i])?s:r[i]:s};function cs(t,e,s,i,r,n){const o=R(t.duration)&&t.duration<=d?s-d:s;kt(e,o,1,1,1);const h=i?new Me(i,t,e,o,!1,r,n):new oe(t,e,o);return h.init(1),Tt(e,h),vt(e,(t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)})),e.duration=function(t){return ft((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||d}(e),e}class ds extends oe{constructor(t={}){super(t,null,0),this.duration=0,this.labels={};const e=t.defaults,s=D.defaults;this.defaults=e?_t(e,s):s,this.onRender=t.onRender||s.onRender;const i=zt(t.playbackEase,s.playbackEase);this._ease=i?Te(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(I(s)){const e=s,r=Ft(t),n=this.duration,o=this.iterationDuration,h=i.id;let a=0;const l=r.length;r.forEach((t=>{const s={...i};this.duration=n,this.iterationDuration=o,X(h)||(s.id=h+"-"+a),cs(s,this,e(t,a,l,this),t,a,l),a++}))}else cs(i,this,ls(this,s),t)}else cs(t,this,ls(this,e));return this.init(1)}}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,ease:"linear"},e)}set(t,e,s){return X(e)?this:(e.duration=d,e.composition=r.replace,this.add(t,e,s))}call(t,e){return X(t)||t&&!I(t)?this:this.add({duration:0,onComplete:()=>t(this)},e)}label(t,e){return X(t)||t&&!Y(t)||(this.labels[t]=ls(this,e)),this}remove(t,e){return is(t,this,e),this}stretch(t){const e=this.duration;if(e===gt(t))return this;const s=t/e,i=this.labels;vt(this,(t=>t.stretch(t.duration*s)));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return vt(this,(t=>{t.refresh&&t.refresh()})),this}revert(){return super.revert(),vt(this,(t=>t.revert),!0),Ce(this)}then(t){return super.then(t)}}class us{constructor(t,e){L.current&&L.current.register(this);const s={},i={};if(this.targets=[],this.animations={},!X(t)&&!X(e)){for(let t in e){const r=e[t];q(t)?i[t]=r:s[t]=r}for(let e in i){const n=i[e],o=M(n);let h={},a="+=0";if(o){const t=n.unit;Y(t)&&(a+=t)}else h.duration=n;h[e]=o?_t({to:a},n):a;const l=_t(s,h);l.composition=r.replace,l.autoplay=!1;const c=this.animations[e]=new Me(t,l,null,0,!1).init();this.targets.length||this.targets.push(...c.targets),this[e]=(t,e,s)=>{const i=c._head;if(X(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return vt(c,(e=>{if(P(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=Te(s)),e._currentTime=0})),X(e)||c.stretch(e),c.reset(1).resume(),this}}}}revert(){for(let t in this.animations)this[t]=_,this.animations[t].revert();return this.animations={},this.targets.length=0,this}}class ps{constructor(t={}){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.m=at(zt(t.mass,1),0,p),this.s=at(zt(t.stiffness,100),1,p),this.d=at(zt(t.damping,10),.1,p),this.v=at(zt(t.velocity,0),-1e3,p),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.solverDuration=0,this.duration=0,this.compute(),this.ease=t=>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?tt(-n*e*s)*(1*J(i*n)+r*Z(i*n)):(1+r*n)*tt(-n*s),1-n}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:h}=this,a=this.w0=at(G(o/r),d,p),l=this.zeta=n/(2*G(o*r)),c=this.wd=l<1?a*G(1-l*l):0;this.b=l<1?(l*a-h)/c:-h+a;let u=0,m=0,f=0;for(;m<t&&f<e;)K(1-this.solve(u))<s?m++:m=0,this.solverDuration=u,u+=i,f++;this.duration=ct(this.solverDuration*p,0)*D.timeScale}get mass(){return this.m}set mass(t){this.m=at(zt(t,1),0,p),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=at(zt(t,100),1,p),this.compute()}get damping(){return this.d}set damping(t){this.d=at(zt(t,10),.1,p),this.compute()}get velocity(){return this.v}set velocity(t){this.v=at(zt(t,0),-1e3,p),this.compute()}}const ms=t=>new ps(t),fs=t=>{t.cancelable&&t.preventDefault()};class gs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:_,remove:_}}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 ys{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 _s=(t,e)=>t&&I(t)?t(e):t;let vs=0;class bs{constructor(t,e={}){if(!t)return;L.current&&L.current.register(this);const r=e.x,n=e.y,o=e.trigger,h=e.modifier,a=e.releaseEase,l=a&&Te(a),c=!X(a)&&!X(a.ease),d=M(r)&&!X(r.mapTo)?r.mapTo:"translateX",p=M(n)&&!X(n.mapTo)?n.mapTo:"translateY",m=_s(e.container,this);this.containerArray=P(m)?m:null,this.$container=m&&!this.containerArray?Ft(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=M(t)?new gs(t):Ft(t)[0],this.$trigger=Ft(o||t)[0],this.fixed="fixed"===ts(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.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=c?a:ms({mass:zt(e.releaseMass,1),stiffness:zt(e.releaseStiffness,80),damping:zt(e.releaseDamping,20)}),this.releaseYSpring=c?a:ms({mass:zt(e.releaseMass,1),stiffness:zt(e.releaseStiffness,80),damping:zt(e.releaseDamping,20)}),this.releaseEase=l||ve.outQuint,this.hasReleaseSpring=c,this.onGrab=e.onGrab||_,this.onDrag=e.onDrag||_,this.onRelease=e.onRelease||_,this.onUpdate=e.onUpdate||_,this.onSettle=e.onSettle||_,this.onSnap=e.onSnap||_,this.onResize=e.onResize||_,this.onAfterResize=e.onAfterResize||_,this.disabled=[0,0];const f={};if(h&&(f.modifier=h),X(r)||!0===r)f[d]=0;else if(M(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[d]=e}else!1===r&&(f[d]=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 us(this.$target,f),this.xProp=d,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=[-1e12,u,u,-1e12],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=O(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new ys(this.$target),this.overshootCoords={x:0,y:0},this.overshootXTicker=new oe({autoplay:!1},null,0).init(),this.overshootYTicker=new oe({autoplay:!1},null,0).init(),this.updateTicker=new oe({autoplay:!1},null,0).init(),this.overshootXTicker.onUpdate=()=>{this.disabled[0]||(this.updated=!0,this.manual=!0,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootXTicker.onComplete=()=>{this.disabled[0]||(this.manual=!1,this.animate[this.xProp](this.overshootCoords.x,0))},this.overshootYTicker.onUpdate=()=>{this.disabled[1]||(this.updated=!0,this.manual=!0,this.animate[this.yProp](this.overshootCoords.y,0))},this.overshootYTicker.onComplete=()=>{this.disabled[1]||(this.manual=!1,this.animate[this.yProp](this.overshootCoords.y,0))},this.updateTicker.onUpdate=()=>this.update(),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]?d:p,this.animate.animations[this.activeProp].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&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=nt(n,r)):this.updated=!1},this.animate.animations[this.activeProp].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 oe({autoplay:!1,duration:150*D.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=O(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,h=this.minVelocity,a=this.maxVelocity,l=this.velocityStackIndex;n[l]=ct(at(G(t*t+e*e)/r*o,h,a),5);const c=rt(n[0],n[1],n[2]);return this.velocity=c,this.velocityStackIndex=(l+1)%3,c}setX(t,e=!1){if(this.disabled[0])return;const s=ct(t,5);return this.overshootXTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=dt(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=ct(t,5);return this.overshootYTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=dt(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return ct(this.animate[this.xProp](),D.precision)}set x(t){this.setX(t,!1)}get y(){return ct(this.animate[this.yProp](),D.precision)}set y(t){this.setY(t,!1)}get progressX(){return rs(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(rs(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return rs(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(rs(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=ct(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=ct(this.useWin?s.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,h=this.scrollThreshold;this.scroll.x=t,this.scroll.y=e,this.scrollBounds[0]=e-this.targetBounds[0]+i-h,this.scrollBounds[1]=t-this.targetBounds[1]-r+h,this.scrollBounds[2]=e-this.targetBounds[2]-n+h,this.scrollBounds[3]=t-this.targetBounds[3]+o-h}updateBoundingValues(){const t=this.$container,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 h=this.window[0]=s.innerWidth,a=this.window[1]=s.innerHeight,l=this.useWin,c=t.scrollWidth,d=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?at(c,h,c):c,this.scrollView[1]=l?at(d,a,d):d,this.updateScrollCoords();const{width:_,height:v,left:b,top:T,right:w,bottom:x}=t.getBoundingClientRect();this.dragArea[2]=ct(l?at(_,h,h):_,0),this.dragArea[3]=ct(l?at(v,a,a):v,0);const S=ts(t,"overflow"),k="visible"===S,$="hidden"===S;if(this.canScroll=!u&&this.contained&&(t===i.body&&k||!$&&!k)&&(c>this.dragArea[2]+y-f||d>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!P(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,c=i?this.scrollView[0]-n-_:0,d=i?this.scrollView[1]-o-v:0;this.targetBounds[0]=ct(r.top+s-(l?0:T),0),this.targetBounds[1]=ct(r.right+e-(l?h:w),0),this.targetBounds[2]=ct(r.bottom+s-(l?a:x),0),this.targetBounds[3]=ct(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]=-ct(r.top-(u?at(T,0,a):T)+o-m,0),this.containerBounds[1]=-ct(r.right-(u?at(w,0,h):w)-c+f,0),this.containerBounds[2]=-ct(r.bottom-(u?at(x,0,a):x)-d+g,0),this.containerBounds[3]=-ct(r.left-(u?at(b,0,h):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,[h,a]=this.disabled,l=!h&&e<o||!h&&e>r,c=!a&&s<i||!a&&s>n;return l&&!c?1:!l&&c?2:l&&c?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=_s(t.container,this),o=_s(t.containerPadding,this)||0,h=P(o)?o:[o,o,o,o],a=this.x,l=this.y,c=_s(t.cursor,this),d={onHover:"grab",onGrab:"grabbing"};if(c){const{onHover:t,onGrab:e}=c;t&&(d.onHover=t),e&&(d.onGrab=e)}this.containerArray=P(n)?n:null,this.$container=n&&!this.containerArray?Ft(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=zt(h,[0,0,0,0]),this.containerFriction=at(zt(_s(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=at(zt(_s(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=_s(M(e)&&!X(e.snap)?e.snap:t.snap,this),this.snapY=_s(M(r)&&!X(r.snap)?r.snap:t.snap,this),this.scrollSpeed=zt(_s(t.scrollSpeed,this),1.5),this.scrollThreshold=zt(_s(t.scrollThreshold,this),20),this.dragSpeed=zt(_s(t.dragSpeed,this),1),this.minVelocity=zt(_s(t.minVelocity,this),0),this.maxVelocity=zt(_s(t.maxVelocity,this),50),this.velocityMultiplier=zt(_s(t.velocityMultiplier,this),1),this.cursor=!1!==c&&d,this.updateBoundingValues();const[u,p,m,f]=this.containerBounds;this.setX(at(a,f,p),!0),this.setY(at(l,u,m),!0)}update(){if(this.updateScrollCoords(),this.canScroll){const[t,e,s,i]=this.containerPadding,[r,n]=this.scrollView,o=this.dragArea[2],h=this.dragArea[3],a=this.scroll.x,l=this.scroll.y,c=this.$container.scrollWidth,d=this.$container.scrollHeight,u=this.useWin?at(c,this.window[0],c):c,p=this.useWin?at(d,this.window[1],d):d,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,w,x]=this.scrollBounds,S=ct(at((v-b+t)/y,-1,0)*g,0),k=ct(at((_-T-e)/y,0,1)*g,0),$=ct(at((v-w-s)/y,0,1)*g,0),C=ct(at((_-x+i)/y,-1,0)*g,0);if(S||$||C||k){const[t,e]=this.disabled;let s=a,i=l;t||(s=ct(at(a+(C||k),0,r-o),0),this.coords[0]-=a-s),e||(i=ct(at(l+(S||$),0,n-h),0),this.coords[1]-=l-i),this.useWin?this.$scrollContainer.scrollBy(-(a-s),-(l-i)):this.$scrollContainer.scrollTo(s,i)}}const[t,e,s,i]=this.containerBounds,[r,n,o,h,a,l]=this.pointer;this.coords[0]+=(r-a)*this.dragSpeed,this.coords[1]+=(n-l)*this.dragSpeed,this.pointer[4]=r,this.pointer[5]=n;const[c,d]=this.coords,[u,p]=this.snapped,m=(1-this.containerFriction)*this.dragSpeed;this.setX(c>e?e+(c-e)*m:c<i?i+(c-i)*m:c,!1),this.setY(d>s?s+(d-s)*m:d<t?t+(d-t)*m:d,!1),this.computeVelocity(r-a,n-l),this.angle=nt(n-h,r-o);const[f,g]=this.snapped;(f!==u&&this.snapX||g!==p&&this.snapY)&&this.onSnap(this)}stop(){this.updateTicker.pause(),this.overshootXTicker.pause(),this.overshootYTicker.pause();for(let t in this.animate.animations)this.animate.animations[t].pause();return is(this,null,"x"),is(this,null,"y"),is(this,null,"progressX"),is(this,null,"progressY"),is(this.scroll),is(this.overshootCoords),this}scrollInView(t,e=0,s=ve.inOutQuad){this.updateScrollCoords();const i=this.destX,r=this.destY,n=this.scroll,o=this.scrollBounds,h=this.canScroll;if(!this.containerArray&&this.isOutOfBounds(o,i,r)){const[a,l,c,d]=o,p=ct(at(r-a,-1e12,0),0),m=ct(at(i-l,0,u),0),f=ct(at(r-c,0,u),0),g=ct(at(i-d,-1e12,0),0);new Me(n,{x:ct(n.x+(g?g-e:m?m+e:0),0),y:ct(n.y+(p?p-e:f?f+e:0),0),duration:X(t)?350*D.timeScale:t,ease:s,onUpdate:()=>{this.canScroll=!1,this.$scrollContainer.scrollTo(n.x,n.y)}}).init().then((()=>{this.canScroll=h}))}return this}handleHover(){this.isFinePointer&&this.cursor&&!this.cursorStyles&&(this.cursorStyles=es(this.$trigger,{cursor:this.cursor.onHover}))}animateInView(t,e=0,s=ve.inOutQuad){this.stop(),this.updateBoundingValues();const i=this.x,r=this.y,[n,o,h,a]=this.containerPadding,l=this.scroll.y-this.targetBounds[0]+n+e,c=this.scroll.x-this.targetBounds[1]-o-e,d=this.scroll.y-this.targetBounds[2]-h-e,u=this.scroll.x-this.targetBounds[3]+a+e,p=this.isOutOfBounds([l,c,d,u],i,r);if(p){const[e,n]=this.disabled,o=at(dt(i,this.snapX),u,c),h=at(dt(r,this.snapY),l,d),a=X(t)?350*D.timeScale:t;e||1!==p&&3!==p||this.animate[this.xProp](o,a,s),n||2!==p&&3!==p||this.animate[this.yProp](h,a,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:h}=this.transforms.normalizePoint(r,n),[a,l,c,d]=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<d?d+(p-d)/u:p:p,this.coords[1]=this.coords[3]=u?m>c?c+(m-c)/u:m<a?a+(m-a)/u:m:m,this.pointer[0]=o,this.pointer[1]=h,this.pointer[2]=o,this.pointer[3]=h,this.pointer[4]=o,this.pointer[5]=h,this.pointer[6]=o,this.pointer[7]=h,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=ts(this.$target,"zIndex",!1);vs=(f>vs?f:vs)+1,this.targetStyles=es(this.$target,{zIndex:vs}),this.triggerStyles&&(this.triggerStyles.revert(),this.triggerStyles=null),this.cursorStyles&&(this.cursorStyles.revert(),this.cursorStyles=null),this.isFinePointer&&this.cursor&&(this.bodyStyles=es(i.body,{cursor:this.cursor.onGrab})),this.scrollInView(100,0,ve.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],h=n-this.pointer[7];let a=t.target,l=!1,c=!1,d=!1;for(;e&&a&&a!==this.$trigger;){const t=ts(a,"overflow-y");if("hidden"!==t&&"visible"!==t){const{scrollTop:t,scrollHeight:e,clientHeight:s}=a;if(e>s){d=!0,l=t<=3,c=t>=e-s-3;break}}a=a.parentNode}d&&(!l&&!c||l&&h<0||c&&h>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):(fs(t),this.triggerStyles||(this.triggerStyles=es(this.$trigger,{pointerEvents:"none"})),this.$trigger.addEventListener("touchstart",fs,{passive:!1}),this.$trigger.addEventListener("touchmove",fs,{passive:!1}),this.$trigger.addEventListener("touchend",fs),(!this.disabled[0]&&K(o)>3||!this.disabled[1]&&K(h)>3)&&(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,h,a,l]=this.pointer,[c,d,u,p]=this.containerBounds,[m,f]=this.snapped,g=this.releaseXSpring,y=this.releaseYSpring,_=this.releaseEase,v=this.hasReleaseSpring,b=this.overshootCoords,T=this.x,w=this.y,x=this.computeVelocity(s-a,n-l),S=this.angle=nt(n-h,s-o),k=150*x,$=(1-this.releaseContainerFriction)*this.dragSpeed,C=T+J(S)*k,E=w+Z(S)*k,B=C>d?d+(C-d)*$:C<p?p+(C-p)*$:C,L=E>u?u+(E-u)*$:E<c?c+(E-c)*$:E,A=this.destX=at(ct(dt(B,this.snapX),5),p,d),N=this.destY=at(ct(dt(L,this.snapY),5),c,u),F=this.isOutOfBounds(this.containerBounds,C,E);let O=0,P=0,M=_,R=_,Y=0;if(b.x=T,b.y=w,!t){const t=A===d?T>d?-1:1:T<p?-1:1,s=ct(T-A,0);g.velocity=e&&v?s?k*t/K(s):0:x;const{ease:i,duration:r,restDuration:n}=g;O=T===A?0:v?r:r-n*D.timeScale,v&&(M=i),O>Y&&(Y=O)}if(!e){const e=N===u?w>u?-1:1:w<c?-1:1,s=ct(w-N,0);y.velocity=t&&v?s?k*e/K(s):0:x;const{ease:i,duration:r,restDuration:n}=y;P=w===N?0:v?r:r-n*D.timeScale,v&&(R=i),P>Y&&(Y=P)}if(!v&&F&&$&&(O||P)){const t=r.blend;new Me(b,{x:{to:B,duration:.65*O},y:{to:L,duration:.65*P},ease:_,composition:t}).init(),new Me(b,{x:{to:A,duration:O},y:{to:N,duration:P},ease:_,composition:t}).init(),this.overshootXTicker.stretch(O).restart(),this.overshootYTicker.stretch(P).restart()}else t||this.animate[this.xProp](A,O,M),e||this.animate[this.yProp](N,P,R);this.scrollInView(Y,this.scrollThreshold,_);let I=!1;A!==m&&(this.snapped[0]=A,this.snapX&&(I=!0)),N!==f&&this.snapY&&(this.snapped[1]=N,this.snapY&&(I=!0)),I&&this.onSnap(this),this.grabbed=!1,this.dragged=!1,this.updated=!0,this.released=!0,this.onRelease(this),this.$trigger.removeEventListener("touchstart",fs),this.$trigger.removeEventListener("touchmove",fs),this.$trigger.removeEventListener("touchend",fs),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=es(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.stop(),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.overshootXTicker.revert(),this.overshootYTicker.revert(),this.resizeTicker.revert(),this.animate.revert(),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":fs(t)}}}class Ts{constructor(t={}){L.current&&L.current.register(this);const e=t.root;let r=i;e&&(r=e.current||e.nativeElement||Ft(e)[0]||i);const n=t.defaults,o=D.defaults,h=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={},h)for(let t in h){const e=s.matchMedia(h[t]);this.mediaQueryLists[t]=e,e.addEventListener("change",this)}}register(t){(this.once?this.revertiblesOnce:this.revertibles).push(t)}execute(t){let e=L.current,s=L.root,i=D.defaults;L.current=this,L.root=this.root,D.defaults=this.defaults;const r=this.mediaQueryLists;for(let t in r)this.matches[t]=r[t].matches;const n=t(this);return L.current=e,L.root=s,D.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);I(e)&&this.revertConstructors.push(e)}))})),this}add(t,e){if(this.once=!1,I(t)){const e=t;this.constructors.push(e),this.execute((()=>{const t=e(this);I(t)&&this.revertConstructors.push(t)}))}else this.methods[t]=(...t)=>this.execute((()=>e(...t)));return this}addOnce(t){if(this.once=!0,I(t)){const e=this.onceIndex++;if(this.constructorsOnce[e])return this;const s=t;this.constructorsOnce[e]=s,this.execute((()=>{const t=s(this);I(t)&&this.revertConstructorsOnce.push(t)}))}return this}keepTime(t){this.once=!0;const e=this.onceIndex++,s=this.constructorsOnce[e];if(I(s))return s(this);const i=wt(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,h=s.length,a=i.length;for(;n--;)t[n].revert();for(;o--;)e[o](this);for(;h--;)s[h].revert();for(;a--;)i[a](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 ws=(t,e)=>t&&I(t)?t(e):t,xs=new Map;class Ss{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.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 oe({autoplay:!1,onBegin:()=>this.dataTimer.resume(),onUpdate:()=>{const t=this.backwardX||this.backwardY;vt(this,(t=>t.handleScroll()),t)},onComplete:()=>this.dataTimer.pause()}).init(),this.dataTimer=new oe({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,h=i-n;this.prevScrollX=r,this.prevScrollY=n,o&&(this.backwardX=s>r),h&&(this.backwardY=i>n),this.velocity=ct(e>0?Math.sqrt(o*o+h*h)/e:0,5)}}).init(),this.resizeTicker=new oe({autoplay:!1,duration:250*D.timeScale,onComplete:()=>{this.updateWindowBounds(),this.refreshScrollObservers(),this.handleScroll()}}).init(),this.wakeTicker=new oe({autoplay:!1,duration:500*D.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=ct(t?s.scrollX:e.scrollLeft,0),this.scrollY=ct(t?s.scrollY:e.scrollTop,0)}updateWindowBounds(){this.winWidth=s.innerWidth,this.winHeight=(()=>{const t=document.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=t.width,i=t.height,this.top=t.top,this.left=t.left}this.width=s,this.height=i}refreshScrollObservers(){vt(this,(t=>{t._debug&&t.removeDebug()})),this.updateBounds(),vt(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.unobserve(this.element),(this.useWin?s:this.element).removeEventListener("scroll",this),xs.delete(this.element)}}const ks=(t,e,s,i,r)=>{const n="min"===e,o="max"===e,h="top"===e||"left"===e||"start"===e||n?0:"bottom"===e||"right"===e||"end"===e||o?"100%":"center"===e?"50%":e,{n:a,u:l}=Qt(h,Gt);let c=a;return"%"===l?c=a/100*s:l&&(c=$e(t,Gt,"px",!0).n),o&&i<0&&(c+=i),n&&r>0&&(c+=r),c},$s=(t,e,s,i,r)=>{let n;if(Y(e)){const o=E.exec(e);if(o){const h=o[0],a=h[0],l=e.split(h),c="min"===l[0],d="max"===l[0],u=ks(t,l[0],s,i,r),p=ks(t,l[1],s,i,r);if(c){const e=qt(ks(t,"min",s),p,a);n=e<u?u:e}else if(d){const e=qt(ks(t,"max",s),p,a);n=e>u?u:e}else n=qt(u,p,a)}else n=ks(t,e,s,i,r)}else n=e;return ct(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 Es=0;const Bs=["#FF4B4B","#FF971B","#FFC730","#F9F640","#7AFF5A","#18FF74","#17E09B","#3CFFEC","#05DBE9","#33B3F1","#638CF9","#C563FE","#FF4FCF","#F93F8A"];class Ls{constructor(t={}){L.current&&L.current.register(this);const e=zt(t.sync,"play pause"),s=e?Te(e):null,r=e&&("linear"===e||e===he),n=e&&!(s===he&&!r),o=e&&(R(e)||!0===e||r),h=e&&Y(e)&&!n&&!o,a=h?e.split(" ").map((t=>()=>{const e=this.linked;return e&&e[t]?e[t]():null})):null,l=h&&a.length>2;this.index=Es++,this.id=X(t.id)?this.index:t.id,this.container=(t=>{const e=t&&Ft(t)[0]||i.body;let s=xs.get(e);return s||(s=new Ss(e),xs.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||!!a,this.syncEase=n?s:null,this.syncSmooth=o?!0===e||r?1:e:null,this.onSyncEnter=a&&!l&&a[0]?a[0]:_,this.onSyncLeave=a&&!l&&a[1]?a[1]:_,this.onSyncEnterForward=a&&l&&a[0]?a[0]:_,this.onSyncLeaveForward=a&&l&&a[1]?a[1]:_,this.onSyncEnterBackward=a&&l&&a[2]?a[2]:_,this.onSyncLeaveBackward=a&&l&&a[3]?a[3]:_,this.onEnter=t.onEnter||_,this.onLeave=t.onLeave||_,this.onEnterForward=t.onEnterForward||_,this.onLeaveForward=t.onLeaveForward||_,this.onEnterBackward=t.onEnterBackward||_,this.onLeaveBackward=t.onLeaveBackward||_,this.onUpdate=t.onUpdate||_,this.onSyncComplete=t.onSyncComplete||_,this.reverted=!1,this.completed=!1,this.began=!1,this.isInView=!1,this.forceEnter=!1,this.hasEntered=!1,this.offsets=[],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=zt(t.debug,!1),this._next=null,this._prev=null,Tt(this.container,this),Ke((()=>{if(!this.reverted){if(!this.target){const e=Ft(t.target)[0];this.target=e||i.body,this.refresh()}this._debug&&this.debug()}}))}link(t){if(t&&(t.pause(),this.linked=t,!this._params.target)){let e;X(t.targets)?vt(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:ct(at(t,0,1),6)}refresh(){this.reverted=!1;const t=this._params;return this.repeat=zt(ws(t.repeat,this),!0),this.horizontal="x"===zt(ws(t.axis,this),"y"),this.enter=zt(ws(t.enter,this),"end start"),this.leave=zt(ws(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"),h=Bs[this.index%Bs.length],a=t.useWin,l=a?t.winWidth:t.width,c=a?t.winHeight:t.height,d=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,_=e?60:g,v=e?_:y,b=e?"repeat-x":"repeat-y",T=t=>e?"0px "+t+"px":t+"px 2px",w=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?d: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:c)}`,s||(n.style.cssText+=`background:\n ${w("#FFFF")}${T(g-10)} / 100px 100px ${b},\n ${w("#FFF8")}${T(g-10)} / 10px 10px ${b};\n `),o.style.cssText=`${x("relative",0,0,e?d:g,e?g:u)}`,s||(o.style.cssText+=`background:\n ${w("#FFFF")}${T(0)} / ${e?"100px 10px":"10px 100px"} ${b},\n ${w("#FFF8")}${T(0)} / ${e?"10px 0px":"0px 10px"} ${b};\n `);const S=[" enter: "," leave: "];this.coords.forEach(((t,s)=>{const r=s>1,a=(r?0:this.offset)+t,m=s%2,f=a<v,g=a>(r?e?l:c:e?d:u)-v,b=(r?m&&!f:!m&&!f)||g,T=i.createElement("div"),w=i.createElement("div"),k=e?b?"right":"left":b?"bottom":"top",$=b?(e?_:y)+(r?e?-1:g?0:-2:e?-1:-2):e?1:0;w.innerHTML=`${this.id}${S[m]}${this.thresholds[s]}`,T.style.cssText=`${x("absolute",0,0,_,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-${k}: 2px solid ${h};\n `,w.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?h:"rgba(0,0,0,.75)"};\n background-color: ${m?"rgba(0,0,0,.65)":h};\n border: 2px solid ${m?h:"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(w);let C=a-$+(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),s||r.classList.add("animejs-onscroll-debug"),this.$debug=r,"static"===ts(t.element,"position")&&(this.debugStyles=es(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,h=e,a=0,l=0,c=h;n&&(o=n.currentTime,n.seek(0,!0));const d="static"===ts(s.element,"position")&&es(s.element,{position:"relative "});for(;h&&h!==s.element&&h!==i.body;){const e="sticky"===ts(h,"position")&&es(h,{position:"static"});h===c&&(a+=h.offsetLeft||0,l+=h.offsetTop||0,c=h.offsetParent),h=h.parentElement,e&&(t||(t=[]),t.push(e))}d&&d.revert();const u=r?a:l,p=r?e.offsetWidth:e.offsetHeight,m=r?s.width:s.height,f=(r?s.scrollWidth:s.scrollHeight)-m,g=this.enter,y=this.leave;let _="start",v="end",b="end",T="start";if(Y(g)){const t=g.split(" ");b=t[0],_=t.length>1?t[1]:_}else if(M(g)){const t=g;X(t.container)||(b=t.container),X(t.target)||(_=t.target)}else R(g)&&(b=g);if(Y(y)){const t=y.split(" ");T=t[0],v=t.length>1?t[1]:v}else if(M(y)){const t=y;X(t.container)||(T=t.container),X(t.target)||(v=t.target)}else R(y)&&(T=y);const w=$s(e,_,p),x=$s(e,v,p),S=w+u-m,k=x+u-f,$=$s(e,b,m,S,k),C=$s(e,T,m,S,k),E=w+u-$,B=x+u-C,L=B-E;this.offsets[0]=a,this.offsets[1]=l,this.offset=u,this.offsetStart=E,this.offsetEnd=B,this.distance=L<=0?0:L,this.thresholds=[_,v,b,T],this.coords=[w,x,$,C],t&&t.forEach((t=>t.revert())),n&&n.seek(o,!0),this._debug&&this.debug()}handleScroll(){const t=this.linked,e=this.sync,s=this.syncEase,i=this.syncSmooth,r=t&&(s||i),n=this.horizontal,o=this.container,h=this.scroll,a=h<=this.offsetStart,l=h>=this.offsetEnd,c=!a&&!l,d=h===this.offsetStart||h===this.offsetEnd,u=!this.hasEntered&&d,p=this._debug&&this.$debug;let m=!1,f=!1,g=this.progress;if(a&&this.began&&(this.began=!1),g>0&&!this.began&&(this.began=!0),r){const e=t.progress;if(i&&R(i)){if(i<1){const t=e<g&&1===g?1e-4:e>g&&!g?-1e-4:0;g=ct(ns(e,g,ut(.01,.2,i),!1)+t,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"}(c&&!this.isInView||u&&!this.forceEnter&&!this.hasEntered)&&(c&&(this.isInView=!0),this.forceEnter&&this.hasEntered?c&&(this.forceEnter=!1):(p&&c&&(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))),(c||!c&&this.isInView)&&(m=!0),m&&(r&&t.seek(t.duration*g),this.onUpdate(this)),!c&&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 bt(t,this),t._head||t.revert(),this._debug&&this.removeDebug(),this.reverted=!0,this}}const Ds=!X(Intl)&&Intl.Segmenter,As=/\{value\}/g,Ns=/\{i\}/g,Fs=/(\s+)/,Os=/^\s+$/,Ps="line",Ms="word",Rs="char",Ys="data-line";let Is=null,Xs=null,zs=null;const Ws=t=>t.isWordLike||" "===t.segment||R(+t.segment),Vs=t=>t.setAttribute("aria-hidden","true"),Hs=(t,e)=>[...t.querySelectorAll(`[data-${e}]:not([data-${e}] [data-${e}])`)],Us={line:"#00D672",word:"#FF4B4B",char:"#5A87FF"},qs=t=>{if(!t.childElementCount&&!t.textContent.trim()){const e=t.parentElement;t.remove(),e&&qs(e)}},Qs=(t,e,s)=>{const i=t.getAttribute(Ys);(null!==i&&+i!==e||"BR"===t.tagName)&&s.add(t);let r=t.childElementCount;for(;r--;)Qs(t.children[r],e,s);return s},js=(t,e={})=>{let s="";const i=Y(e.class)?` class="${e.class}"`:"",r=zt(e.clone,!1),n=zt(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},Gs=(t,e,s,i,r,n,o,h,a)=>{const l=r===Ps,c=r===Rs,d=`_${r}_`,u=I(t)?t(s):t,p=l?"block":"inline-block";zs.innerHTML=u.replace(As,`<i class="${d}"></i>`).replace(Ns,`${c?a:l?o:h}`);const m=zs.content,f=m.firstElementChild,g=m.querySelector(`[data-${r}]`)||f,y=m.querySelectorAll(`i.${d}`),_=y.length;if(_){f.style.display=p,g.style.display=p,g.setAttribute(Ys,`${o}`),l||(g.setAttribute("data-word",`${h}`),c&&g.setAttribute("data-char",`${a}`));let t=_;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 ${Us[r]}`),f};class Zs{constructor(t,s={}){Is||(Is=Ds?new Ds([],{granularity:Ms}):{segment:t=>{const e=[],s=t.split(Fs);for(let t=0,i=s.length;t<i;t++){const i=s[t];e.push({segment:i,isWordLike:!Os.test(i)})}return e}}),Xs||(Xs=Ds?new Ds([],{granularity:"grapheme"}):{segment:t=>[...t].map((t=>({segment:t})))}),!zs&&e&&(zs=i.createElement("template")),L.current&&L.current.register(this);const{words:r,chars:n,lines:o,accessible:h,includeSpaces:a,debug:l}=s,c=(t=P(t)?t[0]:t)&&t.nodeType?t:(Nt(t)||[])[0],d=!0===o?{}:o,u=!0===r||X(r)?{}:r,p=!0===n?{}:n;this.debug=zt(l,!1),this.includeSpaces=zt(a,!1),this.accessible=zt(h,!0),this.linesOnly=d&&!u&&!p,this.lineTemplate=M(d)?js(Ps,d):d,this.wordTemplate=M(u)||this.linesOnly?js(Ms,u):u,this.charTemplate=M(p)?js(Rs,p):p,this.$target=c,this.html=c&&c.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&&(d||u||p)&&this.split();this.resizeObserver=new ResizeObserver((()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((()=>{const t=c.offsetWidth;t!==this.width&&(this.width=t,m())}),150)})),this.lineTemplate&&!this.ready?i.fonts.ready.then(m):m(),c?this.resizeObserver.observe(c):console.warn("No Text Splitter target found.")}addEffect(t){if(!I(t))return console.warn("Effect must return a function.");const e=wt(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=>I(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 h=[],a=this.words,l=this.chars,c=Is.segment(o),d=i.createDocumentFragment();let u=null;for(const t of c){const e=t.segment,s=Ws(t);if(!u||s&&u&&Ws(u))h.push(e);else{const t=h.length-1;h[t].includes(" ")||e.includes(" ")?h.push(e):h[t]+=e}u=t}for(let t=0,o=h.length;t<o;t++){const o=h[t];if(o.trim()){const c=h[t+1],u=r&&c&&!c.trim(),p=o,m=s?Xs.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],h=e===r-1&&u?o.segment+" ":o.segment,c=i.createTextNode(h);Gs(s,l,c,f,Rs,n,-1,a.length,l.length)}}e?Gs(e,a,f,d,Ms,n,-1,a.length,l.length):s?d.appendChild(f):d.appendChild(i.createTextNode(o)),u&&t++}else{if(t&&r)continue;d.appendChild(i.createTextNode(o))}}t.parentNode.replaceChild(d,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,h="loading"!==i.fonts.status,a=r&&h;this.ready=!r||h,s||(t&&(e.innerHTML=this.html,this.words.length=this.chars.length=0),this.splitNode(e),this.cache=e.innerHTML),a&&(this.effectsCleanups.forEach((t=>I(t)&&t(this))),s&&(e.innerHTML=this.cache),this.lines.length=0,n&&(this.words=Hs(e,Ms))),o&&(a||n)&&(this.chars=Hs(e,Rs));const l=this.words.length?this.words:this.chars;let c,d=0;for(let t=0,e=l.length;t<e;t++){const e=l[t],{top:s,height:i}=e.getBoundingClientRect();c&&s-c>.5*i&&d++,e.setAttribute(Ys,`${d}`);const r=e.querySelectorAll(`[${Ys}]`);let n=r.length;for(;n--;)r[n].setAttribute(Ys,`${d}`);c=s}if(a){const t=i.createDocumentFragment(),s=new Set,h=[];for(let t=0;t<d+1;t++){const i=e.cloneNode(!0);Qs(i,t,new Set).forEach((t=>{const e=t.parentElement;e&&s.add(e),t.remove()})),h.push(i)}s.forEach(qs);for(let e=0,s=h.length;e<s;e++)Gs(r,this.lines,h[e],t,Ps,this.debug,e);e.innerHTML="",e.appendChild(t),n&&(this.words=Hs(e,Ms)),o&&(this.chars=Hs(e,Rs))}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((a||t)&&this.effects.forEach(((t,e)=>this.effectsCleanups[e]=t(this))),this.accessible&&(a||!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(Vs),this.words.forEach(Vs),this.chars.forEach(Vs)}return this.width=e.offsetWidth,this}refresh(){this.split(!0)}}const Js={split:(t,e)=>new Zs(t,e)};t.Animatable=us,t.Draggable=bs,t.JSAnimation=Me,t.Scope=Ts,t.ScrollObserver=Ls,t.Spring=ps,t.TextSplitter=Zs,t.Timeline=ds,t.Timer=oe,t.WAAPIAnimation=Ze,t.animate=(t,e)=>new Me(t,e,null,0,!1).init(),t.createAnimatable=(t,e)=>new us(t,e),t.createDraggable=(t,e)=>new bs(t,e),t.createScope=t=>new Ts(t),t.createSpring=ms,t.createTimeline=t=>new ds(t).init(),t.createTimer=t=>new oe(t,null,0).init(),t.eases=ve,t.engine=Lt,t.onScroll=(t={})=>new Ls(t),t.scrollContainers=xs,t.stagger=(t,e={})=>{let s=[],i=0;const r=e.from,n=e.reversed,o=e.ease,h=!X(o),a=h&&!X(o.ease)?o.ease:h?Te(o):null,l=e.grid,c=e.axis,d=e.total,u=X(r)||0===r||"first"===r,p="center"===r,f="last"===r,g="random"===r,y=P(t),_=e.use,v=Q(y?t[0]:t),b=y?Q(t[1]):0,T=k.exec((y?t[1]:t)+m),w=e.start||0+(y?v:0);let x=u?0:R(r)?r:0;return(t,r,o,h)=>{const[u]=Ot(t),m=X(d)?o:d,S=!X(_)&&(I(_)?_(u,r,m):Ut(u,_)),k=R(S)||Y(S)&&R(+S)?+S:r;if(p&&(x=(m-1)/2),f&&(x=m-1),!s.length){for(let t=0;t<m;t++){if(l){const e=p?(l[0]-1)/2:x%l[0],i=p?(l[1]-1)/2:st(x/l[0]),r=e-t%l[0],n=i-st(t/l[0]);let o=G(r*r+n*n);"x"===c&&(o=-r),"y"===c&&(o=-n),s.push(o)}else s.push(K(x-t));i=rt(...s)}a&&(s=s.map((t=>a(t/i)*i))),n&&(s=s.map((t=>c?t<0?-1*t:-t:K(i-t)))),g&&(s=mt(s))}const $=y?(b-v)/i:v;let C=(h?ls(h,X(e.start)?h.iterationDuration:w):w)+($*ct(s[k],2)||0);return e.modifier&&(C=e.modifier(C)),T&&(C=`${C}${T[2]}`),C}},t.svg=It,t.text=Js,t.utils=as,t.waapi=Je}));
diff --git a/lib/gui/index.js b/lib/gui/index.js
new file mode 100644
index 00000000..68454eba
--- /dev/null
+++ b/lib/gui/index.js
@@ -0,0 +1,6341 @@
+/**
+ * anime.js GUI - ESM
+ * @version v4.1.0
+ * @author Julian Garnier
+ * @license MIT
+ * @copyright (c) 2025 Julian Garnier
+ * @see https://animejs.com
+ */
+
+// Global types ///////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} DefaultsParams
+ * @property {Number|String} [id]
+ * @property {PercentageKeyframes|DurationKeyframes} [keyframes]
+ * @property {EasingParam} [playbackEase]
+ * @property {Number} [playbackRate]
+ * @property {Number} [frameRate]
+ * @property {Number|Boolean} [loop]
+ * @property {Boolean} [reversed]
+ * @property {Boolean} [alternate]
+ * @property {Boolean|ScrollObserver} [autoplay]
+ * @property {Number|FunctionValue} [duration]
+ * @property {Number|FunctionValue} [delay]
+ * @property {Number} [loopDelay]
+ * @property {EasingParam} [ease]
+ * @property {'none'|'replace'|'blend'|compositionTypes} [composition]
+ * @property {(v: any) => any} [modifier]
+ * @property {(tickable: Tickable) => void} [onBegin]
+ * @property {(tickable: Tickable) => void} [onBeforeUpdate]
+ * @property {(tickable: Tickable) => void} [onUpdate]
+ * @property {(tickable: Tickable) => void} [onLoop]
+ * @property {(tickable: Tickable) => void} [onPause]
+ * @property {(tickable: Tickable) => void} [onComplete]
+ * @property {(renderable: Renderable) => void} [onRender]
+ */
+
+/** @typedef {JSAnimation|Timeline} Renderable */
+/** @typedef {Timer|Renderable} Tickable */
+/** @typedef {Timer&JSAnimation&Timeline} CallbackArgument */
+/** @typedef {Animatable|Tickable|Draggable|ScrollObserver|TextSplitter|Scope} Revertible */
+
+// Stagger types //////////////////////////////////////////////////////////////
+
+/**
+ * @callback StaggerFunction
+ * @param {Target} [target]
+ * @param {Number} [index]
+ * @param {Number} [length]
+ * @param {Timeline} [tl]
+ * @return {Number|String}
+ */
+
+/**
+ * @typedef {Object} StaggerParams
+ * @property {Number|String} [start]
+ * @property {Number|'first'|'center'|'last'|'random'} [from]
+ * @property {Boolean} [reversed]
+ * @property {Array.<Number>} [grid]
+ * @property {('x'|'y')} [axis]
+ * @property {String|StaggerFunction} [use]
+ * @property {Number} [total]
+ * @property {EasingParam} [ease]
+ * @property {TweenModifier} [modifier]
+ */
+
+// Eases types ////////////////////////////////////////////////////////////////
+
+/**
+ * @callback EasingFunction
+ * @param {Number} time
+ * @return {Number}
+ */
+
+/**
+ * @typedef {('linear'|'linear(x1, x2 25%, x3)'|'in'|'out'|'inOut'|'inQuad'|'outQuad'|'inOutQuad'|'inCubic'|'outCubic'|'inOutCubic'|'inQuart'|'outQuart'|'inOutQuart'|'inQuint'|'outQuint'|'inOutQuint'|'inSine'|'outSine'|'inOutSine'|'inCirc'|'outCirc'|'inOutCirc'|'inExpo'|'outExpo'|'inOutExpo'|'inBounce'|'outBounce'|'inOutBounce'|'inBack'|'outBack'|'inOutBack'|'inElastic'|'outElastic'|'inOutElastic'|'irregular'|'cubicBezier'|'steps'|'in(p = 1.675)'|'out(p = 1.675)'|'inOut(p = 1.675)'|'inBack(overshoot = 1.70158)'|'outBack(overshoot = 1.70158)'|'inOutBack(overshoot = 1.70158)'|'inElastic(amplitude = 1, period = .3)'|'outElastic(amplitude = 1, period = .3)'|'inOutElastic(amplitude = 1, period = .3)'|'irregular(length = 10, randomness = 1)'|'cubicBezier(x1, y1, x2, y2)'|'steps(steps = 10)')} EaseStringParamNames
+ */
+
+// A hack to get both ease names suggestions AND allow any strings
+// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-460346421
+/** @typedef {(String & {})|EaseStringParamNames|EasingFunction|Spring} EasingParam */
+
+/** @typedef {HTMLElement|SVGElement} DOMTarget */
+/** @typedef {Record<String, any>} JSTarget */
+/** @typedef {DOMTarget|JSTarget} Target */
+/** @typedef {Target|NodeList|String} TargetSelector */
+/** @typedef {DOMTarget|NodeList|String} DOMTargetSelector */
+/** @typedef {Array.<DOMTargetSelector>|DOMTargetSelector} DOMTargetsParam */
+/** @typedef {Array.<DOMTarget>} DOMTargetsArray */
+/** @typedef {Array.<JSTarget>|JSTarget} JSTargetsParam */
+/** @typedef {Array.<JSTarget>} JSTargetsArray */
+/** @typedef {Array.<TargetSelector>|TargetSelector} TargetsParam */
+/** @typedef {Array.<Target>} TargetsArray */
+
+ // Callback types ////////////////////////////////////////////////////////////
+
+/**
+ * @template T
+ * @callback Callback
+ * @param {T} self - Returns itself
+ * @param {PointerEvent} [e]
+ * @return {*}
+ */
+
+/**
+ * @template {object} T
+ * @typedef {Object} TickableCallbacks
+ * @property {Callback<T>} [onBegin]
+ * @property {Callback<T>} [onBeforeUpdate]
+ * @property {Callback<T>} [onUpdate]
+ * @property {Callback<T>} [onLoop]
+ * @property {Callback<T>} [onPause]
+ * @property {Callback<T>} [onComplete]
+ */
+
+/**
+ * @template {object} T
+ * @typedef {Object} RenderableCallbacks
+ * @property {Callback<T>} [onRender]
+ */
+
+// Timer types ////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} TimerOptions
+ * @property {Number|String} [id]
+ * @property {TweenParamValue} [duration]
+ * @property {TweenParamValue} [delay]
+ * @property {Number} [loopDelay]
+ * @property {Boolean} [reversed]
+ * @property {Boolean} [alternate]
+ * @property {Boolean|Number} [loop]
+ * @property {Boolean|ScrollObserver} [autoplay]
+ * @property {Number} [frameRate]
+ * @property {Number} [playbackRate]
+ */
+
+/**
+
+/**
+ * @typedef {TimerOptions & TickableCallbacks<Timer>} TimerParams
+ */
+
+// Tween types ////////////////////////////////////////////////////////////////
+
+/**
+ * @callback FunctionValue
+ * @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>}
+ */
+
+/**
+ * @callback TweenModifier
+ * @param {Number} value - The animated value
+ * @return {Number|String}
+ */
+
+/** @typedef {[Number, Number, Number, Number]} ColorArray */
+
+/**
+ * @typedef {Object} Tween
+ * @property {Number} id
+ * @property {JSAnimation} parent
+ * @property {String} property
+ * @property {Target} target
+ * @property {String|Number} _value
+ * @property {Function|null} _func
+ * @property {EasingFunction} _ease
+ * @property {Array.<Number>} _fromNumbers
+ * @property {Array.<Number>} _toNumbers
+ * @property {Array.<String>} _strings
+ * @property {Number} _fromNumber
+ * @property {Number} _toNumber
+ * @property {Array.<Number>} _numbers
+ * @property {Number} _number
+ * @property {String} _unit
+ * @property {TweenModifier} _modifier
+ * @property {Number} _currentTime
+ * @property {Number} _delay
+ * @property {Number} _updateDuration
+ * @property {Number} _startTime
+ * @property {Number} _changeDuration
+ * @property {Number} _absoluteStartTime
+ * @property {tweenTypes} _tweenType
+ * @property {valueTypes} _valueType
+ * @property {Number} _composition
+ * @property {Number} _isOverlapped
+ * @property {Number} _isOverridden
+ * @property {Number} _renderTransforms
+ * @property {Tween} _prevRep
+ * @property {Tween} _nextRep
+ * @property {Tween} _prevAdd
+ * @property {Tween} _nextAdd
+ * @property {Tween} _prev
+ * @property {Tween} _next
+ */
+
+/**
+ * @typedef TweenDecomposedValue
+ * @property {Number} t - Type
+ * @property {Number} n - Single number value
+ * @property {String} u - Value unit
+ * @property {String} o - Value operator
+ * @property {Array.<Number>} d - Array of Numbers (in case of complex value type)
+ * @property {Array.<String>} s - Strings (in case of complex value type)
+ */
+
+/** @typedef {{_head: null|Tween, _tail: null|Tween}} TweenPropertySiblings */
+/** @typedef {Record<String, TweenPropertySiblings>} TweenLookups */
+/** @typedef {WeakMap.<Target, TweenLookups>} TweenReplaceLookups */
+/** @typedef {Map.<Target, TweenLookups>} TweenAdditiveLookups */
+
+// Animation types ////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Number|String|FunctionValue} TweenParamValue
+ */
+
+/**
+ * @typedef {TweenParamValue|[TweenParamValue, TweenParamValue]} TweenPropValue
+ */
+
+/**
+ * @typedef {(String & {})|'none'|'replace'|'blend'|compositionTypes} TweenComposition
+ */
+
+/**
+ * @typedef {Object} TweenParamsOptions
+ * @property {TweenParamValue} [duration]
+ * @property {TweenParamValue} [delay]
+ * @property {EasingParam} [ease]
+ * @property {TweenModifier} [modifier]
+ * @property {TweenComposition} [composition]
+ */
+
+/**
+ * @typedef {Object} TweenValues
+ * @property {TweenParamValue} [from]
+ * @property {TweenPropValue} [to]
+ * @property {TweenPropValue} [fromTo]
+ */
+
+/**
+ * @typedef {TweenParamsOptions & TweenValues} TweenKeyValue
+ */
+
+/**
+ * @typedef {Array.<TweenKeyValue|TweenPropValue>} ArraySyntaxValue
+ */
+
+/**
+ * @typedef {TweenParamValue|ArraySyntaxValue|TweenKeyValue} TweenOptions
+ */
+
+/**
+ * @typedef {Partial<{to: TweenParamValue|Array.<TweenParamValue>; from: TweenParamValue|Array.<TweenParamValue>; fromTo: TweenParamValue|Array.<TweenParamValue>;}>} TweenObjectValue
+ */
+
+/**
+ * @typedef {Object} PercentageKeyframeOptions
+ * @property {EasingParam} [ease]
+ */
+
+/**
+ * @typedef {Record<String, TweenParamValue>} PercentageKeyframeParams
+ */
+
+/**
+ * @typedef {Record<String, PercentageKeyframeParams & PercentageKeyframeOptions>} PercentageKeyframes
+ */
+
+/**
+ * @typedef {Array<Record<String, TweenOptions | TweenModifier | boolean> & TweenParamsOptions>} DurationKeyframes
+ */
+
+/**
+ * @typedef {Object} AnimationOptions
+ * @property {PercentageKeyframes|DurationKeyframes} [keyframes]
+ * @property {EasingParam} [playbackEase]
+ */
+
+// TODO: Currently setting TweenModifier to the intersected Record<> makes the FunctionValue type target param any if only one parameter is set
+/**
+ * @typedef {Record<String, TweenOptions | Callback<JSAnimation> | TweenModifier | boolean | PercentageKeyframes | DurationKeyframes | ScrollObserver> & TimerOptions & AnimationOptions & TweenParamsOptions & TickableCallbacks<JSAnimation> & RenderableCallbacks<JSAnimation>} AnimationParams
+ */
+
+// Timeline types /////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} TimelineOptions
+ * @property {DefaultsParams} [defaults]
+ * @property {EasingParam} [playbackEase]
+ */
+
+/**
+ * @typedef {TimerOptions & TimelineOptions & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} TimelineParams
+ */
+
+// Animatable types ///////////////////////////////////////////////////////////
+
+/**
+ * @callback AnimatablePropertySetter
+ * @param {Number|Array.<Number>} to
+ * @param {Number} [duration]
+ * @param {EasingParam} [ease]
+ * @return {AnimatableObject}
+ */
+
+/**
+ * @callback AnimatablePropertyGetter
+ * @return {Number|Array.<Number>}
+ */
+
+/**
+ * @typedef {AnimatablePropertySetter & AnimatablePropertyGetter} AnimatableProperty
+ */
+
+/**
+ * @typedef {Animatable & Record<String, AnimatableProperty>} AnimatableObject
+ */
+
+/**
+ * @typedef {Object} AnimatablePropertyParamsOptions
+ * @property {String} [unit]
+ * @property {TweenParamValue} [duration]
+ * @property {EasingParam} [ease]
+ * @property {TweenModifier} [modifier]
+ * @property {TweenComposition} [composition]
+ */
+
+/**
+ * @typedef {Record<String, TweenParamValue | EasingParam | TweenModifier | TweenComposition | AnimatablePropertyParamsOptions> & AnimatablePropertyParamsOptions} AnimatableParams
+ */
+
+// Scope types ////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} ReactRef
+ * @property {HTMLElement|SVGElement|null} [current]
+ */
+
+/**
+ * @typedef {Object} AngularRef
+ * @property {HTMLElement|SVGElement} [nativeElement]
+ */
+
+/**
+ * @typedef {Object} ScopeParams
+ * @property {DOMTargetSelector|ReactRef|AngularRef} [root]
+ * @property {DefaultsParams} [defaults]
+ * @property {Record<String, String>} [mediaQueries]
+ */
+
+/**
+ * @template T
+ * @callback ScopedCallback
+ * @param {Scope} scope
+ * @return {T}
+ */
+
+/**
+ * @callback ScopeCleanupCallback
+ * @param {Scope} [scope]
+ */
+
+/**
+ * @callback ScopeConstructorCallback
+ * @param {Scope} [scope]
+ * @return {ScopeCleanupCallback|void}
+ */
+
+/**
+ * @callback ScopeMethod
+ * @param {...*} args
+ * @return {ScopeCleanupCallback|void}
+ */
+
+// Draggable types ////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} DraggableAxisParam
+ * @property {String} [mapTo]
+ * @property {TweenModifier} [modifier]
+ * @property {TweenComposition} [composition]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
+ */
+
+/**
+ * @typedef {Object} DraggableCursorParams
+ * @property {String} [onHover]
+ * @property {String} [onGrab]
+ */
+
+/**
+ * @typedef {Object} DraggableParams
+ * @property {DOMTargetSelector} [trigger]
+ * @property {DOMTargetSelector|Array<Number>|((draggable: Draggable) => DOMTargetSelector|Array<Number>)} [container]
+ * @property {Boolean|DraggableAxisParam} [x]
+ * @property {Boolean|DraggableAxisParam} [y]
+ * @property {TweenModifier} [modifier]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [containerPadding]
+ * @property {Number|((draggable: Draggable) => Number)} [containerFriction]
+ * @property {Number|((draggable: Draggable) => Number)} [releaseContainerFriction]
+ * @property {Number|((draggable: Draggable) => Number)} [dragSpeed]
+ * @property {Number|((draggable: Draggable) => Number)} [scrollSpeed]
+ * @property {Number|((draggable: Draggable) => Number)} [scrollThreshold]
+ * @property {Number|((draggable: Draggable) => Number)} [minVelocity]
+ * @property {Number|((draggable: Draggable) => Number)} [maxVelocity]
+ * @property {Number|((draggable: Draggable) => Number)} [velocityMultiplier]
+ * @property {Number} [releaseMass]
+ * @property {Number} [releaseStiffness]
+ * @property {Number} [releaseDamping]
+ * @property {Boolean} [releaseDamping]
+ * @property {EasingParam} [releaseEase]
+ * @property {Boolean|DraggableCursorParams|((draggable: Draggable) => Boolean|DraggableCursorParams)} [cursor]
+ * @property {Callback<Draggable>} [onGrab]
+ * @property {Callback<Draggable>} [onDrag]
+ * @property {Callback<Draggable>} [onRelease]
+ * @property {Callback<Draggable>} [onUpdate]
+ * @property {Callback<Draggable>} [onSettle]
+ * @property {Callback<Draggable>} [onSnap]
+ * @property {Callback<Draggable>} [onResize]
+ * @property {Callback<Draggable>} [onAfterResize]
+ */
+
+// Text types /////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} splitTemplateParams
+ * @property {false|String} [class]
+ * @property {Boolean|'visible'|'clip'} [wrap]
+ * @property {Boolean|'top'|'right'|'bottom'|'left'} [clone]
+ */
+
+/**
+ * @typedef {Boolean|String} SplitValue
+ */
+
+/**
+ * @callback SplitFunctionValue
+ * @param {Node|HTMLElement} [value]
+ * @return String
+ */
+
+/**
+ * @typedef {Object} TextSplitterParams
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [lines]
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [words]
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [chars]
+ * @property {Boolean} [accessible]
+ * @property {Boolean} [includeSpaces]
+ * @property {Boolean} [debug]
+ * @property {Callback<TextSplitter>} [onLineCalc]
+ */
+
+// SVG types //////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {SVGGeometryElement & {
+ * setAttribute(name: 'draw', value: `${number} ${number}`): void;
+ * draw: `${number} ${number}`;
+ * }} DrawableSVGGeometry
+ */
+
+
+// Environments
+
+// TODO: Do we need to check if we're running inside a worker ?
+const isBrowser = typeof window !== 'undefined';
+
+/** @type {Object|Null} */
+const win = isBrowser ? window : null;
+
+/** @type {Document} */
+const doc = isBrowser ? document : null;
+
+// Enums
+
+/** @enum {Number} */
+const tweenTypes = {
+ OBJECT: 0,
+ ATTRIBUTE: 1,
+ CSS: 2,
+ TRANSFORM: 3,
+ CSS_VAR: 4,
+};
+
+/** @enum {Number} */
+const valueTypes = {
+ NUMBER: 0,
+ UNIT: 1,
+ COLOR: 2,
+ COMPLEX: 3,
+};
+
+/** @enum {Number} */
+const tickModes = {
+ NONE: 0,
+ AUTO: 1,
+ FORCE: 2,
+};
+
+/** @enum {Number} */
+const compositionTypes = {
+ replace: 0,
+ none: 1,
+ blend: 2,
+};
+
+// Cache symbols
+
+const isRegisteredTargetSymbol = Symbol();
+const isDomSymbol = Symbol();
+const isSvgSymbol = Symbol();
+const transformsSymbol = Symbol();
+const morphPointsSymbol = Symbol();
+const proxyTargetSymbol = Symbol();
+
+// Numbers
+
+const minValue = 1e-11;
+const maxValue = 1e12;
+const K = 1e3;
+const maxFps = 120;
+
+// Strings
+
+const emptyString = '';
+const shortTransforms = new Map();
+
+shortTransforms.set('x', 'translateX');
+shortTransforms.set('y', 'translateY');
+shortTransforms.set('z', 'translateZ');
+
+const validTransforms = [
+ 'translateX',
+ 'translateY',
+ 'translateZ',
+ 'rotate',
+ 'rotateX',
+ 'rotateY',
+ 'rotateZ',
+ 'scale',
+ 'scaleX',
+ 'scaleY',
+ 'scaleZ',
+ 'skew',
+ 'skewX',
+ 'skewY',
+ 'perspective',
+ 'matrix',
+ 'matrix3d',
+];
+
+const transformsFragmentStrings = validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});
+
+// Functions
+
+/** @return {void} */
+const noop = () => {};
+
+// Regex
+
+const hexTestRgx = /(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;
+const rgbExecRgx = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;
+const rgbaExecRgx = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;
+const hslExecRgx = /hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i;
+const hslaExecRgx = /hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;
+// export const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g;
+const digitWithExponentRgx = /[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi;
+// export const unitsExecRgx = /^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)+([a-z]+|%)$/i;
+const unitsExecRgx = /^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i;
+const lowerCaseRgx = /([a-z])([A-Z])/g;
+const transformsExecRgx = /(\w+)(\([^)]+\)+)/g; // Match inline transforms with cacl() values, returns the value wrapped in ()
+const relativeValuesExecRgx = /(\*=|\+=|-=)/;
+
+
+
+
+/** @type {DefaultsParams} */
+const defaults = {
+ id: null,
+ keyframes: null,
+ playbackEase: null,
+ playbackRate: 1,
+ frameRate: maxFps,
+ loop: 0,
+ reversed: false,
+ alternate: false,
+ autoplay: true,
+ duration: K,
+ delay: 0,
+ loopDelay: 0,
+ ease: 'out(2)',
+ composition: compositionTypes.replace,
+ modifier: v => v,
+ onBegin: noop,
+ onBeforeUpdate: noop,
+ onUpdate: noop,
+ onLoop: noop,
+ onPause: noop,
+ onComplete: noop,
+ onRender: noop,
+};
+
+const globals = {
+ /** @type {DefaultsParams} */
+ defaults,
+ /** @type {Document|DOMTarget} */
+ root: doc,
+ /** @type {Scope} */
+ scope: null,
+ /** @type {Number} */
+ precision: 4,
+ /** @type {Number} */
+ timeScale: 1,
+ /** @type {Number} */
+ tickThreshold: 200,
+};
+
+const globalVersions = { version: '4.1.0', engine: null };
+
+if (isBrowser) {
+ if (!win.AnimeJS) win.AnimeJS = [];
+ win.AnimeJS.push(globalVersions);
+}
+
+// Strings
+
+/**
+ * @param {String} str
+ * @return {String}
+ */
+const toLowerCase = str => str.replace(lowerCaseRgx, '$1-$2').toLowerCase();
+
+/**
+ * Prioritize this method instead of regex when possible
+ * @param {String} str
+ * @param {String} sub
+ * @return {Boolean}
+ */
+const stringStartsWith = (str, sub) => str.indexOf(sub) === 0;
+
+// Time
+// Note: Date.now is used instead of performance.now since it is precise enough for timings calculations, performs slightly faster and works in Node.js environement.
+const now = Date.now;
+
+// Types checkers
+
+const isArr = Array.isArray;
+/**@param {any} a @return {a is Record<String, any>} */
+const isObj = a => a && a.constructor === Object;
+/**@param {any} a @return {a is Number} */
+const isNum = a => typeof a === 'number' && !isNaN(a);
+/**@param {any} a @return {a is String} */
+const isStr = a => typeof a === 'string';
+/**@param {any} a @return {a is Function} */
+const isFnc = a => typeof a === 'function';
+/**@param {any} a @return {a is undefined} */
+const isUnd = a => typeof a === 'undefined';
+/**@param {any} a @return {a is null | undefined} */
+const isNil = a => isUnd(a) || a === null;
+/**@param {any} a @return {a is SVGElement} */
+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');
+/**@param {any} a @return {Boolean} */
+const isHsl = a => stringStartsWith(a, 'hsl');
+/**@param {any} a @return {Boolean} */
+const isCol = a => isHex(a) || isRgb(a) || isHsl(a);
+/**@param {any} a @return {Boolean} */
+const isKey = a => !globals.defaults.hasOwnProperty(a);
+
+// Number
+
+/**
+ * @param {Number|String} str
+ * @return {Number}
+ */
+const parseNumber = str => isStr(str) ?
+ parseFloat(/** @type {String} */(str)) :
+ /** @type {Number} */(str);
+
+// Math
+
+const pow = Math.pow;
+const sqrt = Math.sqrt;
+const sin = Math.sin;
+const cos = Math.cos;
+const abs = Math.abs;
+const ceil = Math.ceil;
+const floor = Math.floor;
+const asin = Math.asin;
+const atan2 = Math.atan2;
+const PI = Math.PI;
+const _round = Math.round;
+
+/**
+ * @param {Number} v
+ * @param {Number} min
+ * @param {Number} max
+ * @return {Number}
+ */
+const clamp = (v, min, max) => v < min ? min : v > max ? max : v;
+
+const powCache = {};
+
+/**
+ * @param {Number} v
+ * @param {Number} decimalLength
+ * @return {Number}
+ */
+const round = (v, decimalLength) => {
+ if (decimalLength < 0) return v;
+ if (!decimalLength) return _round(v);
+ let p = powCache[decimalLength];
+ if (!p) p = powCache[decimalLength] = 10 ** decimalLength;
+ return _round(v * p) / p;
+};
+
+/**
+ * @param {Number} v
+ * @param {Number|Array<Number>} increment
+ * @return {Number}
+ */
+const snap = (v, increment) => isArr(increment) ? increment.reduce((closest, cv) => (abs(cv - v) < abs(closest - v) ? cv : closest)) : increment ? _round(v / increment) * increment : v;
+
+/**
+ * @param {Number} start
+ * @param {Number} end
+ * @param {Number} progress
+ * @return {Number}
+ */
+const interpolate = (start, end, progress) => start + (end - start) * progress;
+
+/**
+ * @param {Number} min
+ * @param {Number} max
+ * @param {Number} [decimalLength]
+ * @return {Number}
+ */
+const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength || 0); return floor((Math.random() * (max - min + (1 / m)) + min) * m) / m };
+
+/**
+ * Adapted from https://bost.ocks.org/mike/shuffle/
+ * @param {Array} items
+ * @return {Array}
+ */
+const shuffle = items => {
+ let m = items.length, t, i;
+ while (m) { i = random(0, --m); t = items[m]; items[m] = items[i]; items[i] = t; }
+ return items;
+};
+
+/**
+ * @param {Number} v
+ * @return {Number}
+ */
+const clampInfinity = v => v === Infinity ? maxValue : v === -Infinity ? -1e12 : v;
+
+/**
+ * @param {Number} v
+ * @return {Number}
+ */
+const normalizeTime = v => v <= minValue ? minValue : clampInfinity(round(v, 11));
+
+// Arrays
+
+/**
+ * @template T
+ * @param {T[]} a
+ * @return {T[]}
+ */
+const cloneArray = a => isArr(a) ? [ ...a ] : a;
+
+// Objects
+
+/**
+ * @template T
+ * @template U
+ * @param {T} o1
+ * @param {U} o2
+ * @return {T & U}
+ */
+const mergeObjects = (o1, o2) => {
+ const merged = /** @type {T & U} */({ ...o1 });
+ for (let p in o2) {
+ const o1p = /** @type {T & U} */(o1)[p];
+ merged[p] = isUnd(o1p) ? /** @type {T & U} */(o2)[p] : o1p;
+ } return merged;
+};
+
+// Linked lists
+
+/**
+ * @param {Object} parent
+ * @param {Function} callback
+ * @param {Boolean} [reverse]
+ * @param {String} [prevProp]
+ * @param {String} [nextProp]
+ * @return {void}
+ */
+const forEachChildren = (parent, callback, reverse, prevProp = '_prev', nextProp = '_next') => {
+ let next = parent._head;
+ let adjustedNextProp = nextProp;
+ if (reverse) {
+ next = parent._tail;
+ adjustedNextProp = prevProp;
+ }
+ while (next) {
+ const currentNext = next[adjustedNextProp];
+ callback(next);
+ next = currentNext;
+ }
+};
+
+/**
+ * @param {Object} parent
+ * @param {Object} child
+ * @param {String} [prevProp]
+ * @param {String} [nextProp]
+ * @return {void}
+ */
+const removeChild = (parent, child, prevProp = '_prev', nextProp = '_next') => {
+ const prev = child[prevProp];
+ const next = child[nextProp];
+ prev ? prev[nextProp] = next : parent._head = next;
+ next ? next[prevProp] = prev : parent._tail = prev;
+ child[prevProp] = null;
+ child[nextProp] = null;
+};
+
+/**
+ * @param {Object} parent
+ * @param {Object} child
+ * @param {Function} [sortMethod]
+ * @param {String} prevProp
+ * @param {String} nextProp
+ * @return {void}
+ */
+const addChild = (parent, child, sortMethod, prevProp = '_prev', nextProp = '_next') => {
+ let prev = parent._tail;
+ while (prev && sortMethod && sortMethod(prev, child)) prev = prev[prevProp];
+ const next = prev ? prev[nextProp] : parent._head;
+ prev ? prev[nextProp] = child : parent._head = child;
+ next ? next[prevProp] = child : parent._tail = child;
+ child[prevProp] = prev;
+ child[nextProp] = next;
+};
+
+/*
+ * Base class to control framerate and playback rate.
+ * Inherited by Engine, Timer, Animation and Timeline.
+ */
+class Clock {
+
+ /** @param {Number} [initTime] */
+ constructor(initTime = 0) {
+ /** @type {Number} */
+ this.deltaTime = 0;
+ /** @type {Number} */
+ this._currentTime = initTime;
+ /** @type {Number} */
+ this._elapsedTime = initTime;
+ /** @type {Number} */
+ this._startTime = initTime;
+ /** @type {Number} */
+ this._lastTime = initTime;
+ /** @type {Number} */
+ this._scheduledTime = 0;
+ /** @type {Number} */
+ this._frameDuration = round(K / maxFps, 0);
+ /** @type {Number} */
+ this._fps = maxFps;
+ /** @type {Number} */
+ this._speed = 1;
+ /** @type {Boolean} */
+ this._hasChildren = false;
+ /** @type {Tickable|Tween} */
+ this._head = null;
+ /** @type {Tickable|Tween} */
+ this._tail = null;
+ }
+
+ get fps() {
+ return this._fps;
+ }
+
+ set fps(frameRate) {
+ const previousFrameDuration = this._frameDuration;
+ const fr = +frameRate;
+ const fps = fr < minValue ? minValue : fr;
+ const frameDuration = round(K / fps, 0);
+ this._fps = fps;
+ this._frameDuration = frameDuration;
+ this._scheduledTime += frameDuration - previousFrameDuration;
+ }
+
+ get speed() {
+ return this._speed;
+ }
+
+ set speed(playbackRate) {
+ const pbr = +playbackRate;
+ this._speed = pbr < minValue ? minValue : pbr;
+ }
+
+ /**
+ * @param {Number} time
+ * @return {tickModes}
+ */
+ requestTick(time) {
+ const scheduledTime = this._scheduledTime;
+ const elapsedTime = this._elapsedTime;
+ this._elapsedTime += (time - elapsedTime);
+ // If the elapsed time is lower than the scheduled time
+ // this means not enough time has passed to hit one frameDuration
+ // so skip that frame
+ if (elapsedTime < scheduledTime) return tickModes.NONE;
+ const frameDuration = this._frameDuration;
+ const frameDelta = elapsedTime - scheduledTime;
+ // Ensures that _scheduledTime progresses in steps of at least 1 frameDuration.
+ // Skips ahead if the actual elapsed time is higher.
+ this._scheduledTime += frameDelta < frameDuration ? frameDuration : frameDelta;
+ return tickModes.AUTO;
+ }
+
+ /**
+ * @param {Number} time
+ * @return {Number}
+ */
+ computeDeltaTime(time) {
+ const delta = time - this._lastTime;
+ this.deltaTime = delta;
+ this._lastTime = time;
+ return delta;
+ }
+
+}
+
+
+
+
+/**
+ * @param {Tickable} tickable
+ * @param {Number} time
+ * @param {Number} muteCallbacks
+ * @param {Number} internalRender
+ * @param {tickModes} tickMode
+ * @return {Number}
+ */
+const render = (tickable, time, muteCallbacks, internalRender, tickMode) => {
+
+ const parent = tickable.parent;
+ const duration = tickable.duration;
+ const completed = tickable.completed;
+ const iterationDuration = tickable.iterationDuration;
+ const iterationCount = tickable.iterationCount;
+ const _currentIteration = tickable._currentIteration;
+ const _loopDelay = tickable._loopDelay;
+ const _reversed = tickable._reversed;
+ const _alternate = tickable._alternate;
+ const _hasChildren = tickable._hasChildren;
+ const tickableDelay = tickable._delay;
+ const tickablePrevAbsoluteTime = tickable._currentTime; // TODO: rename ._currentTime to ._absoluteCurrentTime
+
+ const tickableEndTime = tickableDelay + iterationDuration;
+ const tickableAbsoluteTime = time - tickableDelay;
+ const tickablePrevTime = clamp(tickablePrevAbsoluteTime, -tickableDelay, duration);
+ const tickableCurrentTime = clamp(tickableAbsoluteTime, -tickableDelay, duration);
+ const deltaTime = tickableAbsoluteTime - tickablePrevAbsoluteTime;
+ const isCurrentTimeAboveZero = tickableCurrentTime > 0;
+ const isCurrentTimeEqualOrAboveDuration = tickableCurrentTime >= duration;
+ const isSetter = duration <= minValue;
+ const forcedTick = tickMode === tickModes.FORCE;
+
+ let isOdd = 0;
+ let iterationElapsedTime = tickableAbsoluteTime;
+ // Render checks
+ // Used to also check if the children have rendered in order to trigger the onRender callback on the parent timer
+ let hasRendered = 0;
+
+ // Execute the "expensive" iterations calculations only when necessary
+ if (iterationCount > 1) {
+ // bitwise NOT operator seems to be generally faster than Math.floor() across browsers
+ const currentIteration = ~~(tickableCurrentTime / (iterationDuration + (isCurrentTimeEqualOrAboveDuration ? 0 : _loopDelay)));
+ tickable._currentIteration = clamp(currentIteration, 0, iterationCount);
+ // Prevent the iteration count to go above the max iterations when reaching the end of the animation
+ if (isCurrentTimeEqualOrAboveDuration) tickable._currentIteration--;
+ isOdd = tickable._currentIteration % 2;
+ iterationElapsedTime = tickableCurrentTime % (iterationDuration + _loopDelay) || 0;
+ }
+
+ // Checks if exactly one of _reversed and (_alternate && isOdd) is true
+ const isReversed = _reversed ^ (_alternate && isOdd);
+ const _ease = /** @type {Renderable} */(tickable)._ease;
+ let iterationTime = isCurrentTimeEqualOrAboveDuration ? isReversed ? 0 : duration : isReversed ? iterationDuration - iterationElapsedTime : iterationElapsedTime;
+ if (_ease) iterationTime = iterationDuration * _ease(iterationTime / iterationDuration) || 0;
+ const isRunningBackwards = (parent ? parent.backwards : tickableAbsoluteTime < tickablePrevAbsoluteTime) ? !isReversed : !!isReversed;
+
+ tickable._currentTime = tickableAbsoluteTime;
+ tickable._iterationTime = iterationTime;
+ tickable.backwards = isRunningBackwards;
+
+ if (isCurrentTimeAboveZero && !tickable.began) {
+ tickable.began = true;
+ if (!muteCallbacks && !(parent && (isRunningBackwards || !parent.began))) {
+ tickable.onBegin(/** @type {CallbackArgument} */(tickable));
+ }
+ } else if (tickableAbsoluteTime <= 0) {
+ tickable.began = false;
+ }
+
+ // Only triggers onLoop for tickable without children, otherwise call the the onLoop callback in the tick function
+ // Make sure to trigger the onLoop before rendering to allow .refresh() to pickup the current values
+ if (!muteCallbacks && !_hasChildren && isCurrentTimeAboveZero && tickable._currentIteration !== _currentIteration) {
+ tickable.onLoop(/** @type {CallbackArgument} */(tickable));
+ }
+
+ if (
+ forcedTick ||
+ tickMode === tickModes.AUTO && (
+ time >= tickableDelay && time <= tickableEndTime || // Normal render
+ time <= tickableDelay && tickablePrevTime > tickableDelay || // Playhead is before the animation start time so make sure the animation is at its initial state
+ time >= tickableEndTime && tickablePrevTime !== duration // Playhead is after the animation end time so make sure the animation is at its end state
+ ) ||
+ iterationTime >= tickableEndTime && tickablePrevTime !== duration ||
+ iterationTime <= tickableDelay && tickablePrevTime > 0 ||
+ time <= tickablePrevTime && tickablePrevTime === duration && completed || // Force a render if a seek occurs on an completed animation
+ isCurrentTimeEqualOrAboveDuration && !completed && isSetter // This prevents 0 duration tickables to be skipped
+ ) {
+
+ if (isCurrentTimeAboveZero) {
+ // Trigger onUpdate callback before rendering
+ tickable.computeDeltaTime(tickablePrevTime);
+ if (!muteCallbacks) tickable.onBeforeUpdate(/** @type {CallbackArgument} */(tickable));
+ }
+
+ // Start tweens rendering
+ if (!_hasChildren) {
+
+ // Time has jumped more than globals.tickThreshold so consider this tick manual
+ const forcedRender = forcedTick || (isRunningBackwards ? deltaTime * -1 : deltaTime) >= globals.tickThreshold;
+ const absoluteTime = tickable._offset + (parent ? parent._offset : 0) + tickableDelay + iterationTime;
+
+ // Only Animation can have tweens, Timer returns undefined
+ let tween = /** @type {Tween} */(/** @type {JSAnimation} */(tickable)._head);
+ let tweenTarget;
+ let tweenStyle;
+ let tweenTargetTransforms;
+ let tweenTargetTransformsProperties;
+ let tweenTransformsNeedUpdate = 0;
+
+ while (tween) {
+
+ const tweenComposition = tween._composition;
+ const tweenCurrentTime = tween._currentTime;
+ const tweenChangeDuration = tween._changeDuration;
+ const tweenAbsEndTime = tween._absoluteStartTime + tween._changeDuration;
+ const tweenNextRep = tween._nextRep;
+ const tweenPrevRep = tween._prevRep;
+ const tweenHasComposition = tweenComposition !== compositionTypes.none;
+
+ if ((forcedRender || (
+ (tweenCurrentTime !== tweenChangeDuration || absoluteTime <= tweenAbsEndTime + (tweenNextRep ? tweenNextRep._delay : 0)) &&
+ (tweenCurrentTime !== 0 || absoluteTime >= tween._absoluteStartTime)
+ )) && (!tweenHasComposition || (
+ !tween._isOverridden &&
+ (!tween._isOverlapped || absoluteTime <= tweenAbsEndTime) &&
+ (!tweenNextRep || (tweenNextRep._isOverridden || absoluteTime <= tweenNextRep._absoluteStartTime)) &&
+ (!tweenPrevRep || (tweenPrevRep._isOverridden || (absoluteTime >= (tweenPrevRep._absoluteStartTime + tweenPrevRep._changeDuration) + tween._delay)))
+ ))
+ ) {
+
+ const tweenNewTime = tween._currentTime = clamp(iterationTime - tween._startTime, 0, tweenChangeDuration);
+ const tweenProgress = tween._ease(tweenNewTime / tween._updateDuration);
+ const tweenModifier = tween._modifier;
+ const tweenValueType = tween._valueType;
+ const tweenType = tween._tweenType;
+ const tweenIsObject = tweenType === tweenTypes.OBJECT;
+ const tweenIsNumber = tweenValueType === valueTypes.NUMBER;
+ // Only round the in-between frames values if the final value is a string
+ const tweenPrecision = (tweenIsNumber && tweenIsObject) || tweenProgress === 0 || tweenProgress === 1 ? -1 : globals.precision;
+
+ // Recompose tween value
+ /** @type {String|Number} */
+ let value;
+ /** @type {Number} */
+ let number;
+
+ if (tweenIsNumber) {
+ value = number = /** @type {Number} */(tweenModifier(round(interpolate(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision )));
+ } else if (tweenValueType === valueTypes.UNIT) {
+ // Rounding the values speed up string composition
+ number = /** @type {Number} */(tweenModifier(round(interpolate(tween._fromNumber, tween._toNumber, tweenProgress), tweenPrecision)));
+ value = `${number}${tween._unit}`;
+ } else if (tweenValueType === valueTypes.COLOR) {
+ const fn = tween._fromNumbers;
+ const tn = tween._toNumbers;
+ const r = round(clamp(/** @type {Number} */(tweenModifier(interpolate(fn[0], tn[0], tweenProgress))), 0, 255), 0);
+ const g = round(clamp(/** @type {Number} */(tweenModifier(interpolate(fn[1], tn[1], tweenProgress))), 0, 255), 0);
+ const b = round(clamp(/** @type {Number} */(tweenModifier(interpolate(fn[2], tn[2], tweenProgress))), 0, 255), 0);
+ const a = clamp(/** @type {Number} */(tweenModifier(round(interpolate(fn[3], tn[3], tweenProgress), tweenPrecision))), 0, 1);
+ value = `rgba(${r},${g},${b},${a})`;
+ if (tweenHasComposition) {
+ const ns = tween._numbers;
+ ns[0] = r;
+ ns[1] = g;
+ ns[2] = b;
+ ns[3] = a;
+ }
+ } else if (tweenValueType === valueTypes.COMPLEX) {
+ value = tween._strings[0];
+ for (let j = 0, l = tween._toNumbers.length; j < l; j++) {
+ const n = /** @type {Number} */(tweenModifier(round(interpolate(tween._fromNumbers[j], tween._toNumbers[j], tweenProgress), tweenPrecision)));
+ const s = tween._strings[j + 1];
+ value += `${s ? n + s : n}`;
+ if (tweenHasComposition) {
+ tween._numbers[j] = n;
+ }
+ }
+ }
+
+ // For additive tweens and Animatables
+ if (tweenHasComposition) {
+ tween._number = number;
+ }
+
+ if (!internalRender && tweenComposition !== compositionTypes.blend) {
+
+ const tweenProperty = tween.property;
+ tweenTarget = tween.target;
+
+ if (tweenIsObject) {
+ tweenTarget[tweenProperty] = value;
+ } else if (tweenType === tweenTypes.ATTRIBUTE) {
+ /** @type {DOMTarget} */(tweenTarget).setAttribute(tweenProperty, /** @type {String} */(value));
+ } else {
+ tweenStyle = /** @type {DOMTarget} */(tweenTarget).style;
+ if (tweenType === tweenTypes.TRANSFORM) {
+ if (tweenTarget !== tweenTargetTransforms) {
+ tweenTargetTransforms = tweenTarget;
+ // NOTE: Referencing the cachedTransforms in the tween property directly can be a little bit faster but appears to increase memory usage.
+ tweenTargetTransformsProperties = tweenTarget[transformsSymbol];
+ }
+ tweenTargetTransformsProperties[tweenProperty] = value;
+ tweenTransformsNeedUpdate = 1;
+ } else if (tweenType === tweenTypes.CSS) {
+ tweenStyle[tweenProperty] = value;
+ } else if (tweenType === tweenTypes.CSS_VAR) {
+ tweenStyle.setProperty(tweenProperty,/** @type {String} */(value));
+ }
+ }
+
+ if (isCurrentTimeAboveZero) hasRendered = 1;
+
+ } else {
+ // Used for composing timeline tweens without having to do a real render
+ tween._value = value;
+ }
+
+ }
+
+ // NOTE: Possible improvement: Use translate(x,y) / translate3d(x,y,z) syntax
+ // to reduce memory usage on string composition
+ if (tweenTransformsNeedUpdate && tween._renderTransforms) {
+ let str = emptyString;
+ for (let key in tweenTargetTransformsProperties) {
+ str += `${transformsFragmentStrings[key]}${tweenTargetTransformsProperties[key]}) `;
+ }
+ tweenStyle.transform = str;
+ tweenTransformsNeedUpdate = 0;
+ }
+
+ tween = tween._next;
+ }
+
+ if (!muteCallbacks && hasRendered) {
+ /** @type {JSAnimation} */(tickable).onRender(/** @type {JSAnimation} */(tickable));
+ }
+ }
+
+ if (!muteCallbacks && isCurrentTimeAboveZero) {
+ tickable.onUpdate(/** @type {CallbackArgument} */(tickable));
+ }
+
+ }
+
+ // End tweens rendering
+
+ // Handle setters on timeline differently and allow re-trigering the onComplete callback when seeking backwards
+ if (parent && isSetter) {
+ if (!muteCallbacks && (
+ (parent.began && !isRunningBackwards && tickableAbsoluteTime >= duration && !completed) ||
+ (isRunningBackwards && tickableAbsoluteTime <= minValue && completed)
+ )) {
+ tickable.onComplete(/** @type {CallbackArgument} */(tickable));
+ tickable.completed = !isRunningBackwards;
+ }
+ // If currentTime is both above 0 and at least equals to duration, handles normal onComplete or infinite loops
+ } else if (isCurrentTimeAboveZero && isCurrentTimeEqualOrAboveDuration) {
+ if (iterationCount === Infinity) {
+ // Offset the tickable _startTime with its duration to reset _currentTime to 0 and continue the infinite timer
+ tickable._startTime += tickable.duration;
+ } else if (tickable._currentIteration >= iterationCount - 1) {
+ // By setting paused to true, we tell the engine loop to not render this tickable and removes it from the list on the next tick
+ tickable.paused = true;
+ if (!completed && !_hasChildren) {
+ // If the tickable has children, triggers onComplete() only when all children have completed in the tick function
+ tickable.completed = true;
+ if (!muteCallbacks && !(parent && (isRunningBackwards || !parent.began))) {
+ tickable.onComplete(/** @type {CallbackArgument} */(tickable));
+ tickable._resolve(/** @type {CallbackArgument} */(tickable));
+ }
+ }
+ }
+ // Otherwise set the completed flag to false
+ } else {
+ tickable.completed = false;
+ }
+
+ // NOTE: hasRendered * direction (negative for backwards) this way we can remove the tickable.backwards property completly ?
+ return hasRendered;
+};
+
+/**
+ * @param {Tickable} tickable
+ * @param {Number} time
+ * @param {Number} muteCallbacks
+ * @param {Number} internalRender
+ * @param {Number} tickMode
+ * @return {void}
+ */
+const tick = (tickable, time, muteCallbacks, internalRender, tickMode) => {
+ const _currentIteration = tickable._currentIteration;
+ render(tickable, time, muteCallbacks, internalRender, tickMode);
+ if (tickable._hasChildren) {
+ const tl = /** @type {Timeline} */(tickable);
+ const tlIsRunningBackwards = tl.backwards;
+ const tlChildrenTime = internalRender ? time : tl._iterationTime;
+ const tlCildrenTickTime = now();
+
+ let tlChildrenHasRendered = 0;
+ let tlChildrenHaveCompleted = true;
+
+ // If the timeline has looped forward, we need to manually triggers children skipped callbacks
+ if (!internalRender && tl._currentIteration !== _currentIteration) {
+ const tlIterationDuration = tl.iterationDuration;
+ forEachChildren(tl, (/** @type {JSAnimation} */child) => {
+ if (!tlIsRunningBackwards) {
+ // Force an internal render to trigger the callbacks if the child has not completed on loop
+ if (!child.completed && !child.backwards && child._currentTime < child.iterationDuration) {
+ render(child, tlIterationDuration, muteCallbacks, 1, tickModes.FORCE);
+ }
+ // Reset their began and completed flags to allow retrigering callbacks on the next iteration
+ child.began = false;
+ child.completed = false;
+ } else {
+ const childDuration = child.duration;
+ const childStartTime = child._offset + child._delay;
+ const childEndTime = childStartTime + childDuration;
+ // Triggers the onComplete callback on reverse for children on the edges of the timeline
+ if (!muteCallbacks && childDuration <= minValue && (!childStartTime || childEndTime === tlIterationDuration)) {
+ child.onComplete(child);
+ }
+ }
+ });
+ if (!muteCallbacks) tl.onLoop(/** @type {CallbackArgument} */(tl));
+ }
+
+ forEachChildren(tl, (/** @type {JSAnimation} */child) => {
+ const childTime = round((tlChildrenTime - child._offset) * child._speed, 12); // Rounding is needed when using seconds
+ const childTickMode = child._fps < tl._fps ? child.requestTick(tlCildrenTickTime) : tickMode;
+ tlChildrenHasRendered += render(child, childTime, muteCallbacks, internalRender, childTickMode);
+ if (!child.completed && tlChildrenHaveCompleted) tlChildrenHaveCompleted = false;
+ }, tlIsRunningBackwards);
+
+ // Renders on timeline are triggered by its children so it needs to be set after rendering the children
+ if (!muteCallbacks && tlChildrenHasRendered) tl.onRender(/** @type {CallbackArgument} */(tl));
+
+ // Triggers the timeline onComplete() once all chindren all completed and the current time has reached the end
+ if (tlChildrenHaveCompleted && tl._currentTime >= tl.duration) {
+ // Make sure the paused flag is false in case it has been skipped in the render function
+ tl.paused = true;
+ if (!tl.completed) {
+ tl.completed = true;
+ if (!muteCallbacks) {
+ tl.onComplete(/** @type {CallbackArgument} */(tl));
+ tl._resolve(/** @type {CallbackArgument} */(tl));
+ }
+ }
+ }
+ }
+};
+
+
+
+
+const additive = {
+ animation: null,
+ update: noop,
+};
+
+/**
+ * @typedef AdditiveAnimation
+ * @property {Number} duration
+ * @property {Number} _offset
+ * @property {Number} _delay
+ * @property {Tween} _head
+ * @property {Tween} _tail
+ */
+
+/**
+ * @param {TweenAdditiveLookups} lookups
+ * @return {AdditiveAnimation}
+ */
+const addAdditiveAnimation = lookups => {
+ let animation = additive.animation;
+ if (!animation) {
+ animation = {
+ duration: minValue,
+ computeDeltaTime: noop,
+ _offset: 0,
+ _delay: 0,
+ _head: null,
+ _tail: null,
+ };
+ additive.animation = animation;
+ additive.update = () => {
+ lookups.forEach(propertyAnimation => {
+ for (let propertyName in propertyAnimation) {
+ const tweens = propertyAnimation[propertyName];
+ const lookupTween = tweens._head;
+ if (lookupTween) {
+ const valueType = lookupTween._valueType;
+ const additiveValues = valueType === valueTypes.COMPLEX || valueType === valueTypes.COLOR ? cloneArray(lookupTween._fromNumbers) : null;
+ let additiveValue = lookupTween._fromNumber;
+ let tween = tweens._tail;
+ while (tween && tween !== lookupTween) {
+ if (additiveValues) {
+ for (let i = 0, l = tween._numbers.length; i < l; i++) additiveValues[i] += tween._numbers[i];
+ } else {
+ additiveValue += tween._number;
+ }
+ tween = tween._prevAdd;
+ }
+ lookupTween._toNumber = additiveValue;
+ lookupTween._toNumbers = additiveValues;
+ }
+ }
+ });
+ // TODO: Avoid polymorphism here, idealy the additive animation should be a regular animation with a higher priority in the render loop
+ render(animation, 1, 1, 0, tickModes.FORCE);
+ };
+ }
+ return animation;
+};
+
+const engineTickMethod = isBrowser ? requestAnimationFrame : setImmediate;
+const engineCancelMethod = isBrowser ? cancelAnimationFrame : clearImmediate;
+
+class Engine extends Clock {
+
+ /** @param {Number} [initTime] */
+ constructor(initTime) {
+ super(initTime);
+ this.useDefaultMainLoop = true;
+ this.pauseOnDocumentHidden = true;
+ /** @type {DefaultsParams} */
+ this.defaults = defaults;
+ this.paused = isBrowser && doc.hidden ? true : false;
+ /** @type {Number|NodeJS.Immediate} */
+ this.reqId = null;
+ }
+
+ update() {
+ const time = this._currentTime = now();
+ if (this.requestTick(time)) {
+ this.computeDeltaTime(time);
+ const engineSpeed = this._speed;
+ const engineFps = this._fps;
+ let activeTickable = /** @type {Tickable} */(this._head);
+ while (activeTickable) {
+ const nextTickable = activeTickable._next;
+ if (!activeTickable.paused) {
+ tick(
+ activeTickable,
+ (time - activeTickable._startTime) * activeTickable._speed * engineSpeed,
+ 0, // !muteCallbacks
+ 0, // !internalRender
+ activeTickable._fps < engineFps ? activeTickable.requestTick(time) : tickModes.AUTO
+ );
+ } else {
+ removeChild(this, activeTickable);
+ this._hasChildren = !!this._tail;
+ activeTickable._running = false;
+ if (activeTickable.completed && !activeTickable._cancelled) {
+ activeTickable.cancel();
+ }
+ }
+ activeTickable = nextTickable;
+ }
+ additive.update();
+ }
+ }
+
+ wake() {
+ if (this.useDefaultMainLoop && !this.reqId && !this.paused) {
+ this.reqId = engineTickMethod(tickEngine);
+ }
+ return this;
+ }
+
+ pause() {
+ this.paused = true;
+ return killEngine();
+ }
+
+ resume() {
+ if (!this.paused) return;
+ this.paused = false;
+ forEachChildren(this, (/** @type {Tickable} */child) => child.resetTime());
+ return this.wake();
+ }
+
+ // Getter and setter for speed
+ get speed() {
+ return this._speed * (globals.timeScale === 1 ? 1 : K);
+ }
+
+ set speed(playbackRate) {
+ this._speed = playbackRate * globals.timeScale;
+ forEachChildren(this, (/** @type {Tickable} */child) => child.speed = child._speed);
+ }
+
+ // Getter and setter for timeUnit
+ get timeUnit() {
+ return globals.timeScale === 1 ? 'ms' : 's';
+ };
+
+ set timeUnit(unit) {
+ const secondsScale = 0.001;
+ const isSecond = unit === 's';
+ const newScale = isSecond ? secondsScale : 1;
+ if (globals.timeScale !== newScale) {
+ globals.timeScale = newScale;
+ globals.tickThreshold = 200 * newScale;
+ const scaleFactor = isSecond ? secondsScale : K;
+ /** @type {Number} */
+ (this.defaults.duration) *= scaleFactor;
+ this._speed *= scaleFactor;
+ }
+ }
+
+ // Getter and setter for precision
+ get precision() {
+ return globals.precision;
+ }
+
+ set precision(precision) {
+ globals.precision = precision;
+ }
+
+}
+const engine = /*#__PURE__*/(() => {
+ const engine = new Engine(now());
+ if (isBrowser) {
+ globalVersions.engine = engine;
+ doc.addEventListener('visibilitychange', () => {
+ if (!engine.pauseOnDocumentHidden) return;
+ doc.hidden ? engine.pause() : engine.resume();
+ });
+ }
+ return engine;
+})();
+
+
+const tickEngine = () => {
+ if (engine._head) {
+ engine.reqId = engineTickMethod(tickEngine);
+ engine.update();
+ } else {
+ engine.reqId = 0;
+ }
+};
+
+const killEngine = () => {
+ engineCancelMethod(/** @type {NodeJS.Immediate & Number} */(engine.reqId));
+ engine.reqId = 0;
+ return engine;
+};
+
+
+
+
+/**
+ * @param {DOMTarget} target
+ * @param {String} propName
+ * @param {Object} animationInlineStyles
+ * @return {String}
+ */
+const parseInlineTransforms = (target, propName, animationInlineStyles) => {
+ const inlineTransforms = target.style.transform;
+ let inlinedStylesPropertyValue;
+ if (inlineTransforms) {
+ const cachedTransforms = target[transformsSymbol];
+ let t; while (t = transformsExecRgx.exec(inlineTransforms)) {
+ const inlinePropertyName = t[1];
+ // const inlinePropertyValue = t[2];
+ const inlinePropertyValue = t[2].slice(1, -1);
+ cachedTransforms[inlinePropertyName] = inlinePropertyValue;
+ if (inlinePropertyName === propName) {
+ inlinedStylesPropertyValue = inlinePropertyValue;
+ // Store the new parsed inline styles if animationInlineStyles is provided
+ if (animationInlineStyles) {
+ animationInlineStyles[propName] = inlinePropertyValue;
+ }
+ }
+ }
+ }
+ return inlineTransforms && !isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :
+ stringStartsWith(propName, 'scale') ? '1' :
+ stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew') ? '0deg' : '0px';
+};
+
+
+
+
+/**
+ * @param {DOMTargetsParam|TargetsParam} v
+ * @return {NodeList|HTMLCollection}
+ */
+function getNodeList(v) {
+ const n = isStr(v) ? globals.root.querySelectorAll(v) : v;
+ if (n instanceof NodeList || n instanceof HTMLCollection) return n;
+}
+
+/**
+ * @overload
+ * @param {DOMTargetsParam} targets
+ * @return {DOMTargetsArray}
+ *
+ * @overload
+ * @param {JSTargetsParam} targets
+ * @return {JSTargetsArray}
+ *
+ * @overload
+ * @param {TargetsParam} targets
+ * @return {TargetsArray}
+ *
+ * @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
+ */
+function parseTargets(targets) {
+ if (isNil(targets)) return /** @type {TargetsArray} */([]);
+ if (isArr(targets)) {
+ const flattened = targets.flat(Infinity);
+ /** @type {TargetsArray} */
+ const parsed = [];
+ for (let i = 0, l = flattened.length; i < l; i++) {
+ const item = flattened[i];
+ if (!isNil(item)) {
+ const nodeList = getNodeList(item);
+ if (nodeList) {
+ for (let j = 0, jl = nodeList.length; j < jl; j++) {
+ const subItem = nodeList[j];
+ if (!isNil(subItem)) {
+ let isDuplicate = false;
+ for (let k = 0, kl = parsed.length; k < kl; k++) {
+ if (parsed[k] === subItem) {
+ isDuplicate = true;
+ break;
+ }
+ }
+ if (!isDuplicate) {
+ parsed.push(subItem);
+ }
+ }
+ }
+ } else {
+ let isDuplicate = false;
+ for (let j = 0, jl = parsed.length; j < jl; j++) {
+ if (parsed[j] === item) {
+ isDuplicate = true;
+ break;
+ }
+ }
+ if (!isDuplicate) {
+ parsed.push(item);
+ }
+ }
+ }
+ }
+ return parsed;
+ }
+ if (!isBrowser) return /** @type {JSTargetsArray} */([targets]);
+ const nodeList = getNodeList(targets);
+ if (nodeList) return /** @type {DOMTargetsArray} */(Array.from(nodeList));
+ return /** @type {TargetsArray} */([targets]);
+}
+
+/**
+ * @overload
+ * @param {DOMTargetsParam} targets
+ * @return {DOMTargetsArray}
+ *
+ * @overload
+ * @param {JSTargetsParam} targets
+ * @return {JSTargetsArray}
+ *
+ * @overload
+ * @param {TargetsParam} targets
+ * @return {TargetsArray}
+ *
+ * @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
+ */
+function registerTargets(targets) {
+ const parsedTargetsArray = parseTargets(targets);
+ const parsedTargetsLength = parsedTargetsArray.length;
+ if (parsedTargetsLength) {
+ for (let i = 0; i < parsedTargetsLength; i++) {
+ const target = parsedTargetsArray[i];
+ if (!target[isRegisteredTargetSymbol]) {
+ target[isRegisteredTargetSymbol] = true;
+ const isSvgType = isSvg(target);
+ const isDom = /** @type {DOMTarget} */(target).nodeType || isSvgType;
+ if (isDom) {
+ target[isDomSymbol] = true;
+ target[isSvgSymbol] = isSvgType;
+ target[transformsSymbol] = {};
+ }
+ }
+ }
+ }
+ return parsedTargetsArray;
+}
+
+
+
+
+/**
+ * @param {TargetsParam} path
+ * @return {SVGGeometryElement|undefined}
+ */
+const getPath = path => {
+ const parsedTargets = parseTargets(path);
+ const $parsedSvg = /** @type {SVGGeometryElement} */(parsedTargets[0]);
+ if (!$parsedSvg || !isSvg($parsedSvg)) return;
+ return $parsedSvg;
+};
+
+/**
+ * @param {TargetsParam} path2
+ * @param {Number} [precision]
+ * @return {FunctionValue}
+ */
+const morphTo = (path2, precision = .33) => ($path1) => {
+ const $path2 = /** @type {SVGGeometryElement} */(getPath(path2));
+ if (!$path2) return;
+ const isPath = $path1.tagName === 'path';
+ const separator = isPath ? ' ' : ',';
+ const previousPoints = $path1[morphPointsSymbol];
+ if (previousPoints) $path1.setAttribute(isPath ? 'd' : 'points', previousPoints);
+
+ let v1 = '', v2 = '';
+
+ if (!precision) {
+ v1 = $path1.getAttribute(isPath ? 'd' : 'points');
+ v2 = $path2.getAttribute(isPath ? 'd' : 'points');
+ } else {
+ const length1 = /** @type {SVGGeometryElement} */($path1).getTotalLength();
+ const length2 = $path2.getTotalLength();
+ const maxPoints = Math.max(Math.ceil(length1 * precision), Math.ceil(length2 * precision));
+ for (let i = 0; i < maxPoints; i++) {
+ const t = i / (maxPoints - 1);
+ const pointOnPath1 = /** @type {SVGGeometryElement} */($path1).getPointAtLength(length1 * t);
+ const pointOnPath2 = $path2.getPointAtLength(length2 * t);
+ const prefix = isPath ? (i === 0 ? 'M' : 'L') : '';
+ v1 += prefix + round(pointOnPath1.x, 3) + separator + pointOnPath1.y + ' ';
+ v2 += prefix + round(pointOnPath2.x, 3) + separator + pointOnPath2.y + ' ';
+ }
+ }
+
+ $path1[morphPointsSymbol] = v2;
+
+ return [v1, v2];
+};
+
+/**
+ * @param {SVGGeometryElement} [$el]
+ * @return {Number}
+ */
+const getScaleFactor = $el => {
+ let scaleFactor = 1;
+ if ($el && $el.getCTM) {
+ const ctm = $el.getCTM();
+ if (ctm) {
+ const scaleX = sqrt(ctm.a * ctm.a + ctm.b * ctm.b);
+ const scaleY = sqrt(ctm.c * ctm.c + ctm.d * ctm.d);
+ scaleFactor = (scaleX + scaleY) / 2;
+ }
+ }
+ return scaleFactor;
+};
+
+/**
+ * Creates a proxy that wraps an SVGGeometryElement and adds drawing functionality.
+ * @param {SVGGeometryElement} $el - The SVG element to transform into a drawable
+ * @param {number} start - Starting position (0-1)
+ * @param {number} end - Ending position (0-1)
+ * @return {DrawableSVGGeometry} - Returns a proxy that preserves the original element's type with additional 'draw' attribute functionality
+ */
+const createDrawableProxy = ($el, start, end) => {
+ const pathLength = K;
+ const computedStyles = getComputedStyle($el);
+ const strokeLineCap = computedStyles.strokeLinecap;
+ // @ts-ignore
+ const $scalled = computedStyles.vectorEffect === 'non-scaling-stroke' ? $el : null;
+ let currentCap = strokeLineCap;
+
+ const proxy = new Proxy($el, {
+ get(target, property) {
+ const value = target[property];
+ if (property === proxyTargetSymbol) return target;
+ if (property === 'setAttribute') {
+ return (...args) => {
+ if (args[0] === 'draw') {
+ const value = args[1];
+ const values = value.split(' ');
+ const v1 = +values[0];
+ const v2 = +values[1];
+ // TOTO: Benchmark if performing two slices is more performant than one split
+ // const spaceIndex = value.indexOf(' ');
+ // const v1 = round(+value.slice(0, spaceIndex), precision);
+ // const v2 = round(+value.slice(spaceIndex + 1), precision);
+ const scaleFactor = getScaleFactor($scalled);
+ const os = v1 * -1e3 * scaleFactor;
+ const d1 = (v2 * pathLength * scaleFactor) + os;
+ const d2 = (pathLength * scaleFactor +
+ ((v1 === 0 && v2 === 1) || (v1 === 1 && v2 === 0) ? 0 : 10 * scaleFactor) - d1);
+ if (strokeLineCap !== 'butt') {
+ const newCap = v1 === v2 ? 'butt' : strokeLineCap;
+ if (currentCap !== newCap) {
+ target.style.strokeLinecap = `${newCap}`;
+ currentCap = newCap;
+ }
+ }
+ target.setAttribute('stroke-dashoffset', `${os}`);
+ target.setAttribute('stroke-dasharray', `${d1} ${d2}`);
+ }
+ return Reflect.apply(value, target, args);
+ };
+ }
+
+ if (isFnc(value)) {
+ return (...args) => Reflect.apply(value, target, args);
+ } else {
+ return value;
+ }
+ }
+ });
+
+ if ($el.getAttribute('pathLength') !== `${pathLength}`) {
+ $el.setAttribute('pathLength', `${pathLength}`);
+ proxy.setAttribute('draw', `${start} ${end}`);
+ }
+
+ return /** @type {DrawableSVGGeometry} */(proxy);
+};
+
+/**
+ * Creates drawable proxies for multiple SVG elements.
+ * @param {TargetsParam} selector - CSS selector, SVG element, or array of elements and selectors
+ * @param {number} [start=0] - Starting position (0-1)
+ * @param {number} [end=0] - Ending position (0-1)
+ * @return {Array<DrawableSVGGeometry>} - Array of proxied elements with drawing functionality
+ */
+const createDrawable = (selector, start = 0, end = 0) => {
+ const els = parseTargets(selector);
+ return els.map($el => createDrawableProxy(
+ /** @type {SVGGeometryElement} */($el),
+ start,
+ end
+ ));
+};
+
+// Motion path animation
+
+/**
+ * @param {SVGGeometryElement} $path
+ * @param {Number} progress
+ * @param {Number}lookup
+ * @return {DOMPoint}
+ */
+const getPathPoint = ($path, progress, lookup = 0) => {
+ return $path.getPointAtLength(progress + lookup >= 1 ? progress + lookup : 0);
+};
+
+/**
+ * @param {SVGGeometryElement} $path
+ * @param {String} pathProperty
+ * @return {FunctionValue}
+ */
+const getPathProgess = ($path, pathProperty) => {
+ return $el => {
+ const totalLength = +($path.getTotalLength());
+ const inSvg = $el[isSvgSymbol];
+ const ctm = $path.getCTM();
+ /** @type {TweenObjectValue} */
+ return {
+ from: 0,
+ to: totalLength,
+ /** @type {TweenModifier} */
+ modifier: progress => {
+ if (pathProperty === 'a') {
+ const p0 = getPathPoint($path, progress, -1);
+ const p1 = getPathPoint($path, progress, 1);
+ return atan2(p1.y - p0.y, p1.x - p0.x) * 180 / PI;
+ } else {
+ const p = getPathPoint($path, progress, 0);
+ return pathProperty === 'x' ?
+ inSvg || !ctm ? p.x : p.x * ctm.a + p.y * ctm.c + ctm.e :
+ inSvg || !ctm ? p.y : p.x * ctm.b + p.y * ctm.d + ctm.f
+ }
+ }
+ }
+ }
+};
+
+/**
+ * @param {TargetsParam} path
+ */
+const createMotionPath = path => {
+ const $path = getPath(path);
+ if (!$path) return;
+ return {
+ translateX: getPathProgess($path, 'x'),
+ translateY: getPathProgess($path, 'y'),
+ rotate: getPathProgess($path, 'a'),
+ }
+};
+
+// Check for valid SVG attribute
+
+const cssReservedProperties = ['opacity', 'rotate', 'overflow', 'color'];
+
+/**
+ * @param {Target} el
+ * @param {String} propertyName
+ * @return {Boolean}
+ */
+const isValidSVGAttribute = (el, propertyName) => {
+ // Return early and use CSS opacity animation instead (already better default values (opacity: 1 instead of 0)) and rotate should be considered a transform
+ if (cssReservedProperties.includes(propertyName)) return false;
+ if (el.getAttribute(propertyName) || propertyName in el) {
+ if (propertyName === 'scale') { // Scale
+ const elParentNode = /** @type {SVGGeometryElement} */(/** @type {DOMTarget} */(el).parentNode);
+ // Only consider scale as a valid SVG attribute on filter element
+ return elParentNode && elParentNode.tagName === 'filter';
+ }
+ return true;
+ }
+};
+
+const svg = {
+ morphTo,
+ createMotionPath,
+ createDrawable,
+};
+
+
+
+
+/**
+ * RGB / RGBA Color value string -> RGBA values array
+ * @param {String} rgbValue
+ * @return {ColorArray}
+ */
+const rgbToRgba = rgbValue => {
+ const rgba = rgbExecRgx.exec(rgbValue) || rgbaExecRgx.exec(rgbValue);
+ const a = !isUnd(rgba[4]) ? +rgba[4] : 1;
+ return [
+ +rgba[1],
+ +rgba[2],
+ +rgba[3],
+ a
+ ]
+};
+
+/**
+ * HEX3 / HEX3A / HEX6 / HEX6A Color value string -> RGBA values array
+ * @param {String} hexValue
+ * @return {ColorArray}
+ */
+const hexToRgba = hexValue => {
+ const hexLength = hexValue.length;
+ const isShort = hexLength === 4 || hexLength === 5;
+ return [
+ +('0x' + hexValue[1] + hexValue[isShort ? 1 : 2]),
+ +('0x' + hexValue[isShort ? 2 : 3] + hexValue[isShort ? 2 : 4]),
+ +('0x' + hexValue[isShort ? 3 : 5] + hexValue[isShort ? 3 : 6]),
+ ((hexLength === 5 || hexLength === 9) ? +(+('0x' + hexValue[isShort ? 4 : 7] + hexValue[isShort ? 4 : 8]) / 255).toFixed(3) : 1)
+ ]
+};
+
+/**
+ * @param {Number} p
+ * @param {Number} q
+ * @param {Number} t
+ * @return {Number}
+ */
+const hue2rgb = (p, q, t) => {
+ if (t < 0) t += 1;
+ if (t > 1) t -= 1;
+ return t < 1 / 6 ? p + (q - p) * 6 * t :
+ t < 1 / 2 ? q :
+ t < 2 / 3 ? p + (q - p) * (2 / 3 - t) * 6 :
+ p;
+};
+
+/**
+ * HSL / HSLA Color value string -> RGBA values array
+ * @param {String} hslValue
+ * @return {ColorArray}
+ */
+const hslToRgba = hslValue => {
+ const hsla = hslExecRgx.exec(hslValue) || hslaExecRgx.exec(hslValue);
+ const h = +hsla[1] / 360;
+ const s = +hsla[2] / 100;
+ const l = +hsla[3] / 100;
+ const a = !isUnd(hsla[4]) ? +hsla[4] : 1;
+ let r, g, b;
+ if (s === 0) {
+ r = g = b = l;
+ } else {
+ const q = l < .5 ? l * (1 + s) : l + s - l * s;
+ const p = 2 * l - q;
+ r = round(hue2rgb(p, q, h + 1 / 3) * 255, 0);
+ g = round(hue2rgb(p, q, h) * 255, 0);
+ b = round(hue2rgb(p, q, h - 1 / 3) * 255, 0);
+ }
+ return [r, g, b, a];
+};
+
+/**
+ * All in one color converter that converts a color string value into an array of RGBA values
+ * @param {String} colorString
+ * @return {ColorArray}
+ */
+const convertColorStringValuesToRgbaArray = colorString => {
+ return isRgb(colorString) ? rgbToRgba(colorString) :
+ isHex(colorString) ? hexToRgba(colorString) :
+ isHsl(colorString) ? hslToRgba(colorString) :
+ [0, 0, 0, 1];
+};
+
+
+
+
+/**
+ * @template T, D
+ * @param {T|undefined} targetValue
+ * @param {D} defaultValue
+ * @return {T|D}
+ */
+const setValue = (targetValue, defaultValue) => {
+ return isUnd(targetValue) ? defaultValue : targetValue;
+};
+
+/**
+ * @param {TweenPropValue} value
+ * @param {Target} target
+ * @param {Number} index
+ * @param {Number} total
+ * @param {Object} [store]
+ * @return {any}
+ */
+const getFunctionValue = (value, target, index, total, store) => {
+ if (isFnc(value)) {
+ const func = () => {
+ const computed = /** @type {Function} */(value)(target, index, total);
+ // Fallback to 0 if the function returns undefined / NaN / null / false / 0
+ return !isNaN(+computed) ? +computed : computed || 0;
+ };
+ if (store) {
+ store.func = func;
+ }
+ return func();
+ } else {
+ return value;
+ }
+};
+
+/**
+ * @param {Target} target
+ * @param {String} prop
+ * @return {tweenTypes}
+ */
+const getTweenType = (target, prop) => {
+ return !target[isDomSymbol] ? tweenTypes.OBJECT :
+ // Handle SVG attributes
+ target[isSvgSymbol] && isValidSVGAttribute(target, prop) ? tweenTypes.ATTRIBUTE :
+ // Handle CSS Transform properties differently than CSS to allow individual animations
+ validTransforms.includes(prop) || shortTransforms.get(prop) ? tweenTypes.TRANSFORM :
+ // CSS variables
+ stringStartsWith(prop, '--') ? tweenTypes.CSS_VAR :
+ // All other CSS properties
+ prop in /** @type {DOMTarget} */(target).style ? tweenTypes.CSS :
+ // Handle other DOM Attributes
+ prop in target ? tweenTypes.OBJECT :
+ tweenTypes.ATTRIBUTE;
+};
+
+/**
+ * @param {DOMTarget} target
+ * @param {String} propName
+ * @param {Object} animationInlineStyles
+ * @return {String}
+ */
+const getCSSValue = (target, propName, animationInlineStyles) => {
+ const inlineStyles = target.style[propName];
+ if (inlineStyles && animationInlineStyles) {
+ animationInlineStyles[propName] = inlineStyles;
+ }
+ const value = inlineStyles || getComputedStyle(target[proxyTargetSymbol] || target).getPropertyValue(propName);
+ return value === 'auto' ? '0' : value;
+};
+
+/**
+ * @param {Target} target
+ * @param {String} propName
+ * @param {tweenTypes} [tweenType]
+ * @param {Object|void} [animationInlineStyles]
+ * @return {String|Number}
+ */
+const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {
+ const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);
+ return type === tweenTypes.OBJECT ? target[propName] || 0 :
+ type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :
+ type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :
+ type === tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :
+ getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);
+};
+
+/**
+ * @param {Number} x
+ * @param {Number} y
+ * @param {String} operator
+ * @return {Number}
+ */
+const getRelativeValue = (x, y, operator) => {
+ return operator === '-' ? x - y :
+ operator === '+' ? x + y :
+ x * y;
+};
+
+/** @return {TweenDecomposedValue} */
+const createDecomposedValueTargetObject = () => {
+ return {
+ /** @type {valueTypes} */
+ t: valueTypes.NUMBER,
+ n: 0,
+ u: null,
+ o: null,
+ d: null,
+ s: null,
+ }
+};
+
+/**
+ * @param {String|Number} rawValue
+ * @param {TweenDecomposedValue} targetObject
+ * @return {TweenDecomposedValue}
+ */
+const decomposeRawValue = (rawValue, targetObject) => {
+ /** @type {valueTypes} */
+ targetObject.t = valueTypes.NUMBER;
+ targetObject.n = 0;
+ targetObject.u = null;
+ targetObject.o = null;
+ targetObject.d = null;
+ targetObject.s = null;
+ if (!rawValue) return targetObject;
+ const num = +rawValue;
+ if (!isNaN(num)) {
+ // It's a number
+ targetObject.n = num;
+ return targetObject;
+ } else {
+ // let str = /** @type {String} */(rawValue).trim();
+ let str = /** @type {String} */(rawValue);
+ // Parsing operators (+=, -=, *=) manually is much faster than using regex here
+ if (str[1] === '=') {
+ targetObject.o = str[0];
+ str = str.slice(2);
+ }
+ // Skip exec regex if the value type is complex or color to avoid long regex backtracking
+ const unitMatch = str.includes(' ') ? false : unitsExecRgx.exec(str);
+ if (unitMatch) {
+ // Has a number and a unit
+ targetObject.t = valueTypes.UNIT;
+ targetObject.n = +unitMatch[1];
+ targetObject.u = unitMatch[2];
+ return targetObject;
+ } else if (targetObject.o) {
+ // Has an operator (+=, -=, *=)
+ targetObject.n = +str;
+ return targetObject;
+ } else if (isCol(str)) {
+ // Is a color
+ targetObject.t = valueTypes.COLOR;
+ targetObject.d = convertColorStringValuesToRgbaArray(str);
+ return targetObject;
+ } else {
+ // Is a more complex string (generally svg coords, calc() or filters CSS values)
+ const matchedNumbers = str.match(digitWithExponentRgx);
+ targetObject.t = valueTypes.COMPLEX;
+ targetObject.d = matchedNumbers ? matchedNumbers.map(Number) : [];
+ targetObject.s = str.split(digitWithExponentRgx) || [];
+ return targetObject;
+ }
+ }
+};
+
+/**
+ * @param {Tween} tween
+ * @param {TweenDecomposedValue} targetObject
+ * @return {TweenDecomposedValue}
+ */
+const decomposeTweenValue = (tween, targetObject) => {
+ targetObject.t = tween._valueType;
+ targetObject.n = tween._toNumber;
+ targetObject.u = tween._unit;
+ targetObject.o = null;
+ targetObject.d = cloneArray(tween._toNumbers);
+ targetObject.s = cloneArray(tween._strings);
+ return targetObject;
+};
+
+const decomposedOriginalValue = createDecomposedValueTargetObject();
+
+
+
+
+const lookups = {
+ /** @type {TweenReplaceLookups} */
+ _rep: new WeakMap(),
+ /** @type {TweenAdditiveLookups} */
+ _add: new Map(),
+};
+
+/**
+ * @param {Target} target
+ * @param {String} property
+ * @param {String} lookup
+ * @return {TweenPropertySiblings}
+ */
+const getTweenSiblings = (target, property, lookup = '_rep') => {
+ const lookupMap = lookups[lookup];
+ let targetLookup = lookupMap.get(target);
+ if (!targetLookup) {
+ targetLookup = {};
+ lookupMap.set(target, targetLookup);
+ }
+ return targetLookup[property] ? targetLookup[property] : targetLookup[property] = {
+ _head: null,
+ _tail: null,
+ }
+};
+
+/**
+ * @param {Tween} p
+ * @param {Tween} c
+ * @return {Number|Boolean}
+ */
+const addTweenSortMethod = (p, c) => {
+ return p._isOverridden || p._absoluteStartTime > c._absoluteStartTime;
+};
+
+/**
+ * @param {Tween} tween
+ */
+const overrideTween = tween => {
+ tween._isOverlapped = 1;
+ tween._isOverridden = 1;
+ tween._changeDuration = minValue;
+ tween._currentTime = minValue;
+};
+
+/**
+ * @param {Tween} tween
+ * @param {TweenPropertySiblings} siblings
+ * @return {Tween}
+ */
+const composeTween = (tween, siblings) => {
+
+ const tweenCompositionType = tween._composition;
+
+ // Handle replaced tweens
+
+ if (tweenCompositionType === compositionTypes.replace) {
+
+ const tweenAbsStartTime = tween._absoluteStartTime;
+
+ addChild(siblings, tween, addTweenSortMethod, '_prevRep', '_nextRep');
+
+ const prevSibling = tween._prevRep;
+
+ // Update the previous siblings for composition replace tweens
+
+ if (prevSibling) {
+
+ const prevParent = prevSibling.parent;
+ const prevAbsEndTime = prevSibling._absoluteStartTime + prevSibling._changeDuration;
+
+ // Handle looped animations tween
+
+ if (
+ // Check if the previous tween is from a different animation
+ tween.parent.id !== prevParent.id &&
+ // Check if the animation has loops
+ prevParent.iterationCount> 1 &&
+ // Check if _absoluteChangeEndTime of last loop overlaps the current tween
+ prevAbsEndTime + (prevParent.duration - prevParent.iterationDuration) > tweenAbsStartTime
+ ) {
+
+ // TODO: Find a way to only override the iterations overlapping with the tween
+ overrideTween(prevSibling);
+
+ let prevPrevSibling = prevSibling._prevRep;
+
+ // If the tween was part of a set of keyframes, override its siblings
+ while (prevPrevSibling && prevPrevSibling.parent.id === prevParent.id) {
+ overrideTween(prevPrevSibling);
+ prevPrevSibling = prevPrevSibling._prevRep;
+ }
+
+ }
+
+ const absoluteUpdateStartTime = tweenAbsStartTime - tween._delay;
+
+ if (prevAbsEndTime > absoluteUpdateStartTime) {
+
+ const prevChangeStartTime = prevSibling._startTime;
+ const prevTLOffset = prevAbsEndTime - (prevChangeStartTime + prevSibling._updateDuration);
+
+ prevSibling._changeDuration = absoluteUpdateStartTime - prevTLOffset - prevChangeStartTime;
+ prevSibling._currentTime = prevSibling._changeDuration;
+ prevSibling._isOverlapped = 1;
+
+ if (prevSibling._changeDuration < minValue) {
+ overrideTween(prevSibling);
+ }
+ }
+
+ // Pause (and cancel) the parent if it only contains overlapped tweens
+
+ let pausePrevParentAnimation = true;
+
+ forEachChildren(prevParent, (/** @type Tween */t) => {
+ if (!t._isOverlapped) pausePrevParentAnimation = false;
+ });
+
+ if (pausePrevParentAnimation) {
+ const prevParentTL = prevParent.parent;
+ if (prevParentTL) {
+ let pausePrevParentTL = true;
+ forEachChildren(prevParentTL, (/** @type JSAnimation */a) => {
+ if (a !== prevParent) {
+ forEachChildren(a, (/** @type Tween */t) => {
+ if (!t._isOverlapped) pausePrevParentTL = false;
+ });
+ }
+ });
+ if (pausePrevParentTL) {
+ prevParentTL.cancel();
+ }
+ } else {
+ prevParent.cancel();
+ // Previously, calling .cancel() on a timeline child would affect the render order of other children
+ // Worked around this by marking it as .completed and using .pause() for safe removal in the engine loop
+ // This is no longer needed since timeline tween composition is now handled separatly
+ // Keeping this here for reference
+ // prevParent.completed = true;
+ // prevParent.pause();
+ }
+ }
+
+ }
+
+ // let nextSibling = tween._nextRep;
+
+ // // All the next siblings are automatically overridden
+
+ // if (nextSibling && nextSibling._absoluteStartTime >= tweenAbsStartTime) {
+ // while (nextSibling) {
+ // overrideTween(nextSibling);
+ // nextSibling = nextSibling._nextRep;
+ // }
+ // }
+
+ // if (nextSibling && nextSibling._absoluteStartTime < tweenAbsStartTime) {
+ // while (nextSibling) {
+ // overrideTween(nextSibling);
+ // console.log(tween.id, nextSibling.id);
+ // nextSibling = nextSibling._nextRep;
+ // }
+ // }
+
+ // Handle additive tweens composition
+
+ } else if (tweenCompositionType === compositionTypes.blend) {
+
+ const additiveTweenSiblings = getTweenSiblings(tween.target, tween.property, '_add');
+ const additiveAnimation = addAdditiveAnimation(lookups._add);
+
+ let lookupTween = additiveTweenSiblings._head;
+
+ if (!lookupTween) {
+ lookupTween = { ...tween };
+ lookupTween._composition = compositionTypes.replace;
+ lookupTween._updateDuration = minValue;
+ lookupTween._startTime = 0;
+ lookupTween._numbers = cloneArray(tween._fromNumbers);
+ lookupTween._number = 0;
+ lookupTween._next = null;
+ lookupTween._prev = null;
+ addChild(additiveTweenSiblings, lookupTween);
+ addChild(additiveAnimation, lookupTween);
+ }
+
+ // Convert the values of TO to FROM and set TO to 0
+
+ const toNumber = tween._toNumber;
+ tween._fromNumber = lookupTween._fromNumber - toNumber;
+ tween._toNumber = 0;
+ tween._numbers = cloneArray(tween._fromNumbers);
+ tween._number = 0;
+ lookupTween._fromNumber = toNumber;
+
+ if (tween._toNumbers) {
+ const toNumbers = cloneArray(tween._toNumbers);
+ if (toNumbers) {
+ toNumbers.forEach((value, i) => {
+ tween._fromNumbers[i] = lookupTween._fromNumbers[i] - value;
+ tween._toNumbers[i] = 0;
+ });
+ }
+ lookupTween._fromNumbers = toNumbers;
+ }
+
+ addChild(additiveTweenSiblings, tween, null, '_prevAdd', '_nextAdd');
+
+ }
+
+ return tween;
+
+};
+
+/**
+ * @param {Tween} tween
+ * @return {Tween}
+ */
+const removeTweenSliblings = tween => {
+ const tweenComposition = tween._composition;
+ if (tweenComposition !== compositionTypes.none) {
+ const tweenTarget = tween.target;
+ const tweenProperty = tween.property;
+ const replaceTweensLookup = lookups._rep;
+ const replaceTargetProps = replaceTweensLookup.get(tweenTarget);
+ const tweenReplaceSiblings = replaceTargetProps[tweenProperty];
+ removeChild(tweenReplaceSiblings, tween, '_prevRep', '_nextRep');
+ if (tweenComposition === compositionTypes.blend) {
+ const addTweensLookup = lookups._add;
+ const addTargetProps = addTweensLookup.get(tweenTarget);
+ if (!addTargetProps) return;
+ const additiveTweenSiblings = addTargetProps[tweenProperty];
+ const additiveAnimation = additive.animation;
+ removeChild(additiveTweenSiblings, tween, '_prevAdd', '_nextAdd');
+ // If only one tween is left in the additive lookup, it's the tween lookup
+ const lookupTween = additiveTweenSiblings._head;
+ if (lookupTween && lookupTween === additiveTweenSiblings._tail) {
+ removeChild(additiveTweenSiblings, lookupTween, '_prevAdd', '_nextAdd');
+ removeChild(additiveAnimation, lookupTween);
+ let shouldClean = true;
+ for (let prop in addTargetProps) {
+ if (addTargetProps[prop]._head) {
+ shouldClean = false;
+ break;
+ }
+ }
+ if (shouldClean) {
+ addTweensLookup.delete(tweenTarget);
+ }
+ }
+ }
+ }
+ return tween;
+};
+
+
+
+
+/**
+ * @param {Timer} timer
+ * @return {Timer}
+ */
+const resetTimerProperties = timer => {
+ timer.paused = true;
+ timer.began = false;
+ timer.completed = false;
+ return timer;
+};
+
+/**
+ * @param {Timer} timer
+ * @return {Timer}
+ */
+const reviveTimer = timer => {
+ if (!timer._cancelled) return timer;
+ if (timer._hasChildren) {
+ forEachChildren(timer, reviveTimer);
+ } else {
+ forEachChildren(timer, (/** @type {Tween} tween*/tween) => {
+ if (tween._composition !== compositionTypes.none) {
+ composeTween(tween, getTweenSiblings(tween.target, tween.property));
+ }
+ });
+ }
+ timer._cancelled = 0;
+ return timer;
+};
+
+let timerId = 0;
+
+/**
+ * Base class used to create Timers, Animations and Timelines
+ */
+class Timer extends Clock {
+ /**
+ * @param {TimerParams} [parameters]
+ * @param {Timeline} [parent]
+ * @param {Number} [parentPosition]
+ */
+ constructor(parameters = {}, parent = null, parentPosition = 0) {
+
+ super(0);
+
+ const {
+ id,
+ delay,
+ duration,
+ reversed,
+ alternate,
+ loop,
+ loopDelay,
+ autoplay,
+ frameRate,
+ playbackRate,
+ onComplete,
+ onLoop,
+ onPause,
+ onBegin,
+ onBeforeUpdate,
+ onUpdate,
+ } = parameters;
+
+ const timerInitTime = parent ? 0 : engine._elapsedTime;
+ const timerDefaults = parent ? parent.defaults : globals.defaults;
+ const timerDelay = /** @type {Number} */(isFnc(delay) || isUnd(delay) ? timerDefaults.delay : +delay);
+ const timerDuration = isFnc(duration) || isUnd(duration) ? Infinity : +duration;
+ const timerLoop = setValue(loop, timerDefaults.loop);
+ const timerLoopDelay = setValue(loopDelay, timerDefaults.loopDelay);
+ const timerIterationCount = timerLoop === true ||
+ timerLoop === Infinity ||
+ /** @type {Number} */(timerLoop) < 0 ? Infinity :
+ /** @type {Number} */(timerLoop) + 1;
+
+ let offsetPosition = 0;
+
+ if (parent) {
+ offsetPosition = parentPosition;
+ } else {
+ let startTime = now();
+ // Make sure to tick the engine once if suspended to avoid big gaps with the following offsetPosition calculation
+ if (engine.paused) {
+ engine.requestTick(startTime);
+ startTime = engine._elapsedTime;
+ }
+ offsetPosition = startTime - engine._startTime;
+ }
+
+ // Timer's parameters
+ this.id = !isUnd(id) ? id : ++timerId;
+ /** @type {Timeline} */
+ this.parent = parent;
+ // Total duration of the timer
+ this.duration = clampInfinity(((timerDuration + timerLoopDelay) * timerIterationCount) - timerLoopDelay) || minValue;
+ /** @type {Boolean} */
+ this.backwards = false;
+ /** @type {Boolean} */
+ this.paused = true;
+ /** @type {Boolean} */
+ this.began = false;
+ /** @type {Boolean} */
+ this.completed = false;
+ /** @type {Callback<this>} */
+ this.onBegin = onBegin || timerDefaults.onBegin;
+ /** @type {Callback<this>} */
+ this.onBeforeUpdate = onBeforeUpdate || timerDefaults.onBeforeUpdate;
+ /** @type {Callback<this>} */
+ this.onUpdate = onUpdate || timerDefaults.onUpdate;
+ /** @type {Callback<this>} */
+ this.onLoop = onLoop || timerDefaults.onLoop;
+ /** @type {Callback<this>} */
+ this.onPause = onPause || timerDefaults.onPause;
+ /** @type {Callback<this>} */
+ this.onComplete = onComplete || timerDefaults.onComplete;
+ /** @type {Number} */
+ this.iterationDuration = timerDuration; // Duration of one loop
+ /** @type {Number} */
+ this.iterationCount = timerIterationCount; // Number of loops
+ /** @type {Boolean|ScrollObserver} */
+ this._autoplay = parent ? false : setValue(autoplay, timerDefaults.autoplay);
+ /** @type {Number} */
+ this._offset = offsetPosition;
+ /** @type {Number} */
+ this._delay = timerDelay;
+ /** @type {Number} */
+ this._loopDelay = timerLoopDelay;
+ /** @type {Number} */
+ this._iterationTime = 0;
+ /** @type {Number} */
+ this._currentIteration = 0; // Current loop index
+ /** @type {Function} */
+ this._resolve = noop; // Used by .then()
+ /** @type {Boolean} */
+ this._running = false;
+ /** @type {Number} */
+ this._reversed = +setValue(reversed, timerDefaults.reversed);
+ /** @type {Number} */
+ this._reverse = this._reversed;
+ /** @type {Number} */
+ this._cancelled = 0;
+ /** @type {Boolean} */
+ this._alternate = setValue(alternate, timerDefaults.alternate);
+ /** @type {Renderable} */
+ this._prev = null;
+ /** @type {Renderable} */
+ this._next = null;
+
+ // Clock's parameters
+ /** @type {Number} */
+ this._elapsedTime = timerInitTime;
+ /** @type {Number} */
+ this._startTime = timerInitTime;
+ /** @type {Number} */
+ this._lastTime = timerInitTime;
+ /** @type {Number} */
+ this._fps = setValue(frameRate, timerDefaults.frameRate);
+ /** @type {Number} */
+ this._speed = setValue(playbackRate, timerDefaults.playbackRate);
+ }
+
+ get cancelled() {
+ return !!this._cancelled;
+ }
+
+ /** @param {Boolean} cancelled */
+ set cancelled(cancelled) {
+ cancelled ? this.cancel() : this.reset(1).play();
+ }
+
+ get currentTime() {
+ return clamp(round(this._currentTime, globals.precision), -this._delay, this.duration);
+ }
+
+ /** @param {Number} time */
+ set currentTime(time) {
+ const paused = this.paused;
+ // Pausing the timer is necessary to avoid time jumps on a running instance
+ this.pause().seek(+time);
+ if (!paused) this.resume();
+ }
+
+ get iterationCurrentTime() {
+ return round(this._iterationTime, globals.precision);
+ }
+
+ /** @param {Number} time */
+ set iterationCurrentTime(time) {
+ this.currentTime = (this.iterationDuration * this._currentIteration) + time;
+ }
+
+ get progress() {
+ return clamp(round(this._currentTime / this.duration, 10), 0, 1);
+ }
+
+ /** @param {Number} progress */
+ set progress(progress) {
+ this.currentTime = this.duration * progress;
+ }
+
+ get iterationProgress() {
+ return clamp(round(this._iterationTime / this.iterationDuration, 10), 0, 1);
+ }
+
+ /** @param {Number} progress */
+ set iterationProgress(progress) {
+ const iterationDuration = this.iterationDuration;
+ this.currentTime = (iterationDuration * this._currentIteration) + (iterationDuration * progress);
+ }
+
+ get currentIteration() {
+ return this._currentIteration;
+ }
+
+ /** @param {Number} iterationCount */
+ set currentIteration(iterationCount) {
+ this.currentTime = (this.iterationDuration * clamp(+iterationCount, 0, this.iterationCount - 1));
+ }
+
+ get reversed() {
+ return !!this._reversed;
+ }
+
+ /** @param {Boolean} reverse */
+ set reversed(reverse) {
+ reverse ? this.reverse() : this.play();
+ }
+
+ get speed() {
+ return super.speed;
+ }
+
+ /** @param {Number} playbackRate */
+ set speed(playbackRate) {
+ super.speed = playbackRate;
+ this.resetTime();
+ }
+
+ /**
+ * @param {Number} internalRender
+ * @return {this}
+ */
+ reset(internalRender = 0) {
+ // If cancelled, revive the timer before rendering in order to have propertly composed tweens siblings
+ reviveTimer(this);
+ if (this._reversed && !this._reverse) this.reversed = false;
+ // Rendering before updating the completed flag to prevent skips and to make sure the properties are not overridden
+ // Setting the iterationTime at the end to force the rendering to happend backwards, otherwise calling .reset() on Timelines might not render children in the right order
+ // NOTE: This is only required for Timelines and might be better to move to the Timeline class?
+ this._iterationTime = this.iterationDuration;
+ // Set tickMode to tickModes.FORCE to force rendering
+ tick(this, 0, 1, internalRender, tickModes.FORCE);
+ // Reset timer properties after revive / render to make sure the props are not updated again
+ resetTimerProperties(this);
+ // Also reset children properties
+ if (this._hasChildren) {
+ forEachChildren(this, resetTimerProperties);
+ }
+ return this;
+ }
+
+ /**
+ * @param {Number} internalRender
+ * @return {this}
+ */
+ init(internalRender = 0) {
+ this.fps = this._fps;
+ this.speed = this._speed;
+ // Manually calling .init() on timelines should render all children intial state
+ // Forces all children to render once then render to 0 when reseted
+ if (!internalRender && this._hasChildren) {
+ tick(this, this.duration, 1, internalRender, tickModes.FORCE);
+ }
+ this.reset(internalRender);
+ // Make sure to set autoplay to false to child timers so it doesn't attempt to autoplay / link
+ const autoplay = this._autoplay;
+ if (autoplay === true) {
+ this.resume();
+ } else if (autoplay && !isUnd(/** @type {ScrollObserver} */(autoplay).linked)) {
+ /** @type {ScrollObserver} */(autoplay).link(this);
+ }
+ return this;
+ }
+
+ /** @return {this} */
+ resetTime() {
+ const timeScale = 1 / (this._speed * engine._speed);
+ this._startTime = now() - (this._currentTime + this._delay) * timeScale;
+ return this;
+ }
+
+ /** @return {this} */
+ pause() {
+ if (this.paused) return this;
+ this.paused = true;
+ this.onPause(this);
+ return this;
+ }
+
+ /** @return {this} */
+ resume() {
+ if (!this.paused) return this;
+ this.paused = false;
+ // We can safely imediatly render a timer that has no duration and no children
+ if (this.duration <= minValue && !this._hasChildren) {
+ tick(this, minValue, 0, 0, tickModes.FORCE);
+ } else {
+ if (!this._running) {
+ addChild(engine, this);
+ engine._hasChildren = true;
+ this._running = true;
+ }
+ this.resetTime();
+ // Forces the timer to advance by at least one frame when the next tick occurs
+ this._startTime -= 12;
+ engine.wake();
+ }
+ return this;
+ }
+
+ /** @return {this} */
+ restart() {
+ return this.reset(0).resume();
+ }
+
+ /**
+ * @param {Number} time
+ * @param {Boolean|Number} [muteCallbacks]
+ * @param {Boolean|Number} [internalRender]
+ * @return {this}
+ */
+ seek(time, muteCallbacks = 0, internalRender = 0) {
+ // Recompose the tween siblings in case the timer has been cancelled
+ reviveTimer(this);
+ // If you seek a completed animation, otherwise the next play will starts at 0
+ this.completed = false;
+ const isPaused = this.paused;
+ this.paused = true;
+ // timer, time, muteCallbacks, internalRender, tickMode
+ tick(this, time + this._delay, ~~muteCallbacks, ~~internalRender, tickModes.AUTO);
+ return isPaused ? this : this.resume();
+ }
+
+ /** @return {this} */
+ alternate() {
+ const reversed = this._reversed;
+ const count = this.iterationCount;
+ const duration = this.iterationDuration;
+ // Calculate the maximum iterations possible given the iteration duration
+ const iterations = count === Infinity ? floor(maxValue / duration) : count;
+ this._reversed = +(this._alternate && !(iterations % 2) ? reversed : !reversed);
+ if (count === Infinity) {
+ // Handle infinite loops to loop on themself
+ this.iterationProgress = this._reversed ? 1 - this.iterationProgress : this.iterationProgress;
+ } else {
+ this.seek((duration * iterations) - this._currentTime);
+ }
+ this.resetTime();
+ return this;
+ }
+
+ /** @return {this} */
+ play() {
+ if (this._reversed) this.alternate();
+ return this.resume();
+ }
+
+ /** @return {this} */
+ reverse() {
+ if (!this._reversed) this.alternate();
+ return this.resume();
+ }
+
+ // TODO: Move all the animation / tweens / children related code to Animation / Timeline
+
+ /** @return {this} */
+ cancel() {
+ if (this._hasChildren) {
+ forEachChildren(this, (/** @type {Renderable} */child) => child.cancel(), true);
+ } else {
+ forEachChildren(this, removeTweenSliblings);
+ }
+ this._cancelled = 1;
+ // Pausing the timer removes it from the engine
+ return this.pause();
+ }
+
+ /**
+ * @param {Number} newDuration
+ * @return {this}
+ */
+ stretch(newDuration) {
+ const currentDuration = this.duration;
+ const normlizedDuration = normalizeTime(newDuration);
+ if (currentDuration === normlizedDuration) return this;
+ const timeScale = newDuration / currentDuration;
+ const isSetter = newDuration <= minValue;
+ this.duration = isSetter ? minValue : normlizedDuration;
+ this.iterationDuration = isSetter ? minValue : normalizeTime(this.iterationDuration * timeScale);
+ this._offset *= timeScale;
+ this._delay *= timeScale;
+ this._loopDelay *= timeScale;
+ return this;
+ }
+
+ /**
+ * Cancels the timer by seeking it back to 0 and reverting the attached scroller if necessary
+ * @return {this}
+ */
+ revert() {
+ tick(this, 0, 1, 0, tickModes.AUTO);
+ const ap = /** @type {ScrollObserver} */(this._autoplay);
+ if (ap && ap.linked && ap.linked === this) ap.revert();
+ return this.cancel();
+ }
+
+ /**
+ * Imediatly completes the timer, cancels it and triggers the onComplete callback
+ * @return {this}
+ */
+ complete() {
+ return this.seek(this.duration).cancel();
+ }
+
+ /**
+ * @param {Callback<this>} [callback]
+ * @return {Promise}
+ */
+ then(callback = noop) {
+ const then = this.then;
+ const onResolve = () => {
+ // this.then = null prevents infinite recursion if returned by an async function
+ // https://github.com/juliangarnierorg/anime-beta/issues/26
+ this.then = null;
+ callback(this);
+ this.then = then;
+ this._resolve = noop;
+ };
+ return new Promise(r => {
+ this._resolve = () => r(onResolve());
+ // Make sure to resolve imediatly if the timer has already completed
+ if (this.completed) this._resolve();
+ return this;
+ });
+ }
+
+}
+
+
+
+
+/** @type {EasingFunction} */
+const none = t => t;
+
+// Cubic Bezier solver adapted from https://github.com/gre/bezier-ease © Gaëtan Renaudeau
+
+/**
+ * @param {Number} aT
+ * @param {Number} aA1
+ * @param {Number} aA2
+ * @return {Number}
+ */
+const calcBezier = (aT, aA1, aA2) => (((1 - 3 * aA2 + 3 * aA1) * aT + (3 * aA2 - 6 * aA1)) * aT + (3 * aA1)) * aT;
+
+/**
+ * @param {Number} aX
+ * @param {Number} mX1
+ * @param {Number} mX2
+ * @return {Number}
+ */
+const binarySubdivide = (aX, mX1, mX2) => {
+ let aA = 0, aB = 1, currentX, currentT, i = 0;
+ do {
+ currentT = aA + (aB - aA) / 2;
+ currentX = calcBezier(currentT, mX1, mX2) - aX;
+ if (currentX > 0) {
+ aB = currentT;
+ } else {
+ aA = currentT;
+ }
+ } while (abs(currentX) > .0000001 && ++i < 100);
+ return currentT;
+};
+
+/**
+ * @param {Number} [mX1]
+ * @param {Number} [mY1]
+ * @param {Number} [mX2]
+ * @param {Number} [mY2]
+ * @return {EasingFunction}
+ */
+
+const cubicBezier = (mX1 = 0.5, mY1 = 0.0, mX2 = 0.5, mY2 = 1.0) => (mX1 === mY1 && mX2 === mY2) ? none :
+ t => t === 0 || t === 1 ? t :
+ calcBezier(binarySubdivide(t, mX1, mX2), mY1, mY2);
+
+/**
+ * Steps ease implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function
+ * Only covers 'end' and 'start' jumpterms
+ * @param {Number} steps
+ * @param {Boolean} [fromStart]
+ * @return {EasingFunction}
+ */
+const steps = (steps = 10, fromStart) => {
+ const roundMethod = fromStart ? ceil : floor;
+ return t => roundMethod(clamp(t, 0, 1) * steps) * (1 / steps);
+};
+
+/**
+ * Without parameters, the linear function creates a non-eased transition.
+ * Parameters, if used, creates a piecewise linear easing by interpolating linearly between the specified points.
+ * @param {...String|Number} [args] - Points
+ * @return {EasingFunction}
+ */
+const linear = (...args) => {
+ const argsLength = args.length;
+ if (!argsLength) return none;
+ const totalPoints = argsLength - 1;
+ const firstArg = args[0];
+ const lastArg = args[totalPoints];
+ const xPoints = [0];
+ const yPoints = [parseNumber(firstArg)];
+ for (let i = 1; i < totalPoints; i++) {
+ const arg = args[i];
+ const splitValue = isStr(arg) ?
+ /** @type {String} */(arg).trim().split(' ') :
+ [arg];
+ const value = splitValue[0];
+ const percent = splitValue[1];
+ xPoints.push(!isUnd(percent) ? parseNumber(percent) / 100 : i / totalPoints);
+ yPoints.push(parseNumber(value));
+ }
+ yPoints.push(parseNumber(lastArg));
+ xPoints.push(1);
+ return function easeLinear(t) {
+ for (let i = 1, l = xPoints.length; i < l; i++) {
+ const currentX = xPoints[i];
+ if (t <= currentX) {
+ const prevX = xPoints[i - 1];
+ const prevY = yPoints[i - 1];
+ return prevY + (yPoints[i] - prevY) * (t - prevX) / (currentX - prevX);
+ }
+ }
+ return yPoints[yPoints.length - 1];
+ }
+};
+
+/**
+ * Generate random steps
+ * @param {Number} [length] - The number of steps
+ * @param {Number} [randomness] - How strong the randomness is
+ * @return {EasingFunction}
+ */
+const irregular = (length = 10, randomness = 1) => {
+ const values = [0];
+ const total = length - 1;
+ for (let i = 1; i < total; i++) {
+ const previousValue = values[i - 1];
+ const spacing = i / total;
+ const segmentEnd = (i + 1) / total;
+ const randomVariation = spacing + (segmentEnd - spacing) * Math.random();
+ // Mix the even spacing and random variation based on the randomness parameter
+ const randomValue = spacing * (1 - randomness) + randomVariation * randomness;
+ values.push(clamp(randomValue, previousValue, 1));
+ }
+ values.push(1);
+ return linear(...values);
+};
+
+// Easing functions adapted from http://www.robertpenner.com/ease © Robert Penner
+
+/**
+ * @callback PowerEasing
+ * @param {Number|String} [power=1.675]
+ * @return {EasingFunction}
+ */
+
+/**
+ * @callback BackEasing
+ * @param {Number|String} [overshoot=1.70158]
+ * @return {EasingFunction}
+ */
+
+/**
+ * @callback ElasticEasing
+ * @param {Number|String} [amplitude=1]
+ * @param {Number|String} [period=.3]
+ * @return {EasingFunction}
+ */
+
+/**
+ * @callback EaseFactory
+ * @param {Number|String} [paramA]
+ * @param {Number|String} [paramB]
+ * @return {EasingFunction|Number}
+ */
+
+/** @typedef {PowerEasing|BackEasing|ElasticEasing} EasesFactory */
+
+const halfPI = PI / 2;
+const doublePI = PI * 2;
+/** @type {PowerEasing} */
+const easeInPower = (p = 1.68) => t => pow(t, +p);
+
+/** @type {Record<String, EasesFactory|EasingFunction>} */
+const easeInFunctions = {
+ [emptyString]: easeInPower,
+ Quad: easeInPower(2),
+ Cubic: easeInPower(3),
+ Quart: easeInPower(4),
+ Quint: easeInPower(5),
+ /** @type {EasingFunction} */
+ Sine: t => 1 - cos(t * halfPI),
+ /** @type {EasingFunction} */
+ Circ: t => 1 - sqrt(1 - t * t),
+ /** @type {EasingFunction} */
+ Expo: t => t ? pow(2, 10 * t - 10) : 0,
+ /** @type {EasingFunction} */
+ Bounce: t => {
+ let pow2, b = 4;
+ while (t < ((pow2 = pow(2, --b)) - 1) / 11);
+ return 1 / pow(4, 3 - b) - 7.5625 * pow((pow2 * 3 - 2) / 22 - t, 2);
+ },
+ /** @type {BackEasing} */
+ Back: (overshoot = 1.70158) => t => (+overshoot + 1) * t * t * t - +overshoot * t * t,
+ /** @type {ElasticEasing} */
+ Elastic: (amplitude = 1, period = .3) => {
+ const a = clamp(+amplitude, 1, 10);
+ const p = clamp(+period, minValue, 2);
+ const s = (p / doublePI) * asin(1 / a);
+ const e = doublePI / p;
+ return t => t === 0 || t === 1 ? t : -a * pow(2, -10 * (1 - t)) * sin(((1 - t) - s) * e);
+ }
+};
+
+/**
+ * @callback EaseType
+ * @param {EasingFunction} Ease
+ * @return {EasingFunction}
+ */
+
+/** @type {Record<String, EaseType>} */
+const easeTypes = {
+ in: easeIn => t => easeIn(t),
+ out: easeIn => t => 1 - easeIn(1 - t),
+ inOut: easeIn => t => t < .5 ? easeIn(t * 2) / 2 : 1 - easeIn(t * -2 + 2) / 2,
+ outIn: easeIn => t => t < .5 ? (1 - easeIn(1 - t * 2)) / 2 : (easeIn(t * 2 - 1) + 1) / 2,
+};
+
+/**
+ * @param {String} string
+ * @param {Record<String, EasesFactory|EasingFunction>} easesFunctions
+ * @param {Object} easesLookups
+ * @return {EasingFunction}
+ */
+const parseEaseString = (string, easesFunctions, easesLookups) => {
+ if (easesLookups[string]) return easesLookups[string];
+ if (string.indexOf('(') <= -1) {
+ const hasParams = easeTypes[string] || string.includes('Back') || string.includes('Elastic');
+ const parsedFn = /** @type {EasingFunction} */(hasParams ? /** @type {EasesFactory} */(easesFunctions[string])() : easesFunctions[string]);
+ return parsedFn ? easesLookups[string] = parsedFn : none;
+ } else {
+ const split = string.slice(0, -1).split('(');
+ const parsedFn = /** @type {EasesFactory} */(easesFunctions[split[0]]);
+ return parsedFn ? easesLookups[string] = parsedFn(...split[1].split(',')) : none;
+ }
+};
+
+/**
+ * @typedef {Object} EasesFunctions
+ * @property {typeof linear} linear
+ * @property {typeof irregular} irregular
+ * @property {typeof steps} steps
+ * @property {typeof cubicBezier} cubicBezier
+ * @property {PowerEasing} in
+ * @property {PowerEasing} out
+ * @property {PowerEasing} inOut
+ * @property {PowerEasing} outIn
+ * @property {EasingFunction} inQuad
+ * @property {EasingFunction} outQuad
+ * @property {EasingFunction} inOutQuad
+ * @property {EasingFunction} outInQuad
+ * @property {EasingFunction} inCubic
+ * @property {EasingFunction} outCubic
+ * @property {EasingFunction} inOutCubic
+ * @property {EasingFunction} outInCubic
+ * @property {EasingFunction} inQuart
+ * @property {EasingFunction} outQuart
+ * @property {EasingFunction} inOutQuart
+ * @property {EasingFunction} outInQuart
+ * @property {EasingFunction} inQuint
+ * @property {EasingFunction} outQuint
+ * @property {EasingFunction} inOutQuint
+ * @property {EasingFunction} outInQuint
+ * @property {EasingFunction} inSine
+ * @property {EasingFunction} outSine
+ * @property {EasingFunction} inOutSine
+ * @property {EasingFunction} outInSine
+ * @property {EasingFunction} inCirc
+ * @property {EasingFunction} outCirc
+ * @property {EasingFunction} inOutCirc
+ * @property {EasingFunction} outInCirc
+ * @property {EasingFunction} inExpo
+ * @property {EasingFunction} outExpo
+ * @property {EasingFunction} inOutExpo
+ * @property {EasingFunction} outInExpo
+ * @property {EasingFunction} inBounce
+ * @property {EasingFunction} outBounce
+ * @property {EasingFunction} inOutBounce
+ * @property {EasingFunction} outInBounce
+ * @property {BackEasing} inBack
+ * @property {BackEasing} outBack
+ * @property {BackEasing} inOutBack
+ * @property {BackEasing} outInBack
+ * @property {ElasticEasing} inElastic
+ * @property {ElasticEasing} outElastic
+ * @property {ElasticEasing} inOutElastic
+ * @property {ElasticEasing} outInElastic
+ */
+
+const eases = (/*#__PURE__*/ (() => {
+ const list = { linear, irregular, steps, cubicBezier };
+ for (let type in easeTypes) {
+ for (let name in easeInFunctions) {
+ const easeIn = easeInFunctions[name];
+ const easeType = easeTypes[type];
+ list[type + name] = /** @type {EasesFactory|EasingFunction} */(
+ name === emptyString || name === 'Back' || name === 'Elastic' ?
+ (a, b) => easeType(/** @type {EasesFactory} */(easeIn)(a, b)) :
+ easeType(/** @type {EasingFunction} */(easeIn))
+ );
+ }
+ }
+ return /** @type {EasesFunctions} */(list);
+})());
+
+/** @type {Record<String, EasingFunction>} */
+const JSEasesLookups = { linear: none };
+
+/**
+ * @param {EasingParam} ease
+ * @return {EasingFunction}
+ */
+const parseEasings = ease => isFnc(ease) ? ease :
+ isStr(ease) ? parseEaseString(/** @type {String} */(ease), eases, JSEasesLookups) :
+ none;
+
+
+
+
+const propertyNamesCache = {};
+
+/**
+ * @param {String} propertyName
+ * @param {Target} target
+ * @param {tweenTypes} tweenType
+ * @return {String}
+ */
+const sanitizePropertyName = (propertyName, target, tweenType) => {
+ if (tweenType === tweenTypes.TRANSFORM) {
+ const t = shortTransforms.get(propertyName);
+ return t ? t : propertyName;
+ } else if (
+ tweenType === tweenTypes.CSS ||
+ // Handle special cases where properties like "strokeDashoffset" needs to be set as "stroke-dashoffset"
+ // but properties like "baseFrequency" should stay in lowerCamelCase
+ (tweenType === tweenTypes.ATTRIBUTE && (isSvg(target) && propertyName in /** @type {DOMTarget} */(target).style))
+ ) {
+ const cachedPropertyName = propertyNamesCache[propertyName];
+ if (cachedPropertyName) {
+ return cachedPropertyName;
+ } else {
+ const lowerCaseName = propertyName ? toLowerCase(propertyName) : propertyName;
+ propertyNamesCache[propertyName] = lowerCaseName;
+ return lowerCaseName;
+ }
+ } else {
+ return propertyName;
+ }
+};
+
+
+
+
+const angleUnitsMap = { 'deg': 1, 'rad': 180 / PI, 'turn': 360 };
+const convertedValuesCache = {};
+
+/**
+ * @param {DOMTarget} el
+ * @param {TweenDecomposedValue} decomposedValue
+ * @param {String} unit
+ * @param {Boolean} [force]
+ * @return {TweenDecomposedValue}
+ */
+const convertValueUnit = (el, decomposedValue, unit, force = false) => {
+ const currentUnit = decomposedValue.u;
+ const currentNumber = decomposedValue.n;
+ if (decomposedValue.t === valueTypes.UNIT && currentUnit === unit) { // TODO: Check if checking against the same unit string is necessary
+ return decomposedValue;
+ }
+ const cachedKey = currentNumber + currentUnit + unit;
+ const cached = convertedValuesCache[cachedKey];
+ if (!isUnd(cached) && !force) {
+ decomposedValue.n = cached;
+ } else {
+ let convertedValue;
+ if (currentUnit in angleUnitsMap) {
+ convertedValue = currentNumber * angleUnitsMap[currentUnit] / angleUnitsMap[unit];
+ } else {
+ const baseline = 100;
+ const tempEl = /** @type {DOMTarget} */(el.cloneNode());
+ const parentNode = el.parentNode;
+ const parentEl = (parentNode && (parentNode !== doc)) ? parentNode : doc.body;
+ parentEl.appendChild(tempEl);
+ const elStyle = tempEl.style;
+ elStyle.width = baseline + currentUnit;
+ const currentUnitWidth = /** @type {HTMLElement} */(tempEl).offsetWidth || baseline;
+ elStyle.width = baseline + unit;
+ const newUnitWidth = /** @type {HTMLElement} */(tempEl).offsetWidth || baseline;
+ const factor = currentUnitWidth / newUnitWidth;
+ parentEl.removeChild(tempEl);
+ convertedValue = factor * currentNumber;
+ }
+ decomposedValue.n = convertedValue;
+ convertedValuesCache[cachedKey] = convertedValue;
+ }
+ decomposedValue.t === valueTypes.UNIT;
+ decomposedValue.u = unit;
+ return decomposedValue;
+};
+
+
+
+
+/**
+ * @template {Renderable} T
+ * @param {T} renderable
+ * @return {T}
+ */
+const cleanInlineStyles = renderable => {
+ // Allow cleanInlineStyles() to be called on timelines
+ if (renderable._hasChildren) {
+ forEachChildren(renderable, cleanInlineStyles, true);
+ } else {
+ const animation = /** @type {JSAnimation} */(renderable);
+ animation.pause();
+ forEachChildren(animation, (/** @type {Tween} */tween) => {
+ const tweenProperty = tween.property;
+ const tweenTarget = tween.target;
+ if (tweenTarget[isDomSymbol]) {
+ const targetStyle = /** @type {DOMTarget} */(tweenTarget).style;
+ const originalInlinedValue = animation._inlineStyles[tweenProperty];
+ if (tween._tweenType === tweenTypes.TRANSFORM) {
+ const cachedTransforms = tweenTarget[transformsSymbol];
+ if (isUnd(originalInlinedValue) || originalInlinedValue === emptyString) {
+ delete cachedTransforms[tweenProperty];
+ } else {
+ cachedTransforms[tweenProperty] = originalInlinedValue;
+ }
+ if (tween._renderTransforms) {
+ if (!Object.keys(cachedTransforms).length) {
+ targetStyle.removeProperty('transform');
+ } else {
+ let str = emptyString;
+ for (let key in cachedTransforms) {
+ str += transformsFragmentStrings[key] + cachedTransforms[key] + ') ';
+ }
+ targetStyle.transform = str;
+ }
+ }
+ } else {
+ if (isUnd(originalInlinedValue) || originalInlinedValue === emptyString) {
+ targetStyle.removeProperty(tweenProperty);
+ } else {
+ targetStyle[tweenProperty] = originalInlinedValue;
+ }
+ }
+ if (animation._tail === tween) {
+ animation.targets.forEach(t => {
+ if (t.getAttribute && t.getAttribute('style') === emptyString) {
+ t.removeAttribute('style');
+ } });
+ }
+ }
+ });
+ }
+ return renderable;
+};
+
+// Defines decomposed values target objects only once and mutate their properties later to avoid GC
+// TODO: Maybe move the objects creation to values.js and use the decompose function to create the base object
+const fromTargetObject = createDecomposedValueTargetObject();
+const toTargetObject = createDecomposedValueTargetObject();
+const toFunctionStore = { func: null };
+const keyframesTargetArray = [null];
+const fastSetValuesArray = [null, null];
+/** @type {TweenKeyValue} */
+const keyObjectTarget = { to: null };
+
+let tweenId = 0;
+let keyframes;
+/** @type {TweenParamsOptions & TweenValues} */
+let key;
+
+/**
+ * @param {DurationKeyframes | PercentageKeyframes} keyframes
+ * @param {AnimationParams} parameters
+ * @return {AnimationParams}
+ */
+const generateKeyframes = (keyframes, parameters) => {
+ /** @type {AnimationParams} */
+ const properties = {};
+ if (isArr(keyframes)) {
+ const propertyNames = [].concat(.../** @type {DurationKeyframes} */(keyframes).map(key => Object.keys(key))).filter(isKey);
+ for (let i = 0, l = propertyNames.length; i < l; i++) {
+ const propName = propertyNames[i];
+ const propArray = /** @type {DurationKeyframes} */(keyframes).map(key => {
+ /** @type {TweenKeyValue} */
+ const newKey = {};
+ for (let p in key) {
+ const keyValue = /** @type {TweenPropValue} */(key[p]);
+ if (isKey(p)) {
+ if (p === propName) {
+ newKey.to = keyValue;
+ }
+ } else {
+ newKey[p] = keyValue;
+ }
+ }
+ return newKey;
+ });
+ properties[propName] = /** @type {ArraySyntaxValue} */(propArray);
+ }
+
+ } else {
+ const totalDuration = /** @type {Number} */(setValue(parameters.duration, globals.defaults.duration));
+ const keys = Object.keys(keyframes)
+ .map(key => { return {o: parseFloat(key) / 100, p: keyframes[key]} })
+ .sort((a, b) => a.o - b.o);
+ keys.forEach(key => {
+ const offset = key.o;
+ const prop = key.p;
+ for (let name in prop) {
+ if (isKey(name)) {
+ let propArray = /** @type {Array} */(properties[name]);
+ if (!propArray) propArray = properties[name] = [];
+ const duration = offset * totalDuration;
+ let length = propArray.length;
+ let prevKey = propArray[length - 1];
+ const keyObj = { to: prop[name] };
+ let durProgress = 0;
+ for (let i = 0; i < length; i++) {
+ durProgress += propArray[i].duration;
+ }
+ if (length === 1) {
+ keyObj.from = prevKey.to;
+ }
+ if (prop.ease) {
+ keyObj.ease = prop.ease;
+ }
+ keyObj.duration = duration - (length ? durProgress : 0);
+ propArray.push(keyObj);
+ }
+ }
+ return key;
+ });
+
+ for (let name in properties) {
+ const propArray = /** @type {Array} */(properties[name]);
+ let prevEase;
+ // let durProgress = 0
+ for (let i = 0, l = propArray.length; i < l; i++) {
+ const prop = propArray[i];
+ // Emulate WAPPI easing parameter position
+ const currentEase = prop.ease;
+ prop.ease = prevEase ? prevEase : undefined;
+ prevEase = currentEase;
+ // durProgress += prop.duration;
+ // if (i === l - 1 && durProgress !== totalDuration) {
+ // propArray.push({ from: prop.to, ease: prop.ease, duration: totalDuration - durProgress })
+ // }
+ }
+ if (!propArray[0].duration) {
+ propArray.shift();
+ }
+ }
+
+ }
+
+ return properties;
+};
+
+class JSAnimation extends Timer {
+ /**
+ * @param {TargetsParam} targets
+ * @param {AnimationParams} parameters
+ * @param {Timeline} [parent]
+ * @param {Number} [parentPosition]
+ * @param {Boolean} [fastSet=false]
+ * @param {Number} [index=0]
+ * @param {Number} [length=0]
+ */
+ constructor(
+ targets,
+ parameters,
+ parent,
+ parentPosition,
+ fastSet = false,
+ index = 0,
+ length = 0
+ ) {
+
+ super(/** @type {TimerParams&AnimationParams} */(parameters), parent, parentPosition);
+
+ const parsedTargets = registerTargets(targets);
+ const targetsLength = parsedTargets.length;
+
+ // If the parameters object contains a "keyframes" property, convert all the keyframes values to regular properties
+
+ const kfParams = /** @type {AnimationParams} */(parameters).keyframes;
+ const params = /** @type {AnimationParams} */(kfParams ? mergeObjects(generateKeyframes(/** @type {DurationKeyframes} */(kfParams), parameters), parameters) : parameters);
+
+ const {
+ delay,
+ duration,
+ ease,
+ playbackEase,
+ modifier,
+ composition,
+ onRender,
+ } = params;
+
+ const animDefaults = parent ? parent.defaults : globals.defaults;
+ const animaPlaybackEase = setValue(playbackEase, animDefaults.playbackEase);
+ const animEase = animaPlaybackEase ? parseEasings(animaPlaybackEase) : null;
+ const hasSpring = !isUnd(ease) && !isUnd(/** @type {Spring} */(ease).ease);
+ const tEasing = hasSpring ? /** @type {Spring} */(ease).ease : setValue(ease, animEase ? 'linear' : animDefaults.ease);
+ const tDuration = hasSpring ? /** @type {Spring} */(ease).duration : setValue(duration, animDefaults.duration);
+ const tDelay = setValue(delay, animDefaults.delay);
+ const tModifier = modifier || animDefaults.modifier;
+ // If no composition is defined and the targets length is high (>= 1000) set the composition to 'none' (0) for faster tween creation
+ const tComposition = isUnd(composition) && targetsLength >= K ? compositionTypes.none : !isUnd(composition) ? composition : animDefaults.composition;
+ // TODO: Do not create an empty object until we know the animation will generate inline styles
+ const animInlineStyles = {};
+ // const absoluteOffsetTime = this._offset;
+ const absoluteOffsetTime = this._offset + (parent ? parent._offset : 0);
+
+ let iterationDuration = NaN;
+ let iterationDelay = NaN;
+ let animationAnimationLength = 0;
+ let shouldTriggerRender = 0;
+
+ for (let targetIndex = 0; targetIndex < targetsLength; targetIndex++) {
+
+ const target = parsedTargets[targetIndex];
+ const ti = index || targetIndex;
+ const tl = length || targetsLength;
+
+ let lastTransformGroupIndex = NaN;
+ let lastTransformGroupLength = NaN;
+
+ for (let p in params) {
+
+ if (isKey(p)) {
+
+ const tweenType = getTweenType(target, p);
+
+ const propName = sanitizePropertyName(p, target, tweenType);
+
+ let propValue = params[p];
+
+ const isPropValueArray = isArr(propValue);
+
+ if (fastSet && !isPropValueArray) {
+ fastSetValuesArray[0] = propValue;
+ fastSetValuesArray[1] = propValue;
+ propValue = fastSetValuesArray;
+ }
+
+ // TODO: Allow nested keyframes inside ObjectValue value (prop: { to: [.5, 1, .75, 2, 3] })
+ // Normalize property values to valid keyframe syntax:
+ // [x, y] to [{to: [x, y]}] or {to: x} to [{to: x}] or keep keys syntax [{}, {}, {}...]
+ // const keyframes = isArr(propValue) ? propValue.length === 2 && !isObj(propValue[0]) ? [{ to: propValue }] : propValue : [propValue];
+ if (isPropValueArray) {
+ const arrayLength = /** @type {Array} */(propValue).length;
+ const isNotObjectValue = !isObj(propValue[0]);
+ // Convert [x, y] to [{to: [x, y]}]
+ if (arrayLength === 2 && isNotObjectValue) {
+ keyObjectTarget.to = /** @type {TweenParamValue} */(/** @type {unknown} */(propValue));
+ keyframesTargetArray[0] = keyObjectTarget;
+ keyframes = keyframesTargetArray;
+ // Convert [x, y, z] to [[x, y], z]
+ } else if (arrayLength > 2 && isNotObjectValue) {
+ keyframes = [];
+ /** @type {Array.<Number>} */(propValue).forEach((v, i) => {
+ if (!i) {
+ fastSetValuesArray[0] = v;
+ } else if (i === 1) {
+ fastSetValuesArray[1] = v;
+ keyframes.push(fastSetValuesArray);
+ } else {
+ keyframes.push(v);
+ }
+ });
+ } else {
+ keyframes = /** @type {Array.<TweenKeyValue>} */(propValue);
+ }
+ } else {
+ keyframesTargetArray[0] = propValue;
+ keyframes = keyframesTargetArray;
+ }
+
+ let siblings = null;
+ let prevTween = null;
+ let firstTweenChangeStartTime = NaN;
+ let lastTweenChangeEndTime = 0;
+ let tweenIndex = 0;
+
+ for (let l = keyframes.length; tweenIndex < l; tweenIndex++) {
+
+ const keyframe = keyframes[tweenIndex];
+
+ if (isObj(keyframe)) {
+ key = keyframe;
+ } else {
+ keyObjectTarget.to = /** @type {TweenParamValue} */(keyframe);
+ key = keyObjectTarget;
+ }
+
+ toFunctionStore.func = null;
+
+ const computedToValue = getFunctionValue(key.to, target, ti, tl, toFunctionStore);
+
+ let tweenToValue;
+ // Allows function based values to return an object syntax value ({to: v})
+ if (isObj(computedToValue) && !isUnd(computedToValue.to)) {
+ key = computedToValue;
+ tweenToValue = computedToValue.to;
+ } else {
+ tweenToValue = computedToValue;
+ }
+ const tweenFromValue = getFunctionValue(key.from, target, ti, tl);
+ const keyEasing = key.ease;
+ 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;
+ // Calculate default individual keyframe duration by dividing the tl of keyframes
+ const tweenDuration = hasSpring ? /** @type {Spring} */(keyEasing).duration : 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
+ const tweenDelay = getFunctionValue(setValue(key.delay, (!tweenIndex ? tDelay : 0)), target, ti, tl);
+ const computedComposition = getFunctionValue(setValue(key.composition, tComposition), target, ti, tl);
+ const tweenComposition = isNum(computedComposition) ? computedComposition : compositionTypes[computedComposition];
+ // Modifiers are treated differently and don't accept function based value to prevent having to pass a function wrapper
+ const tweenModifier = key.modifier || tModifier;
+ const hasFromvalue = !isUnd(tweenFromValue);
+ const hasToValue = !isUnd(tweenToValue);
+ const isFromToArray = isArr(tweenToValue);
+ const isFromToValue = isFromToArray || (hasFromvalue && hasToValue);
+ const tweenStartTime = prevTween ? lastTweenChangeEndTime + tweenDelay : tweenDelay;
+ const absoluteStartTime = absoluteOffsetTime + tweenStartTime;
+
+ // Force a onRender callback if the animation contains at least one from value and autoplay is set to false
+ if (!shouldTriggerRender && (hasFromvalue || isFromToArray)) shouldTriggerRender = 1;
+
+ let prevSibling = prevTween;
+
+ if (tweenComposition !== compositionTypes.none) {
+ if (!siblings) siblings = getTweenSiblings(target, propName);
+ let nextSibling = siblings._head;
+ // Iterate trough all the next siblings until we find a sibling with an equal or inferior start time
+ while (nextSibling && !nextSibling._isOverridden && nextSibling._absoluteStartTime <= absoluteStartTime) {
+ prevSibling = nextSibling;
+ nextSibling = nextSibling._nextRep;
+ // Overrides all the next siblings if the next sibling starts at the same time of after as the new tween start time
+ if (nextSibling && nextSibling._absoluteStartTime >= absoluteStartTime) {
+ while (nextSibling) {
+ overrideTween(nextSibling);
+ // This will ends both the current while loop and the upper one once all the next sibllings have been overriden
+ nextSibling = nextSibling._nextRep;
+ }
+ }
+ }
+ }
+
+ // Decompose values
+ if (isFromToValue) {
+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[0], target, ti, tl) : tweenFromValue, fromTargetObject);
+ decomposeRawValue(isFromToArray ? getFunctionValue(tweenToValue[1], target, ti, tl, toFunctionStore) : tweenToValue, toTargetObject);
+ if (fromTargetObject.t === valueTypes.NUMBER) {
+ if (prevSibling) {
+ if (prevSibling._valueType === valueTypes.UNIT) {
+ fromTargetObject.t = valueTypes.UNIT;
+ fromTargetObject.u = prevSibling._unit;
+ }
+ } else {
+ decomposeRawValue(
+ getOriginalAnimatableValue(target, propName, tweenType, animInlineStyles),
+ decomposedOriginalValue
+ );
+ if (decomposedOriginalValue.t === valueTypes.UNIT) {
+ fromTargetObject.t = valueTypes.UNIT;
+ fromTargetObject.u = decomposedOriginalValue.u;
+ }
+ }
+ }
+ } else {
+ if (hasToValue) {
+ decomposeRawValue(tweenToValue, toTargetObject);
+ } else {
+ if (prevTween) {
+ decomposeTweenValue(prevTween, toTargetObject);
+ } else {
+ // No need to get and parse the original value if the tween is part of a timeline and has a previous sibling part of the same timeline
+ decomposeRawValue(parent && prevSibling && prevSibling.parent.parent === parent ? prevSibling._value :
+ getOriginalAnimatableValue(target, propName, tweenType, animInlineStyles), toTargetObject);
+ }
+ }
+ if (hasFromvalue) {
+ decomposeRawValue(tweenFromValue, fromTargetObject);
+ } else {
+ if (prevTween) {
+ decomposeTweenValue(prevTween, fromTargetObject);
+ } else {
+ decomposeRawValue(parent && prevSibling && prevSibling.parent.parent === parent ? prevSibling._value :
+ // No need to get and parse the original value if the tween is part of a timeline and has a previous sibling part of the same timeline
+ getOriginalAnimatableValue(target, propName, tweenType, animInlineStyles), fromTargetObject);
+ }
+ }
+ }
+
+ // Apply operators
+ if (fromTargetObject.o) {
+ fromTargetObject.n = getRelativeValue(
+ !prevSibling ? decomposeRawValue(
+ getOriginalAnimatableValue(target, propName, tweenType, animInlineStyles),
+ decomposedOriginalValue
+ ).n : prevSibling._toNumber,
+ fromTargetObject.n,
+ fromTargetObject.o
+ );
+ }
+
+ if (toTargetObject.o) {
+ toTargetObject.n = getRelativeValue(fromTargetObject.n, toTargetObject.n, toTargetObject.o);
+ }
+
+ // Values omogenisation in cases of type difference between "from" and "to"
+ if (fromTargetObject.t !== toTargetObject.t) {
+ if (fromTargetObject.t === valueTypes.COMPLEX || toTargetObject.t === valueTypes.COMPLEX) {
+ const complexValue = fromTargetObject.t === valueTypes.COMPLEX ? fromTargetObject : toTargetObject;
+ const notComplexValue = fromTargetObject.t === valueTypes.COMPLEX ? toTargetObject : fromTargetObject;
+ notComplexValue.t = valueTypes.COMPLEX;
+ notComplexValue.s = cloneArray(complexValue.s);
+ notComplexValue.d = complexValue.d.map(() => notComplexValue.n);
+ } else if (fromTargetObject.t === valueTypes.UNIT || toTargetObject.t === valueTypes.UNIT) {
+ const unitValue = fromTargetObject.t === valueTypes.UNIT ? fromTargetObject : toTargetObject;
+ const notUnitValue = fromTargetObject.t === valueTypes.UNIT ? toTargetObject : fromTargetObject;
+ notUnitValue.t = valueTypes.UNIT;
+ notUnitValue.u = unitValue.u;
+ } else if (fromTargetObject.t === valueTypes.COLOR || toTargetObject.t === valueTypes.COLOR) {
+ const colorValue = fromTargetObject.t === valueTypes.COLOR ? fromTargetObject : toTargetObject;
+ const notColorValue = fromTargetObject.t === valueTypes.COLOR ? toTargetObject : fromTargetObject;
+ notColorValue.t = valueTypes.COLOR;
+ notColorValue.s = colorValue.s;
+ notColorValue.d = [0, 0, 0, 1];
+ }
+ }
+
+ // Unit conversion
+ if (fromTargetObject.u !== toTargetObject.u) {
+ let valueToConvert = toTargetObject.u ? fromTargetObject : toTargetObject;
+ valueToConvert = convertValueUnit(/** @type {DOMTarget} */(target), valueToConvert, toTargetObject.u ? toTargetObject.u : fromTargetObject.u, false);
+ // TODO:
+ // convertValueUnit(target, to.u ? from : to, to.u ? to.u : from.u);
+ }
+
+ // Fill in non existing complex values
+ if (toTargetObject.d && fromTargetObject.d && (toTargetObject.d.length !== fromTargetObject.d.length)) {
+ const longestValue = fromTargetObject.d.length > toTargetObject.d.length ? fromTargetObject : toTargetObject;
+ const shortestValue = longestValue === fromTargetObject ? toTargetObject : fromTargetObject;
+ // TODO: Check if n should be used instead of 0 for default complex values
+ shortestValue.d = longestValue.d.map((_, i) => isUnd(shortestValue.d[i]) ? 0 : shortestValue.d[i]);
+ shortestValue.s = cloneArray(longestValue.s);
+ }
+
+ // Tween factory
+
+ // Rounding is necessary here to minimize floating point errors
+ const tweenUpdateDuration = round(+tweenDuration || minValue, 12);
+
+ /** @type {Tween} */
+ const tween = {
+ parent: this,
+ id: tweenId++,
+ property: propName,
+ target: target,
+ _value: null,
+ _func: toFunctionStore.func,
+ _ease: parseEasings(tweenEasing),
+ _fromNumbers: cloneArray(fromTargetObject.d),
+ _toNumbers: cloneArray(toTargetObject.d),
+ _strings: cloneArray(toTargetObject.s),
+ _fromNumber: fromTargetObject.n,
+ _toNumber: toTargetObject.n,
+ _numbers: cloneArray(fromTargetObject.d), // For additive tween and animatables
+ _number: fromTargetObject.n, // For additive tween and animatables
+ _unit: toTargetObject.u,
+ _modifier: tweenModifier,
+ _currentTime: 0,
+ _startTime: tweenStartTime,
+ _delay: +tweenDelay,
+ _updateDuration: tweenUpdateDuration,
+ _changeDuration: tweenUpdateDuration,
+ _absoluteStartTime: absoluteStartTime,
+ // NOTE: Investigate bit packing to stores ENUM / BOOL
+ _tweenType: tweenType,
+ _valueType: toTargetObject.t,
+ _composition: tweenComposition,
+ _isOverlapped: 0,
+ _isOverridden: 0,
+ _renderTransforms: 0,
+ _prevRep: null, // For replaced tween
+ _nextRep: null, // For replaced tween
+ _prevAdd: null, // For additive tween
+ _nextAdd: null, // For additive tween
+ _prev: null,
+ _next: null,
+ };
+
+ if (tweenComposition !== compositionTypes.none) {
+ composeTween(tween, siblings);
+ }
+
+ if (isNaN(firstTweenChangeStartTime)) {
+ firstTweenChangeStartTime = tween._startTime;
+ }
+ // Rounding is necessary here to minimize floating point errors
+ lastTweenChangeEndTime = round(tweenStartTime + tweenUpdateDuration, 12);
+ prevTween = tween;
+ animationAnimationLength++;
+
+ addChild(this, tween);
+
+ }
+
+ // Update animation timings with the added tweens properties
+
+ if (isNaN(iterationDelay) || firstTweenChangeStartTime < iterationDelay) {
+ iterationDelay = firstTweenChangeStartTime;
+ }
+
+ if (isNaN(iterationDuration) || lastTweenChangeEndTime > iterationDuration) {
+ iterationDuration = lastTweenChangeEndTime;
+ }
+
+ // TODO: Find a way to inline tween._renderTransforms = 1 here
+ if (tweenType === tweenTypes.TRANSFORM) {
+ lastTransformGroupIndex = animationAnimationLength - tweenIndex;
+ lastTransformGroupLength = animationAnimationLength;
+ }
+
+ }
+
+ }
+
+ // Set _renderTransforms to last transform property to correctly render the transforms list
+ if (!isNaN(lastTransformGroupIndex)) {
+ let i = 0;
+ forEachChildren(this, (/** @type {Tween} */tween) => {
+ if (i >= lastTransformGroupIndex && i < lastTransformGroupLength) {
+ tween._renderTransforms = 1;
+ if (tween._composition === compositionTypes.blend) {
+ forEachChildren(additive.animation, (/** @type {Tween} */additiveTween) => {
+ if (additiveTween.id === tween.id) {
+ additiveTween._renderTransforms = 1;
+ }
+ });
+ }
+ }
+ i++;
+ });
+ }
+
+ }
+
+ if (!targetsLength) {
+ console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);
+ }
+
+ if (iterationDelay) {
+ forEachChildren(this, (/** @type {Tween} */tween) => {
+ // If (startTime - delay) equals 0, this means the tween is at the begining of the animation so we need to trim the delay too
+ if (!(tween._startTime - tween._delay)) {
+ tween._delay -= iterationDelay;
+ }
+ tween._startTime -= iterationDelay;
+ });
+ iterationDuration -= iterationDelay;
+ } else {
+ iterationDelay = 0;
+ }
+
+ // Prevents iterationDuration to be NaN if no valid animatable props have been provided
+ // Prevents _iterationCount to be NaN if no valid animatable props have been provided
+ if (!iterationDuration) {
+ iterationDuration = minValue;
+ this.iterationCount = 0;
+ }
+ /** @type {TargetsArray} */
+ this.targets = parsedTargets;
+ /** @type {Number} */
+ this.duration = iterationDuration === minValue ? minValue : clampInfinity(((iterationDuration + this._loopDelay) * this.iterationCount) - this._loopDelay) || minValue;
+ /** @type {Callback<this>} */
+ this.onRender = onRender || animDefaults.onRender;
+ /** @type {EasingFunction} */
+ this._ease = animEase;
+ /** @type {Number} */
+ this._delay = iterationDelay;
+ // NOTE: I'm keeping delay values separated from offsets in timelines because delays can override previous tweens and it could be confusing to debug a timeline with overridden tweens and no associated visible delays.
+ // this._delay = parent ? 0 : iterationDelay;
+ // this._offset += parent ? iterationDelay : 0;
+ /** @type {Number} */
+ this.iterationDuration = iterationDuration;
+ /** @type {{}} */
+ this._inlineStyles = animInlineStyles;
+
+ if (!this._autoplay && shouldTriggerRender) this.onRender(this);
+ }
+
+ /**
+ * @param {Number} newDuration
+ * @return {this}
+ */
+ stretch(newDuration) {
+ const currentDuration = this.duration;
+ if (currentDuration === normalizeTime(newDuration)) return this;
+ const timeScale = newDuration / currentDuration;
+ // NOTE: Find a better way to handle the stretch of an animation after stretch = 0
+ forEachChildren(this, (/** @type {Tween} */tween) => {
+ // Rounding is necessary here to minimize floating point errors
+ tween._updateDuration = normalizeTime(tween._updateDuration * timeScale);
+ tween._changeDuration = normalizeTime(tween._changeDuration * timeScale);
+ tween._currentTime *= timeScale;
+ tween._startTime *= timeScale;
+ tween._absoluteStartTime *= timeScale;
+ });
+ return super.stretch(newDuration);
+ }
+
+ /**
+ * @return {this}
+ */
+ refresh() {
+ forEachChildren(this, (/** @type {Tween} */tween) => {
+ const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
+ decomposeRawValue(ogValue, decomposedOriginalValue);
+ tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
+ tween._fromNumber = decomposedOriginalValue.n;
+ if (tween._func) {
+ decomposeRawValue(tween._func(), toTargetObject);
+ tween._toNumbers = cloneArray(toTargetObject.d);
+ tween._strings = cloneArray(toTargetObject.s);
+ tween._toNumber = toTargetObject.n;
+ }
+ });
+ return this;
+ }
+
+ /**
+ * Cancel the animation and revert all the values affected by this animation to their original state
+ * @return {this}
+ */
+ revert() {
+ super.revert();
+ return cleanInlineStyles(this);
+ }
+
+ /**
+ * @param {Callback<this>} [callback]
+ * @return {Promise}
+ */
+ then(callback) {
+ return super.then(callback);
+ }
+
+}
+
+/**
+ * @param {TargetsParam} targets
+ * @param {AnimationParams} parameters
+ * @return {JSAnimation}
+ */
+const animate = (targets, parameters) => new JSAnimation(targets, parameters, null, 0, false).init();
+
+
+
+
+/**
+ * @typedef {String|Number|Array<String>|Array<Number>} WAAPITweenValue
+ */
+
+/**
+ * @callback WAAPIFunctionvalue
+ * @param {DOMTarget} target - The animated target
+ * @param {Number} index - The target index
+ * @param {Number} length - The total number of animated targets
+ * @return {WAAPITweenValue}
+ */
+
+/**
+ * @typedef {WAAPITweenValue|WAAPIFunctionvalue|Array<String|Number|WAAPIFunctionvalue>} WAAPIKeyframeValue
+ */
+
+/**
+ * @typedef {(animation: WAAPIAnimation) => void} WAAPICallback
+ */
+
+/**
+ * @typedef {Object} WAAPITweenOptions
+ * @property {WAAPIKeyframeValue} [to]
+ * @property {WAAPIKeyframeValue} [from]
+ * @property {Number|WAAPIFunctionvalue} [duration]
+ * @property {Number|WAAPIFunctionvalue} [delay]
+ * @property {EasingParam} [ease]
+ * @property {CompositeOperation} [composition]
+ */
+
+/**
+ * @typedef {Object} WAAPIAnimationOptions
+ * @property {Number|Boolean} [loop]
+ * @property {Boolean} [Reversed]
+ * @property {Boolean} [Alternate]
+ * @property {Boolean|ScrollObserver} [autoplay]
+ * @property {Number} [playbackRate]
+ * @property {Number|WAAPIFunctionvalue} [duration]
+ * @property {Number|WAAPIFunctionvalue} [delay]
+ * @property {EasingParam} [ease]
+ * @property {CompositeOperation} [composition]
+ * @property {WAAPICallback} [onComplete]
+ */
+
+/**
+ * @typedef {Record<String, WAAPIKeyframeValue | WAAPIAnimationOptions | Boolean | ScrollObserver | WAAPICallback | EasingParam | WAAPITweenOptions> & WAAPIAnimationOptions} WAAPIAnimationParams
+ */
+
+const transformsShorthands = ['x', 'y', 'z'];
+
+[...transformsShorthands, ...validTransforms.filter(t => ['X', 'Y', 'Z'].some(axis => t.endsWith(axis)))];
+
+// Setting it to true in case CSS.registerProperty is not supported will automatically skip the registration and fallback to no animation
+isBrowser && (isUnd(CSS) || !Object.hasOwnProperty.call(CSS, 'registerProperty'));
+
+const WAAPIAnimationsLookups = {
+ _head: null,
+ _tail: null,
+};
+
+/**
+ * @param {DOMTarget} $el
+ * @param {String} [property]
+ * @param {WAAPIAnimation} [parent]
+ */
+const removeWAAPIAnimation = ($el, property, parent) => {
+ let nextLookup = WAAPIAnimationsLookups._head;
+ while (nextLookup) {
+ const next = nextLookup._next;
+ const matchTarget = nextLookup.$el === $el;
+ const matchProperty = !property || nextLookup.property === property;
+ const matchParent = !parent || nextLookup.parent === parent;
+ if (matchTarget && matchProperty && matchParent) {
+ const anim = nextLookup.animation;
+ try { anim.commitStyles(); } catch {} anim.cancel();
+ removeChild(WAAPIAnimationsLookups, nextLookup);
+ const lookupParent = nextLookup.parent;
+ if (lookupParent) {
+ lookupParent._completed++;
+ if (lookupParent.animations.length === lookupParent._completed) {
+ lookupParent.completed = true;
+ if (!lookupParent.muteCallbacks) {
+ lookupParent.paused = true;
+ lookupParent.onComplete(lookupParent);
+ lookupParent._resolve(lookupParent);
+ }
+ }
+ }
+ }
+ nextLookup = next;
+ }
+};
+
+
+
+
+/**
+ * @param {Callback<Timer>} [callback]
+ * @return {Timer}
+ */
+const sync = (callback = noop) => {
+ return new Timer({ duration: 1 * globals.timeScale, onComplete: callback }, null, 0).resume();
+};
+
+/**
+ * @overload
+ * @param {DOMTargetSelector} targetSelector
+ * @param {String} propName
+ * @return {String}
+ *
+ * @overload
+ * @param {JSTargetsParam} targetSelector
+ * @param {String} propName
+ * @return {Number|String}
+ *
+ * @overload
+ * @param {DOMTargetsParam} targetSelector
+ * @param {String} propName
+ * @param {String} unit
+ * @return {String}
+ *
+ * @overload
+ * @param {TargetsParam} targetSelector
+ * @param {String} propName
+ * @param {Boolean} unit
+ * @return {Number}
+ *
+ * @param {TargetsParam} targetSelector
+ * @param {String} propName
+ * @param {String|Boolean} [unit]
+ */
+function getTargetValue(targetSelector, propName, unit) {
+ const targets = registerTargets(targetSelector);
+ if (!targets.length) return;
+ const [ target ] = targets;
+ const tweenType = getTweenType(target, propName);
+ const normalizePropName = sanitizePropertyName(propName, target, tweenType);
+ let originalValue = getOriginalAnimatableValue(target, normalizePropName);
+ if (isUnd(unit)) {
+ return originalValue;
+ } else {
+ decomposeRawValue(originalValue, decomposedOriginalValue);
+ if (decomposedOriginalValue.t === valueTypes.NUMBER || decomposedOriginalValue.t === valueTypes.UNIT) {
+ if (unit === false) {
+ return decomposedOriginalValue.n;
+ } else {
+ const convertedValue = convertValueUnit(/** @type {DOMTarget} */(target), decomposedOriginalValue, /** @type {String} */(unit), false);
+ return `${round(convertedValue.n, globals.precision)}${convertedValue.u}`;
+ }
+ }
+ }
+}
+
+/**
+ * @param {TargetsParam} targets
+ * @param {AnimationParams} parameters
+ * @return {JSAnimation}
+ */
+const setTargetValues = (targets, parameters) => {
+ if (isUnd(parameters)) return;
+ parameters.duration = minValue;
+ // Do not overrides currently active tweens by default
+ parameters.composition = setValue(parameters.composition, compositionTypes.none);
+ // Skip init() and force rendering by playing the animation
+ return new JSAnimation(targets, parameters, null, 0, true).resume();
+};
+
+/**
+ * @param {TargetsArray} targetsArray
+ * @param {JSAnimation} animation
+ * @param {String} [propertyName]
+ * @return {Boolean}
+ */
+const removeTargetsFromAnimation = (targetsArray, animation, propertyName) => {
+ let tweensMatchesTargets = false;
+ forEachChildren(animation, (/**@type {Tween} */tween) => {
+ const tweenTarget = tween.target;
+ if (targetsArray.includes(tweenTarget)) {
+ const tweenName = tween.property;
+ const tweenType = tween._tweenType;
+ const normalizePropName = sanitizePropertyName(propertyName, tweenTarget, tweenType);
+ if (!normalizePropName || normalizePropName && normalizePropName === tweenName) {
+ // Make sure to flag the previous CSS transform tween to renderTransform
+ if (tween.parent._tail === tween &&
+ tween._tweenType === tweenTypes.TRANSFORM &&
+ tween._prev &&
+ tween._prev._tweenType === tweenTypes.TRANSFORM
+ ) {
+ tween._prev._renderTransforms = 1;
+ }
+ // Removes the tween from the selected animation
+ removeChild(animation, tween);
+ // Detach the tween from its siblings to make sure blended tweens are correctlly removed
+ removeTweenSliblings(tween);
+ tweensMatchesTargets = true;
+ }
+ }
+ }, true);
+ return tweensMatchesTargets;
+};
+
+/**
+ * @param {TargetsParam} targets
+ * @param {Renderable|WAAPIAnimation} [renderable]
+ * @param {String} [propertyName]
+ * @return {TargetsArray}
+ */
+const remove = (targets, renderable, propertyName) => {
+ const targetsArray = parseTargets(targets);
+ const parent = /** @type {Renderable|typeof engine} **/(renderable ? renderable : engine);
+ const waapiAnimation = renderable && /** @type {WAAPIAnimation} */(renderable).controlAnimation && /** @type {WAAPIAnimation} */(renderable);
+ for (let i = 0, l = targetsArray.length; i < l; i++) {
+ const $el = /** @type {DOMTarget} */(targetsArray[i]);
+ removeWAAPIAnimation($el, propertyName, waapiAnimation);
+ }
+ let removeMatches;
+ if (parent._hasChildren) {
+ let iterationDuration = 0;
+ forEachChildren(parent, (/** @type {Renderable} */child) => {
+ if (!child._hasChildren) {
+ removeMatches = removeTargetsFromAnimation(targetsArray, /** @type {JSAnimation} */(child), propertyName);
+ // Remove the child from its parent if no tweens and no children left after the removal
+ if (removeMatches && !child._head) {
+ child.cancel();
+ removeChild(parent, child);
+ } else {
+ // Calculate the new iterationDuration value to handle onComplete with last child in render()
+ const childTLOffset = child._offset + child._delay;
+ const childDur = childTLOffset + child.duration;
+ if (childDur > iterationDuration) {
+ iterationDuration = childDur;
+ }
+ }
+ }
+ // Make sure to also remove engine's children targets
+ // NOTE: Avoid recursion?
+ if (child._head) {
+ remove(targets, child, propertyName);
+ } else {
+ child._hasChildren = false;
+ }
+ }, true);
+ // Update iterationDuration value to handle onComplete with last child in render()
+ if (!isUnd(/** @type {Renderable} */(parent).iterationDuration)) {
+ /** @type {Renderable} */(parent).iterationDuration = iterationDuration;
+ }
+ } else {
+ removeMatches = removeTargetsFromAnimation(
+ targetsArray,
+ /** @type {JSAnimation} */(parent),
+ propertyName
+ );
+ }
+
+ if (removeMatches && !parent._head) {
+ parent._hasChildren = false;
+ // Cancel the parent if there are no tweens and no children left after the removal
+ // We have to check if the .cancel() method exist to handle cases where the parent is the engine itself
+ if (/** @type {Renderable} */(parent).cancel) /** @type {Renderable} */(parent).cancel();
+ }
+
+ return targetsArray;
+};
+
+/**
+ * @param {(...args: any[]) => Tickable} constructor
+ * @return {(...args: any[]) => Tickable}
+ */
+const keepTime = constructor => {
+ /** @type {Tickable} */
+ let tracked;
+ return (...args) => {
+ const currentIteration = tracked ? tracked.currentIteration : 0;
+ const currentIterationProgress = tracked ? tracked.iterationProgress : 0;
+ const reversed = tracked ? tracked.reversed : false;
+ const alternate = tracked ? tracked._alternate : false;
+ if (tracked) tracked.revert();
+ tracked = constructor(...args);
+ if (!tracked || tracked && isUnd(tracked.iterationProgress)) {
+ console.warn('keepTime() first argument must be a function that returns a Timer, Animation or Timeline');
+ } else {
+ tracked.currentIteration = currentIteration;
+ tracked.iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;
+ }
+ return tracked;
+ }
+};
+
+/**
+ * @param {String|Array} items
+ * @return {any}
+ */
+const randomPick = items => items[random(0, items.length - 1)];
+
+/**
+ * @param {Number|String} v
+ * @param {Number} decimalLength
+ * @return {String}
+ */
+const roundPad = (v, decimalLength) => (+v).toFixed(decimalLength);
+
+/**
+ * @param {Number} v
+ * @param {Number} totalLength
+ * @param {String} padString
+ * @return {String}
+ */
+const padStart = (v, totalLength, padString) => `${v}`.padStart(totalLength, padString);
+
+/**
+ * @param {Number} v
+ * @param {Number} totalLength
+ * @param {String} padString
+ * @return {String}
+ */
+const padEnd = (v, totalLength, padString) => `${v}`.padEnd(totalLength, padString);
+
+/**
+ * @param {Number} v
+ * @param {Number} min
+ * @param {Number} max
+ * @return {Number}
+ */
+const wrap = (v, min, max) => (((v - min) % (max - min) + (max - min)) % (max - min)) + min;
+
+/**
+ * @param {Number} value
+ * @param {Number} inLow
+ * @param {Number} inHigh
+ * @param {Number} outLow
+ * @param {Number} outHigh
+ * @return {Number}
+ */
+const mapRange = (value, inLow, inHigh, outLow, outHigh) => outLow + ((value - inLow) / (inHigh - inLow)) * (outHigh - outLow);
+
+/**
+ * @param {Number} degrees
+ * @return {Number}
+ */
+const degToRad = degrees => degrees * PI / 180;
+
+/**
+ * @param {Number} radians
+ * @return {Number}
+ */
+const radToDeg = radians => radians * 180 / PI;
+
+/**
+ * https://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
+ * @param {Number} start
+ * @param {Number} end
+ * @param {Number} amount
+ * @param {Renderable|Boolean} [renderable]
+ * @return {Number}
+ */
+const lerp = (start, end, amount, renderable) => {
+ let dt = K / globals.defaults.frameRate;
+ if (renderable !== false) {
+ const ticker = /** @type Renderable */
+ (renderable) ||
+ (engine._hasChildren && engine);
+ if (ticker && ticker.deltaTime) {
+ dt = ticker.deltaTime;
+ }
+ }
+ const t = 1 - Math.exp(-amount * dt * .1);
+ return !amount ? start : amount === 1 ? end : (1 - t) * start + t * end;
+};
+
+// Chain-able utilities
+
+/**
+ * @callback UtilityFunction
+ * @param {...*} args
+ * @return {Number|String}
+ *
+ * @param {UtilityFunction} fn
+ * @param {Number} [last=0]
+ * @return {function(...(Number|String)): function(Number|String): (Number|String)}
+ */
+const curry = (fn, last = 0) => (...args) => last ? v => fn(...args, v) : v => fn(v, ...args);
+
+/**
+ * @param {Function} fn
+ * @return {function(...(Number|String))}
+ */
+const chain = fn => {
+ return (...args) => {
+ const result = fn(...args);
+ return new Proxy(noop, {
+ apply: (_, __, [v]) => result(v),
+ get: (_, prop) => chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {
+ const nextResult = utils[prop](...nextArgs);
+ return (/**@type {Number|String} */v) => nextResult(result(v));
+ })
+ });
+ }
+};
+
+/**
+ * @param {UtilityFunction} fn
+ * @param {Number} [right]
+ * @return {function(...(Number|String)): UtilityFunction}
+ */
+const makeChainable = (fn, right = 0) => (...args) => (args.length < fn.length ? chain(curry(fn, right)) : fn)(...args);
+
+/**
+ * @callback ChainedUtilsResult
+ * @param {Number} value
+ * @return {Number}
+ *
+ * @typedef {Object} ChainableUtils
+ * @property {ChainedClamp} clamp
+ * @property {ChainedRound} round
+ * @property {ChainedSnap} snap
+ * @property {ChainedWrap} wrap
+ * @property {ChainedInterpolate} interpolate
+ * @property {ChainedMapRange} mapRange
+ * @property {ChainedRoundPad} roundPad
+ * @property {ChainedPadStart} padStart
+ * @property {ChainedPadEnd} padEnd
+ * @property {ChainedDegToRad} degToRad
+ * @property {ChainedRadToDeg} radToDeg
+ *
+ * @typedef {ChainableUtils & ChainedUtilsResult} ChainableUtil
+ *
+ * @callback ChainedClamp
+ * @param {Number} min
+ * @param {Number} max
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedRound
+ * @param {Number} decimalLength
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedSnap
+ * @param {Number} increment
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedWrap
+ * @param {Number} min
+ * @param {Number} max
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedInterpolate
+ * @param {Number} start
+ * @param {Number} end
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedMapRange
+ * @param {Number} inLow
+ * @param {Number} inHigh
+ * @param {Number} outLow
+ * @param {Number} outHigh
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedRoundPad
+ * @param {Number} decimalLength
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedPadStart
+ * @param {Number} totalLength
+ * @param {String} padString
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedPadEnd
+ * @param {Number} totalLength
+ * @param {String} padString
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedDegToRad
+ * @return {ChainableUtil}
+ *
+ * @callback ChainedRadToDeg
+ * @return {ChainableUtil}
+ */
+
+const utils = {
+ $: registerTargets,
+ get: getTargetValue,
+ set: setTargetValues,
+ remove,
+ cleanInlineStyles,
+ random,
+ randomPick,
+ shuffle,
+ lerp,
+ sync,
+ keepTime,
+ clamp: /** @type {typeof clamp & ChainedClamp} */(makeChainable(clamp)),
+ round: /** @type {typeof round & ChainedRound} */(makeChainable(round)),
+ snap: /** @type {typeof snap & ChainedSnap} */(makeChainable(snap)),
+ wrap: /** @type {typeof wrap & ChainedWrap} */(makeChainable(wrap)),
+ interpolate: /** @type {typeof interpolate & ChainedInterpolate} */(makeChainable(interpolate, 1)),
+ mapRange: /** @type {typeof mapRange & ChainedMapRange} */(makeChainable(mapRange)),
+ roundPad: /** @type {typeof roundPad & ChainedRoundPad} */(makeChainable(roundPad)),
+ padStart: /** @type {typeof padStart & ChainedPadStart} */(makeChainable(padStart)),
+ padEnd: /** @type {typeof padEnd & ChainedPadEnd} */(makeChainable(padEnd)),
+ degToRad: /** @type {typeof degToRad & ChainedDegToRad} */(makeChainable(degToRad)),
+ radToDeg: /** @type {typeof radToDeg & ChainedRadToDeg} */(makeChainable(radToDeg)),
+};
+
+
+
+
+/**
+ * @typedef {Number|String|Function} TimePosition
+ */
+
+/**
+ * Timeline's children offsets positions parser
+ * @param {Timeline} timeline
+ * @param {String} timePosition
+ * @return {Number}
+ */
+const getPrevChildOffset = (timeline, timePosition) => {
+ if (stringStartsWith(timePosition, '<')) {
+ const goToPrevAnimationOffset = timePosition[1] === '<';
+ const prevAnimation = /** @type {Tickable} */(timeline._tail);
+ const prevOffset = prevAnimation ? prevAnimation._offset + prevAnimation._delay : 0;
+ return goToPrevAnimationOffset ? prevOffset : prevOffset + prevAnimation.duration;
+ }
+};
+
+/**
+ * @param {Timeline} timeline
+ * @param {TimePosition} [timePosition]
+ * @return {Number}
+ */
+const parseTimelinePosition = (timeline, timePosition) => {
+ let tlDuration = timeline.iterationDuration;
+ if (tlDuration === minValue) tlDuration = 0;
+ if (isUnd(timePosition)) return tlDuration;
+ if (isNum(+timePosition)) return +timePosition;
+ const timePosStr = /** @type {String} */(timePosition);
+ const tlLabels = timeline ? timeline.labels : null;
+ const hasLabels = !isNil(tlLabels);
+ const prevOffset = getPrevChildOffset(timeline, timePosStr);
+ const hasSibling = !isUnd(prevOffset);
+ const matchedRelativeOperator = relativeValuesExecRgx.exec(timePosStr);
+ if (matchedRelativeOperator) {
+ const fullOperator = matchedRelativeOperator[0];
+ const split = timePosStr.split(fullOperator);
+ const labelOffset = hasLabels && split[0] ? tlLabels[split[0]] : tlDuration;
+ const parsedOffset = hasSibling ? prevOffset : hasLabels ? labelOffset : tlDuration;
+ const parsedNumericalOffset = +split[1];
+ return getRelativeValue(parsedOffset, parsedNumericalOffset, fullOperator[0]);
+ } else {
+ return hasSibling ? prevOffset :
+ hasLabels ? !isUnd(tlLabels[timePosStr]) ? tlLabels[timePosStr] :
+ tlDuration : tlDuration;
+ }
+};
+
+/**
+ * @param {Timeline} tl
+ * @return {Number}
+ */
+function getTimelineTotalDuration(tl) {
+ return clampInfinity(((tl.iterationDuration + tl._loopDelay) * tl.iterationCount) - tl._loopDelay) || minValue;
+}
+
+/**
+ * @overload
+ * @param {TimerParams} childParams
+ * @param {Timeline} tl
+ * @param {Number} timePosition
+ * @return {Timeline}
+ *
+ * @overload
+ * @param {AnimationParams} childParams
+ * @param {Timeline} tl
+ * @param {Number} timePosition
+ * @param {TargetsParam} targets
+ * @param {Number} [index]
+ * @param {Number} [length]
+ * @return {Timeline}
+ *
+ * @param {TimerParams|AnimationParams} childParams
+ * @param {Timeline} tl
+ * @param {Number} timePosition
+ * @param {TargetsParam} [targets]
+ * @param {Number} [index]
+ * @param {Number} [length]
+ */
+function addTlChild(childParams, tl, timePosition, targets, index, length) {
+ const isSetter = isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= minValue;
+ // Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined position
+ const adjustedPosition = isSetter ? timePosition - minValue : timePosition;
+ tick(tl, adjustedPosition, 1, 1, tickModes.AUTO);
+ const tlChild = targets ?
+ new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :
+ new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);
+ tlChild.init(1);
+ // TODO: Might be better to insert at a position relative to startTime?
+ addChild(tl, tlChild);
+ forEachChildren(tl, (/** @type {Renderable} */child) => {
+ const childTLOffset = child._offset + child._delay;
+ const childDur = childTLOffset + child.duration;
+ if (childDur > tl.iterationDuration) tl.iterationDuration = childDur;
+ });
+ tl.duration = getTimelineTotalDuration(tl);
+ return tl;
+}
+
+class Timeline extends Timer {
+
+ /**
+ * @param {TimelineParams} [parameters]
+ */
+ constructor(parameters = {}) {
+ super(/** @type {TimerParams&TimelineParams} */(parameters), null, 0);
+ /** @type {Number} */
+ this.duration = 0; // TL duration starts at 0 and grows when adding children
+ /** @type {Record<String, Number>} */
+ this.labels = {};
+ const defaultsParams = parameters.defaults;
+ const globalDefaults = globals.defaults;
+ /** @type {DefaultsParams} */
+ this.defaults = defaultsParams ? mergeObjects(defaultsParams, globalDefaults) : globalDefaults;
+ /** @type {Callback<this>} */
+ this.onRender = parameters.onRender || globalDefaults.onRender;
+ const tlPlaybackEase = setValue(parameters.playbackEase, globalDefaults.playbackEase);
+ this._ease = tlPlaybackEase ? parseEasings(tlPlaybackEase) : null;
+ /** @type {Number} */
+ this.iterationDuration = 0;
+ }
+
+ /**
+ * @overload
+ * @param {TargetsParam} a1
+ * @param {AnimationParams} a2
+ * @param {TimePosition} [a3]
+ * @return {this}
+ *
+ * @overload
+ * @param {TimerParams} a1
+ * @param {TimePosition} [a2]
+ * @return {this}
+ *
+ * @param {TargetsParam|TimerParams} a1
+ * @param {AnimationParams|TimePosition} a2
+ * @param {TimePosition} [a3]
+ */
+ add(a1, a2, a3) {
+ const isAnim = isObj(a2);
+ const isTimer = isObj(a1);
+ if (isAnim || isTimer) {
+ this._hasChildren = true;
+ if (isAnim) {
+ const childParams = /** @type {AnimationParams} */(a2);
+ // Check for function for children stagger positions
+ if (isFnc(a3)) {
+ const staggeredPosition = /** @type {Function} */(a3);
+ const parsedTargetsArray = parseTargets(/** @type {TargetsParam} */(a1));
+ // Store initial duration before adding new children that will change the duration
+ const tlDuration = this.duration;
+ // Store initial _iterationDuration before adding new children that will change the duration
+ const tlIterationDuration = this.iterationDuration;
+ // Store the original id in order to add specific indexes to the new animations ids
+ const id = childParams.id;
+ let i = 0;
+ const parsedLength = parsedTargetsArray.length;
+ parsedTargetsArray.forEach((/** @type {Target} */target) => {
+ // Create a new parameter object for each staggered children
+ const staggeredChildParams = { ...childParams };
+ // Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculation
+ this.duration = tlDuration;
+ this.iterationDuration = tlIterationDuration;
+ if (!isUnd(id)) staggeredChildParams.id = id + '-' + i;
+ addTlChild(
+ staggeredChildParams,
+ this,
+ staggeredPosition(target, i, parsedLength, this),
+ target,
+ i,
+ parsedLength
+ );
+ i++;
+ });
+ } else {
+ addTlChild(
+ childParams,
+ this,
+ parseTimelinePosition(this, a3),
+ /** @type {TargetsParam} */(a1),
+ );
+ }
+ } else {
+ // It's a Timer
+ addTlChild(
+ /** @type TimerParams */(a1),
+ this,
+ parseTimelinePosition(this,/** @type TimePosition */(a2)),
+ );
+ }
+ return this.init(1); // 1 = internalRender
+ }
+ }
+
+ /**
+ * @overload
+ * @param {Tickable} [synced]
+ * @param {TimePosition} [position]
+ * @return {this}
+ *
+ * @overload
+ * @param {globalThis.Animation} [synced]
+ * @param {TimePosition} [position]
+ * @return {this}
+ *
+ * @overload
+ * @param {WAAPIAnimation} [synced]
+ * @param {TimePosition} [position]
+ * @return {this}
+ *
+ * @param {Tickable|WAAPIAnimation|globalThis.Animation} [synced]
+ * @param {TimePosition} [position]
+ */
+ sync(synced, position) {
+ if (isUnd(synced) || synced && isUnd(synced.pause)) return this;
+ synced.pause();
+ const duration = +(/** @type {globalThis.Animation} */(synced).effect ? /** @type {globalThis.Animation} */(synced).effect.getTiming().duration : /** @type {Tickable} */(synced).duration);
+ return this.add(synced, { currentTime: [0, duration], duration, ease: 'linear' }, position);
+ }
+
+ /**
+ * @param {TargetsParam} targets
+ * @param {AnimationParams} parameters
+ * @param {TimePosition} [position]
+ * @return {this}
+ */
+ set(targets, parameters, position) {
+ if (isUnd(parameters)) return this;
+ parameters.duration = minValue;
+ parameters.composition = compositionTypes.replace;
+ return this.add(targets, parameters, position);
+ }
+
+ /**
+ * @param {Callback<Timer>} callback
+ * @param {TimePosition} [position]
+ * @return {this}
+ */
+ call(callback, position) {
+ if (isUnd(callback) || callback && !isFnc(callback)) return this;
+ return this.add({ duration: 0, onComplete: () => callback(this) }, position);
+ }
+
+ /**
+ * @param {String} labelName
+ * @param {TimePosition} [position]
+ * @return {this}
+ *
+ */
+ label(labelName, position) {
+ if (isUnd(labelName) || labelName && !isStr(labelName)) return this;
+ this.labels[labelName] = parseTimelinePosition(this,/** @type TimePosition */(position));
+ return this;
+ }
+
+ /**
+ * @param {TargetsParam} targets
+ * @param {String} [propertyName]
+ * @return {this}
+ */
+ remove(targets, propertyName) {
+ remove(targets, this, propertyName);
+ return this;
+ }
+
+ /**
+ * @param {Number} newDuration
+ * @return {this}
+ */
+ stretch(newDuration) {
+ const currentDuration = this.duration;
+ if (currentDuration === normalizeTime(newDuration)) return this;
+ const timeScale = newDuration / currentDuration;
+ const labels = this.labels;
+ forEachChildren(this, (/** @type {JSAnimation} */child) => child.stretch(child.duration * timeScale));
+ for (let labelName in labels) labels[labelName] *= timeScale;
+ return super.stretch(newDuration);
+ }
+
+ /**
+ * @return {this}
+ */
+ refresh() {
+ forEachChildren(this, (/** @type {JSAnimation} */child) => {
+ if (child.refresh) child.refresh();
+ });
+ return this;
+ }
+
+ /**
+ * @return {this}
+ */
+ revert() {
+ super.revert();
+ forEachChildren(this, (/** @type {JSAnimation} */child) => child.revert, true);
+ return cleanInlineStyles(this);
+ }
+
+ /**
+ * @param {Callback<this>} [callback]
+ * @return {Promise}
+ */
+ then(callback) {
+ return super.then(callback);
+ }
+}
+
+/**
+ * @param {TimelineParams} [parameters]
+ * @return {Timeline}
+ */
+const createTimeline = parameters => new Timeline(parameters).init();
+
+
+
+
+const segmenter = !isUnd(Intl) && Intl.Segmenter;
+isBrowser ? doc.createElement('template') : null;
+const whiteSpaceGroupRgx = /(\s+)/;
+const whiteSpaceRgx = /^\s+$/;
+
+/**
+ * @typedef {Object} Segment
+ * @property {String} segment
+ * @property {Boolean} [isWordLike]
+ */
+
+/**
+ * @typedef {Object} Segmenter
+ * @property {function(String): Iterable<Segment>} segment
+ */
+
+/**
+ * @type {Segmenter}
+ */
+(() => {
+ return segmenter ? new segmenter([], { granularity: 'word' }) : {
+ segment: (text) => {
+ const segments = [];
+ const words = text.split(whiteSpaceGroupRgx);
+ for (let i = 0, l = words.length; i < l; i++) {
+ const segment = words[i];
+ segments.push({
+ segment,
+ isWordLike: !whiteSpaceRgx.test(segment), // Consider non-whitespace as word-like
+ });
+ }
+ return segments;
+ }
+ };
+})();
+
+/**
+ * @type {Segmenter}
+ */
+(() => {
+ return segmenter ? new segmenter([], { granularity: 'grapheme' }) : {
+ segment: text => Array.from(text).map(char => ({ segment: char }))
+ };
+})();
+
+const icons = {
+ toggle: `
+ <polygon fill="currentColor" points="29 18 23 12 17 18"/>
+ <polygon fill="currentColor" points="29 23 17 23 17 20 29 20"/>
+ `,
+ play: `
+ <polygon fill="currentColor" fill-rule="nonzero" points="17 10 17 26 32 18"/>
+ `,
+ pause: `
+ <rect width="5" height="14" x="17" y="11" fill="currentColor" fill-rule="nonzero"/>
+ <rect width="5" height="14" x="24" y="11" fill="currentColor" fill-rule="nonzero"/>
+ `,
+ back: `
+ <polygon fill="currentColor" points="28 12 22 18 28 24"/>
+ <polygon fill="currentColor" points="21 12 21 24 18 24 18 12"/>
+ `,
+ settings: `<path fill="currentColor" fill-rule="nonzero" d="M24.455 10v2.178a5.964 5.964 0 0 1 1.633.676l1.54-1.54 2.057 2.058-1.54 1.54c.302.502.532 1.05.677 1.633H31v2.91h-2.178a5.964 5.964 0 0 1-.676 1.633l1.54 1.54-2.058 2.057-1.54-1.54a5.964 5.964 0 0 1-1.633.677V26h-2.91v-2.178a5.964 5.964 0 0 1-1.633-.676l-1.54 1.54-2.057-2.058 1.54-1.54a5.964 5.964 0 0 1-.677-1.633H15v-2.91h2.178a5.964 5.964 0 0 1 .676-1.633l-1.54-1.54 2.058-2.057 1.54 1.54a5.964 5.964 0 0 1 1.633-.677V10h2.91zM23 15a3 3 0 1 0 0 6 3 3 0 0 0 0-6z"/>
+ `,
+ clamp: `<path fill="currentColor" d="M15 25a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h15a2 2 0 0 1 1.995 1.85L32 14v9a2 2 0 0 1-1.85 1.995L30 25H15zm13-12H17v11h11V13z"/>
+ `,
+};
+
+const sideBarWidth = 212;
+const toolbarHeight = 56;
+const toolbarItemHeight = 36;
+const thumbWidth = 8;
+const tlScrubberHeight = 16;
+const tlLineHeight = 14;
+
+const instances = [];
+
+const parameters = {
+ active: null,
+ $container: document.body,
+ highlightSiblings: true,
+ showTweenId: true,
+ startTime: 0,
+ endTime: null,
+ time: 0,
+ speed: 1,
+ loop: false,
+ scrollX: 0,
+ scrollY: 0,
+ height: toolbarHeight,
+ minified: window.innerHeight * .4,
+ clamped: false,
+};
+
+function getActiveInstance() {
+ return instances[parameters.active];
+}
+
+const url = new URL(window.location.href);
+
+const urlParams = url.searchParams;
+
+function getParsedParameter(paramName, userParams) {
+ const fromUrl = urlParams.get(paramName);
+ const fromUser = userParams[paramName];
+ let param;
+ if (!isUnd(fromUrl)) {
+ param = fromUrl;
+ } else if (!isUnd(fromUser)) {
+ urlParams.set(paramName, fromUser);
+ param = fromUser;
+ }
+ if (param === 'true') {
+ param = true;
+ } else if (param === 'false') {
+ param = false;
+ } else {
+ const numParam = parseFloat(param);
+ if (isNum(numParam)) {
+ param = numParam;
+ }
+ }
+ return param;
+}
+
+function parseParameters(userParams) {
+ for (let paramName in parameters) {
+ const parsedParam = getParsedParameter(paramName, userParams);
+ if (!isNil(parsedParam)) {
+ parameters[paramName] = parsedParam;
+ }
+ }
+}
+
+let setUrlParamTimeout;
+
+function setParameter(param, value) {
+ parameters[param] = value;
+ url.searchParams.set(param, value);
+ clearTimeout(setUrlParamTimeout);
+ setUrlParamTimeout = setTimeout(() => {
+ window.history.replaceState(null, '', url);
+ }, 66);
+}
+
+function msToEm(ms) {
+ return ms / 125 + 'em';
+}
+
+const prefix = 'anime-gui-';
+
+const dot = '.';
+const classPrefix = dot + prefix;
+const prefixRgx = /\.-?[_a-zA-Z\-]+[\w\-:\[\]]*/gm;
+const commentsRgx = /\/\*.*?\*\//g;
+const spacesRgx = /\s{3,}/g;
+
+function prefixCSS(styles) {
+ let prefixed = styles;
+ styles.match(prefixRgx).forEach(match => prefixed = prefixed.replace(match, match.replace(dot, classPrefix)));
+ return prefixed;
+}
+
+function minifyCSS(styles) {
+ return styles.replace(commentsRgx, '').replace(spacesRgx, ''); // Remove comments then remove 3 or more consecutive spaces
+}
+
+function appendStyles(styles) {
+ const styleEl = document.createElement('style');
+ styleEl.setAttribute('id', prefix + 'styles');
+ styleEl.innerHTML = minifyCSS(prefixCSS(styles));
+ document.head.appendChild(styleEl);
+}
+
+function createBlock(className, css) {
+ var $el = document.createElement('div');
+ $el.classList.add(prefix + 'block');
+ if (Array.isArray(className)) {
+ for (let i = 0, l = className.length; i < l; i++) {
+ $el.classList.add(prefix + className[i]);
+ }
+ } else {
+ $el.classList.add(prefix + className);
+ }
+ if (css) $el.style.cssText = css;
+ return $el;
+}
+
+function getIconCode(name) {
+ return `<svg viewBox="0 0 45 36"><g fill-rule="evenodd">${icons[name]}</g></svg>`;
+}
+
+function createProgressBar() {
+ const $el = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
+ $el.classList.add(`${prefix}progress-circle`);
+ utils.set($el, { viewBox: '0 0 14 14'} );
+ $el.innerHTML = `<g fill="none" fill-rule="evenodd"><circle cx="7" cy="7" r="6" stroke="#FFFFFF" stroke-width="2" opacity=".2"/><path stroke="#FFFFFF" stroke-width="2" d="M7 1a6 6 0 1 1-.023 0"/></g>`;
+ return $el;
+}
+
+function createButton(className, innerHTML = '') {
+ const $el = document.createElement('button');
+ $el.classList.add(`${prefix}${className}`);
+ $el.classList.add(`${prefix}sidebar-item`);
+ $el.classList.add(`${prefix}sidebar-button`);
+ $el.innerHTML = innerHTML;
+ return $el;
+}
+
+function createSpeedButton() {
+ const $el = document.createElement('select');
+ const options = [2, 1.8, 1.5, 1.2, 1, .8, .5, .2, .1];
+ $el.classList.add(`${prefix}speed-button`);
+ $el.classList.add(`${prefix}sidebar-item`);
+ $el.classList.add(`${prefix}sidebar-button`);
+ for (let i = 0; i < options.length; i++) {
+ const $option = document.createElement('option');
+ $option.value = options[i];
+ $option.text = options[i] + '×';
+ $el.appendChild($option);
+ }
+ $el.value = 1;
+ return $el;
+}
+
+function createScrubberInput(className) {
+ const $input = document.createElement('input');
+ $input.classList.add(`${prefix}scrubber`);
+ $input.classList.add(`${prefix}${className}`);
+ utils.set($input, { type: 'range', min: '0', max: '1', value: '0' });
+ return $input;
+}
+
+function createScrubberBlock(className) {
+ const $scrubber = createBlock(className);
+ const tlScrubber = createScrubberInput('time-scrubber');
+ const tlMinScrubber = createScrubberInput('min-scrubber');
+ const tlMaxScrubber = createScrubberInput('max-scrubber');
+ $scrubber.appendChild(tlScrubber);
+ $scrubber.appendChild(tlMinScrubber);
+ $scrubber.appendChild(tlMaxScrubber);
+ return $scrubber;
+}
+
+function initDOM() {
+ const $wrapper = createBlock('wrapper');
+ const $tlWrapper = createBlock('tl-wrapper');
+ const $toolbar = createBlock('toolbar');
+ const $resizer = createBlock('resizer');
+ const $sidebarLeft = createBlock('sidebar');
+ const $sidebarRight = createBlock('sidebar');
+ const $toggleButton = createButton('toggle-button', getIconCode('toggle'));
+ const $playbackButton = createButton('playback-button', getIconCode('play'));
+ const $backButton = createButton('back-button', getIconCode('back'));
+ const $speedButton = createSpeedButton();
+ const $clampButton = createButton('clamp-button', getIconCode('clamp'));
+ const $mm = createBlock('mm');
+ const $clock = createBlock(['clock', 'sidebar-item']);
+ const $currentTime = createBlock('current-time');
+ const $currentTimeShadow = createBlock(['current-time', 'current-time-shadow']);
+ const $totalDuration = createBlock('total-duration');
+ const $totalTime = createBlock('total-time');
+ const $progressBar = createProgressBar();
+ const $tl = createBlock(['tl', 'ruller-bg']);
+ const $tlScrubber = createScrubberBlock('tl-scrubber');
+ const $mmScrubber = createScrubberBlock('mm-scrubber');
+ const $mmBox = createBlock('mm-box');
+
+ $totalTime.appendChild($totalDuration);
+ $clock.appendChild($currentTimeShadow);
+ $clock.appendChild($currentTime);
+ $clock.appendChild($totalTime);
+ $clock.appendChild($progressBar);
+ $mmScrubber.appendChild($mmBox);
+ $mm.appendChild($mmScrubber);
+ $tl.appendChild($tlScrubber);
+ $sidebarLeft.appendChild($playbackButton);
+ $sidebarLeft.appendChild($backButton);
+ $sidebarLeft.appendChild($speedButton);
+ $sidebarLeft.appendChild($clampButton);
+ $sidebarRight.appendChild($clock);
+ $sidebarRight.appendChild($toggleButton);
+ $toolbar.appendChild($sidebarLeft);
+ $toolbar.appendChild($mm);
+ $toolbar.appendChild($resizer);
+ $toolbar.appendChild($sidebarRight);
+ $wrapper.appendChild($toolbar);
+ $wrapper.appendChild($tlWrapper);
+ $tlWrapper.appendChild($tl);
+
+ return {
+ $wrapper,
+ $tlWrapper,
+ $tl,
+ $tlScrubber,
+ $resizer,
+ $mmScrubber,
+ $mmBox,
+ $speedButton,
+ $clampButton,
+ $currentTimeShadow,
+ $currentTime,
+ $totalDuration,
+ }
+}
+
+const blackColor = '#1B1B1B';
+const whiteColor = '#F6F4F2';
+const whiteAlpha1Color = 'rgba(246, 244, 242, .05)';
+const whiteAlpha2Color = 'rgba(246, 244, 242, .5)';
+const whiteAlpha3Color = 'rgba(246, 244, 242, .75)';
+const blackAlpha1Color = 'rgba(46, 44, 44, .75)';
+const blackAlpha2Color = 'rgba(46, 44, 44, .9)';
+
+const colors = ['#FF4B4B','#FF8F42','#FFC730','#F6FF56','#A4FF4F','#18FF74','#00D672','#3CFFEC','#61C3FF','#5A87FF','#8453E3','#C26EFF','#FB89FB'];
+// const colors = [...Array(32)].map((c, i) => 'hsl(' + Math.round(360 / 32 * i) + ', 88%, 62%)');
+const colorLength = colors.length;
+const colorIds = {};
+let colorIndex = 0;
+
+function getNextColor() {
+ const color = colors[colorIndex++];
+ if (colorIndex > colorLength - 1) colorIndex = 0;
+ return color;
+}
+
+function getColor(id) {
+ if (id) {
+ const idColor = colorIds[id];
+ if (idColor) {
+ return idColor;
+ } else {
+ return colorIds[id] = getNextColor();
+ }
+ } else {
+ return getNextColor();
+ }
+}
+
+const styles = `
+ .wrapper,
+ .wrapper *,
+ .wrapper *:before,
+ .wrapper *:after {
+ box-sizing: border-box;
+ display: flex;
+ flex-shrink: 0;
+ position: relative;
+ user-select: none;
+ font-variant-numeric: tabular-nums;
+ }
+ .wrapper {
+ position: fixed;
+ z-index: 999999;
+ right: 0;
+ bottom: 0;
+ width: 100%;
+ height: var(--anime-gui-height);
+ font-family: sans-serif;
+ background-color: ${blackColor};
+ }
+ .tl-wrapper {
+ position: absolute;
+ left: 0;
+ top: ${toolbarHeight}px;
+ overflow: auto;
+ flex-direction: column;
+ width: 100%;
+ height: var(--anime-gui-tl-height);
+ background-color: ${blackColor};
+ }
+ .toolbar {
+ position: sticky;
+ z-index: 99;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: ${toolbarHeight}px;
+ padding: 10px;
+ background-color: ${blackColor};
+ box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .04),
+ inset 0 -1px 0 0 rgba(0, 0, 0, .4);
+ }
+ .resizer {
+ position: absolute;
+ z-index: 9999;
+ left: 0;
+ top: -5px;
+ width: 100%;
+ height: 15px;
+ cursor: row-resize;
+ }
+ .sidebar {
+ overflow: hidden;
+ flex-wrap: nowrap;
+ width: ${sideBarWidth - 30}px;
+ border-radius: 4px;
+ background-color: ${whiteAlpha1Color};
+ color: rgba(255,255,255,.65);
+ }
+ .sidebar:first-child {
+ margin-right: 20px;
+ }
+ .sidebar:last-child {
+ margin-left: 20px;
+ }
+ .sidebar-item {
+ width: 100%;
+ flex-shrink: 1;
+ height: ${toolbarItemHeight}px;
+ background-color: transparent;
+ color: currentColor;
+ box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .025),
+ inset 0 -1px 0 0 rgba(0, 0, 0, .4);
+ }
+ .sidebar-item.is-active {
+ background-color: rgba(0, 0, 0, .5);
+ color: #FFF;
+ box-shadow: inset 0 1px 0 0 rgba(0, 0, 0, .4),
+ inset 0 -1px 0 0 rgba(255, 255, 255, .085);
+ }
+ .sidebar-button {
+ overflow: hidden;
+ cursor: pointer;
+ }
+ .sidebar > *:first-child {
+ border-radius: 4px 0 0 4px;
+ }
+ .sidebar > *:last-child {
+ border-radius: 0 4px 4px 0;
+ }
+ .sidebar > *:first-child:last-child {
+ border-radius: 4px;
+ }
+ .sidebar-button:not(:first-child) {
+ border-left: 1px solid ${blackColor};
+ }
+ .sidebar-button:not(.is-active):hover {
+ color: rgba(255,255,255,.85);
+ background-color: rgba(255,255,255,.1);
+ }
+ @keyframes focus {
+ from {
+ box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25),
+ inset 0 0 0 0 rgba(255, 255, 255, .25);
+ }
+ }
+ .sidebar-button:focus {
+ outline: none;
+ animation: focus 1s linear forwards;
+ }
+ .sidebar-button svg {
+ width: 100%;
+ height: 100%;
+ }
+ .speed-button {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ text-align: center;
+ }
+ .mm {
+ width: calc(100% - ${sideBarWidth * 2}px + 20px);
+ height: ${toolbarItemHeight}px;
+ background-color: rgba(0, 0, 0, .25);
+ border-radius: 4px;
+ box-shadow: inset 0 1px 0 0 rgba(0, 0, 0, .4),
+ inset 0 -1px 0 0 rgba(255, 255, 255, .085);
+ }
+ .ruller-bg {
+ background-repeat: repeat-x;
+ background-position: left bottom 0px;
+ background-image: linear-gradient(
+ to right, ${whiteAlpha1Color} 1px, transparent 1px
+ );
+ background-size: ${msToEm(500)} 100%;
+ }
+ .scrubber {
+ -webkit-appearance: none;
+ position: absolute;
+
+ width: calc(100% + ${thumbWidth}px);
+ margin-left: -${thumbWidth / 2}px;
+
+ background: transparent;
+ cursor: col-resize;
+ }
+ .time-scrubber {
+ z-index: 1;
+ top: 0;
+ }
+ .min-scrubber,
+ .max-scrubber {
+ z-index: 2;
+ top: 0;
+ }
+ .scrubber:focus {
+ outline: none;
+ }
+ .scrubber::-webkit-slider-runnable-track {
+ -webkit-appearance: none;
+ }
+ .scrubber.time-scrubber::-webkit-slider-runnable-track {
+ z-index: 99;
+ height: ${tlScrubberHeight}px;
+ border-radius: 10px;
+ }
+ .scrubber.min-scrubber::-webkit-slider-runnable-track,
+ .scrubber.max-scrubber::-webkit-slider-runnable-track {
+ z-index: 1;
+ height: 0px;
+ background-color: red;
+ }
+ .scrubber::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ cursor: col-resize;
+ width: ${thumbWidth}px;
+ }
+ .scrubber.time-scrubber::-webkit-slider-thumb {
+ z-index: 1;
+ height: var(--anime-gui-tl-height);
+ background-color: transparent;
+ background-image: linear-gradient(
+ 90deg,
+ rgba(27,26,26,0.00) 25%, #1B1A1A 25.5%,
+ #1B1A1A 37.5%, #FFFFFF 38%,
+ #FFFFFF 62%, #1B1A1A 62.5%,
+ #1B1A1A 74.5%, rgba(27,26,26,0.00) 75%
+ );
+ }
+ .is-playing .scrubber.time-scrubber::-webkit-slider-thumb {
+ pointer-events: none;
+ }
+ .scrubber.min-scrubber::-webkit-slider-thumb,
+ .scrubber.max-scrubber::-webkit-slider-thumb,
+ .mm-box:before,
+ .mm-box:after {
+ z-index: 2;
+ position: relative;
+ height: ${tlScrubberHeight}px;
+ height: var(--anime-gui-tl-height);
+ background-color: ${whiteAlpha2Color};
+ filter: saturate(2);
+ backdrop-filter: blur(8px);
+ cursor: ew-resize;
+ }
+ .scrubber.min-scrubber::-webkit-slider-thumb:hover,
+ .scrubber.max-scrubber::-webkit-slider-thumb:hover {
+ background-color: ${whiteAlpha3Color};
+ }
+ .scrubber.min-scrubber::-webkit-slider-thumb {
+ transform: translateX(calc(-${thumbWidth / 2}px - 2px));
+ border-radius: 4px 0 0 4px;
+ }
+ .scrubber.max-scrubber::-webkit-slider-thumb {
+ transform: translateX(calc(${thumbWidth / 2}px + 2px));
+ border-radius: 0 4px 4px 0;
+ }
+ .mm-tl {
+ overflow: hidden;
+ width: 100%;
+ height: calc(100% - 6px);
+ margin-top: 3px;
+ }
+ .mm-tl-scroll {
+ flex-direction: column;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ }
+ .mm-tl-line {
+ height: 100%;
+ max-height: 4px;
+ flex-shrink: 1;
+ background-color: currentColor;
+ box-shadow: 0 0 0 .25px currentColor;
+ border-radius: 4px;
+ }
+ .mm-box {
+ pointer-events: none;
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ }
+ .mm-box:before,
+ .mm-box:after {
+ content: "";
+ display: block;
+ position: absolute;
+ z-index: 1;
+ left: 0;
+ right: 0;
+ height: 2px;
+ }
+ .mm-box:before { top: 0; }
+ .mm-box:after { bottom: 0; }
+ .mm-scrubber .scrubber.time-scrubber {
+ height: ${toolbarItemHeight - 6}px;
+ margin-top: 3px;
+ }
+ .mm-scrubber {
+ width: 100%;
+ }
+ .mm-scrubber .scrubber.time-scrubber::-webkit-slider-thumb {
+ height: ${toolbarItemHeight - 6}px;
+ margin-top: -7px;
+ }
+ .mm-scrubber .scrubber.min-scrubber::-webkit-slider-thumb,
+ .mm-scrubber .scrubber.max-scrubber::-webkit-slider-thumb {
+ height: ${toolbarItemHeight}px;
+ }
+ .wrapper:not(.is-clamped) .min-scrubber,
+ .wrapper:not(.is-clamped) .max-scrubber,
+ .wrapper:not(.is-clamped) .mm-box {
+ display: none;
+ }
+ .tl {
+ flex-direction: column;
+ left: ${sideBarWidth}px;
+ padding-right: ${sideBarWidth}px;
+ color: ${whiteColor};
+ backface-visibility: hidden;
+ font-size: 40px;
+ }
+ .tl-scrubber {
+ position: sticky;
+ z-index: 3;
+ top: 0;
+ align-items: flex-start;
+ height: ${tlScrubberHeight}px;
+ }
+ .clock {
+ width: 140px;
+ flex-shrink: 0;
+ justify-content: flex-end;
+ align-items: center;
+ padding: 10px;
+ align-items: center;
+ }
+ .current-time {
+ justify-content: flex-end;
+ position: absolute;
+ left: 14px;
+ top: 9px;
+ width: 6ch;
+ font-size: 16px;
+ font-weight: bold;
+ letter-spacing: 1px;
+ text-align: right;
+ }
+ .current-time-shadow {
+ opacity: .2;
+ }
+ .total-time {
+ position: absolute;
+ left: 67px;
+ top: 9px;
+ font-size: 16px;
+ font-weight: 300;
+ letter-spacing: 0.5px;
+ text-align: left;
+ }
+ .total-duration {
+ opacity: .75;
+ margin-top: 4px;
+ margin-left: 3px;
+ font-weight: bold;
+ font-size: 8px;
+ letter-spacing: 0.5px;
+ line-height: 6px;
+ border-left: 1px solid currentColor;
+ padding-left: 4px;
+ }
+ .progress-circle {
+ opacity: .7;
+ width: 14px;
+ height: 14px;
+ margin-left: 10px;
+ }
+ .time-ruller {
+ overflow: hidden;
+ pointer-events: none;
+ align-items: center;
+ justify-content: flex-start;
+ position: absolute;
+ top: 0;
+ left: 0;
+ height: ${tlScrubberHeight}px;
+ color: ${whiteAlpha3Color};
+ background-color: ${blackColor}AA;
+ backdrop-filter: blur(8px);
+ }
+ .time-ruller-digit {
+ justify-content: flex-start;
+ width: ${msToEm(500)};
+ height: ${tlScrubberHeight}px;
+ padding-left: 4px;
+ text-align: center;
+ }
+ .time-ruller-digit span {
+ font-weight: bold;
+ font-size: 10px;
+ margin-top: 2px;
+ }
+ .timeline-block {
+ flex-direction: column;
+ }
+ .animation-block {
+ flex-direction: column;
+ }
+ .iterations-block {
+ flex-direction: row;
+ align-items: flex-start;
+ }
+ .iteration-block {
+ flex-direction: column;
+ }
+ .iteration-block.is-reversed {
+ transform: scaleX(-1);
+ }
+ .iteration-block.is-reversed .label-block {
+ transform: scaleX(-1);
+ }
+ .iteration-block.is-reversed .iteration-label {
+ right: 0;
+ transform: translateX(100%);
+ }
+ .line-block {
+ height: ${tlLineHeight}px;
+ margin-top: 1px;
+ margin-bottom: 1px;
+ opacity: .87;
+ cursor: pointer;
+ }
+ .line-block:hover {
+ opacity: 1;
+ filter: saturate(1.2);
+ }
+ .line-block:before {
+ content: "";
+ display: block;
+ position: absolute;
+ left: 0;
+ top: -1px;
+ right: 0;
+ bottom: -1px;
+ background-color: transparent;
+ }
+ .iteration-line-block {
+ border-radius: 4px;
+ background-color: currentColor;
+ }
+ .iteration-background-block {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: ${blackAlpha1Color};
+ border-radius: 3px;
+ }
+ .iteration-delay-block {
+ border-radius: 3px 0 0 3px;
+ }
+ .iteration-duration-block {
+ justify-content: space-between;
+ background-color: currentColor;
+ border-radius: 3px;
+ }
+ .iteration-endDelay-block {
+ border-radius: 0 3px 3px 0;
+ }
+ .tween-line-block {
+ border-radius: ${tlLineHeight / 2}px;
+ }
+ .tween-block {
+ background-color: currentColor;
+ border-radius: ${tlLineHeight / 2}px;
+ }
+ .tween-block-item {
+ height: ${tlLineHeight}px;
+ }
+ .tween-background-block {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: ${blackAlpha1Color};
+ border-radius: ${tlLineHeight / 2}px;
+ }
+ .tween-duration-block {
+ overflow: hidden;
+ justify-content: space-between;
+ background-color: currentColor;
+ border-radius: ${tlLineHeight / 2}px;
+ }
+ .tween-skipped-duration-block {
+ position: absolute;
+ top: 0;
+ right: 0;
+ border-radius: 0px 7px 7px 0px;
+ background-image: linear-gradient(
+ 45deg,
+ transparent 25%, ${blackAlpha2Color} 25%, ${blackAlpha2Color} 50%,
+ transparent 50%, transparent 75%, ${blackAlpha2Color} 75%,
+ ${blackAlpha2Color} 100%
+ );
+ background-size: 3px 3px;
+ }
+ .label-block {
+ pointer-events: none;
+ z-index: 1;
+ align-items: center;
+ height: 100%;
+ margin-top: 0px;
+ padding-left: 4px;
+ padding-right: 4px;
+ font-size: 10px;
+ font-weight: bold;
+ letter-spacing: .05em;
+ white-space: pre;
+ }
+ .tl-label-block {
+ pointer-events: auto;
+ position: absolute;
+ z-index: 1;
+ top: 0px;
+ height: 100%;
+ background-color: ${colors[0]}77;
+ backdrop-filter: blur(8px);
+ cursor: pointer;
+ }
+ .tl-label-block:after {
+ pointer-events: none;
+ content: "";
+ display: block;
+ position: absolute;
+ top: 0px;
+ left: -1px;
+ width: 0px;
+ height: var(--anime-gui-tl-height);
+ border-left: 1px dotted ${colors[0]}77;
+ }
+ .tl-label-block .label-block {
+ color: ${whiteAlpha3Color};
+ }
+ .tl-label-block:hover .label-block {
+ color: ${whiteColor};
+ }
+ .tween-line-block .label-block {
+ opacity: 0;
+ }
+ .tween-block-item > .label-block {
+ color: ${blackColor};
+ }
+ .iteration-line-block > .label-block,
+ .tween-block > .label-block {
+ opacity: .4;
+ position: absolute;
+ left: 0;
+ top: 0;
+ color: currentColor;
+ transform: translateX(calc(-100% + 4px));
+ }
+ .iterations-block:first-child:hover > .iteration-block-item > .iteration-line-block .label-block,
+ .animation-block:hover > .iterations-block:first-child .tween-line-block:hover .label-block,
+ .tween-line-block:hover .label-block {
+ opacity: 1!important;
+ transition-duration: 0s;
+ }
+ .iteration-block:before {
+ content: "";
+ position: absolute;
+ opacity: 0;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ background-color: currentColor;
+ transition: opacity .25s ease-out;
+ }
+ .is-highlighted {
+ filter: brightness(2);
+ }
+ .highlight {
+ opacity: 0;
+ position: absolute;
+ zIndex: 9999;
+ box-shadow: 0 0 0 1px #0008, 0 0 0 3px currentColor, 0 0 0 4px #0008;
+ border-radius: 2px;
+ }
+ .highlight:before {
+ content: "";
+ opacity: .25;
+ display: block;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ zIndex: 9999;
+ border-radius: 3px;
+ background-color: currentColor;
+ }
+`;
+
+const dom = initDOM();
+const targetsIdMap = new Map();
+const idsTargetMap = new Map();
+
+let targetId = 0;
+
+function registerTarget($target) {
+ const id = targetsIdMap.get($target);
+ if (id !== undefined) {
+ return id;
+ } else {
+ targetsIdMap.set($target, ++targetId);
+ idsTargetMap.set(targetId, $target);
+ return targetId;
+ }
+}
+
+function highlightTarget(targetId, color) {
+ const $target = idsTargetMap.get(targetId);
+ if (!$target) return;
+ const { left, top, width, height } = $target.getBoundingClientRect();
+ if (width + height === 0) return;
+ let $highlight = utils.$(`.${prefix}highlight.${prefix}${targetId}`)[0];
+ if (!$highlight) {
+ $highlight = createBlock(['highlight', targetId]);
+ document.body.appendChild($highlight);
+ }
+ utils.set($highlight, { left, top, width, height, opacity: 1, color: color });
+}
+
+function clearHighlight() {
+ utils.$(`.${prefix}highlight`).forEach($highlight => $highlight.remove());
+}
+
+function createLabel(text, css) {
+ const el = createBlock('label-block', css);
+ el.innerHTML = text;
+ return el;
+}
+
+/**
+ * @param {Tween} tween
+ * @param {Target} previousTweenEl
+ * @param {HTMLElement} animationEl
+ * @param {Boolean} isFirstIteration
+ * @return {Target|HTMLElement}
+ */
+function createTweenBlock(tween, previousTweenEl, animationEl, isFirstIteration) {
+ const el = createBlock(['line-block', 'tween-line-block']);
+ const tweenEl = createBlock(['tween-block']);
+ const backgroundEl = createBlock(['tween-background-block']);
+ const delayEl = createBlock(['tween-delay-block', 'tween-block-item']);
+ const durationEl = createBlock(['tween-duration-block', 'tween-block-item']);
+ const skippedDurationEl = createBlock(['tween-skipped-duration-block', 'tween-block-item']);
+ const fromValueLabelEl = createLabel(tween._fromNumbers ? tween._fromNumbers[0] : tween._fromNumber, `padding-right: 1px;`);
+ const fromToLabelEl = createLabel(tween._toNumbers ? tween._toNumbers[0] : tween._toNumber, `padding-left: 1px;`);
+ tweenEl.setAttribute('data-tween', `${tween.id}`);
+ if (tween._prevRep) tweenEl.setAttribute('data-previous-tween', `${tween._prevRep.id}`);
+ if (tween._nextRep) tweenEl.setAttribute('data-next-tween', `${tween._nextRep.id}`);
+ if (tween._isOverridden) tweenEl.style.opacity = `${.5}`;
+ durationEl.appendChild(fromValueLabelEl);
+ if (parameters.showTweenId) durationEl.appendChild(createLabel(tween.id, `justify-content: center; position: absolute; left: 0; right: 0; text-align: center;`));
+ durationEl.appendChild(fromToLabelEl);
+ tweenEl.appendChild(backgroundEl);
+ // const tweenDelay = (tween.parent._offset + tween._startTime) - tween._absoluteStartTime;
+ const tweenDelay = tween._delay;
+ if (tweenDelay || tween.parent._delay) {
+ delayEl.style.width = msToEm(previousTweenEl ? tweenDelay : tween.parent._delay + tweenDelay);
+ tweenEl.appendChild(delayEl);
+ }
+ // if (tween._changeDuration) {
+ durationEl.style.width = msToEm(tween._updateDuration);
+ if (tween._updateDuration <= minValue) {
+ durationEl.style.width = msToEm(10);
+ }
+ skippedDurationEl.style.width = msToEm(tween._updateDuration - tween._changeDuration);
+ durationEl.appendChild(skippedDurationEl);
+ tweenEl.appendChild(durationEl);
+ // }
+ if (!previousTweenEl) {
+ if (isFirstIteration) {
+ const propertyLabelEl = createLabel(tween.property + '—');
+ tweenEl.appendChild(propertyLabelEl);
+ }
+ el.appendChild(tweenEl);
+ return el;
+ } else {
+ previousTweenEl.appendChild(tweenEl);
+ return previousTweenEl;
+ }
+}
+
+function createTimelineLabel(labels, name, tlOffset) {
+ const startTime = tlOffset + labels[name];
+ const el = createBlock('tl-label-block', `left: ${msToEm(startTime)};`);
+ el.dataset.startTime = startTime;
+ el.appendChild(createLabel(name));
+ return el;
+}
+
+/**
+ * @param {Timer&Timeline&Animation} animation
+ * @param {Number} i
+ * @param {HTMLElement} iterationsEl
+ * @param {String} color
+ * @param {HTMLElement} $tlScrubber
+ * @return {HTMLElement}
+ */
+function createIterationBlock(animation, i, iterationsEl, color, $tlScrubber) {
+ const { _reversed, _alternate, _delay, _loopDelay, iterationDuration, _offset, labels } = animation;
+ const isFirstIteration = !i;
+ // const isOdd = i % 2;
+ // const isInverted = _direction > 0 && (_direction === 1 || _direction === 2 && isOdd || _direction === 3 && !isOdd);
+ const isOdd = i % 2;
+ // const isInverted = ~~(_direction === -1 || _direction === 2 && isOdd || _direction === -2 && !isOdd);
+ const isReversed = _reversed ^ (_alternate && isOdd);
+ const iterationEl = createBlock(['iteration-block', 'iteration-block-item']);
+ const iterationLineEl = createBlock(['line-block', 'iteration-line-block']);
+ const backgroundEl = createBlock(['iteration-background-block']);
+ const delayEl = createBlock(['iteration-delay-block', 'iteration-block-item']);
+ const durationEl = createBlock(['iteration-duration-block', 'iteration-block-item']);
+ const loopDelayEl = createBlock(['iteration-loopDelay-block', 'iteration-block-item']);
+ iterationLineEl.appendChild(backgroundEl);
+ if (isFirstIteration) {
+ const labelPrefix = isNaN(+animation.id) ? '' : animation._hasChildren ? 'Timeline ' : 'Animation ';
+ const labelEl = createLabel(labelPrefix + animation.id + '—');
+ iterationLineEl.appendChild(labelEl);
+ }
+ if (_delay) {
+ delayEl.style.width = msToEm(_delay);
+ iterationLineEl.appendChild(delayEl);
+ }
+ const isSet = iterationDuration <= minValue;
+ // TODO: REMOVE?
+ if (iterationDuration === Infinity || iterationDuration === maxValue) {
+ // durationEl.style.width = msToEm(iterationDuration);
+ durationEl.appendChild(createLabel('∞', `
+ font-size: 16px;
+ margin-left: auto;
+ margin-right: auto;
+ `));
+ } else if (isSet) {
+ durationEl.style.width = msToEm(10);
+ } else {
+ durationEl.style.width = msToEm(iterationDuration);
+ }
+ iterationLineEl.appendChild(durationEl);
+ if (_loopDelay) {
+ loopDelayEl.style.width = msToEm(_loopDelay);
+ iterationLineEl.appendChild(loopDelayEl);
+ }
+
+ if (isSet) {
+ iterationEl.style.width = msToEm(10);
+ } else {
+ iterationEl.style.width = msToEm(animation.iterationDuration + animation._loopDelay);
+ }
+
+ // if (!animation._hasChildren) {
+ // iterationEl.appendChild(iterationLineEl);
+ // }
+
+ iterationEl.appendChild(iterationLineEl);
+
+ if (isReversed) {
+ iterationEl.classList.add(`${prefix}is-reversed`);
+ }
+
+ if (!animation._hasChildren) {
+ let currentTarget;
+ let currentProperty;
+ let previousTargetTweenEl;
+ forEachChildren(animation, tween => {
+ const target = tween.target;
+ const property = tween.property;
+ let hasPreviousTween = (property === currentProperty && currentTarget === target);
+ if (currentTarget !== target) {
+ currentTarget = target;
+ }
+ const tweenBLockEl = createTweenBlock(tween, hasPreviousTween ? previousTargetTweenEl : false, iterationsEl, isFirstIteration);
+ previousTargetTweenEl = tweenBLockEl;
+ currentProperty = property;
+ tweenBLockEl.dataset.color = color;
+ tweenBLockEl.dataset.targetId = registerTarget(target);
+ iterationEl.appendChild(tweenBLockEl);
+ });
+ }
+
+ if (labels) {
+ for (let name in labels) {
+ const timelineLabelEl = createTimelineLabel(labels, name, _offset);
+ $tlScrubber.appendChild(timelineLabelEl);
+ }
+ }
+
+ return iterationEl;
+}
+
+/**
+ * @param {Timer&Timeline&Animation} animation
+ * @param {String} color
+ * @return {HTMLElement}
+ */
+function createIterationsBlock(animation, color) {
+ const { $tlScrubber } = dom;
+ const $el = createBlock('iterations-block');
+ // const iterationCount = 1;
+ const iterationCount = animation.iterationCount === Infinity ? 1 : animation.iterationCount;
+ const visualOffsetMs = animation._offset;
+ for (let i = 0; i < iterationCount; i++) {
+ const iterationEl = createIterationBlock(animation, i, $el, color, $tlScrubber);
+ if (animation._hasChildren) {
+ forEachChildren(animation, child => {
+ // Do not display tl.set() animations
+ // if (child.duration > 1) {
+ const childAnimationEl = createAnimationBlock(child);
+ childAnimationEl.style.marginLeft = msToEm(-visualOffsetMs);
+ iterationEl.appendChild(childAnimationEl);
+ // }
+ });
+ }
+ $el.appendChild(iterationEl);
+ }
+ $el.style.marginLeft = msToEm(visualOffsetMs);
+ $el.dataset.startTime = visualOffsetMs;
+ $el.dataset.endTime = visualOffsetMs + animation.duration;
+ $el.dataset.color = color;
+ return $el;
+}
+
+function createAnimationBlock(animation) {
+ const color = getColor(animation.id);
+ const el = createBlock('animation-block', `color: ${color};`);
+ const iterationsBLockEl = createIterationsBlock(animation, color);
+ el.setAttribute('data-animation', animation.id);
+ el.appendChild(iterationsBLockEl);
+ return el;
+}
+
+function clearHighlightTweens() {
+ const $tweens = dom.$wrapper.querySelectorAll(`.${prefix}tween-block`);
+ for (let i = 0, l = $tweens.length; i < l; i++) {
+ $tweens[i].classList.remove(`${prefix}is-highlighted`);
+ }
+}
+
+function highlightSiblings($tween) {
+ clearHighlightTweens();
+ const nextId = $tween.getAttribute('data-next-tween');
+ const prevId = $tween.getAttribute('data-previous-tween');
+ if (nextId) {
+ const $nextTween = dom.$wrapper.querySelector(`.${prefix}tween-block[data-tween="${nextId}"]`);
+ if ($nextTween) $nextTween.classList.add(`${prefix}is-highlighted`);
+ }
+ if (prevId) {
+ const $prevTween = dom.$wrapper.querySelector(`.${prefix}tween-block[data-tween="${prevId}"]`);
+ if ($prevTween) $prevTween.classList.add(`${prefix}is-highlighted`);
+ }
+}
+
+function updateCurrentTimeParam() {
+ const activeInstance = getActiveInstance();
+ setParameter('time', utils.round(activeInstance.currentTime, 0));
+}
+
+function generateScrubberTL(progressAnimation) {
+ const activeInstance = getActiveInstance();
+ const { duration } = activeInstance;
+ const { clamped } = parameters;
+ const scrubberDuration = clamped ? parameters.endTime - parameters.startTime : duration;
+ const scrubberStart = clamped ? parameters.startTime : 0;
+ const scrubberEnd = clamped ? parameters.endTime : duration;
+ const minProgress = clamped ? scrubberStart / duration : 0;
+ const maxProgress = clamped ? scrubberEnd / duration : 1;
+
+ const tl = createTimeline({
+ autoplay: false,
+ onBegin: () => setPlaybackStatus(false),
+ onComplete: () => setPlaybackStatus(true),
+ playbackRate: parameters.speed,
+ loop: parameters.loop,
+ defaults: {
+ duration: scrubberDuration,
+ ease: 'linear',
+ },
+ })
+ .add({
+ frameRate: 1,
+ duration: scrubberDuration,
+ onUpdate: updateCurrentTimeParam,
+ }, 0)
+ .add([activeInstance, progressAnimation], {
+ progress: [minProgress, maxProgress],
+ // onUpdate: () => {
+ // console.log(activeInstance.progress, progressAnimation.progress);
+ // }
+ }, 0)
+ .add(`.${prefix}time-scrubber`, {
+ value: [minProgress, maxProgress],
+ }, 0)
+ .add(dom.$currentTime, {
+ innerHTML: [scrubberStart, scrubberEnd],
+ modifier: utils.round(0)
+ }, 0)
+ .add(dom.$currentTimeShadow, {
+ innerHTML: [scrubberStart, scrubberEnd],
+ modifier: utils.round(0).padStart(6, '0')
+ }, 0);
+
+ return tl.seek(parameters.time);
+}
+
+function createMMMap($tlBlock, duration, loopDelay) {
+ const $map = createBlock('mm-tl');
+ const $tlIterationsBlock = $tlBlock.querySelector(`:scope > .${prefix}iterations-block`);
+ const $tlIterationBlocks = $tlIterationsBlock.querySelectorAll(`:scope > .${prefix}iteration-block`);
+ const totalIterations = $tlIterationBlocks.length;
+ const iterationTotalDuration = (duration + loopDelay) / totalIterations;
+ const loopDelayScale = iterationTotalDuration / (duration / totalIterations) * 100;
+ const iterationLoopDelayPercent = (loopDelay * totalIterations) / (duration + loopDelay);
+ const iterationDurationPercent = 1 - iterationLoopDelayPercent;
+
+ $tlIterationBlocks.forEach(($iterationBlock, i) => {
+ const $tlIterationsBlocks = $iterationBlock.querySelectorAll(`.${prefix}iterations-block`);
+ const isReversed = $iterationBlock.classList.contains(`${prefix}is-reversed`);
+ const $mmScroll = createBlock('mm-tl-scroll', `
+ width: ${((iterationDurationPercent / totalIterations) * loopDelayScale)}%;
+ margin-right: ${ totalIterations - 1 === i ? 0 : ((iterationLoopDelayPercent / totalIterations) * loopDelayScale)}%;
+ transform: scaleX(${isReversed ? -1 : 1});
+ `);
+ const $iterationEl = createBlock('mm-tl-line', `
+ left: 0%;
+ width: 100%;
+ color: ${$tlIterationsBlock.dataset.color};
+ `);
+ $mmScroll.appendChild($iterationEl);
+ $tlIterationsBlocks.forEach($block => {
+ const startTime = ((+$block.dataset.startTime / (duration - (loopDelay * (totalIterations - 1)))) * totalIterations) * 100;
+ const endTime = ((+$block.dataset.endTime / (duration - (loopDelay * (totalIterations - 1)))) * totalIterations) * 100;
+ const $el = createBlock('mm-tl-line', `
+ left: ${startTime}%;
+ width: ${(endTime - startTime)}%;
+ color: ${$block.dataset.color};
+ `);
+ $mmScroll.appendChild($el);
+ });
+ $map.appendChild($mmScroll);
+ });
+ return $map;
+}
+
+function cteateTimeRuller(duration) {
+ const $timeRuller = createBlock(['time-ruller', 'ruller-bg'], `
+ width: ${msToEm(duration)}
+ `);
+
+ for (let i = 0, l = utils.round(duration / 500, 0) + 1; i < l; i++) {
+ const timeRullerDigitEl = createBlock('time-ruller-digit');
+ timeRullerDigitEl.innerHTML = `<span>${i / 2}</span>`;
+ $timeRuller.appendChild(timeRullerDigitEl);
+ }
+
+ return $timeRuller;
+}
+
+function renderTL() {
+ const activeInstance = getActiveInstance();
+ const { $tl, $mmScrubber, $tlScrubber, $totalDuration } = dom;
+ let duration = activeInstance.duration;
+ // TODO: REMOVE?
+ if (duration === maxValue) {
+ duration = activeInstance.iterationDuration;
+ }
+ const $tlBlock = createAnimationBlock(activeInstance);
+ const $timeRuller = cteateTimeRuller(duration);
+ const $mmMap = createMMMap($tlBlock, duration, activeInstance._loopDelay);
+
+ $tlScrubber.appendChild($timeRuller);
+ $tl.appendChild($tlBlock);
+ $mmScrubber.appendChild($mmMap);
+
+ utils.set(`.${prefix}scrubber`, { step: utils.round(1 / duration, 8) });
+ utils.set($tl, { width: `calc(${msToEm(duration)} + ${sideBarWidth}px)` });
+ utils.set($totalDuration, { innerHTML: `${duration}<br>ms` });
+ utils.set(`.${prefix}toggle-button svg`, { rotate: parameters.minified !== false ? 0 : 180 });
+
+ // Events
+
+ const $iterationLines = $tlBlock.querySelectorAll(`.${prefix}iteration-line-block`);
+ const $tweenLines = $tlBlock.querySelectorAll(`.${prefix}tween-line-block`);
+ const $tweens = $tlBlock.querySelectorAll(`.${prefix}tween-block`);
+
+ $iterationLines.forEach($iterationLine => {
+ $iterationLine.onmouseenter = () => {
+ const $tweenLines = $iterationLine.parentNode.querySelectorAll(`.${prefix}tween-line-block`);
+ $tweenLines.forEach($tweenLine => {
+ const iterationColor = utils.get($tweenLine.parentNode, 'color');
+ highlightTarget(+$tweenLine.dataset.targetId, iterationColor);
+ });
+ };
+ $iterationLine.onmouseleave = clearHighlight;
+ });
+
+ $tweenLines.forEach($tweenLine => {
+ const { targetId, color } = $tweenLine.dataset;
+ $tweenLine.onmouseenter = () => highlightTarget(+targetId, color);
+ $tweenLine.onmouseleave = clearHighlight;
+ });
+
+ if (parameters.highlightSiblings) {
+ for (let i = 0, l = $tweens.length; i < l; i++) {
+ const $tween = $tweens[i];
+ $tween.onmouseenter = () => highlightSiblings($tween);
+ $tween.onmouseleave = () => highlightSiblings($tween);
+ }
+ }
+
+ return $tlBlock;
+}
+
+function appendDOM($wrapper) {
+ utils.set(parameters.$container, {
+ '--anime-gui-height': `${parameters.height}px`,
+ '--anime-gui-tl-height': `calc(var(--anime-gui-height) - ${toolbarHeight}px)`,
+ paddingBottom: 'var(--anime-gui-height)',
+ });
+ parameters.$container.appendChild($wrapper);
+}
+
+let wrapperWasOpen;
+
+function setWrapperSize(newH) {
+ const height = utils.clamp(toolbarHeight, window.innerHeight).round(0)(newH);
+ const isOpen = height > toolbarHeight;
+ setParameter('height', height);
+ utils.set(parameters.$container, { '--anime-gui-height': height + 'px' });
+ if (wrapperWasOpen !== isOpen) {
+ animate(`.${prefix}toggle-button svg`, { rotate: !wrapperWasOpen ? 180 : 0, duration: 250 });
+ }
+ wrapperWasOpen = isOpen;
+}
+
+function resizeSrubberRange(duration) {
+ const { startTime, endTime } = parameters;
+ utils.set(dom.$mmBox, {
+ left: `calc(${(startTime / duration) * 100}% - 3px)`,
+ right: `calc(${((duration - endTime) / duration) * 100}% - 3px)`,
+ modifier: utils.round(1),
+ });
+}
+
+function setPlaybackStatus(paused) {
+ const playbackMode = paused ? 'play' : 'pause';
+ const classMode = paused ? 'remove' : 'add';
+ utils.set(`.${prefix}playback-button`, { innerHTML: getIconCode(playbackMode) });
+ document.body.classList[classMode](`${prefix}is-playing`);
+ updateCurrentTimeParam();
+}
+
+function togglePlayback(scrubberTL) {
+ const { paused } = scrubberTL;
+ scrubberTL[paused ? 'play' : 'pause']();
+ setPlaybackStatus(!paused);
+}
+
+function inspect(instance, userParams = {}) {
+ instance.pause();
+ if (instance.iterationCount === Infinity) {
+ instance.iterationCount = 1;
+ instance.duration = instance.iterationDuration;
+ parameters.loop = true;
+ }
+ parseParameters(userParams);
+ instances.push(instance);
+ const { height } = parameters;
+ if (isNil(parameters.endTime)) parameters.endTime = instance.duration;
+ if (isNil(parameters.active)) parameters.active = instances.length - 1;
+ if (isNil(parameters.minified)) parameters.minified = height === toolbarHeight ? false : height;
+ dom.$speedButton.value = parameters.speed;
+
+ appendStyles(styles);
+ appendDOM(dom.$wrapper);
+ renderTL();
+
+ const progressAnimation = animate(svg.createDrawable(`.${prefix}progress-circle path`), {
+ draw: '0 1',
+ ease: 'linear',
+ autoplay: false
+ });
+
+ let scrubberTL = generateScrubberTL(progressAnimation);
+
+ function updateClamp() {
+ const { clamped } = parameters;
+ const { paused } = scrubberTL;
+ const { currentTime } = instance;
+ const className = clamped ? 'add' : 'remove';
+ dom.$clampButton.classList[className](`${prefix}is-active`);
+ dom.$wrapper.classList[className](`${prefix}is-clamped`);
+ scrubberTL.cancel();
+ scrubberTL = generateScrubberTL(progressAnimation);
+ scrubberTL.pause().seek(clamped ? 0 : currentTime);
+ if (!paused) scrubberTL.play();
+ }
+
+ function toggleClamp() {
+ parameters.clamped = !parameters.clamped;
+ setParameter('clamped', parameters.clamped);
+ updateClamp();
+ }
+
+ setPlaybackStatus(scrubberTL.paused);
+ updateClamp();
+
+ function updateTimeScrubberValue(timeValue, duration) {
+ clearHighlight();
+ updateCurrentTimeParam();
+ const minProgress = parameters.clamped ? parameters.startTime / duration : 0;
+ const maxProgress = parameters.clamped ? parameters.endTime / duration : 1;
+ const value = utils.clamp(timeValue, minProgress, maxProgress);
+ utils.set(`.${prefix}time-scrubber`, { value });
+ scrubberTL.completed = false;
+ scrubberTL.progress = utils.mapRange(value, minProgress, maxProgress, 0, 1);
+ }
+
+ function seekToRange(startTime, endTime) {
+ if (parameters.clamped) {
+ setParameter('startTime', startTime);
+ setParameter('endTime', endTime);
+ scrubberTL.cancel();
+ scrubberTL = generateScrubberTL(progressAnimation);
+ createTimeline({ defaults: { duration: 250, ease: 'out(3)', composition: 'add' } })
+ .add(`.${prefix}min-scrubber`, { value: startTime / instance.duration }, 0)
+ .add(`.${prefix}max-scrubber`, { value: endTime / instance.duration }, 0)
+ .add(dom.$mmBox, {
+ left: `calc(${(startTime / instance.duration) * 100}% - 3px)`,
+ right: `calc(${((instance.duration-endTime) / instance.duration) * 100}% - 3px)`,
+ modifier: utils.round(1),
+ }, 0);
+ updateTimeScrubberValue(startTime, instance.duration);
+ resizeSrubberRange(instance.duration);
+ scrubberTL.play();
+ } else {
+ scrubberTL.pause().seek(startTime).play();
+ }
+ }
+
+ const $timeScrubbers = utils.$(`.${prefix}time-scrubber`);
+ const $minScrubbers = utils.$(`.${prefix}min-scrubber`);
+ const $maxScrubbers = utils.$(`.${prefix}max-scrubber`);
+
+ utils.set($timeScrubbers, { value: parameters.time / instance.duration });
+ utils.set($minScrubbers, { value: parameters.startTime / instance.duration });
+ utils.set($maxScrubbers, { value: parameters.endTime / instance.duration });
+
+ resizeSrubberRange(instance.duration);
+
+ $timeScrubbers.forEach($timeScrubber => {
+ $timeScrubber.onmousedown = () => {
+ scrubberTL.pause();
+ setPlaybackStatus(scrubberTL.paused);
+ };
+ $timeScrubber.oninput = () => updateTimeScrubberValue($timeScrubber.value, instance.duration);
+ });
+
+ const onMinScrubberInput = function() {
+ const startTime = utils
+ .clamp(0, parameters.endTime).round(0)
+ (this.value * instance.duration);
+ setParameter('startTime', startTime);
+ scrubberTL.cancel();
+ scrubberTL = generateScrubberTL(progressAnimation);
+ scrubberTL.pause().seek(0);
+ setPlaybackStatus(scrubberTL.paused);
+ utils.set($minScrubbers, { value: startTime / instance.duration });
+ resizeSrubberRange(instance.duration);
+ };
+
+ const onMaxScrubberInput = function() {
+ const endTime = utils
+ .clamp(parameters.startTime, instance.duration).round(0)
+ (this.value * instance.duration);
+ setParameter('endTime', endTime);
+ scrubberTL.cancel();
+ scrubberTL = generateScrubberTL(progressAnimation);
+ scrubberTL.pause().seek(scrubberTL.duration);
+ setPlaybackStatus(scrubberTL.paused);
+ utils.set($maxScrubbers, { value: endTime / instance.duration });
+ resizeSrubberRange(instance.duration);
+ };
+
+ $minScrubbers.forEach($scrubber => $scrubber.oninput = onMinScrubberInput);
+ $maxScrubbers.forEach($scrubber => $scrubber.oninput = onMaxScrubberInput);
+
+ dom.$speedButton.addEventListener('change', () => {
+ const speed = dom.$speedButton.value;
+ setParameter('speed', dom.$speedButton.value);
+ scrubberTL.playbackRate = speed;
+ });
+
+ window.addEventListener('keydown', (e) => {
+ if (e.code === 'Space') {
+ e.preventDefault();
+ togglePlayback(scrubberTL);
+ }
+ if (e.code === 'KeyB') {
+ scrubberTL.progress = 0;
+ }
+ if (e.code === 'KeyR') {
+ scrubberTL.progress = 0;
+ scrubberTL.play();
+ }
+ });
+
+ document.addEventListener('click', (e) => {
+ const $closestIterationsBlock = e.target.closest(`.${prefix}iterations-block`);
+ if ($closestIterationsBlock) {
+ const startTime = utils.round($closestIterationsBlock.dataset.startTime, 0);
+ const endTime = utils.round($closestIterationsBlock.dataset.endTime, 0);
+ seekToRange(startTime, endTime);
+ }
+ const $closestTlLabelBlock = e.target.closest(`.${prefix}tl-label-block`);
+ if ($closestTlLabelBlock) {
+ const $nextSlibling = $closestTlLabelBlock.nextElementSibling ? $closestTlLabelBlock.nextElementSibling.matches(`.${prefix}tl-label-block`) ? $closestTlLabelBlock.nextElementSibling : null : null;
+ const startTime = utils.round($closestTlLabelBlock.dataset.startTime, 0);
+ const endTime = $nextSlibling ? utils.round($nextSlibling.dataset.startTime, 0) : parameters.endTime <= startTime ? instance.duration : parameters.endTime;
+ seekToRange(startTime, endTime);
+ }
+ const $closestToggleButton = e.target.closest(`.${prefix}toggle-button`);
+ if ($closestToggleButton) {
+ const isOpen = parameters.minified === false;
+ createTimeline({
+ onRender: () => setWrapperSize(parameters.height),
+ defaults: { duration: 350, ease: 'out(4)' },
+ })
+ .add(parameters, { height: isOpen ? toolbarHeight : parameters.minified }, 0);
+ setParameter('minified', isOpen ? parameters.height : false);
+ }
+ const $closestPlaybackButton = e.target.closest(`.${prefix}playback-button`);
+ if ($closestPlaybackButton) {
+ togglePlayback(scrubberTL);
+ }
+ const $closestBackButton = e.target.closest(`.${prefix}back-button`);
+ if ($closestBackButton) {
+ scrubberTL.progress = 0;
+ }
+ const $closestClampButton = e.target.closest(`.${prefix}clamp-button`);
+ if ($closestClampButton) {
+ toggleClamp();
+ }
+ });
+
+ dom.$tlWrapper.scrollLeft = parameters.scrollX;
+ dom.$tlWrapper.scrollTop = parameters.scrollY;
+
+ dom.$tlWrapper.addEventListener('scroll', () => {
+ setParameter('scrollX', dom.$tlWrapper.scrollLeft);
+ setParameter('scrollY', dom.$tlWrapper.scrollTop);
+ });
+
+ // Resize
+
+ let startY = 0;
+ let startHeight = window.innerHeight;
+
+ function resizeWrapper(diffY) {
+ const newH = parameters.height + diffY;
+ setWrapperSize(newH);
+ setParameter('minified', newH > toolbarHeight ? false : utils.round(window.innerHeight * .33, 0));
+ }
+
+ function onWrapperResize(e) {
+ const diffY = startY - e.y;
+ resizeWrapper(diffY);
+ startY = e.y;
+ }
+
+ function onWindowResize() {
+ const diffY = window.innerHeight - startHeight;
+ resizeWrapper(diffY);
+ startHeight = window.innerHeight;
+ }
+
+ dom.$resizer.addEventListener('mousedown', e => {
+ startY = e.y;
+ document.addEventListener('mousemove', onWrapperResize, false);
+ }, false);
+
+ dom.$mmScrubber.addEventListener('wheel', e => {
+ e.preventDefault();
+ const speed = instance.duration / scrubberTL.duration / 10000;
+ scrubberTL.progress += e.deltaY * speed;
+ scrubberTL.progress += e.deltaX * -speed;
+ }, {passive: false});
+
+ document.addEventListener('mouseup', () => {
+ document.removeEventListener('mousemove', onWrapperResize, false);
+ }, false);
+
+ window.onresize = onWindowResize;
+
+ // Play if the active instance has autplay defined
+
+ scrubberTL[instance._autoplay ? 'play' : 'pause']();
+
+}
+
+export { inspect };
diff --git a/package.json b/package.json
index 2bde3c6d..90e08bc8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "animejs",
- "version": "4.0.2",
+ "version": "4.1.0",
"homepage": "https://animejs.com",
"repository": {
"type": "git",
diff --git a/rollup.config.js b/rollup.config.js
index 6d331d30..f654e59b 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -3,10 +3,8 @@ import filesize from 'rollup-plugin-filesize';
import ts from 'rollup-plugin-ts';
import pkg from './package.json' assert { type: 'json' };
import fs from 'fs';
-import path from 'path';
const inputPath = 'src/anime.js';
-// const inputPathGUI = 'src/gui/gui.js';
const outputName = 'anime';
const jsDocTypes = fs.readFileSync('./src/types.js', 'utf-8').split('/* Exports */')[1];
@@ -28,24 +26,6 @@ const banner = (format, addTypes) => {
`
}
-/**
- * @param {String} format
- * @param {Boolean} [addTypes]
- * @return {String}
- */
-const GUIBanner = (format, addTypes) => {
- const date = new Date();
- return `/**
- * anime.js GUI - ${ format }
- * @version v${ pkg.version }
- * @author Julian Garnier
- * @license MIT
- * @copyright (c) ${ date.getFullYear() } Julian Garnier
- * @see https://animejs.com
- */${addTypes ? jsDocTypes : ''}
-`
-}
-
const terserModuleOptions = {
compress: {
passes: 10,
@@ -79,13 +59,6 @@ const cleanupOptions = {
const cleanup = {
name: 'cleanup',
generateBundle(_, bundle) {
- if (process.env.release) {
- const guiPath = path.resolve('./lib/gui');
- if (fs.existsSync(guiPath)) {
- fs.rmSync(guiPath, { recursive: true, force: true });
- console.log('Removed GUI folder from lib directory in release mode');
- }
- }
Object.keys(bundle).forEach((fileName) => {
const file = bundle[fileName];
let code = file.code;
@@ -119,16 +92,6 @@ tasks.push( // ESM
},
);
-// if (!process.env.release) {
-// tasks.push( // GUI ESM
-// {
-// input: inputPathGUI,
-// output: { file: 'lib/gui/index.js', format: 'esm', banner: GUIBanner('ESM', true) },
-// plugins: [prependTypes, cleanup]
-// },
-// );
-// }
-
if (process.env.types) {
tasks.push( // TYPES
{
diff --git a/src/animatable.js b/src/animatable.js
index dff8c7ea..d1f57839 100644
--- a/src/animatable.js
+++ b/src/animatable.js
@@ -6,7 +6,7 @@ import {
} from './consts.js';
import {
- globals,
+ scope,
} from './globals.js';
import {
@@ -33,7 +33,7 @@ export class Animatable {
* @param {AnimatableParams} parameters
*/
constructor(targets, parameters) {
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
/** @type {AnimationParams} */
const globalParams = {};
const properties = {};
diff --git a/src/animation.js b/src/animation.js
index a0c83fdd..46f01f2c 100644
--- a/src/animation.js
+++ b/src/animation.js
@@ -694,12 +694,13 @@ export class JSAnimation extends Timer {
*/
refresh() {
forEachChildren(this, (/** @type {Tween} */tween) => {
- const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
- decomposeRawValue(ogValue, decomposedOriginalValue);
- tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
- tween._fromNumber = decomposedOriginalValue.n;
- if (tween._func) {
- decomposeRawValue(tween._func(), toTargetObject);
+ const tweenFunc = tween._func;
+ if (tweenFunc) {
+ const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
+ decomposeRawValue(ogValue, decomposedOriginalValue);
+ decomposeRawValue(tweenFunc(), toTargetObject);
+ tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
+ tween._fromNumber = decomposedOriginalValue.n;
tween._toNumbers = cloneArray(toTargetObject.d);
tween._strings = cloneArray(toTargetObject.s);
tween._toNumber = toTargetObject.n;
diff --git a/src/anime.js b/src/anime.js
index 6b908bda..9597ae87 100644
--- a/src/anime.js
+++ b/src/anime.js
@@ -10,5 +10,6 @@ export { createSpring, Spring } from './spring.js';
export { waapi, WAAPIAnimation } from './waapi.js';
export { utils } from './utils.js';
export { svg } from './svg.js';
+export { text, TextSplitter } from './text.js';
export { stagger } from './stagger.js';
export { eases } from './eases.js';
\ No newline at end of file
diff --git a/src/consts.js b/src/consts.js
index 3e7e20bc..e682ceb8 100644
--- a/src/consts.js
+++ b/src/consts.js
@@ -61,11 +61,13 @@ export const maxFps = 120;
// Strings
export const emptyString = '';
-export const shortTransforms = new Map();
-
-shortTransforms.set('x', 'translateX');
-shortTransforms.set('y', 'translateY');
-shortTransforms.set('z', 'translateZ');
+export const shortTransforms = /*#__PURE__*/ (() => {
+ const map = new Map();
+ map.set('x', 'translateX');
+ map.set('y', 'translateY');
+ map.set('z', 'translateZ');
+ return map;
+})();
export const validTransforms = [
'translateX',
@@ -87,7 +89,7 @@ export const validTransforms = [
'matrix3d',
];
-export const transformsFragmentStrings = validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});
+export const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({...a, [v]: v + '('}), {});
// Functions
diff --git a/src/draggable.js b/src/draggable.js
index 872d26cb..4ce34c76 100644
--- a/src/draggable.js
+++ b/src/draggable.js
@@ -1,6 +1,7 @@
/// <reference path='./types.js' />
import {
+ scope,
globals,
} from './globals.js';
@@ -194,7 +195,7 @@ export class Draggable {
*/
constructor(target, parameters = {}) {
if (!target) return;
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const paramX = parameters.x;
const paramY = parameters.y;
const trigger = parameters.trigger;
diff --git a/src/engine.js b/src/engine.js
index dde8dbc0..c676bf53 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -29,8 +29,8 @@ import {
tick,
} from './render.js';
-export const engineTickMethod = isBrowser ? requestAnimationFrame : setImmediate;
-export const engineCancelMethod = isBrowser ? cancelAnimationFrame : clearImmediate;
+export const engineTickMethod = /*#__PURE__*/ (() => isBrowser ? requestAnimationFrame : setImmediate)();
+export const engineCancelMethod = /*#__PURE__*/ (() => isBrowser ? cancelAnimationFrame : clearImmediate)();
export class Engine extends Clock {
diff --git a/src/globals.js b/src/globals.js
index 6b0b7056..fd8c9fe9 100644
--- a/src/globals.js
+++ b/src/globals.js
@@ -36,13 +36,16 @@ export const defaults = {
onRender: noop,
}
+export const scope = {
+ /** @type {Scope} */
+ current: null,
+ /** @type {Document|DOMTarget} */
+ root: doc,
+}
+
export const globals = {
/** @type {DefaultsParams} */
defaults,
- /** @type {Document|DOMTarget} */
- root: doc,
- /** @type {Scope} */
- scope: null,
/** @type {Number} */
precision: 4,
/** @type {Number} */
diff --git a/src/helpers.js b/src/helpers.js
index e3e9c3e0..99705d1d 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -4,6 +4,7 @@ import {
hexTestRgx,
maxValue,
minValue,
+ noop,
} from './consts.js';
import {
@@ -122,6 +123,25 @@ export const snap = (v, increment) => isArr(increment) ? increment.reduce((close
*/
export const interpolate = (start, end, progress) => start + (end - start) * progress;
+/**
+ * @param {Number} min
+ * @param {Number} max
+ * @param {Number} [decimalLength]
+ * @return {Number}
+ */
+export const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength || 0); return floor((Math.random() * (max - min + (1 / m)) + min) * m) / m };
+
+/**
+ * Adapted from https://bost.ocks.org/mike/shuffle/
+ * @param {Array} items
+ * @return {Array}
+ */
+export const shuffle = items => {
+ let m = items.length, t, i;
+ while (m) { i = random(0, --m); t = items[m]; items[m] = items[i]; items[i] = t; }
+ return items;
+}
+
/**
* @param {Number} v
* @return {Number}
@@ -218,3 +238,29 @@ export const addChild = (parent, child, sortMethod, prevProp = '_prev', nextProp
child[prevProp] = prev;
child[nextProp] = next;
}
+
+/**
+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor
+ * @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}
+ */
+export const createRefreshable = constructor => {
+ /** @type {Tickable} */
+ let tracked;
+ return (...args) => {
+ let currentIteration, currentIterationProgress, reversed, alternate;
+ if (tracked) {
+ currentIteration = tracked.currentIteration;
+ currentIterationProgress = tracked.iterationProgress;
+ reversed = tracked.reversed;
+ alternate = tracked._alternate;
+ tracked.revert();
+ }
+ const cleanup = constructor(...args);
+ if (cleanup && !isFnc(cleanup) && cleanup.revert) tracked = cleanup;
+ if (!isUnd(currentIterationProgress)) {
+ /** @type {Tickable} */(tracked).currentIteration = currentIteration;
+ /** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;
+ }
+ return cleanup || noop;
+ }
+}
diff --git a/src/scope.js b/src/scope.js
index e0ade3ac..c9d7f416 100644
--- a/src/scope.js
+++ b/src/scope.js
@@ -3,13 +3,16 @@
import {
doc,
win,
+ noop,
} from './consts.js';
import {
+ scope,
globals,
} from './globals.js';
import {
+ createRefreshable,
isFnc,
mergeObjects,
} from './helpers.js';
@@ -18,44 +21,10 @@ import {
parseTargets,
} from './targets.js';
-/**
- * @typedef {Object} ReactRef
- * @property {HTMLElement|SVGElement|null} [current]
- */
-
-/**
- * @typedef {Object} AngularRef
- * @property {HTMLElement|SVGElement} [nativeElement]
- */
-
-/**
- * @typedef {Object} ScopeParams
- * @property {DOMTargetSelector|ReactRef|AngularRef} [root]
- * @property {DefaultsParams} [defaults]
- * @property {Record<String, String>} [mediaQueries]
- */
-
-/**
- * @callback ScopeCleanup
- * @param {Scope} [scope]
- */
-
-/**
- * @callback ScopeConstructor
- * @param {Scope} [scope]
- * @return {ScopeCleanup|void}
- */
-
-/**
- * @callback ScopeMethod
- * @param {...*} args
- * @return {ScopeCleanup|void}
- */
-
export class Scope {
/** @param {ScopeParams} [parameters] */
constructor(parameters = {}) {
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const rootParam = parameters.root;
/** @type {Document|DOMTarget} */
let root = doc;
@@ -72,13 +41,23 @@ export class Scope {
this.defaults = scopeDefaults ? mergeObjects(scopeDefaults, globalDefault) : globalDefault;
/** @type {Document|DOMTarget} */
this.root = root;
- /** @type {Array<ScopeConstructor>} */
+ /** @type {Array<ScopeConstructorCallback>} */
this.constructors = [];
- /** @type {Array<Function>} */
+ /** @type {Array<ScopeCleanupCallback>} */
this.revertConstructors = [];
/** @type {Array<Revertible>} */
this.revertibles = [];
- /** @type {Record<String, Function>} */
+ /** @type {Array<ScopeConstructorCallback | ((scope: this) => Tickable)>} */
+ this.constructorsOnce = [];
+ /** @type {Array<ScopeCleanupCallback>} */
+ this.revertConstructorsOnce = [];
+ /** @type {Array<Revertible>} */
+ this.revertiblesOnce = [];
+ /** @type {Boolean} */
+ this.once = false;
+ /** @type {Number} */
+ this.onceIndex = 0;
+ /** @type {Record<String, ScopeMethod>} */
this.methods = {};
/** @type {Record<String, Boolean>} */
this.matches = {};
@@ -96,25 +75,30 @@ export class Scope {
}
/**
- * @callback ScoppedCallback
- * @param {this} scope
- * @return {any}
- *
- * @param {ScoppedCallback} cb
- * @return {this}
+ * @param {Revertible} revertible
+ */
+ register(revertible) {
+ const store = this.once ? this.revertiblesOnce : this.revertibles;
+ store.push(revertible);
+ }
+
+ /**
+ * @template T
+ * @param {ScopedCallback<T>} cb
+ * @return {T}
*/
execute(cb) {
- let activeScope = globals.scope;
- let activeRoot = globals.root;
+ let activeScope = scope.current;
+ let activeRoot = scope.root;
let activeDefaults = globals.defaults;
- globals.scope = this;
- globals.root = this.root;
+ scope.current = this;
+ scope.root = this.root;
globals.defaults = this.defaults;
const mqs = this.mediaQueryLists;
for (let mq in mqs) this.matches[mq] = mqs[mq].matches;
const returned = cb(this);
- globals.scope = activeScope;
- globals.root = activeRoot;
+ scope.current = activeScope;
+ scope.root = activeRoot;
globals.defaults = activeDefaults;
return returned;
}
@@ -123,6 +107,7 @@ export class Scope {
* @return {this}
*/
refresh() {
+ this.onceIndex = 0;
this.execute(() => {
let i = this.revertibles.length;
let y = this.revertConstructors.length;
@@ -130,9 +115,9 @@ export class Scope {
while (y--) this.revertConstructors[y](this);
this.revertibles.length = 0;
this.revertConstructors.length = 0;
- this.constructors.forEach( constructor => {
+ this.constructors.forEach((/** @type {ScopeConstructorCallback} */constructor) => {
const revertConstructor = constructor(this);
- if (revertConstructor) {
+ if (isFnc(revertConstructor)) {
this.revertConstructors.push(revertConstructor);
}
});
@@ -141,28 +126,26 @@ export class Scope {
}
/**
- * @callback contructorCallback
- * @param {this} self
- *
* @overload
* @param {String} a1
* @param {ScopeMethod} a2
* @return {this}
*
* @overload
- * @param {contructorCallback} a1
+ * @param {ScopeConstructorCallback} a1
* @return {this}
*
- * @param {String|contructorCallback} a1
+ * @param {String|ScopeConstructorCallback} a1
* @param {ScopeMethod} [a2]
*/
add(a1, a2) {
+ this.once = false;
if (isFnc(a1)) {
- const constructor = /** @type {contructorCallback} */(a1);
+ const constructor = /** @type {ScopeConstructorCallback} */(a1);
this.constructors.push(constructor);
this.execute(() => {
const revertConstructor = constructor(this);
- if (revertConstructor) {
+ if (isFnc(revertConstructor)) {
this.revertConstructors.push(revertConstructor);
}
});
@@ -172,6 +155,46 @@ export class Scope {
return this;
}
+ /**
+ * @param {ScopeConstructorCallback} scopeConstructorCallback
+ * @return {this}
+ */
+ addOnce(scopeConstructorCallback) {
+ this.once = true;
+ if (isFnc(scopeConstructorCallback)) {
+ const currentIndex = this.onceIndex++;
+ const tracked = this.constructorsOnce[currentIndex];
+ if (tracked) return this;
+ const constructor = /** @type {ScopeConstructorCallback} */(scopeConstructorCallback);
+ this.constructorsOnce[currentIndex] = constructor;
+ this.execute(() => {
+ const revertConstructor = constructor(this);
+ if (isFnc(revertConstructor)) {
+ this.revertConstructorsOnce.push(revertConstructor);
+ }
+ });
+ }
+ return this;
+ }
+
+ /**
+ * @param {(scope: this) => Tickable} cb
+ * @return {Tickable}
+ */
+ keepTime(cb) {
+ this.once = true;
+ const currentIndex = this.onceIndex++;
+ const tracked = /** @type {(scope: this) => Tickable} */(this.constructorsOnce[currentIndex]);
+ if (isFnc(tracked)) return tracked(this);
+ const constructor = /** @type {(scope: this) => Tickable} */(createRefreshable(cb));
+ this.constructorsOnce[currentIndex] = constructor;
+ let trackedTickable;
+ this.execute(() => {
+ trackedTickable = constructor(this);
+ });
+ return trackedTickable;
+ }
+
/**
* @param {Event} e
*/
@@ -186,15 +209,25 @@ export class Scope {
revert() {
const revertibles = this.revertibles;
const revertConstructors = this.revertConstructors;
+ const revertiblesOnce = this.revertiblesOnce;
+ const revertConstructorsOnce = this.revertConstructorsOnce;
const mqs = this.mediaQueryLists;
let i = revertibles.length;
- let y = revertConstructors.length;
+ let j = revertConstructors.length;
+ let k = revertiblesOnce.length;
+ let l = revertConstructorsOnce.length;
while (i--) revertibles[i].revert();
- while (y--) revertConstructors[y](this);
+ while (j--) revertConstructors[j](this);
+ while (k--) revertiblesOnce[k].revert();
+ while (l--) revertConstructorsOnce[l](this);
for (let mq in mqs) mqs[mq].removeEventListener('change', this);
revertibles.length = 0;
revertConstructors.length = 0;
this.constructors.length = 0;
+ revertiblesOnce.length = 0;
+ revertConstructorsOnce.length = 0;
+ this.constructorsOnce.length = 0;
+ this.onceIndex = 0;
this.matches = {};
this.methods = {};
this.mediaQueryLists = {};
@@ -206,4 +239,4 @@ export class Scope {
* @param {ScopeParams} [params]
* @return {Scope}
*/
-export const createScope = params => new Scope(params);
\ No newline at end of file
+export const createScope = params => new Scope(params);
diff --git a/src/scroll.js b/src/scroll.js
index b220fe3c..309478d3 100644
--- a/src/scroll.js
+++ b/src/scroll.js
@@ -7,6 +7,7 @@ import {
} from './consts.js';
import {
+ scope,
globals,
} from './globals.js';
@@ -413,7 +414,7 @@ export class ScrollObserver {
* @param {ScrollObserverParams} parameters
*/
constructor(parameters = {}) {
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const syncMode = setValue(parameters.sync, 'play pause');
const ease = syncMode ? parseEasings(/** @type {EasingParam} */(syncMode)) : null;
const isLinear = syncMode && (syncMode === 'linear' || syncMode === none);
diff --git a/src/stagger.js b/src/stagger.js
index 7b643d09..59545f02 100644
--- a/src/stagger.js
+++ b/src/stagger.js
@@ -15,6 +15,9 @@ import {
floor,
sqrt,
max,
+ isStr,
+ isFnc,
+ shuffle,
} from './helpers.js';
import {
@@ -22,33 +25,20 @@ import {
} from './eases.js';
import {
- Timeline,
parseTimelinePosition,
} from './timeline.js';
-/**
- * @typedef {Object} StaggerParameters
- * @property {Number|String} [start]
- * @property {Number|'first'|'center'|'last'} [from]
- * @property {Boolean} [reversed]
- * @property {Array.<Number>} [grid]
- * @property {('x'|'y')} [axis]
- * @property {EasingParam} [ease]
- * @property {TweenModifier} [modifier]
- */
+import {
+ getOriginalAnimatableValue,
+} from './values.js';
-/**
- * @callback StaggerFunction
- * @param {Target} [target]
- * @param {Number} [index]
- * @param {Number} [length]
- * @param {Timeline} [tl]
- * @return {Number|String}
- */
+import {
+ registerTargets,
+} from './targets.js';
/**
* @param {Number|String|[Number|String,Number|String]} val
- * @param {StaggerParameters} params
+ * @param {StaggerParams} params
* @return {StaggerFunction}
*/
export const stagger = (val, params = {}) => {
@@ -62,20 +52,27 @@ export const stagger = (val, params = {}) => {
const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parseEasings(ease) : null;
const grid = params.grid;
const axis = params.axis;
+ const customTotal = params.total;
const fromFirst = isUnd(from) || from === 0 || from === 'first';
const fromCenter = from === 'center';
const fromLast = from === 'last';
+ const fromRandom = from === 'random';
const isRange = isArr(val);
+ const useProp = params.use;
const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);
const val2 = isRange ? parseNumber(val[1]) : 0;
const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);
const start = params.start || 0 + (isRange ? val1 : 0);
let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;
- return (_, i, t, tl) => {
- if (fromCenter) fromIndex = (t - 1) / 2;
- if (fromLast) fromIndex = t - 1;
+ return (target, i, t, tl) => {
+ const [ registeredTarget ] = registerTargets(target);
+ const total = isUnd(customTotal) ? t : customTotal;
+ const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;
+ const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;
+ if (fromCenter) fromIndex = (total - 1) / 2;
+ if (fromLast) fromIndex = total - 1;
if (!values.length) {
- for (let index = 0; index < t; index++) {
+ for (let index = 0; index < total; index++) {
if (!grid) {
values.push(abs(fromIndex - index));
} else {
@@ -94,11 +91,12 @@ export const stagger = (val, params = {}) => {
}
if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);
if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));
+ if (fromRandom) values = shuffle(values);
}
const spacing = isRange ? (val2 - val1) / maxValue : val1;
const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);
/** @type {String|Number} */
- let output = offset + ((spacing * round(values[i], 2)) || 0);
+ let output = offset + ((spacing * round(values[staggerIndex], 2)) || 0);
if (params.modifier) output = params.modifier(output);
if (unitMatch) output = `${output}${unitMatch[2]}`;
return output;
diff --git a/src/targets.js b/src/targets.js
index fa0531e4..5468a36d 100644
--- a/src/targets.js
+++ b/src/targets.js
@@ -1,7 +1,7 @@
/// <reference path='./types.js' />
import {
- globals,
+ scope,
} from './globals.js';
import {
@@ -24,7 +24,7 @@ import {
* @return {NodeList|HTMLCollection}
*/
export function getNodeList(v) {
- const n = isStr(v) ? globals.root.querySelectorAll(v) : v;
+ const n = isStr(v) ? scope.root.querySelectorAll(v) : v;
if (n instanceof NodeList || n instanceof HTMLCollection) return n;
}
diff --git a/src/text.js b/src/text.js
new file mode 100644
index 00000000..dcef1a21
--- /dev/null
+++ b/src/text.js
@@ -0,0 +1,479 @@
+/// <reference path='./types.js' />
+
+import {
+ doc,
+ noop,
+ isBrowser,
+} from './consts.js';
+
+import {
+ scope,
+} from './globals.js';
+
+import {
+ isFnc,
+ isNum,
+ isStr,
+ isObj,
+ isUnd,
+ isArr,
+ createRefreshable,
+} from './helpers.js';
+
+import {
+ getNodeList,
+} from './targets.js';
+
+import {
+ setValue,
+} from './values.js';
+
+const segmenter = !isUnd(Intl) && Intl.Segmenter;
+const valueRgx = /\{value\}/g;
+const indexRgx = /\{i\}/g;
+const whiteSpaceGroupRgx = /(\s+)/;
+const whiteSpaceRgx = /^\s+$/;
+const lineType = 'line';
+const wordType = 'word';
+const charType = 'char';
+const dataLine = `data-line`;
+
+/**
+ * @typedef {Object} Segment
+ * @property {String} segment
+ * @property {Boolean} [isWordLike]
+ */
+
+/**
+ * @typedef {Object} Segmenter
+ * @property {function(String): Iterable<Segment>} segment
+ */
+
+/** @type {Segmenter} */
+let wordSegmenter = null;
+/** @type {Segmenter} */
+let graphemeSegmenter = null;
+let $splitTemplate = null;
+
+/**
+ * @param {Segment} seg
+ * @return {Boolean}
+ */
+const isSegmentWordLike = seg => {
+ return seg.isWordLike ||
+ seg.segment === ' ' || // Consider spaces as words first, then handle them diffrently later
+ isNum(+seg.segment); // Safari doesn't considers numbers as words
+}
+
+/**
+ * @param {HTMLElement} $el
+ */
+const setAriaHidden = $el => $el.setAttribute('aria-hidden', 'true');
+
+/**
+ * @param {DOMTarget} $el
+ * @param {String} type
+ * @return {Array<HTMLElement>}
+ */
+const getAllTopLevelElements = ($el, type) => [.../** @type {*} */($el.querySelectorAll(`[data-${type}]:not([data-${type}] [data-${type}])`))];
+
+const debugColors = { line: '#00D672', word: '#FF4B4B', char: '#5A87FF' };
+
+/**
+ * @param {HTMLElement} $el
+ */
+const filterEmptyElements = $el => {
+ if (!$el.childElementCount && !$el.textContent.trim()) {
+ const $parent = $el.parentElement;
+ $el.remove();
+ if ($parent) filterEmptyElements($parent);
+ }
+};
+
+/**
+ * @param {HTMLElement} $el
+ * @param {Number} lineIndex
+ * @param {Set<HTMLElement>} bin
+ * @returns {Set<HTMLElement>}
+ */
+const filterLineElements = ($el, lineIndex, bin) => {
+ const dataLineAttr = $el.getAttribute(dataLine);
+ if (dataLineAttr !== null && +dataLineAttr !== lineIndex || $el.tagName === 'BR') bin.add($el);
+ let i = $el.childElementCount;
+ while (i--) filterLineElements(/** @type {HTMLElement} */($el.children[i]), lineIndex, bin);
+ return bin;
+}
+
+/**
+ * @param {'line'|'word'|'char'} type
+ * @param {splitTemplateParams} params
+ * @return {String}
+ */
+const generateTemplate = (type, params = {}) => {
+ let template = ``;
+ const classString = isStr(params.class) ? ` class="${params.class}"` : '';
+ const cloneType = setValue(params.clone, false);
+ const wrapType = setValue(params.wrap, false);
+ const overflow = wrapType ? wrapType === true ? 'clip' : wrapType : cloneType ? 'clip' : false;
+ if (wrapType) template += `<span${overflow ? ` style="overflow:${overflow};"` : ''}>`;
+ template += `<span${classString}${cloneType ? ` style="position:relative;"` : ''} data-${type}="{i}">`;
+ if (cloneType) {
+ const left = cloneType === 'left' ? '-100%' : cloneType === 'right' ? '100%' : '0';
+ const top = cloneType === 'top' ? '-100%' : cloneType === 'bottom' ? '100%' : '0';
+ template += `<span>{value}</span>`;
+ template += `<span inert style="position:absolute;top:${top};left:${left};white-space:nowrap;">{value}</span>`;
+ } else {
+ template += `{value}`;
+ }
+ template += `</span>`;
+ if (wrapType) template += `</span>`;
+ return template;
+}
+
+/**
+ * @param {String|SplitFunctionValue} htmlTemplate
+ * @param {Array<HTMLElement>} store
+ * @param {Node|HTMLElement} node
+ * @param {DocumentFragment} $parentFragment
+ * @param {'line'|'word'|'char'} type
+ * @param {Boolean} debug
+ * @param {Number} lineIndex
+ * @param {Number} [wordIndex]
+ * @param {Number} [charIndex]
+ * @return {HTMLElement}
+ */
+const processHTMLTemplate = (htmlTemplate, store, node, $parentFragment, type, debug, lineIndex, wordIndex, charIndex) => {
+ const isLine = type === lineType;
+ const isChar = type === charType;
+ const className = `_${type}_`;
+ const template = isFnc(htmlTemplate) ? htmlTemplate(node) : htmlTemplate;
+ const displayStyle = isLine ? 'block' : 'inline-block';
+ $splitTemplate.innerHTML = template
+ .replace(valueRgx, `<i class="${className}"></i>`)
+ .replace(indexRgx, `${isChar ? charIndex : isLine ? lineIndex : wordIndex}`);
+ const $content = $splitTemplate.content;
+ const $highestParent = /** @type {HTMLElement} */($content.firstElementChild);
+ const $split = /** @type {HTMLElement} */($content.querySelector(`[data-${type}]`)) || $highestParent;
+ const $replacables = /** @type {NodeListOf<HTMLElement>} */($content.querySelectorAll(`i.${className}`));
+ const replacablesLength = $replacables.length;
+ if (replacablesLength) {
+ $highestParent.style.display = displayStyle;
+ $split.style.display = displayStyle;
+ $split.setAttribute(dataLine, `${lineIndex}`);
+ if (!isLine) {
+ $split.setAttribute('data-word', `${wordIndex}`);
+ if (isChar) $split.setAttribute('data-char', `${charIndex}`);
+ }
+ let i = replacablesLength;
+ while (i--) {
+ const $replace = $replacables[i];
+ const $closestParent = $replace.parentElement;
+ $closestParent.style.display = displayStyle;
+ if (isLine) {
+ $closestParent.innerHTML = /** @type {HTMLElement} */(node).innerHTML;
+ } else {
+ $closestParent.replaceChild(node.cloneNode(true), $replace);
+ }
+ }
+ store.push($split);
+ $parentFragment.appendChild($content);
+ } else {
+ console.warn(`The expression "{value}" is missing from the provided template.`);
+ }
+ if (debug) $highestParent.style.outline = `1px dotted ${debugColors[type]}`;
+ return $highestParent;
+}
+
+/**
+ * A class that splits text into words and wraps them in span elements while preserving the original HTML structure.
+ * @class
+ */
+export class TextSplitter {
+ /**
+ * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target
+ * @param {TextSplitterParams} [parameters]
+ */
+ constructor(target, parameters = {}) {
+ // Only init segmenters when needed
+ if (!wordSegmenter) wordSegmenter = segmenter ? new segmenter([], { granularity: wordType }) : {
+ segment: (text) => {
+ const segments = [];
+ const words = text.split(whiteSpaceGroupRgx);
+ for (let i = 0, l = words.length; i < l; i++) {
+ const segment = words[i];
+ segments.push({
+ segment,
+ isWordLike: !whiteSpaceRgx.test(segment), // Consider non-whitespace as word-like
+ });
+ }
+ return segments;
+ }
+ }
+ if (!graphemeSegmenter) graphemeSegmenter = segmenter ? new segmenter([], { granularity: 'grapheme' }) : {
+ segment: text => [...text].map(char => ({ segment: char }))
+ }
+ if (!$splitTemplate && isBrowser) $splitTemplate = doc.createElement('template');
+ if (scope.current) scope.current.register(this);
+ const { words, chars, lines, accessible, includeSpaces, debug } = parameters;
+ const $target = /** @type {HTMLElement} */((target = isArr(target) ? target[0] : target) && /** @type {Node} */(target).nodeType ? target : (getNodeList(target) || [])[0]);
+ const lineParams = lines === true ? {} : lines;
+ const wordParams = words === true || isUnd(words) ? {} : words;
+ const charParams = chars === true ? {} : chars;
+ this.debug = setValue(debug, false);
+ this.includeSpaces = setValue(includeSpaces, false);
+ this.accessible = setValue(accessible, true);
+ this.linesOnly = lineParams && (!wordParams && !charParams);
+ /** @type {String|false|SplitFunctionValue} */
+ this.lineTemplate = isObj(lineParams) ? generateTemplate(lineType, /** @type {splitTemplateParams} */(lineParams)) : lineParams;
+ /** @type {String|false|SplitFunctionValue} */
+ this.wordTemplate = isObj(wordParams) || this.linesOnly ? generateTemplate(wordType, /** @type {splitTemplateParams} */(wordParams)) : wordParams;
+ /** @type {String|false|SplitFunctionValue} */
+ this.charTemplate = isObj(charParams) ? generateTemplate(charType, /** @type {splitTemplateParams} */(charParams)) : charParams;
+ this.$target = $target;
+ this.html = $target && $target.innerHTML;
+ this.lines = [];
+ this.words = [];
+ this.chars = [];
+ this.effects = [];
+ this.effectsCleanups = [];
+ this.cache = null;
+ this.ready = false;
+ this.width = 0;
+ this.resizeTimeout = null;
+ const handleSplit = () => this.html && (lineParams || wordParams || charParams) && this.split();
+ // Make sure this is declared before calling handleSplit() in case revert() is called inside an effect callback
+ this.resizeObserver = new ResizeObserver(() => {
+ // Use a setTimeout instead of a Timer for better tree shaking
+ clearTimeout(this.resizeTimeout);
+ this.resizeTimeout = setTimeout(() => {
+ const currentWidth = /** @type {HTMLElement} */($target).offsetWidth;
+ if (currentWidth === this.width) return;
+ this.width = currentWidth;
+ handleSplit();
+ }, 150);
+ });
+ // Only declare the font ready promise when splitting by lines and not alreay split
+ if (this.lineTemplate && !this.ready) {
+ doc.fonts.ready.then(handleSplit);
+ } else {
+ handleSplit();
+ }
+ $target ? this.resizeObserver.observe($target) : console.warn('No Text Splitter target found.');
+ }
+
+ /**
+ * @param {(...args: any[]) => Tickable | (() => void)} effect
+ * @return this
+ */
+ addEffect(effect) {
+ if (!isFnc(effect)) return console.warn('Effect must return a function.');
+ const refreshableEffect = createRefreshable(effect);
+ this.effects.push(refreshableEffect);
+ if (this.ready) this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);
+ return this;
+ }
+
+ revert() {
+ clearTimeout(this.resizeTimeout);
+ this.lines.length = this.words.length = this.chars.length = 0;
+ this.resizeObserver.disconnect();
+ // Make sure to revert the effects after disconnecting the resizeObserver to avoid triggering it in the process
+ this.effectsCleanups.forEach(cleanup => isFnc(cleanup) ? cleanup(this) : cleanup.revert && cleanup.revert());
+ this.$target.innerHTML = this.html;
+ return this;
+ }
+
+ /**
+ * Recursively processes a node and its children
+ * @param {Node} node
+ */
+ splitNode(node) {
+ const wordTemplate = this.wordTemplate;
+ const charTemplate = this.charTemplate;
+ const includeSpaces = this.includeSpaces;
+ const debug = this.debug;
+ const nodeType = node.nodeType;
+ if (nodeType === 3) {
+ const nodeText = node.nodeValue;
+ // If the nodeText is only whitespace, leave it as is
+ if (nodeText.trim()) {
+ const tempWords = [];
+ const words = this.words;
+ const chars = this.chars;
+ const wordSegments = wordSegmenter.segment(nodeText);
+ const $wordsFragment = doc.createDocumentFragment();
+ let prevSeg = null;
+ for (const wordSegment of wordSegments) {
+ const segment = wordSegment.segment;
+ const isWordLike = isSegmentWordLike(wordSegment);
+ // Determine if this segment should be a new word, first segment always becomes a new word
+ if (!prevSeg || (isWordLike && (prevSeg && (isSegmentWordLike(prevSeg))))) {
+ tempWords.push(segment);
+ } else {
+ // Only concatenate if both current and previous are non-word-like and don't contain spaces
+ const lastWordIndex = tempWords.length - 1;
+ const lastWord = tempWords[lastWordIndex];
+ if (!lastWord.includes(' ') && !segment.includes(' ')) {
+ tempWords[lastWordIndex] += segment;
+ } else {
+ tempWords.push(segment);
+ }
+ }
+ prevSeg = wordSegment;
+ }
+
+ for (let i = 0, l = tempWords.length; i < l; i++) {
+ const word = tempWords[i];
+ if (!word.trim()) {
+ // Preserve whitespace only if includeSpaces is false and if the current space is not the first node
+ if (i && includeSpaces) continue;
+ $wordsFragment.appendChild(doc.createTextNode(word));
+ } else {
+ const nextWord = tempWords[i + 1];
+ const hasWordFollowingSpace = includeSpaces && nextWord && !nextWord.trim();
+ const wordToProcess = word;
+ const charSegments = charTemplate ? graphemeSegmenter.segment(wordToProcess) : null;
+ const $charsFragment = charTemplate ? doc.createDocumentFragment() : doc.createTextNode(hasWordFollowingSpace ? word + '\xa0' : word);
+ if (charTemplate) {
+ const charSegmentsArray = [...charSegments];
+ for (let j = 0, jl = charSegmentsArray.length; j < jl; j++) {
+ const charSegment = charSegmentsArray[j];
+ const isLastChar = j === jl - 1;
+ // If this is the last character and includeSpaces is true with a following space, append the space
+ const charText = isLastChar && hasWordFollowingSpace ? charSegment.segment + '\xa0' : charSegment.segment;
+ const $charNode = doc.createTextNode(charText);
+ processHTMLTemplate(charTemplate, chars, $charNode, /** @type {DocumentFragment} */($charsFragment), charType, debug, -1, words.length, chars.length);
+ }
+ }
+ if (wordTemplate) {
+ processHTMLTemplate(wordTemplate, words, $charsFragment, $wordsFragment, wordType, debug, -1, words.length, chars.length);
+ // Chars elements must be re-parsed in the split() method if both words and chars are parsed
+ } else if (charTemplate) {
+ $wordsFragment.appendChild($charsFragment);
+ } else {
+ $wordsFragment.appendChild(doc.createTextNode(word));
+ }
+ // Skip the next iteration if we included a space
+ if (hasWordFollowingSpace) i++;
+ }
+ }
+ node.parentNode.replaceChild($wordsFragment, node);
+ }
+ } else if (nodeType === 1) {
+ // Converting to an array is necessary to work around childNodes pottential mutation
+ const childNodes = /** @type {Array<Node>} */([.../** @type {*} */(node.childNodes)]);
+ for (let i = 0, l = childNodes.length; i < l; i++) this.splitNode(childNodes[i]);
+ }
+ }
+
+ /**
+ * @param {Boolean} clearCache
+ * @return {this}
+ */
+ split(clearCache = false) {
+ const $el = this.$target;
+ const isCached = !!this.cache && !clearCache;
+ const lineTemplate = this.lineTemplate;
+ const wordTemplate = this.wordTemplate;
+ const charTemplate = this.charTemplate;
+ const fontsReady = doc.fonts.status !== 'loading';
+ const canSplitLines = lineTemplate && fontsReady;
+ this.ready = !lineTemplate || fontsReady;
+ if (!isCached) {
+ if (clearCache) {
+ $el.innerHTML = this.html;
+ this.words.length = this.chars.length = 0;
+ }
+ this.splitNode($el);
+ this.cache = $el.innerHTML;
+ }
+ // Always reset the html when splitting by lines
+ if (canSplitLines) {
+ // No need to revert effects animations here since it's already taken care by the refreshable
+ this.effectsCleanups.forEach(cleanup => isFnc(cleanup) && cleanup(this));
+ if (isCached) $el.innerHTML = this.cache;
+ this.lines.length = 0;
+ if (wordTemplate) this.words = getAllTopLevelElements($el, wordType);
+ }
+ // Always reparse characters after a line reset or if both words and chars are activated
+ if (charTemplate && (canSplitLines || wordTemplate)) {
+ this.chars = getAllTopLevelElements($el, charType);
+ }
+ // Words are used when lines only and prioritized over chars
+ const elementsArray = this.words.length ? this.words : this.chars;
+ let y, linesCount = 0;
+ for (let i = 0, l = elementsArray.length; i < l; i++) {
+ const $el = elementsArray[i];
+ const { top, height } = $el.getBoundingClientRect();
+ if (y && top - y > height * .5) linesCount++;
+ $el.setAttribute(dataLine, `${linesCount}`);
+ const nested = $el.querySelectorAll(`[${dataLine}]`);
+ let c = nested.length;
+ while (c--) nested[c].setAttribute(dataLine, `${linesCount}`);
+ y = top;
+ }
+ if (canSplitLines) {
+ const linesFragment = doc.createDocumentFragment();
+ const parents = new Set();
+ const clones = [];
+ for (let lineIndex = 0; lineIndex < linesCount + 1; lineIndex++) {
+ const $clone = /** @type {HTMLElement} */($el.cloneNode(true));
+ filterLineElements($clone, lineIndex, new Set()).forEach($el => {
+ const $parent = $el.parentElement;
+ if ($parent) parents.add($parent);
+ $el.remove();
+ });
+ clones.push($clone);
+ }
+ parents.forEach(filterEmptyElements);
+ for (let cloneIndex = 0, clonesLength = clones.length; cloneIndex < clonesLength; cloneIndex++) {
+ processHTMLTemplate(lineTemplate, this.lines, clones[cloneIndex], linesFragment, lineType, this.debug, cloneIndex);
+ }
+ $el.innerHTML = '';
+ $el.appendChild(linesFragment);
+ if (wordTemplate) this.words = getAllTopLevelElements($el, wordType);
+ if (charTemplate) this.chars = getAllTopLevelElements($el, charType);
+ }
+ // Remove the word wrappers and clear the words array if lines split only
+ if (this.linesOnly) {
+ const words = this.words;
+ let w = words.length;
+ while (w--) {
+ const $word = words[w];
+ $word.replaceWith($word.textContent);
+ }
+ words.length = 0;
+ }
+ if (canSplitLines || clearCache) {
+ this.effects.forEach((effect, i) => this.effectsCleanups[i] = effect(this));
+ }
+ if (this.accessible && (canSplitLines || !isCached)) {
+ const $accessible = doc.createElement('span');
+ // Make the accessible element visually-hidden (https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html)
+ $accessible.style.cssText = `position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;`;
+ // $accessible.setAttribute('tabindex', '-1');
+ $accessible.innerHTML = this.html;
+ $el.insertBefore($accessible, $el.firstChild);
+ this.lines.forEach(setAriaHidden);
+ this.words.forEach(setAriaHidden);
+ this.chars.forEach(setAriaHidden);
+ }
+ this.width = /** @type {HTMLElement} */($el).offsetWidth;
+ return this;
+ }
+
+ refresh() {
+ this.split(true);
+ }
+}
+
+/**
+ * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target
+ * @param {TextSplitterParams} [parameters]
+ * @return {TextSplitter}
+ */
+export const split = (target, parameters) => new TextSplitter(target, parameters);
+
+export const text = {
+ split,
+}
diff --git a/src/timeline.js b/src/timeline.js
index c17c987d..7364508b 100644
--- a/src/timeline.js
+++ b/src/timeline.js
@@ -24,7 +24,6 @@ import {
clampInfinity,
normalizeTime,
isStr,
- round,
} from './helpers.js';
import {
@@ -368,4 +367,4 @@ export class Timeline extends Timer {
* @param {TimelineParams} [parameters]
* @return {Timeline}
*/
-export const createTimeline = parameters => new Timeline(parameters).init();
\ No newline at end of file
+export const createTimeline = parameters => new Timeline(parameters).init();
diff --git a/src/timer.js b/src/timer.js
index 05e453ce..55a662f1 100644
--- a/src/timer.js
+++ b/src/timer.js
@@ -22,6 +22,7 @@ import {
} from './helpers.js';
import {
+ scope,
globals,
} from './globals.js';
@@ -111,7 +112,7 @@ export class Timer extends Clock {
onUpdate,
} = parameters;
- if (globals.scope) globals.scope.revertibles.push(this);
+ if (scope.current) scope.current.register(this);
const timerInitTime = parent ? 0 : engine._elapsedTime;
const timerDefaults = parent ? parent.defaults : globals.defaults;
@@ -241,7 +242,7 @@ export class Timer extends Clock {
}
get progress() {
- return clamp(round(this._currentTime / this.duration, 5), 0, 1);
+ return clamp(round(this._currentTime / this.duration, 10), 0, 1);
}
/** @param {Number} progress */
@@ -250,7 +251,7 @@ export class Timer extends Clock {
}
get iterationProgress() {
- return clamp(round(this._iterationTime / this.iterationDuration, 5), 0, 1);
+ return clamp(round(this._iterationTime / this.iterationDuration, 10), 0, 1);
}
/** @param {Number} progress */
diff --git a/src/types.js b/src/types.js
index b5f2e441..68712b00 100644
--- a/src/types.js
+++ b/src/types.js
@@ -9,10 +9,13 @@
/** @typedef {import('./draggable.js').Draggable} Draggable */
/** @typedef {import('./scroll.js').ScrollObserver} ScrollObserver */
/** @typedef {import('./scope.js').Scope} Scope */
+/** @typedef {import('./text.js').TextSplitter} TextSplitter */
/** @typedef {import('./spring.js').Spring} Spring */
/* Exports */
+// Global types ///////////////////////////////////////////////////////////////
+
/**
* @typedef {Object} DefaultsParams
* @property {Number|String} [id]
@@ -42,61 +45,33 @@
/** @typedef {JSAnimation|Timeline} Renderable */
/** @typedef {Timer|Renderable} Tickable */
/** @typedef {Timer&JSAnimation&Timeline} CallbackArgument */
-/** @typedef {import('./animatable.js').Animatable|Tickable|Draggable|ScrollObserver|Scope} Revertible */
+/** @typedef {import('./animatable.js').Animatable|Tickable|Draggable|ScrollObserver|TextSplitter|Scope} Revertible */
-/**
- * @typedef {Object} DraggableAxisParam
- * @property {String} [mapTo]
- * @property {TweenModifier} [modifier]
- * @property {TweenComposition} [composition]
- * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
- */
+// Stagger types //////////////////////////////////////////////////////////////
/**
- * @typedef {Object} DraggableCursorParams
- * @property {String} [onHover]
- * @property {String} [onGrab]
+ * @callback StaggerFunction
+ * @param {Target} [target]
+ * @param {Number} [index]
+ * @param {Number} [length]
+ * @param {Timeline} [tl]
+ * @return {Number|String}
*/
/**
- * @typedef {Object} DraggableParams
- * @property {DOMTargetSelector} [trigger]
- * @property {DOMTargetSelector|Array<Number>|((draggable: Draggable) => DOMTargetSelector|Array<Number>)} [container]
- * @property {Boolean|DraggableAxisParam} [x]
- * @property {Boolean|DraggableAxisParam} [y]
+ * @typedef {Object} StaggerParams
+ * @property {Number|String} [start]
+ * @property {Number|'first'|'center'|'last'|'random'} [from]
+ * @property {Boolean} [reversed]
+ * @property {Array.<Number>} [grid]
+ * @property {('x'|'y')} [axis]
+ * @property {String|StaggerFunction} [use]
+ * @property {Number} [total]
+ * @property {EasingParam} [ease]
* @property {TweenModifier} [modifier]
- * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
- * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [containerPadding]
- * @property {Number|((draggable: Draggable) => Number)} [containerFriction]
- * @property {Number|((draggable: Draggable) => Number)} [releaseContainerFriction]
- * @property {Number|((draggable: Draggable) => Number)} [dragSpeed]
- * @property {Number|((draggable: Draggable) => Number)} [scrollSpeed]
- * @property {Number|((draggable: Draggable) => Number)} [scrollThreshold]
- * @property {Number|((draggable: Draggable) => Number)} [minVelocity]
- * @property {Number|((draggable: Draggable) => Number)} [maxVelocity]
- * @property {Number|((draggable: Draggable) => Number)} [velocityMultiplier]
- * @property {Number} [releaseMass]
- * @property {Number} [releaseStiffness]
- * @property {Number} [releaseDamping]
- * @property {Boolean} [releaseDamping]
- * @property {EasingParam} [releaseEase]
- * @property {Boolean|DraggableCursorParams|((draggable: Draggable) => Boolean|DraggableCursorParams)} [cursor]
- * @property {Callback<Draggable>} [onGrab]
- * @property {Callback<Draggable>} [onDrag]
- * @property {Callback<Draggable>} [onRelease]
- * @property {Callback<Draggable>} [onUpdate]
- * @property {Callback<Draggable>} [onSettle]
- * @property {Callback<Draggable>} [onSnap]
- * @property {Callback<Draggable>} [onResize]
- * @property {Callback<Draggable>} [onAfterResize]
*/
-/**
- * @typedef {SVGGeometryElement & {
- * setAttribute(name: 'draw', value: `${number} ${number}`): void;
- * draw: `${number} ${number}`;
- * }} DrawableSVGGeometry
- */
+// Eases types ////////////////////////////////////////////////////////////////
/**
* @callback EasingFunction
@@ -124,21 +99,7 @@
/** @typedef {Array.<TargetSelector>|TargetSelector} TargetsParam */
/** @typedef {Array.<Target>} TargetsArray */
-/**
- * @callback FunctionValue
- * @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>}
- */
-
-/**
- * @callback TweenModifier
- * @param {Number} value - The animated value
- * @return {Number|String}
- */
-
-/** @typedef {[Number, Number, Number, Number]} ColorArray */
+ // Callback types ////////////////////////////////////////////////////////////
/**
* @template T
@@ -165,6 +126,46 @@
* @property {Callback<T>} [onRender]
*/
+// Timer types ////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} TimerOptions
+ * @property {Number|String} [id]
+ * @property {TweenParamValue} [duration]
+ * @property {TweenParamValue} [delay]
+ * @property {Number} [loopDelay]
+ * @property {Boolean} [reversed]
+ * @property {Boolean} [alternate]
+ * @property {Boolean|Number} [loop]
+ * @property {Boolean|ScrollObserver} [autoplay]
+ * @property {Number} [frameRate]
+ * @property {Number} [playbackRate]
+ */
+
+/**
+
+/**
+ * @typedef {TimerOptions & TickableCallbacks<Timer>} TimerParams
+ */
+
+// Tween types ////////////////////////////////////////////////////////////////
+
+/**
+ * @callback FunctionValue
+ * @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>}
+ */
+
+/**
+ * @callback TweenModifier
+ * @param {Number} value - The animated value
+ * @return {Number|String}
+ */
+
+/** @typedef {[Number, Number, Number, Number]} ColorArray */
+
/**
* @typedef {Object} Tween
* @property {Number} id
@@ -218,25 +219,7 @@
/** @typedef {WeakMap.<Target, TweenLookups>} TweenReplaceLookups */
/** @typedef {Map.<Target, TweenLookups>} TweenAdditiveLookups */
-/**
- * @typedef {Object} TimerOptions
- * @property {Number|String} [id]
- * @property {TweenParamValue} [duration]
- * @property {TweenParamValue} [delay]
- * @property {Number} [loopDelay]
- * @property {Boolean} [reversed]
- * @property {Boolean} [alternate]
- * @property {Boolean|Number} [loop]
- * @property {Boolean|ScrollObserver} [autoplay]
- * @property {Number} [frameRate]
- * @property {Number} [playbackRate]
- */
-
-/**
-
-/**
- * @typedef {TimerOptions & TickableCallbacks<Timer>} TimerParams
- */
+// Animation types ////////////////////////////////////////////////////////////
/**
* @typedef {Number|String|FunctionValue} TweenParamValue
@@ -310,6 +293,8 @@
* @typedef {Record<String, TweenOptions | Callback<JSAnimation> | TweenModifier | boolean | PercentageKeyframes | DurationKeyframes | ScrollObserver> & TimerOptions & AnimationOptions & TweenParamsOptions & TickableCallbacks<JSAnimation> & RenderableCallbacks<JSAnimation>} AnimationParams
*/
+// Timeline types /////////////////////////////////////////////////////////////
+
/**
* @typedef {Object} TimelineOptions
* @property {DefaultsParams} [defaults]
@@ -320,6 +305,8 @@
* @typedef {TimerOptions & TimelineOptions & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>} TimelineParams
*/
+// Animatable types ///////////////////////////////////////////////////////////
+
/**
* @callback AnimatablePropertySetter
* @param {Number|Array.<Number>} to
@@ -353,3 +340,133 @@
/**
* @typedef {Record<String, TweenParamValue | EasingParam | TweenModifier | TweenComposition | AnimatablePropertyParamsOptions> & AnimatablePropertyParamsOptions} AnimatableParams
*/
+
+// Scope types ////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} ReactRef
+ * @property {HTMLElement|SVGElement|null} [current]
+ */
+
+/**
+ * @typedef {Object} AngularRef
+ * @property {HTMLElement|SVGElement} [nativeElement]
+ */
+
+/**
+ * @typedef {Object} ScopeParams
+ * @property {DOMTargetSelector|ReactRef|AngularRef} [root]
+ * @property {DefaultsParams} [defaults]
+ * @property {Record<String, String>} [mediaQueries]
+ */
+
+/**
+ * @template T
+ * @callback ScopedCallback
+ * @param {Scope} scope
+ * @return {T}
+ */
+
+/**
+ * @callback ScopeCleanupCallback
+ * @param {Scope} [scope]
+ */
+
+/**
+ * @callback ScopeConstructorCallback
+ * @param {Scope} [scope]
+ * @return {ScopeCleanupCallback|void}
+ */
+
+/**
+ * @callback ScopeMethod
+ * @param {...*} args
+ * @return {ScopeCleanupCallback|void}
+ */
+
+// Draggable types ////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} DraggableAxisParam
+ * @property {String} [mapTo]
+ * @property {TweenModifier} [modifier]
+ * @property {TweenComposition} [composition]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
+ */
+
+/**
+ * @typedef {Object} DraggableCursorParams
+ * @property {String} [onHover]
+ * @property {String} [onGrab]
+ */
+
+/**
+ * @typedef {Object} DraggableParams
+ * @property {DOMTargetSelector} [trigger]
+ * @property {DOMTargetSelector|Array<Number>|((draggable: Draggable) => DOMTargetSelector|Array<Number>)} [container]
+ * @property {Boolean|DraggableAxisParam} [x]
+ * @property {Boolean|DraggableAxisParam} [y]
+ * @property {TweenModifier} [modifier]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [snap]
+ * @property {Number|Array<Number>|((draggable: Draggable) => Number|Array<Number>)} [containerPadding]
+ * @property {Number|((draggable: Draggable) => Number)} [containerFriction]
+ * @property {Number|((draggable: Draggable) => Number)} [releaseContainerFriction]
+ * @property {Number|((draggable: Draggable) => Number)} [dragSpeed]
+ * @property {Number|((draggable: Draggable) => Number)} [scrollSpeed]
+ * @property {Number|((draggable: Draggable) => Number)} [scrollThreshold]
+ * @property {Number|((draggable: Draggable) => Number)} [minVelocity]
+ * @property {Number|((draggable: Draggable) => Number)} [maxVelocity]
+ * @property {Number|((draggable: Draggable) => Number)} [velocityMultiplier]
+ * @property {Number} [releaseMass]
+ * @property {Number} [releaseStiffness]
+ * @property {Number} [releaseDamping]
+ * @property {Boolean} [releaseDamping]
+ * @property {EasingParam} [releaseEase]
+ * @property {Boolean|DraggableCursorParams|((draggable: Draggable) => Boolean|DraggableCursorParams)} [cursor]
+ * @property {Callback<Draggable>} [onGrab]
+ * @property {Callback<Draggable>} [onDrag]
+ * @property {Callback<Draggable>} [onRelease]
+ * @property {Callback<Draggable>} [onUpdate]
+ * @property {Callback<Draggable>} [onSettle]
+ * @property {Callback<Draggable>} [onSnap]
+ * @property {Callback<Draggable>} [onResize]
+ * @property {Callback<Draggable>} [onAfterResize]
+ */
+
+// Text types /////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {Object} splitTemplateParams
+ * @property {false|String} [class]
+ * @property {Boolean|'hidden'|'clip'|'visible'|'scroll'|'auto'} [wrap]
+ * @property {Boolean|'top'|'right'|'bottom'|'left'|'center'} [clone]
+ */
+
+/**
+ * @typedef {Boolean|String} SplitValue
+ */
+
+/**
+ * @callback SplitFunctionValue
+ * @param {Node|HTMLElement} [value]
+ * @return String
+ */
+
+/**
+ * @typedef {Object} TextSplitterParams
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [lines]
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [words]
+ * @property {SplitValue|splitTemplateParams|SplitFunctionValue} [chars]
+ * @property {Boolean} [accessible]
+ * @property {Boolean} [includeSpaces]
+ * @property {Boolean} [debug]
+ */
+
+// SVG types //////////////////////////////////////////////////////////////////
+
+/**
+ * @typedef {SVGGeometryElement & {
+ * setAttribute(name: 'draw', value: `${number} ${number}`): void;
+ * draw: `${number} ${number}`;
+ * }} DrawableSVGGeometry
+ */
diff --git a/src/utils.js b/src/utils.js
index 6278dc51..29a6fe58 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -15,14 +15,16 @@ import {
import {
isUnd,
- floor,
PI,
snap,
clamp,
round,
+ random,
interpolate,
+ shuffle,
removeChild,
forEachChildren,
+ createRefreshable,
} from './helpers.js';
import {
@@ -236,12 +238,10 @@ export const remove = (targets, renderable, propertyName) => {
}
/**
- * @param {Number} min
- * @param {Number} max
- * @param {Number} [decimalLength]
- * @return {Number}
+ * @param {(...args: any[]) => Tickable} constructor
+ * @return {(...args: any[]) => Tickable}
*/
-const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength || 0); return floor((Math.random() * (max - min + (1 / m)) + min) * m) / m };
+export const keepTime = createRefreshable;
/**
* @param {String|Array} items
@@ -249,17 +249,6 @@ const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength ||
*/
const randomPick = items => items[random(0, items.length - 1)];
-/**
- * Adapted from https://bost.ocks.org/mike/shuffle/
- * @param {Array} items
- * @return {Array}
- */
-const shuffle = items => {
- let m = items.length, t, i;
- while (m) { i = random(0, --m); t = items[m]; items[m] = items[i]; items[i] = t; }
- return items;
-}
-
/**
* @param {Number|String} v
* @param {Number} decimalLength
@@ -454,6 +443,7 @@ export const utils = {
shuffle,
lerp,
sync,
+ keepTime,
clamp: /** @type {typeof clamp & ChainedClamp} */(makeChainable(clamp)),
round: /** @type {typeof round & ChainedRound} */(makeChainable(round)),
snap: /** @type {typeof snap & ChainedSnap} */(makeChainable(snap)),
diff --git a/src/waapi.js b/src/waapi.js
index e04b8418..2f24ea9f 100644
--- a/src/waapi.js
+++ b/src/waapi.js
@@ -12,9 +12,11 @@ import {
removeChild,
stringStartsWith,
toLowerCase,
+ isNil,
} from './helpers.js';
import {
+ scope,
globals,
} from './globals.js';
@@ -36,7 +38,6 @@ import {
import {
isBrowser,
- doc,
K,
noop,
emptyString,
@@ -167,31 +168,9 @@ const commonDefaultPXProperties = [
...transformsShorthands
]
-const validIndividualTransforms = [...transformsShorthands, ...validTransforms.filter(t => ['X', 'Y', 'Z'].some(axis => t.endsWith(axis)))];
-
-// Setting it to true in case CSS.registerProperty is not supported will automatically skip the registration and fallback to no animation
-let transformsPropertiesRegistered = isBrowser && (isUnd(CSS) || !Object.hasOwnProperty.call(CSS, 'registerProperty'));
-
-const registerTransformsProperties = () => {
- if (transformsPropertiesRegistered) return;
- validTransforms.forEach(t => {
- const isSkew = stringStartsWith(t, 'skew');
- const isScale = stringStartsWith(t, 'scale');
- const isRotate = stringStartsWith(t, 'rotate');
- const isTranslate = stringStartsWith(t, 'translate');
- const isAngle = isRotate || isSkew;
- const syntax = isAngle ? '<angle>' : isScale ? "<number>" : isTranslate ? "<length-percentage>" : "*";
- try {
- CSS.registerProperty({
- name: '--' + t,
- syntax,
- inherits: false,
- initialValue: isTranslate ? '0px' : isAngle ? '0deg' : isScale ? '1' : '0',
- });
- } catch {};
- });
- transformsPropertiesRegistered = true;
-}
+const validIndividualTransforms = /*#__PURE__*/ (() => [...transformsShorthands, ...validTransforms.filter(t => ['X', 'Y', 'Z'].some(axis => t.endsWith(axis)))])();
+
+let transformsPropertiesRegistered = null;
const WAAPIAnimationsLookups = {
_head: null,
@@ -303,9 +282,32 @@ export class WAAPIAnimation {
*/
constructor(targets, params) {
- if (globals.scope) globals.scope.revertibles.push(this);
-
- registerTransformsProperties();
+ if (scope.current) scope.current.register(this);
+
+ // Skip the registration and fallback to no animation in case CSS.registerProperty is not supported
+ if (isNil(transformsPropertiesRegistered)) {
+ if (isBrowser && (isUnd(CSS) || !Object.hasOwnProperty.call(CSS, 'registerProperty'))) {
+ transformsPropertiesRegistered = false;
+ } else {
+ validTransforms.forEach(t => {
+ const isSkew = stringStartsWith(t, 'skew');
+ const isScale = stringStartsWith(t, 'scale');
+ const isRotate = stringStartsWith(t, 'rotate');
+ const isTranslate = stringStartsWith(t, 'translate');
+ const isAngle = isRotate || isSkew;
+ const syntax = isAngle ? '<angle>' : isScale ? "<number>" : isTranslate ? "<length-percentage>" : "*";
+ try {
+ CSS.registerProperty({
+ name: '--' + t,
+ syntax,
+ inherits: false,
+ initialValue: isTranslate ? '0px' : isAngle ? '0deg' : isScale ? '1' : '0',
+ });
+ } catch {};
+ });
+ transformsPropertiesRegistered = true;
+ }
+ }
const parsedTargets = registerTargets(targets);
const targetsLength = parsedTargets.length;
diff --git a/tests/assets/Altinn-DINExp.woff2 b/tests/assets/Altinn-DINExp.woff2
new file mode 100644
index 00000000..3bea3af6
Binary files /dev/null and b/tests/assets/Altinn-DINExp.woff2 differ
diff --git a/tests/favicon.png b/tests/assets/favicon.png
similarity index 100%
rename from tests/favicon.png
rename to tests/assets/favicon.png
diff --git a/tests/icon.png b/tests/assets/icon.png
similarity index 100%
rename from tests/icon.png
rename to tests/assets/icon.png
diff --git a/tests/index.html b/tests/index.html
index 73a542a6..ff43c0bc 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -5,8 +5,15 @@
<title>Anime.js tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
- <link rel="icon" href="./favicon.png?v=5">
+ <link rel="icon" href="./assets/favicon.png?v=5">
<style>
+ @font-face {
+ font-family: "Altinn";
+ src: url(./assets/Altinn-DINExp.woff2) format("woff2");
+ font-weight: normal;
+ font-style: normal;
+ font-display: swap;
+ }
:root {
--color-white: #F6F4F2; /* White */
--color-black: #2E2C2C; /* Black */
@@ -36,6 +43,7 @@
}
html,
body {
+ font-family: "Altinn";
font-size: 16px;
background-color: var(--color-black);
color: var(--color-white);
@@ -77,6 +85,7 @@
opacity: 1;
}
#mocha {
+ font-family: inherit;
position: relative;
right: 0;
z-index: 1;
@@ -84,6 +93,9 @@
margin: 0 0 0 auto;
padding: 0 1rem 1rem 1rem;
}
+ #mocha em {
+ font-style: normal;
+ }
#mocha-stats {
top: 0;
left: 0;
@@ -183,7 +195,7 @@
/* Tests specific styles */
#tests {
opacity: .0001;
- position: fixed;
+ position: absolute;
display: flex;
flex-wrap: wrap;
z-index: 0;
@@ -258,7 +270,7 @@
background-color: var(--color-darkgreen);
border: 1px solid var(--color-black);
}
- @media (min-width: 1000px) {
+ @media (min-width: 600px) {
#mocha,
#tests {
width: 50%;
diff --git a/tests/playground/sandbox/index.html b/tests/playground/sandbox/index.html
index 288f836d..4e80804e 100644
--- a/tests/playground/sandbox/index.html
+++ b/tests/playground/sandbox/index.html
@@ -8,21 +8,50 @@
<style>
body {
display: flex;
+ flex-direction: column;
+ flex-wrap: wrap;
+ justify-content: center;
align-items: center;
- overflow: hidden;
- position: absolute;
- width: 100%;
- height: 100dvh;
+ height: 100vh;
}
- circle {
- vector-effect: non-scaling-stroke;
+
+ .container {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ gap: .5rem;
+ padding: 1rem;
+ }
+
+ .square {
+ width: 100px;
+ height: 100px;
+ background: var(--red);
+ border-radius: 1rem;
+ padding: 1rem;
+ }
+
+ .button {
+ border-radius: 1rem;
+ padding: 1rem;
}
+
</style>
</head>
<body>
- <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 400 400" preserveAspectRatio="none">
- <circle cx="200" cy="200" r="200" fill="none" stroke="#FFF"/>
- </svg>
+ <div class="container">
+ <button class="button">2000</button>
+ <button class="button">4000</button>
+ <button class="button">1000</button>
+ </div>
+ <div class="container">
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ </div>
<script type="module" src="./index.js"></script>
</body>
</html>
diff --git a/tests/playground/sandbox/index.js b/tests/playground/sandbox/index.js
index 7a824587..3a07dcc8 100644
--- a/tests/playground/sandbox/index.js
+++ b/tests/playground/sandbox/index.js
@@ -1,11 +1,23 @@
import {
- svg,
animate,
+ utils,
} from '../../../lib/anime.esm.js';
-animate(svg.createDrawable('svg circle'), {
- draw: '0 1',
+const buttons = /** @type {Array<HTMLButtonElement>} */(utils.$('.button'));
+
+const colors = ['#0FF', '#F0F', '#FF0'];
+
+const timekeepAnimate = utils.keepTime(duration => animate('.square', {
+ y: 200,
+ scale: utils.random(.8, .9, 2),
+ background: utils.randomPick(colors),
alternate: true,
loop: true,
- duration: 4000,
-});
\ No newline at end of file
+ duration
+}));
+
+buttons.forEach($button => {
+ $button.addEventListener('click', () => {
+ timekeepAnimate($button.innerText);
+ });
+});
diff --git a/tests/playground/scope/index.html b/tests/playground/scope/index.html
new file mode 100644
index 00000000..f861a039
--- /dev/null
+++ b/tests/playground/scope/index.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Scope / 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;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+ }
+
+ .container {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ gap: .5rem;
+ padding: 1rem;
+ }
+
+ .square {
+ width: 100px;
+ height: 100px;
+ background: var(--red);
+ border-radius: 1rem;
+ padding: 1rem;
+ }
+
+ </style>
+</head>
+<body>
+ <div class="container">
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ </div>
+ <div class="container scoped">
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ </div>
+ <div class="container">
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ </div>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
diff --git a/tests/playground/scope/index.js b/tests/playground/scope/index.js
new file mode 100644
index 00000000..f2608c2f
--- /dev/null
+++ b/tests/playground/scope/index.js
@@ -0,0 +1,93 @@
+import {
+ animate,
+ utils,
+ createScope,
+} from '../../../lib/anime.esm.js';
+
+const scope = createScope({
+ mediaQueries: { isSmall: '(max-width: 800px)' },
+ defaults: { ease: 'linear' },
+ root: '.scoped',
+})
+.add(self => {
+
+ const squares = utils.$('.square');
+
+ self.addOnce((scope) => {
+ console.log('ADDED ONCE');
+ // Everything declared here will be only called once and won't be reverted on mediaquery changes
+ animate('.square', {
+ y: [0, -50, 0, 50, 0],
+ loop: true,
+ ease: 'inOut(2)',
+ duration: 2500
+ });
+ })
+
+ self.addOnce(() => {
+ console.log('ADDED ONCE');
+ // Everything declared here will be only called once and won't be reverted on mediaquery changes
+ animate('.square', {
+ x: [0, -100, 0, 100, 0],
+ loop: true,
+ ease: 'inOut(2)',
+ duration: 2500
+ });
+ })
+
+ const rotationAnimation = self.keepTime(() => animate('.square', {
+ rotate: 360,
+ duration: 2000,
+ loop: true,
+ alternate: true
+ }));
+
+
+
+ // Recreate the animation while keeping track of its current time between mediaquery changes
+ // self.keepTime(() => animate('.square', {
+ // scale: self.matches.isSmall ? .5 : 1.5,
+ // rotate: 360,
+ // duration: 2000,
+ // loop: true,
+ // alternate: true
+ // }));
+
+ function handlePointerEnter() {
+ animate(this, {
+ scale: 1.5,
+ ease: 'out(3)',
+ duration: 500
+ });
+ }
+
+ function handlePointerLeave() {
+ animate(this, {
+ scale: 1,
+ ease: 'out(3)',
+ duration: 500
+ });
+ }
+
+ self.keepTime(() => animate('.square', {
+ background: ($el) => utils.get($el, utils.randomPick(['--skyblue', '--lavender', '--pink'])),
+ loop: true,
+ ease: 'inOut(2)',
+ alternate: true,
+ duration: 2000,
+ }));
+
+ squares.forEach($square => $square.addEventListener('pointerenter', handlePointerEnter));
+ squares.forEach($square => $square.addEventListener('pointerleave', handlePointerLeave));
+
+ return () => {
+ squares.forEach($square => $square.removeEventListener('pointerenter', handlePointerEnter));
+ squares.forEach($square => $square.removeEventListener('pointerleave', handlePointerLeave));
+ }
+
+});
+
+document.body.addEventListener('click', () => {
+ console.log('REVERT');
+ scope.revert();
+})
\ No newline at end of file
diff --git a/tests/playground/sprite-animation.html b/tests/playground/sprite-animation.html
index 663411ed..3da92b63 100644
--- a/tests/playground/sprite-animation.html
+++ b/tests/playground/sprite-animation.html
@@ -44,7 +44,6 @@
<script type="module">
import { animate } from '../../lib/anime.esm.js';
- // import { inspect } from '../lib/gui/index.js';
const ryu = animate('.ryu', {
backgroundPosition: '100% 0px',
@@ -53,8 +52,6 @@
loop: true
});
- // inspect(ryu);
-
</script>
</body>
diff --git a/tests/playground/timekeeper/index.html b/tests/playground/timekeeper/index.html
new file mode 100644
index 00000000..ae162100
--- /dev/null
+++ b/tests/playground/timekeeper/index.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Timekeeper / 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;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+ }
+ .container {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ gap: .5rem;
+ padding: 1rem;
+ }
+ .square {
+ width: 100px;
+ height: 100px;
+ background: var(--red);
+ border-radius: 1rem;
+ padding: 1rem;
+ }
+ </style>
+</head>
+<body>
+ <div class="container">
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ <div class="square"></div>
+ </div>
+ <script type="module" src="./index.js"></script>
+</body>
+</html>
diff --git a/tests/playground/timekeeper/index.js b/tests/playground/timekeeper/index.js
new file mode 100644
index 00000000..68b8b2f8
--- /dev/null
+++ b/tests/playground/timekeeper/index.js
@@ -0,0 +1,25 @@
+import {
+ utils,
+ createScope,
+ createTimeline,
+ stagger
+} from '../../../lib/anime.esm.js';
+
+const timekeeper = utils.keepTime(scope => {
+ const isMinM = scope.matches.minM;
+ return createTimeline().add('.square', {
+ y: 200,
+ rotate: -90,
+ scale: utils.random(.8, .9, 2),
+ background: isMinM ? '#0FF' : '#FF0',
+ alternate: true,
+ loop: true,
+ ease: 'inOutQuad',
+ }, stagger(200));
+});
+
+createScope({
+ mediaQueries: { minM: '(min-width: 800px)' }
+}).add(self => {
+ self.preserve(timekeeper);
+});
diff --git a/tests/run.js b/tests/run.js
index 0ebf2b9d..ade7bf0f 100644
--- a/tests/run.js
+++ b/tests/run.js
@@ -18,6 +18,7 @@ import './suites/parameters.test.js';
import './suites/promises.test.js';
import './suites/stagger.test.js';
import './suites/svg.test.js';
+import './suites/text.test.js';
import './suites/units.test.js';
import './suites/utils.test.js';
import './suites/values.test.js';
diff --git a/tests/setup.js b/tests/setup.js
index 3bb77b66..0283f913 100644
--- a/tests/setup.js
+++ b/tests/setup.js
@@ -9,7 +9,8 @@ const testsEl = document.querySelector('#tests');
mocha.setup({
ui: 'tdd',
slow: 100,
- timeout: 1000,
+ timeout: 2000,
+ globals: ['___browserSync___'],
rootHooks: {
beforeEach(done) {
testObject.plainValue = 10;
@@ -49,7 +50,7 @@ mocha.setup({
<div class="css-properties"></div>
</div>
<div id="dom-attributes-tests" class="test test small-test">
- <img class="with-width-attribute" src="./icon.png" width=96 height=96 />
+ <img class="with-width-attribute" src="./assets/icon.png" width=96 height=96 />
<input type="number" id="input-number" name="Input number test" min="0" max="100" value="0">
</div>
<div id="stagger-tests" class="test small-test">
@@ -68,6 +69,13 @@ mocha.setup({
<div></div><div></div><div></div><div></div><div></div>
</div>
</div>
+ <div id="split-text-tests" class="test">
+ <div id="split-text">
+ <p>
+ Split text by characters, words, and lines, do-not-split-hyphens, split <a href="#"><strong>nested elements like</strong></a> <code>&lt;strong&gt;</code> tags and <span class="nested">any <span class="nested">level <span class="nested">of <span class="nested">nested <span class="nested">tags</span></span></span></span></span> and respect line breaks.<br> Split words in languages without spaces like この日本語の文のように, and properly handles ѕρє¢ιαℓ ¢нαяα¢тєяѕ & 🇪Ⓜ️🅾️🇯ℹ️s
+ </p>
+ </div>
+ </div>
`;
done();
}
diff --git a/tests/suites/text.test.js b/tests/suites/text.test.js
new file mode 100644
index 00000000..34dddb24
--- /dev/null
+++ b/tests/suites/text.test.js
@@ -0,0 +1,399 @@
+import {
+ expect,
+ browserIs,
+} from '../utils.js';
+
+import {
+ utils,
+ text,
+ animate,
+} from '../../src/anime.js';
+
+// Firefox detect Japanse words differently
+const wordsLength = browserIs.firefox ? 44 : 45;
+const charsLength = 229;
+
+suite('Text', () => {
+ test('Defaults text split (words only)', () => {
+ const split = text.split('#split-text p');
+ expect(split.lines.length).to.equal(0);
+ expect(split.words.length).to.equal(wordsLength);
+ expect(split.chars.length).to.equal(0);
+ split.revert();
+ });
+
+ test('Split chars only', () => {
+ const split = text.split('#split-text p', { words: false, chars: true });
+ expect(split.lines.length).to.equal(0);
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(charsLength);
+ split.revert();
+ });
+
+ test('Split lines only', resolve => {
+ const split = text.split('#split-text p', {
+ lines: true,
+ words: false,
+ })
+ .addEffect((split) => {
+ const firstLevelSpans = split.$target.querySelectorAll('#split-text p > span[data-line]');
+ expect(split.lines.length).to.be.above(0);
+ expect(split.lines.length).to.equal(firstLevelSpans.length);
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(0);
+ resolve();
+ split.revert();
+ });
+ expect(split.lines.length).to.equal(0);
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(0);
+ });
+
+ test('Split words and chars', () => {
+ const split = text.split('#split-text p', { chars: true });
+ expect(split.lines.length).to.equal(0);
+ expect(split.words.length).to.equal(wordsLength);
+ expect(split.chars.length).to.equal(charsLength);
+ split.revert();
+ });
+
+ test('Split words and lines', resolve => {
+ const split = text.split('#split-text p', {
+ lines: true,
+ });
+ split.addEffect((split) => {
+ const firstLevelSpans = split.$target.querySelectorAll('#split-text p > span[data-line]');
+ expect(split.lines.length).to.be.above(0);
+ expect(split.lines.length).to.equal(firstLevelSpans.length);
+ expect(split.words.length).to.equal(wordsLength);
+ expect(split.chars.length).to.equal(0);
+ resolve();
+ split.revert();
+ });
+ expect(split.lines.length).to.equal(0);
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(0);
+ });
+
+ test('Split lines and chars', resolve => {
+ const split = text.split('#split-text p', {
+ lines: true,
+ words: false,
+ chars: true,
+ })
+ .addEffect((split) => {
+ const firstLevelSpans = split.$target.querySelectorAll('#split-text p > span[data-line]');
+ expect(split.lines.length).to.be.above(0);
+ expect(split.lines.length).to.equal(firstLevelSpans.length);
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(charsLength);
+ resolve();
+ split.revert();
+ });
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(0);
+ });
+
+ test('Split lines words and chars', resolve => {
+ const split = text.split('#split-text p', {
+ lines: true,
+ chars: true,
+ })
+ .addEffect((split) => {
+ const firstLevelSpans = split.$target.querySelectorAll('#split-text p > span[data-line]');
+ expect(split.lines.length).to.be.above(0);
+ expect(split.lines.length).to.equal(firstLevelSpans.length);
+ expect(split.words.length).to.equal(wordsLength);
+ expect(split.chars.length).to.equal(charsLength);
+ resolve();
+ split.revert();
+ });
+ expect(split.lines.length).to.equal(0);
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(0);
+ });
+
+ test('Custom css classes', resolve => {
+ const split = text.split('#split-text p', {
+ lines: { class: 'split-line' },
+ words: { class: 'split-word' },
+ chars: { class: 'split-char' },
+ })
+ .addEffect((split) => {
+ expect(split.lines.length).to.be.above(0);
+ expect(split.lines.length).to.equal(utils.$('.split-line').length);
+ expect(split.words.length).to.equal(utils.$('.split-word').length);
+ expect(split.chars.length).to.equal(utils.$('.split-char').length);
+ resolve();
+ split.revert();
+ });
+ expect(split.lines.length).to.equal(0);
+ expect(split.words.length).to.equal(0);
+ expect(split.chars.length).to.equal(0);
+ });
+
+ test('Wrap text', resolve => {
+ const split = text.split('#split-text p', {
+ lines: { wrap: 'clip' },
+ words: { wrap: 'clip' },
+ chars: { wrap: 'clip' },
+ })
+ .addEffect((split) => {
+ expect(split.lines.length).to.be.above(0);
+ expect(split.words.length).to.equal(wordsLength);
+ expect(split.chars.length).to.equal(charsLength);
+ split.lines.forEach($line => expect($line.parentElement.style.overflow).to.equal('clip'));
+ split.words.forEach($word => expect($word.parentElement.style.overflow).to.equal('clip'));
+ split.chars.forEach($char => expect($char.parentElement.style.overflow).to.equal('clip'));
+ resolve();
+ split.revert();
+ })
+ });
+
+ test('Clone text', resolve => {
+ const split = text.split('#split-text p', {
+ lines: { clone: true },
+ words: { clone: true },
+ chars: { clone: true },
+ });
+ split.addEffect((split) => {
+ expect(split.lines.length).to.be.above(0);
+ expect(split.words.length).to.equal(wordsLength * 2);
+ expect(split.chars.length).to.equal(charsLength * 4);
+ resolve();
+ split.revert();
+ });
+ });
+
+ test('Custom template', resolve => {
+ const split = text.split('#split-text p', {
+ lines: '<span class="split-line split-line-{i}">{value}</span>',
+ words: '<span class="split-word split-word-{i}">{value}</span>',
+ chars: '<span class="split-char split-char-{i}">{value}</span>',
+ });
+ split.addEffect((split) => {
+ expect(split.lines.length).to.be.above(0);
+ expect(split.words.length).to.equal(wordsLength);
+ expect(split.chars.length).to.equal(charsLength);
+ split.lines.forEach(($line, i) => expect($line.classList[1]).to.equal(`split-line-${i}`));
+ split.words.forEach(($word, i) => expect($word.classList[1]).to.equal(`split-word-${i}`));
+ split.chars.forEach(($char, i) => expect($char.classList[1]).to.equal(`split-char-${i}`));
+ resolve();
+ split.revert();
+ });
+ });
+
+ test('Init in a document.fonts.ready Promise', resolve => {
+ document.fonts.ready.then(() => {
+ text.split('#split-text p', {
+ lines: true,
+ words: true,
+ chars: true,
+ })
+ .addEffect((split) => {
+ const firstLevelSpans = split.$target.querySelectorAll('#split-text p > span[data-line]');
+ expect(split.lines.length).to.be.above(0);
+ expect(split.lines.length).to.equal(firstLevelSpans.length);
+ expect(split.words.length).to.equal(wordsLength);
+ expect(split.chars.length).to.equal(charsLength);
+ resolve();
+ split.revert();
+ })
+ });
+ });
+
+ test('addEffect() should only triggers once on load', resolve => {
+ let calls = 0, timeout;
+ text.split('#split-text p', {
+ lines: true,
+ })
+ .addEffect((split) => {
+ calls++;
+ if (timeout) clearTimeout(timeout);
+ timeout = setTimeout(() => {
+ expect(calls).to.equal(1);
+ resolve();
+ split.revert();
+ }, 33)
+ })
+ });
+
+ test('addEffect() should properly track the time of an animation', resolve => {
+ let animation;
+ const [ $p ] = utils.$('#split-text p');
+ const split = text.split('#split-text p', {
+ lines: true,
+ })
+ .addEffect((split) => {
+ animation = animate(split.lines, {
+ opacity: 0,
+ });
+ return animation;
+ });
+ setTimeout(() => {
+ expect(animation.currentTime).to.be.above(10);
+ expect(animation.currentTime).to.be.below(100);
+ $p.style.width = '10px';
+ }, 50);
+ setTimeout(() => {
+ expect(animation.currentTime).to.be.above(150);
+ resolve();
+ split.revert();
+ }, 200);
+ });
+
+ test('addEffect() should properly triggers on resize', resolve => {
+ document.fonts.ready.then(() => {
+ let calls = 0;
+ let cleanups = 0;
+ let lines = 0;
+ const [ $p ] = utils.$('#split-text p');
+ const split = text.split($p, {
+ lines: true,
+ })
+ .addEffect(() => {
+ calls++;
+ return () => {
+ cleanups++;
+ }
+ });
+ expect(calls).to.equal(0);
+ expect(cleanups).to.equal(0);
+ setTimeout(() => {
+ expect(calls).to.equal(1);
+ expect(cleanups).to.equal(0);
+ $p.style.width = '10px';
+ }, 10);
+ setTimeout(() => {
+ expect(calls).to.equal(2);
+ expect(cleanups).to.equal(1);
+ expect(split.lines.length).to.be.above(lines);
+ lines = split.lines.length;
+ $p.style.width = 'auto';
+ }, 200);
+ setTimeout(() => {
+ expect(calls).to.equal(3);
+ expect(cleanups).to.equal(2);
+ expect(lines).to.be.above(split.lines.length);
+ resolve();
+ split.revert();
+ }, 400);
+ });
+ });
+
+ test('addEffect() should only triggers once on load inside a document.fonts.ready Promise', resolve => {
+ document.fonts.ready.then(() => {
+ let calls = 0, timeout;
+ text.split('#split-text p', {
+ lines: true,
+ })
+ .addEffect((split) => {
+ calls++;
+ if (timeout) clearTimeout(timeout);
+ timeout = setTimeout(() => {
+ expect(calls).to.equal(1);
+ resolve();
+ split.revert();
+ }, 33)
+ })
+ });
+ });
+
+ test('addEffect() cleanup function should only execute between addEffect', resolve => {
+ document.fonts.ready.then(() => {
+ let calls = 0;
+ let cleanups = 0;
+ const [ $p ] = utils.$('#split-text p');
+ const split = text.split($p, {
+ lines: true,
+ })
+ .addEffect(() => {
+ calls++;
+ return () => {
+ cleanups++;
+ }
+ });
+ setTimeout(() => {
+ expect(calls).to.equal(1);
+ expect(cleanups).to.equal(0);
+ $p.style.width = '10px';
+ }, 10);
+ setTimeout(() => {
+ expect(calls).to.equal(2);
+ expect(cleanups).to.equal(1);
+ resolve();
+ split.revert();
+ }, 200);
+ });
+ });
+
+ test('addEffect() function should be triggered even when not splitting by lines', resolve => {
+ let calls = 0;
+ let cleanups = 0;
+ const [ $p ] = utils.$('#split-text p');
+ const split = text.split($p, {
+ lines: false,
+ })
+ .addEffect(() => {
+ calls++;
+ return () => {
+ cleanups++;
+ }
+ });
+ setTimeout(() => {
+ expect(calls).to.equal(1);
+ expect(cleanups).to.equal(0);
+ resolve();
+ split.revert();
+ }, 10);
+ });
+
+ test('revert() should properly call cleanups function', resolve => {
+ document.fonts.ready.then(() => {
+ let calls = 0;
+ let cleanups = 0;
+ const [ $p ] = utils.$('#split-text p');
+ const split = text.split($p, {
+ lines: true,
+ })
+ .addEffect(() => {
+ calls++;
+ return () => {
+ cleanups++;
+ }
+ });
+ setTimeout(() => {
+ expect(calls).to.equal(1);
+ expect(cleanups).to.equal(0);
+ split.revert();
+ $p.style.width = '10px';
+ }, 10);
+ setTimeout(() => {
+ expect(calls).to.equal(1);
+ expect(cleanups).to.equal(1);
+ resolve();
+ }, 200);
+ });
+ });
+
+ test('revert() should properly revert animations effects', resolve => {
+ let animation;
+ const [ $p ] = utils.$('#split-text p');
+ const split = text.split('#split-text p', {
+ lines: true,
+ })
+ .addEffect((split) => {
+ animation = animate(split.lines, {
+ opacity: 0,
+ });
+ return animation;
+ });
+ setTimeout(() => {
+ expect(animation.paused).to.equal(false);
+ split.revert();
+ expect(animation.paused).to.equal(true);
+ resolve();
+ }, 10);
+ });
+
+});
diff --git a/tests/suites/tweens.test.js b/tests/suites/tweens.test.js
index 2042d2e9..e8f3dacd 100644
--- a/tests/suites/tweens.test.js
+++ b/tests/suites/tweens.test.js
@@ -13,7 +13,7 @@ import {
} from '../../src/anime.js';
import {
- compositionTypes,
+ compositionTypes,
valueTypes,
} from '../../src/consts.js';
diff --git a/tests/suites/utils.test.js b/tests/suites/utils.test.js
index a7680ee1..b3afa0c6 100644
--- a/tests/suites/utils.test.js
+++ b/tests/suites/utils.test.js
@@ -480,4 +480,27 @@ suite('Utils', () => {
utils.remove('#target-id', animation, 'y');
});
+ test('Track instance loop alternate progress with a Timekeeper', () => {
+ const timekeeper = utils.keepTime((duration) => animate('#target-id', {
+ x: 100, ease: 'linear', duration, loop: true, alternate: true,
+ }));
+ let animation = timekeeper(1000);
+ expect(animation.currentTime).to.equal(0);
+ animation.seek(500);
+ expect(animation.currentTime).to.equal(500);
+ animation = timekeeper(2000);
+ expect(animation.currentTime).to.equal(1000);
+ animation.seek(500);
+ expect(animation.currentTime).to.equal(500);
+ animation = timekeeper(500);
+ expect(animation.currentTime).to.equal(125);
+ animation.seek(875);
+ expect(animation.currentTime).to.equal(875);
+ expect(animation.iterationProgress).to.equal(.25); // It alternates, so we should be at the begining
+ animation.seek(1375);
+ expect(animation.currentTime).to.equal(1375);
+ expect(animation.iterationProgress).to.equal(.75); // It alternates, so we should now be at the end
+ animation.pause();
+ });
+
});
diff --git a/tests/utils.js b/tests/utils.js
index adeab300..e00957c6 100644
--- a/tests/utils.js
+++ b/tests/utils.js
@@ -30,6 +30,10 @@ export const getChildLength = (parent) => {
return i;
}
+export const browserIs = {
+ firefox: /firefox|fxios/i.test(navigator.userAgent) && !/seamonkey/i.test(navigator.userAgent),
+}
+
// export const getTweenDelay = t => (t.parent._offset + t._startTime) - t._absoluteStartTime;
// export const getTweenDelay = t => {
diff --git a/types/index.d.ts b/types/index.d.ts
index fc0fad24..edc7ae0c 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -70,6 +70,7 @@ declare function getTargetValue(targetSelector: TargetsParam, propName: string,
declare function sync(callback?: Callback<Timer>): Timer;
declare function setTargetValues(targets: TargetsParam, parameters: AnimationParams): JSAnimation;
declare function remove(targets: TargetsParam, renderable?: Renderable | WAAPIAnimation, propertyName?: string): TargetsArray;
+declare const keepTime: (constructor: (...args: any[]) => Tickable | ((...args: any[]) => void)) => (...args: any[]) => Tickable | ((...args: any[]) => void);
declare function lerp(start: number, end: number, amount: number, renderable?: Renderable | boolean): number;
declare namespace utils {
export { registerTargets as $ };
@@ -82,6 +83,7 @@ declare namespace utils {
export { shuffle };
export { lerp };
export { sync };
+ export { keepTime };
export let clamp: ((v: number, min: number, max: number) => number) & ChainedClamp;
export let round: ((v: number, decimalLength: number) => number) & ChainedRound;
export let snap: ((v: number, increment: number | number[]) => number) & ChainedSnap;
@@ -199,8 +201,8 @@ declare function registerTargets(targets: DOMTargetsParam): DOMTargetsArray;
declare function registerTargets(targets: JSTargetsParam): JSTargetsArray;
declare function registerTargets(targets: TargetsParam): TargetsArray;
declare function random(min: number, max: number, decimalLength?: number): number;
-declare function randomPick(items: string | any[]): any;
declare function shuffle(items: any[]): any[];
+declare function randomPick(items: string | any[]): any;
declare namespace svg {
export { morphTo };
export { createMotionPath };
@@ -216,39 +218,7 @@ declare function createDrawable(selector: TargetsParam, start?: number, end?: nu
declare function stagger(val: number | string | [
number | string,
number | string
-], params?: StaggerParameters): StaggerFunction;
-type StaggerParameters = {
- start?: number | string;
- from?: number | "first" | "center" | "last";
- reversed?: boolean;
- grid?: Array<number>;
- axis?: ("x" | "y");
- ease?: EasingParam;
- modifier?: TweenModifier;
-};
-type StaggerFunction = (target?: Target, index?: number, length?: number, tl?: Timeline) => number | string;
-declare class Timeline extends Timer {
- constructor(parameters?: TimelineParams);
- labels: Record<string, number>;
- defaults: DefaultsParams;
- onRender: Callback<this>;
- _ease: EasingFunction;
- add(a1: TargetsParam, a2: AnimationParams, a3?: TimePosition): this;
- add(a1: TimerParams, a2?: TimePosition): this;
- sync(synced?: Tickable, position?: TimePosition): this;
- sync(synced?: globalThis.Animation, position?: TimePosition): this;
- sync(synced?: WAAPIAnimation, position?: TimePosition): this;
- set(targets: TargetsParam, parameters: AnimationParams, position?: TimePosition): this;
- call(callback: Callback<Timer>, position?: TimePosition): this;
- label(labelName: string, position?: TimePosition): this;
- remove(targets: TargetsParam, propertyName?: string): this;
- stretch(newDuration: number): this;
- refresh(): this;
- revert(): this;
- then(callback?: Callback<this>): Promise<any>;
-}
-declare function createTimeline(parameters?: TimelineParams): Timeline;
-type TimePosition = number | string | Function;
+], params?: StaggerParams): StaggerFunction;
declare namespace eases {
export let linear: (...args?: (string | number)[]) => EasingFunction;
export let irregular: (length?: number, randomness?: number) => EasingFunction;
@@ -337,50 +307,18 @@ declare class Animatable {
revert(): this;
}
declare function createAnimatable(targets: TargetsParam, parameters: AnimatableParams): AnimatableObject;
-type Revertible = Animatable | Tickable | Draggable | ScrollObserver | Scope;
-type DraggableAxisParam = {
- mapTo?: string;
- modifier?: TweenModifier;
- composition?: TweenComposition;
- snap?: number | number[] | ((draggable: Draggable) => number | Array<number>);
-};
-type DraggableCursorParams = {
- onHover?: string;
- onGrab?: string;
-};
-type DraggableParams = {
- trigger?: DOMTargetSelector;
- container?: number[] | DOMTargetSelector | ((draggable: Draggable) => DOMTargetSelector | Array<number>);
- x?: boolean | DraggableAxisParam;
- y?: boolean | DraggableAxisParam;
+type Revertible = Animatable | Tickable | Draggable | ScrollObserver | TextSplitter | Scope;
+type StaggerFunction = (target?: Target, index?: number, length?: number, tl?: Timeline) => number | string;
+type StaggerParams = {
+ start?: number | string;
+ from?: number | 'first' | 'center' | 'last' | 'random';
+ reversed?: boolean;
+ grid?: Array<number>;
+ axis?: ('x' | 'y');
+ use?: string | StaggerFunction;
+ total?: number;
+ ease?: EasingParam;
modifier?: TweenModifier;
- snap?: number | number[] | ((draggable: Draggable) => number | Array<number>);
- containerPadding?: number | number[] | ((draggable: Draggable) => number | Array<number>);
- containerFriction?: number | ((draggable: Draggable) => number);
- releaseContainerFriction?: number | ((draggable: Draggable) => number);
- dragSpeed?: number | ((draggable: Draggable) => number);
- scrollSpeed?: number | ((draggable: Draggable) => number);
- scrollThreshold?: number | ((draggable: Draggable) => number);
- minVelocity?: number | ((draggable: Draggable) => number);
- maxVelocity?: number | ((draggable: Draggable) => number);
- velocityMultiplier?: number | ((draggable: Draggable) => number);
- releaseMass?: number;
- releaseStiffness?: number;
- releaseDamping?: number;
- releaseEase?: EasingParam;
- cursor?: boolean | DraggableCursorParams | ((draggable: Draggable) => boolean | DraggableCursorParams);
- onGrab?: Callback<Draggable>;
- onDrag?: Callback<Draggable>;
- onRelease?: Callback<Draggable>;
- onUpdate?: Callback<Draggable>;
- onSettle?: Callback<Draggable>;
- onSnap?: Callback<Draggable>;
- onResize?: Callback<Draggable>;
- onAfterResize?: Callback<Draggable>;
-};
-type DrawableSVGGeometry = SVGGeometryElement & {
- setAttribute(name: 'draw', value: `${number} ${number}`): void;
- draw: `${number} ${number}`;
};
type EasingFunction = (time: number) => number;
type EaseStringParamNames = ('linear' | 'linear(x1, x2 25%, x3)' | 'in' | 'out' | 'inOut' | 'inQuad' | 'outQuad' | 'inOutQuad' | 'inCubic' | 'outCubic' | 'inOutCubic' | 'inQuart' | 'outQuart' | 'inOutQuart' | 'inQuint' | 'outQuint' | 'inOutQuint' | 'inSine' | 'outSine' | 'inOutSine' | 'inCirc' | 'outCirc' | 'inOutCirc' | 'inExpo' | 'outExpo' | 'inOutExpo' | 'inBounce' | 'outBounce' | 'inOutBounce' | 'inBack' | 'outBack' | 'inOutBack' | 'inElastic' | 'outElastic' | 'inOutElastic' | 'irregular' | 'cubicBezier' | 'steps' | 'in(p = 1.675)' | 'out(p = 1.675)' | 'inOut(p = 1.675)' | 'inBack(overshoot = 1.70158)' | 'outBack(overshoot = 1.70158)' | 'inOutBack(overshoot = 1.70158)' | 'inElastic(amplitude = 1, period = .3)' | 'outElastic(amplitude = 1, period = .3)' | 'inOutElastic(amplitude = 1, period = .3)' | 'irregular(length = 10, randomness = 1)' | 'cubicBezier(x1, y1, x2, y2)' | 'steps(steps = 10)');
@@ -396,9 +334,6 @@ type JSTargetsParam = Array<JSTarget> | JSTarget;
type JSTargetsArray = Array<JSTarget>;
type TargetsParam = Array<TargetSelector> | TargetSelector;
type TargetsArray = Array<Target>;
-type FunctionValue = (target: Target, index: number, length: number) => number | string | TweenObjectValue | Array<number | string | TweenObjectValue>;
-type TweenModifier = (value: number) => number | string;
-type ColorArray = [number, number, number, number];
type Callback<T> = (self: T, e?: PointerEvent) => any;
type TickableCallbacks<T extends unknown> = {
onBegin?: Callback<T>;
@@ -411,6 +346,26 @@ type TickableCallbacks<T extends unknown> = {
type RenderableCallbacks<T extends unknown> = {
onRender?: Callback<T>;
};
+type TimerOptions = {
+ id?: number | string;
+ duration?: TweenParamValue;
+ delay?: TweenParamValue;
+ loopDelay?: number;
+ reversed?: boolean;
+ alternate?: boolean;
+ loop?: boolean | number;
+ autoplay?: boolean | ScrollObserver;
+ frameRate?: number;
+ playbackRate?: number;
+};
+/**
+ *
+ * /**
+ */
+type TimerParams = TimerOptions & TickableCallbacks<Timer>;
+type FunctionValue = (target: Target, index: number, length: number) => number | string | TweenObjectValue | Array<number | string | TweenObjectValue>;
+type TweenModifier = (value: number) => number | string;
+type ColorArray = [number, number, number, number];
type Tween = {
id: number;
parent: JSAnimation;
@@ -480,23 +435,6 @@ type TweenPropertySiblings = {
type TweenLookups = Record<string, TweenPropertySiblings>;
type TweenReplaceLookups = WeakMap<Target, TweenLookups>;
type TweenAdditiveLookups = Map<Target, TweenLookups>;
-type TimerOptions = {
- id?: number | string;
- duration?: TweenParamValue;
- delay?: TweenParamValue;
- loopDelay?: number;
- reversed?: boolean;
- alternate?: boolean;
- loop?: boolean | number;
- autoplay?: boolean | ScrollObserver;
- frameRate?: number;
- playbackRate?: number;
-};
-/**
- *
- * /**
- */
-type TimerParams = TimerOptions & TickableCallbacks<Timer>;
type TweenParamValue = number | string | FunctionValue;
type TweenPropValue = TweenParamValue | [TweenParamValue, TweenParamValue];
type TweenComposition = (string & {}) | 'none' | 'replace' | 'blend' | compositionTypes;
@@ -548,6 +486,102 @@ type AnimatablePropertyParamsOptions = {
composition?: TweenComposition;
};
type AnimatableParams = Record<string, TweenParamValue | EasingParam | TweenModifier | TweenComposition | AnimatablePropertyParamsOptions> & AnimatablePropertyParamsOptions;
+type ReactRef = {
+ current?: HTMLElement | SVGElement | null;
+};
+type AngularRef = {
+ nativeElement?: HTMLElement | SVGElement;
+};
+type ScopeParams = {
+ root?: DOMTargetSelector | ReactRef | AngularRef;
+ defaults?: DefaultsParams;
+ mediaQueries?: Record<string, string>;
+};
+type ScopedCallback<T> = (scope: Scope) => T;
+type ScopeCleanupCallback = (scope?: Scope) => any;
+type ScopeConstructorCallback = (scope?: Scope) => ScopeCleanupCallback | void;
+type ScopeMethod = (...args: any[]) => ScopeCleanupCallback | void;
+type DraggableAxisParam = {
+ mapTo?: string;
+ modifier?: TweenModifier;
+ composition?: TweenComposition;
+ snap?: number | number[] | ((draggable: Draggable) => number | Array<number>);
+};
+type DraggableCursorParams = {
+ onHover?: string;
+ onGrab?: string;
+};
+type DraggableParams = {
+ trigger?: DOMTargetSelector;
+ container?: number[] | DOMTargetSelector | ((draggable: Draggable) => DOMTargetSelector | Array<number>);
+ x?: boolean | DraggableAxisParam;
+ y?: boolean | DraggableAxisParam;
+ modifier?: TweenModifier;
+ snap?: number | number[] | ((draggable: Draggable) => number | Array<number>);
+ containerPadding?: number | number[] | ((draggable: Draggable) => number | Array<number>);
+ containerFriction?: number | ((draggable: Draggable) => number);
+ releaseContainerFriction?: number | ((draggable: Draggable) => number);
+ dragSpeed?: number | ((draggable: Draggable) => number);
+ scrollSpeed?: number | ((draggable: Draggable) => number);
+ scrollThreshold?: number | ((draggable: Draggable) => number);
+ minVelocity?: number | ((draggable: Draggable) => number);
+ maxVelocity?: number | ((draggable: Draggable) => number);
+ velocityMultiplier?: number | ((draggable: Draggable) => number);
+ releaseMass?: number;
+ releaseStiffness?: number;
+ releaseDamping?: number;
+ releaseEase?: EasingParam;
+ cursor?: boolean | DraggableCursorParams | ((draggable: Draggable) => boolean | DraggableCursorParams);
+ onGrab?: Callback<Draggable>;
+ onDrag?: Callback<Draggable>;
+ onRelease?: Callback<Draggable>;
+ onUpdate?: Callback<Draggable>;
+ onSettle?: Callback<Draggable>;
+ onSnap?: Callback<Draggable>;
+ onResize?: Callback<Draggable>;
+ onAfterResize?: Callback<Draggable>;
+};
+type splitTemplateParams = {
+ class?: false | string;
+ wrap?: boolean | 'hidden' | 'clip' | 'visible' | 'scroll' | 'auto';
+ clone?: boolean | 'top' | 'right' | 'bottom' | 'left' | 'center';
+};
+type SplitValue = boolean | string;
+type SplitFunctionValue = (value?: Node | HTMLElement) => any;
+type TextSplitterParams = {
+ lines?: SplitValue | splitTemplateParams | SplitFunctionValue;
+ words?: SplitValue | splitTemplateParams | SplitFunctionValue;
+ chars?: SplitValue | splitTemplateParams | SplitFunctionValue;
+ accessible?: boolean;
+ includeSpaces?: boolean;
+ debug?: boolean;
+};
+type DrawableSVGGeometry = SVGGeometryElement & {
+ setAttribute(name: 'draw', value: `${number} ${number}`): void;
+ draw: `${number} ${number}`;
+};
+declare class Timeline extends Timer {
+ constructor(parameters?: TimelineParams);
+ labels: Record<string, number>;
+ defaults: DefaultsParams;
+ onRender: Callback<this>;
+ _ease: EasingFunction;
+ add(a1: TargetsParam, a2: AnimationParams, a3?: TimePosition): this;
+ add(a1: TimerParams, a2?: TimePosition): this;
+ sync(synced?: Tickable, position?: TimePosition): this;
+ sync(synced?: globalThis.Animation, position?: TimePosition): this;
+ sync(synced?: WAAPIAnimation, position?: TimePosition): this;
+ set(targets: TargetsParam, parameters: AnimationParams, position?: TimePosition): this;
+ call(callback: Callback<Timer>, position?: TimePosition): this;
+ label(labelName: string, position?: TimePosition): this;
+ remove(targets: TargetsParam, propertyName?: string): this;
+ stretch(newDuration: number): this;
+ refresh(): this;
+ revert(): this;
+ then(callback?: Callback<this>): Promise<any>;
+}
+declare function createTimeline(parameters?: TimelineParams): Timeline;
+type TimePosition = number | string | Function;
declare class Draggable {
constructor(target: TargetsParam, parameters?: DraggableParams);
containerArray: number[];
@@ -759,35 +793,29 @@ declare class Scope {
constructor(parameters?: ScopeParams);
defaults: DefaultsParams;
root: Document | DOMTarget;
- constructors: Array<ScopeConstructor>;
- revertConstructors: Array<Function>;
+ constructors: Array<ScopeConstructorCallback>;
+ revertConstructors: Array<ScopeCleanupCallback>;
revertibles: Array<Revertible>;
- methods: Record<string, Function>;
+ constructorsOnce: (ScopeConstructorCallback | ((scope: this) => Tickable))[];
+ revertConstructorsOnce: Array<ScopeCleanupCallback>;
+ revertiblesOnce: Array<Revertible>;
+ once: boolean;
+ onceIndex: number;
+ methods: Record<string, ScopeMethod>;
matches: Record<string, boolean>;
mediaQueryLists: Record<string, MediaQueryList>;
data: Record<string, any>;
- execute(cb: (scope: this) => any): this;
+ register(revertible: Revertible): void;
+ execute<T>(cb: ScopedCallback<T>): T;
refresh(): this;
add(a1: string, a2: ScopeMethod): this;
- add(a1: (self: this) => any): this;
+ add(a1: ScopeConstructorCallback): this;
+ addOnce(scopeConstructorCallback: ScopeConstructorCallback): this;
+ keepTime(cb: (scope: this) => Tickable): Tickable;
handleEvent(e: Event): void;
revert(): void;
}
declare function createScope(params?: ScopeParams): Scope;
-type ReactRef = {
- current?: HTMLElement | SVGElement | null;
-};
-type AngularRef = {
- nativeElement?: HTMLElement | SVGElement;
-};
-type ScopeParams = {
- root?: DOMTargetSelector | ReactRef | AngularRef;
- defaults?: DefaultsParams;
- mediaQueries?: Record<string, string>;
-};
-type ScopeCleanup = (scope?: Scope) => any;
-type ScopeConstructor = (scope?: Scope) => ScopeCleanup | void;
-type ScopeMethod = (...args: any[]) => ScopeCleanup | void;
declare const scrollContainers: Map<any, any>;
declare class ScrollObserver {
constructor(parameters?: ScrollObserverParams);
@@ -1020,4 +1048,35 @@ type WAAPIAnimationOptions = {
};
type WAAPIAnimationParams = Record<string, WAAPIKeyframeValue | WAAPIAnimationOptions | boolean | ScrollObserver | WAAPICallback | EasingParam | WAAPITweenOptions> & WAAPIAnimationOptions;
declare function easingToLinear(fn: EasingFunction, samples?: number): string;
-export { engine, utils, svg, stagger, eases, DefaultsParams, Renderable, Tickable, CallbackArgument, Revertible, DraggableAxisParam, DraggableCursorParams, DraggableParams, DrawableSVGGeometry, EasingFunction, EaseStringParamNames, EasingParam, DOMTarget, JSTarget, Target, TargetSelector, DOMTargetSelector, DOMTargetsParam, DOMTargetsArray, JSTargetsParam, JSTargetsArray, TargetsParam, TargetsArray, FunctionValue, TweenModifier, ColorArray, Callback, TickableCallbacks, RenderableCallbacks, Tween, TweenDecomposedValue, TweenPropertySiblings, TweenLookups, TweenReplaceLookups, TweenAdditiveLookups, TimerOptions, TimerParams, TweenParamValue, TweenPropValue, TweenComposition, TweenParamsOptions, TweenValues, TweenKeyValue, ArraySyntaxValue, TweenOptions, TweenObjectValue, PercentageKeyframeOptions, PercentageKeyframeParams, PercentageKeyframes, DurationKeyframes, AnimationOptions, AnimationParams, TimelineOptions, TimelineParams, AnimatablePropertySetter, AnimatablePropertyGetter, AnimatableProperty, AnimatableObject, AnimatablePropertyParamsOptions, AnimatableParams, createTimer, Timer, animate, JSAnimation, createTimeline, Timeline, createAnimatable, Animatable, createDraggable, Draggable, createScope, Scope, onScroll, ScrollObserver, scrollContainers, createSpring, Spring, waapi, WAAPIAnimation };
+declare class TextSplitter {
+ constructor(target: HTMLElement | NodeList | string | Array<HTMLElement>, parameters?: TextSplitterParams);
+ debug: boolean;
+ includeSpaces: boolean;
+ accessible: boolean;
+ linesOnly: boolean;
+ lineTemplate: string | false | SplitFunctionValue;
+ wordTemplate: string | false | SplitFunctionValue;
+ charTemplate: string | false | SplitFunctionValue;
+ $target: HTMLElement;
+ html: string;
+ lines: any[];
+ words: any[];
+ chars: any[];
+ effects: any[];
+ effectsCleanups: any[];
+ cache: string;
+ ready: boolean;
+ width: number;
+ resizeTimeout: NodeJS.Timeout;
+ resizeObserver: ResizeObserver;
+ addEffect(effect: (...args: any[]) => Tickable | (() => void)): void | this;
+ revert(): this;
+ splitNode(node: Node): void;
+ split(clearCache?: boolean): this;
+ refresh(): void;
+}
+declare function split(target: HTMLElement | NodeList | string | Array<HTMLElement>, parameters?: TextSplitterParams): TextSplitter;
+declare namespace text {
+ export { split };
+}
+export { engine, utils, svg, stagger, eases, DefaultsParams, Renderable, Tickable, CallbackArgument, Revertible, StaggerFunction, StaggerParams, EasingFunction, EaseStringParamNames, EasingParam, DOMTarget, JSTarget, Target, TargetSelector, DOMTargetSelector, DOMTargetsParam, DOMTargetsArray, JSTargetsParam, JSTargetsArray, TargetsParam, TargetsArray, Callback, TickableCallbacks, RenderableCallbacks, TimerOptions, TimerParams, FunctionValue, TweenModifier, ColorArray, Tween, TweenDecomposedValue, TweenPropertySiblings, TweenLookups, TweenReplaceLookups, TweenAdditiveLookups, TweenParamValue, TweenPropValue, TweenComposition, TweenParamsOptions, TweenValues, TweenKeyValue, ArraySyntaxValue, TweenOptions, TweenObjectValue, PercentageKeyframeOptions, PercentageKeyframeParams, PercentageKeyframes, DurationKeyframes, AnimationOptions, AnimationParams, TimelineOptions, TimelineParams, AnimatablePropertySetter, AnimatablePropertyGetter, AnimatableProperty, AnimatableObject, AnimatablePropertyParamsOptions, AnimatableParams, ReactRef, AngularRef, ScopeParams, ScopedCallback, ScopeCleanupCallback, ScopeConstructorCallback, ScopeMethod, DraggableAxisParam, DraggableCursorParams, DraggableParams, splitTemplateParams, SplitValue, SplitFunctionValue, TextSplitterParams, DrawableSVGGeometry, createTimer, Timer, animate, JSAnimation, createTimeline, Timeline, createAnimatable, Animatable, createDraggable, Draggable, createScope, Scope, onScroll, ScrollObserver, scrollContainers, createSpring, Spring, waapi, WAAPIAnimation, text, TextSplitter };
diff --git a/types/index.js b/types/index.js
index 64d8d92d..48d530ca 100644
--- a/types/index.js
+++ b/types/index.js
@@ -1,6 +1,6 @@
/**
* anime.js - ESM
- * @version v4.0.2
+ * @version v4.1.0
* @author Julian Garnier
* @license MIT
* @copyright (c) 2025 Julian Garnier
@@ -56,10 +56,13 @@ const K = 1e3;
const maxFps = 120;
// Strings
const emptyString = '';
-const shortTransforms = new Map();
-shortTransforms.set('x', 'translateX');
-shortTransforms.set('y', 'translateY');
-shortTransforms.set('z', 'translateZ');
+const shortTransforms = /*#__PURE__*/ (() => {
+ const map = new Map();
+ map.set('x', 'translateX');
+ map.set('y', 'translateY');
+ map.set('z', 'translateZ');
+ return map;
+})();
const validTransforms = [
'translateX',
'translateY',
@@ -79,7 +82,7 @@ const validTransforms = [
'matrix',
'matrix3d',
];
-const transformsFragmentStrings = validTransforms.reduce((a, v) => ({ ...a, [v]: v + '(' }), {});
+const transformsFragmentStrings = /*#__PURE__*/ validTransforms.reduce((a, v) => ({ ...a, [v]: v + '(' }), {});
// Functions
/** @return {void} */
const noop = () => { };
@@ -123,13 +126,15 @@ const defaults = {
onComplete: noop,
onRender: noop,
};
+const scope = {
+ /** @type {Scope} */
+ current: null,
+ /** @type {Document|DOMTarget} */
+ root: doc,
+};
const globals = {
/** @type {DefaultsParams} */
defaults,
- /** @type {Document|DOMTarget} */
- root: doc,
- /** @type {Scope} */
- scope: null,
/** @type {Number} */
precision: 4,
/** @type {Number} */
@@ -137,7 +142,7 @@ const globals = {
/** @type {Number} */
tickThreshold: 200,
};
-const globalVersions = { version: '4.0.2', engine: null };
+const globalVersions = { version: '4.1.0', engine: null };
if (isBrowser) {
if (!win.AnimeJS)
win.AnimeJS = [];
@@ -244,6 +249,28 @@ const snap = (v, increment) => isArr(increment) ? increment.reduce((closest, cv)
* @return {Number}
*/
const interpolate = (start, end, progress) => start + (end - start) * progress;
+/**
+ * @param {Number} min
+ * @param {Number} max
+ * @param {Number} [decimalLength]
+ * @return {Number}
+ */
+const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength || 0); return floor((Math.random() * (max - min + (1 / m)) + min) * m) / m; };
+/**
+ * Adapted from https://bost.ocks.org/mike/shuffle/
+ * @param {Array} items
+ * @return {Array}
+ */
+const shuffle = items => {
+ let m = items.length, t, i;
+ while (m) {
+ i = random(0, --m);
+ t = items[m];
+ items[m] = items[i];
+ items[i] = t;
+ }
+ return items;
+};
/**
* @param {Number} v
* @return {Number}
@@ -332,6 +359,32 @@ const addChild = (parent, child, sortMethod, prevProp = '_prev', nextProp = '_ne
child[prevProp] = prev;
child[nextProp] = next;
};
+/**
+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor
+ * @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}
+ */
+const createRefreshable = constructor => {
+ /** @type {Tickable} */
+ let tracked;
+ return (...args) => {
+ let currentIteration, currentIterationProgress, reversed, alternate;
+ if (tracked) {
+ currentIteration = tracked.currentIteration;
+ currentIterationProgress = tracked.iterationProgress;
+ reversed = tracked.reversed;
+ alternate = tracked._alternate;
+ tracked.revert();
+ }
+ const cleanup = constructor(...args);
+ if (cleanup && !isFnc(cleanup) && cleanup.revert)
+ tracked = cleanup;
+ if (!isUnd(currentIterationProgress)) {
+ /** @type {Tickable} */ (tracked).currentIteration = currentIteration;
+ /** @type {Tickable} */ (tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;
+ }
+ return cleanup || noop;
+ };
+};
/*
* Base class to control framerate and playback rate.
@@ -801,8 +854,8 @@ const addAdditiveAnimation = lookups => {
return animation;
};
-const engineTickMethod = isBrowser ? requestAnimationFrame : setImmediate;
-const engineCancelMethod = isBrowser ? cancelAnimationFrame : clearImmediate;
+const engineTickMethod = /*#__PURE__*/ (() => isBrowser ? requestAnimationFrame : setImmediate)();
+const engineCancelMethod = /*#__PURE__*/ (() => isBrowser ? cancelAnimationFrame : clearImmediate)();
class Engine extends Clock {
/** @param {Number} [initTime] */
constructor(initTime) {
@@ -958,7 +1011,7 @@ const parseInlineTransforms = (target, propName, animationInlineStyles) => {
* @return {NodeList|HTMLCollection}
*/
function getNodeList(v) {
- const n = isStr(v) ? globals.root.querySelectorAll(v) : v;
+ const n = isStr(v) ? scope.root.querySelectorAll(v) : v;
if (n instanceof NodeList || n instanceof HTMLCollection)
return n;
}
@@ -1803,8 +1856,8 @@ class Timer extends Clock {
constructor(parameters = {}, parent = null, parentPosition = 0) {
super(0);
const { id, delay, duration, reversed, alternate, loop, loopDelay, autoplay, frameRate, playbackRate, onComplete, onLoop, onPause, onBegin, onBeforeUpdate, onUpdate, } = parameters;
- if (globals.scope)
- globals.scope.revertibles.push(this);
+ if (scope.current)
+ scope.current.register(this);
const timerInitTime = parent ? 0 : engine._elapsedTime;
const timerDefaults = parent ? parent.defaults : globals.defaults;
const timerDelay = /** @type {Number} */ (isFnc(delay) || isUnd(delay) ? timerDefaults.delay : +delay);
@@ -1924,14 +1977,14 @@ class Timer extends Clock {
this.currentTime = (this.iterationDuration * this._currentIteration) + time;
}
get progress() {
- return clamp(round(this._currentTime / this.duration, 5), 0, 1);
+ return clamp(round(this._currentTime / this.duration, 10), 0, 1);
}
/** @param {Number} progress */
set progress(progress) {
this.currentTime = this.duration * progress;
}
get iterationProgress() {
- return clamp(round(this._iterationTime / this.iterationDuration, 5), 0, 1);
+ return clamp(round(this._iterationTime / this.iterationDuration, 10), 0, 1);
}
/** @param {Number} progress */
set iterationProgress(progress) {
@@ -3090,12 +3143,13 @@ class JSAnimation extends Timer {
*/
refresh() {
forEachChildren(this, (/** @type {Tween} */ tween) => {
- const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
- decomposeRawValue(ogValue, decomposedOriginalValue);
- tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
- tween._fromNumber = decomposedOriginalValue.n;
- if (tween._func) {
- decomposeRawValue(tween._func(), toTargetObject);
+ const tweenFunc = tween._func;
+ if (tweenFunc) {
+ const ogValue = getOriginalAnimatableValue(tween.target, tween.property, tween._tweenType);
+ decomposeRawValue(ogValue, decomposedOriginalValue);
+ decomposeRawValue(tweenFunc(), toTargetObject);
+ tween._fromNumbers = cloneArray(decomposedOriginalValue.d);
+ tween._fromNumber = decomposedOriginalValue.n;
tween._toNumbers = cloneArray(toTargetObject.d);
tween._strings = cloneArray(toTargetObject.s);
tween._toNumber = toTargetObject.n;
@@ -3243,31 +3297,8 @@ const commonDefaultPXProperties = [
'borderRadius',
...transformsShorthands
];
-const validIndividualTransforms = [...transformsShorthands, ...validTransforms.filter(t => ['X', 'Y', 'Z'].some(axis => t.endsWith(axis)))];
-// Setting it to true in case CSS.registerProperty is not supported will automatically skip the registration and fallback to no animation
-let transformsPropertiesRegistered = isBrowser && (isUnd(CSS) || !Object.hasOwnProperty.call(CSS, 'registerProperty'));
-const registerTransformsProperties = () => {
- if (transformsPropertiesRegistered)
- return;
- validTransforms.forEach(t => {
- const isSkew = stringStartsWith(t, 'skew');
- const isScale = stringStartsWith(t, 'scale');
- const isRotate = stringStartsWith(t, 'rotate');
- const isTranslate = stringStartsWith(t, 'translate');
- const isAngle = isRotate || isSkew;
- const syntax = isAngle ? '<angle>' : isScale ? "<number>" : isTranslate ? "<length-percentage>" : "*";
- try {
- CSS.registerProperty({
- name: '--' + t,
- syntax,
- inherits: false,
- initialValue: isTranslate ? '0px' : isAngle ? '0deg' : isScale ? '1' : '0',
- });
- }
- catch { }
- });
- transformsPropertiesRegistered = true;
-};
+const validIndividualTransforms = /*#__PURE__*/ (() => [...transformsShorthands, ...validTransforms.filter(t => ['X', 'Y', 'Z'].some(axis => t.endsWith(axis)))])();
+let transformsPropertiesRegistered = null;
const WAAPIAnimationsLookups = {
_head: null,
_tail: null,
@@ -3380,9 +3411,34 @@ class WAAPIAnimation {
* @param {WAAPIAnimationParams} params
*/
constructor(targets, params) {
- if (globals.scope)
- globals.scope.revertibles.push(this);
- registerTransformsProperties();
+ if (scope.current)
+ scope.current.register(this);
+ // Skip the registration and fallback to no animation in case CSS.registerProperty is not supported
+ if (isNil(transformsPropertiesRegistered)) {
+ if (isBrowser && (isUnd(CSS) || !Object.hasOwnProperty.call(CSS, 'registerProperty'))) {
+ transformsPropertiesRegistered = false;
+ }
+ else {
+ validTransforms.forEach(t => {
+ const isSkew = stringStartsWith(t, 'skew');
+ const isScale = stringStartsWith(t, 'scale');
+ const isRotate = stringStartsWith(t, 'rotate');
+ const isTranslate = stringStartsWith(t, 'translate');
+ const isAngle = isRotate || isSkew;
+ const syntax = isAngle ? '<angle>' : isScale ? "<number>" : isTranslate ? "<length-percentage>" : "*";
+ try {
+ CSS.registerProperty({
+ name: '--' + t,
+ syntax,
+ inherits: false,
+ initialValue: isTranslate ? '0px' : isAngle ? '0deg' : isScale ? '1' : '0',
+ });
+ }
+ catch { }
+ });
+ transformsPropertiesRegistered = true;
+ }
+ }
const parsedTargets = registerTargets(targets);
const targetsLength = parsedTargets.length;
if (!targetsLength) {
@@ -3815,32 +3871,15 @@ const remove = (targets, renderable, propertyName) => {
return targetsArray;
};
/**
- * @param {Number} min
- * @param {Number} max
- * @param {Number} [decimalLength]
- * @return {Number}
+ * @param {(...args: any[]) => Tickable} constructor
+ * @return {(...args: any[]) => Tickable}
*/
-const random = (min, max, decimalLength) => { const m = 10 ** (decimalLength || 0); return floor((Math.random() * (max - min + (1 / m)) + min) * m) / m; };
+const keepTime = createRefreshable;
/**
* @param {String|Array} items
* @return {any}
*/
const randomPick = items => items[random(0, items.length - 1)];
-/**
- * Adapted from https://bost.ocks.org/mike/shuffle/
- * @param {Array} items
- * @return {Array}
- */
-const shuffle = items => {
- let m = items.length, t, i;
- while (m) {
- i = random(0, --m);
- t = items[m];
- items[m] = items[i];
- items[i] = t;
- }
- return items;
-};
/**
* @param {Number|String} v
* @param {Number} decimalLength
@@ -4021,6 +4060,7 @@ const utils = {
shuffle,
lerp,
sync,
+ keepTime,
clamp: /** @type {typeof clamp & ChainedClamp} */ (makeChainable(clamp)),
round: /** @type {typeof round & ChainedRound} */ (makeChainable(round)),
snap: /** @type {typeof snap & ChainedSnap} */ (makeChainable(snap)),
@@ -4340,8 +4380,8 @@ class Animatable {
* @param {AnimatableParams} parameters
*/
constructor(targets, parameters) {
- if (globals.scope)
- globals.scope.revertibles.push(this);
+ if (scope.current)
+ scope.current.register(this);
/** @type {AnimationParams} */
const globalParams = {};
const properties = {};
@@ -4665,8 +4705,8 @@ class Draggable {
constructor(target, parameters = {}) {
if (!target)
return;
- if (globals.scope)
- globals.scope.revertibles.push(this);
+ if (scope.current)
+ scope.current.register(this);
const paramX = parameters.x;
const paramY = parameters.y;
const trigger = parameters.trigger;
@@ -5696,39 +5736,11 @@ class Draggable {
const createDraggable = (target, parameters) => new Draggable(target, parameters);
-/**
- * @typedef {Object} ReactRef
- * @property {HTMLElement|SVGElement|null} [current]
- */
-/**
- * @typedef {Object} AngularRef
- * @property {HTMLElement|SVGElement} [nativeElement]
- */
-/**
- * @typedef {Object} ScopeParams
- * @property {DOMTargetSelector|ReactRef|AngularRef} [root]
- * @property {DefaultsParams} [defaults]
- * @property {Record<String, String>} [mediaQueries]
- */
-/**
- * @callback ScopeCleanup
- * @param {Scope} [scope]
- */
-/**
- * @callback ScopeConstructor
- * @param {Scope} [scope]
- * @return {ScopeCleanup|void}
- */
-/**
- * @callback ScopeMethod
- * @param {...*} args
- * @return {ScopeCleanup|void}
- */
class Scope {
/** @param {ScopeParams} [parameters] */
constructor(parameters = {}) {
- if (globals.scope)
- globals.scope.revertibles.push(this);
+ if (scope.current)
+ scope.current.register(this);
const rootParam = parameters.root;
/** @type {Document|DOMTarget} */
let root = doc;
@@ -5745,13 +5757,23 @@ class Scope {
this.defaults = scopeDefaults ? mergeObjects(scopeDefaults, globalDefault) : globalDefault;
/** @type {Document|DOMTarget} */
this.root = root;
- /** @type {Array<ScopeConstructor>} */
+ /** @type {Array<ScopeConstructorCallback>} */
this.constructors = [];
- /** @type {Array<Function>} */
+ /** @type {Array<ScopeCleanupCallback>} */
this.revertConstructors = [];
/** @type {Array<Revertible>} */
this.revertibles = [];
- /** @type {Record<String, Function>} */
+ /** @type {Array<ScopeConstructorCallback | ((scope: this) => Tickable)>} */
+ this.constructorsOnce = [];
+ /** @type {Array<ScopeCleanupCallback>} */
+ this.revertConstructorsOnce = [];
+ /** @type {Array<Revertible>} */
+ this.revertiblesOnce = [];
+ /** @type {Boolean} */
+ this.once = false;
+ /** @type {Number} */
+ this.onceIndex = 0;
+ /** @type {Record<String, ScopeMethod>} */
this.methods = {};
/** @type {Record<String, Boolean>} */
this.matches = {};
@@ -5768,26 +5790,30 @@ class Scope {
}
}
/**
- * @callback ScoppedCallback
- * @param {this} scope
- * @return {any}
- *
- * @param {ScoppedCallback} cb
- * @return {this}
+ * @param {Revertible} revertible
+ */
+ register(revertible) {
+ const store = this.once ? this.revertiblesOnce : this.revertibles;
+ store.push(revertible);
+ }
+ /**
+ * @template T
+ * @param {ScopedCallback<T>} cb
+ * @return {T}
*/
execute(cb) {
- let activeScope = globals.scope;
- let activeRoot = globals.root;
+ let activeScope = scope.current;
+ let activeRoot = scope.root;
let activeDefaults = globals.defaults;
- globals.scope = this;
- globals.root = this.root;
+ scope.current = this;
+ scope.root = this.root;
globals.defaults = this.defaults;
const mqs = this.mediaQueryLists;
for (let mq in mqs)
this.matches[mq] = mqs[mq].matches;
const returned = cb(this);
- globals.scope = activeScope;
- globals.root = activeRoot;
+ scope.current = activeScope;
+ scope.root = activeRoot;
globals.defaults = activeDefaults;
return returned;
}
@@ -5795,6 +5821,7 @@ class Scope {
* @return {this}
*/
refresh() {
+ this.onceIndex = 0;
this.execute(() => {
let i = this.revertibles.length;
let y = this.revertConstructors.length;
@@ -5804,9 +5831,9 @@ class Scope {
this.revertConstructors[y](this);
this.revertibles.length = 0;
this.revertConstructors.length = 0;
- this.constructors.forEach(constructor => {
+ this.constructors.forEach((/** @type {ScopeConstructorCallback} */ constructor) => {
const revertConstructor = constructor(this);
- if (revertConstructor) {
+ if (isFnc(revertConstructor)) {
this.revertConstructors.push(revertConstructor);
}
});
@@ -5814,28 +5841,26 @@ class Scope {
return this;
}
/**
- * @callback contructorCallback
- * @param {this} self
- *
* @overload
* @param {String} a1
* @param {ScopeMethod} a2
* @return {this}
*
* @overload
- * @param {contructorCallback} a1
+ * @param {ScopeConstructorCallback} a1
* @return {this}
*
- * @param {String|contructorCallback} a1
+ * @param {String|ScopeConstructorCallback} a1
* @param {ScopeMethod} [a2]
*/
add(a1, a2) {
+ this.once = false;
if (isFnc(a1)) {
- const constructor = /** @type {contructorCallback} */ (a1);
+ const constructor = /** @type {ScopeConstructorCallback} */ (a1);
this.constructors.push(constructor);
this.execute(() => {
const revertConstructor = constructor(this);
- if (revertConstructor) {
+ if (isFnc(revertConstructor)) {
this.revertConstructors.push(revertConstructor);
}
});
@@ -5845,6 +5870,46 @@ class Scope {
}
return this;
}
+ /**
+ * @param {ScopeConstructorCallback} scopeConstructorCallback
+ * @return {this}
+ */
+ addOnce(scopeConstructorCallback) {
+ this.once = true;
+ if (isFnc(scopeConstructorCallback)) {
+ const currentIndex = this.onceIndex++;
+ const tracked = this.constructorsOnce[currentIndex];
+ if (tracked)
+ return this;
+ const constructor = /** @type {ScopeConstructorCallback} */ (scopeConstructorCallback);
+ this.constructorsOnce[currentIndex] = constructor;
+ this.execute(() => {
+ const revertConstructor = constructor(this);
+ if (isFnc(revertConstructor)) {
+ this.revertConstructorsOnce.push(revertConstructor);
+ }
+ });
+ }
+ return this;
+ }
+ /**
+ * @param {(scope: this) => Tickable} cb
+ * @return {Tickable}
+ */
+ keepTime(cb) {
+ this.once = true;
+ const currentIndex = this.onceIndex++;
+ const tracked = /** @type {(scope: this) => Tickable} */ (this.constructorsOnce[currentIndex]);
+ if (isFnc(tracked))
+ return tracked(this);
+ const constructor = /** @type {(scope: this) => Tickable} */ (createRefreshable(cb));
+ this.constructorsOnce[currentIndex] = constructor;
+ let trackedTickable;
+ this.execute(() => {
+ trackedTickable = constructor(this);
+ });
+ return trackedTickable;
+ }
/**
* @param {Event} e
*/
@@ -5858,18 +5923,30 @@ class Scope {
revert() {
const revertibles = this.revertibles;
const revertConstructors = this.revertConstructors;
+ const revertiblesOnce = this.revertiblesOnce;
+ const revertConstructorsOnce = this.revertConstructorsOnce;
const mqs = this.mediaQueryLists;
let i = revertibles.length;
- let y = revertConstructors.length;
+ let j = revertConstructors.length;
+ let k = revertiblesOnce.length;
+ let l = revertConstructorsOnce.length;
while (i--)
revertibles[i].revert();
- while (y--)
- revertConstructors[y](this);
+ while (j--)
+ revertConstructors[j](this);
+ while (k--)
+ revertiblesOnce[k].revert();
+ while (l--)
+ revertConstructorsOnce[l](this);
for (let mq in mqs)
mqs[mq].removeEventListener('change', this);
revertibles.length = 0;
revertConstructors.length = 0;
this.constructors.length = 0;
+ revertiblesOnce.length = 0;
+ revertConstructorsOnce.length = 0;
+ this.constructorsOnce.length = 0;
+ this.onceIndex = 0;
this.matches = {};
this.methods = {};
this.mediaQueryLists = {};
@@ -6186,7 +6263,7 @@ const getAnimationDomTarget = linked => {
return $linkedTarget;
};
let scrollerIndex = 0;
-const debugColors = ['#FF4B4B', '#FF971B', '#FFC730', '#F9F640', '#7AFF5A', '#18FF74', '#17E09B', '#3CFFEC', '#05DBE9', '#33B3F1', '#638CF9', '#C563FE', '#FF4FCF', '#F93F8A'];
+const debugColors$1 = ['#FF4B4B', '#FF971B', '#FFC730', '#F9F640', '#7AFF5A', '#18FF74', '#17E09B', '#3CFFEC', '#05DBE9', '#33B3F1', '#638CF9', '#C563FE', '#FF4FCF', '#F93F8A'];
/**
* @typedef {Object} ScrollThresholdParam
* @property {ScrollThresholdValue} [target]
@@ -6227,8 +6304,8 @@ class ScrollObserver {
* @param {ScrollObserverParams} parameters
*/
constructor(parameters = {}) {
- if (globals.scope)
- globals.scope.revertibles.push(this);
+ if (scope.current)
+ scope.current.register(this);
const syncMode = setValue(parameters.sync, 'play pause');
const ease = syncMode ? parseEasings(/** @type {EasingParam} */ (syncMode)) : null;
const isLinear = syncMode && (syncMode === 'linear' || syncMode === none);
@@ -6418,7 +6495,7 @@ class ScrollObserver {
const $debug = doc.createElement('div');
const $thresholds = doc.createElement('div');
const $triggers = doc.createElement('div');
- const color = debugColors[this.index % debugColors.length];
+ const color = debugColors$1[this.index % debugColors$1.length];
const useWin = container.useWin;
const containerWidth = useWin ? container.winWidth : container.width;
const containerHeight = useWin ? container.winHeight : container.height;
@@ -6771,27 +6848,474 @@ class ScrollObserver {
const onScroll = (parameters = {}) => new ScrollObserver(parameters);
+const segmenter = !isUnd(Intl) && Intl.Segmenter;
+const valueRgx = /\{value\}/g;
+const indexRgx = /\{i\}/g;
+const whiteSpaceGroupRgx = /(\s+)/;
+const whiteSpaceRgx = /^\s+$/;
+const lineType = 'line';
+const wordType = 'word';
+const charType = 'char';
+const dataLine = `data-line`;
+/**
+ * @typedef {Object} Segment
+ * @property {String} segment
+ * @property {Boolean} [isWordLike]
+ */
+/**
+ * @typedef {Object} Segmenter
+ * @property {function(String): Iterable<Segment>} segment
+ */
+/** @type {Segmenter} */
+let wordSegmenter = null;
+/** @type {Segmenter} */
+let graphemeSegmenter = null;
+let $splitTemplate = null;
+/**
+ * @param {Segment} seg
+ * @return {Boolean}
+ */
+const isSegmentWordLike = seg => {
+ return seg.isWordLike ||
+ seg.segment === ' ' || // Consider spaces as words first, then handle them diffrently later
+ isNum(+seg.segment); // Safari doesn't considers numbers as words
+};
/**
- * @typedef {Object} StaggerParameters
- * @property {Number|String} [start]
- * @property {Number|'first'|'center'|'last'} [from]
- * @property {Boolean} [reversed]
- * @property {Array.<Number>} [grid]
- * @property {('x'|'y')} [axis]
- * @property {EasingParam} [ease]
- * @property {TweenModifier} [modifier]
+ * @param {HTMLElement} $el
*/
+const setAriaHidden = $el => $el.setAttribute('aria-hidden', 'true');
/**
- * @callback StaggerFunction
- * @param {Target} [target]
- * @param {Number} [index]
- * @param {Number} [length]
- * @param {Timeline} [tl]
- * @return {Number|String}
+ * @param {DOMTarget} $el
+ * @param {String} type
+ * @return {Array<HTMLElement>}
+ */
+const getAllTopLevelElements = ($el, type) => [... /** @type {*} */($el.querySelectorAll(`[data-${type}]:not([data-${type}] [data-${type}])`))];
+const debugColors = { line: '#00D672', word: '#FF4B4B', char: '#5A87FF' };
+/**
+ * @param {HTMLElement} $el
+ */
+const filterEmptyElements = $el => {
+ if (!$el.childElementCount && !$el.textContent.trim()) {
+ const $parent = $el.parentElement;
+ $el.remove();
+ if ($parent)
+ filterEmptyElements($parent);
+ }
+};
+/**
+ * @param {HTMLElement} $el
+ * @param {Number} lineIndex
+ * @param {Set<HTMLElement>} bin
+ * @returns {Set<HTMLElement>}
+ */
+const filterLineElements = ($el, lineIndex, bin) => {
+ const dataLineAttr = $el.getAttribute(dataLine);
+ if (dataLineAttr !== null && +dataLineAttr !== lineIndex || $el.tagName === 'BR')
+ bin.add($el);
+ let i = $el.childElementCount;
+ while (i--)
+ filterLineElements(/** @type {HTMLElement} */ ($el.children[i]), lineIndex, bin);
+ return bin;
+};
+/**
+ * @param {'line'|'word'|'char'} type
+ * @param {splitTemplateParams} params
+ * @return {String}
+ */
+const generateTemplate = (type, params = {}) => {
+ let template = ``;
+ const classString = isStr(params.class) ? ` class="${params.class}"` : '';
+ const cloneType = setValue(params.clone, false);
+ const wrapType = setValue(params.wrap, false);
+ const overflow = wrapType ? wrapType === true ? 'clip' : wrapType : cloneType ? 'clip' : false;
+ if (wrapType)
+ template += `<span${overflow ? ` style="overflow:${overflow};"` : ''}>`;
+ template += `<span${classString}${cloneType ? ` style="position:relative;"` : ''} data-${type}="{i}">`;
+ if (cloneType) {
+ const left = cloneType === 'left' ? '-100%' : cloneType === 'right' ? '100%' : '0';
+ const top = cloneType === 'top' ? '-100%' : cloneType === 'bottom' ? '100%' : '0';
+ template += `<span>{value}</span>`;
+ template += `<span inert style="position:absolute;top:${top};left:${left};white-space:nowrap;">{value}</span>`;
+ }
+ else {
+ template += `{value}`;
+ }
+ template += `</span>`;
+ if (wrapType)
+ template += `</span>`;
+ return template;
+};
+/**
+ * @param {String|SplitFunctionValue} htmlTemplate
+ * @param {Array<HTMLElement>} store
+ * @param {Node|HTMLElement} node
+ * @param {DocumentFragment} $parentFragment
+ * @param {'line'|'word'|'char'} type
+ * @param {Boolean} debug
+ * @param {Number} lineIndex
+ * @param {Number} [wordIndex]
+ * @param {Number} [charIndex]
+ * @return {HTMLElement}
+ */
+const processHTMLTemplate = (htmlTemplate, store, node, $parentFragment, type, debug, lineIndex, wordIndex, charIndex) => {
+ const isLine = type === lineType;
+ const isChar = type === charType;
+ const className = `_${type}_`;
+ const template = isFnc(htmlTemplate) ? htmlTemplate(node) : htmlTemplate;
+ const displayStyle = isLine ? 'block' : 'inline-block';
+ $splitTemplate.innerHTML = template
+ .replace(valueRgx, `<i class="${className}"></i>`)
+ .replace(indexRgx, `${isChar ? charIndex : isLine ? lineIndex : wordIndex}`);
+ const $content = $splitTemplate.content;
+ const $highestParent = /** @type {HTMLElement} */ ($content.firstElementChild);
+ const $split = /** @type {HTMLElement} */ ($content.querySelector(`[data-${type}]`)) || $highestParent;
+ const $replacables = /** @type {NodeListOf<HTMLElement>} */ ($content.querySelectorAll(`i.${className}`));
+ const replacablesLength = $replacables.length;
+ if (replacablesLength) {
+ $highestParent.style.display = displayStyle;
+ $split.style.display = displayStyle;
+ $split.setAttribute(dataLine, `${lineIndex}`);
+ if (!isLine) {
+ $split.setAttribute('data-word', `${wordIndex}`);
+ if (isChar)
+ $split.setAttribute('data-char', `${charIndex}`);
+ }
+ let i = replacablesLength;
+ while (i--) {
+ const $replace = $replacables[i];
+ const $closestParent = $replace.parentElement;
+ $closestParent.style.display = displayStyle;
+ if (isLine) {
+ $closestParent.innerHTML = /** @type {HTMLElement} */ (node).innerHTML;
+ }
+ else {
+ $closestParent.replaceChild(node.cloneNode(true), $replace);
+ }
+ }
+ store.push($split);
+ $parentFragment.appendChild($content);
+ }
+ else {
+ console.warn(`The expression "{value}" is missing from the provided template.`);
+ }
+ if (debug)
+ $highestParent.style.outline = `1px dotted ${debugColors[type]}`;
+ return $highestParent;
+};
+/**
+ * A class that splits text into words and wraps them in span elements while preserving the original HTML structure.
+ * @class
+ */
+class TextSplitter {
+ /**
+ * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target
+ * @param {TextSplitterParams} [parameters]
+ */
+ constructor(target, parameters = {}) {
+ // Only init segmenters when needed
+ if (!wordSegmenter)
+ wordSegmenter = segmenter ? new segmenter([], { granularity: wordType }) : {
+ segment: (text) => {
+ const segments = [];
+ const words = text.split(whiteSpaceGroupRgx);
+ for (let i = 0, l = words.length; i < l; i++) {
+ const segment = words[i];
+ segments.push({
+ segment,
+ isWordLike: !whiteSpaceRgx.test(segment), // Consider non-whitespace as word-like
+ });
+ }
+ return segments;
+ }
+ };
+ if (!graphemeSegmenter)
+ graphemeSegmenter = segmenter ? new segmenter([], { granularity: 'grapheme' }) : {
+ segment: text => [...text].map(char => ({ segment: char }))
+ };
+ if (!$splitTemplate && isBrowser)
+ $splitTemplate = doc.createElement('template');
+ if (scope.current)
+ scope.current.register(this);
+ const { words, chars, lines, accessible, includeSpaces, debug } = parameters;
+ const $target = /** @type {HTMLElement} */ ((target = isArr(target) ? target[0] : target) && /** @type {Node} */ (target).nodeType ? target : (getNodeList(target) || [])[0]);
+ const lineParams = lines === true ? {} : lines;
+ const wordParams = words === true || isUnd(words) ? {} : words;
+ const charParams = chars === true ? {} : chars;
+ this.debug = setValue(debug, false);
+ this.includeSpaces = setValue(includeSpaces, false);
+ this.accessible = setValue(accessible, true);
+ this.linesOnly = lineParams && (!wordParams && !charParams);
+ /** @type {String|false|SplitFunctionValue} */
+ this.lineTemplate = isObj(lineParams) ? generateTemplate(lineType, /** @type {splitTemplateParams} */ (lineParams)) : lineParams;
+ /** @type {String|false|SplitFunctionValue} */
+ this.wordTemplate = isObj(wordParams) || this.linesOnly ? generateTemplate(wordType, /** @type {splitTemplateParams} */ (wordParams)) : wordParams;
+ /** @type {String|false|SplitFunctionValue} */
+ this.charTemplate = isObj(charParams) ? generateTemplate(charType, /** @type {splitTemplateParams} */ (charParams)) : charParams;
+ this.$target = $target;
+ this.html = $target && $target.innerHTML;
+ this.lines = [];
+ this.words = [];
+ this.chars = [];
+ this.effects = [];
+ this.effectsCleanups = [];
+ this.cache = null;
+ this.ready = false;
+ this.width = 0;
+ this.resizeTimeout = null;
+ const handleSplit = () => this.html && (lineParams || wordParams || charParams) && this.split();
+ // Make sure this is declared before calling handleSplit() in case revert() is called inside an effect callback
+ this.resizeObserver = new ResizeObserver(() => {
+ // Use a setTimeout instead of a Timer for better tree shaking
+ clearTimeout(this.resizeTimeout);
+ this.resizeTimeout = setTimeout(() => {
+ const currentWidth = /** @type {HTMLElement} */ ($target).offsetWidth;
+ if (currentWidth === this.width)
+ return;
+ this.width = currentWidth;
+ handleSplit();
+ }, 150);
+ });
+ // Only declare the font ready promise when splitting by lines and not alreay split
+ if (this.lineTemplate && !this.ready) {
+ doc.fonts.ready.then(handleSplit);
+ }
+ else {
+ handleSplit();
+ }
+ $target ? this.resizeObserver.observe($target) : console.warn('No Text Splitter target found.');
+ }
+ /**
+ * @param {(...args: any[]) => Tickable | (() => void)} effect
+ * @return this
+ */
+ addEffect(effect) {
+ if (!isFnc(effect))
+ return console.warn('Effect must return a function.');
+ const refreshableEffect = createRefreshable(effect);
+ this.effects.push(refreshableEffect);
+ if (this.ready)
+ this.effectsCleanups[this.effects.length - 1] = refreshableEffect(this);
+ return this;
+ }
+ revert() {
+ clearTimeout(this.resizeTimeout);
+ this.lines.length = this.words.length = this.chars.length = 0;
+ this.resizeObserver.disconnect();
+ // Make sure to revert the effects after disconnecting the resizeObserver to avoid triggering it in the process
+ this.effectsCleanups.forEach(cleanup => isFnc(cleanup) ? cleanup(this) : cleanup.revert && cleanup.revert());
+ this.$target.innerHTML = this.html;
+ return this;
+ }
+ /**
+ * Recursively processes a node and its children
+ * @param {Node} node
+ */
+ splitNode(node) {
+ const wordTemplate = this.wordTemplate;
+ const charTemplate = this.charTemplate;
+ const includeSpaces = this.includeSpaces;
+ const debug = this.debug;
+ const nodeType = node.nodeType;
+ if (nodeType === 3) {
+ const nodeText = node.nodeValue;
+ // If the nodeText is only whitespace, leave it as is
+ if (nodeText.trim()) {
+ const tempWords = [];
+ const words = this.words;
+ const chars = this.chars;
+ const wordSegments = wordSegmenter.segment(nodeText);
+ const $wordsFragment = doc.createDocumentFragment();
+ let prevSeg = null;
+ for (const wordSegment of wordSegments) {
+ const segment = wordSegment.segment;
+ const isWordLike = isSegmentWordLike(wordSegment);
+ // Determine if this segment should be a new word, first segment always becomes a new word
+ if (!prevSeg || (isWordLike && (prevSeg && (isSegmentWordLike(prevSeg))))) {
+ tempWords.push(segment);
+ }
+ else {
+ // Only concatenate if both current and previous are non-word-like and don't contain spaces
+ const lastWordIndex = tempWords.length - 1;
+ const lastWord = tempWords[lastWordIndex];
+ if (!lastWord.includes(' ') && !segment.includes(' ')) {
+ tempWords[lastWordIndex] += segment;
+ }
+ else {
+ tempWords.push(segment);
+ }
+ }
+ prevSeg = wordSegment;
+ }
+ for (let i = 0, l = tempWords.length; i < l; i++) {
+ const word = tempWords[i];
+ if (!word.trim()) {
+ // Preserve whitespace only if includeSpaces is false and if the current space is not the first node
+ if (i && includeSpaces)
+ continue;
+ $wordsFragment.appendChild(doc.createTextNode(word));
+ }
+ else {
+ const nextWord = tempWords[i + 1];
+ const hasWordFollowingSpace = includeSpaces && nextWord && !nextWord.trim();
+ const wordToProcess = word;
+ const charSegments = charTemplate ? graphemeSegmenter.segment(wordToProcess) : null;
+ const $charsFragment = charTemplate ? doc.createDocumentFragment() : doc.createTextNode(hasWordFollowingSpace ? word + '\xa0' : word);
+ if (charTemplate) {
+ const charSegmentsArray = [...charSegments];
+ for (let j = 0, jl = charSegmentsArray.length; j < jl; j++) {
+ const charSegment = charSegmentsArray[j];
+ const isLastChar = j === jl - 1;
+ // If this is the last character and includeSpaces is true with a following space, append the space
+ const charText = isLastChar && hasWordFollowingSpace ? charSegment.segment + '\xa0' : charSegment.segment;
+ const $charNode = doc.createTextNode(charText);
+ processHTMLTemplate(charTemplate, chars, $charNode, /** @type {DocumentFragment} */ ($charsFragment), charType, debug, -1, words.length, chars.length);
+ }
+ }
+ if (wordTemplate) {
+ processHTMLTemplate(wordTemplate, words, $charsFragment, $wordsFragment, wordType, debug, -1, words.length, chars.length);
+ // Chars elements must be re-parsed in the split() method if both words and chars are parsed
+ }
+ else if (charTemplate) {
+ $wordsFragment.appendChild($charsFragment);
+ }
+ else {
+ $wordsFragment.appendChild(doc.createTextNode(word));
+ }
+ // Skip the next iteration if we included a space
+ if (hasWordFollowingSpace)
+ i++;
+ }
+ }
+ node.parentNode.replaceChild($wordsFragment, node);
+ }
+ }
+ else if (nodeType === 1) {
+ // Converting to an array is necessary to work around childNodes pottential mutation
+ const childNodes = /** @type {Array<Node>} */ ([... /** @type {*} */(node.childNodes)]);
+ for (let i = 0, l = childNodes.length; i < l; i++)
+ this.splitNode(childNodes[i]);
+ }
+ }
+ /**
+ * @param {Boolean} clearCache
+ * @return {this}
+ */
+ split(clearCache = false) {
+ const $el = this.$target;
+ const isCached = !!this.cache && !clearCache;
+ const lineTemplate = this.lineTemplate;
+ const wordTemplate = this.wordTemplate;
+ const charTemplate = this.charTemplate;
+ const fontsReady = doc.fonts.status !== 'loading';
+ const canSplitLines = lineTemplate && fontsReady;
+ this.ready = !lineTemplate || fontsReady;
+ if (!isCached) {
+ if (clearCache) {
+ $el.innerHTML = this.html;
+ this.words.length = this.chars.length = 0;
+ }
+ this.splitNode($el);
+ this.cache = $el.innerHTML;
+ }
+ // Always reset the html when splitting by lines
+ if (canSplitLines) {
+ // No need to revert effects animations here since it's already taken care by the refreshable
+ this.effectsCleanups.forEach(cleanup => isFnc(cleanup) && cleanup(this));
+ if (isCached)
+ $el.innerHTML = this.cache;
+ this.lines.length = 0;
+ if (wordTemplate)
+ this.words = getAllTopLevelElements($el, wordType);
+ }
+ // Always reparse characters after a line reset or if both words and chars are activated
+ if (charTemplate && (canSplitLines || wordTemplate)) {
+ this.chars = getAllTopLevelElements($el, charType);
+ }
+ // Words are used when lines only and prioritized over chars
+ const elementsArray = this.words.length ? this.words : this.chars;
+ let y, linesCount = 0;
+ for (let i = 0, l = elementsArray.length; i < l; i++) {
+ const $el = elementsArray[i];
+ const { top, height } = $el.getBoundingClientRect();
+ if (y && top - y > height * .5)
+ linesCount++;
+ $el.setAttribute(dataLine, `${linesCount}`);
+ const nested = $el.querySelectorAll(`[${dataLine}]`);
+ let c = nested.length;
+ while (c--)
+ nested[c].setAttribute(dataLine, `${linesCount}`);
+ y = top;
+ }
+ if (canSplitLines) {
+ const linesFragment = doc.createDocumentFragment();
+ const parents = new Set();
+ const clones = [];
+ for (let lineIndex = 0; lineIndex < linesCount + 1; lineIndex++) {
+ const $clone = /** @type {HTMLElement} */ ($el.cloneNode(true));
+ filterLineElements($clone, lineIndex, new Set()).forEach($el => {
+ const $parent = $el.parentElement;
+ if ($parent)
+ parents.add($parent);
+ $el.remove();
+ });
+ clones.push($clone);
+ }
+ parents.forEach(filterEmptyElements);
+ for (let cloneIndex = 0, clonesLength = clones.length; cloneIndex < clonesLength; cloneIndex++) {
+ processHTMLTemplate(lineTemplate, this.lines, clones[cloneIndex], linesFragment, lineType, this.debug, cloneIndex);
+ }
+ $el.innerHTML = '';
+ $el.appendChild(linesFragment);
+ if (wordTemplate)
+ this.words = getAllTopLevelElements($el, wordType);
+ if (charTemplate)
+ this.chars = getAllTopLevelElements($el, charType);
+ }
+ // Remove the word wrappers and clear the words array if lines split only
+ if (this.linesOnly) {
+ const words = this.words;
+ let w = words.length;
+ while (w--) {
+ const $word = words[w];
+ $word.replaceWith($word.textContent);
+ }
+ words.length = 0;
+ }
+ if (canSplitLines || clearCache) {
+ this.effects.forEach((effect, i) => this.effectsCleanups[i] = effect(this));
+ }
+ if (this.accessible && (canSplitLines || !isCached)) {
+ const $accessible = doc.createElement('span');
+ // Make the accessible element visually-hidden (https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html)
+ $accessible.style.cssText = `position:absolute;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;white-space:nowrap;`;
+ // $accessible.setAttribute('tabindex', '-1');
+ $accessible.innerHTML = this.html;
+ $el.insertBefore($accessible, $el.firstChild);
+ this.lines.forEach(setAriaHidden);
+ this.words.forEach(setAriaHidden);
+ this.chars.forEach(setAriaHidden);
+ }
+ this.width = /** @type {HTMLElement} */ ($el).offsetWidth;
+ return this;
+ }
+ refresh() {
+ this.split(true);
+ }
+}
+/**
+ * @param {HTMLElement|NodeList|String|Array<HTMLElement>} target
+ * @param {TextSplitterParams} [parameters]
+ * @return {TextSplitter}
*/
+const split = (target, parameters) => new TextSplitter(target, parameters);
+const text = {
+ split,
+};
+
+
/**
* @param {Number|String|[Number|String,Number|String]} val
- * @param {StaggerParameters} params
+ * @param {StaggerParams} params
* @return {StaggerFunction}
*/
const stagger = (val, params = {}) => {
@@ -6805,22 +7329,29 @@ const stagger = (val, params = {}) => {
const staggerEase = hasSpring ? /** @type {Spring} */ (ease).ease : hasEasing ? parseEasings(ease) : null;
const grid = params.grid;
const axis = params.axis;
+ const customTotal = params.total;
const fromFirst = isUnd(from) || from === 0 || from === 'first';
const fromCenter = from === 'center';
const fromLast = from === 'last';
+ const fromRandom = from === 'random';
const isRange = isArr(val);
+ const useProp = params.use;
const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);
const val2 = isRange ? parseNumber(val[1]) : 0;
const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);
const start = params.start || 0 + (isRange ? val1 : 0);
let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;
- return (_, i, t, tl) => {
+ return (target, i, t, tl) => {
+ const [registeredTarget] = registerTargets(target);
+ const total = isUnd(customTotal) ? t : customTotal;
+ const customIndex = !isUnd(useProp) ? isFnc(useProp) ? useProp(registeredTarget, i, total) : getOriginalAnimatableValue(registeredTarget, useProp) : false;
+ const staggerIndex = isNum(customIndex) || isStr(customIndex) && isNum(+customIndex) ? +customIndex : i;
if (fromCenter)
- fromIndex = (t - 1) / 2;
+ fromIndex = (total - 1) / 2;
if (fromLast)
- fromIndex = t - 1;
+ fromIndex = total - 1;
if (!values.length) {
- for (let index = 0; index < t; index++) {
+ for (let index = 0; index < total; index++) {
if (!grid) {
values.push(abs(fromIndex - index));
}
@@ -6844,11 +7375,13 @@ const stagger = (val, params = {}) => {
values = values.map(val => staggerEase(val / maxValue) * maxValue);
if (reversed)
values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));
+ if (fromRandom)
+ values = shuffle(values);
}
const spacing = isRange ? (val2 - val1) / maxValue : val1;
const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */ (start);
/** @type {String|Number} */
- let output = offset + ((spacing * round(values[i], 2)) || 0);
+ let output = offset + ((spacing * round(values[staggerIndex], 2)) || 0);
if (params.modifier)
output = params.modifier(output);
if (unitMatch)
@@ -6857,4 +7390,4 @@ const stagger = (val, params = {}) => {
};
};
-export { Animatable, Draggable, JSAnimation, Scope, ScrollObserver, Spring, Timeline, Timer, WAAPIAnimation, animate, createAnimatable, createDraggable, createScope, createSpring, createTimeline, createTimer, eases, engine, onScroll, scrollContainers, stagger, svg, utils, waapi };
+export { Animatable, Draggable, JSAnimation, Scope, ScrollObserver, Spring, TextSplitter, Timeline, Timer, WAAPIAnimation, animate, createAnimatable, createDraggable, createScope, createSpring, createTimeline, createTimer, eases, engine, onScroll, scrollContainers, stagger, svg, text, utils, waapi };