{"version":3,"file":"base.mjs","sources":["../src/core/AttachmentType.ts","../src/core/BinaryInput.ts","../src/core/IAnimation.ts","../src/core/IConstraint.ts","../src/core/ISkeleton.ts","../src/core/TextureRegion.ts","../src/core/TextureAtlas.ts","../src/core/Utils.ts","../src/core/SkeletonBoundsBase.ts","../src/settings.ts","../src/SpineBase.ts","../src/SpineDebugRenderer.ts"],"sourcesContent":["/**\n * @public\n */\nexport enum AttachmentType {\n    Region,\n    BoundingBox,\n    Mesh,\n    LinkedMesh,\n    Path,\n    Point,\n    Clipping,\n}\n","/**\n * @public\n */\nexport class BinaryInput {\n    constructor(data: Uint8Array, public strings = new Array<string>(), private index: number = 0, private buffer = new DataView(data.buffer)) {}\n\n    readByte(): number {\n        return this.buffer.getInt8(this.index++);\n    }\n\n    readUnsignedByte(): number {\n        return this.buffer.getUint8(this.index++);\n    }\n\n    readShort(): number {\n        const value = this.buffer.getInt16(this.index);\n\n        this.index += 2;\n\n        return value;\n    }\n\n    readInt32(): number {\n        const value = this.buffer.getInt32(this.index);\n\n        this.index += 4;\n\n        return value;\n    }\n\n    readInt(optimizePositive: boolean) {\n        let b = this.readByte();\n        let result = b & 0x7f;\n\n        if ((b & 0x80) != 0) {\n            b = this.readByte();\n            result |= (b & 0x7f) << 7;\n            if ((b & 0x80) != 0) {\n                b = this.readByte();\n                result |= (b & 0x7f) << 14;\n                if ((b & 0x80) != 0) {\n                    b = this.readByte();\n                    result |= (b & 0x7f) << 21;\n                    if ((b & 0x80) != 0) {\n                        b = this.readByte();\n                        result |= (b & 0x7f) << 28;\n                    }\n                }\n            }\n        }\n\n        return optimizePositive ? result : (result >>> 1) ^ -(result & 1);\n    }\n\n    readStringRef(): string | null {\n        const index = this.readInt(true);\n\n        return index == 0 ? null : this.strings[index - 1];\n    }\n\n    readString(): string | null {\n        let byteCount = this.readInt(true);\n\n        switch (byteCount) {\n            case 0:\n                return null;\n            case 1:\n                return '';\n        }\n        byteCount--;\n        let chars = '';\n\n        for (let i = 0; i < byteCount; ) {\n            const b = this.readUnsignedByte();\n\n            switch (b >> 4) {\n                case 12:\n                case 13:\n                    chars += String.fromCharCode(((b & 0x1f) << 6) | (this.readByte() & 0x3f));\n                    i += 2;\n                    break;\n                case 14:\n                    chars += String.fromCharCode(((b & 0x0f) << 12) | ((this.readByte() & 0x3f) << 6) | (this.readByte() & 0x3f));\n                    i += 3;\n                    break;\n                default:\n                    chars += String.fromCharCode(b);\n                    i++;\n            }\n        }\n\n        return chars;\n    }\n\n    readFloat(): number {\n        const value = this.buffer.getFloat32(this.index);\n\n        this.index += 4;\n\n        return value;\n    }\n\n    readBoolean(): boolean {\n        return this.readByte() != 0;\n    }\n}\n","import type { ISkeleton, ISkeletonData } from './ISkeleton';\nimport type { Map } from './Utils';\n\n// Those enums were moved from Animation.ts of spine 3.8 and 4.0\n\n/** Controls how a timeline value is mixed with the setup pose value or current pose value when a timeline's `alpha`\n * < 1.\n *\n * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.\n * @public\n * */\nexport enum MixBlend {\n    /** Transitions from the setup value to the timeline value (the current value is not used). Before the first key, the setup\n     * value is set. */\n    setup,\n    /** Transitions from the current value to the timeline value. Before the first key, transitions from the current value to\n     * the setup value. Timelines which perform instant transitions, such as DrawOrderTimeline or\n     * AttachmentTimeline, use the setup value before the first key.\n     *\n     * `first` is intended for the first animations applied, not for animations layered on top of those. */\n    first,\n    /** Transitions from the current value to the timeline value. No change is made before the first key (the current value is\n     * kept until the first key).\n     *\n     * `replace` is intended for animations layered on top of others, not for the first animations applied. */\n    replace,\n    /** Transitions from the current value to the current value plus the timeline value. No change is made before the first key\n     * (the current value is kept until the first key).\n     *\n     * `add` is intended for animations layered on top of others, not for the first animations applied. Properties\n     * keyed by additive animations must be set manually or by another animation before applying the additive animations, else\n     * the property values will increase continually. */\n    add,\n}\n\n/** Indicates whether a timeline's `alpha` is mixing out over time toward 0 (the setup or current pose value) or\n * mixing in toward 1 (the timeline's value).\n *\n * See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.\n * @public\n * */\nexport enum MixDirection {\n    mixIn,\n    mixOut,\n}\n\n/**\n * @public\n */\nexport interface IAnimation<Timeline extends ITimeline = ITimeline> {\n    name: string;\n    timelines: Timeline[];\n    duration: number;\n}\n\n/**\n * @public\n */\nexport interface IAnimationState<AnimationStateData extends IAnimationStateData = IAnimationStateData> {\n    data: AnimationStateData;\n    tracks: ITrackEntry[];\n    listeners: IAnimationStateListener[];\n    timeScale: number;\n\n    update(dt: number): void;\n    apply(skeleton: ISkeleton): boolean;\n\n    setAnimation(trackIndex: number, animationName: string, loop: boolean): ITrackEntry;\n    addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): ITrackEntry;\n    addEmptyAnimation(trackIndex: number, mixDuration: number, delay: number): ITrackEntry;\n    setEmptyAnimation(trackIndex: number, mixDuration: number): ITrackEntry;\n    setEmptyAnimations(mixDuration: number): void;\n    hasAnimation(animationName: string): boolean;\n    addListener(listener: IAnimationStateListener): void;\n    removeListener(listener: IAnimationStateListener): void;\n    clearListeners(): void;\n    clearTracks(): void;\n    clearTrack(index: number): void;\n}\n\n/**\n * @public\n */\nexport interface IAnimationStateData<SkeletonData extends ISkeletonData = ISkeletonData, Animation extends IAnimation = IAnimation> {\n    skeletonData: SkeletonData;\n    animationToMixTime: Map<number>;\n    defaultMix: number;\n    setMix(fromName: string, toName: string, duration: number): void;\n    setMixWith(from: Animation, to: Animation, duration: number): void;\n    getMix(from: Animation, to: Animation): number;\n}\n\n/**\n * @public\n */\nexport interface IAnimationStateListener {\n    start?(entry: ITrackEntry): void;\n    interrupt?(entry: ITrackEntry): void;\n    end?(entry: ITrackEntry): void;\n    dispose?(entry: ITrackEntry): void;\n    complete?(entry: ITrackEntry): void;\n    event?(entry: ITrackEntry, event: IEvent): void;\n}\n\n/**\n * @public\n */\nexport interface ITimeline {}\n\n/**\n * @public\n */\nexport interface ITrackEntry {\n    trackIndex: number;\n    loop: boolean;\n    animationEnd: number;\n    listener: IAnimationStateListener;\n\n    delay: number;\n    trackTime: number;\n    trackLast: number;\n    nextTrackLast: number;\n    trackEnd: number;\n    timeScale: number;\n    alpha: number;\n    mixTime: number;\n    mixDuration: number;\n    interruptAlpha: number;\n    totalAlpha: number;\n}\n\n/**\n * @public\n */\nexport interface IEventData {\n    name: string;\n}\n\n/**\n * @public\n */\nexport interface IEvent {\n    time: number;\n    data: IEventData;\n}\n","// These enums were moved from PathConstraintData.ts of spine 3.7, 3.8 and 4.0\n\n/** Controls how the first bone is positioned along the path.\n *\n * See [Position mode](http://esotericsoftware.com/spine-path-constraints#Position-mode) in the Spine User Guide.\n * @public\n * */\nexport enum PositionMode {\n    Fixed,\n    Percent,\n}\n\n/** Controls how bones are rotated, translated, and scaled to match the path.\n *\n * [Rotate mode](http://esotericsoftware.com/spine-path-constraints#Rotate-mod) in the Spine User Guide.\n * @public\n * */\nexport enum RotateMode {\n    Tangent,\n    Chain,\n    ChainScale,\n}\n\n/**\n * @public\n */\nexport interface IConstraintData {\n    name: string;\n    order: number;\n}\n\n/**\n * @public\n */\nexport interface IIkConstraint {\n    data: IIkConstraintData;\n    /** -1 | 0 | 1 */\n    bendDirection: number;\n    compress: boolean;\n    stretch: boolean;\n\n    /** A percentage (0-1) */\n    mix: number;\n}\n\n/**\n * @public\n */\nexport interface IIkConstraintData extends IConstraintData {\n    /** -1 | 0 | 1 */\n    bendDirection: number;\n    compress: boolean;\n    stretch: boolean;\n    uniform: boolean;\n\n    /** A percentage (0-1) */\n    mix: number;\n}\n\n/**\n * @public\n */\nexport interface IPathConstraint {\n    data: IPathConstraintData;\n    position: number;\n    spacing: number;\n\n    spaces: number[];\n    positions: number[];\n    world: number[];\n    curves: number[];\n    lengths: number[];\n    segments: number[];\n}\n\n/**\n * @public\n */\nexport interface IPathConstraintData extends IConstraintData {\n    positionMode: PositionMode;\n    rotateMode: RotateMode;\n    offsetRotation: number;\n    position: number;\n    spacing: number;\n}\n\n/**\n * @public\n */\nexport interface ITransformConstraint {\n    data: ITransformConstraintData;\n}\n\n/**\n * @public\n */\nexport interface ITransformConstraintData extends IConstraintData {\n    offsetRotation: number;\n    offsetX: number;\n    offsetY: number;\n    offsetScaleX: number;\n    offsetScaleY: number;\n    offsetShearY: number;\n    relative: boolean;\n    local: boolean;\n}\n","import type { AttachmentType } from './AttachmentType';\nimport type { IAnimation, IEventData } from './IAnimation';\nimport type { IIkConstraintData, IPathConstraintData, ITransformConstraintData } from './IConstraint';\nimport type { Color, Vector2, Map } from './Utils';\nimport type { TextureRegion } from './TextureRegion';\nimport type { BLEND_MODES, Matrix } from '@pixi/core';\n\n// This enum was moved from BoneData.ts of spine 3.7, 3.8 and 4.0\n\n/** Determines how a bone inherits world transforms from parent bones.\n * @public\n * */\nexport enum TransformMode {\n    Normal,\n    OnlyTranslation,\n    NoRotationOrReflection,\n    NoScale,\n    NoScaleOrReflection,\n}\n\n/**\n * @public\n */\nexport interface IBone {\n    data: IBoneData;\n    matrix: Matrix;\n    active: boolean;\n}\n\n/**\n * @public\n */\nexport interface ISkin {\n    name: string;\n    attachments: Array<Map<IAttachment>>;\n\n    getAttachment(slotIndex: number, name: string): IAttachment | null;\n}\n\n/**\n * @public\n */\nexport interface IAttachment {\n    name: string;\n    type: AttachmentType;\n    readonly sequence?: ISequence;\n}\n\n/**\n * @public\n */\nexport interface IHasTextureRegion {\n    /** The name used to find the {@link #region()}. */\n    path: string;\n\n    /** The region used to draw the attachment. After setting the region or if the region's properties are changed,\n     * {@link #updateRegion()} must be called. */\n    region: TextureRegion | null;\n\n    /** Updates any values the attachment calculates using the {@link #getRegion()}. Must be called after setting the\n     * {@link #getRegion()} or if the region's properties are changed. */\n    // updateRegion (): void;\n\n    /** The color to tint the attachment. */\n    color: Color;\n\n    readonly sequence: ISequence | null;\n}\n\n/**\n * @public\n */\nexport interface ISequence {\n    id: number;\n    regions: TextureRegion[];\n    apply(slot: ISlot, attachment: IHasTextureRegion): void;\n}\n\n/**\n * @public\n */\nexport interface IVertexAttachment<Slot extends ISlot = ISlot> extends IAttachment {\n    id: number;\n    computeWorldVerticesOld(slot: Slot, worldVertices: ArrayLike<number>): void;\n    computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;\n    worldVerticesLength: number;\n}\n\n/**\n * @public\n */\nexport interface IClippingAttachment extends IVertexAttachment {\n    endSlot?: ISlotData;\n}\n\n/**\n * @public\n */\nexport interface IRegionAttachment extends IAttachment {\n    region: TextureRegion;\n    color: Color;\n    x;\n    y;\n    scaleX;\n    scaleY;\n    rotation;\n    width;\n    height: number;\n}\n\n/**\n * @public\n */\nexport interface IMeshAttachment extends IVertexAttachment {\n    region: TextureRegion;\n    color: Color;\n    regionUVs: Float32Array;\n    triangles: number[];\n    hullLength: number;\n}\n\n/**\n * @public\n */\nexport interface ISlotData {\n    index: number;\n    name: string;\n    boneData: IBoneData;\n    color: Color;\n    darkColor: Color;\n    attachmentName: string;\n    blendMode: BLEND_MODES;\n}\n\n/**\n * @public\n */\nexport interface IBoneData {\n    index: number;\n    name: string;\n    parent: IBoneData;\n    length: number;\n    x: number;\n    y: number;\n    rotation: number;\n    scaleX: number;\n    scaleY: number;\n    shearX: number;\n    shearY: number;\n    transformMode: TransformMode;\n}\n\n/**\n * @public\n */\nexport interface ISlot {\n    getAttachment(): IAttachment;\n    data: ISlotData;\n    color: Color;\n    darkColor: Color;\n    blendMode: number;\n    bone: IBone;\n\n    sprites?: any;\n    currentSprite?: any;\n    currentSpriteName?: string;\n\n    meshes?: any;\n    currentMesh?: any;\n    currentMeshName?: string;\n    currentMeshId?: number;\n\n    currentGraphics?: any;\n    clippingContainer?: any;\n\n    hackRegion?: TextureRegion;\n    hackAttachment?: IAttachment;\n}\n\n/**\n * @public\n */\nexport interface ISkeleton<SkeletonData extends ISkeletonData = ISkeletonData, Bone extends IBone = IBone, Slot extends ISlot = ISlot, Skin extends ISkin = ISkin> {\n    bones: Bone[];\n    slots: Slot[];\n    drawOrder: Slot[];\n    skin: Skin;\n    data: SkeletonData;\n    x: number; // added for debug purposes\n    y: number; // added for debug purposes\n    updateWorldTransform(): void;\n    setToSetupPose(): void;\n    findSlotIndex(slotName: string): number;\n    getAttachmentByName(slotName: string, attachmentName: string): IAttachment;\n\n    setBonesToSetupPose(): void;\n    setSlotsToSetupPose(): void;\n    findBone(boneName: string): Bone;\n    findSlot(slotName: string): Slot;\n    findBoneIndex(boneName: string): number;\n    findSlotIndex(slotName: string): number;\n    setSkinByName(skinName: string): void;\n    setAttachment(slotName: string, attachmentName: string): void;\n    getBounds(offset: Vector2, size: Vector2, temp: Array<number>): void;\n}\n\n/**\n * @public\n */\nexport interface ISkeletonParser {\n    scale: number;\n}\n\n/**\n * @public\n */\nexport interface ISkeletonData<\n    BoneData extends IBoneData = IBoneData,\n    SlotData extends ISlotData = ISlotData,\n    Skin extends ISkin = ISkin,\n    Animation extends IAnimation = IAnimation,\n    EventData extends IEventData = IEventData,\n    IkConstraintData extends IIkConstraintData = IIkConstraintData,\n    TransformConstraintData extends ITransformConstraintData = ITransformConstraintData,\n    PathConstraintData extends IPathConstraintData = IPathConstraintData\n> {\n    name: string;\n    bones: BoneData[];\n    slots: SlotData[];\n    skins: Skin[];\n    defaultSkin: Skin;\n    events: EventData[];\n    animations: Animation[];\n    version: string;\n    hash: string;\n    width: number;\n    height: number;\n    ikConstraints: IkConstraintData[];\n    transformConstraints: TransformConstraintData[];\n    pathConstraints: PathConstraintData[];\n\n    findBone(boneName: string): BoneData | null;\n    findBoneIndex(boneName: string): number;\n    findSlot(slotName: string): SlotData | null;\n    findSlotIndex(slotName: string): number;\n    findSkin(skinName: string): Skin | null;\n\n    findEvent(eventDataName: string): EventData | null;\n    findAnimation(animationName: string): Animation | null;\n    findIkConstraint(constraintName: string): IkConstraintData | null;\n    findTransformConstraint(constraintName: string): TransformConstraintData | null;\n    findPathConstraint(constraintName: string): PathConstraintData | null;\n}\n","import type { Texture, Rectangle } from '@pixi/core';\n\n/**\n * @public\n */\nexport function filterFromString(text: string): TextureFilter {\n    switch (text.toLowerCase()) {\n        case 'nearest':\n            return TextureFilter.Nearest;\n        case 'linear':\n            return TextureFilter.Linear;\n        case 'mipmap':\n            return TextureFilter.MipMap;\n        case 'mipmapnearestnearest':\n            return TextureFilter.MipMapNearestNearest;\n        case 'mipmaplinearnearest':\n            return TextureFilter.MipMapLinearNearest;\n        case 'mipmapnearestlinear':\n            return TextureFilter.MipMapNearestLinear;\n        case 'mipmaplinearlinear':\n            return TextureFilter.MipMapLinearLinear;\n        default:\n            throw new Error(`Unknown texture filter ${text}`);\n    }\n}\n\n/**\n * @public\n */\nexport function wrapFromString(text: string): TextureWrap {\n    switch (text.toLowerCase()) {\n        case 'mirroredtepeat':\n            return TextureWrap.MirroredRepeat;\n        case 'clamptoedge':\n            return TextureWrap.ClampToEdge;\n        case 'repeat':\n            return TextureWrap.Repeat;\n        default:\n            throw new Error(`Unknown texture wrap ${text}`);\n    }\n}\n\n/**\n * @public\n */\nexport enum TextureFilter {\n    Nearest = 9728, // WebGLRenderingContext.NEAREST\n    Linear = 9729, // WebGLRenderingContext.LINEAR\n    MipMap = 9987, // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR\n    MipMapNearestNearest = 9984, // WebGLRenderingContext.NEAREST_MIPMAP_NEAREST\n    MipMapLinearNearest = 9985, // WebGLRenderingContext.LINEAR_MIPMAP_NEAREST\n    MipMapNearestLinear = 9986, // WebGLRenderingContext.NEAREST_MIPMAP_LINEAR\n    MipMapLinearLinear = 9987, // WebGLRenderingContext.LINEAR_MIPMAP_LINEAR\n}\n\n/**\n * @public\n */\nexport enum TextureWrap {\n    MirroredRepeat = 33648, // WebGLRenderingContext.MIRRORED_REPEAT\n    ClampToEdge = 33071, // WebGLRenderingContext.CLAMP_TO_EDGE\n    Repeat = 10497, // WebGLRenderingContext.REPEAT\n}\n\n/**\n * @public\n */\nexport class TextureRegion {\n    texture: Texture;\n\n    // thats for overrides\n    size: Rectangle = null;\n\n    names: string[] = null;\n    values: number[][] = null;\n\n    renderObject: any = null;\n\n    get width(): number {\n        const tex = this.texture;\n\n        if (tex.trim) {\n            return tex.trim.width;\n        }\n\n        return tex.orig.width;\n    }\n\n    get height(): number {\n        const tex = this.texture;\n\n        if (tex.trim) {\n            return tex.trim.height;\n        }\n\n        return tex.orig.height;\n    }\n\n    get u(): number {\n        return (this.texture as any)._uvs.x0;\n    }\n\n    get v(): number {\n        return (this.texture as any)._uvs.y0;\n    }\n\n    get u2(): number {\n        return (this.texture as any)._uvs.x2;\n    }\n\n    get v2(): number {\n        return (this.texture as any)._uvs.y2;\n    }\n\n    get offsetX(): number {\n        const tex = this.texture;\n\n        return tex.trim ? tex.trim.x : 0;\n    }\n\n    get offsetY(): number {\n        // console.warn(\"Deprecation Warning: @Hackerham: I guess, if you are using PIXI-SPINE ATLAS region.offsetY, you want a texture, right? Use region.texture from now on.\");\n        return this.spineOffsetY;\n    }\n\n    get pixiOffsetY(): number {\n        const tex = this.texture;\n\n        return tex.trim ? tex.trim.y : 0;\n    }\n\n    get spineOffsetY(): number {\n        const tex = this.texture;\n\n        return this.originalHeight - this.height - (tex.trim ? tex.trim.y : 0);\n    }\n\n    get originalWidth(): number {\n        return this.texture.orig.width;\n    }\n\n    get originalHeight(): number {\n        return this.texture.orig.height;\n    }\n\n    get x(): number {\n        return this.texture.frame.x;\n    }\n\n    get y(): number {\n        return this.texture.frame.y;\n    }\n\n    get rotate(): boolean {\n        return this.texture.rotate !== 0;\n    }\n\n    get degrees() {\n        return (360 - this.texture.rotate * 45) % 360;\n    }\n}\n","import { Texture, SCALE_MODES, MIPMAP_MODES, ALPHA_MODES, Rectangle } from '@pixi/core';\nimport { TextureRegion, TextureWrap, TextureFilter, filterFromString } from './TextureRegion';\nimport type { Map, Disposable } from './Utils';\nimport type { BaseTexture } from '@pixi/core';\n\nclass RegionFields {\n    x = 0;\n    y = 0;\n    width = 0;\n    height = 0;\n    offsetX = 0;\n    offsetY = 0;\n    originalWidth = 0;\n    originalHeight = 0;\n    rotate = 0;\n    index = 0;\n}\n/**\n * @public\n */\nexport class TextureAtlas implements Disposable {\n    pages = new Array<TextureAtlasPage>();\n    regions = new Array<TextureAtlasRegion>();\n\n    constructor(atlasText?: string, textureLoader?: (path: string, loaderFunction: (tex: BaseTexture) => any) => any, callback?: (obj: TextureAtlas) => any) {\n        if (atlasText) {\n            this.addSpineAtlas(atlasText, textureLoader, callback);\n        }\n    }\n\n    addTexture(name: string, texture: Texture) {\n        const pages = this.pages;\n        let page: TextureAtlasPage = null;\n\n        for (let i = 0; i < pages.length; i++) {\n            if (pages[i].baseTexture === texture.baseTexture) {\n                page = pages[i];\n                break;\n            }\n        }\n        if (page === null) {\n            page = new TextureAtlasPage();\n            page.name = 'texturePage';\n            const baseTexture = texture.baseTexture;\n\n            page.width = baseTexture.realWidth;\n            page.height = baseTexture.realHeight;\n            page.baseTexture = baseTexture;\n            // those fields are not relevant in Pixi\n            page.minFilter = page.magFilter = TextureFilter.Nearest;\n            page.uWrap = TextureWrap.ClampToEdge;\n            page.vWrap = TextureWrap.ClampToEdge;\n            pages.push(page);\n        }\n        const region = new TextureAtlasRegion();\n\n        region.name = name;\n        region.page = page;\n        region.texture = texture;\n        region.index = -1;\n        this.regions.push(region);\n\n        return region;\n    }\n\n    addTextureHash(textures: Map<Texture>, stripExtension: boolean) {\n        for (const key in textures) {\n            if (textures.hasOwnProperty(key)) {\n                this.addTexture(stripExtension && key.indexOf('.') !== -1 ? key.substr(0, key.lastIndexOf('.')) : key, textures[key]);\n            }\n        }\n    }\n\n    public addSpineAtlas(atlasText: string, textureLoader: (path: string, loaderFunction: (tex: BaseTexture) => any) => any, callback: (obj: TextureAtlas) => any) {\n        return this.load(atlasText, textureLoader, callback);\n    }\n\n    private load(atlasText: string, textureLoader: (path: string, loaderFunction: (tex: BaseTexture) => any) => any, callback: (obj: TextureAtlas) => any) {\n        if (textureLoader == null) {\n            throw new Error('textureLoader cannot be null.');\n        }\n\n        const reader = new TextureAtlasReader(atlasText);\n        const entry = new Array<string>(4);\n        let page: TextureAtlasPage = null;\n        const pageFields: Map<Function> = {};\n        let region: RegionFields = null;\n\n        pageFields.size = () => {\n            page.width = parseInt(entry[1]);\n            page.height = parseInt(entry[2]);\n        };\n        pageFields.format = () => {\n            // page.format = Format[tuple[0]]; we don't need format in WebGL\n        };\n        pageFields.filter = () => {\n            page.minFilter = filterFromString(entry[1]);\n            page.magFilter = filterFromString(entry[2]);\n        };\n        pageFields.repeat = () => {\n            if (entry[1].indexOf('x') != -1) page.uWrap = TextureWrap.Repeat;\n            if (entry[1].indexOf('y') != -1) page.vWrap = TextureWrap.Repeat;\n        };\n        pageFields.pma = () => {\n            page.pma = entry[1] == 'true';\n        };\n\n        const regionFields: Map<Function> = {};\n\n        regionFields.xy = () => {\n            // Deprecated, use bounds.\n            region.x = parseInt(entry[1]);\n            region.y = parseInt(entry[2]);\n        };\n        regionFields.size = () => {\n            // Deprecated, use bounds.\n            region.width = parseInt(entry[1]);\n            region.height = parseInt(entry[2]);\n        };\n        regionFields.bounds = () => {\n            region.x = parseInt(entry[1]);\n            region.y = parseInt(entry[2]);\n            region.width = parseInt(entry[3]);\n            region.height = parseInt(entry[4]);\n        };\n        regionFields.offset = () => {\n            // Deprecated, use offsets.\n            region.offsetX = parseInt(entry[1]);\n            region.offsetY = parseInt(entry[2]);\n        };\n        regionFields.orig = () => {\n            // Deprecated, use offsets.\n            region.originalWidth = parseInt(entry[1]);\n            region.originalHeight = parseInt(entry[2]);\n        };\n        regionFields.offsets = () => {\n            region.offsetX = parseInt(entry[1]);\n            region.offsetY = parseInt(entry[2]);\n            region.originalWidth = parseInt(entry[3]);\n            region.originalHeight = parseInt(entry[4]);\n        };\n        regionFields.rotate = () => {\n            const rotateValue = entry[1];\n            let rotate = 0;\n\n            if (rotateValue.toLocaleLowerCase() == 'true') {\n                rotate = 6;\n            } else if (rotateValue.toLocaleLowerCase() == 'false') {\n                rotate = 0;\n            } else {\n                rotate = ((720 - parseFloat(rotateValue)) % 360) / 45;\n            }\n            region.rotate = rotate;\n        };\n        regionFields.index = () => {\n            region.index = parseInt(entry[1]);\n        };\n\n        let line = reader.readLine();\n        // Ignore empty lines before first entry.\n\n        while (line != null && line.trim().length == 0) {\n            line = reader.readLine();\n        }\n        // Header entries.\n        while (true) {\n            if (line == null || line.trim().length == 0) break;\n            if (reader.readEntry(entry, line) == 0) break; // Silently ignore all header fields.\n            line = reader.readLine();\n        }\n\n        const iterateParser = () => {\n            while (true) {\n                if (line == null) {\n                    return callback && callback(this);\n                }\n                if (line.trim().length == 0) {\n                    page = null;\n                    line = reader.readLine();\n                } else if (page === null) {\n                    page = new TextureAtlasPage();\n                    page.name = line.trim();\n\n                    while (true) {\n                        if (reader.readEntry(entry, (line = reader.readLine())) == 0) break;\n                        const field: Function = pageFields[entry[0]];\n\n                        if (field) field();\n                    }\n                    this.pages.push(page);\n\n                    textureLoader(page.name, (texture: BaseTexture) => {\n                        if (texture === null) {\n                            this.pages.splice(this.pages.indexOf(page), 1);\n\n                            return callback && callback(null);\n                        }\n                        page.baseTexture = texture;\n                        // TODO: set scaleMode and mipmapMode from spine\n                        if (page.pma) {\n                            texture.alphaMode = ALPHA_MODES.PMA;\n                        }\n                        if (!texture.valid) {\n                            texture.setSize(page.width, page.height);\n                        }\n                        page.setFilters();\n\n                        if (!page.width || !page.height) {\n                            page.width = texture.realWidth;\n                            page.height = texture.realHeight;\n                            if (!page.width || !page.height) {\n                                console.log(\n                                    `ERROR spine atlas page ${page.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`\n                                );\n                            }\n                        }\n                        iterateParser();\n                    });\n                    break;\n                } else {\n                    region = new RegionFields();\n                    const atlasRegion = new TextureAtlasRegion();\n\n                    atlasRegion.name = line;\n                    atlasRegion.page = page;\n                    let names: string[] = null;\n                    let values: number[][] = null;\n\n                    while (true) {\n                        const count = reader.readEntry(entry, (line = reader.readLine()));\n\n                        if (count == 0) break;\n                        const field: Function = regionFields[entry[0]];\n\n                        if (field) {\n                            field();\n                        } else {\n                            if (names == null) {\n                                names = [];\n                                values = [];\n                            }\n                            names.push(entry[0]);\n                            const entryValues: number[] = [];\n\n                            for (let i = 0; i < count; i++) {\n                                entryValues.push(parseInt(entry[i + 1]));\n                            }\n                            values.push(entryValues);\n                        }\n                    }\n                    if (region.originalWidth == 0 && region.originalHeight == 0) {\n                        region.originalWidth = region.width;\n                        region.originalHeight = region.height;\n                    }\n\n                    const resolution = page.baseTexture.resolution;\n\n                    region.x /= resolution;\n                    region.y /= resolution;\n                    region.width /= resolution;\n                    region.height /= resolution;\n                    region.originalWidth /= resolution;\n                    region.originalHeight /= resolution;\n                    region.offsetX /= resolution;\n                    region.offsetY /= resolution;\n\n                    const swapWH = region.rotate % 4 !== 0;\n                    const frame = new Rectangle(region.x, region.y, swapWH ? region.height : region.width, swapWH ? region.width : region.height);\n\n                    const orig = new Rectangle(0, 0, region.originalWidth, region.originalHeight);\n                    const trim = new Rectangle(region.offsetX, region.originalHeight - region.height - region.offsetY, region.width, region.height);\n\n                    atlasRegion.texture = new Texture(atlasRegion.page.baseTexture, frame, orig, trim, region.rotate);\n                    atlasRegion.index = region.index;\n                    atlasRegion.texture.updateUvs();\n\n                    this.regions.push(atlasRegion);\n                }\n            }\n        };\n\n        iterateParser();\n    }\n\n    findRegion(name: string): TextureAtlasRegion {\n        for (let i = 0; i < this.regions.length; i++) {\n            if (this.regions[i].name == name) {\n                return this.regions[i];\n            }\n        }\n\n        return null;\n    }\n\n    dispose() {\n        for (let i = 0; i < this.pages.length; i++) {\n            this.pages[i].baseTexture.dispose();\n        }\n    }\n}\n\n/**\n * @public\n */\nclass TextureAtlasReader {\n    lines: Array<string>;\n    index = 0;\n\n    constructor(text: string) {\n        this.lines = text.split(/\\r\\n|\\r|\\n/);\n    }\n\n    readLine(): string {\n        if (this.index >= this.lines.length) {\n            return null;\n        }\n\n        return this.lines[this.index++];\n    }\n\n    readEntry(entry: string[], line: string): number {\n        if (line == null) return 0;\n        line = line.trim();\n        if (line.length == 0) return 0;\n\n        const colon = line.indexOf(':');\n\n        if (colon == -1) return 0;\n        entry[0] = line.substr(0, colon).trim();\n        for (let i = 1, lastMatch = colon + 1; ; i++) {\n            const comma = line.indexOf(',', lastMatch);\n\n            if (comma == -1) {\n                entry[i] = line.substr(lastMatch).trim();\n\n                return i;\n            }\n            entry[i] = line.substr(lastMatch, comma - lastMatch).trim();\n            lastMatch = comma + 1;\n            if (i == 4) return 4;\n        }\n    }\n}\n\n/**\n * @public\n */\nexport class TextureAtlasPage {\n    name: string;\n    minFilter: TextureFilter = TextureFilter.Nearest;\n    magFilter: TextureFilter = TextureFilter.Nearest;\n    uWrap: TextureWrap = TextureWrap.ClampToEdge;\n    vWrap: TextureWrap = TextureWrap.ClampToEdge;\n    baseTexture: BaseTexture;\n    width: number;\n    height: number;\n    pma: boolean;\n\n    public setFilters() {\n        const tex = this.baseTexture;\n        const filter = this.minFilter;\n\n        if (filter == TextureFilter.Linear) {\n            tex.scaleMode = SCALE_MODES.LINEAR;\n        } else if (this.minFilter == TextureFilter.Nearest) {\n            tex.scaleMode = SCALE_MODES.NEAREST;\n        } else {\n            tex.mipmap = MIPMAP_MODES.POW2;\n            if (filter == TextureFilter.MipMapNearestNearest) {\n                tex.scaleMode = SCALE_MODES.NEAREST;\n            } else {\n                tex.scaleMode = SCALE_MODES.LINEAR;\n            }\n        }\n    }\n}\n\n/**\n * @public\n */\nexport class TextureAtlasRegion extends TextureRegion {\n    page: TextureAtlasPage;\n    name: string;\n    index: number;\n}\n","import type { ISkeleton } from './ISkeleton';\n\n/**\n * @public\n */\n\nexport interface Map<T> {\n    [key: string]: T;\n}\n\n/**\n * @public\n */\nexport interface StringMap<T> {\n    [key: string]: T;\n}\n\n/**\n * @public\n */\nexport class IntSet {\n    array = new Array<number>();\n\n    add(value: number): boolean {\n        const contains = this.contains(value);\n\n        this.array[value | 0] = value | 0;\n\n        return !contains;\n    }\n\n    contains(value: number) {\n        return this.array[value | 0] != undefined;\n    }\n\n    remove(value: number) {\n        this.array[value | 0] = undefined;\n    }\n\n    clear() {\n        this.array.length = 0;\n    }\n}\n\n/**\n * @public\n */\nexport class StringSet {\n    entries: StringMap<boolean> = {};\n    size = 0;\n\n    add(value: string): boolean {\n        const contains = this.entries[value];\n\n        this.entries[value] = true;\n        if (!contains) {\n            this.size++;\n\n            return true;\n        }\n\n        return false;\n    }\n\n    addAll(values: string[]): boolean {\n        const oldSize = this.size;\n\n        for (let i = 0, n = values.length; i < n; i++) {\n            this.add(values[i]);\n        }\n\n        return oldSize != this.size;\n    }\n\n    contains(value: string) {\n        return this.entries[value];\n    }\n\n    clear() {\n        this.entries = {};\n        this.size = 0;\n    }\n}\n\n/**\n * @public\n */\nexport interface NumberArrayLike {\n    readonly length: number;\n    [n: number]: number;\n}\n\n/**\n * @public\n */\nexport interface Disposable {\n    dispose(): void;\n}\n\n/**\n * @public\n */\nexport interface Restorable {\n    restore(): void;\n}\n\n/**\n * @public\n */\nexport class Color {\n    public static WHITE = new Color(1, 1, 1, 1);\n    public static RED = new Color(1, 0, 0, 1);\n    public static GREEN = new Color(0, 1, 0, 1);\n    public static BLUE = new Color(0, 0, 1, 1);\n    public static MAGENTA = new Color(1, 0, 1, 1);\n\n    constructor(public r: number = 0, public g: number = 0, public b: number = 0, public a: number = 0) {}\n\n    set(r: number, g: number, b: number, a: number) {\n        this.r = r;\n        this.g = g;\n        this.b = b;\n        this.a = a;\n\n        return this.clamp();\n    }\n\n    setFromColor(c: Color) {\n        this.r = c.r;\n        this.g = c.g;\n        this.b = c.b;\n        this.a = c.a;\n\n        return this;\n    }\n\n    setFromString(hex: string) {\n        hex = hex.charAt(0) == '#' ? hex.substr(1) : hex;\n        this.r = parseInt(hex.substr(0, 2), 16) / 255;\n        this.g = parseInt(hex.substr(2, 2), 16) / 255;\n        this.b = parseInt(hex.substr(4, 2), 16) / 255;\n        this.a = hex.length != 8 ? 1 : parseInt(hex.substr(6, 2), 16) / 255;\n\n        return this;\n    }\n\n    add(r: number, g: number, b: number, a: number) {\n        this.r += r;\n        this.g += g;\n        this.b += b;\n        this.a += a;\n\n        return this.clamp();\n    }\n\n    clamp() {\n        if (this.r < 0) this.r = 0;\n        else if (this.r > 1) this.r = 1;\n\n        if (this.g < 0) this.g = 0;\n        else if (this.g > 1) this.g = 1;\n\n        if (this.b < 0) this.b = 0;\n        else if (this.b > 1) this.b = 1;\n\n        if (this.a < 0) this.a = 0;\n        else if (this.a > 1) this.a = 1;\n\n        return this;\n    }\n\n    static rgba8888ToColor(color: Color, value: number) {\n        color.r = ((value & 0xff000000) >>> 24) / 255;\n        color.g = ((value & 0x00ff0000) >>> 16) / 255;\n        color.b = ((value & 0x0000ff00) >>> 8) / 255;\n        color.a = (value & 0x000000ff) / 255;\n    }\n\n    static rgb888ToColor(color: Color, value: number) {\n        color.r = ((value & 0x00ff0000) >>> 16) / 255;\n        color.g = ((value & 0x0000ff00) >>> 8) / 255;\n        color.b = (value & 0x000000ff) / 255;\n    }\n\n    static fromString(hex: string): Color {\n        return new Color().setFromString(hex);\n    }\n}\n\n/**\n * @public\n */\nexport class MathUtils {\n    static PI = 3.1415927;\n    static PI2 = MathUtils.PI * 2;\n    static radiansToDegrees = 180 / MathUtils.PI;\n    static radDeg = MathUtils.radiansToDegrees;\n    static degreesToRadians = MathUtils.PI / 180;\n    static degRad = MathUtils.degreesToRadians;\n\n    static clamp(value: number, min: number, max: number) {\n        if (value < min) return min;\n        if (value > max) return max;\n\n        return value;\n    }\n\n    static cosDeg(degrees: number) {\n        return Math.cos(degrees * MathUtils.degRad);\n    }\n\n    static sinDeg(degrees: number) {\n        return Math.sin(degrees * MathUtils.degRad);\n    }\n\n    static signum(value: number): number {\n        return Math.sign(value);\n    }\n\n    static toInt(x: number) {\n        return x > 0 ? Math.floor(x) : Math.ceil(x);\n    }\n\n    static cbrt(x: number) {\n        const y = Math.pow(Math.abs(x), 1 / 3);\n\n        return x < 0 ? -y : y;\n    }\n\n    static randomTriangular(min: number, max: number): number {\n        return MathUtils.randomTriangularWith(min, max, (min + max) * 0.5);\n    }\n\n    static randomTriangularWith(min: number, max: number, mode: number): number {\n        const u = Math.random();\n        const d = max - min;\n\n        if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));\n\n        return max - Math.sqrt((1 - u) * d * (max - mode));\n    }\n\n    static isPowerOfTwo(value: number) {\n        return value && (value & (value - 1)) === 0;\n    }\n}\n\n/**\n * @public\n */\nexport abstract class Interpolation {\n    protected abstract applyInternal(a: number): number;\n    apply(start: number, end: number, a: number): number {\n        return start + (end - start) * this.applyInternal(a);\n    }\n}\n\n/**\n * @public\n */\nexport class Pow extends Interpolation {\n    protected power = 2;\n\n    constructor(power: number) {\n        super();\n        this.power = power;\n    }\n\n    applyInternal(a: number): number {\n        if (a <= 0.5) return Math.pow(a * 2, this.power) / 2;\n\n        return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;\n    }\n}\n\n/**\n * @public\n */\nexport class PowOut extends Pow {\n    applyInternal(a: number): number {\n        return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;\n    }\n}\n\n/**\n * @public\n */\nexport class Utils {\n    static SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== 'undefined';\n\n    static arrayCopy<T>(source: ArrayLike<T>, sourceStart: number, dest: ArrayLike<T>, destStart: number, numElements: number) {\n        for (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {\n            dest[j] = source[i];\n        }\n    }\n\n    static arrayFill<T>(array: ArrayLike<T>, fromIndex: number, toIndex: number, value: T) {\n        for (let i = fromIndex; i < toIndex; i++) {\n            array[i] = value;\n        }\n    }\n\n    static setArraySize<T>(array: Array<T>, size: number, value: any = 0): Array<T> {\n        const oldSize = array.length;\n\n        if (oldSize == size) return array;\n        array.length = size;\n        if (oldSize < size) {\n            for (let i = oldSize; i < size; i++) array[i] = value;\n        }\n\n        return array;\n    }\n\n    static ensureArrayCapacity<T>(array: Array<T>, size: number, value: any = 0): Array<T> {\n        if (array.length >= size) return array;\n\n        return Utils.setArraySize(array, size, value);\n    }\n\n    static newArray<T>(size: number, defaultValue: T): Array<T> {\n        const array = new Array<T>(size);\n\n        for (let i = 0; i < size; i++) array[i] = defaultValue;\n\n        return array;\n    }\n\n    static newFloatArray(size: number): NumberArrayLike {\n        if (Utils.SUPPORTS_TYPED_ARRAYS) {\n            return new Float32Array(size);\n        }\n\n        const array = new Array<number>(size);\n\n        for (let i = 0; i < array.length; i++) array[i] = 0;\n\n        return array;\n    }\n\n    static newShortArray(size: number): NumberArrayLike {\n        if (Utils.SUPPORTS_TYPED_ARRAYS) {\n            return new Int16Array(size);\n        }\n\n        const array = new Array<number>(size);\n\n        for (let i = 0; i < array.length; i++) array[i] = 0;\n\n        return array;\n    }\n\n    static toFloatArray(array: Array<number>) {\n        return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array;\n    }\n\n    static toSinglePrecision(value: number) {\n        return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;\n    }\n\n    // This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109\n    static webkit602BugfixHelper(alpha: number, blend: any) {}\n\n    static contains<T>(array: Array<T>, element: T, identity = true) {\n        for (let i = 0; i < array.length; i++) {\n            if (array[i] == element) return true;\n        }\n\n        return false;\n    }\n\n    static enumValue(type: any, name: string) {\n        return type[name[0].toUpperCase() + name.slice(1)];\n    }\n}\n\n/**\n * @public\n */\nexport class DebugUtils {\n    static logBones(skeleton: ISkeleton) {\n        for (let i = 0; i < skeleton.bones.length; i++) {\n            const bone = skeleton.bones[i];\n            const mat = bone.matrix;\n\n            console.log(`${bone.data.name}, ${mat.a}, ${mat.b}, ${mat.c}, ${mat.d}, ${mat.tx}, ${mat.ty}`);\n        }\n    }\n}\n\n/**\n * @public\n */\nexport class Pool<T> {\n    private items = new Array<T>();\n    private instantiator: () => T;\n\n    constructor(instantiator: () => T) {\n        this.instantiator = instantiator;\n    }\n\n    obtain() {\n        return this.items.length > 0 ? this.items.pop() : this.instantiator();\n    }\n\n    free(item: T) {\n        if ((item as any).reset) (item as any).reset();\n        this.items.push(item);\n    }\n\n    freeAll(items: ArrayLike<T>) {\n        for (let i = 0; i < items.length; i++) {\n            this.free(items[i]);\n        }\n    }\n\n    clear() {\n        this.items.length = 0;\n    }\n}\n\n/**\n * @public\n */\nexport class Vector2 {\n    constructor(public x = 0, public y = 0) {}\n\n    set(x: number, y: number): Vector2 {\n        this.x = x;\n        this.y = y;\n\n        return this;\n    }\n\n    length() {\n        const x = this.x;\n        const y = this.y;\n\n        return Math.sqrt(x * x + y * y);\n    }\n\n    normalize() {\n        const len = this.length();\n\n        if (len != 0) {\n            this.x /= len;\n            this.y /= len;\n        }\n\n        return this;\n    }\n}\n\n/**\n * @public\n */\nexport class TimeKeeper {\n    maxDelta = 0.064;\n    framesPerSecond = 0;\n    delta = 0;\n    totalTime = 0;\n\n    private lastTime = Date.now() / 1000;\n    private frameCount = 0;\n    private frameTime = 0;\n\n    update() {\n        const now = Date.now() / 1000;\n\n        this.delta = now - this.lastTime;\n        this.frameTime += this.delta;\n        this.totalTime += this.delta;\n        if (this.delta > this.maxDelta) this.delta = this.maxDelta;\n        this.lastTime = now;\n\n        this.frameCount++;\n        if (this.frameTime > 1) {\n            this.framesPerSecond = this.frameCount / this.frameTime;\n            this.frameTime = 0;\n            this.frameCount = 0;\n        }\n    }\n}\n\n/**\n * @public\n */\nexport interface ArrayLike<T> {\n    length: number;\n    [n: number]: T;\n}\n\n/**\n * @public\n */\nexport class WindowedMean {\n    values: Array<number>;\n    addedValues = 0;\n    lastValue = 0;\n    mean = 0;\n    dirty = true;\n\n    constructor(windowSize = 32) {\n        this.values = new Array<number>(windowSize);\n    }\n\n    hasEnoughData() {\n        return this.addedValues >= this.values.length;\n    }\n\n    addValue(value: number) {\n        if (this.addedValues < this.values.length) this.addedValues++;\n        this.values[this.lastValue++] = value;\n        if (this.lastValue > this.values.length - 1) this.lastValue = 0;\n        this.dirty = true;\n    }\n\n    getMean() {\n        if (this.hasEnoughData()) {\n            if (this.dirty) {\n                let mean = 0;\n\n                for (let i = 0; i < this.values.length; i++) {\n                    mean += this.values[i];\n                }\n                this.mean = mean / this.values.length;\n                this.dirty = false;\n            }\n\n            return this.mean;\n        }\n\n        return 0;\n    }\n}\n","import { AttachmentType } from './AttachmentType';\nimport type { ISkeleton, IVertexAttachment } from './ISkeleton';\nimport { NumberArrayLike, Pool, Utils } from './Utils';\n\n/** Collects each visible BoundingBoxAttachment and computes the world vertices for its polygon. The polygon vertices are\n * provided along with convenience methods for doing hit detection.\n * @public\n * */\nexport class SkeletonBoundsBase<BoundingBoxAttachment extends IVertexAttachment> {\n    /** The left edge of the axis aligned bounding box. */\n    minX = 0;\n\n    /** The bottom edge of the axis aligned bounding box. */\n    minY = 0;\n\n    /** The right edge of the axis aligned bounding box. */\n    maxX = 0;\n\n    /** The top edge of the axis aligned bounding box. */\n    maxY = 0;\n\n    /** The visible bounding boxes. */\n    boundingBoxes = new Array<BoundingBoxAttachment>();\n\n    /** The world vertices for the bounding box polygons. */\n    polygons = new Array<NumberArrayLike>();\n\n    private polygonPool = new Pool<NumberArrayLike>(() => Utils.newFloatArray(16));\n\n    /** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding\n     * box's polygon.\n     * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the\n     *           SkeletonBounds AABB methods will always return true. */\n    update(skeleton: ISkeleton, updateAabb: boolean) {\n        if (!skeleton) throw new Error('skeleton cannot be null.');\n        const boundingBoxes = this.boundingBoxes;\n        const polygons = this.polygons;\n        const polygonPool = this.polygonPool;\n        const slots = skeleton.slots;\n        const slotCount = slots.length;\n\n        boundingBoxes.length = 0;\n        polygonPool.freeAll(polygons);\n        polygons.length = 0;\n\n        for (let i = 0; i < slotCount; i++) {\n            const slot = slots[i];\n\n            if (!slot.bone.active) continue;\n            const attachment = slot.getAttachment();\n\n            if (attachment != null && attachment.type === AttachmentType.BoundingBox) {\n                const boundingBox = attachment as BoundingBoxAttachment;\n\n                boundingBoxes.push(boundingBox);\n\n                let polygon = polygonPool.obtain() as NumberArrayLike;\n\n                if (polygon.length != boundingBox.worldVerticesLength) {\n                    polygon = Utils.newFloatArray(boundingBox.worldVerticesLength);\n                }\n                polygons.push(polygon);\n                boundingBox.computeWorldVertices(slot, 0, boundingBox.worldVerticesLength, polygon, 0, 2);\n            }\n        }\n\n        if (updateAabb) {\n            this.aabbCompute();\n        } else {\n            this.minX = Number.POSITIVE_INFINITY;\n            this.minY = Number.POSITIVE_INFINITY;\n            this.maxX = Number.NEGATIVE_INFINITY;\n            this.maxY = Number.NEGATIVE_INFINITY;\n        }\n    }\n\n    aabbCompute() {\n        let minX = Number.POSITIVE_INFINITY;\n        let minY = Number.POSITIVE_INFINITY;\n        let maxX = Number.NEGATIVE_INFINITY;\n        let maxY = Number.NEGATIVE_INFINITY;\n        const polygons = this.polygons;\n\n        for (let i = 0, n = polygons.length; i < n; i++) {\n            const polygon = polygons[i];\n            const vertices = polygon;\n\n            for (let ii = 0, nn = polygon.length; ii < nn; ii += 2) {\n                const x = vertices[ii];\n                const y = vertices[ii + 1];\n\n                minX = Math.min(minX, x);\n                minY = Math.min(minY, y);\n                maxX = Math.max(maxX, x);\n                maxY = Math.max(maxY, y);\n            }\n        }\n        this.minX = minX;\n        this.minY = minY;\n        this.maxX = maxX;\n        this.maxY = maxY;\n    }\n\n    /** Returns true if the axis aligned bounding box contains the point. */\n    aabbContainsPoint(x: number, y: number) {\n        return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;\n    }\n\n    /** Returns true if the axis aligned bounding box intersects the line segment. */\n    aabbIntersectsSegment(x1: number, y1: number, x2: number, y2: number) {\n        const minX = this.minX;\n        const minY = this.minY;\n        const maxX = this.maxX;\n        const maxY = this.maxY;\n\n        if ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY)) {\n            return false;\n        }\n        const m = (y2 - y1) / (x2 - x1);\n        let y = m * (minX - x1) + y1;\n\n        if (y > minY && y < maxY) return true;\n        y = m * (maxX - x1) + y1;\n        if (y > minY && y < maxY) return true;\n        let x = (minY - y1) / m + x1;\n\n        if (x > minX && x < maxX) return true;\n        x = (maxY - y1) / m + x1;\n        if (x > minX && x < maxX) return true;\n\n        return false;\n    }\n\n    /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */\n    aabbIntersectsSkeleton(bounds: SkeletonBoundsBase<BoundingBoxAttachment>) {\n        return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;\n    }\n\n    /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more\n     * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true.\n     * Cannot be done here because BoundingBoxAttachment is not a thing yet*/\n    containsPoint(x: number, y: number): BoundingBoxAttachment | null {\n        const polygons = this.polygons;\n\n        for (let i = 0, n = polygons.length; i < n; i++) {\n            if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];\n        }\n\n        return null;\n    }\n\n    /** Returns true if the polygon contains the point. */\n    containsPointPolygon(polygon: NumberArrayLike, x: number, y: number) {\n        const vertices = polygon;\n        const nn = polygon.length;\n\n        let prevIndex = nn - 2;\n        let inside = false;\n\n        for (let ii = 0; ii < nn; ii += 2) {\n            const vertexY = vertices[ii + 1];\n            const prevY = vertices[prevIndex + 1];\n\n            if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) {\n                const vertexX = vertices[ii];\n\n                if (vertexX + ((y - vertexY) / (prevY - vertexY)) * (vertices[prevIndex] - vertexX) < x) inside = !inside;\n            }\n            prevIndex = ii;\n        }\n\n        return inside;\n    }\n\n    /** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it\n     * is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns\n     * true. */\n    intersectsSegment(x1: number, y1: number, x2: number, y2: number) {\n        const polygons = this.polygons;\n\n        for (let i = 0, n = polygons.length; i < n; i++) {\n            if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];\n        }\n\n        return null;\n    }\n\n    /** Returns true if the polygon contains any part of the line segment. */\n    intersectsSegmentPolygon(polygon: NumberArrayLike, x1: number, y1: number, x2: number, y2: number) {\n        const vertices = polygon;\n        const nn = polygon.length;\n\n        const width12 = x1 - x2;\n        const height12 = y1 - y2;\n        const det1 = x1 * y2 - y1 * x2;\n        let x3 = vertices[nn - 2];\n        let y3 = vertices[nn - 1];\n\n        for (let ii = 0; ii < nn; ii += 2) {\n            const x4 = vertices[ii];\n            const y4 = vertices[ii + 1];\n            const det2 = x3 * y4 - y3 * x4;\n            const width34 = x3 - x4;\n            const height34 = y3 - y4;\n            const det3 = width12 * height34 - height12 * width34;\n            const x = (det1 * width34 - width12 * det2) / det3;\n\n            if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) {\n                const y = (det1 * height34 - height12 * det2) / det3;\n\n                if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return true;\n            }\n            x3 = x4;\n            y3 = y4;\n        }\n\n        return false;\n    }\n\n    /** Returns the polygon for the specified bounding box, or null. */\n    getPolygon(boundingBox: BoundingBoxAttachment) {\n        if (!boundingBox) throw new Error('boundingBox cannot be null.');\n        const index = this.boundingBoxes.indexOf(boundingBox);\n\n        return index == -1 ? null : this.polygons[index];\n    }\n\n    /** The width of the axis aligned bounding box. */\n    getWidth() {\n        return this.maxX - this.minX;\n    }\n\n    /** The height of the axis aligned bounding box. */\n    getHeight() {\n        return this.maxY - this.minY;\n    }\n}\n","/**\n * @public\n */\nexport const settings = {\n    yDown: true,\n    /**\n     * pixi-spine gives option to not fail at certain parsing errors\n     * spine-ts fails here\n     */\n    FAIL_ON_NON_EXISTING_SKIN: false,\n\n    /**\n     * past Spine.globalAutoUpdate\n     */\n    GLOBAL_AUTO_UPDATE: true,\n\n    /**\n     * past Spine.globalDelayLimit\n     */\n    GLOBAL_DELAY_LIMIT: 0,\n    /**\n     * shows error in console if atlas page loading somehow failed\n     */\n    REPORT_TEXTURE_LOADER_ERROR: true,\n};\n","import { AttachmentType } from './core/AttachmentType';\nimport { TextureRegion } from './core/TextureRegion';\nimport { MathUtils } from './core/Utils';\nimport type { IAnimationState, IAnimationStateData } from './core/IAnimation';\nimport type { IAttachment, IClippingAttachment, IMeshAttachment, IRegionAttachment, ISkeleton, ISkeletonData, ISlot, IVertexAttachment } from './core/ISkeleton';\nimport { DRAW_MODES, Rectangle, Polygon, Transform, Texture, utils } from '@pixi/core';\nimport { Container, DisplayObject } from '@pixi/display';\nimport { Sprite } from '@pixi/sprite';\nimport { SimpleMesh } from '@pixi/mesh-extras';\nimport { Graphics } from '@pixi/graphics';\nimport { settings } from './settings';\nimport type { ISpineDebugRenderer } from './SpineDebugRenderer';\n\nconst tempRgb = [0, 0, 0];\n\n/**\n * @public\n */\nexport interface ISpineDisplayObject extends DisplayObject {\n    region?: TextureRegion;\n    attachment?: IAttachment;\n}\n\n/**\n * @public\n */\nexport class SpineSprite extends Sprite implements ISpineDisplayObject {\n    region?: TextureRegion = null;\n    attachment?: IAttachment = null;\n}\n\n/**\n * @public\n */\nexport class SpineMesh extends SimpleMesh implements ISpineDisplayObject {\n    region?: TextureRegion = null;\n    attachment?: IAttachment = null;\n\n    constructor(texture: Texture, vertices?: Float32Array, uvs?: Float32Array, indices?: Uint16Array, drawMode?: number) {\n        super(texture, vertices, uvs, indices, drawMode);\n    }\n}\n\n/**\n * A class that enables the you to import and run your spine animations in pixi.\n * The Spine animation data needs to be loaded using either the Loader or a SpineLoader before it can be used by this class\n * See example 12 (http://www.goodboydigital.com/pixijs/examples/12/) to see a working example and check out the source\n *\n * ```js\n * let spineAnimation = new spine(spineData);\n * ```\n *\n * @public\n * @class\n * @extends Container\n * @memberof spine\n * @param spineData {object} The spine data loaded from a spine atlas.\n */\nexport abstract class SpineBase<\n        Skeleton extends ISkeleton,\n        SkeletonData extends ISkeletonData,\n        AnimationState extends IAnimationState,\n        AnimationStateData extends IAnimationStateData\n    >\n    extends Container\n    implements GlobalMixins.Spine\n{\n    tintRgb: ArrayLike<number>;\n    spineData: SkeletonData;\n    skeleton: Skeleton;\n    stateData: AnimationStateData;\n    state: AnimationState;\n    slotContainers: Array<Container>;\n    tempClipContainers: Array<Container>;\n    localDelayLimit: number;\n    private _autoUpdate: boolean;\n    protected _visible: boolean;\n    private _debug: ISpineDebugRenderer;\n    public get debug(): ISpineDebugRenderer {\n        return this._debug;\n    }\n    public set debug(value: ISpineDebugRenderer) {\n        if (value == this._debug) {\n            // soft equality allows null == undefined\n            return;\n        }\n        this._debug?.unregisterSpine(this);\n        value?.registerSpine(this);\n        this._debug = value;\n    }\n\n    abstract createSkeleton(spineData: ISkeletonData);\n\n    constructor(spineData: SkeletonData) {\n        super();\n\n        if (!spineData) {\n            throw new Error('The spineData param is required.');\n        }\n\n        if (typeof spineData === 'string') {\n            throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas(\"YOUR_RESOURCE_NAME\") from now on.');\n        }\n\n        /**\n         * The spineData object\n         *\n         * @member {object}\n         */\n        this.spineData = spineData;\n\n        /**\n         * A spine Skeleton object\n         *\n         * @member {object}\n         */\n        this.createSkeleton(spineData);\n\n        /**\n         * An array of containers\n         *\n         * @member {Container[]}\n         */\n        this.slotContainers = [];\n\n        this.tempClipContainers = [];\n\n        for (let i = 0, n = this.skeleton.slots.length; i < n; i++) {\n            const slot = this.skeleton.slots[i];\n            const attachment: any = slot.getAttachment();\n            const slotContainer = this.newContainer();\n\n            this.slotContainers.push(slotContainer);\n            this.addChild(slotContainer);\n            this.tempClipContainers.push(null);\n\n            if (!attachment) {\n                continue;\n            }\n            if (attachment.type === AttachmentType.Region) {\n                const spriteName = attachment.name;\n                const sprite = this.createSprite(slot, attachment as IRegionAttachment, spriteName);\n\n                slot.currentSprite = sprite;\n                slot.currentSpriteName = spriteName;\n                slotContainer.addChild(sprite);\n            } else if (attachment.type === AttachmentType.Mesh) {\n                const mesh = this.createMesh(slot, attachment);\n\n                slot.currentMesh = mesh;\n                slot.currentMeshId = attachment.id;\n                slot.currentMeshName = attachment.name;\n                slotContainer.addChild(mesh);\n            } else if (attachment.type === AttachmentType.Clipping) {\n                this.createGraphics(slot, attachment);\n                slotContainer.addChild(slot.clippingContainer);\n                slotContainer.addChild(slot.currentGraphics);\n            }\n        }\n\n        /**\n         * The tint applied to all spine slots. This is a [r,g,b] value. A value of [1,1,1] will remove any tint effect.\n         *\n         * @member {number}\n         * @memberof spine.Spine#\n         */\n        this.tintRgb = new Float32Array([1, 1, 1]);\n\n        this.autoUpdate = true;\n        this.visible = true;\n    }\n\n    /**\n     * If this flag is set to true, the spine animation will be automatically updated every\n     * time the object id drawn. The down side of this approach is that the delta time is\n     * automatically calculated and you could miss out on cool effects like slow motion,\n     * pause, skip ahead and the sorts. Most of these effects can be achieved even with\n     * autoUpdate enabled but are harder to achieve.\n     *\n     * @member {boolean}\n     * @memberof spine.Spine#\n     * @default true\n     */\n    get autoUpdate(): boolean {\n        return this._autoUpdate;\n    }\n\n    set autoUpdate(value: boolean) {\n        if (value !== this._autoUpdate) {\n            this._autoUpdate = value;\n            this.updateTransform = value ? SpineBase.prototype.autoUpdateTransform : Container.prototype.updateTransform;\n        }\n    }\n\n    /**\n     * The tint applied to the spine object. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n     *\n     * @member {number}\n     * @memberof spine.Spine#\n     * @default 0xFFFFFF\n     */\n    get tint(): number {\n        return utils.rgb2hex(this.tintRgb as any);\n    }\n\n    set tint(value: number) {\n        this.tintRgb = utils.hex2rgb(value, this.tintRgb as any);\n    }\n\n    /**\n     * Limit value for the update dt with Spine.globalDelayLimit\n     * that can be overridden with localDelayLimit\n     * @return {number} - Maximum processed dt value for the update\n     */\n    get delayLimit(): number {\n        const limit = typeof this.localDelayLimit !== 'undefined' ? this.localDelayLimit : settings.GLOBAL_DELAY_LIMIT;\n\n        // If limit is 0, this means there is no limit for the delay\n        return limit || Number.MAX_VALUE;\n    }\n\n    /**\n     * Update the spine skeleton and its animations by delta time (dt)\n     *\n     * @param dt {number} Delta time. Time by which the animation should be updated\n     */\n    update(dt: number) {\n        // Limit delta value to avoid animation jumps\n        const delayLimit = this.delayLimit;\n\n        if (dt > delayLimit) dt = delayLimit;\n\n        this.state.update(dt);\n        this.state.apply(this.skeleton);\n\n        // check we haven't been destroyed via a spine event callback in state update\n        if (!this.skeleton) {\n            return;\n        }\n\n        this.skeleton.updateWorldTransform();\n\n        const slots = this.skeleton.slots;\n\n        // in case pixi has double tint\n        const globalClr = (this as any).color;\n        let light: ArrayLike<number> = null;\n        let dark: ArrayLike<number> = null;\n\n        if (globalClr) {\n            light = globalClr.light;\n            dark = globalClr.dark;\n        } else {\n            light = this.tintRgb;\n        }\n\n        // let thack = false;\n\n        for (let i = 0, n = slots.length; i < n; i++) {\n            const slot = slots[i];\n            const attachment = slot.getAttachment();\n            const slotContainer = this.slotContainers[i];\n\n            if (!attachment) {\n                slotContainer.visible = false;\n                continue;\n            }\n\n            let spriteColor: any = null;\n\n            if (attachment.sequence) {\n                attachment.sequence.apply(slot, attachment as any);\n            }\n            let region = (attachment as IRegionAttachment).region;\n\n            const attColor = (attachment as any).color;\n\n            switch (attachment != null && attachment.type) {\n                case AttachmentType.Region:\n                    const transform = slotContainer.transform;\n\n                    transform.setFromMatrix(slot.bone.matrix);\n\n                    region = (attachment as IRegionAttachment).region;\n                    if (slot.currentMesh) {\n                        slot.currentMesh.visible = false;\n                        slot.currentMesh = null;\n                        slot.currentMeshId = undefined;\n                        slot.currentMeshName = undefined;\n                    }\n                    if (!region) {\n                        if (slot.currentSprite) {\n                            slot.currentSprite.renderable = false;\n                        }\n                        break;\n                    }\n                    if (!slot.currentSpriteName || slot.currentSpriteName !== attachment.name) {\n                        const spriteName = attachment.name;\n\n                        if (slot.currentSprite) {\n                            slot.currentSprite.visible = false;\n                        }\n                        slot.sprites = slot.sprites || {};\n                        if (slot.sprites[spriteName] !== undefined) {\n                            slot.sprites[spriteName].visible = true;\n                        } else {\n                            const sprite = this.createSprite(slot, attachment as IRegionAttachment, spriteName);\n\n                            slotContainer.addChild(sprite);\n                        }\n                        slot.currentSprite = slot.sprites[spriteName];\n                        slot.currentSpriteName = spriteName;\n\n                        // force sprite update when attachment name is same.\n                        // issues https://github.com/pixijs/pixi-spine/issues/318\n                    }\n                    slot.currentSprite.renderable = true;\n                    if (!slot.hackRegion) {\n                        this.setSpriteRegion(attachment as IRegionAttachment, slot.currentSprite, region);\n                    }\n                    if (slot.currentSprite.color) {\n                        // YAY! double - tint!\n                        spriteColor = slot.currentSprite.color;\n                    } else {\n                        tempRgb[0] = light[0] * slot.color.r * attColor.r;\n                        tempRgb[1] = light[1] * slot.color.g * attColor.g;\n                        tempRgb[2] = light[2] * slot.color.b * attColor.b;\n                        slot.currentSprite.tint = utils.rgb2hex(tempRgb);\n                    }\n                    slot.currentSprite.blendMode = slot.blendMode;\n                    break;\n\n                case AttachmentType.Mesh:\n                    if (slot.currentSprite) {\n                        // TODO: refactor this thing, switch it on and off for container\n                        slot.currentSprite.visible = false;\n                        slot.currentSprite = null;\n                        slot.currentSpriteName = undefined;\n\n                        // TODO: refactor this shit\n                        const transform = new Transform();\n\n                        (transform as any)._parentID = -1;\n                        (transform as any)._worldID = (slotContainer.transform as any)._worldID;\n                        slotContainer.transform = transform;\n                    }\n                    if (!region) {\n                        if (slot.currentMesh) {\n                            slot.currentMesh.renderable = false;\n                        }\n                        break;\n                    }\n\n                    const id = (attachment as IVertexAttachment).id;\n\n                    if (slot.currentMeshId === undefined || slot.currentMeshId !== id) {\n                        const meshId = id;\n\n                        if (slot.currentMesh) {\n                            slot.currentMesh.visible = false;\n                        }\n\n                        slot.meshes = slot.meshes || {};\n\n                        if (slot.meshes[meshId] !== undefined) {\n                            slot.meshes[meshId].visible = true;\n                        } else {\n                            const mesh = this.createMesh(slot, attachment as IMeshAttachment);\n\n                            slotContainer.addChild(mesh);\n                        }\n\n                        slot.currentMesh = slot.meshes[meshId];\n                        slot.currentMeshName = attachment.name;\n                        slot.currentMeshId = meshId;\n                    }\n                    slot.currentMesh.renderable = true;\n                    (attachment as IVertexAttachment).computeWorldVerticesOld(slot, slot.currentMesh.vertices);\n                    if (slot.currentMesh.color) {\n                        // pixi-heaven\n                        spriteColor = slot.currentMesh.color;\n                    } else {\n                        tempRgb[0] = light[0] * slot.color.r * attColor.r;\n                        tempRgb[1] = light[1] * slot.color.g * attColor.g;\n                        tempRgb[2] = light[2] * slot.color.b * attColor.b;\n                        slot.currentMesh.tint = utils.rgb2hex(tempRgb);\n                    }\n                    slot.currentMesh.blendMode = slot.blendMode;\n                    if (!slot.hackRegion) {\n                        this.setMeshRegion(attachment as IMeshAttachment, slot.currentMesh, region);\n                    }\n                    break;\n                case AttachmentType.Clipping:\n                    if (!slot.currentGraphics) {\n                        this.createGraphics(slot, attachment as IClippingAttachment);\n                        slotContainer.addChild(slot.clippingContainer);\n                        slotContainer.addChild(slot.currentGraphics);\n                    }\n                    this.updateGraphics(slot, attachment as IClippingAttachment);\n                    slotContainer.alpha = 1.0;\n                    slotContainer.visible = true;\n                    continue;\n                default:\n                    slotContainer.visible = false;\n                    continue;\n            }\n            slotContainer.visible = true;\n\n            // pixi has double tint\n            if (spriteColor) {\n                let r0 = slot.color.r * attColor.r;\n                let g0 = slot.color.g * attColor.g;\n                let b0 = slot.color.b * attColor.b;\n\n                // YAY! double-tint!\n                spriteColor.setLight(light[0] * r0 + dark[0] * (1.0 - r0), light[1] * g0 + dark[1] * (1.0 - g0), light[2] * b0 + dark[2] * (1.0 - b0));\n                if (slot.darkColor) {\n                    r0 = slot.darkColor.r;\n                    g0 = slot.darkColor.g;\n                    b0 = slot.darkColor.b;\n                } else {\n                    r0 = 0.0;\n                    g0 = 0.0;\n                    b0 = 0.0;\n                }\n                spriteColor.setDark(light[0] * r0 + dark[0] * (1 - r0), light[1] * g0 + dark[1] * (1 - g0), light[2] * b0 + dark[2] * (1 - b0));\n            }\n\n            slotContainer.alpha = slot.color.a;\n        }\n\n        // == this is clipping implementation ===\n        // TODO: remove parent hacks when pixi masks allow it\n        const drawOrder = this.skeleton.drawOrder;\n        let clippingAttachment: IClippingAttachment = null;\n        let clippingContainer: Container = null;\n\n        for (let i = 0, n = drawOrder.length; i < n; i++) {\n            const slot = slots[drawOrder[i].data.index];\n            const slotContainer = this.slotContainers[drawOrder[i].data.index];\n\n            if (!clippingContainer) {\n                // Adding null check as it is possible for slotContainer.parent to be null in the event of a spine being disposed off in its loop callback\n                if (slotContainer.parent !== null && slotContainer.parent !== this) {\n                    slotContainer.parent.removeChild(slotContainer);\n                    // silend add hack\n                    (slotContainer as any).parent = this;\n                }\n            }\n            if (slot.currentGraphics && slot.getAttachment()) {\n                clippingContainer = slot.clippingContainer;\n                clippingAttachment = slot.getAttachment() as IClippingAttachment;\n                clippingContainer.children.length = 0;\n                this.children[i] = slotContainer;\n\n                if (clippingAttachment.endSlot === slot.data) {\n                    clippingAttachment.endSlot = null;\n                }\n            } else if (clippingContainer) {\n                let c = this.tempClipContainers[i];\n\n                if (!c) {\n                    c = this.tempClipContainers[i] = this.newContainer();\n                    c.visible = false;\n                }\n                this.children[i] = c;\n\n                // silent remove hack\n                (slotContainer as any).parent = null;\n                clippingContainer.addChild(slotContainer);\n                if (clippingAttachment.endSlot == slot.data) {\n                    clippingContainer.renderable = true;\n                    clippingContainer = null;\n                    clippingAttachment = null;\n                }\n            } else {\n                this.children[i] = slotContainer;\n            }\n        }\n\n        // if you can debug, then debug!\n        this._debug?.renderDebug(this);\n    }\n\n    private setSpriteRegion(attachment: IRegionAttachment, sprite: SpineSprite, region: TextureRegion) {\n        // prevent setters calling when attachment and region is same\n        if (sprite.attachment === attachment && sprite.region === region) {\n            return;\n        }\n\n        sprite.region = region;\n        sprite.attachment = attachment;\n\n        sprite.texture = region.texture;\n        sprite.rotation = attachment.rotation * MathUtils.degRad;\n        sprite.position.x = attachment.x;\n        sprite.position.y = attachment.y;\n        sprite.alpha = attachment.color.a;\n\n        if (!region.size) {\n            sprite.scale.x = (attachment.scaleX * attachment.width) / region.originalWidth;\n            sprite.scale.y = (-attachment.scaleY * attachment.height) / region.originalHeight;\n        } else {\n            // hacked!\n            sprite.scale.x = region.size.width / region.originalWidth;\n            sprite.scale.y = -region.size.height / region.originalHeight;\n        }\n    }\n\n    private setMeshRegion(attachment: IMeshAttachment, mesh: SpineMesh, region: TextureRegion) {\n        if (mesh.attachment === attachment && mesh.region === region) {\n            return;\n        }\n\n        mesh.region = region;\n        mesh.attachment = attachment;\n        mesh.texture = region.texture;\n        region.texture.updateUvs();\n        mesh.uvBuffer.update(attachment.regionUVs);\n    }\n\n    protected lastTime: number;\n\n    /**\n     * When autoupdate is set to yes this function is used as pixi's updateTransform function\n     *\n     * @private\n     */\n    autoUpdateTransform() {\n        if (settings.GLOBAL_AUTO_UPDATE) {\n            this.lastTime = this.lastTime || Date.now();\n            const timeDelta = (Date.now() - this.lastTime) * 0.001;\n\n            this.lastTime = Date.now();\n            this.update(timeDelta);\n        } else {\n            this.lastTime = 0;\n        }\n\n        Container.prototype.updateTransform.call(this);\n    }\n\n    /**\n     * Create a new sprite to be used with core.RegionAttachment\n     *\n     * @param slot {spine.Slot} The slot to which the attachment is parented\n     * @param attachment {spine.RegionAttachment} The attachment that the sprite will represent\n     * @private\n     */\n    createSprite(slot: ISlot, attachment: IRegionAttachment, defName: string) {\n        let region = attachment.region;\n\n        if (slot.hackAttachment === attachment) {\n            region = slot.hackRegion;\n        }\n        const texture = region ? region.texture : null;\n        const sprite = this.newSprite(texture);\n\n        sprite.anchor.set(0.5);\n        if (region) {\n            this.setSpriteRegion(attachment, sprite, attachment.region);\n        }\n\n        slot.sprites = slot.sprites || {};\n        slot.sprites[defName] = sprite;\n\n        return sprite;\n    }\n\n    /**\n     * Creates a Strip from the spine data\n     * @param slot {spine.Slot} The slot to which the attachment is parented\n     * @param attachment {spine.RegionAttachment} The attachment that the sprite will represent\n     * @private\n     */\n    createMesh(slot: ISlot, attachment: IMeshAttachment) {\n        if (!attachment.region && attachment.sequence) {\n            attachment.sequence.apply(slot, attachment as any);\n        }\n        let region = attachment.region;\n\n        if (slot.hackAttachment === attachment) {\n            region = slot.hackRegion;\n            slot.hackAttachment = null;\n            slot.hackRegion = null;\n        }\n        const strip = this.newMesh(\n            region ? region.texture : null,\n            new Float32Array(attachment.regionUVs.length),\n            attachment.regionUVs,\n            new Uint16Array(attachment.triangles),\n            DRAW_MODES.TRIANGLES\n        );\n\n        if (typeof (strip as any)._canvasPadding !== 'undefined') {\n            (strip as any)._canvasPadding = 1.5;\n        }\n\n        strip.alpha = attachment.color.a;\n\n        strip.region = attachment.region;\n        if (region) {\n            this.setMeshRegion(attachment, strip, region);\n        }\n\n        slot.meshes = slot.meshes || {};\n        slot.meshes[attachment.id] = strip;\n\n        return strip;\n    }\n\n    static clippingPolygon: Array<number> = [];\n\n    // @ts-ignore\n    createGraphics(slot: ISlot, clip: IClippingAttachment) {\n        const graphics = this.newGraphics();\n        const poly = new Polygon([]);\n\n        graphics.clear();\n        graphics.beginFill(0xffffff, 1);\n        graphics.drawPolygon(poly as any);\n        graphics.renderable = false;\n        slot.currentGraphics = graphics;\n        slot.clippingContainer = this.newContainer();\n        slot.clippingContainer.mask = slot.currentGraphics;\n\n        return graphics;\n    }\n\n    updateGraphics(slot: ISlot, clip: IClippingAttachment) {\n        const geom = slot.currentGraphics.geometry;\n        const vertices = (geom.graphicsData[0].shape as Polygon).points;\n        const n = clip.worldVerticesLength;\n\n        vertices.length = n;\n        clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);\n        geom.invalidate();\n    }\n\n    /**\n     * Changes texture in attachment in specific slot.\n     *\n     * PIXI runtime feature, it was made to satisfy our users.\n     *\n     * @param slotIndex {number}\n     * @param [texture = null] {PIXI.Texture} If null, take default (original) texture\n     * @param [size = null] {PIXI.Point} sometimes we need new size for region attachment, you can pass 'texture.orig' there\n     * @returns {boolean} Success flag\n     */\n    hackTextureBySlotIndex(slotIndex: number, texture: Texture = null, size: Rectangle = null) {\n        const slot = this.skeleton.slots[slotIndex];\n\n        if (!slot) {\n            return false;\n        }\n        const attachment: any = slot.getAttachment();\n        let region: TextureRegion = attachment.region;\n\n        if (texture) {\n            region = new TextureRegion();\n            region.texture = texture;\n            region.size = size;\n            slot.hackRegion = region;\n            slot.hackAttachment = attachment;\n        } else {\n            slot.hackRegion = null;\n            slot.hackAttachment = null;\n        }\n        if (slot.currentSprite) {\n            this.setSpriteRegion(attachment, slot.currentSprite, region);\n        } else if (slot.currentMesh) {\n            this.setMeshRegion(attachment, slot.currentMesh, region);\n        }\n\n        return true;\n    }\n\n    /**\n     * Changes texture in attachment in specific slot.\n     *\n     * PIXI runtime feature, it was made to satisfy our users.\n     *\n     * @param slotName {string}\n     * @param [texture = null] {PIXI.Texture} If null, take default (original) texture\n     * @param [size = null] {PIXI.Point} sometimes we need new size for region attachment, you can pass 'texture.orig' there\n     * @returns {boolean} Success flag\n     */\n    hackTextureBySlotName(slotName: string, texture: Texture = null, size: Rectangle = null) {\n        const index = this.skeleton.findSlotIndex(slotName);\n\n        if (index == -1) {\n            return false;\n        }\n\n        return this.hackTextureBySlotIndex(index, texture, size);\n    }\n\n    /**\n     * Changes texture of an attachment\n     *\n     * PIXI runtime feature, it was made to satisfy our users.\n     *\n     * @param slotName {string}\n     * @param attachmentName {string}\n     * @param [texture = null] {PIXI.Texture} If null, take default (original) texture\n     * @param [size = null] {PIXI.Point} sometimes we need new size for region attachment, you can pass 'texture.orig' there\n     * @returns {boolean} Success flag\n     */\n    hackTextureAttachment(slotName: string, attachmentName: string, texture, size: Rectangle = null) {\n        // changes the texture of an attachment at the skeleton level\n        const slotIndex = this.skeleton.findSlotIndex(slotName);\n        const attachment: any = this.skeleton.getAttachmentByName(slotName, attachmentName);\n\n        attachment.region.texture = texture;\n\n        const slot = this.skeleton.slots[slotIndex];\n\n        if (!slot) {\n            return false;\n        }\n\n        // gets the currently active attachment in this slot\n        const currentAttachment: any = slot.getAttachment();\n\n        if (attachmentName === currentAttachment.name) {\n            // if the attachment we are changing is currently active, change the the live texture\n            let region: TextureRegion = attachment.region;\n\n            if (texture) {\n                region = new TextureRegion();\n                region.texture = texture;\n                region.size = size;\n                slot.hackRegion = region;\n                slot.hackAttachment = currentAttachment;\n            } else {\n                slot.hackRegion = null;\n                slot.hackAttachment = null;\n            }\n            if (slot.currentSprite && slot.currentSprite.region != region) {\n                this.setSpriteRegion(currentAttachment, slot.currentSprite, region);\n                slot.currentSprite.region = region;\n            } else if (slot.currentMesh && slot.currentMesh.region != region) {\n                this.setMeshRegion(currentAttachment, slot.currentMesh, region);\n            }\n\n            return true;\n        }\n\n        return false;\n    }\n\n    // those methods can be overriden to spawn different classes\n    newContainer() {\n        return new Container();\n    }\n\n    newSprite(tex: Texture) {\n        return new SpineSprite(tex);\n    }\n\n    newGraphics() {\n        return new Graphics();\n    }\n\n    newMesh(texture: Texture, vertices?: Float32Array, uvs?: Float32Array, indices?: Uint16Array, drawMode?: number) {\n        return new SpineMesh(texture, vertices, uvs, indices, drawMode);\n    }\n\n    transformHack() {\n        return 1;\n    }\n\n    /**\n     * Hack for pixi-display and pixi-lights. Every attachment name ending with a suffix will be added to different layer\n     * @param nameSuffix\n     * @param group\n     * @param outGroup\n     */\n    hackAttachmentGroups(nameSuffix: string, group: any, outGroup: any) {\n        if (!nameSuffix) {\n            return undefined;\n        }\n        const list_d = [];\n        const list_n = [];\n\n        for (let i = 0, len = this.skeleton.slots.length; i < len; i++) {\n            const slot = this.skeleton.slots[i];\n            const name = slot.currentSpriteName || slot.currentMeshName || '';\n            const target = slot.currentSprite || slot.currentMesh;\n\n            if (name.endsWith(nameSuffix)) {\n                target.parentGroup = group;\n                list_n.push(target);\n            } else if (outGroup && target) {\n                target.parentGroup = outGroup;\n                list_d.push(target);\n            }\n        }\n\n        return [list_d, list_n];\n    }\n\n    destroy(options?: any): void {\n        this.debug = null; // setter will do the cleanup\n\n        for (let i = 0, n = this.skeleton.slots.length; i < n; i++) {\n            const slot = this.skeleton.slots[i];\n\n            for (const name in slot.meshes) {\n                slot.meshes[name].destroy(options);\n            }\n            slot.meshes = null;\n\n            for (const name in slot.sprites) {\n                slot.sprites[name].destroy(options);\n            }\n            slot.sprites = null;\n        }\n\n        for (let i = 0, n = this.slotContainers.length; i < n; i++) {\n            this.slotContainers[i].destroy(options);\n        }\n        this.spineData = null;\n        this.skeleton = null;\n        this.slotContainers = null;\n        this.stateData = null;\n        this.state = null;\n        this.tempClipContainers = null;\n\n        super.destroy(options);\n    }\n}\n\n/**\n * The visibility of the spine object. If false the object will not be drawn,\n * the updateTransform function will not be called, and the spine will not be automatically updated.\n *\n * @member {boolean}\n * @memberof spine.Spine#\n * @default true\n */\nObject.defineProperty(SpineBase.prototype, 'visible', {\n    get() {\n        return this._visible;\n    },\n    set(value: boolean) {\n        if (value !== this._visible) {\n            this._visible = value;\n            if (value) {\n                this.lastTime = 0;\n            }\n        }\n    },\n});\n","import { Container } from '@pixi/display';\nimport { Graphics } from '@pixi/graphics';\nimport type { IAnimationState, IAnimationStateData } from './core/IAnimation';\nimport type { IClippingAttachment, IMeshAttachment, IRegionAttachment, ISkeleton, ISkeletonData, IVertexAttachment } from './core/ISkeleton';\nimport type { SpineBase } from './SpineBase';\nimport { AttachmentType } from './core/AttachmentType';\nimport { SkeletonBoundsBase } from './core/SkeletonBoundsBase';\n\n/**\n * Make a class that extends from this interface to create your own debug renderer.\n * @public\n */\nexport interface ISpineDebugRenderer {\n    /**\n     * This will be called every frame, after the spine has been updated.\n     */\n    renderDebug(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>): void;\n\n    /**\n     *  This is called when the `spine.debug` object is set to null or when the spine is destroyed.\n     */\n    unregisterSpine(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>): void;\n\n    /**\n     * This is called when the `spine.debug` object is set to a new instance of a debug renderer.\n     */\n    registerSpine(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>): void;\n}\n\ntype DebugDisplayObjects = {\n    bones: Container;\n    skeletonXY: Graphics;\n    regionAttachmentsShape: Graphics;\n    meshTrianglesLine: Graphics;\n    meshHullLine: Graphics;\n    clippingPolygon: Graphics;\n    boundingBoxesRect: Graphics;\n    boundingBoxesCircle: Graphics;\n    boundingBoxesPolygon: Graphics;\n    pathsCurve: Graphics;\n    pathsLine: Graphics;\n    parentDebugContainer: Container;\n};\n\n/**\n * This is a debug renderer that uses PixiJS Graphics under the hood.\n * @public\n */\nexport class SpineDebugRenderer implements ISpineDebugRenderer {\n    private registeredSpines: Map<SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>, DebugDisplayObjects> = new Map();\n\n    public drawDebug = true;\n    public drawMeshHull = true;\n    public drawMeshTriangles = true;\n    public drawBones = true;\n    public drawPaths = true;\n    public drawBoundingBoxes = true;\n    public drawClipping = true;\n    public drawRegionAttachments = true;\n\n    public lineWidth = 1;\n    public regionAttachmentsColor = 0x0078ff;\n    public meshHullColor = 0x0078ff;\n    public meshTrianglesColor = 0xffcc00;\n    public clippingPolygonColor = 0xff00ff;\n    public boundingBoxesRectColor = 0x00ff00;\n    public boundingBoxesPolygonColor = 0x00ff00;\n    public boundingBoxesCircleColor = 0x00ff00;\n    public pathsCurveColor = 0xff0000;\n    public pathsLineColor = 0xff00ff;\n    public skeletonXYColor = 0xff0000;\n    public bonesColor = 0x00eecc;\n\n    /**\n     * The debug is attached by force to each spine object. So we need to create it inside the spine when we get the first update\n     */\n    public registerSpine(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>) {\n        if (this.registeredSpines.has(spine)) {\n            console.warn('SpineDebugRenderer.registerSpine() - this spine is already registered!', spine);\n        }\n        const debugDisplayObjects = {\n            parentDebugContainer: new Container(),\n            bones: new Container(),\n            skeletonXY: new Graphics(),\n            regionAttachmentsShape: new Graphics(),\n            meshTrianglesLine: new Graphics(),\n            meshHullLine: new Graphics(),\n            clippingPolygon: new Graphics(),\n            boundingBoxesRect: new Graphics(),\n            boundingBoxesCircle: new Graphics(),\n            boundingBoxesPolygon: new Graphics(),\n            pathsCurve: new Graphics(),\n            pathsLine: new Graphics(),\n        };\n\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.bones);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.skeletonXY);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.regionAttachmentsShape);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.meshTrianglesLine);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.meshHullLine);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.clippingPolygon);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.boundingBoxesRect);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.boundingBoxesCircle);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.boundingBoxesPolygon);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.pathsCurve);\n        debugDisplayObjects.parentDebugContainer.addChild(debugDisplayObjects.pathsLine);\n\n        spine.addChild(debugDisplayObjects.parentDebugContainer);\n\n        this.registeredSpines.set(spine, debugDisplayObjects);\n    }\n    public renderDebug(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>): void {\n        if (!this.registeredSpines.has(spine)) {\n            // This should never happen. Spines are registered when you assign spine.debug\n            this.registerSpine(spine);\n        }\n\n        const debugDisplayObjects = this.registeredSpines.get(spine);\n\n        debugDisplayObjects.skeletonXY.clear();\n        debugDisplayObjects.regionAttachmentsShape.clear();\n        debugDisplayObjects.meshTrianglesLine.clear();\n        debugDisplayObjects.meshHullLine.clear();\n        debugDisplayObjects.clippingPolygon.clear();\n        debugDisplayObjects.boundingBoxesRect.clear();\n        debugDisplayObjects.boundingBoxesCircle.clear();\n        debugDisplayObjects.boundingBoxesPolygon.clear();\n        debugDisplayObjects.pathsCurve.clear();\n        debugDisplayObjects.pathsLine.clear();\n\n        for (let len = debugDisplayObjects.bones.children.length; len > 0; len--) {\n            debugDisplayObjects.bones.children[len - 1].destroy({ children: true, texture: true, baseTexture: true });\n        }\n\n        const scale = spine.scale.x || spine.scale.y || 1;\n        const lineWidth = this.lineWidth / scale;\n\n        if (this.drawBones) {\n            this.drawBonesFunc(spine, debugDisplayObjects, lineWidth, scale);\n        }\n\n        if (this.drawPaths) {\n            this.drawPathsFunc(spine, debugDisplayObjects, lineWidth);\n        }\n\n        if (this.drawBoundingBoxes) {\n            this.drawBoundingBoxesFunc(spine, debugDisplayObjects, lineWidth);\n        }\n\n        if (this.drawClipping) {\n            this.drawClippingFunc(spine, debugDisplayObjects, lineWidth);\n        }\n\n        if (this.drawMeshHull || this.drawMeshTriangles) {\n            this.drawMeshHullAndMeshTriangles(spine, debugDisplayObjects, lineWidth);\n        }\n\n        if (this.drawRegionAttachments) {\n            this.drawRegionAttachmentsFunc(spine, debugDisplayObjects, lineWidth);\n        }\n    }\n\n    private drawBonesFunc(\n        spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>,\n        debugDisplayObjects: DebugDisplayObjects,\n        lineWidth: number,\n        scale: number\n    ): void {\n        const skeleton = spine.skeleton;\n        const skeletonX = skeleton.x;\n        const skeletonY = skeleton.y;\n        const bones = skeleton.bones;\n\n        debugDisplayObjects.skeletonXY.lineStyle(lineWidth, this.skeletonXYColor, 1);\n\n        for (let i = 0, len = bones.length; i < len; i++) {\n            const bone = bones[i];\n            const boneLen = bone.data.length;\n            const starX = skeletonX + bone.matrix.tx;\n            const starY = skeletonY + bone.matrix.ty;\n            const endX = skeletonX + boneLen * bone.matrix.a + bone.matrix.tx;\n            const endY = skeletonY + boneLen * bone.matrix.b + bone.matrix.ty;\n\n            if (bone.data.name === 'root' || bone.data.parent === null) {\n                continue;\n            }\n\n            // Triangle calculation formula\n            // area: A=sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c))/4\n            // alpha: alpha=acos((pow(b, 2)+pow(c, 2)-pow(a, 2))/(2*b*c))\n            // beta: beta=acos((pow(a, 2)+pow(c, 2)-pow(b, 2))/(2*a*c))\n            // gamma: gamma=acos((pow(a, 2)+pow(b, 2)-pow(c, 2))/(2*a*b))\n\n            const w = Math.abs(starX - endX);\n            const h = Math.abs(starY - endY);\n            // a = w, // side length a\n            const a2 = Math.pow(w, 2); // square root of side length a\n            const b = h; // side length b\n            const b2 = Math.pow(h, 2); // square root of side length b\n            const c = Math.sqrt(a2 + b2); // side length c\n            const c2 = Math.pow(c, 2); // square root of side length c\n            const rad = Math.PI / 180;\n            // A = Math.acos([a2 + c2 - b2] / [2 * a * c]) || 0, // Angle A\n            // C = Math.acos([a2 + b2 - c2] / [2 * a * b]) || 0, // C angle\n            const B = Math.acos((c2 + b2 - a2) / (2 * b * c)) || 0; // angle of corner B\n\n            if (c === 0) {\n                continue;\n            }\n\n            const gp = new Graphics();\n\n            debugDisplayObjects.bones.addChild(gp);\n\n            // draw bone\n            const refRation = c / 50 / scale;\n\n            gp.beginFill(this.bonesColor, 1);\n            gp.drawPolygon(0, 0, 0 - refRation, c - refRation * 3, 0, c - refRation, 0 + refRation, c - refRation * 3);\n            gp.endFill();\n            gp.x = starX;\n            gp.y = starY;\n            gp.pivot.y = c;\n\n            // Calculate bone rotation angle\n            let rotation = 0;\n\n            if (starX < endX && starY < endY) {\n                // bottom right\n                rotation = -B + 180 * rad;\n            } else if (starX > endX && starY < endY) {\n                // bottom left\n                rotation = 180 * rad + B;\n            } else if (starX > endX && starY > endY) {\n                // top left\n                rotation = -B;\n            } else if (starX < endX && starY > endY) {\n                // bottom left\n                rotation = B;\n            } else if (starY === endY && starX < endX) {\n                // To the right\n                rotation = 90 * rad;\n            } else if (starY === endY && starX > endX) {\n                // go left\n                rotation = -90 * rad;\n            } else if (starX === endX && starY < endY) {\n                // down\n                rotation = 180 * rad;\n            } else if (starX === endX && starY > endY) {\n                // up\n                rotation = 0;\n            }\n            gp.rotation = rotation;\n\n            // Draw the starting rotation point of the bone\n            gp.lineStyle(lineWidth + refRation / 2.4, this.bonesColor, 1);\n            gp.beginFill(0x000000, 0.6);\n            gp.drawCircle(0, c, refRation * 1.2);\n            gp.endFill();\n        }\n\n        // Draw the skeleton starting point \"X\" form\n        const startDotSize = lineWidth * 3;\n\n        debugDisplayObjects.skeletonXY.moveTo(skeletonX - startDotSize, skeletonY - startDotSize);\n        debugDisplayObjects.skeletonXY.lineTo(skeletonX + startDotSize, skeletonY + startDotSize);\n        debugDisplayObjects.skeletonXY.moveTo(skeletonX + startDotSize, skeletonY - startDotSize);\n        debugDisplayObjects.skeletonXY.lineTo(skeletonX - startDotSize, skeletonY + startDotSize);\n    }\n\n    private drawRegionAttachmentsFunc(\n        spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>,\n        debugDisplayObjects: DebugDisplayObjects,\n        lineWidth: number\n    ): void {\n        const skeleton = spine.skeleton;\n        const slots = skeleton.slots;\n\n        debugDisplayObjects.regionAttachmentsShape.lineStyle(lineWidth, this.regionAttachmentsColor, 1);\n\n        for (let i = 0, len = slots.length; i < len; i++) {\n            const slot = slots[i];\n            const attachment = slot.getAttachment();\n\n            if (attachment == null || attachment.type !== AttachmentType.Region) {\n                continue;\n            }\n\n            const regionAttachment = attachment as IRegionAttachment & {\n                computeWorldVertices: (slot: unknown, worldVertices: unknown, offset: unknown, stride: unknown) => void;\n                updateOffset?: () => void;\n            };\n\n            const vertices = new Float32Array(8);\n\n            if (regionAttachment.updateOffset) regionAttachment.updateOffset(); // We don't need this on all versions\n\n            regionAttachment.computeWorldVertices(slot, vertices, 0, 2);\n            debugDisplayObjects.regionAttachmentsShape.drawPolygon(Array.from(vertices.slice(0, 8)));\n        }\n    }\n\n    private drawMeshHullAndMeshTriangles(\n        spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>,\n        debugDisplayObjects: DebugDisplayObjects,\n        lineWidth: number\n    ): void {\n        const skeleton = spine.skeleton;\n        const slots = skeleton.slots;\n\n        debugDisplayObjects.meshHullLine.lineStyle(lineWidth, this.meshHullColor, 1);\n        debugDisplayObjects.meshTrianglesLine.lineStyle(lineWidth, this.meshTrianglesColor, 1);\n\n        for (let i = 0, len = slots.length; i < len; i++) {\n            const slot = slots[i];\n\n            if (!slot.bone.active) {\n                continue;\n            }\n            const attachment = slot.getAttachment();\n\n            if (attachment == null || attachment.type !== AttachmentType.Mesh) {\n                continue;\n            }\n\n            const meshAttachment: IMeshAttachment = attachment as IMeshAttachment;\n\n            const vertices = new Float32Array(meshAttachment.worldVerticesLength);\n            const triangles = meshAttachment.triangles;\n            let hullLength = meshAttachment.hullLength;\n\n            meshAttachment.computeWorldVertices(slot, 0, meshAttachment.worldVerticesLength, vertices, 0, 2);\n            // draw the skinned mesh (triangle)\n            if (this.drawMeshTriangles) {\n                for (let i = 0, len = triangles.length; i < len; i += 3) {\n                    const v1 = triangles[i] * 2;\n                    const v2 = triangles[i + 1] * 2;\n                    const v3 = triangles[i + 2] * 2;\n\n                    debugDisplayObjects.meshTrianglesLine.moveTo(vertices[v1], vertices[v1 + 1]);\n                    debugDisplayObjects.meshTrianglesLine.lineTo(vertices[v2], vertices[v2 + 1]);\n                    debugDisplayObjects.meshTrianglesLine.lineTo(vertices[v3], vertices[v3 + 1]);\n                }\n            }\n\n            // draw skin border\n            if (this.drawMeshHull && hullLength > 0) {\n                hullLength = (hullLength >> 1) * 2;\n                let lastX = vertices[hullLength - 2];\n                let lastY = vertices[hullLength - 1];\n\n                for (let i = 0, len = hullLength; i < len; i += 2) {\n                    const x = vertices[i];\n                    const y = vertices[i + 1];\n\n                    debugDisplayObjects.meshHullLine.moveTo(x, y);\n                    debugDisplayObjects.meshHullLine.lineTo(lastX, lastY);\n                    lastX = x;\n                    lastY = y;\n                }\n            }\n        }\n    }\n\n    private drawClippingFunc(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>, debugDisplayObjects: DebugDisplayObjects, lineWidth: number): void {\n        const skeleton = spine.skeleton;\n        const slots = skeleton.slots;\n\n        debugDisplayObjects.clippingPolygon.lineStyle(lineWidth, this.clippingPolygonColor, 1);\n        for (let i = 0, len = slots.length; i < len; i++) {\n            const slot = slots[i];\n\n            if (!slot.bone.active) {\n                continue;\n            }\n            const attachment = slot.getAttachment();\n\n            if (attachment == null || attachment.type !== AttachmentType.Clipping) {\n                continue;\n            }\n\n            const clippingAttachment: IClippingAttachment = attachment as IClippingAttachment;\n\n            const nn = clippingAttachment.worldVerticesLength;\n            const world = new Float32Array(nn);\n\n            clippingAttachment.computeWorldVertices(slot, 0, nn, world, 0, 2);\n            debugDisplayObjects.clippingPolygon.drawPolygon(Array.from(world));\n        }\n    }\n\n    private drawBoundingBoxesFunc(\n        spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>,\n        debugDisplayObjects: DebugDisplayObjects,\n        lineWidth: number\n    ): void {\n        // draw the total outline of the bounding box\n        debugDisplayObjects.boundingBoxesRect.lineStyle(lineWidth, this.boundingBoxesRectColor, 5);\n\n        const bounds = new SkeletonBoundsBase();\n\n        bounds.update(spine.skeleton, true);\n        debugDisplayObjects.boundingBoxesRect.drawRect(bounds.minX, bounds.minY, bounds.getWidth(), bounds.getHeight());\n\n        const polygons = bounds.polygons;\n        const drawPolygon = (polygonVertices: ArrayLike<number>, _offset: unknown, count: number): void => {\n            debugDisplayObjects.boundingBoxesPolygon.lineStyle(lineWidth, this.boundingBoxesPolygonColor, 1);\n            debugDisplayObjects.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor, 0.1);\n\n            if (count < 3) {\n                throw new Error('Polygon must contain at least 3 vertices');\n            }\n            const paths = [];\n            const dotSize = lineWidth * 2;\n\n            for (let i = 0, len = polygonVertices.length; i < len; i += 2) {\n                const x1 = polygonVertices[i];\n                const y1 = polygonVertices[i + 1];\n\n                // draw the bounding box node\n                debugDisplayObjects.boundingBoxesCircle.lineStyle(0);\n                debugDisplayObjects.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor);\n                debugDisplayObjects.boundingBoxesCircle.drawCircle(x1, y1, dotSize);\n                debugDisplayObjects.boundingBoxesCircle.endFill();\n\n                paths.push(x1, y1);\n            }\n\n            // draw the bounding box area\n            debugDisplayObjects.boundingBoxesPolygon.drawPolygon(paths);\n            debugDisplayObjects.boundingBoxesPolygon.endFill();\n        };\n\n        for (let i = 0, len = polygons.length; i < len; i++) {\n            const polygon = polygons[i];\n\n            drawPolygon(polygon, 0, polygon.length);\n        }\n    }\n\n    private drawPathsFunc(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>, debugDisplayObjects: DebugDisplayObjects, lineWidth: number): void {\n        const skeleton = spine.skeleton;\n        const slots = skeleton.slots;\n\n        debugDisplayObjects.pathsCurve.lineStyle(lineWidth, this.pathsCurveColor, 1);\n        debugDisplayObjects.pathsLine.lineStyle(lineWidth, this.pathsLineColor, 1);\n\n        for (let i = 0, len = slots.length; i < len; i++) {\n            const slot = slots[i];\n\n            if (!slot.bone.active) {\n                continue;\n            }\n            const attachment = slot.getAttachment();\n\n            if (attachment == null || attachment.type !== AttachmentType.Path) {\n                continue;\n            }\n\n            const pathAttachment = attachment as IVertexAttachment & { closed: boolean };\n            let nn = pathAttachment.worldVerticesLength;\n            const world = new Float32Array(nn);\n\n            pathAttachment.computeWorldVertices(slot, 0, nn, world, 0, 2);\n            let x1 = world[2];\n            let y1 = world[3];\n            let x2 = 0;\n            let y2 = 0;\n\n            if (pathAttachment.closed) {\n                const cx1 = world[0];\n                const cy1 = world[1];\n                const cx2 = world[nn - 2];\n                const cy2 = world[nn - 1];\n\n                x2 = world[nn - 4];\n                y2 = world[nn - 3];\n\n                // curve\n                debugDisplayObjects.pathsCurve.moveTo(x1, y1);\n                debugDisplayObjects.pathsCurve.bezierCurveTo(cx1, cy1, cx2, cy2, x2, y2);\n\n                // handle\n                debugDisplayObjects.pathsLine.moveTo(x1, y1);\n                debugDisplayObjects.pathsLine.lineTo(cx1, cy1);\n                debugDisplayObjects.pathsLine.moveTo(x2, y2);\n                debugDisplayObjects.pathsLine.lineTo(cx2, cy2);\n            }\n            nn -= 4;\n            for (let ii = 4; ii < nn; ii += 6) {\n                const cx1 = world[ii];\n                const cy1 = world[ii + 1];\n                const cx2 = world[ii + 2];\n                const cy2 = world[ii + 3];\n\n                x2 = world[ii + 4];\n                y2 = world[ii + 5];\n                // curve\n                debugDisplayObjects.pathsCurve.moveTo(x1, y1);\n                debugDisplayObjects.pathsCurve.bezierCurveTo(cx1, cy1, cx2, cy2, x2, y2);\n\n                // handle\n                debugDisplayObjects.pathsLine.moveTo(x1, y1);\n                debugDisplayObjects.pathsLine.lineTo(cx1, cy1);\n                debugDisplayObjects.pathsLine.moveTo(x2, y2);\n                debugDisplayObjects.pathsLine.lineTo(cx2, cy2);\n                x1 = x2;\n                y1 = y2;\n            }\n        }\n    }\n\n    public unregisterSpine(spine: SpineBase<ISkeleton, ISkeletonData, IAnimationState, IAnimationStateData>): void {\n        if (!this.registeredSpines.has(spine)) {\n            console.warn(\"SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!\", spine);\n        }\n        const debugDisplayObjects = this.registeredSpines.get(spine);\n\n        debugDisplayObjects.parentDebugContainer.destroy({ baseTexture: true, children: true, texture: true });\n        this.registeredSpines.delete(spine);\n    }\n}\n"],"names":["AttachmentType","i","BinaryInput","data","strings","index","buffer","value","optimizePositive","b","result","byteCount","chars","MixBlend","t","MixDirection","PositionMode","RotateMode","TransformMode","filterFromString","text","TextureFilter","wrapFromString","TextureWrap","n","TextureRegion","tex","RegionFields","TextureAtlas","atlasText","textureLoader","callback","name","texture","pages","page","TextureAtlasPage","baseTexture","region","TextureAtlasRegion","textures","stripExtension","key","reader","TextureAtlasReader","entry","pageFields","regionFields","rotateValue","rotate","line","iterateParser","field","ALPHA_MODES","atlasRegion","names","values","count","entryValues","resolution","swapWH","frame","Rectangle","orig","trim","Texture","colon","lastMatch","comma","filter","SCALE_MODES","MIPMAP_MODES","IntSet","contains","StringSet","oldSize","_Color","r","g","a","c","hex","color","Color","_MathUtils","min","max","degrees","x","y","mode","u","d","MathUtils","Interpolation","start","end","Pow","power","PowOut","_Utils","source","sourceStart","dest","destStart","numElements","j","array","fromIndex","toIndex","size","defaultValue","alpha","blend","element","identity","type","Utils","DebugUtils","skeleton","bone","mat","Pool","instantiator","item","items","Vector2","len","TimeKeeper","now","WindowedMean","windowSize","mean","SkeletonBoundsBase","updateAabb","boundingBoxes","polygons","polygonPool","slots","slotCount","slot","attachment","boundingBox","polygon","minX","minY","maxX","maxY","vertices","ii","nn","x1","y1","x2","y2","m","bounds","prevIndex","inside","vertexY","prevY","vertexX","width12","height12","det1","x3","y3","x4","y4","det2","width34","height34","det3","settings","tempRgb","SpineSprite","Sprite","SpineMesh","SimpleMesh","uvs","indices","drawMode","_SpineBase","Container","spineData","slotContainer","spriteName","sprite","mesh","_a","utils","dt","delayLimit","globalClr","light","dark","spriteColor","attColor","transform","Transform","id","meshId","r0","g0","b0","drawOrder","clippingAttachment","clippingContainer","timeDelta","defName","strip","DRAW_MODES","clip","graphics","poly","Polygon","geom","slotIndex","slotName","attachmentName","currentAttachment","Graphics","nameSuffix","group","outGroup","list_d","list_n","target","options","SpineBase","SpineDebugRenderer","spine","debugDisplayObjects","scale","lineWidth","skeletonX","skeletonY","bones","boneLen","starX","starY","endX","endY","w","h","a2","b2","c2","rad","B","gp","refRation","rotation","startDotSize","regionAttachment","meshAttachment","triangles","hullLength","v1","v2","v3","lastX","lastY","world","drawPolygon","polygonVertices","_offset","paths","dotSize","pathAttachment","cx1","cy1","cx2","cy2"],"m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