{"version":3,"file":"pixi-animate.mjs","sources":["../src/animate/utils.ts","../src/animate/load.ts","../src/animate/sound.ts","../src/animate/Tween.ts","../src/animate/Timeline.ts","../src/animate/Container.ts","../src/animate/MovieClip.ts","../src/animate/Scene.ts","../src/animate/AnimatorTimeline.ts","../src/animate/Animator.ts","../src/animate/Sprite.ts","../src/animate/Graphics.ts","../src/animate/Text.ts","../src/index.ts"],"sourcesContent":["import type { DrawCommands } from './Graphics';\nimport type { TweenProps, KeyframeData, TweenData, TweenablePropNames } from './Tween';\nimport type { DisplayObject } from '@pixi/display';\nimport type { Renderer } from '@pixi/core';\nimport type { Prepare } from '@pixi/prepare';\nimport type { MovieClip } from './MovieClip';\n\n// If the movieclip plugin is installed\nlet _prepare: Prepare = null;\n\n/* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */\n// awkwardly named instead of the final export of 'utils' to avoid problems in .d.ts build tools.\nexport namespace utils\n{\n\n    /**\n     * Convert the Hexidecimal string (e.g., \"#fff\") to uint\n     */\n    export function hexToUint(hex: string): number\n    {\n        // Remove the hash\n        hex = hex.substr(1);\n\n        // Convert shortcolors fc9 to ffcc99\n        if (hex.length === 3)\n        {\n            hex = hex.replace(/([a-f0-9])/g, '$1$1');\n        }\n\n        return parseInt(hex, 16);\n    }\n\n    /**\n     * Fill frames with booleans of true (showing) and false (hidden).\n     * @param timeline -\n     * @param startFrame - The start frame when the timeline shows up\n     * @param duration - The length of showing\n     */\n    export function fillFrames(timeline: boolean[], startFrame: number, duration: number): void\n    {\n        // ensure that the timeline is long enough\n        const oldLength = timeline.length;\n\n        if (oldLength < startFrame + duration)\n        {\n            timeline.length = startFrame + duration;\n            // fill any gaps with false to denote that the child should be removed for a bit\n            if (oldLength < startFrame)\n            {\n                // if the browser has implemented the ES6 fill() function, use that\n                if (timeline.fill)\n                {\n                    timeline.fill(false, oldLength, startFrame);\n                }\n                else\n                {\n                    // if we can't use fill, then do a for loop to fill it\n                    for (let i = oldLength; i < startFrame; ++i)\n                    {\n                        timeline[i] = false;\n                    }\n                }\n            }\n        }\n        // if the browser has implemented the ES6 fill() function, use that\n        if (timeline.fill)\n        {\n            timeline.fill(true, startFrame, startFrame + duration);\n        }\n        else\n        {\n            const length = timeline.length;\n            // if we can't use fill, then do a for loop to fill it\n\n            for (let i = startFrame; i < length; ++i)\n            {\n                timeline[i] = true;\n            }\n        }\n    }\n\n    const keysMap: {[s: string]: keyof TweenProps} = {\n        X: 'x', // x position\n        Y: 'y', // y position\n        A: 'sx', // scale x\n        B: 'sy', // scale y\n        C: 'kx', // skew x\n        D: 'ky', // skew y\n        R: 'r', // rotation\n        L: 'a', // alpha\n        T: 't', // tint\n        F: 'c', // colorTransform\n        V: 'v', // visibility\n    };\n\n    /**\n     * Parse the value of the compressed keyframe.\n     * @param prop - The property key\n     * @param buffer - The contents\n     * @return The parsed value\n     */\n    function parseValue(prop: string, buffer: string): string | number | boolean | (string | number)[]\n    {\n        switch (prop)\n        {\n            // Color transforms are parsed as an array\n            case 'c':\n            {\n                const buff: (string | number)[] = buffer.split(',');\n\n                buff.forEach((val, i, buffer) =>\n                {\n                    buffer[i] = parseFloat(val as string);\n                });\n\n                return buff;\n            }\n            // Tint value should not be converted\n            // can be color uint or string\n            case 't':\n            {\n                return buffer;\n            }\n            // The visiblity parse as boolean\n            case 'v':\n            {\n                return !!parseInt(buffer, 10);\n            }\n            // Everything else parse a floats\n            default:\n            {\n                return parseFloat(buffer);\n            }\n        }\n    }\n\n    const tweenKeysMap: { [s: string]: keyof TweenData } = {\n        D: 'd', // duration\n        // E: 'e', // easing - disabled for manual handling\n        P: 'p', // props\n    };\n\n    /**\n     * Regex to test for a basic ease desccriptor\n     */\n    const basicEase = /(\\-?\\d*\\.?\\d*)([a-zA-Z]+)/;\n\n    /**\n     * Convert serialized tween from a serialized keyframe into TweenData\n     * `\"D20E25EaseIn;PX3Y5A1.2\"` to: `{ d: 20, e: { s: 25, n: \"EaseIn\" }, p: { x:3, y: 5, sx: 1.2 } }`\n     * @param tweenBuffer -\n     * @return Resulting TweenData\n     */\n    function parseTween(tweenBuffer: string): TweenData\n    {\n        const result: TweenData = { d: 0, p: {} };\n\n        let i = 0;\n        let buffer = '';\n        let handlingProps = false;\n        let prop: keyof TweenProps | keyof TweenData;\n\n        // tween format:\n        // D20E25EaseIn;PX3Y5A1.2\n\n        while (i <= tweenBuffer.length)\n        {\n            const c = tweenBuffer[i];\n\n            if (!handlingProps && (tweenKeysMap[prop] || tweenKeysMap[c]))\n            {\n                // handle potential active duration property, which is the only normal one\n                if (prop === 'd')\n                {\n                    (result.d as any) = parseValue(prop, buffer);\n                    prop = null;\n                }\n\n                // seeing the p property kicks us immediately into props mode\n                if (c === 'P')\n                {\n                    handlingProps = true;\n                    ++i;\n                }\n                else\n                {\n                    // only handles D, really\n                    prop = tweenKeysMap[c];\n                    ++i;\n                }\n                buffer = '';\n            }\n            // seeing easing means we need to read ahead to the end of the easing section\n            else if (c === 'E')\n            {\n                // search for the next space or end of the string to see where the tween ends\n                let index = tweenBuffer.indexOf(';', i);\n\n                // should never end early, but just in case we are somehow tweening 0 properties\n                if (index < 0)\n                {\n                    index = tweenBuffer.length;\n                }\n                const easeBuffer = tweenBuffer.substring(i + 1, index);\n\n                if (basicEase.test(easeBuffer))\n                {\n                    const [, strength, name] = basicEase.exec(easeBuffer);\n\n                    // if not yet handling props, apply ease to whole tween\n                    if (!handlingProps)\n                    {\n                        result.e = {\n                            s: parseFloat(strength),\n                            n: name,\n                        };\n                    }\n                    // apply ease to last property read\n                    else if (prop)\n                    {\n                        (result.p[prop as TweenablePropNames] as any) = parseValue(prop, buffer);\n                        if (!result.p.e)\n                        {\n                            result.p.e = {};\n                        }\n                        result.p.e[prop as TweenablePropNames] = {\n                            s: parseFloat(strength),\n                            n: name,\n                        };\n                        prop = null;\n                        buffer = '';\n                    }\n                }\n                else\n                {\n                    // TODO: encode some sort of function for a custom ease\n                }\n\n                i = index + 1;\n            }\n            // normal prop/buffer handling, like in the main deserializeKeyframes function\n            else if (keysMap[c])\n            {\n                if (prop)\n                {\n                    (result.p[prop as keyof TweenProps] as any) = parseValue(prop, buffer);\n                }\n                prop = keysMap[c];\n                buffer = '';\n                i++;\n            }\n            else if (!c)\n            {\n                if (prop)\n                {\n                    (result.p[prop as keyof TweenProps] as any) = parseValue(prop, buffer);\n                }\n                buffer = '';\n                prop = null;\n                i++;\n            }\n            else\n            {\n                buffer += c;\n                i++;\n            }\n        }\n\n        return result;\n    }\n\n    /**\n     * Convert serialized array into keyframes\n     * `\"0x100y100 1x150\"` to: `{ \"0\": {\"x\":100, \"y\": 100}, \"1\": {\"x\": 150} }`\n     * @param keyframes -\n     * @return Resulting keyframes\n     */\n    export function deserializeKeyframes(keyframes: string): {[s: number]: KeyframeData}\n    {\n        const result: {[s: number]: KeyframeData} = {};\n        let i = 0;\n\n        let buffer = '';\n        let isFrameStarted = false;\n        let prop: keyof TweenProps;\n        let frame: KeyframeData = {};\n\n        while (i <= keyframes.length)\n        {\n            const c = keyframes[i];\n\n            // if we found the name of a property\n            if (keysMap[c])\n            {\n                // start a new frame if we need to\n                if (!isFrameStarted)\n                {\n                    isFrameStarted = true;\n                    result[buffer as any] = frame;\n                }\n                // finish a previous prop if one is running\n                if (prop)\n                {\n                    (frame[prop] as any) = parseValue(prop, buffer);\n                }\n                // save the new prop that we are now handling\n                prop = keysMap[c];\n                // reset buffer (because we did the previous prop if we had to)\n                buffer = '';\n                i++;\n            }\n            // contains a tween\n            else if (c === 'W')\n            {\n                // start a new frame if we need to\n                if (!isFrameStarted)\n                {\n                    isFrameStarted = true;\n                    result[buffer as any] = frame;\n                }\n                // finish previous prop\n                if (prop)\n                {\n                    (frame[prop] as any) = parseValue(prop, buffer);\n                    buffer = '';\n                    prop = null;\n                }\n                // search for the next space or end of the string to see where the tween ends\n                let index = keyframes.indexOf(' ', i);\n\n                if (index < 0)\n                {\n                    index = keyframes.length;\n                }\n                // parse the tween section\n                frame.tw = parseTween(keyframes.substring(i + 1, index));\n                // skip past the tween section\n                i = index;\n            }\n            // finish existing prop & frame on end of string or space\n            else if (!c || c === ' ')\n            {\n                i++;\n                if (prop)\n                {\n                    (frame[prop] as any) = parseValue(prop, buffer);\n                }\n                buffer = '';\n                prop = null;\n                frame = {};\n                isFrameStarted = false;\n            }\n            // add to the buffer for the next parse\n            else\n            {\n                buffer += c;\n                i++;\n            }\n        }\n\n        return result;\n    }\n\n    /**\n     * Convert serialized shapes into draw commands for PIXI.Graphics.\n     * @param str -\n     */\n    export function deserializeShapes(str: string): DrawCommands[]\n    {\n        const result = [];\n        // each shape is a new line\n        const shapes = str.split('\\n');\n        const isCommand = /^[a-z]{1,2}$/;\n\n        for (let i = 0; i < shapes.length; i++)\n        {\n            const shape: DrawCommands = shapes[i].split(' '); // arguments are space separated\n\n            for (let j = 0; j < shape.length; j++)\n            {\n                // Convert all numbers to floats, ignore colors\n                const arg = shape[j] as string;\n\n                if (arg[0] !== '#' && !isCommand.test(arg))\n                {\n                    shape[j] = parseFloat(arg);\n                }\n            }\n            result.push(shape);\n        }\n\n        return result;\n    }\n\n    /**\n     * Add movie clips to the upload prepare.\n     * @param item - item To add to the queue\n     */\n    export function addMovieClips(item: any): boolean\n    {\n        if (item.isMovieClip)\n        {\n            const mc = item as MovieClip;\n\n            mc._timedChildTimelines.forEach((timeline) =>\n            {\n                const index = mc.children.indexOf(timeline.target);\n\n                if (index === -1)\n                {\n                    // eslint-disable-next-line no-unused-expressions\n                    _prepare?.add(timeline.target);\n                }\n            });\n\n            return true;\n        }\n\n        return false;\n    }\n\n    /**\n     * Upload all the textures and graphics to the GPU.\n     * @param renderer - Render to upload to\n     * @param clip - MovieClip to upload\n     * @param done - When complete\n     */\n    export function upload(renderer: Renderer, displayObject: DisplayObject, done: () => void): void\n    {\n        if (!_prepare)\n        {\n            _prepare = renderer.plugins.prepare;\n            _prepare.registerFindHook(addMovieClips);\n        }\n        // eslint-disable-next-line no-unused-expressions\n        _prepare?.upload(displayObject).then(done);\n    }\n}\n","import type { Container } from '@pixi/display';\nimport type { AnimateAsset } from '../AnimateAsset';\nimport type { MovieClip } from './MovieClip';\nimport type { DrawCommands } from './Graphics';\nimport { utils } from './utils';\nimport { Assets } from '@pixi/assets';\nimport { Texture } from '@pixi/core';\nimport { Spritesheet } from '@pixi/spritesheet';\n\ntype Complete = (instance: MovieClip | null) => void;\ntype Progress = (value: number) => void;\nexport interface LoadOptions\n{\n    /**\n     * The Container to auto-add the stage to, if createInstance is true.\n     */\n    parent?: Container;\n    /**\n     * Callback for load completion.\n     */\n    complete?: Complete;\n    /**\n     * Callback for load progress.\n     */\n    progress?: Progress;\n    /**\n     * Base root directory\n     */\n    basePath?: string;\n    /**\n     * Enable or disable automatic instantiation of stage - defaults to false.\n     */\n    createInstance?: boolean;\n    /**\n     * Metadata to be handed off to the loader for assets that are loaded.\n     */\n    metadata?: any;\n}\n\nconst EXPECTED_ASSET_VERSION = 2;\n\n/**\n * Load the stage class and preload any assets\n * ```\n * import MyAsset from './myAsset.js';\n * let renderer = new PIXI.autoDetectRenderer(1280, 720);\n * let stage = new PIXI.Container();\n * PIXI.animate.load(MyAsset, function(asset){\n *     stage.addChild(new asset.stage());\n * });\n * function update() {\n *      renderer.render(stage);\n *      update();\n * }\n * update();\n * ```\n * @param scene - Reference to the scene data.\n * @param complete - The callback function when complete.\n * @return instance of PIXI resource loader\n */\nexport function load(scene: AnimateAsset, complete?: Complete): void;\n/**\n * Load the stage class and preload any assets\n * ```\n * import MyAsset from './myAsset.js';\n * let basePath = 'file:/path/to/assets';\n * let renderer = new PIXI.Renderer(1280, 720);\n *\n * let extensions = PIXI.compressedTextures.detectExtensions(renderer);\n * let loader = new PIXI.Loader();\n * // this is an example of setting up a pre loader plugin to handle compressed textures in this case\n * loader.pre(PIXI.compressedTextures.extensionChooser(extensions));\n *\n * // specify metadata this way if you want to provide a default loading strategy for all assets listed in the PIXI animation\n * let metadata = { default: { metadata: { imageMetadata: { choice: ['.crn'] } } } };\n * // specify metadata this way if you want to provide a specific loading strategy for a\n * // certain asset listed inside the PIXI animation library\n * let metadata = { MyStage_atlas_1: { metadata: { imageMetadata: { choice: ['.crn'] } } } };\n *\n * let stage = new PIXI.Container();\n * PIXI.animate.load(MyAsset, {\n *     parent: stage,\n *     complete: ()=>{},\n *     basePath: basePath,\n *     loader: loader,\n *     metadata: metadata\n * });\n * function update() {\n *      renderer.render(stage);\n *      update();\n * }\n * update();\n * ```\n * @param scene - Reference to the scene data.\n * @param options - Options for loading.\n * @return instance of PIXI resource loader\n */\nexport function load(scene: AnimateAsset, options: LoadOptions): void;\nexport function load(scene: AnimateAsset, optionsOrComplete?: Complete | LoadOptions): void\n{\n    const complete: Complete = typeof optionsOrComplete === 'function' ? optionsOrComplete : optionsOrComplete?.complete;\n    const progress: Progress | undefined = typeof optionsOrComplete === 'function' ? undefined : optionsOrComplete?.progress;\n\n    let basePath = '';\n    let parent: Container = null;\n    let metadata: any;\n    let createInstance = false;\n\n    // check scene and warn about it\n    const { version } = scene;\n\n    if (typeof version === 'number')\n    {\n        /* eslint-disable max-len */\n        if (Math.floor(version) !== Math.floor(EXPECTED_ASSET_VERSION))\n        {\n            console.warn(`Asset version is not the major version expected of ${Math.floor(EXPECTED_ASSET_VERSION)} - it may not load properly`, scene);\n        }\n        else if (version > EXPECTED_ASSET_VERSION)\n        {\n            console.warn('Asset has been published with a newer version than PixiAnimate expects. It may not load properly.', scene);\n        }\n        /* eslint-enable max-len */\n    }\n\n    if (optionsOrComplete && typeof optionsOrComplete !== 'function')\n    {\n        basePath = optionsOrComplete.basePath || '';\n        parent = optionsOrComplete.parent;\n        metadata = optionsOrComplete.metadata;\n        createInstance = !!optionsOrComplete.createInstance;\n    }\n\n    function done(): void\n    {\n        const instance = (createInstance && typeof scene.stage === 'function') ? new scene.stage() : null;\n\n        if (parent && instance)\n        {\n            parent.addChild(instance);\n        }\n        if (complete)\n        {\n            complete(instance);\n        }\n    }\n\n    // Check for assets to preload\n    const assets = scene.assets || {};\n\n    if (assets && Object.keys(assets).length)\n    {\n        let totalAssets = 0;\n        let loadedAssets = 0;\n\n        const promises: Promise<any>[] = [];\n        // assetBaseDir can accept either with trailing slash or not\n\n        if (basePath)\n        {\n            basePath += '/';\n        }\n        for (const id in assets)\n        {\n            if (progress) totalAssets++;\n\n            let data = null;\n\n            if (metadata)\n            {\n                // if the metadata was supplied for this particular asset, use these options\n                if (metadata[id])\n                {\n                    data = metadata[id];\n                }\n                // if the metadata supplied a default option\n                else if (metadata.default)\n                {\n                    data = metadata.default;\n                }\n            }\n            promises.push(Assets.load({ alias: [id], src: basePath + assets[id], data }).then((loadedAsset) =>\n            {\n                if (progress)\n                {\n                    loadedAssets++;\n\n                    progress(loadedAssets / totalAssets);\n                }\n\n                if (!loadedAsset)\n                {\n                    return; // not sure if this can ever happen\n                }\n                if (loadedAsset instanceof Spritesheet)\n                {\n                    scene.spritesheets.push(loadedAsset);\n                }\n                else if (loadedAsset instanceof Texture)\n                {\n                    scene.textures[id] = loadedAsset;\n                }\n                else if (Array.isArray(loadedAsset) || typeof loadedAsset === 'string')\n                {\n                    // save shape data\n                    let items: string | DrawCommands[] = loadedAsset;\n\n                    // Decode string to map of files\n                    if (typeof items === 'string')\n                    {\n                        items = utils.deserializeShapes(items);\n                    }\n\n                    // Convert all hex string colors (animate) to int (pixi.js)\n                    for (let i = 0; i < items.length; i++)\n                    {\n                        const item = items[i];\n\n                        for (let j = 0; j < item.length; j++)\n                        {\n                            const arg = item[j];\n\n                            if (typeof arg === 'string' && arg[0] === '#')\n                            {\n                                item[j] = utils.hexToUint(arg);\n                            }\n                        }\n                    }\n                    scene.shapes[id] = items;\n                }\n            }));\n        }\n        Promise.all(promises).then(done);\n    }\n    else\n    {\n        // tiny case where there's only text and no shapes/animations\n        done();\n    }\n}\n","import { EventEmitter } from '@pixi/utils';\n/**\n * @description Event emitter for all sound events. This emits a single\n * `play` event which contains the alias, loop and MovieClip which is playing\n * the sound.\n * @example\n *\n * PIXI.animate.sound.on('play', (alias, loop, context) => {\n *    // custom handle sounds being played\n *    // where 'alias' is the ID in stage assets\n * });\n */\nexport const sound = new EventEmitter();\n","import type { AnimateDisplayObject } from './DisplayObject';\nimport type { Graphics } from '@pixi/graphics';\nimport type { Sprite } from '@pixi/sprite';\n\nexport type EaseMethod = (input: number) => number;\n\n// NOTE ABOUT KEYS OF TweenProps: Use \"(myProps[key] as any) = myVal;\"\n// Typescript is unhelpful in this case: https://github.com/microsoft/TypeScript/issues/31663\nexport interface TweenProps\n{\n    x?: number;\n    y?: number;\n    sx?: number;\n    sy?: number;\n    kx?: number;\n    ky?: number;\n    r?: number;\n    a?: number;\n    t?: number;\n    v?: boolean;\n    c?: number[];\n    m?: Graphics | Sprite;\n    g?: any;\n    /** Eases for any of the tweenable properties, if published as a per-property ease */\n    e?: {[P in TweenablePropNames]?: EaseMethod | {n: string; s: number}};\n}\n\nexport type TweenablePropNames = keyof Omit<TweenProps, 'm' | 'g' | 'e' | 'v'>;\n\nexport interface TweenData\n{\n    d: number;\n    p: TweenProps;\n    e?: EaseMethod | {n: string; s: number};\n}\n\nexport interface KeyframeData extends TweenProps\n{\n    /** Not tweenable, but information about a tween that starts on this frame */\n    tw?: TweenData;\n}\n\n// standard tweening\nfunction lerpValue(start: number, end: number, t: number): number\n{\n    return start + ((end - start) * t);\n}\n\nconst PI = Math.PI;\nconst TWO_PI = PI * 2;\n\n// handle 355 -> 5 degrees only going through a 10 degree change instead of\n// the long way around\n// Math from http://stackoverflow.com/a/2708740\nfunction lerpRotation(start: number, end: number, t: number): number\n{\n    const difference = Math.abs(end - start);\n\n    if (difference > PI)\n    {\n        // We need to add on to one of the values.\n        if (end > start)\n        {\n            // We'll add it on to start...\n            start += TWO_PI;\n        }\n        else\n        {\n            // Add it on to end.\n            end += TWO_PI;\n        }\n    }\n\n    // Interpolate it.\n    const value = (start + ((end - start) * t));\n\n    // wrap to 0-2PI\n    /* if (value >= 0 && value <= TWO_PI)\n        return value;\n    return value % TWO_PI;*/\n\n    // just return, as it's faster\n    return value;\n}\n\n// handle 180 -> -170 degrees only going through a 10 degree change instead of\n// the long way around\n// Math from http://stackoverflow.com/a/2708740\n// We're assuming Skew values are always in the range -PI to PI\nfunction lerpSkew(start: number, end: number, t: number): number\n{\n    const difference = Math.abs(end - start);\n\n    if (difference > PI)\n    {\n        // We need to add on to one of the values.\n        if (end > start)\n        {\n            // We'll add it on to start...\n            start += TWO_PI;\n        }\n        else\n        {\n            // Add it on to end.\n            end += TWO_PI;\n        }\n    }\n\n    // Interpolate it.\n    const value = (start + ((end - start) * t));\n\n    // wrap to -PI to PI\n    if (value > PI) return value - TWO_PI;\n    if (value < -PI) return value + TWO_PI;\n\n    return value;\n}\n\n// split r, g, b into separate values for tweening\nfunction lerpTint(start: number, end: number, t: number): number\n{\n    // split start color into components\n    const sR = (start >> 16) & 0xFF;\n    const sG = (start >> 8) & 0xFF;\n    const sB = start & 0xFF;\n    // split end color into components\n    const eR = (end >> 16) & 0xFF;\n    const eG = (end >> 8) & 0xFF;\n    const eB = end & 0xFF;\n    // lerp red\n    let r = sR + ((eR - sR) * t);\n\n    // clamp red to valid values\n    if (r < 0) r = 0;\n    else if (r > 255) r = 255;\n    // lerp green\n    let g = sG + ((eG - sG) * t);\n\n    // clamp green to valid values\n    if (g < 0) g = 0;\n    else if (g > 255) g = 255;\n    // lerp blue\n    let b = sB + ((eB - sB) * t);\n\n    // clamp blue to valid values\n    if (b < 0) b = 0;\n    else if (b > 255) b = 255;\n\n    const combined = (r << 16) | (g << 8) | b;\n\n    return combined;\n}\n\nconst COLOR_HELPER: number[] = [];\n\nfunction lerpColor(start: number[], end: number[], t: number): number[]\n{\n    COLOR_HELPER[0] = start[0] + ((end[0] - start[0]) * t);\n    COLOR_HELPER[1] = start[1] + ((end[1] - start[1]) * t);\n    COLOR_HELPER[2] = start[2] + ((end[2] - start[2]) * t);\n    COLOR_HELPER[3] = start[3] + ((end[3] - start[3]) * t);\n    COLOR_HELPER[4] = start[4] + ((end[4] - start[4]) * t);\n    COLOR_HELPER[5] = start[5] + ((end[5] - start[5]) * t);\n\n    return COLOR_HELPER;\n}\n\nconst PROP_LERPS: {[P in keyof TweenProps]: (start: number, end: number, t: number) => number} = {\n    // position\n    x: lerpValue,\n    y: lerpValue,\n    // scale\n    sx: lerpValue,\n    sy: lerpValue,\n    // skew\n    kx: lerpSkew,\n    ky: lerpSkew,\n    // rotation\n    r: lerpRotation,\n    // alpha\n    a: lerpValue,\n    // tinting\n    t: lerpTint,\n    // values to be set\n    v: null, // visible\n    c: lerpColor as any, // colorTransform\n    m: null, // mask\n    g: null, // not sure if we'll actually handle graphics this way?\n};\n\nfunction setPropFromShorthand(target: AnimateDisplayObject, prop: keyof TweenProps, value: any): void\n{\n    switch (prop)\n    {\n        case 'x':\n            target.transform.position.x = value;\n            break;\n        case 'y':\n            target.transform.position.y = value;\n            break;\n        case 'sx':\n            target.transform.scale.x = value;\n            break;\n        case 'sy':\n            target.transform.scale.y = value;\n            break;\n        case 'kx':\n            target.transform.skew.x = value;\n            break;\n        case 'ky':\n            target.transform.skew.y = value;\n            break;\n        case 'r':\n            target.transform.rotation = value;\n            break;\n        case 'a':\n            target.alpha = value;\n            break;\n        case 't':\n            target.i(value); // i = setTint\n            break;\n        case 'c':\n            target.setColorTransform(...value as [number, number, number, number, number, number]); // c = setColorTransform\n            break;\n        case 'v':\n            target.visible = value;\n            break;\n        case 'm':\n            target.ma(value); // ma = setMask\n            break;\n    }\n}\n\n// builds an ease in function for a specific exponential power, i.e. quadratic easing is power 2 and cubic is 3\nfunction buildPowIn(power: number): EaseMethod\n{\n    return (t): number => Math.pow(t, power);\n}\n\n// builds an ease out function for a specific exponential power, i.e. quadratic easing is power 2 and cubic is 3\nfunction buildPowOut(power: number): EaseMethod\n{\n    return (t): number => 1 - Math.pow(1 - t, power);\n}\n\n// builds an ease in & out function for a specific exponential power, i.e. quadratic easing is power 2 and cubic is 3\nfunction buildPowInOut(power: number): EaseMethod\n{\n    return (t): number =>\n    {\n        if ((t *= 2) < 1) return 0.5 * Math.pow(t, power);\n\n        return 1 - (0.5 * Math.abs(Math.pow(2 - t, power)));\n    };\n}\nconst ELASTIC_AMPLITUDE = 1;\nconst ELASTIC_PERIOD = 0.3;\nconst ELASTIC_INOUT_PERIOD = 0.3 * 1.5;\n\nconst EASE_DICT: { [name: string]: EaseMethod } = {\n    quadIn: buildPowIn(2),\n    quadOut: buildPowOut(2),\n    quadInOut: buildPowInOut(2),\n    cubicIn: buildPowIn(3),\n    cubicOut: buildPowOut(3),\n    cubicInOut: buildPowInOut(3),\n    quartIn: buildPowIn(4),\n    quartOut: buildPowOut(4),\n    quartInOut: buildPowInOut(4),\n    quintIn: buildPowIn(5),\n    quintOut: buildPowOut(5),\n    quintInOut: buildPowInOut(5),\n    sineIn: (t) => 1 - Math.cos(t * PI / 2),\n    sineOut: (t) => Math.sin(t * PI / 2),\n    sineInOut: (t) => -0.5 * (Math.cos(PI * t) - 1),\n    backIn: (t) => t * t * (((1.7 + 1) * t) - 1.7),\n    backOut: (t) => (--t * t * (((1.7 + 1) * t) + 1.7)) + 1,\n    backInOut: (t) =>\n    {\n        const constVal = 1.7 * 1.525;\n\n        if ((t *= 2) < 1) return 0.5 * (t * t * (((constVal + 1) * t) - constVal));\n\n        return 0.5 * (((t -= 2) * t * (((constVal + 1) * t) + constVal)) + 2);\n    },\n    circIn: (t) => -(Math.sqrt(1 - (t * t)) - 1),\n    circOut: (t) => Math.sqrt(1 - ((--t) * t)),\n    circInOut: (t) =>\n    {\n        if ((t *= 2) < 1) return -0.5 * (Math.sqrt(1 - (t * t)) - 1);\n\n        return 0.5 * (Math.sqrt(1 - ((t -= 2) * t)) + 1);\n    },\n    bounceIn: (t) => 1 - EASE_DICT.bounceOut(1 - t),\n    bounceOut: (t) =>\n    {\n        if (t < 1 / 2.75)\n        {\n            return 7.5625 * t * t;\n        }\n        else if (t < 2 / 2.75)\n        {\n            return (7.5625 * (t -= 1.5 / 2.75) * t) + 0.75;\n        }\n        else if (t < 2.5 / 2.75)\n        {\n            return (7.5625 * (t -= 2.25 / 2.75) * t) + 0.9375;\n        }\n\n        return (7.5625 * (t -= 2.625 / 2.75) * t) + 0.984375;\n    },\n    // eslint-disable-next-line no-confusing-arrow\n    bounceInOut: (t) => t < 0.5 ? EASE_DICT.bounceIn(t * 2) * 0.5 : (EASE_DICT.bounceOut((t * 2) - 1) * 0.5) + 0.5,\n    elasticIn: (t) =>\n    {\n        if (t === 0 || t === 1) return t;\n        const s = ELASTIC_PERIOD / TWO_PI * Math.asin(1 / ELASTIC_AMPLITUDE);\n\n        return -(ELASTIC_AMPLITUDE * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * TWO_PI / ELASTIC_PERIOD));\n    },\n    elasticOut: (t) =>\n    {\n        if (t === 0 || t === 1) return t;\n        const s = ELASTIC_PERIOD / TWO_PI * Math.asin(1 / ELASTIC_AMPLITUDE);\n\n        return (ELASTIC_AMPLITUDE * Math.pow(2, -10 * t) * Math.sin((t - s) * TWO_PI / ELASTIC_PERIOD)) + 1;\n    },\n    elasticInOut: (t) =>\n    {\n        const s = ELASTIC_INOUT_PERIOD / TWO_PI * Math.asin(1 / ELASTIC_AMPLITUDE);\n\n        if ((t *= 2) < 1)\n        {\n            return -0.5 * (ELASTIC_AMPLITUDE * Math.pow(2, 10 * (t -= 1))\n                * Math.sin((t - s) * TWO_PI / ELASTIC_INOUT_PERIOD));\n        }\n\n        return (ELASTIC_AMPLITUDE * Math.pow(2, -10 * (t -= 1))\n            * Math.sin((t - s) * TWO_PI / ELASTIC_INOUT_PERIOD) * 0.5) + 1;\n    },\n};\n\nexport function getEaseFromConfig(config: EaseMethod | { n: string; s: number }): EaseMethod | null\n{\n    if (!config) return null;\n    if (typeof config === 'function') return config;\n    // TODO: use config (name, strength) to determine an ease method\n    // In order to figure that out, we need to test out Animate's actual output values so we know what to use.\n\n    if (config.n === 'classic')\n    {\n        const s = config.s / 100;\n\n        // (s + 1)t + (-s)(t^2)\n        return (t: number): number => ((s + 1) * t) + ((-s) * t * t);\n    }\n\n    return EASE_DICT[config.n];\n}\n\n/**\n * Provides timeline playback of movieclip\n */\nexport class Tween\n{\n    /**\n     * Target display object.\n     */\n    public target: AnimateDisplayObject;\n    /**\n     * Properties at the start of the tween\n     */\n    public startProps: TweenProps;\n    /**\n     * Properties at the end of the tween, as well as any properties that are set\n     * instead of tweened\n     */\n    public endProps: TweenProps;\n    /**\n     * duration of tween in frames. A single-frame keyframe has a duration of 0.\n     */\n    public duration: number;\n    /**\n     * The frame that the tween starts on\n     */\n    public startFrame: number;\n    /**\n     * the frame that the tween ends on\n     */\n    public endFrame: number;\n    /**\n     * easing function to use, if any\n     */\n    public ease: {[P in TweenablePropNames]?: EaseMethod};\n    /**\n     * If we don't tween.\n     */\n    public isTweenlessFrame: boolean;\n\n    /**\n     * @param target - The target to play\n     * @param startProps - The starting properties\n     * @param endProps - The ending properties\n     * @param startFrame - frame number on which to begin tweening\n     * @param duration - Number of frames to tween\n     * @param ease - Ease function to use\n     */\n    constructor(target: AnimateDisplayObject,\n        startProps: TweenProps,\n        endProps: TweenProps | null,\n        startFrame: number,\n        duration: number,\n        ease?: EaseMethod)\n    {\n        this.target = target;\n        this.startProps = startProps;\n        this.endProps = {};\n        this.duration = duration;\n        this.startFrame = startFrame;\n        this.endFrame = startFrame + duration;\n        this.ease = {};\n        this.isTweenlessFrame = !endProps;\n\n        if (endProps)\n        {\n            // make a copy to safely include any unchanged values from the start of the tween\n            for (const prop in endProps)\n            {\n                if (prop === 'e') continue;\n                // read the end value\n                (this.endProps[prop as TweenablePropNames] as any) = endProps[prop as TweenablePropNames];\n                // if there is an ease for that property, use that\n                if (endProps.e?.[prop as TweenablePropNames])\n                {\n                    this.ease[prop as TweenablePropNames] = getEaseFromConfig(endProps.e[prop as TweenablePropNames]);\n                }\n                // otherwise use the global ease for this tween (if any)\n                else\n                {\n                    this.ease[prop as TweenablePropNames] = ease;\n                }\n            }\n        }\n\n        // copy in any starting properties don't change\n        for (const prop in startProps)\n        {\n            // eslint-disable-next-line no-prototype-builtins\n            if (!this.endProps.hasOwnProperty(prop))\n            {\n                (this.endProps[prop as keyof TweenProps] as any) = startProps[prop as keyof TweenProps];\n            }\n        }\n    }\n\n    /**\n     * Set the current frame.\n     */\n    public setPosition(currentFrame: number): void\n    {\n        // if this is a single frame with no tweening, or at the end of the tween, then\n        // just speed up the process by setting values\n        if (currentFrame >= this.endFrame)\n        {\n            this.setToEnd();\n\n            return;\n        }\n\n        if (this.isTweenlessFrame)\n        {\n            this.setToEnd();\n\n            return;\n        }\n\n        const time = (currentFrame - this.startFrame) / this.duration;\n\n        const target = this.target;\n        const startProps = this.startProps;\n        const endProps = this.endProps;\n\n        for (const prop in endProps)\n        {\n            const p = prop as keyof TweenProps;\n            const lerp = PROP_LERPS[p];\n            let lerpedTime = time;\n\n            if (this.ease[prop as TweenablePropNames])\n            {\n                lerpedTime = this.ease[prop as TweenablePropNames](time);\n            }\n\n            if (lerp)\n            {\n                setPropFromShorthand(target, p, lerp(startProps[p], endProps[p], lerpedTime));\n            }\n            else\n            {\n                setPropFromShorthand(target, p, startProps[p]);\n            }\n        }\n    }\n\n    /**\n     * Set to the end position\n     */\n    setToEnd(): void\n    {\n        const endProps = this.endProps;\n        const target = this.target;\n\n        for (const prop in endProps)\n        {\n            setPropFromShorthand(target, prop as keyof TweenProps, endProps[prop as keyof TweenProps]);\n        }\n    }\n}\n","import { Tween, TweenProps, EaseMethod } from './Tween';\nimport type { AnimateDisplayObject } from './DisplayObject';\n\n/**\n * The Timeline class represents a series of tweens, tied to keyframes.\n */\nexport class Timeline extends Array<Tween>\n{\n    /**\n     * The target DisplayObject.\n     */\n    public target: AnimateDisplayObject;\n    /**\n     * Current properties in the tween, to make building the timeline more\n     * efficient.\n     */\n    private _currentProps: TweenProps;\n\n    /**\n     * Creates a new Timeline. Must be used instead of a constructor because extending the Array\n     * class is a pain: https://blog.simontest.net/extend-array-with-typescript-965cc1134b3\n     * @param target - The target for this string of tweens.\n     * @returns A new Timeline instance.\n     */\n    public static create(target: AnimateDisplayObject): Timeline\n    {\n        const out = Object.create(Timeline.prototype) as Timeline;\n\n        out.target = target;\n        out._currentProps = {};\n\n        return out;\n    }\n\n    // exists to be private to prevent usage\n    private constructor()\n    {\n        super();\n    }\n\n    /**\n     * Adds one or more tweens (or timelines) to this timeline. The tweens will be paused (to\n     * remove them from the normal ticking system and managed by this timeline. Adding a tween to\n     * multiple timelines will result in unexpected behaviour.\n     * @param tween - The tween(s) to add. Accepts multiple arguments.\n     * @return Tween The first tween that was passed in.\n     */\n    public addTween(properties: TweenProps, startFrame: number, duration: number, ease?: EaseMethod): void\n    {\n        this.extendLastFrame(startFrame - 1);\n        // figure out what the starting values for this tween should be\n        // ownership of startProps is passed to the new Tween - this object should not be reused\n        const startProps: TweenProps = Object.assign({}, this._currentProps);\n\n        for (const prop in properties)\n        {\n            const p = prop as keyof TweenProps;\n\n            // if we have not already set that property in an earlier tween, handle that property\n            if (!Object.hasOwnProperty.call(this._currentProps, prop))\n            {\n                const startValue = (startProps[p] as any) = this.getPropFromShorthand(p);\n\n                // go through previous tweens to set the value so that when the timeline loops\n                // around, the values are set properly - having each tween know what came before\n                // allows us to set to a specific frame without running through the entire timeline\n                for (let i = this.length - 1; i >= 0; --i)\n                {\n                    (this[i].startProps[p] as any) = startValue;\n                    (this[i].endProps[p] as any) = startValue;\n                }\n            }\n        }\n        // create the new Tween and add it to the list\n        const tween = new Tween(this.target, startProps, properties, startFrame, duration, ease);\n\n        // if we have this frame already, replace it\n        if (startFrame === this[this.length - 1].startFrame)\n        {\n            this[this.length - 1] = tween;\n        }\n        // otherwise add it to the list\n        else\n        {\n            this.push(tween);\n        }\n        // update starting values for the next tween - if tweened values included 'p', then Tween\n        // parsed that to add additional data that is required\n        Object.assign(this._currentProps, tween.endProps);\n    }\n\n    /**\n     * Add a single keyframe that doesn't tween.\n     * Note that this has some capability to insert keyframes into the middle of a timeline, in order to\n     * handle how masks are published, it should only be relied upon to add keyframes to the end of a timeline.\n     * @param properties - The properties to set.\n     * @param startFrame - The starting frame index.\n     * @param duration - The number of frames to hold beyond startFrame (0 is single frame)\n     */\n    public addKeyframe(properties: TweenProps, startFrame: number, duration = 0): void\n    {\n        // see if we need to go back in and insert properties\n        if (this.length && this[this.length - 1].startFrame >= startFrame)\n        {\n            for (let i = this.length - 1; i >= 0; --i)\n            {\n                const prev = this[i];\n\n                // insert into an existing frame that shares the same keyframe\n                if (prev.startFrame === startFrame)\n                {\n                    // update the start props\n                    Object.assign(prev.startProps, properties);\n                    // carry the new props over unless they're already overridden by end props\n                    prev.endProps = Object.assign({}, prev.startProps, prev.endProps);\n                    // go through any later keyframes to update them the same way\n                    for (let k = i + 1; k < this.length; ++k)\n                    {\n                        const next = this[k];\n\n                        next.startProps = Object.assign({}, properties, next.startProps);\n                        next.endProps = Object.assign({}, next.startProps, next.endProps);\n                    }\n                    break;\n                }\n                // insert into the middle of an extended keyframe (but *not* one that tweens)\n                else if (prev.startFrame < startFrame && prev.endFrame > startFrame && prev.isTweenlessFrame)\n                {\n                    prev.endFrame = startFrame - 1;\n                    const startProps = Object.assign({}, prev.endProps, properties);\n                    // create the new Tween and add it to the list\n                    const tween = new Tween(this.target, startProps, null, startFrame, duration);\n\n                    this.splice(i, 0, tween);\n                    // go through any later keyframes to update them with our inserted props\n                    for (let k = i + 1; k < this.length; ++k)\n                    {\n                        const next = this[k];\n\n                        next.startProps = Object.assign({}, properties, next.startProps);\n                        next.endProps = Object.assign({}, next.startProps, next.endProps);\n                    }\n                    break;\n                }\n                // insert in a gap between frames (which shouldn't really happen, but just in case)\n                else if (prev.endFrame < startFrame)\n                {\n                    const startProps = Object.assign({}, prev.endProps, properties);\n                    // create the new Tween and add it to the list\n                    const tween = new Tween(this.target, startProps, null, startFrame, duration);\n\n                    this.splice(i, 0, tween);\n\n                    // go through any later keyframes to update them with our inserted props\n                    for (let k = i + 1; k < this.length; ++k)\n                    {\n                        const next = this[k];\n\n                        next.startProps = Object.assign({}, properties, next.startProps);\n                        next.endProps = Object.assign({}, next.startProps, next.endProps);\n                    }\n                    break;\n                }\n            }\n            // save in current props, but don't take priority over existing values since we went back in time\n            Object.assign(this._currentProps, properties, this._currentProps);\n        }\n        else\n        {\n            this.extendLastFrame(startFrame - 1);\n            const startProps = Object.assign({}, this._currentProps, properties);\n            // create the new Tween and add it to the list\n            const tween = new Tween(this.target, startProps, null, startFrame, duration);\n\n            this.push(tween);\n            Object.assign(this._currentProps, tween.endProps);\n        }\n    }\n\n    /**\n     * Extend the last frame of the tween.\n     * @param endFrame - The ending frame index.\n     */\n    public extendLastFrame(endFrame: number): void\n    {\n        if (this.length)\n        {\n            const prevTween = this[this.length - 1];\n\n            if (prevTween.endFrame < endFrame)\n            {\n                if (prevTween.isTweenlessFrame)\n                {\n                    prevTween.endFrame = endFrame;\n                    prevTween.duration = endFrame - prevTween.startFrame;\n                }\n                else\n                {\n                    this.addKeyframe(\n                        this._currentProps,\n                        prevTween.endFrame + 1,\n                        endFrame - (prevTween.endFrame + 1),\n                    );\n                }\n            }\n        }\n    }\n\n    /**\n     * Get the value for a property\n     * @param prop\n     */\n    private getPropFromShorthand<P extends keyof TweenProps>(prop: P): TweenProps[P]\n    {\n        const target = this.target;\n\n        switch (prop)\n        {\n            case 'x':\n                return target.position.x as any;\n            case 'y':\n                return target.position.y as any;\n            case 'sx':\n                return target.scale.x as any;\n            case 'sy':\n                return target.scale.y as any;\n            case 'kx':\n                return target.skew.x as any;\n            case 'ky':\n                return target.skew.y as any;\n            case 'r':\n                return target.rotation as any;\n            case 'a':\n                return target.alpha as any;\n            case 'v':\n                return target.visible as any;\n            case 'm':\n                return target.mask as any;\n                // case 't':\n                //   return target.tint;\n                // not sure if we'll actually handle graphics this way?\n                // g: return null;\n        }\n\n        return null;\n    }\n\n    public destroy(): void\n    {\n        this._currentProps = null;\n        this.length = 0;\n    }\n}\n","import { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { Container } from '@pixi/display';\nimport { Graphics } from '@pixi/graphics';\nimport { Sprite } from '@pixi/sprite';\nimport { utils } from './utils';\n\n/**\n * Utility subclass of PIXI.Container\n */\nexport class AnimateContainer extends Container\n{\n    // **************************\n    //     Container methods\n    // **************************\n\n    /**\n     * Shortcut for `addChild`.\n     */\n    public ac = super.addChild;\n\n    // **************************\n    //     DisplayObject methods\n    // **************************\n\n    /**\n     * Function to set if this is renderable or not. Useful for setting masks.\n     * @param renderable - Make renderable. Defaults to false.\n     * @return This instance, for chaining.\n     */\n    public setRenderable(renderable?: boolean): this\n    {\n        this.renderable = !!renderable;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setRenderable`.\n     */\n    public re = this.setRenderable;\n\n    /**\n     * Shortcut for `setTransform`.\n     */\n    public t = super.setTransform;\n\n    /**\n     * Setter for mask to be able to chain.\n     * @param mask - The mask shape to use\n     * @return Instance for chaining\n     */\n    public setMask(mask: Graphics | Sprite): this\n    {\n        // According to PIXI, only Graphics and Sprites can\n        // be used as mask, let's ignore everything else, like other\n        // movieclips and displayobjects/containers\n        if (mask)\n        {\n            if (!(mask instanceof Graphics) && !(mask instanceof Sprite))\n            {\n                if (typeof console !== 'undefined' && console.warn)\n                {\n                    console.warn('Warning: Masks can only be PIXI.Graphics or PIXI.Sprite objects.');\n                }\n\n                return this;\n            }\n        }\n        this.mask = mask;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setMask`.\n     */\n    public ma = this.setMask;\n\n    /**\n     * Chainable setter for alpha\n     * @param alpha - The alpha amount to use, from 0 to 1\n     * @return Instance for chaining\n     */\n    public setAlpha(alpha: number): this\n    {\n        this.alpha = alpha;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setAlpha`.\n     */\n    public a = this.setAlpha;\n\n    /**\n     * Set the tint values by color.\n     * @param tint - The color value to tint\n     * @return Object for chaining\n     */\n    public setTint(tint: string | number): this\n    {\n        if (typeof tint === 'string')\n        {\n            tint = utils.hexToUint(tint);\n        }\n        // this.tint = tint\n        // return this;\n        // TODO: Replace with DisplayObject.tint setter\n        // once the functionality is added to Pixi.js, for\n        // now we'll use the slower ColorMatrixFilter to handle\n        // the color transformation\n        const r = (tint >> 16) & 0xFF;\n        const g = (tint >> 8) & 0xFF;\n        const b = tint & 0xFF;\n\n        return this.setColorTransform(r / 255, 0, g / 255, 0, b / 255, 0);\n    }\n    /**\n     * Shortcut for `setTint`.\n     */\n    public i = this.setTint;\n\n    /**\n     * Set additive and multiply color, tinting\n     * @param r - The multiply red value\n     * @param rA - The additive red value\n     * @param g - The multiply green value\n     * @param gA - The additive green value\n     * @param b - The multiply blue value\n     * @param bA - The additive blue value\n     * @return Object for chaining\n     */\n    public setColorTransform(r: number, rA: number, g: number, gA: number, b: number, bA: number): this\n    {\n        const filter = this.colorTransformFilter;\n\n        filter.matrix[0] = r;\n        filter.matrix[4] = rA;\n        filter.matrix[6] = g;\n        filter.matrix[9] = gA;\n        filter.matrix[12] = b;\n        filter.matrix[14] = bA;\n        this.filters = [filter];\n\n        return this;\n    }\n    /**\n     * Shortcut for `setColor`.\n     */\n    public c = this.setColorTransform;\n\n    protected _colorTransformFilter: ColorMatrixFilter;\n    /**\n     * The current default color transforming filters\n     */\n    public set colorTransformFilter(filter: ColorMatrixFilter)\n    {\n        this._colorTransformFilter = filter;\n    }\n    public get colorTransformFilter(): ColorMatrixFilter\n    {\n        return this._colorTransformFilter || new ColorMatrixFilter();\n    }\n}\n","import { Timeline } from './Timeline';\nimport { TweenProps, EaseMethod, getEaseFromConfig, KeyframeData } from './Tween';\nimport { utils } from './utils';\nimport { sound } from './sound';\nimport { AnimateContainer } from './Container';\nimport type { AnimateDisplayObject } from './DisplayObject';\nimport { Ticker } from '@pixi/ticker';\nimport { settings } from '@pixi/settings';\nimport type { Graphics } from '@pixi/graphics';\nimport type { Sprite } from '@pixi/sprite';\nimport type { IDestroyOptions } from '@pixi/display';\nconst SharedTicker = Ticker.shared;\n\nexport interface MovieClipOptions\n{\n    /**\n     * The default playback mode is independent (0). Child movieclips are given a different value as subordinate objects.\n     */\n    mode?: number;\n    /**\n     * The starting frame. Default is 0.\n     */\n    startPosition?: number;\n    /**\n     * If playback is looped. Default is true.\n     */\n    loop?: boolean;\n    /**\n     * The frame labels map - label to frames\n     */\n    labels?: LabelMap;\n    /**\n     * The duration of the clip. If no duration is provided, length is automatically determined.\n     */\n    duration?: number;\n    /**\n     * The framerate to use for an independent mode MovieClip. Default is 24.\n     */\n    framerate?: number;\n}\n\nexport interface FrameLabel\n{\n    label: string;\n    position: number;\n}\n\nexport interface LabelMap\n{\n    [label: string]: number;\n}\n\nexport type FrameAction = (this: MovieClip) => void;\n\ntype TimedChildTimeline = boolean[] & {target?: AnimateDisplayObject};\n\n/**\n * Provide timeline playback of movieclip\n */\nexport class MovieClip extends AnimateContainer\n{\n    /**\n     * The MovieClip will advance independently of its parent, even if its parent is paused.\n     * This is the default mode.\n     */\n    public static readonly INDEPENDENT = 0;\n\n    /**\n     * The MovieClip will only display a single frame (as determined by the startPosition property).\n     */\n    public static readonly SINGLE_FRAME = 1;\n\n    /**\n     * The MovieClip will be advanced only when its parent advances and will be synched to the position of\n     * the parent MovieClip.\n     */\n    public static readonly SYNCHED = 2;\n\n    /**\n     * The default framerate if none is specified or there's not parent clip with a framerate.\n     */\n    public static readonly DEFAULT_FRAMERATE = 24;\n\n    /**\n     * Fast way of checking if a movie clip is actually a movie clip.\n     * Prevents circular references and is faster than instanceof.\n     */\n    public isMovieClip = true;\n\n    /**\n     * Controls how this MovieClip advances its time. Must be one of 0 (INDEPENDENT), 1 (SINGLE_FRAME), or 2 (SYNCHED).\n     * See each constant for a description of the behaviour.\n     */\n    public mode: number;\n\n    /**\n     * Specifies what the first frame to play in this movieclip, or the only frame to display if mode is SINGLE_FRAME.\n     */\n    public startPosition: number;\n\n    /**\n     * Indicates whether this MovieClip should loop when it reaches the end of its timeline.\n     */\n    public loop: boolean;\n\n    /**\n     * The current frame of the movieclip.\n     * @readOnly\n     */\n    public currentFrame: number;\n\n    /**\n     * The collection of private labels\n     */\n    private _labels: FrameLabel[];\n\n    /**\n     * The collection of private labels\n     */\n    private _labelDict: LabelMap;\n\n    /**\n     * If true, this movieclip will animate automatically whenever it is on the stage.\n     */\n    public selfAdvance: boolean;\n\n    /**\n     * If true, the MovieClip's position will not advance when ticked.\n     */\n    public paused: boolean;\n\n    /**\n     * If true, actions in this MovieClip's tweens will be run when the playhead advances.\n     */\n    public actionsEnabled: boolean;\n\n    /**\n     * If true, the MovieClip will automatically be reset to its first frame whenever the timeline adds\n     * it back onto the display list. This only applies to MovieClip instances with mode=INDEPENDENT.\n     * <br><br>\n     * For example, if you had a character animation with a 'body' child MovieClip instance\n     * with different costumes on each frame, you could set body.autoReset = false, so that\n     * you can manually change the frame it is on, without worrying that it will be reset\n     * automatically.\n     */\n    public autoReset: boolean;\n\n    /**\n     * Offset from parent frame for a synched movieclip.\n     */\n    private _synchOffset: number;\n\n    /**\n     * Previous position that this movieclip was stopped on.\n     */\n    private _prevPos: number;\n\n    /**\n     * Note - changed from default: When the MovieClip is framerate independent, this is the time\n     * elapsed from frame 0 in seconds.\n     */\n    private _t: number;\n\n    /**\n     * By default MovieClip instances advance one frame per tick. Specifying a framerate for the MovieClip\n     * will cause it to advance based on elapsed time between ticks as appropriate to maintain the target\n     * framerate.\n     */\n    protected _framerate: number;\n\n    /**\n     * The total time in seconds for the animation. This is changed when setting the framerate.\n     */\n    private _duration: number;\n\n    /**\n     * The total duration in frames for the animation.\n     */\n    private _totalFrames: number;\n\n    /**\n     * Standard tween timelines for all objects. Each element in the _timelines array\n     * is a Timeline object - an array of tweens for one target, in order of occurrence.\n     */\n    protected _timelines: Timeline[];\n\n    /**\n     * Array of child timelines denoting if a child is actively a child of this movieclip\n     * on any given frame. Each element in the _timedChildTimelines is an array with a 'target'\n     * property, and is an array of boolean values indexed by frame.\n     * @private\n     */\n    public _timedChildTimelines: TimedChildTimeline[];\n\n    /**\n     * Array to depth sort timed children\n     */\n    protected _depthSorted: AnimateDisplayObject[];\n\n    /**\n     * Array of frame scripts, indexed by frame.\n     */\n    protected _actions: FrameAction[][];\n\n    /**\n     * Optional callback fired before timeline is updated.\n     * Can be used to clamp or update the currentFrame.\n     * @private\n     */\n    public _beforeUpdate: (target: MovieClip) => (() => void | null);\n\n    /**\n     * Internal property used to control child MovieClips relative to parents.\n     */\n    private parentStartPosition: number;\n\n    /**\n     * @param options - The options object\n     */\n    constructor(options?: MovieClipOptions);\n    /**\n     * @param mode - The playback mode default is independent (0),\n     * @param duration - The duration, if no duration is provided, auto determines length\n     * @param loop - If playback is looped\n     * @param framerate - The framerate to use for independent mode\n     * @param labels - The frame labels map of label to frames\n     */\n    constructor(mode?: number, duration?: number, loop?: boolean, framerate?: number, labels?: LabelMap);\n    constructor(\n        options?: MovieClipOptions | number,\n        duration?: number,\n        loop?: boolean,\n        framerate?: number,\n        labels?: LabelMap\n    )\n    {\n        super();\n\n        // Default options\n        options = options === undefined ? {} : options;\n\n        // Options can also be the mode\n        if (typeof options === 'number')\n        {\n            options = {\n                mode: options || MovieClip.INDEPENDENT,\n                duration: duration || 0,\n                loop: loop === undefined ? true : loop,\n                labels: labels || {},\n                framerate: framerate || 0,\n                startPosition: 0,\n            };\n        }\n        else\n        {\n            // Apply defaults to options\n            options = Object.assign({\n                mode: MovieClip.INDEPENDENT,\n                startPosition: 0,\n                loop: true,\n                labels: {},\n                duration: 0,\n                framerate: 0,\n            }, options);\n        }\n\n        this.mode = options.mode;\n        this.startPosition = options.startPosition;\n        this.loop = !!options.loop;\n        this.currentFrame = 0;\n        this._labels = [];\n        this._labelDict = options.labels;\n\n        if (options.labels)\n        {\n            for (const name in options.labels)\n            {\n                const label = {\n                    label: name,\n                    position: options.labels[name],\n                };\n\n                this._labels.push(label);\n            }\n            this._labels.sort((a, b) => a.position - b.position);\n        }\n\n        this.selfAdvance = true;\n        this.paused = false;\n        this.actionsEnabled = true;\n        this.autoReset = true;\n        this._synchOffset = 0;\n        this._prevPos = -1; // TODO: evaluate using a ._reset Boolean prop instead of -1.\n        this._t = 0;\n        this._framerate = options.framerate;\n        this._duration = 0;\n        this._totalFrames = options.duration;\n        this._timelines = [];\n        this._timedChildTimelines = [];\n        this._depthSorted = [];\n        this._actions = [];\n        this._beforeUpdate = null;\n        this.parentStartPosition = 0;\n\n        if (this.mode === MovieClip.INDEPENDENT)\n        {\n            this._tickListener = this._tickListener.bind(this);\n            this._onAdded = this._onAdded.bind(this);\n            this._onRemoved = this._onRemoved.bind(this);\n            this.on('added', this._onAdded);\n            this.on('removed', this._onRemoved);\n        }\n\n        if (options.framerate)\n        {\n            this.framerate = options.framerate;\n        }\n\n        // save often used methods on the instance so that they can be fetched slightly faster\n        // than if they had to be fetched from the prototype\n        /* eslint-disable no-self-assign */\n        this.advance = this.advance;\n        this._updateTimeline = this._updateTimeline;\n        this._setTimelinePosition = this._setTimelinePosition;\n        this._goto = this._goto;\n        /* eslint-enable no-self-assign */\n    }\n\n    private _onAdded(): void\n    {\n        if (!this._framerate)\n        {\n            this.framerate = this.parentFramerate;\n        }\n        SharedTicker.add(this._tickListener, null);\n    }\n\n    private _tickListener(tickerDeltaTime: number): void\n    {\n        if (this.paused || !this.selfAdvance)\n        {\n            // see if the movieclip needs to be updated even though it isn't animating\n            if (this._prevPos < 0)\n            {\n                this._goto(this.currentFrame);\n            }\n\n            return;\n        }\n        const seconds = tickerDeltaTime / settings.TARGET_FPMS / 1000;\n\n        this.advance(seconds);\n    }\n\n    private _onRemoved(): void\n    {\n        SharedTicker.remove(this._tickListener, null);\n    }\n\n    /**\n     * Returns an array of objects with label and position (aka frame) properties, sorted by position.\n     */\n    public get labels(): FrameLabel[]\n    {\n        return this._labels;\n    }\n\n    /**\n     * Returns a dictionary of labels where key is the label and value is the frame.\n     */\n    public get labelsMap(): LabelMap\n    {\n        return this._labelDict;\n    }\n\n    /**\n     * Returns the name of the label on or immediately before the current frame.\n     */\n    public get currentLabel(): string | null\n    {\n        const labels = this._labels;\n        let current: string = null;\n\n        for (let i = 0, len = labels.length; i < len; ++i)\n        {\n            if (labels[i].position <= this.currentFrame)\n            {\n                current = labels[i].label;\n            }\n            else\n            {\n                break;\n            }\n        }\n\n        return current;\n    }\n\n    /**\n     * When the MovieClip is framerate independent, this is the time elapsed from frame 0 in seconds.\n     */\n    public get elapsedTime(): number\n    {\n        return this._t;\n    }\n\n    public set elapsedTime(value)\n    {\n        this._t = value;\n    }\n\n    /**\n     * By default MovieClip instances advance one frame per tick. Specifying a framerate for the\n     * MovieClip will cause it to advance based on elapsed time between ticks as appropriate to\n     * maintain the target framerate.\n     *\n     * For example, if a MovieClip with a framerate of 10 is placed on a Stage being updated at\n     * 40fps, then the MovieClip advance roughly one frame every 4 ticks. This will not be exact,\n     * because the time between each tick vary slightly between frames.\n     *\n     * This feature is dependent on the tick event object (or an object with an appropriate 'delta' property) being\n     * passed into {{#crossLink 'Stage/update'}}{{/crossLink}}.\n     */\n    public get framerate(): number\n    {\n        return this._framerate;\n    }\n    public set framerate(value)\n    {\n        if (value > 0)\n        {\n            if (this._framerate)\n            {\n                // recalculate time based on difference between new and old framerate:\n                this._t *= this._framerate / value;\n            }\n            else\n            {\n                this._t = this.currentFrame / value;\n            }\n            this._framerate = value;\n            this._duration = value ? this._totalFrames / value : 0;\n        }\n        else\n        {\n            this._t = this._framerate = this._duration = 0;\n        }\n    }\n\n    /**\n     * Get the total number of frames (duration) of this MovieClip\n     */\n    public get totalFrames(): number\n    {\n        return this._totalFrames;\n    }\n\n    /**\n     * Extend the timeline to the last frame.\n     */\n    private _autoExtend(endFrame: number): void\n    {\n        if (this._totalFrames < endFrame)\n        {\n            this._totalFrames = endFrame;\n        }\n    }\n\n    /**\n     * Convert values of properties\n     */\n    private _parseProperties(properties: TweenProps & {t?: string | number; v?: number | boolean}): void\n    {\n        // Convert any string colors to uints\n        if (typeof properties.t === 'string')\n        {\n            properties.t = utils.hexToUint(properties.t);\n        }\n        else if (typeof properties.v === 'number')\n        {\n            properties.v = !!properties.v;\n        }\n    }\n\n    /**\n     * Get a timeline for a child, synced timeline.\n     */\n    private _getChildTimeline(instance: AnimateDisplayObject): Timeline\n    {\n        for (let i = this._timelines.length - 1; i >= 0; --i)\n        {\n            if (this._timelines[i].target === instance)\n            {\n                return this._timelines[i];\n            }\n        }\n        const timeline = Timeline.create(instance);\n\n        this._timelines.push(timeline);\n\n        return timeline;\n    }\n\n    /**\n     * Add mask or masks\n     */\n    public addTimedMask(instance: AnimateDisplayObject, keyframes: {[frame: number]: Graphics | Sprite}): this\n    {\n        for (const i in keyframes)\n        {\n            this.addKeyframe(instance, {\n                m: keyframes[i],\n            }, parseInt(i, 10));\n        }\n\n        // Set the initial position/add\n        this._setTimelinePosition(this.currentFrame, this.currentFrame, true);\n\n        return this;\n    }\n\n    /**\n     * Shortcut alias for `addTimedMask`\n     */\n    public am = this.addTimedMask;\n\n    /**\n     * Shortcut alias for `addTween`\n     */\n    public tw = this.addTween;\n\n    /**\n     * Add a tween to the clip\n     * @param instance - The clip to tween\n     * @param properties - The property or property to tween\n     * @param startFrame - The frame to start tweening\n     * @param duration - Number of frames to tween. If 0, then the properties are set with no tweening.\n     * @param ease - An optional easing function that takes the tween time from 0-1.\n     */\n    public addTween(instance: AnimateDisplayObject,\n        properties: TweenProps,\n        startFrame: number,\n        duration?: number,\n        ease?: EaseMethod): this\n    {\n        const timeline = this._getChildTimeline(instance);\n\n        this._parseProperties(properties);\n        timeline.addTween(properties, startFrame, duration, ease);\n        this._autoExtend(startFrame + duration);\n\n        return this;\n    }\n\n    /**\n     * Add a tween to the clip\n     * @param instance - The clip to tween\n     * @param properties - The property or property to tween\n     * @param startFrame - The frame to start tweening\n     */\n    public addKeyframe(instance: AnimateDisplayObject, properties: KeyframeData, startFrame: number): this\n    {\n        const timeline = this._getChildTimeline(instance);\n        const { tw } = properties;\n\n        // remove tw property just so that it doesn't mess anything up or confuse anyone doing debugging\n        delete properties.tw;\n        this._parseProperties(properties);\n        // add keyframe - note that even if we add a tween immediately afterwards, we want to\n        // add this keyframe in order to make sure the starting properties are set\n        timeline.addKeyframe(properties, startFrame);\n        this._autoExtend(startFrame);\n        // Add a tween if present in the keyframe data\n        if (tw)\n        {\n            this.addTween(instance, tw.p, startFrame, tw.d, getEaseFromConfig(tw.e));\n        }\n\n        return this;\n    }\n\n    /**\n     * Alias for method `addTimedChild`\n     */\n    public at = this.addTimedChild;\n\n    /**\n     * Add a child to show for a certain number of frames before automatic removal.\n     * @param instance - The clip to show\n     * @param startFrame - The starting frame\n     * @param duration - The number of frames to display the child before removing it.\n     * @param keyframes - The collection of static keyframes to add\n     */\n    public addTimedChild(instance: AnimateDisplayObject,\n        startFrame: number,\n        duration?: number,\n        keyframes?: string | {[frame: number]: KeyframeData}): this\n    {\n        if (startFrame === undefined) // jshint ignore:line\n        {\n            startFrame = 0;\n        }\n        if (duration === undefined || duration < 1) // jshint ignore:line\n        {\n            duration = this._totalFrames || 1;\n        }\n\n        // Add the starting offset for synced movie clips\n        if (instance instanceof MovieClip && instance.mode === MovieClip.SYNCHED)\n        {\n            (instance as MovieClip).parentStartPosition = startFrame;\n        }\n\n        // add tweening info about this child's presence on stage\n        // when the child is (re)added, if it has 'autoReset' set to true, then it\n        // should be set back to frame 0\n        let timeline: TimedChildTimeline;\n\n        // get existing timeline\n        for (let i = this._timedChildTimelines.length - 1; i >= 0; --i)\n        {\n            if (this._timedChildTimelines[i].target === instance)\n            {\n                timeline = this._timedChildTimelines[i];\n                break;\n            }\n        }\n        // if there wasn't one, make a new one\n        if (!timeline)\n        {\n            timeline = [];\n            timeline.target = instance;\n            this._timedChildTimelines.push(timeline);\n        }\n\n        // Fill the timeline with keyframe booleans\n        utils.fillFrames(timeline, startFrame, duration);\n\n        // Update the total frames if the instance extends our current\n        // total frames for this movieclip\n        if (this._totalFrames < startFrame + duration)\n        {\n            this._totalFrames = startFrame + duration;\n        }\n\n        // Add the collection of keyframes\n        if (keyframes)\n        {\n            if (typeof keyframes === 'string')\n            {\n                keyframes = utils.deserializeKeyframes(keyframes);\n            }\n            let sequenceUsesSkew = false;\n\n            for (const i in keyframes)\n            {\n                if (keyframes[i].kx || keyframes[i].ky)\n                {\n                    sequenceUsesSkew = true;\n                    break;\n                }\n            }\n            if (sequenceUsesSkew)\n            {\n                for (const i in keyframes)\n                {\n                    if (keyframes[i].r !== undefined)\n                    {\n                        keyframes[i].kx = keyframes[i].kx || keyframes[i].r * -1;\n                        keyframes[i].ky = keyframes[i].ky || keyframes[i].r;\n                        delete keyframes[i].r;\n                    }\n                    if (keyframes[i].tw?.p?.r !== undefined)\n                    {\n                        keyframes[i].tw.p.kx = keyframes[i].tw.p.kx || keyframes[i].tw.p.r * -1;\n                        keyframes[i].tw.p.ky = keyframes[i].tw.p.ky || keyframes[i].tw.p.r;\n                        delete keyframes[i].tw.p.r;\n                    }\n                }\n            }\n            for (const i in keyframes)\n            {\n                this.addKeyframe(instance, keyframes[i], parseInt(i, 10));\n            }\n            this._getChildTimeline(instance)\n                // subtract 1 from duration because we are using 0 based frame indices\n                // and duration is calculated as total frames\n                .extendLastFrame(startFrame + duration - 1);\n        }\n\n        // Set the initial position/add\n        this._setTimelinePosition(startFrame, this.currentFrame, true);\n\n        return this;\n    }\n\n    /**\n     * Short cut for `addAction`\n     */\n    public aa = this.addAction;\n\n    /**\n     * Handle frame actions, callback is bound to the instance of the MovieClip.\n     * @param callback - The clip call on a certain frame\n     * @param startFrame - The starting frame index or label\n     */\n    public addAction(callback: FrameAction, startFrame: number | string): this\n    {\n        if (typeof startFrame === 'string')\n        {\n            const index = this._labelDict[startFrame];\n\n            if (index === undefined)\n            {\n                throw new Error(`The label '${startFrame}' does not exist on this timeline`);\n            }\n            startFrame = index;\n        }\n\n        const actions = this._actions;\n\n        // ensure that the movieclip timeline is long enough to support the target frame\n        if (actions.length <= startFrame)\n        {\n            actions.length = startFrame + 1;\n        }\n        if (this._totalFrames < startFrame)\n        {\n            this._totalFrames = startFrame;\n        }\n        // add the action\n        if (actions[startFrame])\n        {\n            actions[startFrame].push(callback);\n        }\n        else\n        {\n            actions[startFrame] = [callback];\n        }\n\n        return this;\n    }\n\n    /**\n     * Short cut for `playSound`\n     */\n    public ps = this.playSound;\n\n    /**\n     * Handle sounds.\n     * @param alias - The name of the Sound\n     * @param loop - The loop property of the sound\n     */\n    public playSound(alias: string, loop?: boolean): this\n    {\n        sound.emit('play', alias, !!loop, this);\n\n        return this;\n    }\n\n    /**\n     * Sets paused to false.\n     */\n    play(): void\n    {\n        this.paused = false;\n    }\n\n    /**\n     * Sets paused to true.\n     */\n    stop(): void\n    {\n        this.paused = true;\n    }\n\n    /**\n     * Advances this movie clip to the specified position or label and sets paused to false.\n     * @param positionOrLabel - The animation name or frame number to go to.\n     */\n    public gotoAndPlay(positionOrLabel: string | number): void\n    {\n        this.paused = false;\n        this._goto(positionOrLabel);\n    }\n\n    /**\n     * Advances this movie clip to the specified position or label and sets paused to true.\n     * @param positionOrLabel - The animation or frame name to go to.\n     */\n    public gotoAndStop(positionOrLabel: string | number): void\n    {\n        this.paused = true;\n        this._goto(positionOrLabel);\n    }\n\n    /**\n     * Get the close parent with a valid framerate. If no parent, returns the default framerate.\n     */\n    public get parentFramerate(): number\n    {\n        // eslint-disable-next-line @typescript-eslint/no-this-alias\n        let o: MovieClip = this;\n        let fps = o._framerate;\n\n        // eslint-disable-next-line no-unmodified-loop-condition\n        while ((o = o.parent as MovieClip) && !fps)\n        {\n            if (o.mode === MovieClip.INDEPENDENT)\n            {\n                fps = o._framerate;\n            }\n        }\n\n        return fps || MovieClip.DEFAULT_FRAMERATE;\n    }\n\n    /**\n     * Advances the playhead. This occurs automatically each tick by default.\n     * @param time - The amount of time in seconds to advance by. Only applicable if framerate is set.\n     */\n    public advance(time?: number): void\n    {\n        // Handle any other cases where starting to play\n        // and no framerate has been set yet\n        if (!this._framerate)\n        {\n            this.framerate = this.parentFramerate;\n        }\n\n        if (time)\n        {\n            this._t += time;\n        }\n        if (this._t > this._duration)\n        {\n            this._t = this.loop ? this._t % this._duration : this._duration;\n        }\n        // add a tiny amount to account for potential floating point errors\n        this.currentFrame = Math.floor((this._t * this._framerate) + 0.00000001);\n        // final error checking\n        if (this.currentFrame >= this._totalFrames)\n        {\n            this.currentFrame = this._totalFrames - 1;\n        }\n        let afterUpdateOnce;\n\n        if (this._beforeUpdate)\n        {\n            afterUpdateOnce = this._beforeUpdate(this);\n        }\n        // update all tweens & actions in the timeline\n        this._updateTimeline();\n\n        // Do the animator callback here\n        if (afterUpdateOnce)\n        {\n            afterUpdateOnce();\n        }\n    }\n\n    /**\n     * @param positionOrLabel - The animation name or frame number to go to.\n     */\n    protected _goto(positionOrLabel: string | number): void\n    {\n        const pos = typeof positionOrLabel === 'string' ? this._labelDict[positionOrLabel] : positionOrLabel;\n\n        if (pos === undefined) // jshint ignore:line\n        {\n            return;\n        }\n        // prevent _updateTimeline from overwriting the new position because of a reset:\n        this._prevPos = NaN;\n        this.currentFrame = pos;\n\n        // Handle the case where trying to play but haven't\n        // added to the stage yet\n        if (!this._framerate)\n        {\n            this.framerate = this.parentFramerate;\n        }\n\n        // update the elapsed time if a time based movieclip\n        if (this._framerate > 0)\n        {\n            this._t = pos / this._framerate;\n        }\n        else\n        {\n            this._t = 0;\n        }\n        this._updateTimeline();\n    }\n\n    /**\n     * Reset the movieclip to the first frame (without advancing the timeline).\n     */\n    private _reset(): void\n    {\n        this._prevPos = -1;\n        this._t = 0;\n        this.currentFrame = 0;\n    }\n\n    /**\n     * Update timeline position according to playback, performing actions and updating children.\n     * @private\n     */\n    public _updateTimeline(): void\n    {\n        const synched = this.mode !== MovieClip.INDEPENDENT;\n\n        if (synched)\n        {\n            this.currentFrame = this.startPosition + (this.mode === MovieClip.SINGLE_FRAME ? 0 : this._synchOffset);\n            if (this.currentFrame >= this._totalFrames)\n            {\n                this.currentFrame %= this._totalFrames;\n            }\n        }\n\n        if (this._prevPos === this.currentFrame)\n        {\n            return;\n        }\n\n        // update timeline position, ignoring actions if this is a graphic.\n        this._setTimelinePosition(this._prevPos, this.currentFrame, synched ? false : this.actionsEnabled);\n\n        this._prevPos = this.currentFrame;\n    }\n\n    /**\n     * Set the timeline position\n     */\n    protected _setTimelinePosition(startFrame: number, currentFrame: number, doActions: boolean): void\n    {\n        if (startFrame !== currentFrame && doActions)\n        {\n            let startPos: number;\n\n            if (isNaN(startFrame))\n            {\n                startPos = currentFrame;\n            }\n            else\n            {\n                startPos = (startFrame >= this._totalFrames - 1 ? 0 : startFrame + 1);\n            }\n            // generate actionFrames on the way\n            const actionFrames: number[] = [];\n\n            // loop\n            if (currentFrame < startPos)\n            {\n                for (let i = startPos; i < this._actions.length; ++i)\n                {\n                    if (this._actions[i])\n                    {\n                        actionFrames.push(i);\n                    }\n                }\n                for (let i = 0; i <= currentFrame; ++i)\n                {\n                    if (this._actions[i])\n                    {\n                        actionFrames.push(i);\n                    }\n                }\n            }\n            // no loop\n            else\n            {\n                for (let i = startPos; i <= currentFrame; ++i)\n                {\n                    if (this._actions[i])\n                    {\n                        actionFrames.push(i);\n                    }\n                }\n            }\n\n            if (actionFrames.length)\n            {\n                const oldCurrentFrame = this.currentFrame;\n\n                for (let i = 0; i < actionFrames.length; ++i)\n                {\n                    const frame = actionFrames[i];\n\n                    this._setTimelinePosition(frame, frame, true);\n                    // _goto is called OR last frame reached\n                    if (this.currentFrame !== oldCurrentFrame || frame === currentFrame)\n                    {\n                        return;\n                    }\n                    // stop is called\n                    else if (this.paused)\n                    {\n                        this.currentFrame = frame;\n\n                        return;\n                    }\n                }\n            }\n        }\n\n        // handle all tweens\n        const _timelines = this._timelines;\n\n        for (let i = _timelines.length - 1; i >= 0; --i)\n        {\n            const timeline = _timelines[i];\n\n            for (let j = 0, length = timeline.length; j < length; ++j)\n            {\n                const tween = timeline[j];\n\n                // if the tween contains part of the timeline that we are travelling through\n                if (currentFrame >= tween.startFrame && currentFrame <= tween.endFrame)\n                {\n                    // set the position within that tween\n                    // and break the loop to move onto the next timeline\n                    tween.setPosition(currentFrame);\n                    break;\n                }\n            }\n        }\n\n        const timedChildTimelines = this._timedChildTimelines;\n        const depthSorted = this._depthSorted;\n\n        for (let i = 0, length = timedChildTimelines.length; i < length; ++i)\n        {\n            const target = timedChildTimelines[i].target;\n            const shouldBeChild = timedChildTimelines[i][currentFrame];\n\n            // if child should be on stage and is not:\n            if (shouldBeChild)\n            {\n                // Add to the depthSorted object so we can\n                // check that items are property drawn later\n                depthSorted.push(target);\n                if (target.parent !== this)\n                {\n                    // add the target if it's not there already\n                    this.addChild(target);\n                    if (target instanceof MovieClip && target.mode === MovieClip.INDEPENDENT && target.autoReset)\n                    {\n                        target._reset();\n                    }\n                }\n            }\n            else if (!shouldBeChild && target.parent === this)\n            {\n                this.removeChild(target);\n            }\n        }\n\n        // Properly depth sort the children\n        for (let i = 0, length = depthSorted.length; i < length; i++)\n        {\n            const target = depthSorted[i];\n            const currentIndex = this.children.indexOf(target);\n\n            if (currentIndex !== i)\n            {\n                this.addChildAt(target, i);\n            }\n        }\n\n        // Clear the temporary depth sorting array\n        depthSorted.length = 0;\n\n        // go through all children and update synched movieclips that are not single frames\n        const children = this.children;\n\n        for (let i = 0, length = children.length; i < length; ++i)\n        {\n            const child = children[i];\n\n            if (child instanceof MovieClip && child.mode === MovieClip.SYNCHED)\n            {\n                child._synchOffset = currentFrame - child.parentStartPosition;\n                child._updateTimeline();\n            }\n        }\n\n        // handle actions\n        if (doActions && this._actions && this._actions[currentFrame])\n        {\n            const frameActions = this._actions[currentFrame];\n\n            for (let j = 0; j < frameActions.length; ++j)\n            {\n                frameActions[j].call(this);\n            }\n        }\n    }\n\n    destroy(options?: IDestroyOptions | boolean): void\n    {\n        if (this._tickListener)\n        {\n            SharedTicker.remove(this._tickListener, null);\n            this._tickListener = null;\n        }\n        const hiddenChildren = [];\n        const timelines = this._timelines;\n\n        if (timelines)\n        {\n            for (let i = 0; i < timelines.length; i++)\n            {\n                const timeline = timelines[i];\n\n                hiddenChildren.push(timeline.target);\n                timeline.destroy();\n            }\n        }\n        const childTimelines = this._timedChildTimelines;\n\n        if (childTimelines)\n        {\n            for (let i = 0; i < childTimelines.length; i++)\n            {\n                const timeline = childTimelines[i];\n\n                if (hiddenChildren.indexOf(timeline.target) < 0)\n                {\n                    hiddenChildren.push(timeline.target);\n                }\n                timeline.length = 0;\n            }\n        }\n        // Destroy all the children\n        for (let i = 0; i < hiddenChildren.length; i++)\n        {\n            // Don't destroy children in the display list\n            if (this.children.indexOf(hiddenChildren[i]) < 0)\n            {\n                hiddenChildren[i].destroy(options as IDestroyOptions);\n            }\n        }\n        hiddenChildren.length = 0;\n        this._actions = null;\n        this._timelines = null;\n        this._depthSorted = null;\n        this._timedChildTimelines = null;\n        this._beforeUpdate = null;\n        this._labels = null;\n        this._labelDict = null;\n        super.destroy(options as IDestroyOptions);\n    }\n}\n","import { load } from './load';\nimport { sound } from './sound';\nimport type { MovieClip } from './MovieClip';\nimport { Application } from '@pixi/app';\nimport type { EventEmitter } from '@pixi/utils';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { AnimateAsset } from '../AnimateAsset';\n\n/**\n * Extends the PIXI.Application class to provide easy loading.\n * ```\n * const scene = new PIXI.animate.Scene();\n * scene.load(lib.StageName);\n * ```\n */\nexport class Scene extends Application\n{\n    /**\n     * Reference to the global sound object\n     * @readOnly\n     */\n    public readonly sound: EventEmitter = sound;\n\n    /**\n     * The stage object created.\n     */\n    public instance: MovieClip = null;\n\n    /**\n     * Load a stage scene and add it to the stage.\n     * @param asset - Reference to the scene to load.\n     * @param complete - Callback when finished loading.\n     * @param basePath - Optional base directory to prepend to assets.\n     * @return instance of PIXI resource loader\n     */\n    public load(asset: AnimateAsset, complete?: (instance?: MovieClip) => void, basePath?: string): void\n    {\n        return load(asset, {\n            parent: this.stage,\n            createInstance: true,\n            complete: (instance) =>\n            {\n                this.instance = instance as MovieClip;\n                if (complete)\n                {\n                    complete(this.instance);\n                }\n            },\n            basePath,\n        });\n    }\n\n    /**\n     * Destroy and don't use after calling.\n     * @param removeView - Automatically remove canvas from DOM.\n     * @param stageOptions - Options parameter. A boolean will act as if all options\n     *  have been set to that value\n     */\n    destroy(removeView?: boolean, stageOptions?: IDestroyOptions | boolean): void\n    {\n        if (this.instance)\n        {\n            this.instance.destroy(true);\n            this.instance = null;\n        }\n        super.destroy(removeView, stageOptions as IDestroyOptions);\n    }\n}\n","import type { MovieClip } from './MovieClip';\nimport { Animator } from './Animator';\n\nconst pool: AnimatorTimeline[] = [];\n\n/**\n * Represents a single animation play.\n */\nexport class AnimatorTimeline\n{\n    /**\n     * Bound copy of update().\n     */\n    private _update: (instance: MovieClip) => (() => void | null);\n\n    /**\n     * Instance of clip to play.\n     * @readOnly\n     */\n    public instance: MovieClip;\n\n    /**\n     * `true` if the timeline is suppose to loop.\n     * @readOnly\n     */\n    public loop: boolean;\n\n    /**\n     * Frame number of the starting farme.\n     * @readOnly\n     */\n    public start: number;\n\n    /**\n     * Frame number of the ending frame.\n     * @readOnly\n     */\n    public end: number;\n\n    /**\n     * Callback called when completed (non-looping animation).\n     * @readOnly\n     */\n    public callback: () => void;\n\n    constructor()\n    {\n        this._update = this.update.bind(this);\n        this.init(null, 0, 0, false, null);\n    }\n\n    /**\n     * The pool of timelines to use\n     * @param instance\n     * @param start\n     * @param end\n     * @param loop\n     * @param callback\n     */\n    private init(instance: MovieClip, start: number, end: number, loop: boolean, callback: () => void): void\n    {\n        this.instance = instance;\n        this.loop = loop;\n        this.start = start;\n        this.end = end;\n        this.callback = callback;\n\n        if (instance)\n        {\n            // Prevent overshooting the end frame and looping back around:\n            instance.loop = false;\n            instance.gotoAndStop(start);\n            instance._beforeUpdate = this._update;\n        }\n    }\n\n    /**\n     * Don't use after this\n     * @private\n     */\n    destroy(): void\n    {\n        this.instance._beforeUpdate = null;\n        this.init(null, 0, 0, false, null);\n        AnimatorTimeline._pool.push(this);\n    }\n\n    /**\n     * Is the animation complete\n     * @param instance\n     * @return Callback to do after updateTimeline\n     * @private\n     */\n    update(instance: MovieClip): (() => void) | null\n    {\n        let completed: () => void;\n\n        if (instance.currentFrame >= this.end)\n        {\n            // In case we over-shoot the current frame becuase of low FPS\n            instance.currentFrame = this.end;\n\n            if (this.loop)\n            {\n                // Update timeline so we get actions at the end frame\n                instance._updateTimeline();\n                instance.gotoAndPlay(this.start);\n            }\n            else\n            {\n                instance.stop();\n                if (this.callback)\n                {\n                    completed = this.callback;\n                }\n                this.stop(); // cleanup timeline\n            }\n        }\n\n        return completed;\n    }\n\n    /**\n     * Stop the animation, cannot be reused.\n     */\n    stop(): void\n    {\n        Animator._internalStop(this);\n    }\n\n    /**\n     * The progress from 0 to 1 of the playback.\n     */\n    get progress(): number\n    {\n        const progress = (this.instance.currentFrame - this.start) / (this.end - this.start);\n\n        return Math.max(0, Math.min(1, progress)); // clamp\n    }\n\n    /**\n     * The pool of timelines to use\n     * @private\n     */\n    static get _pool(): AnimatorTimeline[]\n    {\n        return pool;\n    }\n\n    /**\n     * Create a new timeline\n     */\n    static create(instance: MovieClip, start: number, end: number, loop: boolean, callback: () => void): AnimatorTimeline\n    {\n        let timeline: AnimatorTimeline;\n\n        if (this._pool.length)\n        {\n            timeline = this._pool.pop();\n        }\n        else\n        {\n            timeline = new AnimatorTimeline();\n        }\n        timeline.init(instance, start, end, loop, callback);\n\n        return timeline;\n    }\n}\n","import { AnimatorTimeline } from './AnimatorTimeline';\nimport type { MovieClip } from './MovieClip';\n\n// Static collection of timelines\nconst timelines: AnimatorTimeline[] = [];\n\n/**\n * Play animation via start/stop frame labels\n * @class Animator\n */\nexport class Animator\n{\n    /**\n     * The collection of timelines\n     */\n    private static get _timelines(): AnimatorTimeline[]\n    {\n        return timelines;\n    }\n\n    /**\n     * Suffix added to label for a stop.\n     */\n    static get STOP_LABEL(): string\n    {\n        return '_stop';\n    }\n\n    /**\n     * Suffix added to label for a loop.\n     */\n    static get LOOP_LABEL(): string\n    {\n        return '_loop';\n    }\n\n    /**\n     * Play the entire duration of the MovieClip.\n     * @param instance - Movie clip to play.\n     * @param callback - Optional callback when complete\n     * @return Timeline object for stopping or getting progress.\n     */\n    static play(instance: MovieClip, callback?: () => void): AnimatorTimeline;\n    /**\n     * Play an animation by frame labels. For instance, play animation sequence from\n     * 'idle' to 'idle_stop' or 'idle_loop'. If no event label is provided, will\n     * play the entire duration of the MovieClip.\n     * @param instance - Movie clip to play.\n     * @param label - The frame label event to call, if no event is provided\n     *        will use the entire length of the MovieClip.\n     * @param callback - Optional callback when complete\n     * @return Timeline object for stopping or getting progress.\n     */\n    static play(instance: MovieClip, label: string, callback?: () => void): AnimatorTimeline;\n    static play(instance: MovieClip, label?: string | (() => void), callback?: () => void): AnimatorTimeline\n    {\n        let loop = false;\n        let start;\n        let end;\n\n        if (!label || typeof label === 'function')\n        {\n            start = 0;\n            end = instance.totalFrames - 1;\n            if (label && typeof label === 'function')\n            {\n                callback = label;\n                label = null;\n            }\n        }\n        else\n        {\n            start = instance.labelsMap[label];\n            end = instance.labelsMap[label + this.STOP_LABEL];\n            if (end === undefined)\n            {\n                end = instance.labelsMap[label + this.LOOP_LABEL];\n                loop = true;\n            }\n            if (start === undefined)\n            {\n                throw new Error(`No start label matching \"${label}\"`);\n            }\n            else if (end === undefined)\n            {\n                throw new Error(`No end label matching \"${label}\"`);\n            }\n        }\n\n        return this.fromTo(\n            instance,\n            start,\n            end,\n            loop,\n            callback,\n        );\n    }\n\n    /**\n     * Play an animation from the current frame to an end frame or label.\n     * @param instance - Movie clip to play.\n     * @param end - The end frame or label.\n     * @param callback - Optional callback when complete\n     * @return Timeline object for stopping or getting progress.\n     */\n    static to(instance: MovieClip, end: string | number, callback?: () => void): AnimatorTimeline\n    {\n        return this.fromTo(\n            instance,\n            instance.currentFrame,\n            end,\n            false,\n            callback,\n        );\n    }\n\n    /**\n     * Play a MovieClip from a start to end frame.\n     * @param instance - Movie clip to play.\n     * @param start - The starting frame index or label.\n     * @param end - The ending frame index or label.\n     * @param loop - If the animation should loop.\n     * @param callback - Optional callback when complete\n     * @return Timeline object for stopping or getting progress.\n     */\n    static fromTo(instance: MovieClip,\n        start: number | string,\n        end: number | string,\n        loop?: boolean,\n        callback?: () => void): AnimatorTimeline\n    {\n        if (typeof start === 'string')\n        {\n            const startLabel = start;\n\n            start = instance.labelsMap[startLabel];\n            if (start === undefined)\n            {\n                throw new Error(`No start label matching \"${startLabel}\"`);\n            }\n        }\n        if (typeof end === 'string')\n        {\n            const endLabel = end;\n\n            end = instance.labelsMap[endLabel];\n            if (end === undefined)\n            {\n                throw new Error(`No end label matching \"${endLabel}\"`);\n            }\n        }\n        if (start < 0)\n        {\n            throw new Error('Start frame is out of bounds');\n        }\n        if (end >= instance.totalFrames)\n        {\n            throw new Error('End frame is out of bounds');\n        }\n        if (start >= end)\n        {\n            throw new Error('End frame is before start frame');\n        }\n\n        // Stop any animation that's playing\n        this.stop(instance);\n\n        loop = !!loop;\n\n        // Add a new timeline\n        const timeline = AnimatorTimeline.create(\n            instance,\n            start,\n            end,\n            loop,\n            callback,\n        );\n\n        this._timelines.push(timeline);\n\n        // Set the current frame\n        if (instance.currentFrame !== start)\n        {\n            instance.gotoAndPlay(start);\n        }\n        else\n        {\n            instance.play();\n        }\n\n        return timeline;\n    }\n\n    /**\n     * Stop the animation by instance.\n     * @param instance - Movie clip to play.\n     */\n    static stop(instance: MovieClip): void\n    {\n        for (let i = 0, len = this._timelines.length; i < len; i++)\n        {\n            const timeline = this._timelines[i];\n\n            if (timeline.instance === instance)\n            {\n                this._internalStop(timeline);\n                break;\n            }\n        }\n    }\n\n    /**\n     * Stop all the currently playing animations.\n     */\n    static stopAll(): void\n    {\n        for (let i = this._timelines.length - 1; i >= 0; i--)\n        {\n            this._internalStop(this._timelines[i]);\n        }\n    }\n\n    /**\n     * Stop the animation\n     * @private\n     * @param timeline - Timeline to stop.\n     */\n    static _internalStop(timeline: AnimatorTimeline): void\n    {\n        this._timelines.splice(this._timelines.indexOf(timeline), 1);\n        timeline.instance.stop();\n        timeline.destroy();\n    }\n}\n","import { Sprite } from '@pixi/sprite';\nimport { Graphics } from '@pixi/graphics';\nimport { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { utils } from './utils';\n\n/**\n * Utility subclass of PIXI.Sprite\n */\nexport class AnimateSprite extends Sprite\n{\n    // **************************\n    //     DisplayObject methods\n    // **************************\n\n    /**\n     * Function to set if this is renderable or not. Useful for setting masks.\n     * @param renderable - Make renderable. Defaults to false.\n     * @return This instance, for chaining.\n     */\n    public setRenderable(renderable?: boolean): this\n    {\n        this.renderable = !!renderable;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setRenderable`.\n     */\n    public re = this.setRenderable;\n\n    /**\n     * Shortcut for `setTransform`.\n     */\n    public t = super.setTransform;\n\n    /**\n     * Setter for mask to be able to chain.\n     * @param mask - The mask shape to use\n     * @return Instance for chaining\n     */\n    public setMask(mask: Graphics | Sprite): this\n    {\n        // According to PIXI, only Graphics and Sprites can\n        // be used as mask, let's ignore everything else, like other\n        // movieclips and displayobjects/containers\n        if (mask)\n        {\n            if (!(mask instanceof Graphics) && !(mask instanceof Sprite))\n            {\n                if (typeof console !== 'undefined' && console.warn)\n                {\n                    console.warn('Warning: Masks can only be PIXI.Graphics or PIXI.Sprite objects.');\n                }\n\n                return this;\n            }\n        }\n        this.mask = mask;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setMask`.\n     */\n    public ma = this.setMask;\n\n    /**\n     * Chainable setter for alpha\n     * @param alpha - The alpha amount to use, from 0 to 1\n     * @return Instance for chaining\n     */\n    public setAlpha(alpha: number): this\n    {\n        this.alpha = alpha;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setAlpha`.\n     */\n    public a = this.setAlpha;\n\n    /**\n     * Set the tint values by color.\n     * @param tint - The color value to tint\n     * @return Object for chaining\n     */\n    public setTint(tint: string | number): this\n    {\n        if (typeof tint === 'string')\n        {\n            tint = utils.hexToUint(tint);\n        }\n        this.tint = tint;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setTint`.\n     */\n    public i = this.setTint;\n\n    /**\n     * Set additive and multiply color, tinting\n     * @param r - The multiply red value\n     * @param rA - The additive red value\n     * @param g - The multiply green value\n     * @param gA - The additive green value\n     * @param b - The multiply blue value\n     * @param bA - The additive blue value\n     * @return Object for chaining\n     */\n    public setColorTransform(r: number, rA: number, g: number, gA: number, b: number, bA: number): this\n    {\n        const filter = this.colorTransformFilter;\n\n        filter.matrix[0] = r;\n        filter.matrix[4] = rA;\n        filter.matrix[6] = g;\n        filter.matrix[9] = gA;\n        filter.matrix[12] = b;\n        filter.matrix[14] = bA;\n        this.filters = [filter];\n\n        return this;\n    }\n    /**\n     * Shortcut for `setColor`.\n     */\n    public c = this.setColorTransform;\n\n    protected _colorTransformFilter: ColorMatrixFilter;\n    /**\n     * The current default color transforming filter\n     */\n    public set colorTransformFilter(filter: ColorMatrixFilter)\n    {\n        this._colorTransformFilter = filter;\n    }\n    public get colorTransformFilter(): ColorMatrixFilter\n    {\n        return this._colorTransformFilter || new ColorMatrixFilter();\n    }\n}\n","import { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { Graphics, GraphicsGeometry, ILineStyleOptions } from '@pixi/graphics';\nimport { Sprite } from '@pixi/sprite';\nimport { utils } from './utils';\n\nexport type DrawCommands = (string | number)[];\n\nexport class AnimateGraphics extends Graphics\n{\n    constructor(geometry?: GraphicsGeometry)\n    {\n        super(geometry);\n\n        // overwrite with a cleaner version, so fewer function calls are involved\n        this.s = super.lineStyle;\n    }\n\n    // **************************\n    //     Graphics methods\n    // **************************\n\n    /**\n     * Execute a series of commands, this is the name of the short function\n     * followed by the parameters -, e.g., `[\"f\", \"#ff0000\", \"r\", 0, 0, 100, 200]`\n     * @param commands - The commands and parameters - to draw\n     * @return This instance for chaining.\n     */\n    public drawCommands(commands: DrawCommands): this\n    {\n        let currentCommand: string; const params = [];\n        let i = 0;\n\n        while (i <= commands.length)\n        {\n            const item = commands[i++];\n\n            if (item === undefined || (this as any)[item])\n            {\n                if (currentCommand)\n                {\n                    (this as any)[currentCommand].apply(this, params);\n                    params.length = 0;\n                }\n                currentCommand = item as string;\n            }\n            else\n            {\n                params.push(item);\n            }\n        }\n\n        return this;\n    }\n    /**\n     * Shortcut for `drawCommands`.\n     */\n    public d = this.drawCommands;\n\n    /**\n     * Shortcut for `closePath`.\n     **/\n    public cp = super.closePath;\n\n    /**\n     * Shortcut for `beginHole`\n     **/\n    public bh = super.beginHole;\n\n    /**\n     * Shortcut for `endHole`\n     **/\n    public eh = super.endHole;\n\n    /**\n     * Shortcut for `moveTo`.\n     **/\n    public m = super.moveTo;\n\n    /**\n     * Shortcut for `lineTo`.\n     **/\n    public l = super.lineTo;\n\n    /**\n     * Shortcut for `quadraticCurveTo`.\n     **/\n    public q = super.quadraticCurveTo;\n\n    /**\n     * Shortcut for `bezierCurveTo`.\n     **/\n    public b = super.bezierCurveTo;\n\n    /**\n     * Shortcut for `beginFill`.\n     **/\n    public f = super.beginFill;\n\n    /**\n     * Shortcut for `lineStyle`.\n     **/\n    public s(width: number, color?: number, alpha?: number, alignment?: number, native?: boolean): this;\n    public s(options?: ILineStyleOptions): this;\n    public s(...args: any[]): this\n    {\n        return super.lineStyle(...args);\n    }\n\n    /**\n     * Shortcut for `drawRect`.\n     **/\n    public dr = super.drawRect;\n\n    /**\n     * Shortcut for `drawRoundedRect`.\n     **/\n    public rr = super.drawRoundedRect;\n\n    /**\n     * Shortcut for `drawRoundedRect`.\n     **/\n    public rc = super.drawRoundedRect;\n\n    /**\n     * Shortcut for `drawCircle`.\n     **/\n    public dc = super.drawCircle;\n\n    /**\n     * Shortcut for `arc`.\n     **/\n    public ar = super.arc;\n\n    /**\n     * Shortcut for `arcTo`.\n     **/\n    public at = super.arcTo;\n\n    /**\n     * Shortcut for `drawEllipse`.\n     */\n    public de = super.drawEllipse;\n\n    /**\n     * Placeholder method for a linear gradient fill. Pixi does not support linear gradient fills,\n     * so we just pick the first color in colorArray\n     * @param colorArray - An array of CSS compatible color values @see `f`\n     * @return The Graphics instance the method is called on (useful for chaining calls.)\n     **/\n    public lf(colorArray: number[]): this\n    {\n        // @if DEBUG\n        console.warn('Linear gradient fills are not supported');\n        // @endif\n\n        return this.f(colorArray[0]) as this;\n    }\n\n    /**\n     * Placeholder method for a radial gradient fill. Pixi does not support radial gradient fills,\n     * so we just pick the first color in colorArray\n     * @param colorArray - An array of CSS compatible color values @see `f`\n     * @return The Graphics instance the method is called on (useful for chaining calls.)\n     **/\n    public rf(colorArray: number[]): this\n    {\n        // @if DEBUG\n        console.warn('Radial gradient fills are not supported');\n        // @endif\n\n        return this.f(colorArray[0]) as this;\n    }\n\n    /**\n     * Placeholder method for a `beginBitmapFill`. Pixi does not support bitmap fills.\n     * @return The Graphics instance the method is called on (useful for chaining calls.)\n     **/\n    public bf(): this\n    {\n        // @if DEBUG\n        console.warn('Bitmap fills are not supported');\n        // @endif\n\n        return this.f(0x0) as this;\n    }\n\n    /**\n     * Placeholder method for a `setStrokeDash`. Pixi does not support dashed strokes.\n     * @return The Graphics instance the method is called on (useful for chaining calls.)\n     **/\n    public sd(): this\n    {\n        // @if DEBUG\n        console.warn('Dashed strokes are not supported');\n        // @endif\n\n        return this;\n    }\n\n    /**\n     * Placeholder method for a `beginBitmapStroke`. Pixi does not support bitmap strokes.\n     * @return The Graphics instance the method is called on (useful for chaining calls.)\n     **/\n    public bs(): this\n    {\n        // @if DEBUG\n        console.warn('Bitmap strokes are not supported');\n        // @endif\n\n        return this;\n    }\n\n    /**\n     * Placeholder method for a `beginLinearGradientStroke`. Pixi does not support gradient strokes.\n     * @return The Graphics instance the method is called on (useful for chaining calls.)\n     **/\n    public ls(): this\n    {\n        // @if DEBUG\n        console.warn('Linear gradient strokes are not supported');\n        // @endif\n\n        return this;\n    }\n\n    /**\n     * Placeholder method for a `beginRadialGradientStroke`. Pixi does not support gradient strokes.\n     * @return The Graphics instance the method is called on (useful for chaining calls.)\n     **/\n    public rs(): this\n    {\n        // @if DEBUG\n        console.warn('Radial gradient strokes are not supported');\n        // @endif\n\n        return this;\n    }\n\n    // **************************\n    //     DisplayObject methods\n    // **************************\n\n    /**\n     * Function to set if this is renderable or not. Useful for setting masks.\n     * @param renderable - Make renderable. Defaults to false.\n     * @return This instance, for chaining.\n     */\n    public setRenderable(renderable?: boolean): this\n    {\n        this.renderable = !!renderable;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setRenderable`.\n     */\n    public re = this.setRenderable;\n\n    /**\n     * Shortcut for `setTransform`.\n     */\n    public t = super.setTransform;\n\n    /**\n     * Setter for mask to be able to chain.\n     * @param mask - The mask shape to use\n     * @return Instance for chaining\n     */\n    public setMask(mask: Graphics | Sprite): this\n    {\n        // According to PIXI, only Graphics and Sprites can\n        // be used as mask, let's ignore everything else, like other\n        // movieclips and displayobjects/containers\n        if (mask)\n        {\n            if (!(mask instanceof Graphics) && !(mask instanceof Sprite))\n            {\n                if (typeof console !== 'undefined' && console.warn)\n                {\n                    console.warn('Warning: Masks can only be PIXI.Graphics or PIXI.Sprite objects.');\n                }\n\n                return this;\n            }\n        }\n        this.mask = mask;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setMask`.\n     */\n    public ma = this.setMask;\n\n    /**\n     * Chainable setter for alpha\n     * @param alpha - The alpha amount to use, from 0 to 1\n     * @return Instance for chaining\n     */\n    public setAlpha(alpha: number): this\n    {\n        this.alpha = alpha;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setAlpha`.\n     */\n    public a = this.setAlpha;\n\n    /**\n     * Set the tint values by color.\n     * @param tint - The color value to tint\n     * @return Object for chaining\n     */\n    public setTint(tint: string | number): this\n    {\n        if (typeof tint === 'string')\n        {\n            tint = utils.hexToUint(tint);\n        }\n        // this.tint = tint\n        // return this;\n        // TODO: Replace with DisplayObject.tint setter\n        // once the functionality is added to Pixi.js, for\n        // now we'll use the slower ColorMatrixFilter to handle\n        // the color transformation\n        const r = (tint >> 16) & 0xFF;\n        const g = (tint >> 8) & 0xFF;\n        const b = tint & 0xFF;\n\n        return this.setColorTransform(r / 255, 0, g / 255, 0, b / 255, 0);\n    }\n    /**\n     * Shortcut for `setTint`.\n     */\n    public i = this.setTint;\n\n    /**\n     * Set additive and multiply color, tinting\n     * @param r - The multiply red value\n     * @param rA - The additive red value\n     * @param g - The multiply green value\n     * @param gA - The additive green value\n     * @param b - The multiply blue value\n     * @param bA - The additive blue value\n     * @return Object for chaining\n     */\n    public setColorTransform(r: number, rA: number, g: number, gA: number, b: number, bA: number): this\n    {\n        const filter = this.colorTransformFilter;\n\n        filter.matrix[0] = r;\n        filter.matrix[4] = rA;\n        filter.matrix[6] = g;\n        filter.matrix[9] = gA;\n        filter.matrix[12] = b;\n        filter.matrix[14] = bA;\n        this.filters = [filter];\n\n        return this;\n    }\n    /**\n     * Shortcut for `setColor`.\n     */\n    // method instead of direct reference to allow override in v1 shim\n    public c(r: number, rA: number, g: number, gA: number, b: number, bA: number): this\n    {\n        return this.setColorTransform(r, rA, g, gA, b, bA);\n    }\n    // public c = this.setColorTransform;\n\n    protected _colorTransformFilter: ColorMatrixFilter;\n    /**\n     * The current default color transforming filter\n     */\n    public set colorTransformFilter(filter: ColorMatrixFilter)\n    {\n        this._colorTransformFilter = filter;\n    }\n    public get colorTransformFilter(): ColorMatrixFilter\n    {\n        return this._colorTransformFilter || new ColorMatrixFilter();\n    }\n}\n","import { ColorMatrixFilter } from '@pixi/filter-color-matrix';\nimport { Text, TextStyleAlign } from '@pixi/text';\nimport { Graphics } from '@pixi/graphics';\nimport { Sprite } from '@pixi/sprite';\nimport { utils } from './utils';\n\n// Possible align values\nenum ALIGN_VALUES\n    {\n    center = 0,\n    right = 1,\n    left = -1\n}\n\n// Map of short names to long names\nconst STYLE_PROPS = {\n    o: 'font', // TODO: deprecate in Pixi v4\n    z: 'fontSize',\n    f: 'fontFamily',\n    y: 'fontStyle',\n    g: 'fontWeight',\n    i: 'fill',\n    a: 'align',\n    s: 'stroke',\n    t: 'strokeThickness',\n    w: 'wordWrap',\n    d: 'wordWrapWidth',\n    l: 'lineHeight',\n    h: 'dropShadow',\n    c: 'dropShadowColor',\n    n: 'dropShadowAngle',\n    b: 'dropShadowBlur',\n    p: 'padding',\n    x: 'textBaseline',\n    j: 'lineJoin',\n    m: 'miterLimit',\n    e: 'letterSpacing',\n};\n\n/**\n * Check if a value is undefined, fallback to default value\n * @param value - The value to check\n * @param defaultValue - The default value if value is undefined\n * @return Either the value or the default value\n */\nfunction isUndefinedOr<T>(value: T, defaultValue: T): T\n{\n    return value === undefined ? defaultValue : value;\n}\n\nexport class AnimateText extends Text\n{\n    // **************************\n    //     Text methods\n    // **************************\n\n    /**\n     * Setter for the alignment, also sets the anchor point\n     * to make sure the positioning is correct.\n     * @param align - Either center (0), right (1), left (-1)\n     * @return This instance for chaining\n     */\n    public setAlign(align: 'center' | 'right' | 'left' | 0 | 1 | -1): this\n    {\n        if (typeof align === 'string')\n        {\n            align = ALIGN_VALUES[align];\n        }\n        this.style.align = ALIGN_VALUES[align] as TextStyleAlign || 'left';\n        this.anchor.x = (align + 1) / 2;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setAlign`.\n     */\n    public g = this.setAlign;\n\n    /**\n     * Set the style, a chainable version of style setter\n     * @param style -\n     * @return This instance for chaining.\n     */\n    // TODO: improve typing of style parameter - (needs ITextStyle interface to exist)\n    public setStyle(style: any): this\n    {\n        // Replace short STYLE_PROPS with long names\n        for (const k in STYLE_PROPS)\n        {\n            if ((style as any)[k] !== undefined)\n            {\n                (style as any)[(STYLE_PROPS as any)[k]] = (style as any)[k];\n                delete (style as any)[k];\n            }\n        }\n        this.style = style as any;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setStyle`.\n     */\n    public ss = this.setStyle;\n\n    /**\n     * Initial setting of the drop shadow.\n     * @param color - The color to set\n     * @param angle - The angle of offset, in radians\n     * @param distance - The offset distance\n     * @return This instance for chaining\n     */\n    public setShadow(color: string | number, angle: number, distance: number): this\n    {\n        const style = this.style;\n\n        style.dropShadow = true;\n\n        // Convert color to hex string\n        if (color && typeof color === 'number')\n        {\n            color = `#${color.toString(16)}`;\n        }\n        style.dropShadowColor = isUndefinedOr(color, style.dropShadowColor);\n        style.dropShadowAngle = isUndefinedOr(angle, style.dropShadowAngle);\n        style.dropShadowDistance = isUndefinedOr(distance, style.dropShadowDistance);\n\n        return this;\n    }\n    /**\n     * Shortcut for `setShadow`.\n     */\n    public sh = this.setShadow;\n\n    // **************************\n    //     DisplayObject methods\n    // **************************\n\n    /**\n     * Function to set if this is renderable or not. Useful for setting masks.\n     * @param renderable - Make renderable. Defaults to false.\n     * @return This instance, for chaining.\n     */\n    public setRenderable(renderable?: boolean): this\n    {\n        this.renderable = !!renderable;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setRenderable`.\n     */\n    public re = this.setRenderable;\n\n    /**\n     * Shortcut for `setTransform`.\n     */\n    public t = super.setTransform;\n\n    /**\n     * Setter for mask to be able to chain.\n     * @param mask - The mask shape to use\n     * @return Instance for chaining\n     */\n    public setMask(mask: Graphics | Sprite): this\n    {\n        // According to PIXI, only Graphics and Sprites can\n        // be used as mask, let's ignore everything else, like other\n        // movieclips and displayobjects/containers\n        if (mask)\n        {\n            if (!(mask instanceof Graphics) && !(mask instanceof Sprite))\n            {\n                if (typeof console !== 'undefined' && console.warn)\n                {\n                    console.warn('Warning: Masks can only be PIXI.Graphics or PIXI.Sprite objects.');\n                }\n\n                return this;\n            }\n        }\n        this.mask = mask;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setMask`.\n     */\n    public ma = this.setMask;\n\n    /**\n     * Chainable setter for alpha\n     * @param alpha - The alpha amount to use, from 0 to 1\n     * @return Instance for chaining\n     */\n    public setAlpha(alpha: number): this\n    {\n        this.alpha = alpha;\n\n        return this;\n    }\n    /**\n     * Shortcut for `setAlpha`.\n     */\n    public a = this.setAlpha;\n\n    /**\n     * Set the tint values by color.\n     * @param tint - The color value to tint\n     * @return Object for chaining\n     */\n    public setTint(tint: string | number): this\n    {\n        if (typeof tint === 'string')\n        {\n            tint = utils.hexToUint(tint);\n        }\n        // this.tint = tint\n        // return this;\n        // TODO: Replace with DisplayObject.tint setter\n        // once the functionality is added to Pixi.js, for\n        // now we'll use the slower ColorMatrixFilter to handle\n        // the color transformation\n        const r = (tint >> 16) & 0xFF;\n        const g = (tint >> 8) & 0xFF;\n        const b = tint & 0xFF;\n\n        return this.setColorTransform(r / 255, 0, g / 255, 0, b / 255, 0);\n    }\n    /**\n     * Shortcut for `setTint`.\n     */\n    public i = this.setTint;\n\n    /**\n     * Set additive and multiply color, tinting\n     * @param r - The multiply red value\n     * @param rA - The additive red value\n     * @param g - The multiply green value\n     * @param gA - The additive green value\n     * @param b - The multiply blue value\n     * @param bA - The additive blue value\n     * @return Object for chaining\n     */\n    public setColorTransform(r: number, rA: number, g: number, gA: number, b: number, bA: number): this\n    {\n        const filter = this.colorTransformFilter;\n\n        filter.matrix[0] = r;\n        filter.matrix[4] = rA;\n        filter.matrix[6] = g;\n        filter.matrix[9] = gA;\n        filter.matrix[12] = b;\n        filter.matrix[14] = bA;\n        this.filters = [filter];\n\n        return this;\n    }\n    /**\n     * Shortcut for `setColor`.\n     */\n    public c = this.setColorTransform;\n\n    protected _colorTransformFilter: ColorMatrixFilter;\n    /**\n     * The current default color transforming filter\n     */\n    public set colorTransformFilter(filter: ColorMatrixFilter)\n    {\n        this._colorTransformFilter = filter;\n    }\n    public get colorTransformFilter(): ColorMatrixFilter\n    {\n        return this._colorTransformFilter || new ColorMatrixFilter();\n    }\n}\n","export { load, sound, utils, MovieClip, Scene, Timeline, Tween, Animator, AnimatorTimeline } from './animate';\n\nexport {\n    AnimateContainer as Container,\n    AnimateSprite as Sprite,\n    AnimateGraphics as Graphics,\n    AnimateText as Text,\n} from './animate';\n\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const VERSION: string = '__VERSION__';\n\nexport * from './AnimateAsset';\n\n// export type are weeeeird\nimport type { DrawCommands, AnimateDisplayObject  } from './animate';\nexport { DrawCommands };\nexport { AnimateDisplayObject as DisplayObject };\n"],"names":["_prepare","utils","hexToUint","hex","fillFrames","timeline","startFrame","duration","oldLength","i","length","keysMap","parseValue","prop","buffer","buff","val","tweenKeysMap","basicEase","parseTween","tweenBuffer","result","handlingProps","c","index","easeBuffer","strength","name","deserializeKeyframes","keyframes","isFrameStarted","frame","deserializeShapes","str","shapes","isCommand","shape","j","arg","addMovieClips","item","mc","upload","renderer","displayObject","done","EXPECTED_ASSET_VERSION","load","scene","optionsOrComplete","complete","progress","basePath","parent","metadata","createInstance","version","instance","assets","totalAssets","loadedAssets","promises","id","data","Assets","loadedAsset","Spritesheet","Texture","items","sound","EventEmitter","lerpValue","start","end","t","PI","TWO_PI","lerpRotation","lerpSkew","value","lerpTint","sR","sG","sB","eR","eG","eB","r","g","b","COLOR_HELPER","lerpColor","PROP_LERPS","setPropFromShorthand","target","buildPowIn","power","buildPowOut","buildPowInOut","ELASTIC_AMPLITUDE","ELASTIC_PERIOD","ELASTIC_INOUT_PERIOD","EASE_DICT","s","getEaseFromConfig","config","Tween","startProps","endProps","ease","_a","currentFrame","time","p","lerp","lerpedTime","Timeline","out","properties","startValue","tween","prev","k","next","endFrame","prevTween","AnimateContainer","Container","renderable","mask","Graphics","Sprite","alpha","tint","rA","gA","bA","filter","ColorMatrixFilter","SharedTicker","Ticker","_MovieClip","options","loop","framerate","labels","label","tickerDeltaTime","seconds","settings","current","len","tw","_b","sequenceUsesSkew","callback","actions","alias","positionOrLabel","o","fps","afterUpdateOnce","pos","synched","doActions","startPos","actionFrames","oldCurrentFrame","_timelines","timedChildTimelines","depthSorted","shouldBeChild","children","child","frameActions","hiddenChildren","timelines","childTimelines","MovieClip","Scene","Application","asset","removeView","stageOptions","pool","AnimatorTimeline","completed","Animator","startLabel","endLabel","AnimateSprite","AnimateGraphics","geometry","commands","currentCommand","params","args","colorArray","ALIGN_VALUES","STYLE_PROPS","isUndefinedOr","defaultValue","AnimateText","Text","align","style","color","angle","distance","VERSION"],"mappings":";;;;;;;;ogBAQA,IAAIA,EAAoB,KAIP,IAAAC,GAAAA,GAAV,CAMI,SAASC,EAAUC,EAC1B,CAEI,OAAAA,EAAMA,EAAI,OAAO,CAAC,EAGdA,EAAI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