{"version":3,"file":"index.mjs","names":[],"sources":["../../src/Easing.ts","../../src/Util.ts","../../src/extend/array.ts","../../src/extend/path.ts","../../src/extend/object.ts","../../src/extend/transform.ts","../../src/Now.ts","../../src/Runtime.ts","../../src/Tween.ts","../../src/Timeline.ts","../../src/Version.ts"],"sourcesContent":["// Easing.ts\nimport type { EasingFunction, EasingFunctionGroup } from \"./types.ts\";\n\n/**\n * A frozen collection of preset easing functions, grouped by name\n * (`Linear`, `Quadratic`, `Cubic`, `Quartic`, `Quintic`, `Sinusoidal`,\n * `Exponential`, `Circular`, `Elastic`, `Back`, `Bounce`), each exposing\n * `In`, `Out` and `InOut` variants. Use with `.easing()`.\n *\n * @example\n * ```ts\n * const tween = new Tween({ x: 0 }).to({ x: 300 }).easing(Easing.Elastic.Out);\n * ```\n */\nexport const Easing: {\n  Linear: EasingFunctionGroup & { None: EasingFunction };\n  Quadratic: EasingFunctionGroup;\n  Cubic: EasingFunctionGroup;\n  Quartic: EasingFunctionGroup;\n  Quintic: EasingFunctionGroup;\n  Sinusoidal: EasingFunctionGroup;\n  Exponential: EasingFunctionGroup;\n  Circular: EasingFunctionGroup;\n  Elastic: EasingFunctionGroup;\n  Back: EasingFunctionGroup;\n  Bounce: EasingFunctionGroup;\n  pow(power?: number): EasingFunctionGroup;\n} = Object.freeze({\n  /**\n   * Linear easing functions, including a `None` variant that returns the input unchanged.\n   */\n  Linear: Object.freeze<EasingFunctionGroup & { None: EasingFunction }>({\n    None(amount: number): number {\n      return amount;\n    },\n    In(amount: number): number {\n      return amount;\n    },\n    Out(amount: number): number {\n      return amount;\n    },\n    InOut(amount: number): number {\n      return amount;\n    },\n  }),\n\n  /**\n   * Quadratic easing functions (power of 2).\n   */\n  Quadratic: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return amount * amount;\n      },\n      Out(amount: number): number {\n        return amount * (2 - amount);\n      },\n      InOut(amount: number): number {\n        if ((amount *= 2) < 1) {\n          return 0.5 * amount * amount;\n        }\n\n        return -0.5 * (--amount * (amount - 2) - 1);\n      },\n    },\n  ),\n\n  /**\n   * Cubic easing functions (power of 3).\n   */\n  Cubic: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return amount * amount * amount;\n      },\n      Out(amount: number): number {\n        return --amount * amount * amount + 1;\n      },\n      InOut(amount: number): number {\n        if ((amount *= 2) < 1) {\n          return 0.5 * amount * amount * amount;\n        }\n        return 0.5 * ((amount -= 2) * amount * amount + 2);\n      },\n    },\n  ),\n\n  /**\n   * Quartic easing functions (power of 4).\n   */\n  Quartic: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return amount * amount * amount * amount;\n      },\n      Out(amount: number): number {\n        return 1 - --amount * amount * amount * amount;\n      },\n      InOut(amount: number): number {\n        if ((amount *= 2) < 1) {\n          return 0.5 * amount * amount * amount * amount;\n        }\n\n        return -0.5 * ((amount -= 2) * amount * amount * amount - 2);\n      },\n    },\n  ),\n\n  /**\n   * Quintic easing functions (power of 5).\n   */\n  Quintic: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return amount * amount * amount * amount * amount;\n      },\n      Out(amount: number): number {\n        return --amount * amount * amount * amount * amount + 1;\n      },\n      InOut(amount: number): number {\n        if ((amount *= 2) < 1) {\n          return 0.5 * amount * amount * amount * amount * amount;\n        }\n\n        return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);\n      },\n    },\n  ),\n\n  /**\n   * Sinusoidal easing functions based on the sine curve.\n   */\n  Sinusoidal: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2);\n      },\n      Out(amount: number): number {\n        return Math.sin((amount * Math.PI) / 2);\n      },\n      InOut(amount: number): number {\n        return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));\n      },\n    },\n  ),\n\n  /**\n   * Exponential easing functions based on powers of 2.\n   */\n  Exponential: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return amount === 0 ? 0 : Math.pow(1024, amount - 1);\n      },\n      Out(amount: number): number {\n        return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);\n      },\n      InOut(amount: number): number {\n        if (amount === 0) {\n          return 0;\n        }\n\n        if (amount === 1) {\n          return 1;\n        }\n\n        if ((amount *= 2) < 1) {\n          return 0.5 * Math.pow(1024, amount - 1);\n        }\n\n        return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);\n      },\n    },\n  ),\n\n  /**\n   * Circular easing functions based on the quarter circle.\n   */\n  Circular: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return 1 - Math.sqrt(1 - amount * amount);\n      },\n      Out(amount: number): number {\n        return Math.sqrt(1 - --amount * amount);\n      },\n      InOut(amount: number): number {\n        if ((amount *= 2) < 1) {\n          return -0.5 * (Math.sqrt(1 - amount * amount) - 1);\n        }\n        return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);\n      },\n    },\n  ),\n\n  /**\n   * Elastic easing functions with an oscillating spring-like effect.\n   */\n  Elastic: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        if (amount === 0) {\n          return 0;\n        }\n\n        if (amount === 1) {\n          return 1;\n        }\n\n        return (\n          -Math.pow(2, 10 * (amount - 1)) *\n          Math.sin((amount - 1.1) * 5 * Math.PI)\n        );\n      },\n      Out(amount: number): number {\n        if (amount === 0) {\n          return 0;\n        }\n\n        if (amount === 1) {\n          return 1;\n        }\n        return (\n          Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1\n        );\n      },\n      InOut(amount: number): number {\n        if (amount === 0) {\n          return 0;\n        }\n\n        if (amount === 1) {\n          return 1;\n        }\n\n        amount *= 2;\n\n        if (amount < 1) {\n          return (\n            -0.5 *\n            Math.pow(2, 10 * (amount - 1)) *\n            Math.sin((amount - 1.1) * 5 * Math.PI)\n          );\n        }\n\n        return (\n          0.5 *\n            Math.pow(2, -10 * (amount - 1)) *\n            Math.sin((amount - 1.1) * 5 * Math.PI) +\n          1\n        );\n      },\n    },\n  ),\n\n  /**\n   * Back easing functions that overshoot the target before settling.\n   */\n  Back: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        const s = 1.70158;\n        return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);\n      },\n      Out(amount: number): number {\n        const s = 1.70158;\n        return amount === 0\n          ? 0\n          : --amount * amount * ((s + 1) * amount + s) + 1;\n      },\n      InOut(amount: number): number {\n        const s = 1.70158 * 1.525;\n        if ((amount *= 2) < 1) {\n          return 0.5 * (amount * amount * ((s + 1) * amount - s));\n        }\n        return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);\n      },\n    },\n  ),\n\n  /**\n   * Bounce easing functions that simulate a bouncing ball.\n   */\n  Bounce: Object.freeze(\n    <EasingFunctionGroup> {\n      In(amount: number): number {\n        return 1 - Easing.Bounce.Out(1 - amount);\n      },\n      Out(amount: number): number {\n        if (amount < 1 / 2.75) {\n          return 7.5625 * amount * amount;\n        } else if (amount < 2 / 2.75) {\n          return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;\n        } else if (amount < 2.5 / 2.75) {\n          return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;\n        } else {\n          return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;\n        }\n      },\n      InOut(amount: number): number {\n        if (amount < 0.5) {\n          return Easing.Bounce.In(amount * 2) * 0.5;\n        }\n        return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;\n      },\n    },\n  ),\n\n  /**\n   * Creates a new group of easing functions with the given power.\n   * @param power - The exponent used by the easing functions, clamped to `[Number.EPSILON, 10000]`\n   * @returns An `EasingFunctionGroup` with `In`, `Out` and `InOut` variants\n   */\n  pow(power = 4): EasingFunctionGroup {\n    power = power < Number.EPSILON ? Number.EPSILON : power;\n    power = power > 10000 ? 10000 : power;\n    return {\n      In(amount: number): number {\n        return amount ** power;\n      },\n      Out(amount: number): number {\n        return 1 - (1 - amount) ** power;\n      },\n      InOut(amount: number): number {\n        if (amount < 0.5) {\n          return (amount * 2) ** power / 2;\n        }\n        return (1 - (2 - amount * 2) ** power) / 2 + 0.5;\n      },\n    };\n  },\n});\n","import type { DeepObject, DeepPartial, TweenProps } from \"./types.ts\";\nimport type { Tween } from \"./Tween.ts\";\nimport type { Timeline } from \"./Timeline.ts\";\n\n// Util.ts\n/**\n * Checks if a value is a `string`.\n *\n * @param value - The value to check\n * @returns `true` when the value is a `string`\n */\nexport const isString = (value: unknown): value is string =>\n  typeof value === \"string\";\n\n/**\n * Checks if a value is a `number`.\n *\n * @param value - The value to check\n * @returns `true` when the value is a `number`\n */\nexport const isNumber = (value: unknown): value is number =>\n  typeof value === \"number\";\n\n/**\n * Checks if a value is an `Array`.\n *\n * @param value - The value to check\n * @returns `true` when the value is an `Array`\n */\nexport const isArray = (value: unknown): value is Array<unknown> =>\n  Array.isArray(value);\n\n/**\n * Checks if a value is a `function`.\n *\n * @param value - The value to check\n * @returns `true` when the value is a `function`\n */\nexport const isFunction = (value: unknown): value is () => unknown =>\n  typeof value === \"function\";\n\n/**\n * Checks if a value is a plain object (an object whose prototype\n * is `Object.prototype`), excluding `null`, `undefined` and arrays.\n *\n * @param value - The value to check\n * @returns `true` when the value is a plain object\n */\nexport const isObject = (value: unknown): value is Record<string, never> =>\n  value !== null &&\n  value !== undefined &&\n  typeof value === \"object\" &&\n  Object.getPrototypeOf(value) === Object.prototype;\n\n/**\n * Checks if a value is a plain object and not an array.\n *\n * @param value - The value to check\n * @returns `true` when the value is a plain non-array object\n */\nexport const isPlainObject = (value: unknown): value is Record<string, never> =>\n  isObject(value) && !isArray(value);\n\n/**\n * Checks if a value is a single-level nested object (a plain object\n * that contains at least one plain object value).\n *\n * @param value - The value to check\n * @returns `true` when the value is a {@link DeepObject}\n */\nexport const isDeepObject = (value: unknown): value is DeepObject =>\n  isPlainObject(value) && Object.values(value).some(isPlainObject);\n\n/**\n * A boolean that is `true` when running in a server environment\n * (e.g. SSR / Node.js), where `window` is not defined.\n */\nexport const isServer = typeof window === \"undefined\";\n\n/**\n * The method names shared by {@link Tween} and {@link Timeline} that\n * are stubbed on the SSR {@link dummyInstance}.\n */\nconst instanceMethods = [\n  \"play\",\n  \"label\",\n  \"start\",\n  \"stop\",\n  \"pause\",\n  \"resume\",\n  \"reverse\",\n  \"use\",\n  \"clear\",\n  \"from\",\n  \"to\",\n  \"easing\",\n  \"delay\",\n  \"yoyo\",\n  \"repeat\",\n  \"update\",\n  \"repeatDelay\",\n  \"onStart\",\n  \"onUpdate\",\n  \"onComplete\",\n  \"onStop\",\n  \"onRepeat\",\n];\n\n/**\n * SSR helper to speed up UI frameworks render.\n *\n * Why:\n * - skip validation\n * - skip ministore creation\n * - allow free-form configuration for signal based frameworks\n */\nconst dummyInstance: Record<string, typeof dummyMethod> = {};\n// istanbul ignore next @preserve\n// const dummyMethod = () => dummyInstance;\n/**\n * A no-op method that returns the calling instance, used to stub\n * {@link Tween} / {@link Timeline} methods in SSR environments.\n *\n * @returns The calling `dummyInstance`\n */\nfunction dummyMethod(this: typeof dummyInstance): typeof dummyInstance {\n  return this;\n}\n\nfor (let i = 0; i < instanceMethods.length; i++) {\n  dummyInstance[instanceMethods[i]] = dummyMethod;\n}\n\nexport { dummyInstance };\n\n/**\n * Checks if an object has a property as its own (not inherited).\n *\n * @param obj - The object to check\n * @param prop - The property name to look for\n * @returns `true` when the object has the property\n */\nexport const objectHasProp = <T extends object>(\n  obj: T,\n  prop: keyof T,\n): boolean => Object.prototype.hasOwnProperty.call(obj, prop);\n\n/**\n * Checks if a key is unsafe for assignment, to prevent prototype pollution.\n *\n * @param key - The property key to check\n * @returns `true` when the key is `__proto__`, `constructor` or `prototype`\n */\nconst isUnsafeKey = (key: string): boolean =>\n  key === \"__proto__\" || key === \"constructor\" || key === \"prototype\";\n\n/**\n * A small utility to deep assign up to one level deep nested objects.\n * This is to prevent breaking reactivity of miniStore.\n *\n * **NOTE** - This doesn't perform ANY check and expects objects values\n * to be validated beforehand.\n * @param target The target to assign values to\n * @param source The source object to assign values from\n */\nexport function deepAssign<T extends TweenProps>(target: T, source: T): void {\n  const keys = Object.keys(source) as (keyof T)[];\n  let i = 0;\n  const len = keys.length;\n\n  while (i < len) {\n    const key = keys[i++];\n    // prevent prototype pollution\n    // istanbul ignore next @preserve\n    if (isUnsafeKey(key as string) || !objectHasProp(source, key)) {\n      continue;\n    }\n    const targetVal = target[key];\n    const sourceVal = source[key];\n\n    if (isArray(sourceVal)) {\n      // Handle arrays (number[], TransformArray, MorphPathArray)\n      const targetArr = targetVal as unknown[];\n      let j = 0;\n      const arLen = sourceVal.length;\n\n      while (j < arLen) {\n        const sourceItem = sourceVal[j];\n\n        if (isArray(sourceItem)) {\n          // Nested array (e.g., TransformStep, MorphPathSegment)\n          // if (!isArray(targetArr[j])) {\n          //   targetArr[j] = [];\n          // }\n          const targetItem = targetArr[j] as unknown[];\n          let k = 0;\n          const itemLen = sourceItem.length;\n          while (k < itemLen) {\n            targetItem[k] = sourceItem[k];\n            k++;\n          }\n        } else {\n          // Primitive in array (e.g., number[] like rgb)\n          targetArr[j] = sourceItem;\n        }\n        j++;\n      }\n    } else if (objectHasProp(target, key) && isObject(sourceVal)) {\n      // Handle nested objects (BaseTweenProps)\n      deepAssign(targetVal as never, sourceVal as never);\n    } else {\n      // Primitive value (number)\n      target[key] = sourceVal;\n    }\n  }\n}\n\n/**\n * Creates a new object with the same structure of a target object / array\n * without its proxy elements / properties, only their values.\n *\n * **NOTE** - The utility is useful to create deep clones as well.\n *\n * @param value An object / array with proxy elements\n * @returns the object / array value without proxy elements\n */\nexport const deproxy = <T>(value: T): T => {\n  if (isArray(value)) {\n    return value.map(deproxy) as T;\n  }\n\n  if (isPlainObject(value)) {\n    const result: Record<string, unknown> = {};\n    for (const key in value) {\n      // istanbul ignore else @preserve\n      if (objectHasProp(value, key)) {\n        result[key] = deproxy(value[key]);\n      }\n    }\n    return result as T;\n  }\n\n  return value;\n};\n\n/**\n * Test values validity or their compatibility with the validated ones\n * in the state. This is something we don't want to do in the runtime\n * update loop.\n * @param this The Tween/Timeline instance\n * @param target The target object to validate\n * @param reference The reference state value\n * @returns void\n */\nexport function validateValues<T extends TweenProps>(\n  this: Timeline | Tween,\n  target: Partial<T> | DeepPartial<T>,\n  reference?: T,\n) {\n  const errors = this.getErrors();\n\n  if (!isPlainObject(target) || Object.keys(target).length === 0) {\n    errors.set(\"init\", \"Initialization value is empty or not an object.\");\n    return;\n  }\n\n  const keys = Object.keys(target);\n\n  // skip if from()/to() was used before one another\n  // we don't want to validate props invalidated!\n  if (reference && keys.some((key) => errors.has(key))) {\n    return;\n  }\n\n  // Validate every value\n  let i = 0;\n  while (i < keys.length) {\n    const key = keys[i++];\n    const refValue = reference?.[key];\n    const value = target[key];\n\n    // everything else is either number or not supported\n    if (isNumber(value)) {\n      // no error there\n      // this.removeError(key);\n      continue; // good value\n    }\n\n    if (value === undefined || value === null) {\n      errors.set(key, `Property \"${key}\" is null/undefined.`);\n      continue;\n    }\n\n    if (reference && refValue === undefined) {\n      errors.set(key, `Property \"${key}\" doesn't exist in state yet.`);\n      continue;\n    }\n\n    // allow validators to override default validation behavior\n    const validator = this.getValidator(key);\n    if (validator) {\n      const [valid, reason] = validator(key, value, refValue as never);\n      if (valid) errors.delete(key);\n      else errors.set(key, reason as string);\n      continue;\n    }\n\n    if (reference && isNumber(refValue)) {\n      // istanbul ignore else @preserve\n      if (!isNumber(value)) {\n        errors.set(key, `Property \"${key}\" is not a number.`);\n      }\n      // only validators can revalidate\n      // this case can never be covered\n      // else this.removeError(key);\n\n      continue;\n    }\n\n    // Any value here is either not valid or not supported yet\n    errors.set(\n      key,\n      `Property \"${key}\" of type \"${\n        isArray(value) ? \"array\" : typeof value\n      }\" is not supported yet.`,\n    );\n  }\n  errors.delete(\"init\");\n}\n","// src/extend/array.ts\nimport { isArray, isNumber } from \"../Util.ts\";\nimport type { InterpolatorFunction, ValidationResultEntry } from \"../types.ts\";\n\n/**\n * Interpolates two `Array<number>` values.\n *\n * **NOTE**: Values my be validated first!\n *\n * @param target The target `Array<number>` value of the state object\n * @param start The start `Array<number>` value\n * @param end The end `Array<number>` value\n * @param t The progress value\n * @returns The interpolated `Array<number>` value.\n */\nexport const interpolateArray: InterpolatorFunction<number[]> = <\n  T extends number[],\n>(\n  target: T,\n  start: T,\n  end: T,\n  t: number,\n) => {\n  const len = end.length;\n  let i = 0;\n\n  while (i < len) {\n    target[i] = start[i] + (end[i] - start[i]) * t;\n    i += 1;\n  }\n\n  return target;\n};\n\n/**\n * Check if a value is a valid `Array<number>` for interpolation.\n * @param target The array to check\n * @returns `true` is value is array and all elements are numbers\n */\nexport const isValidArray = <T extends number[]>(\n  target: unknown,\n): target is T => isArray(target) && target.every(isNumber);\n\n/**\n * Check if an `Array<number>` is valid and compatible with a reference.\n *\n * @param target The incoming value `from()` / `to()`\n * @param ref The state reference value\n * @returns [boolean, reason] tuple with validation state as boolean and,\n * if not valid, a reason why it's not valid\n */\nexport const validateArray = <T extends number[]>(\n  propName: string,\n  target: unknown,\n  ref?: T,\n): ValidationResultEntry => {\n  // istanbul ignore if @preserve\n  if (!isArray(target)) {\n    return [false, `Property \"${String(propName)}\" is not Array.`];\n  }\n  // istanbul ignore if @preserve\n  if (!isValidArray(target)) {\n    return [\n      false,\n      `Property \"${String(propName)}\" is not a valid Array<number>.`,\n    ];\n  }\n\n  if (ref && ref.length !== target.length) {\n    return [\n      false,\n      `Property \"${\n        String(propName)\n      }\" is expecting an array of ${ref.length} numbers.`,\n    ];\n  }\n\n  return [true];\n};\n\n/**\n * Config for .use(propName, arrayConfig)\n */\nexport const arrayConfig = {\n  interpolate: interpolateArray,\n  validate: validateArray,\n};\n","// src/extend/path.ts\nimport type { MorphPathArray } from \"svg-path-commander\";\nimport {\n  equalizePaths,\n  equalizeSegments,\n  pathToString,\n} from \"svg-path-commander/util\";\nimport { isArray, isNumber } from \"../Util.ts\";\n\nimport type {\n  InterpolatorFunction,\n  PathLike,\n  ValidationResultEntry,\n} from \"../types.ts\";\n/**\n * Re-exports the path utilities from `svg-path-commander/util`:\n * `equalizePaths`, `equalizeSegments` and `pathToString`.\n */\nexport { equalizePaths, equalizeSegments, type MorphPathArray, pathToString };\n\n/**\n * Interpolate `PathArray` values.\n *\n * **NOTE**: these values must be validated first!\n * @param target - The target PathArray value\n * @param start - A starting PathArray value\n * @param end - An ending PathArray value\n * @param t - The progress value\n * @returns The interpolated PathArray value\n */\nexport const interpolatePath: InterpolatorFunction<MorphPathArray> = <\n  T extends MorphPathArray,\n>(\n  target: T,\n  start: T,\n  end: T,\n  t: number,\n): T => {\n  const segCount = end.length;\n  let i = 0;\n\n  while (i < segCount) {\n    const targetSeg = target[i];\n    const startSeg = start[i];\n    const endSeg = end[i];\n\n    if (targetSeg[0] === \"Z\") {\n      // force update when Z is used\n      // Z has no params\n      targetSeg[0] === \"Z\";\n    } else if (targetSeg[0] === \"C\") {\n      targetSeg[1] = startSeg[1]! + (endSeg[1]! - startSeg[1]!) * t;\n      targetSeg[2] = startSeg[2]! + (endSeg[2]! - startSeg[2]!) * t;\n      targetSeg[3] = startSeg[3]! + (endSeg[3]! - startSeg[3]!) * t;\n      targetSeg[4] = startSeg[4]! + (endSeg[4]! - startSeg[4]!) * t;\n      targetSeg[5] = startSeg[5]! + (endSeg[5]! - startSeg[5]!) * t;\n      targetSeg[6] = startSeg[6]! + (endSeg[6]! - startSeg[6]!) * t;\n    } else {\n      // M / L\n      targetSeg[1] = startSeg[1]! + (endSeg[1]! - startSeg[1]!) * t;\n      targetSeg[2] = startSeg[2]! + (endSeg[2]! - startSeg[2]!) * t;\n    }\n    i++;\n  }\n\n  return target as T;\n};\n\n/** The path commands supported by the interpolation engine */\nconst supportedPathCommands = [\"M\", \"L\", \"C\", \"Z\"] as const;\n\n/**\n * Check if an array of arrays is potentially a PathArray\n * @param value The incoming value `constructor()` `from()` / `to()`\n * @returns `true` when array is potentially a PathArray\n */\nexport const isPathLike = (value: unknown): value is PathLike =>\n  isArray(value) &&\n  value.some(\n    (seg) => isArray(seg) && supportedPathCommands.includes(seg[0] as never),\n  );\n\n/**\n * Check if an array of arrays is a valid PathArray for interpolation\n * @param value The incoming value `from()` / `to()`\n * @returns `true` when array is valid\n */\nexport const isValidPath = (value: unknown): value is MorphPathArray =>\n  isPathLike(value) &&\n  value.length > 1 &&\n  value.every(isArray) &&\n  value.every(\n    ([cmd, ...values]) =>\n      supportedPathCommands.includes(cmd as MorphPathArray[0][0]) &&\n      (([\"M\", \"L\"].includes(cmd as MorphPathArray[0][0]) &&\n        (values as number[]).length === 2 &&\n        values.every(isNumber)) ||\n        (\"C\" === cmd &&\n          (values as number[]).length === 6 &&\n          values.every(isNumber)) ||\n        (\"Z\" === cmd && (values as number[]).length === 0)),\n  );\n\n/**\n * Validate a `PathArray` and check if it's compatible with a reference.\n *\n * **NOTE**: Path interpolation only works when both paths have:\n * - Identical segments structure (same number and order of M/L/C/Z path commands)\n * - Corresponding coordinates to interpolate\n * Complex morphs require preprocessing (e.g. KUTE.js, Flubber)\n *\n * @example\n * // simple shapes\n * const linePath1 = [[\"M\", 0, 0],[\"L\", 50, 50]]\n * const linePath2 = [[\"M\",50,50],[\"L\",150,150]]\n * const curvePath1 = [[\"M\", 0, 0],[\"C\",15,15, 35, 35, 50, 50]]\n * const curvePath2 = [[\"M\",50,50],[\"C\",50,50,100,100,150,150]]\n *\n * // closed shapes\n * const closedLinePath1 = [[\"M\", 0, 0],[\"L\", 50, 50],[\"Z\"]]\n * const closedLinePath2 = [[\"M\",50,50],[\"L\",150,150],[\"Z\"]]\n * const closedCurvePath1 = [[\"M\", 0, 0],[\"C\",15,15, 35, 35, 50, 50],[\"Z\"]]\n * const closedCurvePath2 = [[\"M\",50,50],[\"C\",50,50,100,100,150,150],[\"Z\"]]\n *\n * // composit shapes (multi-path)\n * const compositPath1 = [\n *  [\"M\", 0, 0],[\"L\",50,50],\n *  [\"M\",50,50],[\"C\",50,50,100,100,150,150],\n * ]\n * const compositPath2 = [\n *  [\"M\",50,50],[\"L\",150,150],\n *  [\"M\", 0, 0],[\"C\", 15, 15,35,35,50,50],\n * ]\n *\n * @param target The incoming value `from()` / `to()`\n * @param ref The state reference value\n * @returns a tuple with validation result as a `boolean` and,\n * if not valid, a reason why value isn't\n */\nexport const validatePath = <T extends MorphPathArray>(\n  propName: string,\n  target: unknown,\n  ref?: T,\n): ValidationResultEntry => {\n  // ref is state[prop] and is already validated on initialization\n  if (!isValidPath(target)) {\n    return [false, `Property \"${propName}\" is not a valid PathArray.`];\n  }\n\n  if (ref) {\n    if (ref.length !== target.length) {\n      return [\n        false,\n        `Property \"${propName}\" is expecting an array of ${ref.length} path segments, got ${target.length}.`,\n      ];\n    }\n\n    let i = 0;\n    const len = ref.length;\n    while (i < len) {\n      const refSeg = ref[i];\n      const targetSeg = target[i];\n      const refCmd = refSeg[0];\n      const targetCmd = targetSeg[0];\n      const refLen = refSeg.length;\n      const targetLen = targetSeg.length;\n\n      if (refCmd !== targetCmd || refLen !== targetLen) {\n        return [\n          false,\n          `Property \"${propName}\" mismatch at index ${i}. ` +\n          `Segments don't match:\\n` +\n          `> segment: \"[${targetCmd}, ${targetSeg.slice(1)}]\"\\n` +\n          `> reference: \"[${refCmd}, ${refSeg.slice(1)}]\"`,\n        ];\n      }\n      i++;\n    }\n  }\n\n  return [true];\n};\n\n/**\n * Config for .use(propName, pathArrayConfig)\n */\nexport const pathArrayConfig = {\n  interpolate: interpolatePath,\n  validate: validatePath,\n};\n","// src/extend/object.ts\nimport type {\n  BaseTweenProps,\n  InterpolatorFunction,\n  ValidationResultEntry,\n} from \"../types.ts\";\nimport { isNumber, isPlainObject } from \"../Util.ts\";\n\n/**\n * Caches the key list of each interpolated object so it's computed once\n * instead of every frame. The `end` object reference is stable for the\n * lifetime of a tween configuration.\n */\nconst endKeysCache = new WeakMap<object, string[]>();\n\n/**\n * Single-level `Record<string, number>` object interpolate function.\n *\n * **NOTE**: values must be validated first!\n *\n * Input: single-level nested object\n *\n * Output: interpolated flat object with same structure\n *\n * @example\n * const initialValues = { translate : { x: 0, y: 0 } };\n * // we will need to validate the value of `translate`\n *\n * @param target The target value of the state object\n * @param start The start value of the object\n * @param end The end value of the object\n * @param t The progress value\n * @returns The interpolated flat object with same structure.\n */\nexport const interpolateObject: InterpolatorFunction<BaseTweenProps> = <\n  T extends BaseTweenProps,\n>(\n  target: T,\n  start: T,\n  end: T,\n  t: number,\n): T => {\n  // Iterate over end keys (we only interpolate what's in end),\n  // computing the key list once per end object reference\n  let keys = endKeysCache.get(end as object) as (keyof T)[] | undefined;\n  if (!keys) {\n    keys = Object.keys(end) as (keyof T)[];\n    endKeysCache.set(end as object, keys as string[]);\n  }\n  let i = 0;\n\n  while (i < keys.length) {\n    const key = keys[i++];\n    const endVal = end[key];\n    const startVal = start[key];\n\n    target[key] = (startVal + (endVal - startVal) * t) as T[keyof T];\n  }\n\n  return target;\n};\n\n/**\n * Validate a plain `Record<string, number>` object and compare its compatibility\n * with a reference object.\n * @param propName The property name to which this object belongs to\n * @param target The target object itself\n * @param ref A reference object to compare our target to\n * @returns A [boolean, string?] tuple which represents [validity, \"reason why not valid\"]\n */\nexport const validateObject = (\n  propName: string,\n  target: unknown,\n  ref?: BaseTweenProps,\n): ValidationResultEntry => {\n  if (!isPlainObject(target)) {\n    return [false, `Property \"${propName}\" must be a plain object.`];\n  }\n\n  const keys = Object.keys(target);\n  let i = 0;\n  const iLen = keys.length;\n\n  while (i < iLen) {\n    const key = keys[i++];\n    const value = target[key];\n\n    if (value === null || value === undefined) {\n      return [\n        false,\n        `Property \"${key}\" from \"${propName}\" is null/undefined.`,\n      ];\n    }\n\n    // We never want to go down that route\n    // if (isPlainObject(value)) {}\n\n    if (!isNumber(value)) {\n      return [\n        false,\n        `Property \"${key}\" from \"${propName}\" must be a number.` +\n        `${\n          isPlainObject(value)\n            ? \" Deeper nested objects are not supported.\"\n            : ` Unsupported value: \"${typeof value}\".`\n        }`,\n      ];\n    }\n\n    if (ref) {\n      if (ref[key] === undefined) {\n        return [\n          false,\n          `Property \"${key}\" in \"${propName}\" doesn't exist in the reference object.`,\n        ];\n      }\n    }\n  }\n\n  return [true];\n};\n\n/**\n * Config for .use(propName, objectConfig)\n */\nexport const objectConfig = {\n  interpolate: interpolateObject,\n  validate: validateObject,\n};\n","// src/extend/transform.ts\nimport CSSMatrix from \"@thednp/dommatrix\";\nimport type {\n  InterpolatorFunction,\n  TransformArray,\n  TransformLike,\n  TransformStep,\n  TransformStepInternal,\n  ValidationResultEntry,\n  Vec3,\n} from \"../types.ts\";\nimport { isArray, isNumber } from \"../Util.ts\";\n\nexport type { TransformArray };\n\n/**\n * Returns a valid CSS transform string either with transform functions (Eg.: `translate(15px) rotate(25deg)`)\n * or `matrix(...)` / `matrix3d(...)`.\n * When the `toMatrix` parameter is `true` it will create a CSSMatrix instance, apply transform\n * steps and return a `matrix(...)` or `matrix3d(...)` string value.\n * @param steps An array of TransformStep\n * @param toMatrix An optional parameter to modify the function output\n * @returns The valid CSS transform string value\n */\nexport const transformToString = (\n  steps: TransformStep[],\n  toMatrix: boolean = false,\n): string => {\n  if (toMatrix) {\n    const matrix = new CSSMatrix();\n    // reused scratch matrix for the perspective step\n    const scratch = new CSSMatrix();\n    const len = steps.length;\n    let i = 0;\n\n    while (i < len) {\n      const step = steps[i++];\n\n      switch (step[0]) {\n        case \"perspective\": {\n          scratch.m34 = -1 / step[1];\n          matrix.multiplySelf(scratch);\n          break;\n        }\n        case \"translate\": {\n          matrix.translateSelf(step[1], step[2] || 0, step[3] || 0);\n          break;\n        }\n        case \"rotate\": {\n          matrix.rotateSelf(step[1], step[2] || 0, step[3] || 0);\n          break;\n        }\n        case \"rotateAxisAngle\": {\n          matrix.rotateAxisAngleSelf(step[1], step[2], step[3], step[4]);\n          break;\n        }\n        case \"scale\": {\n          matrix.scaleSelf(step[1], step[2] || 1, step[3] || 1);\n          break;\n        }\n        case \"skewX\": {\n          matrix.skewXSelf(step[1]);\n          break;\n        }\n        case \"skewY\": {\n          matrix.skewYSelf(step[1]);\n          break;\n        }\n      }\n    }\n\n    return matrix.toString();\n  }\n  // Return CSS transform string\n  const len = steps.length;\n  let i = 0;\n  let stringOutput = \"\";\n\n  while (i < len) {\n    const step = steps[i++];\n\n    switch (step[0]) {\n      case \"perspective\": {\n        stringOutput += ` perspective(${step[1]}px)`;\n        break;\n      }\n      case \"translate\": {\n        stringOutput += ` translate3d(${step[1]}px, ${step[2] || 0}px, ${\n          step[3] || 0\n        }px)`;\n        break;\n      }\n      case \"rotate\": {\n        const [rx, ry, rz] = step.slice(1) as Vec3;\n\n        if (typeof rx === \"number\" && ry === undefined && rz === undefined) {\n          stringOutput += ` rotate(${step[1]}deg)`;\n        } else {\n          stringOutput += ` rotateX(${step[1]}deg)`;\n          // istanbul ignore else @preserve\n          if (step[2] !== undefined) stringOutput += ` rotateY(${step[2]}deg)`;\n          // istanbul ignore else @preserve\n          if (step[3] !== undefined) stringOutput += ` rotateZ(${step[3]}deg)`;\n        }\n        break;\n      }\n      case \"rotateAxisAngle\": {\n        stringOutput += ` rotate3d(${step[1]}, ${step[2]}, ${step[3]}, ${\n          step[4]\n        }deg)`;\n        break;\n      }\n      case \"scale\": {\n        stringOutput += ` scale(${step[1]}, ${step[2] || step[1]}, ${\n          step[3] || 1\n        })`;\n        break;\n      }\n      case \"skewX\": {\n        stringOutput += ` skewX(${step[1]}deg)`;\n        break;\n      }\n      case \"skewY\": {\n        stringOutput += ` skewY(${step[1]}deg)`;\n        break;\n      }\n    }\n  }\n\n  return stringOutput.slice(1);\n};\n\n/**\n * Convert euler rotation to axis angle.\n * All values are degrees.\n * @param x rotateX value\n * @param y rotateY value\n * @param z rotateZ value\n * @returns The axis angle tuple [vectorX, vectorY, vectorZ, angle]\n */\nexport const eulerToAxisAngle = (\n  x: number,\n  y: number,\n  z: number,\n): [number, number, number, number] => {\n  // Convert to quaternion first\n  const quat = eulerToQuaternion(x, y, z);\n\n  // Then convert quaternion to axis-angle\n  return quaternionToAxisAngle(quat);\n};\n\n/**\n * Convert euler rotation tuple to quaternion.\n * All values are degrees.\n * @param x The rotateX value\n * @param y The rotateY value\n * @param z The rotateZ value\n * @returns The rotation quaternion\n */\nconst eulerToQuaternion = (\n  x: number,\n  y: number,\n  z: number,\n): [number, number, number, number] => {\n  const cx = Math.cos(x / 2);\n  const sx = Math.sin(x / 2);\n  const cy = Math.cos(y / 2);\n  const sy = Math.sin(y / 2);\n  const cz = Math.cos(z / 2);\n  const sz = Math.sin(z / 2);\n\n  return [\n    cx * cy * cz + sx * sy * sz,\n    sx * cy * cz - cx * sy * sz,\n    cx * sy * cz + sx * cy * sz,\n    cx * cy * sz - sx * sy * cz,\n  ];\n};\n\n/**\n * Convert euler rotation tuple to axis angle.\n * All values are degrees.\n * @param q The rotation quaternion\n * @returns The axis angle tuple [vectorX, vectorY, vectorZ, angle]\n */\nconst quaternionToAxisAngle = (\n  q: [number, number, number, number],\n): [number, number, number, number] => {\n  const [w, x, y, z] = q;\n\n  // Normalize\n  const len = Math.sqrt(x * x + y * y + z * z);\n\n  if (len < 0.0001) {\n    // No rotation\n    return [0, 0, 1, 0];\n  }\n\n  const angle = 2 * Math.acos(Math.max(-1, Math.min(1, w)));\n\n  return [x / len, y / len, z / len, angle];\n};\n\n/** Per-`end`-array cache of the number of interpolatable numeric params per step */\nconst paramCountsCache = new WeakMap<object, Uint8Array>();\n\n/**\n * Returns the number of interpolatable numeric parameters for each step of\n * an `end` transform array, lazily computed and cached per array reference.\n * The structure of validated transform arrays never changes between frames,\n * so the dispatch work is hoisted out of the per-frame interpolation loop.\n * @internal\n */\nconst getParamCounts = (end: TransformStep[]): Uint8Array => {\n  let counts = paramCountsCache.get(end);\n  if (!counts) {\n    const len = end.length;\n    counts = new Uint8Array(len);\n    let i = 0;\n    while (i < len) {\n      const sLen = end[i].length;\n      counts[i++] = sLen - 1;\n    }\n    paramCountsCache.set(end, counts);\n  }\n  return counts;\n};\n\n/**\n * Interpolates arrays of `TransformStep`s → returns interpolated `TransformStep`s.\n *\n * **NOTE** - Like `PathArray`, these values are required to have same length,\n * structure and must be validated beforehand.\n * @example\n * const a1: TransformArray = [\n *  [\"translate\", 0, 0],              // [translateX, translateY]\n *  [\"rotate\", 0],                    // [rotateZ]\n *  [\"rotate\", 0, 0],                 // [rotateX, rotateY]\n *  [\"rotateAxisAngle\", 0, 0, 0, 0],  // [originX, originY, originZ, angle]\n *  [\"scale\", 1],                     // [scale]\n *  [\"scale\", 1, 1],                  // [scaleX, scaleY]\n *  [\"perspective\", 800],             // [length]\n * ];\n * const a2: TransformArray = [\n *  [\"translate\", 50, 50],\n *  [\"rotate\", 45],\n *  [\"rotate\", 45, 45],\n *  [\"rotateAxisAngle\", 1, 0, 0, 45],\n *  [\"scale\", 1.5],\n *  [\"scale\", 1.5, 1.2],\n *  [\"perspective\", 400],\n * ];\n *\n * @param target The target `TransformArray` of the state object\n * @param start The start `TransformArray`\n * @param end The end `TransformArray`\n * @param t The progress value\n * @returns The interpolated `TransformArray`\n */\nexport const interpolateTransform: InterpolatorFunction<TransformStep[]> = <\n  T extends TransformStepInternal[],\n>(\n  target: T,\n  start: T,\n  end: T,\n  t: number,\n): T => {\n  const len = end.length;\n  const counts = getParamCounts(end as TransformStep[]);\n  let i = 0;\n\n  while (i < len) {\n    const count = counts[i];\n    const targetStep = target[i];\n    const startStep = start[i];\n    const endStep = end[i];\n\n    if (count > 0) {\n      targetStep[1] = startStep[1] + (endStep[1] - startStep[1]) * t;\n    }\n    if (count > 1) {\n      targetStep[2] = startStep[2]! + (endStep[2]! - startStep[2]!) * t;\n    }\n    if (count > 2) {\n      targetStep[3] = startStep[3]! + (endStep[3]! - startStep[3]!) * t;\n    }\n    if (count > 3) {\n      targetStep[4] = startStep[4]! + (endStep[4]! - startStep[4]!) * t;\n    }\n    i++;\n  }\n\n  return target as T;\n};\n\n/** The transform functions supported by the interpolation engine */\nconst supportedTransform = [\n  \"perspective\",\n  \"translate\",\n  \"rotate\",\n  \"rotateAxisAngle\",\n  \"scale\",\n  \"skewX\",\n  \"skewY\",\n] as const;\n\n/**\n * Check if a value is potentially a `TransformArray`.\n * @param value The incoming value `constructor()` `from()` / `to()`\n * @returns `true` when array is potentially a `TransformArray`\n */\nexport const isTransformLike = (value: unknown): value is TransformLike =>\n  isArray(value) &&\n  value.some(\n    (step) => isArray(step) && supportedTransform.includes(step[0] as never),\n  );\n\n/**\n * Check if a value is a valid `TransformArray` for interpolation.\n * @param value The incoming value `from()` / `to()`\n * @returns `true` when value is a valid `TransformArray`\n */\nexport const isValidTransformArray = (\n  value: unknown,\n): value is TransformArray =>\n  isTransformLike(value) &&\n  value.every(\n    ([fn, ...values]) =>\n      supportedTransform.includes(fn as TransformStep[0]) &&\n      (([\"translate\", \"rotate\", \"scale\"].includes(fn as TransformStep[0]) &&\n        values.length > 0 &&\n        values.length <= 3 &&\n        values.every(isNumber)) ||\n        (\"rotateAxisAngle\" === fn &&\n          (values as number[]).length === 4 &&\n          values.every(isNumber)) ||\n        ([\"skewX\", \"skewY\", \"perspective\"].includes(fn as string) &&\n          (values as number[]).length === 1 &&\n          isNumber((values as number[])[0]))),\n  );\n\n/**\n * Validator for `TransformArray` that checks\n * structure + parameter counts, and if provided,\n * the compatibility with a reference value.\n */\nexport const validateTransform = (\n  propName: string,\n  target: unknown,\n  ref?: TransformArray,\n): ValidationResultEntry => {\n  if (!isValidTransformArray(target)) {\n    return [false, `Property \"${propName}\" must be an array of TransformStep.`];\n  }\n\n  if (ref) {\n    if (ref.length !== target.length) {\n      return [\n        false,\n        `Property \"${propName}\" is expecting an array of ${ref.length} transform steps, got ${target.length}.`,\n      ];\n    }\n\n    let i = 0;\n    const len = target.length;\n\n    while (i < len) {\n      const step = target[i] as [string, ...Vec3];\n      const refStep = ref[i] as [string, ...Vec3];\n      const fn = step[0];\n      const fnRef = refStep[0];\n\n      // istanbul ignore else @preserve\n      if (refStep) {\n        if (fnRef !== fn || refStep.length !== step.length) {\n          return [\n            false,\n            `Property \"${propName}\" mismatch at index ${i}\":\\n` +\n            `> step: [\"${fn}\", ${step.slice(1)}]\\n` +\n            `> reference: [\"${fnRef}\", ${refStep.slice(1)}]`,\n          ];\n        }\n      }\n      i++;\n    }\n  }\n\n  return [true];\n};\n\n/**\n * Config for .use(\"transform\", transformConfig)\n */\nexport const transformConfig = {\n  interpolate: interpolateTransform,\n  validate: validateTransform,\n};\n","/**\n * The current time function used by the engine, defaults to\n * `globalThis.performance.now()`. Can be replaced with {@link setNow}\n * for testing or custom time sources.\n */\nlet _nowFunc: () => number = () => globalThis.performance.now();\n\n/**\n * Returns the current time in milliseconds since the time origin,\n * using the function set via {@link setNow}.\n *\n * @returns The current time in milliseconds\n */\nexport const now = (): number => {\n  return _nowFunc();\n};\n\n/**\n * Replaces the internal time function used by {@link now}.\n *\n * @param nowFunction - A function returning the current time in milliseconds\n */\nexport function setNow(nowFunction: typeof _nowFunc) {\n  _nowFunc = nowFunction;\n}\n","// Runtime.ts\nimport type { AnimationItem, TweenProps } from \"./types.ts\";\nimport { now } from \"./Now.ts\";\n\n/**\n * The runtime queue holding all active {@link AnimationItem} instances\n * (Tween / Timeline) that are updated by the RAF loop.\n */\nexport const Queue: AnimationItem[] = new Array(0);\n\n/** The current `requestAnimationFrame` id, `0` when the loop is stopped */\nlet rafID = 0;\n/** The length of the {@link Queue}, kept in sync for micro-optimization */\nlet queueLength = 0;\n/** O(1) membership lookup for the items in the {@link Queue} */\nconst queuedItems = new Set<AnimationItem>();\n\n/**\n * The hot update loop updates all items in the queue,\n * and stops automatically when there are no items left.\n * @param t - Execution time, in milliseconds (defaults to {@link now})\n */\nexport function Runtime(t: number = now()) {\n  let i = 0;\n  while (i < queueLength) {\n    if (Queue[i]?.update(t)) {\n      i += 1;\n    } else {\n      // swap-and-pop: O(1) removal, order in the queue is irrelevant\n      queuedItems.delete(Queue[i] as AnimationItem);\n      Queue[i] = Queue[queueLength - 1];\n      queueLength--;\n    }\n  }\n\n  // keep the public queue length in sync with the internal counter\n  Queue.length = queueLength;\n\n  if (queueLength === 0) {\n    cancelAnimationFrame(rafID);\n    rafID = 0;\n  } else rafID = requestAnimationFrame(Runtime);\n}\n\n/**\n * Add a new item to the update loop.\n * If it's the first item, it will also start the update loop.\n * @param newItem - Tween / Timeline instance to add\n */\nexport function addToQueue<T extends TweenProps>(\n  newItem: AnimationItem<T>,\n): void {\n  // istanbul ignore else @preserve\n  if (queuedItems.has(newItem as AnimationItem)) return;\n  queuedItems.add(newItem as AnimationItem);\n  // Queue.push(item);\n  Queue[queueLength++] = newItem as AnimationItem;\n  // istanbul ignore else @preserve\n  if (!rafID) Runtime();\n}\n\n/**\n * Remove item from the update loop.\n * @param removedItem - Tween / Timeline instance to remove\n */\nexport function removeFromQueue<T extends TweenProps>(\n  removedItem: AnimationItem<T>,\n): void {\n  const idx = Queue.indexOf(removedItem as AnimationItem);\n  // istanbul ignore else @preserve\n  if (idx > -1) {\n    queuedItems.delete(removedItem as AnimationItem);\n    Queue[idx] = Queue[queueLength - 1];\n    queueLength--;\n    Queue.length = queueLength;\n  }\n}\n","// Tween.ts\nimport type {\n  DeepPartial,\n  EasingFunction,\n  InterpolatorFunction,\n  PropConfig,\n  TweenCallback,\n  TweenProps,\n  TweenRuntime,\n  TweenUpdateCallback,\n  ValidationFunction,\n} from \"./types.ts\";\nimport {\n  deepAssign,\n  deproxy,\n  isArray,\n  isObject,\n  validateValues,\n} from \"./Util.ts\";\nimport { addToQueue, removeFromQueue } from \"./Runtime.ts\";\nimport { now } from \"./Now.ts\";\n\n/**\n * Lightweight tween engine for interpolating values over time.\n * Supports numbers and via extensions it enxtends to arrays\n * (e.g. RGB, points), nested objects, and SVG path morphing.\n *\n * @template T - The type of the target object (usually a plain object with numeric properties)\n *\n * @example\n * ```ts\n * const tween = new Tween({ x: 0, opacity: 1 })\n *   .to({ x: 300, opacity: 0 })\n *   .duration(1.5)\n *   .easing(Easing.Elastic.Out)\n *   .start();\n * ```\n *\n * @param initialValues The initial values object\n */\nexport class Tween<T extends TweenProps = TweenProps> {\n  /**\n   * The animated state object, mutated in place on every frame.\n   * The values here are the ones interpolated between `from` / `to` values.\n   */\n  state: T;\n  /** A deproxied reference of the initial state, used to reset values */\n  private _state: T;\n  /** Whether the start values were captured for the current configuration */\n  private _startIsSet = false;\n  /** The remaining number of repeats */\n  private _repeat = 0;\n  /** Whether the tween alternates direction (yoyo) */\n  private _yoyo = false;\n  /** Whether the playback direction is reversed */\n  private _reversed = false;\n  /** The number of repeats set by the user */\n  private _initialRepeat = 0;\n  /** Whether the `onStart` callback was fired for the current run */\n  private _startFired = false;\n  /** The starting values of each animated property */\n  private _propsStart: Partial<T> = {};\n  /** The ending values of each animated property */\n  private _propsEnd: Partial<T> = {};\n  /** Whether the tween is currently in the runtime queue */\n  private _isPlaying = false;\n  /** The duration of the tween, in milliseconds */\n  private _duration = 1000;\n  /** The delay before the tween starts, in milliseconds */\n  private _delay = 0;\n  /** The timestamp when the tween was paused, `0` when not paused */\n  private _pauseStart = 0;\n  /** The delay between repeats, in milliseconds */\n  private _repeatDelay = 0;\n  /** The absolute start timestamp of the current run */\n  private _startTime: number = 0;\n  /** The validation errors map, keyed by property name or `\"init\"` */\n  private _errors = new Map<string | \"init\", string>();\n  /** The registered interpolators, keyed by property name */\n  private _interpolators = new Map<string | keyof T, InterpolatorFunction>();\n  /** The registered validators, keyed by property name */\n  private _validators = new Map<string | keyof T, ValidationFunction>();\n  /** The easing function applied to the progress value, defaults to linear */\n  private _easing: EasingFunction = (t) => t;\n  /** The `onUpdate` callback, fired on every frame */\n  private _onUpdate?: TweenUpdateCallback<T>;\n  /** The `onComplete` callback, fired when the tween finishes */\n  private _onComplete?: TweenCallback<T>;\n  /** The `onStart` callback, fired when the tween starts */\n  private _onStart?: TweenCallback<T>;\n  /** The `onStop` callback, fired when the tween is stopped */\n  private _onStop?: TweenCallback<T>;\n  /** The `onPause` callback, fired when the tween is paused */\n  private _onPause?: TweenCallback<T>;\n  /** The `onResume` callback, fired when the tween resumes */\n  private _onResume?: TweenCallback<T>;\n  /** The `onRepeat` callback, fired on every repeat cycle */\n  private _onRepeat?: TweenCallback<T>;\n  /** The runtime tuples used by the update loop for interpolation */\n  private _runtime: (TweenRuntime<T>)[] = [];\n  /**\n   * Creates a new Tween instance.\n   * @param initialValues - The initial state of the animated object\n   */\n  constructor(initialValues: T) {\n    // we must initialize state to allow isValidState to work from here\n    this.state = {} as T;\n    validateValues.call(this as unknown as Tween, initialValues);\n    if (this._errors.size) {\n      // we temporarily store initialValues reference here\n      this._state = initialValues;\n    } else {\n      // or set values right away\n      this.state = initialValues;\n      this._state = deproxy(initialValues);\n    }\n\n    return this;\n  }\n\n  // GETTERS FIRST\n  /**\n   * A boolean that returns `true` when tween is playing.\n   */\n  get isPlaying(): boolean {\n    return this._isPlaying;\n  }\n\n  /**\n   * A boolean that returns `true` when tween is paused.\n   */\n  get isPaused(): boolean {\n    return this._pauseStart > 0;\n  }\n\n  /**\n   * A boolean that returns `true` when initial values are valid.\n   */\n  get isValidState(): boolean {\n    return Object.keys(this.state).length > 0;\n  }\n\n  /**\n   * A boolean that returns `true` when all values are valid.\n   */\n  get isValid(): boolean {\n    return this._errors.size === 0;\n  }\n\n  /**\n   * Returns the configured duration in seconds.\n   */\n  getDuration(): number {\n    return this._duration / 1000;\n  }\n\n  /**\n   * Returns the total duration in seconds. It's calculated as a sum of\n   * the delay, duration multiplied by repeat value, repeat delay multiplied\n   * by repeat value.\n   */\n  get totalDuration(): number {\n    const repeat = this._initialRepeat;\n    return (\n      this._delay +\n      this._duration * (repeat + 1) +\n      this._repeatDelay * repeat\n    ) / 1000;\n  }\n\n  /**\n   * Returns the validator configured for a given property.\n   */\n  getValidator(propName: string): ValidationFunction | undefined {\n    return this._validators.get(propName);\n  }\n\n  /**\n   * Returns the errors Map, mainly used by external validators.\n   */\n  getErrors(): Map<string, string> {\n    return this._errors;\n  }\n\n  /**\n   * Starts the tween (adds it to the global update loop).\n   * Triggers `onStart` if set.\n   * @param time - Optional explicit start time (defaults to `now()`)\n   * @param overrideStart - If true, resets starting values even if already set\n   * @returns this\n   */\n  start(time: number = now(), overrideStart: boolean = false): this {\n    if (this._isPlaying) return this;\n    if (this._pauseStart) return this.resume();\n    if (!this.isValid) {\n      this._report();\n      return this;\n    }\n    // micro-optimization - don't reset state if never started\n    if (this._startTime && !overrideStart) this._resetState();\n\n    // istanbul ignore else @preserve\n    if (!this._startIsSet || /* istanbul ignore next */ overrideStart) {\n      this._startIsSet = true;\n\n      this._setProps(\n        this.state,\n        this._propsStart,\n        this._propsEnd,\n        overrideStart,\n      );\n    }\n    this._isPlaying = true;\n    this._startTime = time;\n    this._startTime += this._delay;\n\n    addToQueue(this);\n    return this;\n  }\n\n  /**\n   * Starts the tween from current values.\n   * @param time - Optional explicit start time (defaults to `now()`)\n   * @returns this\n   */\n  startFromLast(time: number = now()): this {\n    return this.start(time, true);\n  }\n\n  /**\n   * Immediately stops the tween and removes it from the update loop.\n   * Triggers `onStop` if set.\n   * @returns this\n   */\n  stop(): this {\n    if (!this._isPlaying) return this;\n    removeFromQueue(this);\n    this._isPlaying = false;\n    this._repeat = this._initialRepeat;\n    this._reversed = false;\n\n    this._onStop?.(this.state);\n    return this;\n  }\n\n  /**\n   * Reverses playback direction and mirrors current time position.\n   * @returns this\n   */\n  reverse(): this {\n    // istanbul ignore next @preserve\n    if (!this._isPlaying) return this;\n\n    const currentTime = now();\n    const elapsed = currentTime - this._startTime;\n    this._startTime = currentTime - (this._duration - elapsed);\n    this._reversed = !this._reversed;\n\n    // istanbul ignore else @preserve\n    if (this._initialRepeat > 0) {\n      this._repeat = this._initialRepeat - this._repeat;\n    }\n\n    return this;\n  }\n\n  /**\n   * Pause playback and capture the pause time.\n   * @param time - Time of pause\n   * @returns this\n   */\n  pause(time: number = now()): this {\n    if (!this._isPlaying) return this;\n\n    this._pauseStart = time;\n    this._isPlaying = false;\n    this._onPause?.(this.state);\n\n    return this;\n  }\n\n  /**\n   * Resume playback and reset the pause time.\n   * @param time - Time of pause\n   * @returns this\n   */\n  resume(time: number = now()): this {\n    if (!this._pauseStart) return this;\n\n    this._startTime += time - this._pauseStart;\n    this._pauseStart = 0;\n    this._isPlaying = true;\n    this._onResume?.(this.state);\n\n    addToQueue(this);\n\n    return this;\n  }\n\n  /**\n   * Sets the starting values for properties.\n   * @param startValues - Partial object with starting values\n   * @returns this\n   */\n  from(startValues: Partial<T> | DeepPartial<T>): this {\n    if (!this.isValidState || this.isPlaying) return this;\n\n    this._evaluate(startValues);\n    if (this.isValid) {\n      Object.assign(this._propsStart, startValues);\n      this._startIsSet = false;\n    }\n\n    return this;\n  }\n\n  /**\n   * Sets the ending values for properties.\n   * @param endValues - Partial object with target values\n   * @returns this\n   */\n  to(endValues: Partial<T> | DeepPartial<T>): this {\n    if (!this.isValidState || this.isPlaying) return this;\n\n    this._evaluate(endValues);\n    if (this.isValid) {\n      this._propsEnd = endValues as T;\n      this._startIsSet = false;\n    }\n\n    return this;\n  }\n\n  /**\n   * Sets the duration of the tween in seconds.\n   * Internally it's converted to milliseconds.\n   * @param seconds - Time in seconds\n   * @default 1 second\n   * @returns this\n   */\n  duration(seconds: number = 1): this {\n    this._duration = seconds * 1000;\n    return this;\n  }\n\n  /**\n   * Sets the delay in seconds before the tween starts.\n   * Internally it's converted to milliseconds.\n   * @param delay - Time in seconds\n   * @default 0 seconds\n   * @returns this\n   */\n  delay(seconds: number = 0): this {\n    this._delay = seconds * 1000;\n    return this;\n  }\n\n  /**\n   * Sets how many times to repeat.\n   * @param times - How many times to repeat\n   * @default 0 times\n   * @returns this\n   */\n  repeat(times: number = 0): this {\n    this._repeat = times;\n    this._initialRepeat = times;\n    return this;\n  }\n\n  /**\n   * Sets a number of seconds to delay the animation\n   * after each repeat.\n   * @param seconds - How many seconds to delay\n   * @default 0 seconds\n   * @returns this\n   */\n  repeatDelay(seconds: number = 0): this {\n    this._repeatDelay = seconds * 1000;\n    return this;\n  }\n\n  /**\n   * Sets to tween from end to start values.\n   * The easing is also goes backwards.\n   * This requires repeat value of at least 1.\n   * @param yoyo - When `true` values are reversed on every uneven repeat\n   * @default false\n   * @returns this\n   */\n  yoyo(yoyo: boolean = false): this {\n    this._yoyo = yoyo;\n    return this;\n  }\n\n  /**\n   * Sets the easing function.\n   * @param easing - Function that maps progress [0,1] → eased progress [0,1]\n   * @default linear\n   * @returns this\n   */\n  easing(easing: EasingFunction = (t: number) => t): this {\n    this._easing = easing;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when `.start()` is called.\n   * @param callback - Receives state at start time\n   * @returns this\n   */\n  onStart(callback: TweenCallback<T>): this {\n    this._onStart = callback;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired on every frame.\n   * @param callback - Receives current state, elapsed (0–1)\n   * @returns this\n   */\n  onUpdate(callback?: TweenUpdateCallback<T>): this {\n    this._onUpdate = callback;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when the tween reaches progress = 1.\n   * @param callback - Receives final state\n   * @returns this\n   */\n  onComplete(callback: TweenCallback<T>): this {\n    this._onComplete = callback;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when `.stop()` is called.\n   * @param callback - Receives state at stop time\n   * @returns this\n   */\n  onStop(callback: TweenCallback<T>): this {\n    this._onStop = callback;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when `pause()` was called.\n   * @param cb - Receives state at pause time\n   * @returns this\n   */\n  onPause(cb: TweenCallback<T>): this {\n    this._onPause = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when `.resume()` was called.\n   * @param cb - Receives state at resume time\n   * @returns this\n   */\n  onResume(cb: TweenCallback<T>): this {\n    this._onResume = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback that is invoked **every time** one full cycle\n   * (repeat iteration) * of the tween has completed — but **before**\n   * the next repeat begins (if any remain).\n   *\n   * This is different from `onComplete`, which only fires once at the\n   * very end of the entire tween (after all repeats are finished).\n   */\n  onRepeat(cb?: TweenCallback<T>): this {\n    this._onRepeat = cb;\n    return this;\n  }\n\n  /**\n   * Manually advances the tween to the given time.\n   * @param time - Current absolute time (performance.now style)\n   *\n   * @returns `true` if the tween is still playing after the update, `false`\n   * otherwise.\n   */\n  update(time: number = now()): boolean {\n    // istanbul ignore else\n    if (!this._isPlaying) return false;\n\n    // istanbul ignore else\n    if (time < this._startTime) return true;\n\n    // istanbul ignore else\n    if (!this._startFired) {\n      this._onStart?.(this.state);\n      this._startFired = true;\n    }\n\n    const reversed = this._reversed;\n    const state = this.state;\n    const runtime = this._runtime;\n    let progress = (time - this._startTime) / this._duration;\n    // some limits are in good order for reverse\n    // if (progress < 0) progress = 0;\n    if (progress > 1) progress = 1;\n\n    // super cheap yoyo\n    let eased = this._easing(reversed ? 1 - progress : progress);\n    eased = reversed ? 1 - eased : eased;\n\n    const len = runtime.length;\n    let i = 0;\n    while (i < len) {\n      const prop = runtime[i++];\n      const targetObject = prop[0];\n      const property = prop[1];\n      const interpolator = prop[2];\n      const startVal = reversed ? prop[4] : prop[3];\n      const endVal = reversed ? prop[3] : prop[4];\n\n      if (prop[5]) {\n        state[property as keyof T] =\n          ((startVal as number) + ((endVal as number) - (startVal as number)) *\n              eased) as T[keyof T];\n      } else {\n        interpolator(\n          targetObject as never,\n          startVal as never,\n          endVal as never,\n          eased,\n        );\n      }\n    }\n\n    this._onUpdate?.(state, progress);\n\n    // istanbul ignore else\n    if (progress === 1) {\n      if (this._repeat === 0) {\n        this._isPlaying = false;\n        this._repeat = this._initialRepeat;\n        this._reversed = false;\n        this._onComplete?.(state);\n        return false;\n      }\n      // istanbul ignore else @preserve\n      if (this._repeat !== Infinity) this._repeat--;\n      // istanbul ignore else @preserve\n      if (this._yoyo) this._reversed = !reversed;\n      this._startTime = time;\n      this._startTime += this._repeatDelay;\n      this._onRepeat?.(state);\n      return true;\n    }\n\n    return true;\n  }\n\n  /**\n   * Public method to register an extension for a given property.\n   *\n   * **NOTES**\n   * - the extension will validate the initial values once `.use()` is called.\n   * - the `.use()` method must be called before `.to()` / `.from()`.\n   *\n   * @param property The property name\n   * @param extension The extension object\n   * @returns this\n   *\n   * @example\n   *\n   * const tween = new Tween({ myProp: { x: 0, y: 0 } });\n   * tween.use(\"myProp\", objectConfig);\n   */\n  use(property: string, { interpolate, validate }: PropConfig): this {\n    // istanbul ignore else\n    if (interpolate && !this._interpolators.has(property)) {\n      this._interpolators.set(property, interpolate);\n    }\n    if (validate && !this._validators.has(property)) {\n      this._validators.set(property, validate);\n    }\n    this._evaluate();\n    return this;\n  }\n\n  /**\n   * Internal method to reset state to initial values.\n   * @internal\n   */\n  private _resetState() {\n    deepAssign(this.state, this._state);\n  }\n\n  /**\n   * Reset starting values, end values and runtime.\n   */\n  clear(): this {\n    this._propsStart = {} as T;\n    this._propsEnd = {} as T;\n    this._runtime.length = 0;\n    this._startTime = 0;\n    this._pauseStart = 0;\n    this._repeat = 0;\n    this._initialRepeat = 0;\n    return this;\n  }\n\n  /**\n   * Internal method to handle instrumentation of start and end values for interpolation.\n   * @internal\n   */\n  private _setProps(\n    obj: T,\n    propsStart: Partial<T>,\n    propsEnd: Partial<T>,\n    overrideStartingValues: boolean,\n  ): void {\n    const endKeys = Object.keys(propsEnd) as (keyof T)[];\n    const len = endKeys.length;\n    this._runtime.length = 0;\n    let rtLen = 0;\n    let i = 0;\n\n    while (i < len) {\n      const property = endKeys[i++];\n      const objValue = obj[property] as T[keyof T];\n\n      // Save the starting value, but only once unless override is requested.\n      // istanbul ignore else\n      if (\n        typeof propsStart[property] === \"undefined\" ||\n        overrideStartingValues\n      ) {\n        // Update start property value\n        if (isObject(objValue) || isArray(objValue)) {\n          propsStart[property] = deproxy(objValue);\n        } else {\n          // number\n          propsStart[property] = objValue;\n        }\n      }\n      // Pre-register interpolator\n      const interpolator = this._interpolators.get(property) || null;\n\n      // Hoist the numeric/value-type check out of the per-frame loop\n      const endVal = propsEnd[property] as T[keyof T];\n      const isNumeric = typeof endVal === \"number\";\n\n      // Store all values needed for interpolation\n      // regardless if propsStart[property] is set or not\n      this._runtime[rtLen++] = [\n        objValue,\n        property,\n        interpolator,\n        propsStart[property] as T[keyof T],\n        endVal,\n        isNumeric,\n      ] as TweenRuntime<T>;\n    }\n  }\n\n  /**\n   * Internal method to handle validation of initial values, start and end values.\n   * @internal\n   */\n  private _evaluate(newObj?: Partial<T> | DeepPartial<T>) {\n    // the reference of the initialization state is stored here\n    // istanbul ignore else @preserve\n    if (!this.isValidState) {\n      const temp = this._state;\n      validateValues.call(this as unknown as Tween, temp);\n      // istanbul ignore else @preserve\n      if (this.isValid) {\n        this.state = temp;\n        this._state = deproxy(temp);\n      }\n    } else if (newObj) {\n      validateValues.call(this as unknown as Tween, newObj, this._state);\n    }\n    return this;\n  }\n\n  /**\n   * Internal method to provide feedback on validation issues.\n   * @internal\n   */\n  private _report() {\n    // istanbul ignore else @preserve\n    if (!this.isValid) {\n      const message = [\n        \"[Tween] failed validation:\",\n        \"- \" + Array.from(this._errors.values()).join(\"\\n- \"),\n      ];\n\n      console.warn(message.join(\"\\n\"));\n    }\n    return this;\n  }\n}\n","// Timeline.ts\nimport type {\n  DeepPartial,\n  InterpolatorFunction,\n  Position,\n  PropConfig,\n  TimelineCallback,\n  TimelineEntry,\n  TimelineEntryConfig,\n  TweenProps,\n  ValidationFunction,\n} from \"./types.ts\";\nimport { addToQueue, removeFromQueue } from \"./Runtime.ts\";\nimport {\n  deepAssign,\n  deproxy,\n  isArray,\n  isObject,\n  validateValues,\n} from \"./Util.ts\";\nimport { now } from \"./Now.ts\";\n\n/**\n * Timeline orchestrates multiple tweens with scheduling, overlaps, labels and repeat.\n * Supports numbers and via extensions it enxtends to arrays\n * (e.g. RGB, points), nested objects, and SVG path morphing.\n *\n * @template T - Type of the animated state object\n *\n * @example\n * ```ts\n * const tl = new Timeline({ x: 0, opacity: 0 })\n *   .to({ x: 300, duration: 1.2 })\n *   .to({ opacity: 1, duration: 0.8 }, \"-=0.4\")\n *   .play();\n * ```\n *\n * @param initialValues The initial values object\n */\nexport class Timeline<T extends TweenProps = TweenProps> {\n  /**\n   * The animated state object, mutated in place on every frame by\n   * the active timeline entries.\n   */\n  public state: T;\n  /** A deproxied reference of the initial state, used to reset values */\n  private _state: T;\n  /** The animation entries, in insertion order */\n  private _entries: TimelineEntry<T>[] = [];\n  /** The named labels, mapping a label name to an absolute time in ms */\n  private _labels = new Map<string, number>();\n  /** The current progress value in the `[0, 1]` range */\n  private _progress = 0;\n  /** The total duration of all entries, in milliseconds */\n  private _duration = 0;\n  /** Whether the timeline alternates direction (yoyo) */\n  private _yoyo = false;\n  /** Whether the playback direction is reversed */\n  private _reversed = false;\n  /** The current playback time, in milliseconds */\n  private _time = 0;\n  /** The timestamp when the timeline was paused, `0` when not paused */\n  private _pauseTime = 0;\n  /** The last update timestamp, used to compute the frame delta */\n  private _lastTime = 0;\n  /** Whether the timeline is currently in the runtime queue */\n  private _isPlaying = false;\n  /** The remaining number of repeats */\n  private _repeat = 0;\n  /** The delay between repeats, in milliseconds */\n  private _repeatDelay = 0;\n  /** The timestamp when the current repeat delay started */\n  private _repeatDelayStart = 0;\n  /** The number of repeats set by the user */\n  private _initialRepeat = 0;\n  /** The validation errors map, keyed by property name or `\"init\"` */\n  private _errors = new Map<string | \"init\", string>();\n  /** The registered interpolators, keyed by property name */\n  private _interpolators = new Map<string | keyof T, InterpolatorFunction>();\n  /** The registered validators, keyed by property name */\n  private _validators = new Map<string | keyof T, ValidationFunction>();\n  /**\n   * The animation entries sorted by `startTime`, rebuilt lazily on play.\n   * While the timeline is playing the entry list is frozen, so the sorted\n   * order only changes when more `.to()` calls are made.\n   */\n  private _sorted: TimelineEntry<T>[] | null = null;\n  /** The longest entry duration, used to widen the active window bounds */\n  private _maxDuration = 0;\n  /** The `onStart` callback, fired when playback begins */\n  private _onStart?: TimelineCallback<T>;\n  /** The `onStop` callback, fired when the timeline is stopped */\n  private _onStop?: TimelineCallback<T>;\n  /** The `onPause` callback, fired when the timeline is paused */\n  private _onPause?: TimelineCallback<T>;\n  /** The `onResume` callback, fired when playback resumes */\n  private _onResume?: TimelineCallback<T>;\n  /** The `onUpdate` callback, fired on every frame */\n  private _onUpdate?: TimelineCallback<T>;\n  /** The `onComplete` callback, fired when the timeline finishes */\n  private _onComplete?: TimelineCallback<T>;\n  /** The `onRepeat` callback, fired on every repeat cycle */\n  private _onRepeat?: TimelineCallback<T>;\n\n  /**\n   * Creates a new Timeline instance.\n   * @param initialValues - The initial state of the animated object\n   */\n  constructor(initialValues: T) {\n    // we must initialize state to allow isValidState to work from here\n    this.state = {} as T;\n    validateValues.call(this as Timeline, initialValues);\n    if (this._errors.size) {\n      // we temporarily store initialValues reference here\n      this._state = initialValues;\n    } else {\n      this.state = initialValues;\n      this._state = { ...initialValues };\n    }\n\n    return this;\n  }\n\n  // GETTERS FIRST\n  /**\n   * Returns the current [0-1] progress value.\n   */\n  get progress(): number {\n    return this._progress;\n  }\n\n  /**\n   * Returns the total duration in seconds.\n   */\n  get duration(): number {\n    return this._duration / 1000;\n  }\n\n  /**\n   * Returns the total duration in seconds, which is a sum of all entries duration\n   * multiplied by repeat value and repeat delay multiplied by repeat value.\n   */\n  get totalDuration(): number {\n    const repeat = this._initialRepeat;\n    return (\n      this._duration * (repeat + 1) +\n      this._repeatDelay * repeat\n    ) / 1000;\n  }\n\n  /**\n   * A boolean that returns `true` when timeline is playing.\n   */\n  get isPlaying(): boolean {\n    return this._isPlaying;\n  }\n\n  /**\n   * A boolean that returns `true` when timeline is paused.\n   */\n  get isPaused(): boolean {\n    return !this._isPlaying && this._pauseTime > 0;\n  }\n\n  /**\n   * A boolean that returns `true` when initial values are valid.\n   */\n  get isValidState(): boolean {\n    return Object.keys(this.state).length > 0;\n  }\n\n  /**\n   * A boolean that returns `true` when all values are valid.\n   */\n  get isValid(): boolean {\n    return this._errors.size === 0;\n  }\n\n  /**\n   * Returns the validator configured for a given property.\n   */\n  getValidator(propName: string): ValidationFunction | undefined {\n    return this._validators.get(propName);\n  }\n\n  /**\n   * Returns the errors Map, mainly used by external validators.\n   */\n  getErrors(): Map<string | \"init\", string> {\n    return this._errors;\n  }\n\n  /**\n   * Starts or resumes playback from the beginning (or current time if resumed).\n   * Triggers the `onStart` callback if set.\n   * @param startTime - Optional explicit start timestamp (defaults to now)\n   * @returns this\n   */\n  play(time: number = now()): this {\n    if (this._pauseTime) return this.resume();\n    if (this._isPlaying) return this;\n    if (!this.isValid) {\n      this._report();\n      return this;\n    }\n    if (this._time) this._resetState();\n    this._isPlaying = true;\n    this._lastTime = time;\n    this._time = 0;\n    this._onStart?.(this.state, 0);\n\n    addToQueue(this);\n    return this;\n  }\n\n  /**\n   * Pauses playback (preserves current time).\n   * Triggers the `onPause` callback if set.\n   * @returns this\n   */\n  pause(time: number = now()): this {\n    if (!this._isPlaying) return this;\n    this._isPlaying = false;\n    this._pauseTime = time;\n    this._onPause?.(this.state, this.progress);\n    return this;\n  }\n\n  /**\n   * Resumes from paused state (adjusts internal clock).\n   * Triggers the `onResume` callback if set.\n\n   * @param time - Optional current timestamp (defaults to now)\n   * @returns this\n   */\n  resume(time: number = now()): this {\n    if (this._isPlaying) return this;\n    this._isPlaying = true;\n    const dif = time - this._pauseTime;\n    this._pauseTime = 0;\n    this._lastTime += dif;\n    this._onResume?.(this.state, this.progress);\n\n    addToQueue(this);\n    return this;\n  }\n\n  /**\n   * Reverses playback direction and mirrors current time position.\n   * @returns this\n   */\n  reverse(): this {\n    if (!this._isPlaying) return this;\n\n    this._reversed = !this._reversed;\n    this._time = this._duration - this._time;\n\n    // istanbul ignore else @preserve\n    if (this._initialRepeat > 0) {\n      this._repeat = this._initialRepeat - this._repeat;\n    }\n\n    return this;\n  }\n\n  /**\n   * Jumps to a specific time or label. When playback is reversed\n   * the time is adjusted.\n   * @param pointer - Seconds or label name\n   * @returns this\n   */\n  seek(pointer: number | string): this {\n    const elapsed = this._resolvePosition(pointer);\n\n    this._time = elapsed;\n    return this;\n  }\n\n  /**\n   * Stops playback, resets time to 0, and restores initial state.\n   * Triggers the `onStop` callback if set.\n   * @returns this\n   */\n  stop(): this {\n    if (!this._isPlaying) return this;\n    this._isPlaying = false;\n    this._time = 0;\n    this._pauseTime = 0;\n    this._repeat = this._initialRepeat;\n    this._reversed = false;\n    removeFromQueue(this);\n    this._onStop?.(this.state, this._progress);\n    return this;\n  }\n\n  /**\n   * Sets the number of times the timeline should repeat.\n   * @param count - Number of repeats (0 = once, Infinity = loop forever)\n   * @returns this\n   */\n  repeat(count = 0): this {\n    this._repeat = count;\n    this._initialRepeat = count;\n    return this;\n  }\n\n  /**\n   * Sets a number of seconds to delay the animation\n   * after each repeat.\n   * @param amount - How many seconds to delay\n   * @default 0 seconds\n   * @returns this\n   */\n  repeatDelay(amount: number = 0): this {\n    this._repeatDelay = amount * 1000;\n    return this;\n  }\n\n  /**\n   * Sets to Timeline entries to tween from end to start values.\n   * The easing is also goes backwards.\n   * This requires repeat value of at least 1.\n   * @param yoyo - When `true` values are reversed\n   * @default false\n   * @returns this\n   */\n  yoyo(yoyo: boolean = false): this {\n    this._yoyo = yoyo;\n    return this;\n  }\n\n  /**\n   * Adds a named time position for use in `.seek(\"label\")`.\n   * @param name - Label identifier\n   * @param position - Time offset or relative position\n   * @returns this\n   */\n  label(name: string, position?: Position): this {\n    this._labels.set(name, this._resolvePosition(position));\n    return this;\n  }\n\n  /**\n   * Adds a new tween entry to the timeline.\n   * @param config - Values to animate + duration, easing, etc.\n   * @param position - Start offset: number, \"+=0.5\", \"-=0.3\", or label name\n   * @returns this (chainable)\n   */\n  to(\n    {\n      duration = 1,\n      easing = (t) => t,\n      ...values\n    }: (Partial<T> | DeepPartial<T>) & TimelineEntryConfig,\n    position: Position = \"+=0\",\n  ): this {\n    if (!this.isValidState || this._isPlaying) return this;\n\n    this._evaluate(values as Partial<T> | DeepPartial<T>);\n    if (this.isValid) {\n      const startTime = this._resolvePosition(position);\n      const to = values as Partial<T> | DeepPartial<T>;\n      const from = {} as Partial<T>;\n      const entryDuration = duration * 1000;\n      const runtime = [] as TimelineEntry<T>[\"runtime\"];\n\n      this._entries.push({\n        from,\n        to,\n        runtime,\n        startTime,\n        duration: entryDuration,\n        easing,\n        isActive: false,\n      });\n\n      const endTime = startTime + entryDuration;\n      this._duration = Math.max(this._duration, endTime);\n      this._sorted = null;\n    }\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when playback begins.\n   * @param cb - Receives state and progress (`0`) at play time\n   * @returns this\n   */\n  onStart(cb: TimelineCallback<T>): this {\n    this._onStart = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when `pause()` was called.\n   * @param cb - Receives state and progress at pause time\n   * @returns this\n   */\n  onPause(cb: TimelineCallback<T>): this {\n    this._onPause = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when `.play()` / `.resume()` was called.\n   * @param cb - Receives state and progress at resume time\n   * @returns this\n   */\n  onResume(cb: TimelineCallback<T>): this {\n    this._onResume = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired on explicit `.stop()`.\n   * @param cb - Receives state and progress at stop time\n   * @returns this\n   */\n  onStop(cb: TimelineCallback<T>): this {\n    this._onStop = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired every frame.\n   * @param cb - Receives state and progress in the `[0, 1]` range\n   * @returns this\n   */\n  onUpdate(cb: TimelineCallback<T>): this {\n    this._onUpdate = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired when timeline naturally completes.\n   * @param cb - Receives state and progress (`1`) at completion time\n   * @returns this\n   */\n  onComplete(cb: TimelineCallback<T>): this {\n    this._onComplete = cb;\n    return this;\n  }\n\n  /**\n   * Registers a callback fired on every repeat cycle, usually before\n   * the next iteration begins.\n   * @param cb - Receives state and the current progress value\n   * @returns this\n   */\n  onRepeat(cb?: TimelineCallback<T>): this {\n    this._onRepeat = cb;\n    return this;\n  }\n\n  /**\n   * Public method to register an extension for a given property.\n   *\n   * **NOTES**\n   * - the extension will validate the initial values once `.use()` is called.\n   * - the `.use()` method must be called before `.to()`.\n   *\n   * @param property The property name\n   * @param extension The extension object\n   * @returns this\n   *\n   * @example\n   *\n   * const timeline = new Timeline({ myProp: { x: 0, y: 0 } });\n   * timeline.use(\"myProp\", objectConfig);\n   */\n  use(property: string, { interpolate, validate }: PropConfig): this {\n    // istanbul ignore else\n    if (interpolate && !this._interpolators.has(property)) {\n      this._interpolators.set(property, interpolate);\n    }\n    if (validate && !this._validators.has(property)) {\n      this._validators.set(property, validate);\n    }\n    this._evaluate();\n    return this;\n  }\n\n  /**\n   * Manually advances the timeline to the given time.\n   * @param time - Current absolute time (performance.now style)\n   *\n   * @returns `true` if the timeline is still playing after the update, `false`\n   * otherwise.\n   */\n  update(time: number = now()): boolean {\n    if (!this._isPlaying) return false;\n\n    if (this._repeatDelayStart) {\n      if (time - this._repeatDelayStart < this._repeatDelay) {\n        this._lastTime = time; // Update lastTime to prevent delta accumulation\n        return true;\n      }\n      // Delay complete\n      this._repeatDelayStart = 0;\n    }\n\n    const prevTime = this._time;\n    const delta = time - this._lastTime;\n    const reversed = this._reversed;\n    this._lastTime = time;\n    this._time += delta;\n\n    this._progress = this._time > this._duration\n      ? 1\n      : this._time / this._duration;\n\n    // Binary search the sorted entries to only process the active window:\n    // entries overlapping the current time. Since the entry list is frozen\n    // while playing, the sorted order is cached and only rebuilt on change.\n    if (!this._sorted) this._sorted = this._buildSortedEntries();\n\n    const entries = this._sorted;\n    const state = this.state;\n    const { startIndex, endIndex } = this._activeWindow(\n      entries,\n      reversed,\n      prevTime,\n    );\n    let i = startIndex;\n\n    while (i < endIndex) {\n      const entry = entries[i++];\n\n      // reverse start time\n      const startTime = !reversed\n        ? entry.startTime\n        : this._duration - entry.startTime - entry.duration;\n\n      const localTime = this._time - startTime;\n\n      // Calculate local time within the entry's duration\n      let tweenElapsed = localTime / entry.duration;\n      // some limits are in good order for reverse\n      if (tweenElapsed > 1) tweenElapsed = 1;\n      if (tweenElapsed < 0) tweenElapsed = 0;\n\n      // Only build runtime once on first activation\n      if (!entry.isActive && tweenElapsed > 0 && tweenElapsed < 1) {\n        // istanbul ignore else @preserve\n        if (entry.runtime.length === 0) {\n          this._setEntry(entry, state);\n        }\n        entry.isActive = true;\n      }\n\n      // istanbul ignore else @preserve\n      if (entry.isActive) {\n        // super cheap yoyo\n        let easedValue = entry.easing(\n          reversed ? 1 - tweenElapsed : tweenElapsed,\n        );\n        easedValue = reversed ? 1 - easedValue : easedValue;\n        const runtime = entry.runtime;\n\n        const runtimeLen = runtime.length;\n        let j = 0;\n        while (j < runtimeLen) {\n          const prop = runtime[j++];\n          const targetObject = prop[0];\n          const property = prop[1];\n          const interpolator = prop[2];\n          const startVal = reversed ? prop[4] : prop[3];\n          const endVal = reversed ? prop[3] : prop[4];\n\n          if (prop[5]) {\n            state[property as keyof T] = ((startVal as number) +\n              ((endVal as number) - (startVal as number)) * easedValue) as T[\n                keyof T\n              ];\n          } else {\n            interpolator(\n              targetObject as never,\n              startVal as never,\n              endVal as never,\n              easedValue,\n            );\n          }\n        }\n        if (tweenElapsed === 1) entry.isActive = false;\n      }\n    }\n\n    this._onUpdate?.(state, this._progress);\n\n    // istanbul ignore else\n    if (this._progress === 1) {\n      // istanbul ignore else\n      if (this._repeat === 0) {\n        this._isPlaying = false;\n        this._repeat = this._initialRepeat;\n        this._reversed = false;\n        this._onComplete?.(state, 1);\n        this._resetState(true);\n\n        return false;\n      }\n\n      // istanbul ignore else @preserve\n      if (this._repeat !== Infinity) this._repeat--;\n      if (this._yoyo) this._reversed = !reversed;\n\n      this._time = 0;\n      this._resetState();\n      this._onRepeat?.(state, this.progress);\n\n      if (this._repeatDelay > 0) this._repeatDelayStart = time;\n\n      return true;\n    }\n\n    return true;\n  }\n\n  /**\n   * Public method to clear all entries, labels and reset timers to zero\n   * or initial value (repeat).\n   * @returns this\n   */\n  clear(): this {\n    this._entries.length = 0;\n    this._sorted = null;\n    this._duration = 0;\n    this._labels.clear();\n    this._time = 0;\n    this._progress = 0;\n    this._pauseTime = 0;\n    this._lastTime = 0;\n    this._repeatDelay = 0;\n    this._repeat = this._initialRepeat;\n    this._repeatDelayStart = 0;\n    this._reversed = false;\n    return this;\n  }\n\n  /**\n   * Internal method to handle instrumentation of start and end values for interpolation\n   * of a tween entry. Only called once per entry on first activation.\n   * @internal\n   */\n  private _setEntry(entry: TimelineEntry<T>, state: T) {\n    const from = entry.from as Partial<T>;\n    const to = entry.to as Partial<T>;\n    const keysTo = Object.keys(to) as (keyof T)[];\n    const keyLen = keysTo.length;\n    entry.runtime = new Array(keyLen);\n    let rtLen = 0;\n    let j = 0;\n\n    while (j < keyLen) {\n      const key = keysTo[j++];\n      const objValue = state[key] as T[keyof T];\n\n      // Capture current state value for 'from'\n      if (isObject(objValue) || isArray(objValue)) {\n        from[key] = deproxy(objValue);\n      } else {\n        // number\n        from[key] = objValue;\n      }\n\n      const interpolator = this._interpolators.get(key) || null;\n\n      // Hoist the numeric/value-type check out of the per-frame loop\n      const endVal = to[key] as T[keyof T];\n      const isNumeric = typeof endVal === \"number\";\n\n      // Push tuple\n      entry.runtime[rtLen++] = [\n        objValue,\n        key,\n        interpolator,\n        from[key] as T[keyof T],\n        endVal,\n        isNumeric,\n      ] as TimelineEntry<T>[\"runtime\"][0];\n    }\n  }\n\n  /**\n   * Internal method to revert state to initial values and reset entry flags.\n   * @internal\n   */\n  private _resetState(isComplete = false) {\n    let i = 0;\n    const entriesLen = this._entries.length;\n    while (i < entriesLen) {\n      const entry = this._entries[i++];\n      entry.isActive = false;\n    }\n    if (!isComplete) {\n      deepAssign(this.state, this._state);\n    }\n  }\n\n  /**\n   * Internal method to resolve the position relative to the current duration\n   * or a set value in seconds.\n   * @internal\n   */\n  private _resolvePosition(pos?: Position): number {\n    if (typeof pos === \"number\") {\n      return Math.min(this._duration, Math.max(0, pos * 1000));\n    }\n\n    // istanbul ignore else @preserve\n    if (typeof pos === \"string\") {\n      // First try label\n      const labelTime = this._labels.get(pos);\n      if (labelTime !== undefined) return labelTime;\n\n      // Then relative\n      // istanbul ignore else @preserve\n      if (pos.startsWith(\"+=\") || pos.startsWith(\"-=\")) {\n        let offset = parseFloat(pos.slice(2));\n        if (isNaN(offset)) offset = 0;\n        offset *= 1000;\n        return pos.startsWith(\"+=\")\n          ? this._duration + offset\n          : Math.max(0, this._duration - offset);\n      }\n    }\n\n    // Fallback to current duration\n    return this._duration;\n  }\n\n  /**\n   * Internal method to build the sorted entry list, cached while playing.\n   * @internal\n   */\n  private _buildSortedEntries(): TimelineEntry<T>[] {\n    const sorted = this._entries.slice().sort(\n      (a, b) => a.startTime - b.startTime,\n    );\n    let maxDuration = 0;\n    const len = sorted.length;\n    let i = 0;\n    while (i < len) {\n      const duration = sorted[i++].duration;\n      if (duration > maxDuration) maxDuration = duration;\n    }\n    this._maxDuration = maxDuration;\n    return sorted;\n  }\n\n  /**\n   * Internal method to compute the window of entries overlapping the\n   * playback-time span `[min(time, prevTime), max(time, prevTime)]`, so\n   * the update loop only processes active candidates. The bounds are a\n   * safe superset: every entry that is active, finishing or about to\n   * activate within the frame is guaranteed to be inside.\n   * @internal\n   */\n  private _activeWindow(\n    entries: TimelineEntry<T>[],\n    reversed: boolean,\n    prevTime: number,\n  ): { startIndex: number; endIndex: number } {\n    const len = entries.length;\n    if (len === 0) return { startIndex: 0, endIndex: 0 };\n\n    const time = this._time;\n    const loTime = Math.min(time, prevTime);\n    const hiTime = Math.max(time, prevTime);\n    // safe lower bound of the entry start times that could be in play:\n    // - forward:  startTime >= loTime - maxDuration\n    // - reversed: startTime >= duration - hiTime - maxDuration\n    const lower = reversed\n      ? this._duration - hiTime - this._maxDuration\n      : loTime - this._maxDuration;\n    // safe upper bound of the entry start times that could be in play:\n    // - forward:  startTime <= hiTime\n    // - reversed: startTime <= duration - loTime\n    const upper = reversed ? this._duration - loTime : hiTime;\n\n    // binary search the first entry with startTime >= lower\n    let lo = 0;\n    let hi = len;\n    while (lo < hi) {\n      const mid = (lo + hi) >> 1;\n      if (entries[mid].startTime < lower) lo = mid + 1;\n      else hi = mid;\n    }\n    const startIndex = lo;\n\n    // binary search the first entry with startTime > upper\n    lo = 0;\n    hi = len;\n    while (lo < hi) {\n      const mid = (lo + hi) >> 1;\n      if (entries[mid].startTime <= upper) lo = mid + 1;\n      else hi = mid;\n    }\n\n    return { startIndex, endIndex: lo };\n  }\n\n  /**\n   * Internal method to handle validation of initial values and entries values.\n   * @internal\n   */\n  private _evaluate(newObj?: Partial<T> | DeepPartial<T>) {\n    // the reference of the initialization state is stored here\n    // istanbul ignore else @preserve\n    if (!this.isValidState) {\n      const temp = this._state;\n      validateValues.call(this as Timeline, temp);\n      // istanbul ignore else @preserve\n      if (this.isValid) {\n        this.state = temp;\n        this._state = deproxy(temp);\n      }\n    } else if (newObj) {\n      validateValues.call(this as Timeline, newObj, this._state);\n    }\n    return this;\n  }\n\n  /**\n   * Internal method to provide feedback on validation issues.\n   * @internal\n   */\n  private _report() {\n    // istanbul ignore else @preserve\n    if (!this.isValid) {\n      const message = [\n        \"[Timeline] failed validation:\",\n        \"- \" + Array.from(this._errors.values()).join(\"\\n- \"),\n      ].join(\"\\n\");\n\n      console.warn(message);\n    }\n    return this;\n  }\n}\n","// src/Version.ts\nexport const version = \"0.1.5\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAcA,MAAa,SAaT,OAAO,OAAO;;;;CAIhB,QAAQ,OAAO,OAAuD;EACpE,KAAK,QAAwB;GAC3B,OAAO;EACT;EACA,GAAG,QAAwB;GACzB,OAAO;EACT;EACA,IAAI,QAAwB;GAC1B,OAAO;EACT;EACA,MAAM,QAAwB;GAC5B,OAAO;EACT;CACF,CAAC;;;;CAKD,WAAW,OAAO,OACM;EACpB,GAAG,QAAwB;GACzB,OAAO,SAAS;EAClB;EACA,IAAI,QAAwB;GAC1B,OAAO,UAAU,IAAI;EACvB;EACA,MAAM,QAAwB;GAC5B,KAAK,UAAU,KAAK,GAClB,OAAO,KAAM,SAAS;GAGxB,OAAO,OAAQ,EAAE,UAAU,SAAS,KAAK;EAC3C;CACF,CACF;;;;CAKA,OAAO,OA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