From 6d5daed925559c3833025ec4a48aa5b99f217efc Mon Sep 17 00:00:00 2001 From: Gleb Volkov Date: Wed, 13 May 2026 17:40:07 +0200 Subject: [PATCH 1/2] Migrate Spine extension from pixi-spine to @esotericsoftware/spine-pixi-v7 --- Extensions/Spine/JsExtension.js | 59 +- .../managers/pixi-spine-atlas-manager.ts | 155 +- .../Spine/managers/pixi-spine-manager.ts | 93 +- Extensions/Spine/pixi-spine/pixi-spine.js | 14 - .../Spine-Runtimes-License-Agreement.txt | 22 +- .../Spine/spine-pixi-v7/spine-pixi-v7-pre.js | 10 + .../Spine/spine-pixi-v7/spine-pixi-v7.js | 13212 ++++++++++++++++ .../Spine/spineruntimeobject-pixi-renderer.ts | 166 +- Extensions/Spine/spineruntimeobject.ts | 2 +- GDJS/Runtime/types/global-pixi-spine.d.ts | 4 - GDJS/Runtime/types/global-spine.d.ts | 4 + GDJS/package-lock.json | 3989 ++--- GDJS/package.json | 2 +- GDJS/scripts/lib/runtime-files-list.js | 3 +- GDJS/tests/karma.conf.js | 3 +- newIDE/app/package-lock.json | 157 +- newIDE/app/package.json | 8 +- .../ParameterFields/ObjectSkinNameField.js | 12 +- .../src/ObjectEditor/Editors/SpineEditor.js | 122 +- .../ObjectsRenderingService.js | 3 +- .../ObjectsRendering/PixiResourcesLoader.js | 156 +- tsconfig.json | 3 +- 22 files changed, 15165 insertions(+), 3034 deletions(-) delete mode 100644 Extensions/Spine/pixi-spine/pixi-spine.js rename Extensions/Spine/{pixi-spine => spine-pixi-v7}/Spine-Runtimes-License-Agreement.txt (99%) create mode 100644 Extensions/Spine/spine-pixi-v7/spine-pixi-v7-pre.js create mode 100644 Extensions/Spine/spine-pixi-v7/spine-pixi-v7.js delete mode 100644 GDJS/Runtime/types/global-pixi-spine.d.ts create mode 100644 GDJS/Runtime/types/global-spine.d.ts diff --git a/Extensions/Spine/JsExtension.js b/Extensions/Spine/JsExtension.js index d4a6422506af..c759506d469f 100644 --- a/Extensions/Spine/JsExtension.js +++ b/Extensions/Spine/JsExtension.js @@ -54,8 +54,9 @@ module.exports = { .addDefaultBehavior('OpacityCapability::OpacityBehavior') .addDefaultBehavior('AnimatableCapability::AnimatableBehavior') .setIncludeFile('Extensions/Spine/spineruntimeobject.js') + .addIncludeFile('Extensions/Spine/spine-pixi-v7/spine-pixi-v7-pre.js') + .addIncludeFile('Extensions/Spine/spine-pixi-v7/spine-pixi-v7.js') .addIncludeFile('Extensions/Spine/spineruntimeobject-pixi-renderer.js') - .addIncludeFile('Extensions/Spine/pixi-spine/pixi-spine.js') .addIncludeFile('Extensions/Spine/managers/pixi-spine-atlas-manager.js') .addIncludeFile('Extensions/Spine/managers/pixi-spine-manager.js') .setCategory('Advanced') @@ -280,7 +281,7 @@ module.exports = { const { PIXI, RenderedInstance, gd } = objectsRenderingService; class RenderedSpineInstance extends RenderedInstance { - /** @type {pixi_spine.Spine | null} */ + /** @type {spine.Spine | null} */ _spine = null; /** @type {PIXI.Sprite} */ _placeholder; @@ -467,7 +468,8 @@ module.exports = { // if custom size is set it will be reinitialized in update method spine.scale.set(1, 1); spine.state.setAnimation(0, source, shouldLoop); - spine.state.tracks[0].trackTime = 0; + const newTrack = spine.state.tracks[0]; + if (newTrack) newTrack.trackTime = 0; spine.update(0); spine.autoUpdate = false; } @@ -497,49 +499,34 @@ module.exports = { gd.SpineObjectConfiguration ); this._pixiResourcesLoader - .getSpineData(this._project, object.getSpineResourceName()) - .then((spineDataOrLoadingError) => { + .createSpine(this._project, object.getSpineResourceName()) + .then((spineInstance) => { if (this._wasDestroyed) return; if (this._spine) this._pixiObject.removeChild(this._spine); - if (!spineDataOrLoadingError.skeleton) { - console.error( - 'Unable to load Spine (' + - (spineDataOrLoadingError.loadingErrorReason || - 'Unknown reason') + - ')', - spineDataOrLoadingError.loadingError - ); + if (!spineInstance) { this._spine = null; this._placeholder.alpha = 255; return; } - try { - this._spine = new PIXI.Spine(spineDataOrLoadingError.skeleton); - - // Apply the default skin if configured. - const skinName = object.getSkinName(); - if (skinName && this._spine) { - try { - this._spine.skeleton.setSkinByName(skinName); - this._spine.skeleton.setSlotsToSetupPose(); - } catch (skinError) { - console.warn( - 'Unable to set skin "' + skinName + '":', - skinError - ); - } + this._spine = spineInstance; + + const skinName = object.getSkinName(); + if (skinName) { + try { + spineInstance.skeleton.setSkinByName(skinName); + spineInstance.skeleton.setSlotsToSetupPose(); + } catch (skinError) { + console.warn( + 'Unable to set skin "' + skinName + '":', + skinError + ); } - - this._pixiObject.addChild(this._spine); - this._placeholder.alpha = 0; - } catch (error) { - console.error('Exception while loading Spine.', error); - this._spine = null; - this._placeholder.alpha = 255; - return; } + + this._pixiObject.addChild(spineInstance); + this._placeholder.alpha = 0; }); } } diff --git a/Extensions/Spine/managers/pixi-spine-atlas-manager.ts b/Extensions/Spine/managers/pixi-spine-atlas-manager.ts index ef9178b56dc9..21014274a9db 100644 --- a/Extensions/Spine/managers/pixi-spine-atlas-manager.ts +++ b/Extensions/Spine/managers/pixi-spine-atlas-manager.ts @@ -4,33 +4,25 @@ * This project is released under the MIT License. */ namespace gdjs { - /** - * The callback called when a text that was requested is loaded (or an error occurred). - * @category Resources > Spine - */ - export type SpineAtlasManagerRequestCallback = ( - error: Error | null, - content?: pixi_spine.TextureAtlas - ) => void; - const atlasKinds: ResourceKind[] = ['atlas']; /** - * AtlasManager loads atlas files with pixi loader, using the "atlas" resources - * registered in the game resources and process them to Pixi TextureAtlas. + * SpineAtlasManager loads `.atlas` files via the official `@esotericsoftware/spine-pixi-v7` + * Pixi atlas loader, sharing texture pages with the engine's ImageManager. + * + * The loader is auto-registered by the `spine-pixi-v7` IIFE bundle. We simply prepare + * the asset metadata (`data.images`) so that PIXI.Assets binds atlas pages to the + * already-loaded base textures instead of fetching them again. * - * Contrary to audio/fonts, text files are loaded asynchronously, when requested. - * You should properly handle errors, and give the developer/player a way to know - * that loading failed. * @category Resources > Spine */ export class SpineAtlasManager implements gdjs.ResourceManager { private _imageManager: ImageManager; private _resourceLoader: ResourceLoader; private _loadedSpineAtlases = - new gdjs.ResourceCache(); + new gdjs.ResourceCache(); private _loadingSpineAtlases = new gdjs.ResourceCache< - Promise + Promise >(); /** @@ -49,8 +41,8 @@ namespace gdjs { return atlasKinds; } - async processResource(resourceName: string): Promise { - // Do nothing because pixi-spine parses resources by itself. + async processResource(_resourceName: string): Promise { + // The spine-pixi-v7 atlas loader parses the resource itself. } async loadResource(resourceName: string): Promise { @@ -58,88 +50,59 @@ namespace gdjs { } /** - * Returns promisified loaded atlas resource if it is available, loads it otherwise. - * - * @param resourceName The name of resource to load. + * Returns a cached promise resolving to the loaded atlas, loading it if needed. */ - getOrLoad(resourceName: string): Promise { + getOrLoad(resourceName: string): Promise { const resource = this._getAtlasResource(resourceName); - if (!resource) { return Promise.reject( - `Unable to find atlas for resource '${resourceName}'.` + new Error(`Unable to find atlas for resource '${resourceName}'.`) ); } - let loadingPromise = this._loadingSpineAtlases.get(resource); - - if (!loadingPromise) { - loadingPromise = new Promise( - (resolve, reject) => { - const onLoad: SpineAtlasManagerRequestCallback = ( - error, - content - ) => { - if (error) { - return reject( - `Error while preloading a spine atlas resource: ${error}` - ); - } - if (!content) { - return reject( - `Cannot reach texture atlas for resource '${resourceName}'.` - ); - } - - resolve(content); - }; - - this.load(resource, onLoad); - } - ); + const cachedAtlas = this._loadedSpineAtlases.get(resource); + if (cachedAtlas) { + return Promise.resolve(cachedAtlas); + } - this._loadingSpineAtlases.set(resource, loadingPromise); + const inflight = this._loadingSpineAtlases.get(resource); + if (inflight) { + return inflight; } + const loadingPromise = this._load(resource).then((atlas) => { + this._loadedSpineAtlases.set(resource, atlas); + return atlas; + }); + this._loadingSpineAtlases.set(resource, loadingPromise); return loadingPromise; } - /** - * Load specified atlas resource and pass it to callback once it is loaded. - * - * @param resource The data of resource to load. - * @param callback The callback to pass atlas to it once it is loaded. - */ - load( - resource: ResourceData, - callback: SpineAtlasManagerRequestCallback - ): void { + private async _load(resource: ResourceData): Promise { const game = this._resourceLoader.getRuntimeGame(); const embeddedResourcesNames = game.getEmbeddedResourcesNames( resource.name ); - if (!embeddedResourcesNames.length) - return callback( - new Error(`${resource.name} do not have image metadata!`) - ); + if (!embeddedResourcesNames.length) { + throw new Error(`${resource.name} does not have image metadata!`); + } const images = embeddedResourcesNames.reduce<{ - [key: string]: PIXI.Texture; + [key: string]: PIXI.BaseTexture; }>((imagesMap, embeddedResourceName) => { const mappedResourceName = game.resolveEmbeddedResource( resource.name, embeddedResourceName ); + // The v7 atlas loader expects BaseTexture instances when sharing pages + // with already-loaded textures. imagesMap[embeddedResourceName] = - this._imageManager.getOrLoadPIXITexture(mappedResourceName); - + this._imageManager.getOrLoadPIXITexture(mappedResourceName) + .baseTexture; return imagesMap; }, {}); - const onLoad = (atlas: pixi_spine.TextureAtlas) => { - this._loadedSpineAtlases.set(resource, atlas); - callback(null, atlas); - }; + const url = this._resourceLoader.getFullUrl(resource.file); const alias = url; @@ -150,45 +113,33 @@ namespace gdjs { : 'anonymous', }); PIXI.Assets.add({ alias, src: url, data: { images } }); - PIXI.Assets.load(alias).then( - (atlas) => { - /** - * Ideally atlas of TextureAtlas should be passed here - * but there is known issue in case of preloaded images (see https://github.com/pixijs/spine/issues/537) - * - * Here covered all possible ways to make it work fine if issue is fixed in pixi-spine or after migration to spine-pixi - */ - if (typeof atlas === 'string') { - new pixi_spine.TextureAtlas( - atlas, - (textureName, textureCb) => - //@ts-ignore - textureCb(images[textureName].baseTexture), - onLoad - ); - } else { - onLoad(atlas); - } - } - ); + return PIXI.Assets.load(alias); } /** - * Check if the given atlas resource was loaded (preloaded or loaded with `load`). + * Check if the given atlas resource was loaded. * @param resourceName The name of the atlas resource. - * @returns true if the content of the atlas resource is loaded, false otherwise. */ isLoaded(resourceName: string): boolean { return !!this._loadedSpineAtlases.getFromName(resourceName); } /** - * Get the Pixi TextureAtlas for the given resource that is already loaded (preloaded or loaded with `load`). - * If the resource is not loaded, `null` will be returned. - * @param resourceName The name of the atlas resource. - * @returns the TextureAtlas of the atlas if loaded, `null` otherwise. + * Returns the alias used to register the atlas in PIXI.Assets, + * or null if the resource is not loaded. */ - getAtlasTexture(resourceName: string): pixi_spine.TextureAtlas | null { + getAtlasAlias(resourceName: string): string | null { + const resource = this._getAtlasResource(resourceName); + if (!resource) return null; + return this._loadedSpineAtlases.get(resource) + ? this._resourceLoader.getFullUrl(resource.file) + : null; + } + + /** + * Returns the loaded TextureAtlas for the given resource, if available. + */ + getAtlasTexture(resourceName: string): spine.TextureAtlas | null { return this._loadedSpineAtlases.getFromName(resourceName); } @@ -198,9 +149,9 @@ namespace gdjs { ? resource : null; } + /** * To be called when the game is disposed. - * Clear the Spine atlases loaded in this manager. */ dispose(): void { this._loadedSpineAtlases.clear(); @@ -220,7 +171,7 @@ namespace gdjs { resourceData.name ); if (loadingSpineAtlas) { - loadingSpineAtlas.then((atl) => atl.dispose()); + loadingSpineAtlas.then((atlas) => atlas.dispose()).catch(() => {}); this._loadingSpineAtlases.delete(resourceData); } } diff --git a/Extensions/Spine/managers/pixi-spine-manager.ts b/Extensions/Spine/managers/pixi-spine-manager.ts index 19c1a865b942..a6e25b45ca13 100644 --- a/Extensions/Spine/managers/pixi-spine-manager.ts +++ b/Extensions/Spine/managers/pixi-spine-manager.ts @@ -9,17 +9,32 @@ namespace gdjs { const resourceKinds: ResourceKind[] = ['spine']; /** - * SpineManager manages pixi spine skeleton data. + * Aliases used to instantiate a Spine container via `Spine.from`. + */ + export type SpineAssetAliases = { + skeletonAlias: string; + atlasAlias: string; + }; + + /** + * SpineManager loads Spine skeleton (`.json` / `.skel`) resources via the + * official `@esotericsoftware/spine-pixi-v7` asset loader. The skeleton is + * stored in the global `PIXI.Assets` cache under a stable alias, ready to be + * consumed by `spine.Spine.from(...)`. * @category Resources > Spine */ export class SpineManager implements gdjs.ResourceManager { private _spineAtlasManager: SpineAtlasManager; private _resourceLoader: ResourceLoader; - private _loadedSpines = new gdjs.ResourceCache(); + /** + * Stores the asset aliases needed to construct a Spine container. + * The atlas page textures are tracked separately by the SpineAtlasManager. + */ + private _loadedSpines = new gdjs.ResourceCache(); /** * @param resourceLoader The resources loader of the game. - * @param spineAtlasManager The resources data of the game. + * @param spineAtlasManager The Spine atlas manager of the game. */ constructor( resourceLoader: gdjs.ResourceLoader, @@ -33,8 +48,8 @@ namespace gdjs { return resourceKinds; } - async processResource(resourceName: string): Promise { - // Do nothing because pixi-spine parses resources by itself. + async processResource(_resourceName: string): Promise { + // The spine-pixi-v7 skeleton loader parses the resource itself. } async loadResource(resourceName: string): Promise { @@ -42,12 +57,12 @@ namespace gdjs { if (!resource) { return logger.error( - `Unable to find spine json for resource ${resourceName}.` + `Unable to find spine skeleton for resource ${resourceName}.` ); } - const url = this._resourceLoader.getFullUrl(resource.file); - const alias = url; + const skeletonUrl = this._resourceLoader.getFullUrl(resource.file); + const skeletonAlias = skeletonUrl; try { const game = this._resourceLoader.getRuntimeGame(); @@ -55,10 +70,10 @@ namespace gdjs { resource.name ); - // there should be exactly one file which is pointing to atlas + // there should be exactly one embedded resource (the atlas) if (embeddedResourcesNames.length !== 1) { return logger.error( - `Unable to find atlas metadata for resource spine json ${resourceName}.` + `Unable to find atlas metadata for resource spine skeleton ${resourceName}.` ); } @@ -66,53 +81,47 @@ namespace gdjs { resource.name, embeddedResourcesNames[0] ); - const spineAtlas = - await this._spineAtlasManager.getOrLoad(atlasResourceName); + await this._spineAtlasManager.getOrLoad(atlasResourceName); + const atlasAlias = + this._spineAtlasManager.getAtlasAlias(atlasResourceName); + + if (!atlasAlias) { + return logger.error( + `Atlas '${atlasResourceName}' was loaded but no alias is registered.` + ); + } PIXI.Assets.setPreferences({ preferWorkers: false, - crossOrigin: this._resourceLoader.checkIfCredentialsRequired(url) + crossOrigin: this._resourceLoader.checkIfCredentialsRequired( + skeletonUrl + ) ? 'use-credentials' : 'anonymous', }); - PIXI.Assets.add({ - alias, - src: url, - data: { spineAtlas }, - }); - const loadedJson = await PIXI.Assets.load(alias); + PIXI.Assets.add({ alias: skeletonAlias, src: skeletonUrl }); + await PIXI.Assets.load(skeletonAlias); - if (loadedJson.spineData) { - this._loadedSpines.set(resource, loadedJson.spineData); - } else { - logger.error( - `Loader cannot process spine resource ${resource.name} correctly.` - ); - } + this._loadedSpines.set(resource, { skeletonAlias, atlasAlias }); } catch (error) { logger.error( `Error while preloading spine resource ${resource.name}: ${error}` ); - PIXI.Assets.unload(alias); + await PIXI.Assets.unload(skeletonAlias).catch(() => {}); throw error; } } /** - * Get the object for the given resource that is already loaded (preloaded or loaded with `loadJson`). - * If the resource is not loaded, `null` will be returned. - * - * @param resourceName The name of the spine skeleton. - * @returns the spine skeleton if loaded, `null` otherwise. + * Returns the asset aliases required to instantiate a Spine container, + * or `null` if the resource is not loaded yet. */ - getSpine(resourceName: string): pixi_spine.ISkeletonData | null { + getSpineAliases(resourceName: string): SpineAssetAliases | null { return this._loadedSpines.getFromName(resourceName); } /** * Check if the given spine skeleton was loaded. - * @param resourceName The name of the spine skeleton. - * @returns true if the content of the spine skeleton is loaded, false otherwise. */ isSpineLoaded(resourceName: string): boolean { return !!this._loadedSpines.getFromName(resourceName); @@ -127,15 +136,23 @@ namespace gdjs { /** * To be called when the game is disposed. - * Clear the Spine skeleton data loaded in this manager. */ dispose(): void { this._loadedSpines.clear(); } unloadResource(resourceData: ResourceData): void { - const loadedSpine = this._loadedSpines.get(resourceData); - if (loadedSpine) { + const aliases = this._loadedSpines.get(resourceData); + if (aliases) { + // Drop cached SkeletonData entries created by Spine.from for this skeleton. + const skeletonCache = spine.Spine.skeletonCache; + const cachePrefix = `${aliases.skeletonAlias}-${aliases.atlasAlias}-`; + for (const cacheKey of Object.keys(skeletonCache)) { + if (cacheKey.startsWith(cachePrefix)) { + delete skeletonCache[cacheKey]; + } + } + PIXI.Assets.unload(aliases.skeletonAlias).catch(() => {}); this._loadedSpines.delete(resourceData); } } diff --git a/Extensions/Spine/pixi-spine/pixi-spine.js b/Extensions/Spine/pixi-spine/pixi-spine.js deleted file mode 100644 index a15d8af142a8..000000000000 --- a/Extensions/Spine/pixi-spine/pixi-spine.js +++ /dev/null @@ -1,14 +0,0 @@ -/*! - * pixi-spine - v4.0.4 - * Compiled Thu, 25 May 2023 20:30:28 UTC - * - * pixi-spine is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - * - * Copyright 2023, Ivan Igorevich Popelyshev , All Rights Reserved - */this.PIXI=this.PIXI||{},this.PIXI.spine=function(tt,H,dn,wr,br,oe,qe){"use strict";var Z=(c=>(c[c.Region=0]="Region",c[c.BoundingBox=1]="BoundingBox",c[c.Mesh=2]="Mesh",c[c.LinkedMesh=3]="LinkedMesh",c[c.Path=4]="Path",c[c.Point=5]="Point",c[c.Clipping=6]="Clipping",c))(Z||{});class Mn{constructor(t,n=new Array,e=0,i=new DataView(t.buffer)){this.strings=n,this.index=e,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let n=this.readByte(),e=n&127;return n&128&&(n=this.readByte(),e|=(n&127)<<7,n&128&&(n=this.readByte(),e|=(n&127)<<14,n&128&&(n=this.readByte(),e|=(n&127)<<21,n&128&&(n=this.readByte(),e|=(n&127)<<28)))),t?e:e>>>1^-(e&1)}readStringRef(){const t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let n="";for(let e=0;e>4){case 12:case 13:n+=String.fromCharCode((i&31)<<6|this.readByte()&63),e+=2;break;case 14:n+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),e+=3;break;default:n+=String.fromCharCode(i),e++}}return n}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var A=(c=>(c[c.setup=0]="setup",c[c.first=1]="first",c[c.replace=2]="replace",c[c.add=3]="add",c))(A||{}),J=(c=>(c[c.mixIn=0]="mixIn",c[c.mixOut=1]="mixOut",c))(J||{}),dt=(c=>(c[c.Fixed=0]="Fixed",c[c.Percent=1]="Percent",c))(dt||{}),pt=(c=>(c[c.Tangent=0]="Tangent",c[c.Chain=1]="Chain",c[c.ChainScale=2]="ChainScale",c))(pt||{}),j=(c=>(c[c.Normal=0]="Normal",c[c.OnlyTranslation=1]="OnlyTranslation",c[c.NoRotationOrReflection=2]="NoRotationOrReflection",c[c.NoScale=3]="NoScale",c[c.NoScaleOrReflection=4]="NoScaleOrReflection",c))(j||{});function Jn(c){switch(c.toLowerCase()){case"nearest":return Bt.Nearest;case"linear":return Bt.Linear;case"mipmap":return Bt.MipMap;case"mipmapnearestnearest":return Bt.MipMapNearestNearest;case"mipmaplinearnearest":return Bt.MipMapLinearNearest;case"mipmapnearestlinear":return Bt.MipMapNearestLinear;case"mipmaplinearlinear":return Bt.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${c}`)}}function Er(c){switch(c.toLowerCase()){case"mirroredtepeat":return fe.MirroredRepeat;case"clamptoedge":return fe.ClampToEdge;case"repeat":return fe.Repeat;default:throw new Error(`Unknown texture wrap ${c}`)}}var Bt=(c=>(c[c.Nearest=9728]="Nearest",c[c.Linear=9729]="Linear",c[c.MipMap=9987]="MipMap",c[c.MipMapNearestNearest=9984]="MipMapNearestNearest",c[c.MipMapLinearNearest=9985]="MipMapLinearNearest",c[c.MipMapNearestLinear=9986]="MipMapNearestLinear",c[c.MipMapLinearLinear=9987]="MipMapLinearLinear",c))(Bt||{}),fe=(c=>(c[c.MirroredRepeat=33648]="MirroredRepeat",c[c.ClampToEdge=33071]="ClampToEdge",c[c.Repeat=10497]="Repeat",c))(fe||{});class Vn{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class Sr{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Fn{constructor(t,n,e){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,n,e)}addTexture(t,n){const e=this.pages;let i=null;for(let h=0;h{h.width=parseInt(r[1]),h.height=parseInt(r[2])},l.format=()=>{},l.filter=()=>{h.minFilter=Jn(r[1]),h.magFilter=Jn(r[2])},l.repeat=()=>{r[1].indexOf("x")!=-1&&(h.uWrap=fe.Repeat),r[1].indexOf("y")!=-1&&(h.vWrap=fe.Repeat)},l.pma=()=>{h.pma=r[1]=="true"};const a={};a.xy=()=>{s.x=parseInt(r[1]),s.y=parseInt(r[2])},a.size=()=>{s.width=parseInt(r[1]),s.height=parseInt(r[2])},a.bounds=()=>{s.x=parseInt(r[1]),s.y=parseInt(r[2]),s.width=parseInt(r[3]),s.height=parseInt(r[4])},a.offset=()=>{s.offsetX=parseInt(r[1]),s.offsetY=parseInt(r[2])},a.orig=()=>{s.originalWidth=parseInt(r[1]),s.originalHeight=parseInt(r[2])},a.offsets=()=>{s.offsetX=parseInt(r[1]),s.offsetY=parseInt(r[2]),s.originalWidth=parseInt(r[3]),s.originalHeight=parseInt(r[4])},a.rotate=()=>{const f=r[1];let u=0;f.toLocaleLowerCase()=="true"?u=6:f.toLocaleLowerCase()=="false"?u=0:u=(720-parseFloat(f))%360/45,s.rotate=u},a.index=()=>{s.index=parseInt(r[1])};let o=i.readLine();for(;o!=null&&o.trim().length==0;)o=i.readLine();for(;!(o==null||o.trim().length==0||i.readEntry(r,o)==0);)o=i.readLine();const d=()=>{for(;;){if(o==null)return e&&e(this);if(o.trim().length==0)h=null,o=i.readLine();else if(h===null){for(h=new ts,h.name=o.trim();i.readEntry(r,o=i.readLine())!=0;){const f=l[r[0]];f&&f()}this.pages.push(h),n(h.name,f=>{if(f===null)return this.pages.splice(this.pages.indexOf(h),1),e&&e(null);h.baseTexture=f,h.pma&&(f.alphaMode=H.ALPHA_MODES.PMA),f.valid||f.setSize(h.width,h.height),h.setFilters(),(!h.width||!h.height)&&(h.width=f.realWidth,h.height=f.realHeight,(!h.width||!h.height)&&console.log(`ERROR spine atlas page ${h.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),d()});break}else{s=new Sr;const f=new es;f.name=o,f.page=h;let u=null,m=null;for(;;){const p=i.readEntry(r,o=i.readLine());if(p==0)break;const S=a[r[0]];if(S)S();else{u==null&&(u=[],m=[]),u.push(r[0]);const y=[];for(let M=0;M=this.lines.length?null:this.lines[this.index++]}readEntry(t,n){if(n==null||(n=n.trim(),n.length==0))return 0;const e=n.indexOf(":");if(e==-1)return 0;t[0]=n.substr(0,e).trim();for(let i=1,r=e+1;;i++){const h=n.indexOf(",",r);if(h==-1)return t[i]=n.substr(r).trim(),i;if(t[i]=n.substr(r,h-r).trim(),r=h+1,i==4)return 4}}}class ts{constructor(){this.minFilter=Bt.Nearest,this.magFilter=Bt.Nearest,this.uWrap=fe.ClampToEdge,this.vWrap=fe.ClampToEdge}setFilters(){const t=this.baseTexture,n=this.minFilter;n==Bt.Linear?t.scaleMode=H.SCALE_MODES.LINEAR:this.minFilter==Bt.Nearest?t.scaleMode=H.SCALE_MODES.NEAREST:(t.mipmap=H.MIPMAP_MODES.POW2,n==Bt.MipMapNearestNearest?t.scaleMode=H.SCALE_MODES.NEAREST:t.scaleMode=H.SCALE_MODES.LINEAR)}}class es extends Vn{}class ns{constructor(){this.array=new Array}add(t){const n=this.contains(t);return this.array[t|0]=t|0,!n}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class ss{constructor(){this.entries={},this.size=0}add(t){const n=this.entries[t];return this.entries[t]=!0,n?!1:(this.size++,!0)}addAll(t){const n=this.size;for(let e=0,i=t.length;e1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(c,t){c.r=((t&4278190080)>>>24)/255,c.g=((t&16711680)>>>16)/255,c.b=((t&65280)>>>8)/255,c.a=(t&255)/255}static rgb888ToColor(c,t){c.r=((t&16711680)>>>16)/255,c.g=((t&65280)>>>8)/255,c.b=(t&255)/255}static fromString(c){return new Je().setFromString(c)}};let _=Je;_.WHITE=new Je(1,1,1,1),_.RED=new Je(1,0,0,1),_.GREEN=new Je(0,1,0,1),_.BLUE=new Je(0,0,1,1),_.MAGENTA=new Je(1,0,1,1);const Fe=class{static clamp(c,t,n){return cn?n:c}static cosDeg(c){return Math.cos(c*Fe.degRad)}static sinDeg(c){return Math.sin(c*Fe.degRad)}static signum(c){return Math.sign(c)}static toInt(c){return c>0?Math.floor(c):Math.ceil(c)}static cbrt(c){const t=Math.pow(Math.abs(c),.3333333333333333);return c<0?-t:t}static randomTriangular(c,t){return Fe.randomTriangularWith(c,t,(c+t)*.5)}static randomTriangularWith(c,t,n){const e=Math.random(),i=t-c;return e<=(n-c)/i?c+Math.sqrt(e*i*(n-c)):t-Math.sqrt((1-e)*i*(t-n))}static isPowerOfTwo(c){return c&&(c&c-1)===0}};let C=Fe;C.PI=3.1415927,C.PI2=Fe.PI*2,C.radiansToDegrees=180/Fe.PI,C.radDeg=Fe.radiansToDegrees,C.degreesToRadians=Fe.PI/180,C.degRad=Fe.degreesToRadians;class Si{apply(t,n,e){return t+(n-t)*this.applyInternal(e)}}class yi extends Si{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class is extends yi{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const fn=class{static arrayCopy(c,t,n,e,i){for(let r=t,h=e;r=t?c:fn.setArraySize(c,t,n)}static newArray(c,t){const n=new Array(c);for(let e=0;e0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let n=0;nthis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class Cr{constructor(t=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let n=0;nv.newFloatArray(16))}update(t,n){if(!t)throw new Error("skeleton cannot be null.");const e=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=t.slots,l=h.length;e.length=0,r.freeAll(i),i.length=0;for(let s=0;s=this.minX&&t<=this.maxX&&n>=this.minY&&n<=this.maxY}aabbIntersectsSegment(t,n,e,i){const r=this.minX,h=this.minY,l=this.maxX,s=this.maxY;if(t<=r&&e<=r||n<=h&&i<=h||t>=l&&e>=l||n>=s&&i>=s)return!1;const a=(i-n)/(e-t);let o=a*(r-t)+n;if(o>h&&oh&&or&&dr&&dt.minX&&this.minYt.minY}containsPoint(t,n){const e=this.polygons;for(let i=0,r=e.length;i=e||o=e){const d=i[s];d+(e-a)/(o-a)*(i[h]-d)=d&&p<=m||p>=m&&p<=d)&&(p>=n&&p<=i||p>=i&&p<=n)){const S=(o*w-a*x)/b;if((S>=f&&S<=g||S>=g&&S<=f)&&(S>=e&&S<=r||S>=r&&S<=e))return!0}d=m,f=g}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const n=this.boundingBoxes.indexOf(t);return n==-1?null:this.polygons[n]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}const zt={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},Ue=[0,0,0];class Mi extends wr.Sprite{constructor(){super(...arguments),this.region=null,this.attachment=null}}class Ai extends br.SimpleMesh{constructor(t,n,e,i,r){super(t,n,e,i,r),this.region=null,this.attachment=null}}const Ci=class extends dn.Container{constructor(c){if(super(),!c)throw new Error("The spineData param is required.");if(typeof c=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=c,this.createSkeleton(c),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,n=this.skeleton.slots.length;tt&&(c=t),this.state.update(c),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const n=this.skeleton.slots,e=this.color;let i=null,r=null;e?(i=e.light,r=e.dark):i=this.tintRgb;for(let o=0,d=n.length;o0;r--)n.bones.children[r-1].destroy({children:!0,texture:!0,baseTexture:!0});const e=t.scale.x||t.scale.y||1,i=this.lineWidth/e;this.drawBones&&this.drawBonesFunc(t,n,i,e),this.drawPaths&&this.drawPathsFunc(t,n,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,n,i),this.drawClipping&&this.drawClippingFunc(t,n,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,n,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,n,i)}drawBonesFunc(t,n,e,i){const r=t.skeleton,h=r.x,l=r.y,s=r.bones;n.skeletonXY.lineStyle(e,this.skeletonXYColor,1);for(let o=0,d=s.length;ox&&gx&&g>E?F=-I:mE?F=I:g===E&&mx?F=-90*k:m===x&&gE&&(F=0),R.rotation=F,R.lineStyle(e+V/2.4,this.bonesColor,1),R.beginFill(0,.6),R.drawCircle(0,M,V*1.2),R.endFill()}const a=e*3;n.skeletonXY.moveTo(h-a,l-a),n.skeletonXY.lineTo(h+a,l+a),n.skeletonXY.moveTo(h+a,l-a),n.skeletonXY.lineTo(h-a,l+a)}drawRegionAttachmentsFunc(t,n,e){const r=t.skeleton.slots;n.regionAttachmentsShape.lineStyle(e,this.regionAttachmentsColor,1);for(let h=0,l=r.length;h0){u=(u>>1)*2;let m=d[u-2],g=d[u-1];for(let x=0,E=u;x{if(n.boundingBoxesPolygon.lineStyle(e,this.boundingBoxesPolygonColor,1),n.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor,.1),a<3)throw new Error("Polygon must contain at least 3 vertices");const o=[],d=e*2;for(let f=0,u=l.length;f{r=o,h=d});let s;const a=o=>{o||h(`Something went terribly wrong loading a spine .atlas file -Most likely your texture failed to load.`),r(s)};if(e.image||e.images){const o=Object.assign(e.image?{default:e.image}:{},e.images);s=new Fn(c,(d,f)=>{const u=o[d]||o.default;u&&u.baseTexture?f(u.baseTexture):f(u)},a)}else s=new Fn(c,Ti(n,i,e.imageMetadata),a);return await l},unload(c){c.dispose()}}},Ti=(c,t,n)=>async(e,i)=>{const r=H.utils.path.normalize([...t.split(H.utils.path.sep),e].join(H.utils.path.sep)),h=await c.load({src:r,data:n});i(h.baseTexture)};H.extensions.add(kr);function ki(c){return c.hasOwnProperty("bones")}function Ir(c){return c instanceof ArrayBuffer}class Rr{constructor(){}installLoader(){const t=this,n={extension:H.ExtensionType.Asset,loader:{extension:{type:H.ExtensionType.LoadParser,priority:qe.LoaderParserPriority.Normal},test(e){return qe.checkExtension(e,".skel")},async load(e){return await(await H.settings.ADAPTER.fetch(e)).arrayBuffer()},testParse(e,i){var s;const r=qe.checkExtension(i.src,".json")&&ki(e),h=qe.checkExtension(i.src,".skel")&&Ir(e),l=((s=i.data)==null?void 0:s.spineAtlas)===!1;return Promise.resolve(r&&!l||h)},async parse(e,i,r){var w;const h=H.utils.path.extname(i.src).toLowerCase(),l=H.utils.path.basename(i.src,h);let s=H.utils.path.dirname(i.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");const a=qe.checkExtension(i.src,".json")&&ki(e);let o=null,d=e;a?o=t.createJsonParser():(o=t.createBinaryParser(),d=new Uint8Array(e));const f=i.data||{},u=(w=f==null?void 0:f.spineSkeletonScale)!=null?w:null;u&&(o.scale=u);const m=f.spineAtlas;if(m&&m.pages)return t.parseData(o,m,d);const g=f.atlasRawData;if(g){let b=null,p=null;const S=new Promise((T,k)=>{b=T,p=k}),y=new Fn(g,Ti(r,s,f.imageMetadata),T=>{T||p(`Something went terribly wrong loading a spine .atlas file -Most likely your texture failed to load.`),b(y)}),M=await S;return t.parseData(o,M,d)}let x=f.spineAtlasFile;x||(x=`${s+l}.atlas`);const E=await r.load({src:x,data:f,alias:f.spineAtlasAlias});return t.parseData(o,E,d)}}};return H.extensions.add(n),n}}let rs=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const Ii=class extends rs{constructor(t){super(t),this.id=(Ii.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,n){this.computeWorldVertices(t,0,this.worldVerticesLength,n,0,2)}computeWorldVertices(t,n,e,i,r,h){e=r+(e>>1)*h;const l=t.bone.skeleton,s=t.deform;let a=this.vertices;const o=this.bones;if(o==null){s.length>0&&(a=s);const m=t.bone.matrix,g=m.tx,x=m.ty,E=m.a,w=m.c,b=m.b,p=m.d;for(let S=n,y=r;y0&&(n%=this.duration));const a=this.timelines;for(let o=0,d=a.length;o>>1;for(;;){if(t[(h+1)*e]<=n?i=h+1:r=h,i==r)return(i+1)*e;h=i+r>>>1}}static linearSearch(t,n,e){for(let i=0,r=t.length-e;i<=r;i+=e)if(t[i]>n)return i;return-1}};var Pi=(c=>(c[c.rotate=0]="rotate",c[c.translate=1]="translate",c[c.scale=2]="scale",c[c.shear=3]="shear",c[c.attachment=4]="attachment",c[c.color=5]="color",c[c.deform=6]="deform",c[c.event=7]="event",c[c.drawOrder=8]="drawOrder",c[c.ikConstraint=9]="ikConstraint",c[c.transformConstraint=10]="transformConstraint",c[c.pathConstraintPosition=11]="pathConstraintPosition",c[c.pathConstraintSpacing=12]="pathConstraintSpacing",c[c.pathConstraintMix=13]="pathConstraintMix",c[c.twoColor=14]="twoColor",c))(Pi||{});const St=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=v.newFloatArray((t-1)*St.BEZIER_SIZE)}getFrameCount(){return this.curves.length/St.BEZIER_SIZE+1}setLinear(t){this.curves[t*St.BEZIER_SIZE]=St.LINEAR}setStepped(t){this.curves[t*St.BEZIER_SIZE]=St.STEPPED}getCurveType(t){const n=t*St.BEZIER_SIZE;if(n==this.curves.length)return St.LINEAR;const e=this.curves[n];return e==St.LINEAR?St.LINEAR:e==St.STEPPED?St.STEPPED:St.BEZIER}setCurve(t,n,e,i,r){const h=(-n*2+i)*.03,l=(-e*2+r)*.03,s=((n-i)*3+1)*.006,a=((e-r)*3+1)*.006;let o=h*2+s,d=l*2+a,f=n*.3+h+s*.16666667,u=e*.3+l+a*.16666667,m=t*St.BEZIER_SIZE;const g=this.curves;g[m++]=St.BEZIER;let x=f,E=u;for(let w=m+St.BEZIER_SIZE-1;m=n){let o,d;return i==s?(o=0,d=0):(o=e[i-2],d=e[i-1]),d+(e[i+1]-d)*(n-o)/(h-o)}const l=e[i-1];return l+(1-l)*(n-h)/(1-h)}};let Ht=St;Ht.LINEAR=0,Ht.STEPPED=1,Ht.BEZIER=2,Ht.BEZIER_SIZE=10*2-1;const He=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t<<1)}getPropertyId(){return(0<<24)+this.boneIndex}setFrame(t,n,e){t<<=1,this.frames[t]=n,this.frames[t+He.ROTATION]=e}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.bones[this.boneIndex];if(!a.active)return;if(e=s[s.length-He.ENTRIES]){let g=s[s.length+He.PREV_ROTATION];switch(h){case A.setup:a.rotation=a.data.rotation+g*r;break;case A.first:case A.replace:g+=a.data.rotation-a.rotation,g-=(16384-(16384.499999999996-g/360|0))*360;case A.add:a.rotation+=g*r}return}const o=Et.binarySearch(s,e,He.ENTRIES),d=s[o+He.PREV_ROTATION],f=s[o],u=this.getCurvePercent((o>>1)-1,1-(e-f)/(s[o+He.PREV_TIME]-f));let m=s[o+He.ROTATION]-d;switch(m=d+(m-(16384-(16384.499999999996-m/360|0))*360)*u,h){case A.setup:a.rotation=a.data.rotation+(m-(16384-(16384.499999999996-m/360|0))*360)*r;break;case A.first:case A.replace:m+=a.data.rotation-a.rotation;case A.add:a.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*r}}};let Vt=He;Vt.ENTRIES=2,Vt.PREV_TIME=-2,Vt.PREV_ROTATION=-1,Vt.ROTATION=1;const Dt=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t*Dt.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,n,e,i){t*=Dt.ENTRIES,this.frames[t]=n,this.frames[t+Dt.X]=e,this.frames[t+Dt.Y]=i}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.bones[this.boneIndex];if(!a.active)return;if(e=s[s.length-Dt.ENTRIES])o=s[s.length+Dt.PREV_X],d=s[s.length+Dt.PREV_Y];else{const f=Et.binarySearch(s,e,Dt.ENTRIES);o=s[f+Dt.PREV_X],d=s[f+Dt.PREV_Y];const u=s[f],m=this.getCurvePercent(f/Dt.ENTRIES-1,1-(e-u)/(s[f+Dt.PREV_TIME]-u));o+=(s[f+Dt.X]-o)*m,d+=(s[f+Dt.Y]-d)*m}switch(h){case A.setup:a.x=a.data.x+o*r,a.y=a.data.y+d*r;break;case A.first:case A.replace:a.x+=(a.data.x+o-a.x)*r,a.y+=(a.data.y+d-a.y)*r;break;case A.add:a.x+=o*r,a.y+=d*r}}};let Jt=Dt;Jt.ENTRIES=3,Jt.PREV_TIME=-3,Jt.PREV_X=-2,Jt.PREV_Y=-1,Jt.X=1,Jt.Y=2;let te=class extends Jt{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.bones[this.boneIndex];if(!a.active)return;if(e=s[s.length-te.ENTRIES])o=s[s.length+te.PREV_X]*a.data.scaleX,d=s[s.length+te.PREV_Y]*a.data.scaleY;else{const f=Et.binarySearch(s,e,te.ENTRIES);o=s[f+te.PREV_X],d=s[f+te.PREV_Y];const u=s[f],m=this.getCurvePercent(f/te.ENTRIES-1,1-(e-u)/(s[f+te.PREV_TIME]-u));o=(o+(s[f+te.X]-o)*m)*a.data.scaleX,d=(d+(s[f+te.Y]-d)*m)*a.data.scaleY}if(r==1)h==A.add?(a.scaleX+=o-a.data.scaleX,a.scaleY+=d-a.data.scaleY):(a.scaleX=o,a.scaleY=d);else{let f=0,u=0;if(l==J.mixOut)switch(h){case A.setup:f=a.data.scaleX,u=a.data.scaleY,a.scaleX=f+(Math.abs(o)*C.signum(f)-f)*r,a.scaleY=u+(Math.abs(d)*C.signum(u)-u)*r;break;case A.first:case A.replace:f=a.scaleX,u=a.scaleY,a.scaleX=f+(Math.abs(o)*C.signum(f)-f)*r,a.scaleY=u+(Math.abs(d)*C.signum(u)-u)*r;break;case A.add:f=a.scaleX,u=a.scaleY,a.scaleX=f+(Math.abs(o)*C.signum(f)-a.data.scaleX)*r,a.scaleY=u+(Math.abs(d)*C.signum(u)-a.data.scaleY)*r}else switch(h){case A.setup:f=Math.abs(a.data.scaleX)*C.signum(o),u=Math.abs(a.data.scaleY)*C.signum(d),a.scaleX=f+(o-f)*r,a.scaleY=u+(d-u)*r;break;case A.first:case A.replace:f=Math.abs(a.scaleX)*C.signum(o),u=Math.abs(a.scaleY)*C.signum(d),a.scaleX=f+(o-f)*r,a.scaleY=u+(d-u)*r;break;case A.add:f=C.signum(o),u=C.signum(d),a.scaleX=Math.abs(a.scaleX)*f+(o-Math.abs(a.data.scaleX)*f)*r,a.scaleY=Math.abs(a.scaleY)*u+(d-Math.abs(a.data.scaleY)*u)*r}}}},ee=class extends Jt{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.bones[this.boneIndex];if(!a.active)return;if(e=s[s.length-ee.ENTRIES])o=s[s.length+ee.PREV_X],d=s[s.length+ee.PREV_Y];else{const f=Et.binarySearch(s,e,ee.ENTRIES);o=s[f+ee.PREV_X],d=s[f+ee.PREV_Y];const u=s[f],m=this.getCurvePercent(f/ee.ENTRIES-1,1-(e-u)/(s[f+ee.PREV_TIME]-u));o=o+(s[f+ee.X]-o)*m,d=d+(s[f+ee.Y]-d)*m}switch(h){case A.setup:a.shearX=a.data.shearX+o*r,a.shearY=a.data.shearY+d*r;break;case A.first:case A.replace:a.shearX+=(a.data.shearX+o-a.shearX)*r,a.shearY+=(a.data.shearY+d-a.shearY)*r;break;case A.add:a.shearX+=o*r,a.shearY+=d*r}}};const ft=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t*ft.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,n,e,i,r,h){t*=ft.ENTRIES,this.frames[t]=n,this.frames[t+ft.R]=e,this.frames[t+ft.G]=i,this.frames[t+ft.B]=r,this.frames[t+ft.A]=h}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(!s.bone.active)return;const a=this.frames;if(e=a[a.length-ft.ENTRIES]){const m=a.length;o=a[m+ft.PREV_R],d=a[m+ft.PREV_G],f=a[m+ft.PREV_B],u=a[m+ft.PREV_A]}else{const m=Et.binarySearch(a,e,ft.ENTRIES);o=a[m+ft.PREV_R],d=a[m+ft.PREV_G],f=a[m+ft.PREV_B],u=a[m+ft.PREV_A];const g=a[m],x=this.getCurvePercent(m/ft.ENTRIES-1,1-(e-g)/(a[m+ft.PREV_TIME]-g));o+=(a[m+ft.R]-o)*x,d+=(a[m+ft.G]-d)*x,f+=(a[m+ft.B]-f)*x,u+=(a[m+ft.A]-u)*x}if(r==1)s.color.set(o,d,f,u);else{const m=s.color;h==A.setup&&m.setFromColor(s.data.color),m.add((o-m.r)*r,(d-m.g)*r,(f-m.b)*r,(u-m.a)*r)}}};let Lt=ft;Lt.ENTRIES=5,Lt.PREV_TIME=-5,Lt.PREV_R=-4,Lt.PREV_G=-3,Lt.PREV_B=-2,Lt.PREV_A=-1,Lt.R=1,Lt.G=2,Lt.B=3,Lt.A=4;const nt=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t*nt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,n,e,i,r,h,l,s,a){t*=nt.ENTRIES,this.frames[t]=n,this.frames[t+nt.R]=e,this.frames[t+nt.G]=i,this.frames[t+nt.B]=r,this.frames[t+nt.A]=h,this.frames[t+nt.R2]=l,this.frames[t+nt.G2]=s,this.frames[t+nt.B2]=a}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(!s.bone.active)return;const a=this.frames;if(e=a[a.length-nt.ENTRIES]){const E=a.length;o=a[E+nt.PREV_R],d=a[E+nt.PREV_G],f=a[E+nt.PREV_B],u=a[E+nt.PREV_A],m=a[E+nt.PREV_R2],g=a[E+nt.PREV_G2],x=a[E+nt.PREV_B2]}else{const E=Et.binarySearch(a,e,nt.ENTRIES);o=a[E+nt.PREV_R],d=a[E+nt.PREV_G],f=a[E+nt.PREV_B],u=a[E+nt.PREV_A],m=a[E+nt.PREV_R2],g=a[E+nt.PREV_G2],x=a[E+nt.PREV_B2];const w=a[E],b=this.getCurvePercent(E/nt.ENTRIES-1,1-(e-w)/(a[E+nt.PREV_TIME]-w));o+=(a[E+nt.R]-o)*b,d+=(a[E+nt.G]-d)*b,f+=(a[E+nt.B]-f)*b,u+=(a[E+nt.A]-u)*b,m+=(a[E+nt.R2]-m)*b,g+=(a[E+nt.G2]-g)*b,x+=(a[E+nt.B2]-x)*b}if(r==1)s.color.set(o,d,f,u),s.darkColor.set(m,g,x,1);else{const E=s.color,w=s.darkColor;h==A.setup&&(E.setFromColor(s.data.color),w.setFromColor(s.data.darkColor)),E.add((o-E.r)*r,(d-E.g)*r,(f-E.b)*r,(u-E.a)*r),w.add((m-w.r)*r,(g-w.g)*r,(x-w.b)*r,0)}}};let yt=nt;yt.ENTRIES=8,yt.PREV_TIME=-8,yt.PREV_R=-7,yt.PREV_G=-6,yt.PREV_B=-5,yt.PREV_A=-4,yt.PREV_R2=-3,yt.PREV_G2=-2,yt.PREV_B2=-1,yt.R=1,yt.G=2,yt.B=3,yt.A=4,yt.R2=5,yt.G2=6,yt.B2=7;let en=class{constructor(t){this.frames=v.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,n,e){this.frames[t]=n,this.attachmentNames[t]=e}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(!s.bone.active)return;if(l==J.mixOut){h==A.setup&&this.setAttachment(t,s,s.data.attachmentName);return}const a=this.frames;if(e=a[a.length-1]?o=a.length-1:o=Et.binarySearch(a,e,1)-1;const d=this.attachmentNames[o];t.slots[this.slotIndex].setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}setAttachment(t,n,e){n.setAttachment(e==null?null:t.getAttachment(this.slotIndex,e))}},Vi=null,hs=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t),this.frameVertices=new Array(t),Vi==null&&(Vi=v.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,n,e){this.frames[t]=n,this.frameVertices[t]=e}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(!s.bone.active)return;const a=s.getAttachment();if(!(a instanceof ze)||a.deformAttachment!=this.attachment)return;const o=s.deform;o.length==0&&(h=A.setup);const d=this.frameVertices,f=d[0].length,u=this.frames;if(e=u[u.length-1]){const p=d[u.length-1];if(r==1)if(h==A.add){const S=a;if(S.bones==null){const y=S.vertices;for(let M=0;Me)this.apply(t,n,Number.MAX_VALUE,i,r,h,l),n=-1;else if(n>=s[a-1])return;if(e0&&s[o-1]==d;)o--}for(;o=s[o];o++)i.push(this.events[o])}},xn=class{constructor(t){this.frames=v.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,n,e){this.frames[t]=n,this.drawOrders[t]=e}apply(t,n,e,i,r,h,l){const s=t.drawOrder,a=t.slots;if(l==J.mixOut&&h==A.setup){v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const o=this.frames;if(e=o[o.length-1]?d=o.length-1:d=Et.binarySearch(o,e)-1;const f=this.drawOrders[d];if(f==null)v.arrayCopy(a,0,s,0,a.length);else for(let u=0,m=f.length;u=s[s.length-at.ENTRIES]){h==A.setup?(a.mix=a.data.mix+(s[s.length+at.PREV_MIX]-a.data.mix)*r,a.softness=a.data.softness+(s[s.length+at.PREV_SOFTNESS]-a.data.softness)*r,l==J.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=s[s.length+at.PREV_BEND_DIRECTION],a.compress=s[s.length+at.PREV_COMPRESS]!=0,a.stretch=s[s.length+at.PREV_STRETCH]!=0)):(a.mix+=(s[s.length+at.PREV_MIX]-a.mix)*r,a.softness+=(s[s.length+at.PREV_SOFTNESS]-a.softness)*r,l==J.mixIn&&(a.bendDirection=s[s.length+at.PREV_BEND_DIRECTION],a.compress=s[s.length+at.PREV_COMPRESS]!=0,a.stretch=s[s.length+at.PREV_STRETCH]!=0));return}const o=Et.binarySearch(s,e,at.ENTRIES),d=s[o+at.PREV_MIX],f=s[o+at.PREV_SOFTNESS],u=s[o],m=this.getCurvePercent(o/at.ENTRIES-1,1-(e-u)/(s[o+at.PREV_TIME]-u));h==A.setup?(a.mix=a.data.mix+(d+(s[o+at.MIX]-d)*m-a.data.mix)*r,a.softness=a.data.softness+(f+(s[o+at.SOFTNESS]-f)*m-a.data.softness)*r,l==J.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=s[o+at.PREV_BEND_DIRECTION],a.compress=s[o+at.PREV_COMPRESS]!=0,a.stretch=s[o+at.PREV_STRETCH]!=0)):(a.mix+=(d+(s[o+at.MIX]-d)*m-a.mix)*r,a.softness+=(f+(s[o+at.SOFTNESS]-f)*m-a.softness)*r,l==J.mixIn&&(a.bendDirection=s[o+at.PREV_BEND_DIRECTION],a.compress=s[o+at.PREV_COMPRESS]!=0,a.stretch=s[o+at.PREV_STRETCH]!=0))}};let Ft=at;Ft.ENTRIES=6,Ft.PREV_TIME=-6,Ft.PREV_MIX=-5,Ft.PREV_SOFTNESS=-4,Ft.PREV_BEND_DIRECTION=-3,Ft.PREV_COMPRESS=-2,Ft.PREV_STRETCH=-1,Ft.MIX=1,Ft.SOFTNESS=2,Ft.BEND_DIRECTION=3,Ft.COMPRESS=4,Ft.STRETCH=5;const ut=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t*ut.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,n,e,i,r,h){t*=ut.ENTRIES,this.frames[t]=n,this.frames[t+ut.ROTATE]=e,this.frames[t+ut.TRANSLATE]=i,this.frames[t+ut.SCALE]=r,this.frames[t+ut.SHEAR]=h}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.transformConstraints[this.transformConstraintIndex];if(!a.active)return;if(e=s[s.length-ut.ENTRIES]){const m=s.length;o=s[m+ut.PREV_ROTATE],d=s[m+ut.PREV_TRANSLATE],f=s[m+ut.PREV_SCALE],u=s[m+ut.PREV_SHEAR]}else{const m=Et.binarySearch(s,e,ut.ENTRIES);o=s[m+ut.PREV_ROTATE],d=s[m+ut.PREV_TRANSLATE],f=s[m+ut.PREV_SCALE],u=s[m+ut.PREV_SHEAR];const g=s[m],x=this.getCurvePercent(m/ut.ENTRIES-1,1-(e-g)/(s[m+ut.PREV_TIME]-g));o+=(s[m+ut.ROTATE]-o)*x,d+=(s[m+ut.TRANSLATE]-d)*x,f+=(s[m+ut.SCALE]-f)*x,u+=(s[m+ut.SHEAR]-u)*x}if(h==A.setup){const m=a.data;a.rotateMix=m.rotateMix+(o-m.rotateMix)*r,a.translateMix=m.translateMix+(d-m.translateMix)*r,a.scaleMix=m.scaleMix+(f-m.scaleMix)*r,a.shearMix=m.shearMix+(u-m.shearMix)*r}else a.rotateMix+=(o-a.rotateMix)*r,a.translateMix+=(d-a.translateMix)*r,a.scaleMix+=(f-a.scaleMix)*r,a.shearMix+=(u-a.shearMix)*r}};let _t=ut;_t.ENTRIES=5,_t.PREV_TIME=-5,_t.PREV_ROTATE=-4,_t.PREV_TRANSLATE=-3,_t.PREV_SCALE=-2,_t.PREV_SHEAR=-1,_t.ROTATE=1,_t.TRANSLATE=2,_t.SCALE=3,_t.SHEAR=4;const ue=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t*ue.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,n,e){t*=ue.ENTRIES,this.frames[t]=n,this.frames[t+ue.VALUE]=e}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(e=s[s.length-ue.ENTRIES])o=s[s.length+ue.PREV_VALUE];else{const d=Et.binarySearch(s,e,ue.ENTRIES);o=s[d+ue.PREV_VALUE];const f=s[d],u=this.getCurvePercent(d/ue.ENTRIES-1,1-(e-f)/(s[d+ue.PREV_TIME]-f));o+=(s[d+ue.VALUE]-o)*u}h==A.setup?a.position=a.data.position+(o-a.data.position)*r:a.position+=(o-a.position)*r}};let Te=ue;Te.ENTRIES=2,Te.PREV_TIME=-2,Te.PREV_VALUE=-1,Te.VALUE=1;let ke=class extends Te{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(e=s[s.length-ke.ENTRIES])o=s[s.length+ke.PREV_VALUE];else{const d=Et.binarySearch(s,e,ke.ENTRIES);o=s[d+ke.PREV_VALUE];const f=s[d],u=this.getCurvePercent(d/ke.ENTRIES-1,1-(e-f)/(s[d+ke.PREV_TIME]-f));o+=(s[d+ke.VALUE]-o)*u}h==A.setup?a.spacing=a.data.spacing+(o-a.data.spacing)*r:a.spacing+=(o-a.spacing)*r}};const Ot=class extends Ht{constructor(t){super(t),this.frames=v.newFloatArray(t*Ot.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,n,e,i){t*=Ot.ENTRIES,this.frames[t]=n,this.frames[t+Ot.ROTATE]=e,this.frames[t+Ot.TRANSLATE]=i}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(e=s[s.length-Ot.ENTRIES])o=s[s.length+Ot.PREV_ROTATE],d=s[s.length+Ot.PREV_TRANSLATE];else{const f=Et.binarySearch(s,e,Ot.ENTRIES);o=s[f+Ot.PREV_ROTATE],d=s[f+Ot.PREV_TRANSLATE];const u=s[f],m=this.getCurvePercent(f/Ot.ENTRIES-1,1-(e-u)/(s[f+Ot.PREV_TIME]-u));o+=(s[f+Ot.ROTATE]-o)*m,d+=(s[f+Ot.TRANSLATE]-d)*m}h==A.setup?(a.rotateMix=a.data.rotateMix+(o-a.data.rotateMix)*r,a.translateMix=a.data.translateMix+(d-a.data.translateMix)*r):(a.rotateMix+=(o-a.rotateMix)*r,a.translateMix+=(d-a.translateMix)*r)}};let me=Ot;me.ENTRIES=3,me.PREV_TIME=-3,me.PREV_ROTATE=-2,me.PREV_TRANSLATE=-1,me.ROTATE=1,me.TRANSLATE=2;const mt=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new fs(this),this.propertyIDs=new ns,this.animationsChanged=!1,this.trackEntryPool=new An(()=>new Xn),this.data=t}update(t){t*=this.timeScale;const n=this.tracks;for(let e=0,i=n.length;e0){if(r.delay-=h,r.delay>0)continue;h=-r.delay,r.delay=0}let l=r.next;if(l!=null){const s=r.trackLast-l.delay;if(s>=0){for(l.delay=0,l.trackTime+=r.timeScale==0?0:(s/r.timeScale+t)*l.timeScale,r.trackTime+=h,this.setCurrent(e,l,!0);l.mixingFrom!=null;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){n[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,t)){let s=r.mixingFrom;for(r.mixingFrom=null,s!=null&&(s.mixingTo=null);s!=null;)this.queue.end(s),s=s.mixingFrom}r.trackTime+=h}this.queue.drain()}updateMixingFrom(t,n){const e=t.mixingFrom;if(e==null)return!0;const i=this.updateMixingFrom(e,n);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?((e.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=t),t.interruptAlpha=e.interruptAlpha,this.queue.end(e)),i):(e.trackTime+=n*e.timeScale,t.mixTime+=n,!1)}apply(t){if(t==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const n=this.events,e=this.tracks;let i=!1;for(let l=0,s=e.length;l0)continue;i=!0;const o=l==0?A.first:a.mixBlend;let d=a.alpha;a.mixingFrom!=null?d*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&a.next==null&&(d=0);const f=a.animationLast,u=a.getAnimationTime(),m=a.animation.timelines.length,g=a.animation.timelines;if(l==0&&d==1||o==A.add)for(let x=0;x1&&(r=1),e!=A.first&&(e=i.mixBlend));const h=r0&&this.queueEvents(i,o),this.events.length=0,i.nextAnimationLast=o,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(t,n,e,i,r){const h=n.slots[t.slotIndex];if(!h.bone.active)return;const l=t.frames;if(e=l[l.length-1]?s=l.length-1:s=Et.binarySearch(l,e)-1,this.setAttachment(n,h,t.attachmentNames[s],r)}h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+mt.SETUP)}setAttachment(t,n,e,i){n.setAttachment(e==null?null:t.getAttachment(n.data.index,e)),i&&(n.attachmentState=this.unkeyedState+mt.CURRENT)}applyRotateTimeline(t,n,e,i,r,h,l,s){if(s&&(h[l]=0),i==1){t.apply(n,0,e,null,1,r,J.mixIn);return}const a=t,o=a.frames,d=n.bones[a.boneIndex];if(!d.active)return;let f=0,u=0;if(e=o[o.length-Vt.ENTRIES])u=d.data.rotation+o[o.length+Vt.PREV_ROTATION];else{const x=Et.binarySearch(o,e,Vt.ENTRIES),E=o[x+Vt.PREV_ROTATION],w=o[x],b=a.getCurvePercent((x>>1)-1,1-(e-w)/(o[x+Vt.PREV_TIME]-w));u=o[x+Vt.ROTATION]-E,u-=(16384-(16384.499999999996-u/360|0))*360,u=E+u*b+d.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let m=0,g=u-f;if(g-=(16384-(16384.499999999996-g/360|0))*360,g==0)m=h[l];else{let x=0,E=0;s?(x=0,E=g):(x=h[l],E=h[l+1]);const w=g>0;let b=x>=0;C.signum(E)!=C.signum(g)&&Math.abs(E)<=90&&(Math.abs(x)>180&&(x+=360*C.signum(x)),b=w),m=g+x-x%360,b!=w&&(m+=360*C.signum(x)),h[l]=m}h[l+1]=g,f+=m*i,d.rotation=f-(16384-(16384.499999999996-f/360|0))*360}queueEvents(t,n){const e=t.animationStart,i=t.animationEnd,r=i-e,h=t.trackLast%r,l=this.events;let s=0;const a=l.length;for(;si||this.queue.event(t,d)}let o=!1;for(t.loop?o=r==0||h>t.trackTime%r:o=n>=i&&t.animationLast=this.tracks.length)return;const n=this.tracks[t];if(n==null)return;this.queue.end(n),this.disposeNext(n);let e=n;for(;;){const i=e.mixingFrom;if(i==null)break;this.queue.end(i),e.mixingFrom=null,e.mixingTo=null,e=i}this.tracks[n.trackIndex]=null,this.queue.drain()}setCurrent(t,n,e){const i=this.expandToIndex(t);this.tracks[t]=n,i!=null&&(e&&this.queue.interrupt(i),n.mixingFrom=i,i.mixingTo=n,n.mixTime=0,i.mixingFrom!=null&&i.mixDuration>0&&(n.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(n)}setAnimation(t,n,e){const i=this.data.skeletonData.findAnimation(n);if(i==null)throw new Error(`Animation not found: ${n}`);return this.setAnimationWith(t,i,e)}setAnimationWith(t,n,e){if(n==null)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(t);r!=null&&(r.nextTrackLast==-1?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,i=!1):this.disposeNext(r));const h=this.trackEntry(t,n,e,r);return this.setCurrent(t,h,i),this.queue.drain(),h}addAnimation(t,n,e,i){const r=this.data.skeletonData.findAnimation(n);if(r==null)throw new Error(`Animation not found: ${n}`);return this.addAnimationWith(t,r,e,i)}addAnimationWith(t,n,e,i){if(n==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r!=null)for(;r.next!=null;)r=r.next;const h=this.trackEntry(t,n,e,r);if(r==null)this.setCurrent(t,h,!0),this.queue.drain();else if(r.next=h,i<=0){const l=r.animationEnd-r.animationStart;l!=0?(r.loop?i+=l*(1+(r.trackTime/l|0)):i+=Math.max(l,r.trackTime),i-=this.data.getMix(r.animation,n)):i=r.trackTime}return h.delay=i,h}setEmptyAnimation(t,n){const e=this.setAnimationWith(t,mt.emptyAnimation,!1);return e.mixDuration=n,e.trackEnd=n,e}addEmptyAnimation(t,n,e){e<=0&&(e-=n);const i=this.addAnimationWith(t,mt.emptyAnimation,!1,e);return i.mixDuration=n,i.trackEnd=n,i}setEmptyAnimations(t){const n=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e0){r[s]=mt.HOLD_MIX,h[s]=d;continue t}break}r[s]=mt.HOLD_FIRST}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(t==null)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const n=this.listeners.indexOf(t);n>=0&&this.listeners.splice(n,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(t,n,e){mt.deprecatedWarning1||(mt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,n,e)}addAnimationByName(t,n,e,i){mt.deprecatedWarning2||(mt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,n,e,i)}hasAnimation(t){return this.data.skeletonData.findAnimation(t)!==null}hasAnimationByName(t){return mt.deprecatedWarning3||(mt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let ne=mt;ne.emptyAnimation=new Et("",[],0),ne.SUBSEQUENT=0,ne.FIRST=1,ne.HOLD_SUBSEQUENT=2,ne.HOLD_FIRST=3,ne.HOLD_MIX=4,ne.SETUP=1,ne.CURRENT=2,ne.deprecatedWarning1=!1,ne.deprecatedWarning2=!1,ne.deprecatedWarning3=!1;const Ye=class{constructor(){this.mixBlend=A.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ye.deprecatedWarning1||(Ye.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){Ye.deprecatedWarning1||(Ye.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return Ye.deprecatedWarning2||(Ye.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){Ye.deprecatedWarning2||(Ye.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Xn=Ye;Xn.deprecatedWarning1=!1,Xn.deprecatedWarning2=!1;const ds=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(Gt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Gt.interrupt),this.objects.push(t)}end(t){this.objects.push(Gt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Gt.dispose),this.objects.push(t)}complete(t){this.objects.push(Gt.complete),this.objects.push(t)}event(t,n){this.objects.push(Gt.event),this.objects.push(t),this.objects.push(n)}deprecateStuff(){return ds.deprecatedWarning1||(ds.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const t=this.objects,n=this.animState.listeners;for(let e=0;e(c[c.start=0]="start",c[c.interrupt=1]="interrupt",c[c.end=2]="end",c[c.dispose=3]="dispose",c[c.complete=4]="complete",c[c.event=5]="event",c))(Gt||{});let Pr=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,n){}};const us=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,t==null)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,n,e){const i=this.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);const r=this.skeletonData.findAnimation(n);if(r==null)throw new Error(`Animation not found: ${n}`);this.setMixWith(i,r,e)}setMixByName(t,n,e){us.deprecatedWarning1||(us.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,n,e)}setMixWith(t,n,e){if(t==null)throw new Error("from cannot be null.");if(n==null)throw new Error("to cannot be null.");const i=`${t.name}.${n.name}`;this.animationToMixTime[i]=e}getMix(t,n){const e=`${t.name}.${n.name}`,i=this.animationToMixTime[e];return i===void 0?this.defaultMix:i}};let ms=us;ms.deprecatedWarning1=!1;let gs=class{constructor(t){this.atlas=t}newRegionAttachment(t,n,e){const i=this.atlas.findRegion(e);if(i==null)throw new Error(`Region not found in atlas: ${e} (region attachment: ${n})`);const r=new Q(n);return r.region=i,r}newMeshAttachment(t,n,e){const i=this.atlas.findRegion(e);if(i==null)throw new Error(`Region not found in atlas: ${e} (mesh attachment: ${n})`);const r=new mn(n);return r.region=i,r}newBoundingBoxAttachment(t,n){return new as(n)}newPathAttachment(t,n){return new gn(n)}newPointAttachment(t,n){return new ls(n)}newClippingAttachment(t,n){return new os(n)}},xs=class{constructor(t,n,e){if(this.matrix=new H.Matrix,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=n,this.parent=e,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,n,e,i,r,h,l){this.ax=t,this.ay=n,this.arotation=e,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=l,this.appliedValid=!0;const s=this.parent,a=this.matrix,o=this.skeleton.scaleX,d=zt.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(s==null){const x=this.skeleton,E=e+90+l;a.a=C.cosDeg(e+h)*i*o,a.c=C.cosDeg(E)*r*o,a.b=C.sinDeg(e+h)*i*d,a.d=C.sinDeg(E)*r*d,a.tx=t*o+x.x,a.ty=n*d+x.y;return}let f=s.matrix.a,u=s.matrix.c,m=s.matrix.b,g=s.matrix.d;switch(a.tx=f*t+u*n+s.matrix.tx,a.ty=m*t+g*n+s.matrix.ty,this.data.transformMode){case j.Normal:{const x=e+90+l,E=C.cosDeg(e+h)*i,w=C.cosDeg(x)*r,b=C.sinDeg(e+h)*i,p=C.sinDeg(x)*r;a.a=f*E+u*b,a.c=f*w+u*p,a.b=m*E+g*b,a.d=m*w+g*p;return}case j.OnlyTranslation:{const x=e+90+l;a.a=C.cosDeg(e+h)*i,a.c=C.cosDeg(x)*r,a.b=C.sinDeg(e+h)*i,a.d=C.sinDeg(x)*r;break}case j.NoRotationOrReflection:{let x=f*f+m*m,E=0;x>1e-4?(x=Math.abs(f*g-u*m)/x,f/=this.skeleton.scaleX,m/=this.skeleton.scaleY,u=m*x,g=f*x,E=Math.atan2(m,f)*C.radDeg):(f=0,m=0,E=90-Math.atan2(g,u)*C.radDeg);const w=e+h-E,b=e+l-E+90,p=C.cosDeg(w)*i,S=C.cosDeg(b)*r,y=C.sinDeg(w)*i,M=C.sinDeg(b)*r;a.a=f*p-u*y,a.c=f*S-u*M,a.b=m*p+g*y,a.d=m*S+g*M;break}case j.NoScale:case j.NoScaleOrReflection:{const x=C.cosDeg(e),E=C.sinDeg(e);let w=(f*x+u*E)/o,b=(m*x+g*E)/d,p=Math.sqrt(w*w+b*b);p>1e-5&&(p=1/p),w*=p,b*=p,p=Math.sqrt(w*w+b*b),this.data.transformMode==j.NoScale&&f*g-u*m<0!=(zt.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);const S=Math.PI/2+Math.atan2(b,w),y=Math.cos(S)*p,M=Math.sin(S)*p,T=C.cosDeg(h)*i,k=C.cosDeg(90+l)*r,I=C.sinDeg(h)*i,R=C.sinDeg(90+l)*r;a.a=w*T+y*I,a.c=w*k+y*R,a.b=b*T+M*I,a.d=b*k+M*R;break}}a.a*=o,a.c*=o,a.b*=d,a.d*=d}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*C.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*C.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,n=this.matrix;if(t==null){this.ax=n.tx,this.ay=n.ty,this.arotation=Math.atan2(n.b,n.a)*C.radDeg,this.ascaleX=Math.sqrt(n.a*n.a+n.b*n.b),this.ascaleY=Math.sqrt(n.c*n.c+n.d*n.d),this.ashearX=0,this.ashearY=Math.atan2(n.a*n.c+n.b*n.d,n.a*n.d-n.b*n.c)*C.radDeg;return}const e=t.matrix,i=1/(e.a*e.d-e.b*e.c),r=n.tx-e.tx,h=n.ty-e.ty;this.ax=r*e.d*i-h*e.c*i,this.ay=h*e.a*i-r*e.b*i;const l=i*e.d,s=i*e.a,a=i*e.c,o=i*e.b,d=l*n.a-a*n.b,f=l*n.c-a*n.d,u=s*n.b-o*n.a,m=s*n.d-o*n.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){const g=d*m-f*u;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+u*m,g)*C.radDeg,this.arotation=Math.atan2(u,d)*C.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,f)*C.radDeg}worldToLocal(t){const n=this.matrix,e=n.a,i=n.c,r=n.b,h=n.d,l=1/(e*h-i*r),s=t.x-n.tx,a=t.y-n.ty;return t.x=s*h*l-a*i*l,t.y=a*e*l-s*r*l,t}localToWorld(t){const n=this.matrix,e=t.x,i=t.y;return t.x=e*n.a+i*n.c+n.tx,t.y=e*n.b+i*n.d+n.ty,t}worldToLocalRotation(t){const n=C.sinDeg(t),e=C.cosDeg(t),i=this.matrix;return Math.atan2(i.a*n-i.b*e,i.d*e-i.c*n)*C.radDeg}localToWorldRotation(t){const n=C.sinDeg(t),e=C.cosDeg(t),i=this.matrix;return Math.atan2(e*i.b+n*i.d,e*i.a+n*i.c)*C.radDeg}rotateWorld(t){const n=this.matrix,e=n.a,i=n.c,r=n.b,h=n.d,l=C.cosDeg(t),s=C.sinDeg(t);n.a=l*e-s*r,n.c=l*i-s*h,n.b=s*e+l*r,n.d=s*i+l*h,this.appliedValid=!1}},ps=class{constructor(t,n,e){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=j.Normal,this.skinRequired=!1,this.color=new _,t<0)throw new Error("index must be >= 0.");if(n==null)throw new Error("name cannot be null.");this.index=t,this.name=n,this.parent=e}},Nn=class{constructor(t,n,e){this.name=t,this.order=n,this.skinRequired=e}},ws=class{constructor(t,n){if(n==null)throw new Error("data cannot be null.");this.time=t,this.data=n}},bs=class{constructor(t){this.name=t}},Fi=class{constructor(t,n){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let e=0;e180?u-=360:u<-180&&(u+=360);let x=t.ascaleX,E=t.ascaleY;if(i||r){switch(t.data.transformMode){case j.NoScale:case j.NoScaleOrReflection:m=n-t.worldX,g=e-t.worldY}const w=t.data.length*x,b=Math.sqrt(m*m+g*g);if(i&&bw&&w>1e-4){const p=(b/w-1)*l+1;x*=p,h&&(E*=p)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*l,x,E,t.ashearX,t.ashearY)}apply2(t,n,e,i,r,h,l,s){if(s==0){n.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),n.appliedValid||n.updateAppliedTransform();const a=t.ax,o=t.ay;let d=t.ascaleX,f=d,u=t.ascaleY,m=n.ascaleX;const g=t.matrix;let x=0,E=0,w=0;d<0?(d=-d,x=180,w=-1):(x=0,w=1),u<0&&(u=-u,w=-w),m<0?(m=-m,E=180):E=0;const b=n.ax;let p=0,S=0,y=0,M=g.a,T=g.c,k=g.b,I=g.d;const R=Math.abs(d-u)<=1e-4;R?(p=n.ay,S=M*b+T*p+g.tx,y=k*b+I*p+g.ty):(p=0,S=M*b+g.tx,y=k*b+g.ty);const V=t.parent.matrix;M=V.a,T=V.c,k=V.b,I=V.d;const F=1/(M*I-T*k);let B=S-V.tx,Y=y-V.ty;const N=(B*I-Y*T)*F-a,q=(Y*M-B*k)*F-o,z=Math.sqrt(N*N+q*q);let D=n.data.length*m,X,L;if(z<1e-4){this.apply1(t,e,i,!1,h,!1,s),n.updateWorldTransformWith(b,p,0,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY);return}B=e-V.tx,Y=i-V.ty;let O=(B*I-Y*T)*F-a,W=(Y*M-B*k)*F-o,U=O*O+W*W;if(l!=0){l*=d*(m+1)/2;const lt=Math.sqrt(U),It=lt-z-D*d+l;if(It>0){let ct=Math.min(1,It/(l*2))-1;ct=(It-l*(1-ct*ct))/lt,O-=ct*O,W-=ct*W,U=O*O+W*W}}t:if(R){D*=d;let lt=(U-z*z-D*D)/(2*z*D);lt<-1?lt=-1:lt>1&&(lt=1,h&&(f*=(Math.sqrt(U)/(z+D)-1)*s+1)),L=Math.acos(lt)*r,M=z+D*lt,T=D*Math.sin(L),X=Math.atan2(W*M-O*T,O*M+W*T)}else{M=d*D,T=u*D;const lt=M*M,It=T*T,ct=Math.atan2(W,O);k=It*z*z+lt*U-lt*It;const Xt=-2*It*z,Ut=It-lt;if(I=Xt*Xt-4*Ut*k,I>=0){let ae=Math.sqrt(I);Xt<0&&(ae=-ae),ae=-(Xt+ae)/2;const Ke=ae/Ut,Nt=k/ae,We=Math.abs(Ke)=-1&&k<=1&&(k=Math.acos(k),B=M*Math.cos(k)+z,Y=T*Math.sin(k),I=B*B+Y*Y,I$e&&(Ae=k,$e=I,Ce=B,Kt=Y)),U<=(Oe+$e)/2?(X=ct-Math.atan2(Ve*r,Me),L=de*r):(X=ct-Math.atan2(Kt*r,Ce),L=Ae*r)}const $=Math.atan2(p,b)*w;let G=t.arotation;X=(X-$)*C.radDeg+x-G,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(a,o,G+X*s,f,t.ascaleY,0,0),G=n.arotation,L=((L+$)*C.radDeg-n.ashearX)*w+E-G,L>180?L-=360:L<-180&&(L+=360),n.updateWorldTransformWith(b,p,G+L*s,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}},Es=class extends Nn{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},Ss=class extends Nn{constructor(t){super(t,0,!1),this.bones=new Array}};var vt=(c=>(c[c.Length=0]="Length",c[c.Fixed=1]="Fixed",c[c.Percent=2]="Percent",c))(vt||{});const nn=class{constructor(t,n){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let e=0,i=t.bones.length;e0,r=n>0;if(!i&&!r)return;const h=this.data,l=h.spacingMode,s=l==vt.Length,a=h.rotateMode,o=a==pt.Tangent,d=a==pt.ChainScale,f=this.bones.length,u=o?f:f+1,m=this.bones,g=v.setArraySize(this.spaces,u);let x=null;const E=this.spacing;if(d||s){d&&(x=v.setArraySize(this.lengths,f));for(let M=0,T=u-1;M0?C.degRad:-C.degRad}for(let M=0,T=3;MC.PI?D-=C.PI2:D<-C.PI&&(D+=C.PI2),D*=n,X=Math.cos(D),L=Math.sin(D),I.a=X*Y-L*q,I.c=X*N-L*z,I.b=L*Y+X*q,I.d=L*N+X*z}k.appliedValid=!1}}computeWorldPositions(t,n,e,i,r){const h=this.target;let l=this.position;const s=this.spaces,a=v.setArraySize(this.positions,n*3+2);let o=null;const d=t.closed;let f=t.worldVerticesLength,u=f/6,m=nn.NONE;if(!t.constantSpeed){const D=t.lengths;u-=d?1:2;const X=D[u];if(i&&(l*=X),r)for(let L=0;LX){m!=nn.AFTER&&(m=nn.AFTER,t.computeWorldVertices(h,f-6,4,o,0,2)),this.addAfterPosition($-X,o,0,a,O);continue}for(;;W++){const G=D[W];if(!($>G)){if(W==0)$/=G;else{const lt=D[W-1];$=($-lt)/(G-lt)}break}}W!=m&&(m=W,d&&W==u?(t.computeWorldVertices(h,f-4,4,o,0,2),t.computeWorldVertices(h,0,4,o,4,2)):t.computeWorldVertices(h,W*6+2,8,o,0,2)),this.addCurvePosition($,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,O,e||L>0&&U==0)}return a}d?(f+=2,o=v.setArraySize(this.world,f),t.computeWorldVertices(h,2,f-4,o,0,2),t.computeWorldVertices(h,0,2,o,f-4,2),o[f-2]=o[0],o[f-1]=o[1]):(u--,f-=4,o=v.setArraySize(this.world,f),t.computeWorldVertices(h,2,f,o,0,2));const g=v.setArraySize(this.curves,u);let x=0,E=o[0],w=o[1],b=0,p=0,S=0,y=0,M=0,T=0,k=0,I=0,R=0,V=0,F=0,B=0,Y=0,N=0;for(let D=0,X=2;Dx){this.addAfterPosition(U-x,o,f-4,a,X);continue}for(;;L++){const $=g[L];if(!(U>$)){if(L==0)U/=$;else{const G=g[L-1];U=(U-G)/($-G)}break}}if(L!=m){m=L;let $=L*6;for(E=o[$],w=o[$+1],b=o[$+2],p=o[$+3],S=o[$+4],y=o[$+5],M=o[$+6],T=o[$+7],k=(E-b*2+S)*.03,I=(w-p*2+y)*.03,R=((b-S)*3-E+M)*.006,V=((p-y)*3-w+T)*.006,F=k*2+R,B=I*2+V,Y=(b-E)*.3+k+R*.16666667,N=(p-w)*.3+I+V*.16666667,z=Math.sqrt(Y*Y+N*N),q[0]=z,$=1;$<8;$++)Y+=F,N+=B,F+=R,B+=V,z+=Math.sqrt(Y*Y+N*N),q[$]=z;Y+=F,N+=B,z+=Math.sqrt(Y*Y+N*N),q[8]=z,Y+=F+R,N+=B+V,z+=Math.sqrt(Y*Y+N*N),q[9]=z,O=0}for(U*=z;;O++){const $=q[O];if(!(U>$)){if(O==0)U/=$;else{const G=q[O-1];U=O+(U-G)/($-G)}break}}this.addCurvePosition(U*.1,E,w,b,p,S,y,M,T,a,X,e||D>0&&W==0)}return a}addBeforePosition(t,n,e,i,r){const h=n[e],l=n[e+1],s=n[e+2]-h,a=n[e+3]-l,o=Math.atan2(a,s);i[r]=h+t*Math.cos(o),i[r+1]=l+t*Math.sin(o),i[r+2]=o}addAfterPosition(t,n,e,i,r){const h=n[e+2],l=n[e+3],s=h-n[e],a=l-n[e+1],o=Math.atan2(a,s);i[r]=h+t*Math.cos(o),i[r+1]=l+t*Math.sin(o),i[r+2]=o}addCurvePosition(t,n,e,i,r,h,l,s,a,o,d,f){(t==0||isNaN(t))&&(t=1e-4);const u=t*t,m=u*t,g=1-t,x=g*g,E=x*g,w=g*t,b=w*3,p=g*b,S=b*t,y=n*E+i*p+h*S+s*m,M=e*E+r*p+l*S+a*m;o[d]=y,o[d+1]=M,f&&(o[d+2]=Math.atan2(M-(e*x+r*w*2+l*u),y-(n*x+i*w*2+h*u)))}};let pn=nn;pn.NONE=-1,pn.BEFORE=-2,pn.AFTER=-3,pn.epsilon=1e-5;let Yi=class{constructor(t,n){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new un,this.active=!1,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let e=0;e0?C.degRad:-C.degRad,f=this.data.offsetRotation*d,u=this.data.offsetShearY*d,m=this.bones;for(let g=0,x=m.length;gC.PI?T-=C.PI2:T<-C.PI&&(T+=C.PI2),T*=t;const k=Math.cos(T),I=Math.sin(T);b.a=k*p-I*y,b.c=k*S-I*M,b.b=I*p+k*y,b.d=I*S+k*M,w=!0}if(n!=0){const p=this.temp;r.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),b.tx+=(p.x-b.tx)*n,b.ty+=(p.y-b.ty)*n,w=!0}if(e>0){let p=Math.sqrt(b.a*b.a+b.b*b.b),S=Math.sqrt(l*l+a*a);p>1e-5&&(p=(p+(S-p+this.data.offsetScaleX)*e)/p),b.a*=p,b.b*=p,p=Math.sqrt(b.c*b.c+b.d*b.d),S=Math.sqrt(s*s+o*o),p>1e-5&&(p=(p+(S-p+this.data.offsetScaleY)*e)/p),b.c*=p,b.d*=p,w=!0}if(i>0){const p=b.c,S=b.d,y=Math.atan2(S,p);let M=Math.atan2(o,s)-Math.atan2(a,l)-(y-Math.atan2(b.b,b.a));M>C.PI?M-=C.PI2:M<-C.PI&&(M+=C.PI2),M=y+(M+u)*i;const T=Math.sqrt(p*p+S*S);b.c=Math.cos(M)*T,b.d=Math.sin(M)*T,w=!0}w&&(E.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,n=this.translateMix,e=this.scaleMix,i=this.shearMix,r=this.target,h=r.matrix,l=h.a,s=h.c,a=h.b,o=h.d,d=l*o-s*a>0?C.degRad:-C.degRad,f=this.data.offsetRotation*d,u=this.data.offsetShearY*d,m=this.bones;for(let g=0,x=m.length;gC.PI?T-=C.PI2:T<-C.PI&&(T+=C.PI2),T*=t;const k=Math.cos(T),I=Math.sin(T);b.a=k*p-I*y,b.c=k*S-I*M,b.b=I*p+k*y,b.d=I*S+k*M,w=!0}if(n!=0){const p=this.temp;r.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),b.tx+=p.x*n,b.ty+=p.y*n,w=!0}if(e>0){let p=(Math.sqrt(l*l+a*a)-1+this.data.offsetScaleX)*e+1;b.a*=p,b.b*=p,p=(Math.sqrt(s*s+o*o)-1+this.data.offsetScaleY)*e+1,b.c*=p,b.d*=p,w=!0}if(i>0){let p=Math.atan2(o,s)-Math.atan2(a,l);p>C.PI?p-=C.PI2:p<-C.PI&&(p+=C.PI2);const S=b.c,y=b.d;p=Math.atan2(y,S)+(p-C.PI/2+u)*i;const M=Math.sqrt(S*S+y*y);b.c=Math.cos(p)*M,b.d=Math.sin(p)*M,w=!0}w&&(E.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,n=this.translateMix,e=this.scaleMix,i=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();const h=this.bones;for(let l=0,s=h.length;l0&&(u>1e-5&&(u=(u+(r.ascaleX-u+this.data.offsetScaleX)*e)/u),m>1e-5&&(m=(m+(r.ascaleY-m+this.data.offsetScaleY)*e)/m));const g=a.ashearY;if(i>0){let x=r.ashearY-g+this.data.offsetShearY;x-=(16384-(16384.499999999996-x/360|0))*360,a.shearY+=x*i}a.updateWorldTransformWith(d,f,o,u,m,a.ashearX,g)}}applyRelativeLocal(){const t=this.rotateMix,n=this.translateMix,e=this.scaleMix,i=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();const h=this.bones;for(let l=0,s=h.length;l0&&(u>1e-5&&(u*=(r.ascaleX-1+this.data.offsetScaleX)*e+1),m>1e-5&&(m*=(r.ascaleY-1+this.data.offsetScaleY)*e+1));let g=a.ashearY;i>0&&(g+=(r.ashearY+this.data.offsetShearY)*i),a.updateWorldTransformWith(d,f,o,u,m,a.ashearX,g)}}};const Tn=class{constructor(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,t==null)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let n=0;n1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(t),this.sortReset(i.children),e[e.length-1].sorted=!0}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin!=null&&v.contains(this.skin.constraints,t.data,!0)),!t.active)return;const n=t.target,e=n.data.index,i=n.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,i),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,i);for(let s=0,a=this.data.skins.length;s-1||this.updateCacheReset.push(r)}else for(let i=0;i= 0.");if(n==null)throw new Error("name cannot be null.");if(e==null)throw new Error("boneData cannot be null.");this.index=t,this.name=n,this.boneData=e}},Cs=class extends Nn{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Ts=class{constructor(t,n,e){this.slotIndex=t,this.name=n,this.attachment=e}},Bn=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,n,e){if(e==null)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][n]=e}addSkin(t){for(let e=0;e0){const o=new xn(s),d=n.slots.length;for(let f=0;f=0;b--)g[b]=-1;const x=v.newArray(d-m,0);let E=0,w=0;for(let b=0;b=0;b--)g[b]==-1&&(g[b]=x[--w]);o.setFrame(f,u,g)}e.push(o),r=Math.max(r,o.frames[s-1])}const a=c.readInt(!0);if(a>0){const o=new Yn(a);for(let d=0;d=0;w--)u[w]==-1&&(u[w]=g[--E])}s.setFrame(o++,this.getValue(f,"time",0),u)}r.push(s),h=Math.max(h,s.frames[s.getFrameCount()-1])}if(t.events){const s=new Yn(t.events.length);let a=0;for(let o=0;o>1)*h;const l=t.bone.skeleton,s=t.attachmentVertices;let a=this.vertices;const o=this.bones;if(o==null){s.length>0&&(a=s);const m=t.bone.matrix,g=m.tx,x=m.ty,E=m.a,w=m.c,b=m.b,p=m.d;for(let S=n,y=r;y0&&(n%=this.duration));const a=this.timelines;for(let o=0,d=a.length;o>>1;for(;;){if(t[(h+1)*e]<=n?i=h+1:r=h,i==r)return(i+1)*e;h=i+r>>>1}}static linearSearch(t,n,e){for(let i=0,r=t.length-e;i<=r;i+=e)if(t[i]>n)return i;return-1}};var Oi=(c=>(c[c.rotate=0]="rotate",c[c.translate=1]="translate",c[c.scale=2]="scale",c[c.shear=3]="shear",c[c.attachment=4]="attachment",c[c.color=5]="color",c[c.deform=6]="deform",c[c.event=7]="event",c[c.drawOrder=8]="drawOrder",c[c.ikConstraint=9]="ikConstraint",c[c.transformConstraint=10]="transformConstraint",c[c.pathConstraintPosition=11]="pathConstraintPosition",c[c.pathConstraintSpacing=12]="pathConstraintSpacing",c[c.pathConstraintMix=13]="pathConstraintMix",c[c.twoColor=14]="twoColor",c))(Oi||{});const At=class{constructor(c){if(c<=0)throw new Error(`frameCount must be > 0: ${c}`);this.curves=v.newFloatArray((c-1)*At.BEZIER_SIZE)}getFrameCount(){return this.curves.length/At.BEZIER_SIZE+1}setLinear(c){this.curves[c*At.BEZIER_SIZE]=At.LINEAR}setStepped(c){this.curves[c*At.BEZIER_SIZE]=At.STEPPED}getCurveType(c){const t=c*At.BEZIER_SIZE;if(t==this.curves.length)return At.LINEAR;const n=this.curves[t];return n==At.LINEAR?At.LINEAR:n==At.STEPPED?At.STEPPED:At.BEZIER}setCurve(c,t,n,e,i){const r=(-t*2+e)*.03,h=(-n*2+i)*.03,l=((t-e)*3+1)*.006,s=((n-i)*3+1)*.006;let a=r*2+l,o=h*2+s,d=t*.3+r+l*.16666667,f=n*.3+h+s*.16666667,u=c*At.BEZIER_SIZE;const m=this.curves;m[u++]=At.BEZIER;let g=d,x=f;for(let E=u+At.BEZIER_SIZE-1;u=t){let a,o;return e==l?(a=0,o=0):(a=n[e-2],o=n[e-1]),o+(n[e+1]-o)*(t-a)/(r-a)}const h=n[e-1];return h+(1-h)*(t-r)/(1-r)}};let jt=At;jt.LINEAR=0,jt.STEPPED=1,jt.BEZIER=2,jt.BEZIER_SIZE=10*2-1;const je=class extends jt{constructor(c){super(c),this.frames=v.newFloatArray(c<<1)}getPropertyId(){return(0<<24)+this.boneIndex}setFrame(c,t,n){c<<=1,this.frames[c]=t,this.frames[c+je.ROTATION]=n}apply(c,t,n,e,i,r,h){const l=this.frames,s=c.bones[this.boneIndex];if(n=l[l.length-je.ENTRIES]){let m=l[l.length+je.PREV_ROTATION];switch(r){case A.setup:s.rotation=s.data.rotation+m*i;break;case A.first:case A.replace:m+=s.data.rotation-s.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case A.add:s.rotation+=m*i}return}const a=Ct.binarySearch(l,n,je.ENTRIES),o=l[a+je.PREV_ROTATION],d=l[a],f=this.getCurvePercent((a>>1)-1,1-(n-d)/(l[a+je.PREV_TIME]-d));let u=l[a+je.ROTATION]-o;switch(u=o+(u-(16384-(16384.499999999996-u/360|0))*360)*f,r){case A.setup:s.rotation=s.data.rotation+(u-(16384-(16384.499999999996-u/360|0))*360)*i;break;case A.first:case A.replace:u+=s.data.rotation-s.rotation;case A.add:s.rotation+=(u-(16384-(16384.499999999996-u/360|0))*360)*i}}};let $t=je;$t.ENTRIES=2,$t.PREV_TIME=-2,$t.PREV_ROTATION=-1,$t.ROTATION=1;const Wt=class extends jt{constructor(c){super(c),this.frames=v.newFloatArray(c*Wt.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(c,t,n,e){c*=Wt.ENTRIES,this.frames[c]=t,this.frames[c+Wt.X]=n,this.frames[c+Wt.Y]=e}apply(c,t,n,e,i,r,h){const l=this.frames,s=c.bones[this.boneIndex];if(n=l[l.length-Wt.ENTRIES])a=l[l.length+Wt.PREV_X],o=l[l.length+Wt.PREV_Y];else{const d=Ct.binarySearch(l,n,Wt.ENTRIES);a=l[d+Wt.PREV_X],o=l[d+Wt.PREV_Y];const f=l[d],u=this.getCurvePercent(d/Wt.ENTRIES-1,1-(n-f)/(l[d+Wt.PREV_TIME]-f));a+=(l[d+Wt.X]-a)*u,o+=(l[d+Wt.Y]-o)*u}switch(r){case A.setup:s.x=s.data.x+a*i,s.y=s.data.y+o*i;break;case A.first:case A.replace:s.x+=(s.data.x+a-s.x)*i,s.y+=(s.data.y+o-s.y)*i;break;case A.add:s.x+=a*i,s.y+=o*i}}};let ge=Wt;ge.ENTRIES=3,ge.PREV_TIME=-3,ge.PREV_X=-2,ge.PREV_Y=-1,ge.X=1,ge.Y=2;let le=class extends ge{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.bones[this.boneIndex];if(e=s[s.length-le.ENTRIES])o=s[s.length+le.PREV_X]*a.data.scaleX,d=s[s.length+le.PREV_Y]*a.data.scaleY;else{const f=Ct.binarySearch(s,e,le.ENTRIES);o=s[f+le.PREV_X],d=s[f+le.PREV_Y];const u=s[f],m=this.getCurvePercent(f/le.ENTRIES-1,1-(e-u)/(s[f+le.PREV_TIME]-u));o=(o+(s[f+le.X]-o)*m)*a.data.scaleX,d=(d+(s[f+le.Y]-d)*m)*a.data.scaleY}if(r==1)h==A.add?(a.scaleX+=o-a.data.scaleX,a.scaleY+=d-a.data.scaleY):(a.scaleX=o,a.scaleY=d);else{let f=0,u=0;if(l==J.mixOut)switch(h){case A.setup:f=a.data.scaleX,u=a.data.scaleY,a.scaleX=f+(Math.abs(o)*C.signum(f)-f)*r,a.scaleY=u+(Math.abs(d)*C.signum(u)-u)*r;break;case A.first:case A.replace:f=a.scaleX,u=a.scaleY,a.scaleX=f+(Math.abs(o)*C.signum(f)-f)*r,a.scaleY=u+(Math.abs(d)*C.signum(u)-u)*r;break;case A.add:f=a.scaleX,u=a.scaleY,a.scaleX=f+(Math.abs(o)*C.signum(f)-a.data.scaleX)*r,a.scaleY=u+(Math.abs(d)*C.signum(u)-a.data.scaleY)*r}else switch(h){case A.setup:f=Math.abs(a.data.scaleX)*C.signum(o),u=Math.abs(a.data.scaleY)*C.signum(d),a.scaleX=f+(o-f)*r,a.scaleY=u+(d-u)*r;break;case A.first:case A.replace:f=Math.abs(a.scaleX)*C.signum(o),u=Math.abs(a.scaleY)*C.signum(d),a.scaleX=f+(o-f)*r,a.scaleY=u+(d-u)*r;break;case A.add:f=C.signum(o),u=C.signum(d),a.scaleX=Math.abs(a.scaleX)*f+(o-Math.abs(a.data.scaleX)*f)*r,a.scaleY=Math.abs(a.scaleY)*u+(d-Math.abs(a.data.scaleY)*u)*r}}}},ce=class extends ge{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.bones[this.boneIndex];if(e=s[s.length-ce.ENTRIES])o=s[s.length+ce.PREV_X],d=s[s.length+ce.PREV_Y];else{const f=Ct.binarySearch(s,e,ce.ENTRIES);o=s[f+ce.PREV_X],d=s[f+ce.PREV_Y];const u=s[f],m=this.getCurvePercent(f/ce.ENTRIES-1,1-(e-u)/(s[f+ce.PREV_TIME]-u));o=o+(s[f+ce.X]-o)*m,d=d+(s[f+ce.Y]-d)*m}switch(h){case A.setup:a.shearX=a.data.shearX+o*r,a.shearY=a.data.shearY+d*r;break;case A.first:case A.replace:a.shearX+=(a.data.shearX+o-a.shearX)*r,a.shearY+=(a.data.shearY+d-a.shearY)*r;break;case A.add:a.shearX+=o*r,a.shearY+=d*r}}};const gt=class extends jt{constructor(c){super(c),this.frames=v.newFloatArray(c*gt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(c,t,n,e,i,r){c*=gt.ENTRIES,this.frames[c]=t,this.frames[c+gt.R]=n,this.frames[c+gt.G]=e,this.frames[c+gt.B]=i,this.frames[c+gt.A]=r}apply(c,t,n,e,i,r,h){const l=c.slots[this.slotIndex],s=this.frames;if(n=s[s.length-gt.ENTRIES]){const u=s.length;a=s[u+gt.PREV_R],o=s[u+gt.PREV_G],d=s[u+gt.PREV_B],f=s[u+gt.PREV_A]}else{const u=Ct.binarySearch(s,n,gt.ENTRIES);a=s[u+gt.PREV_R],o=s[u+gt.PREV_G],d=s[u+gt.PREV_B],f=s[u+gt.PREV_A];const m=s[u],g=this.getCurvePercent(u/gt.ENTRIES-1,1-(n-m)/(s[u+gt.PREV_TIME]-m));a+=(s[u+gt.R]-a)*g,o+=(s[u+gt.G]-o)*g,d+=(s[u+gt.B]-d)*g,f+=(s[u+gt.A]-f)*g}if(i==1)l.color.set(a,o,d,f);else{const u=l.color;r==A.setup&&u.setFromColor(l.data.color),u.add((a-u.r)*i,(o-u.g)*i,(d-u.b)*i,(f-u.a)*i)}}};let se=gt;se.ENTRIES=5,se.PREV_TIME=-5,se.PREV_R=-4,se.PREV_G=-3,se.PREV_B=-2,se.PREV_A=-1,se.R=1,se.G=2,se.B=3,se.A=4;const st=class extends jt{constructor(c){super(c),this.frames=v.newFloatArray(c*st.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(c,t,n,e,i,r,h,l,s){c*=st.ENTRIES,this.frames[c]=t,this.frames[c+st.R]=n,this.frames[c+st.G]=e,this.frames[c+st.B]=i,this.frames[c+st.A]=r,this.frames[c+st.R2]=h,this.frames[c+st.G2]=l,this.frames[c+st.B2]=s}apply(c,t,n,e,i,r,h){const l=c.slots[this.slotIndex],s=this.frames;if(n=s[s.length-st.ENTRIES]){const x=s.length;a=s[x+st.PREV_R],o=s[x+st.PREV_G],d=s[x+st.PREV_B],f=s[x+st.PREV_A],u=s[x+st.PREV_R2],m=s[x+st.PREV_G2],g=s[x+st.PREV_B2]}else{const x=Ct.binarySearch(s,n,st.ENTRIES);a=s[x+st.PREV_R],o=s[x+st.PREV_G],d=s[x+st.PREV_B],f=s[x+st.PREV_A],u=s[x+st.PREV_R2],m=s[x+st.PREV_G2],g=s[x+st.PREV_B2];const E=s[x],w=this.getCurvePercent(x/st.ENTRIES-1,1-(n-E)/(s[x+st.PREV_TIME]-E));a+=(s[x+st.R]-a)*w,o+=(s[x+st.G]-o)*w,d+=(s[x+st.B]-d)*w,f+=(s[x+st.A]-f)*w,u+=(s[x+st.R2]-u)*w,m+=(s[x+st.G2]-m)*w,g+=(s[x+st.B2]-g)*w}if(i==1)l.color.set(a,o,d,f),l.darkColor.set(u,m,g,1);else{const x=l.color,E=l.darkColor;r==A.setup&&(x.setFromColor(l.data.color),E.setFromColor(l.data.darkColor)),x.add((a-x.r)*i,(o-x.g)*i,(d-x.b)*i,(f-x.a)*i),E.add((u-E.r)*i,(m-E.g)*i,(g-E.b)*i,0)}}};let Tt=st;Tt.ENTRIES=8,Tt.PREV_TIME=-8,Tt.PREV_R=-7,Tt.PREV_G=-6,Tt.PREV_B=-5,Tt.PREV_A=-4,Tt.PREV_R2=-3,Tt.PREV_G2=-2,Tt.PREV_B2=-1,Tt.R=1,Tt.G=2,Tt.B=3,Tt.A=4,Tt.R2=5,Tt.G2=6,Tt.B2=7;let Dn=class{constructor(t){this.frames=v.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,n,e){this.frames[t]=n,this.attachmentNames[t]=e}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(l==J.mixOut&&h==A.setup){const f=s.data.attachmentName;s.setAttachment(f==null?null:t.getAttachment(this.slotIndex,f));return}const a=this.frames;if(e=a[a.length-1]?o=a.length-1:o=Ct.binarySearch(a,e,1)-1;const d=this.attachmentNames[o];t.slots[this.slotIndex].setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}},$i=null,Wi=class extends jt{constructor(t){super(t),this.frames=v.newFloatArray(t),this.frameVertices=new Array(t),$i==null&&($i=v.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,n,e){this.frames[t]=n,this.frameVertices[t]=e}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex],a=s.getAttachment();if(!(a instanceof Ge)||!a.applyDeform(this.attachment))return;const o=s.attachmentVertices;o.length==0&&(h=A.setup);const d=this.frameVertices,f=d[0].length,u=this.frames;if(e=u[u.length-1]){const p=d[u.length-1];if(r==1)if(h==A.add){const S=a;if(S.bones==null){const y=S.vertices;for(let M=0;Me)this.apply(t,n,Number.MAX_VALUE,i,r,h,l),n=-1;else if(n>=s[a-1])return;if(e0&&s[o-1]==d;)o--}for(;o=s[o];o++)i.push(this.events[o])}},Ln=class{constructor(t){this.frames=v.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,n,e){this.frames[t]=n,this.drawOrders[t]=e}apply(t,n,e,i,r,h,l){const s=t.drawOrder,a=t.slots;if(l==J.mixOut&&h==A.setup){v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const o=this.frames;if(e=o[o.length-1]?d=o.length-1:d=Ct.binarySearch(o,e)-1;const f=this.drawOrders[d];if(f==null)v.arrayCopy(a,0,s,0,a.length);else for(let u=0,m=f.length;u=l[l.length-ht.ENTRIES]){r==A.setup?(s.mix=s.data.mix+(l[l.length+ht.PREV_MIX]-s.data.mix)*i,h==J.mixOut?(s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch):(s.bendDirection=l[l.length+ht.PREV_BEND_DIRECTION],s.compress=l[l.length+ht.PREV_COMPRESS]!=0,s.stretch=l[l.length+ht.PREV_STRETCH]!=0)):(s.mix+=(l[l.length+ht.PREV_MIX]-s.mix)*i,h==J.mixIn&&(s.bendDirection=l[l.length+ht.PREV_BEND_DIRECTION],s.compress=l[l.length+ht.PREV_COMPRESS]!=0,s.stretch=l[l.length+ht.PREV_STRETCH]!=0));return}const a=Ct.binarySearch(l,n,ht.ENTRIES),o=l[a+ht.PREV_MIX],d=l[a],f=this.getCurvePercent(a/ht.ENTRIES-1,1-(n-d)/(l[a+ht.PREV_TIME]-d));r==A.setup?(s.mix=s.data.mix+(o+(l[a+ht.MIX]-o)*f-s.data.mix)*i,h==J.mixOut?(s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch):(s.bendDirection=l[a+ht.PREV_BEND_DIRECTION],s.compress=l[a+ht.PREV_COMPRESS]!=0,s.stretch=l[a+ht.PREV_STRETCH]!=0)):(s.mix+=(o+(l[a+ht.MIX]-o)*f-s.mix)*i,h==J.mixIn&&(s.bendDirection=l[a+ht.PREV_BEND_DIRECTION],s.compress=l[a+ht.PREV_COMPRESS]!=0,s.stretch=l[a+ht.PREV_STRETCH]!=0))}};let ie=ht;ie.ENTRIES=5,ie.PREV_TIME=-5,ie.PREV_MIX=-4,ie.PREV_BEND_DIRECTION=-3,ie.PREV_COMPRESS=-2,ie.PREV_STRETCH=-1,ie.MIX=1,ie.BEND_DIRECTION=2,ie.COMPRESS=3,ie.STRETCH=4;const xt=class extends jt{constructor(c){super(c),this.frames=v.newFloatArray(c*xt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(c,t,n,e,i,r){c*=xt.ENTRIES,this.frames[c]=t,this.frames[c+xt.ROTATE]=n,this.frames[c+xt.TRANSLATE]=e,this.frames[c+xt.SCALE]=i,this.frames[c+xt.SHEAR]=r}apply(c,t,n,e,i,r,h){const l=this.frames,s=c.transformConstraints[this.transformConstraintIndex];if(n=l[l.length-xt.ENTRIES]){const u=l.length;a=l[u+xt.PREV_ROTATE],o=l[u+xt.PREV_TRANSLATE],d=l[u+xt.PREV_SCALE],f=l[u+xt.PREV_SHEAR]}else{const u=Ct.binarySearch(l,n,xt.ENTRIES);a=l[u+xt.PREV_ROTATE],o=l[u+xt.PREV_TRANSLATE],d=l[u+xt.PREV_SCALE],f=l[u+xt.PREV_SHEAR];const m=l[u],g=this.getCurvePercent(u/xt.ENTRIES-1,1-(n-m)/(l[u+xt.PREV_TIME]-m));a+=(l[u+xt.ROTATE]-a)*g,o+=(l[u+xt.TRANSLATE]-o)*g,d+=(l[u+xt.SCALE]-d)*g,f+=(l[u+xt.SHEAR]-f)*g}if(r==A.setup){const u=s.data;s.rotateMix=u.rotateMix+(a-u.rotateMix)*i,s.translateMix=u.translateMix+(o-u.translateMix)*i,s.scaleMix=u.scaleMix+(d-u.scaleMix)*i,s.shearMix=u.shearMix+(f-u.shearMix)*i}else s.rotateMix+=(a-s.rotateMix)*i,s.translateMix+=(o-s.translateMix)*i,s.scaleMix+=(d-s.scaleMix)*i,s.shearMix+=(f-s.shearMix)*i}};let re=xt;re.ENTRIES=5,re.PREV_TIME=-5,re.PREV_ROTATE=-4,re.PREV_TRANSLATE=-3,re.PREV_SCALE=-2,re.PREV_SHEAR=-1,re.ROTATE=1,re.TRANSLATE=2,re.SCALE=3,re.SHEAR=4;const xe=class extends jt{constructor(c){super(c),this.frames=v.newFloatArray(c*xe.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(c,t,n){c*=xe.ENTRIES,this.frames[c]=t,this.frames[c+xe.VALUE]=n}apply(c,t,n,e,i,r,h){const l=this.frames,s=c.pathConstraints[this.pathConstraintIndex];if(n=l[l.length-xe.ENTRIES])a=l[l.length+xe.PREV_VALUE];else{const o=Ct.binarySearch(l,n,xe.ENTRIES);a=l[o+xe.PREV_VALUE];const d=l[o],f=this.getCurvePercent(o/xe.ENTRIES-1,1-(n-d)/(l[o+xe.PREV_TIME]-d));a+=(l[o+xe.VALUE]-a)*f}r==A.setup?s.position=s.data.position+(a-s.data.position)*i:s.position+=(a-s.position)*i}};let Ze=xe;Ze.ENTRIES=2,Ze.PREV_TIME=-2,Ze.PREV_VALUE=-1,Ze.VALUE=1;let Xe=class extends Ze{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,n,e,i,r,h,l){const s=this.frames,a=t.pathConstraints[this.pathConstraintIndex];if(e=s[s.length-Xe.ENTRIES])o=s[s.length+Xe.PREV_VALUE];else{const d=Ct.binarySearch(s,e,Xe.ENTRIES);o=s[d+Xe.PREV_VALUE];const f=s[d],u=this.getCurvePercent(d/Xe.ENTRIES-1,1-(e-f)/(s[d+Xe.PREV_TIME]-f));o+=(s[d+Xe.VALUE]-o)*u}h==A.setup?a.spacing=a.data.spacing+(o-a.data.spacing)*r:a.spacing+=(o-a.spacing)*r}};const qt=class extends jt{constructor(c){super(c),this.frames=v.newFloatArray(c*qt.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(c,t,n,e){c*=qt.ENTRIES,this.frames[c]=t,this.frames[c+qt.ROTATE]=n,this.frames[c+qt.TRANSLATE]=e}apply(c,t,n,e,i,r,h){const l=this.frames,s=c.pathConstraints[this.pathConstraintIndex];if(n=l[l.length-qt.ENTRIES])a=l[l.length+qt.PREV_ROTATE],o=l[l.length+qt.PREV_TRANSLATE];else{const d=Ct.binarySearch(l,n,qt.ENTRIES);a=l[d+qt.PREV_ROTATE],o=l[d+qt.PREV_TRANSLATE];const f=l[d],u=this.getCurvePercent(d/qt.ENTRIES-1,1-(n-f)/(l[d+qt.PREV_TIME]-f));a+=(l[d+qt.ROTATE]-a)*u,o+=(l[d+qt.TRANSLATE]-o)*u}r==A.setup?(s.rotateMix=s.data.rotateMix+(a-s.data.rotateMix)*i,s.translateMix=s.data.translateMix+(o-s.data.translateMix)*i):(s.rotateMix+=(a-s.rotateMix)*i,s.translateMix+=(o-s.translateMix)*i)}};let Ne=qt;Ne.ENTRIES=3,Ne.PREV_TIME=-3,Ne.PREV_ROTATE=-2,Ne.PREV_TRANSLATE=-1,Ne.ROTATE=1,Ne.TRANSLATE=2;const Pt=class{constructor(t){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new Ps(this),this.propertyIDs=new ns,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new An(()=>new _n),this.data=t}update(t){t*=this.timeScale;const n=this.tracks;for(let e=0,i=n.length;e0){if(r.delay-=h,r.delay>0)continue;h=-r.delay,r.delay=0}let l=r.next;if(l!=null){const s=r.trackLast-l.delay;if(s>=0){for(l.delay=0,l.trackTime=r.timeScale==0?0:(s/r.timeScale+t)*l.timeScale,r.trackTime+=h,this.setCurrent(e,l,!0);l.mixingFrom!=null;)l.mixTime+=t,l=l.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){n[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,t)){let s=r.mixingFrom;for(r.mixingFrom=null,s!=null&&(s.mixingTo=null);s!=null;)this.queue.end(s),s=s.mixingFrom}r.trackTime+=h}this.queue.drain()}updateMixingFrom(t,n){const e=t.mixingFrom;if(e==null)return!0;const i=this.updateMixingFrom(e,n);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?((e.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=t),t.interruptAlpha=e.interruptAlpha,this.queue.end(e)),i):(e.trackTime+=n*e.timeScale,t.mixTime+=n,!1)}apply(t){if(t==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const n=this.events,e=this.tracks;let i=!1;for(let r=0,h=e.length;r0)continue;i=!0;const s=r==0?A.first:l.mixBlend;let a=l.alpha;l.mixingFrom!=null?a*=this.applyMixingFrom(l,t,s):l.trackTime>=l.trackEnd&&l.next==null&&(a=0);const o=l.animationLast,d=l.getAnimationTime(),f=l.animation.timelines.length,u=l.animation.timelines;if(r==0&&a==1||s==A.add)for(let m=0;m1&&(r=1),e!=A.first&&(e=i.mixBlend));const h=r0&&this.queueEvents(i,o),this.events.length=0,i.nextAnimationLast=o,i.nextTrackLast=i.trackTime,r}applyRotateTimeline(t,n,e,i,r,h,l,s){if(s&&(h[l]=0),i==1){t.apply(n,0,e,null,1,r,J.mixIn);return}const a=t,o=a.frames,d=n.bones[a.boneIndex];let f=0,u=0;if(e=o[o.length-$t.ENTRIES])u=d.data.rotation+o[o.length+$t.PREV_ROTATION];else{const x=Ct.binarySearch(o,e,$t.ENTRIES),E=o[x+$t.PREV_ROTATION],w=o[x],b=a.getCurvePercent((x>>1)-1,1-(e-w)/(o[x+$t.PREV_TIME]-w));u=o[x+$t.ROTATION]-E,u-=(16384-(16384.499999999996-u/360|0))*360,u=E+u*b+d.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let m=0,g=u-f;if(g-=(16384-(16384.499999999996-g/360|0))*360,g==0)m=h[l];else{let x=0,E=0;s?(x=0,E=g):(x=h[l],E=h[l+1]);const w=g>0;let b=x>=0;C.signum(E)!=C.signum(g)&&Math.abs(E)<=90&&(Math.abs(x)>180&&(x+=360*C.signum(x)),b=w),m=g+x-x%360,b!=w&&(m+=360*C.signum(x)),h[l]=m}h[l+1]=g,f+=m*i,d.rotation=f-(16384-(16384.499999999996-f/360|0))*360}queueEvents(t,n){const e=t.animationStart,i=t.animationEnd,r=i-e,h=t.trackLast%r,l=this.events;let s=0;const a=l.length;for(;si||this.queue.event(t,d)}let o=!1;for(t.loop?o=r==0||h>t.trackTime%r:o=n>=i&&t.animationLast=this.tracks.length)return;const n=this.tracks[t];if(n==null)return;this.queue.end(n),this.disposeNext(n);let e=n;for(;;){const i=e.mixingFrom;if(i==null)break;this.queue.end(i),e.mixingFrom=null,e.mixingTo=null,e=i}this.tracks[n.trackIndex]=null,this.queue.drain()}setCurrent(t,n,e){const i=this.expandToIndex(t);this.tracks[t]=n,i!=null&&(e&&this.queue.interrupt(i),n.mixingFrom=i,i.mixingTo=n,n.mixTime=0,i.mixingFrom!=null&&i.mixDuration>0&&(n.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(n)}setAnimation(t,n,e){const i=this.data.skeletonData.findAnimation(n);if(i==null)throw new Error(`Animation not found: ${n}`);return this.setAnimationWith(t,i,e)}setAnimationWith(t,n,e){if(n==null)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(t);r!=null&&(r.nextTrackLast==-1?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,i=!1):this.disposeNext(r));const h=this.trackEntry(t,n,e,r);return this.setCurrent(t,h,i),this.queue.drain(),h}addAnimation(t,n,e,i){const r=this.data.skeletonData.findAnimation(n);if(r==null)throw new Error(`Animation not found: ${n}`);return this.addAnimationWith(t,r,e,i)}addAnimationWith(t,n,e,i){if(n==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r!=null)for(;r.next!=null;)r=r.next;const h=this.trackEntry(t,n,e,r);if(r==null)this.setCurrent(t,h,!0),this.queue.drain();else if(r.next=h,i<=0){const l=r.animationEnd-r.animationStart;l!=0?(r.loop?i+=l*(1+(r.trackTime/l|0)):i+=Math.max(l,r.trackTime),i-=this.data.getMix(r.animation,n)):i=r.trackTime}return h.delay=i,h}setEmptyAnimation(t,n){const e=this.setAnimationWith(t,Pt.emptyAnimation,!1);return e.mixDuration=n,e.trackEnd=n,e}addEmptyAnimation(t,n,e){e<=0&&(e-=n);const i=this.addAnimationWith(t,Pt.emptyAnimation,!1,e);return i.mixDuration=n,i.trackEnd=n,i}setEmptyAnimations(t){const n=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e0){r[s]=Pt.HOLD_MIX,h[s]=o;continue t}break}r[s]=Pt.HOLD}}}hasTimeline(t,n){const e=t.animation.timelines;for(let i=0,r=e.length;i=this.tracks.length?null:this.tracks[t]}addListener(t){if(t==null)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const n=this.listeners.indexOf(t);n>=0&&this.listeners.splice(n,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(t,n,e){Pt.deprecatedWarning1||(Pt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,n,e)}addAnimationByName(t,n,e,i){Pt.deprecatedWarning2||(Pt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,n,e,i)}hasAnimation(t){return this.data.skeletonData.findAnimation(t)!==null}hasAnimationByName(t){return Pt.deprecatedWarning3||(Pt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let Ie=Pt;Ie.emptyAnimation=new Ct("",[],0),Ie.SUBSEQUENT=0,Ie.FIRST=1,Ie.HOLD=2,Ie.HOLD_MIX=3,Ie.deprecatedWarning1=!1,Ie.deprecatedWarning2=!1,Ie.deprecatedWarning3=!1;const Be=class{constructor(){this.mixBlend=A.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Be.deprecatedWarning1||(Be.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){Be.deprecatedWarning1||(Be.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return Be.deprecatedWarning2||(Be.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){Be.deprecatedWarning2||(Be.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let _n=Be;_n.deprecatedWarning1=!1,_n.deprecatedWarning2=!1;const vs=class{constructor(c){this.objects=[],this.drainDisabled=!1,this.animState=c}start(c){this.objects.push(Zt.start),this.objects.push(c),this.animState.animationsChanged=!0}interrupt(c){this.objects.push(Zt.interrupt),this.objects.push(c)}end(c){this.objects.push(Zt.end),this.objects.push(c),this.animState.animationsChanged=!0}dispose(c){this.objects.push(Zt.dispose),this.objects.push(c)}complete(c){this.objects.push(Zt.complete),this.objects.push(c)}event(c,t){this.objects.push(Zt.event),this.objects.push(c),this.objects.push(t)}deprecateStuff(){return vs.deprecatedWarning1||(vs.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const c=this.objects,t=this.animState.listeners;for(let n=0;n(c[c.start=0]="start",c[c.interrupt=1]="interrupt",c[c.end=2]="end",c[c.dispose=3]="dispose",c[c.complete=4]="complete",c[c.event=5]="event",c))(Zt||{});class Dr{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,n){}}const Vs=class{constructor(c){if(this.animationToMixTime={},this.defaultMix=0,c==null)throw new Error("skeletonData cannot be null.");this.skeletonData=c}setMix(c,t,n){const e=this.skeletonData.findAnimation(c);if(e==null)throw new Error(`Animation not found: ${c}`);const i=this.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(e,i,n)}setMixByName(c,t,n){Vs.deprecatedWarning1||(Vs.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(c,t,n)}setMixWith(c,t,n){if(c==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const e=`${c.name}.${t.name}`;this.animationToMixTime[e]=n}getMix(c,t){const n=`${c.name}.${t.name}`,e=this.animationToMixTime[n];return e===void 0?this.defaultMix:e}};let Fs=Vs;Fs.deprecatedWarning1=!1;let Ui=class{constructor(t){this.atlas=t}newRegionAttachment(t,n,e){const i=this.atlas.findRegion(e);if(i==null)throw new Error(`Region not found in atlas: ${e} (region attachment: ${n})`);const r=new K(n);return r.region=i,r}newMeshAttachment(t,n,e){const i=this.atlas.findRegion(e);if(i==null)throw new Error(`Region not found in atlas: ${e} (mesh attachment: ${n})`);const r=new Is(n);return r.region=i,r}newBoundingBoxAttachment(t,n){return new Ni(n)}newPathAttachment(t,n){return new kn(n)}newPointAttachment(t,n){return new Di(n)}newClippingAttachment(t,n){return new Bi(n)}},Ys=class{constructor(t,n,e){if(this.matrix=new H.Matrix,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!0,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=n,this.parent=e,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,n,e,i,r,h,l){this.ax=t,this.ay=n,this.arotation=e,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=l,this.appliedValid=!0;const s=this.parent,a=this.matrix,o=this.skeleton.scaleX,d=zt.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(s==null){const x=this.skeleton,E=e+90+l;a.a=C.cosDeg(e+h)*i*o,a.c=C.cosDeg(E)*r*o,a.b=C.sinDeg(e+h)*i*d,a.d=C.sinDeg(E)*r*d,a.tx=t*o+x.x,a.ty=n*d+x.y;return}let f=s.matrix.a,u=s.matrix.c,m=s.matrix.b,g=s.matrix.d;switch(a.tx=f*t+u*n+s.matrix.tx,a.ty=m*t+g*n+s.matrix.ty,this.data.transformMode){case j.Normal:{const x=e+90+l,E=C.cosDeg(e+h)*i,w=C.cosDeg(x)*r,b=C.sinDeg(e+h)*i,p=C.sinDeg(x)*r;a.a=f*E+u*b,a.c=f*w+u*p,a.b=m*E+g*b,a.d=m*w+g*p;return}case j.OnlyTranslation:{const x=e+90+l;a.a=C.cosDeg(e+h)*i,a.c=C.cosDeg(x)*r,a.b=C.sinDeg(e+h)*i,a.d=C.sinDeg(x)*r;break}case j.NoRotationOrReflection:{let x=f*f+m*m,E=0;x>1e-4?(x=Math.abs(f*g-u*m)/x,u=m*x,g=f*x,E=Math.atan2(m,f)*C.radDeg):(f=0,m=0,E=90-Math.atan2(g,u)*C.radDeg);const w=e+h-E,b=e+l-E+90,p=C.cosDeg(w)*i,S=C.cosDeg(b)*r,y=C.sinDeg(w)*i,M=C.sinDeg(b)*r;a.a=f*p-u*y,a.c=f*S-u*M,a.b=m*p+g*y,a.d=m*S+g*M;break}case j.NoScale:case j.NoScaleOrReflection:{const x=C.cosDeg(e),E=C.sinDeg(e);let w=(f*x+u*E)/o,b=(m*x+g*E)/d,p=Math.sqrt(w*w+b*b);p>1e-5&&(p=1/p),w*=p,b*=p,p=Math.sqrt(w*w+b*b),this.data.transformMode==j.NoScale&&f*g-u*m<0!=(zt.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);const S=Math.PI/2+Math.atan2(b,w),y=Math.cos(S)*p,M=Math.sin(S)*p,T=C.cosDeg(h)*i,k=C.cosDeg(90+l)*r,I=C.sinDeg(h)*i,R=C.sinDeg(90+l)*r;a.a=w*T+y*I,a.c=w*k+y*R,a.b=b*T+M*I,a.d=b*k+M*R;break}}a.a*=o,a.c*=o,a.b*=d,a.d*=d}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*C.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*C.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,n=this.matrix;if(t==null){this.ax=n.tx,this.ay=n.ty,this.arotation=Math.atan2(n.b,n.a)*C.radDeg,this.ascaleX=Math.sqrt(n.a*n.a+n.b*n.b),this.ascaleY=Math.sqrt(n.c*n.c+n.d*n.d),this.ashearX=0,this.ashearY=Math.atan2(n.a*n.c+n.b*n.d,n.a*n.d-n.b*n.c)*C.radDeg;return}const e=t.matrix,i=1/(e.a*e.d-e.b*e.c),r=n.tx-e.tx,h=n.ty-e.ty;this.ax=r*e.d*i-h*e.c*i,this.ay=h*e.a*i-r*e.b*i;const l=i*e.d,s=i*e.a,a=i*e.c,o=i*e.b,d=l*n.a-a*n.b,f=l*n.c-a*n.d,u=s*n.b-o*n.a,m=s*n.d-o*n.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){const g=d*m-f*u;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+u*m,g)*C.radDeg,this.arotation=Math.atan2(u,d)*C.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,f)*C.radDeg}worldToLocal(t){const n=this.matrix,e=n.a,i=n.c,r=n.b,h=n.d,l=1/(e*h-i*r),s=t.x-n.tx,a=t.y-n.ty;return t.x=s*h*l-a*i*l,t.y=a*e*l-s*r*l,t}localToWorld(t){const n=this.matrix,e=t.x,i=t.y;return t.x=e*n.a+i*n.c+n.tx,t.y=e*n.b+i*n.d+n.ty,t}worldToLocalRotation(t){const n=C.sinDeg(t),e=C.cosDeg(t),i=this.matrix;return Math.atan2(i.a*n-i.b*e,i.d*e-i.c*n)*C.radDeg}localToWorldRotation(t){const n=C.sinDeg(t),e=C.cosDeg(t),i=this.matrix;return Math.atan2(e*i.b+n*i.d,e*i.a+n*i.c)*C.radDeg}rotateWorld(t){const n=this.matrix,e=n.a,i=n.c,r=n.b,h=n.d,l=C.cosDeg(t),s=C.sinDeg(t);n.a=l*e-s*r,n.c=l*i-s*h,n.b=s*e+l*r,n.d=s*i+l*h,this.appliedValid=!1}},zi=class{constructor(t,n,e){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=j.Normal,t<0)throw new Error("index must be >= 0.");if(n==null)throw new Error("name cannot be null.");this.index=t,this.name=n,this.parent=e}},Hi=class{constructor(t,n){if(n==null)throw new Error("data cannot be null.");this.time=t,this.data=n}},Gi=class{constructor(t){this.name=t}},ji=class{constructor(t,n){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let e=0;e180?m-=360:m<-180&&(m+=360);let g=t.ascaleX,x=t.ascaleY;if(i||r){const E=t.data.length*g,w=Math.sqrt(f*f+u*u);if(i&&wE&&E>1e-4){const b=(w/E-1)*l+1;g*=b,h&&(x*=b)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*l,g,x,t.ashearX,t.ashearY)}apply2(t,n,e,i,r,h,l){if(l==0){n.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),n.appliedValid||n.updateAppliedTransform();const s=t.ax,a=t.ay;let o=t.ascaleX,d=o,f=t.ascaleY,u=n.ascaleX;const m=t.matrix;let g=0,x=0,E=0;o<0?(o=-o,g=180,E=-1):(g=0,E=1),f<0&&(f=-f,E=-E),u<0?(u=-u,x=180):x=0;const w=n.ax;let b=0,p=0,S=0,y=m.a,M=m.c,T=m.b,k=m.d;const I=Math.abs(o-f)<=1e-4;I?(b=n.ay,p=y*w+M*b+m.tx,S=T*w+k*b+m.ty):(b=0,p=y*w+m.tx,S=T*w+m.ty);const R=t.parent.matrix;y=R.a,M=R.c,T=R.b,k=R.d;const V=1/(y*k-M*T);let F=e-R.tx,B=i-R.ty;const Y=(F*k-B*M)*V-s,N=(B*y-F*T)*V-a,q=Y*Y+N*N;F=p-R.tx,B=S-R.ty;const z=(F*k-B*M)*V-s,D=(B*y-F*T)*V-a,X=Math.sqrt(z*z+D*D);let L=n.data.length*u,O=0,W=0;t:if(I){L*=o;let G=(q-X*X-L*L)/(2*X*L);G<-1?G=-1:G>1&&(G=1,h&&X+L>1e-4&&(d*=(Math.sqrt(q)/(X+L)-1)*l+1)),W=Math.acos(G)*r,y=X+L*G,M=L*Math.sin(W),O=Math.atan2(N*y-Y*M,Y*y+N*M)}else{y=o*L,M=f*L;const G=y*y,lt=M*M,It=Math.atan2(N,Y);T=lt*X*X+G*q-G*lt;const ct=-2*lt*X,Xt=lt-G;if(k=ct*ct-4*Xt*T,k>=0){let Kt=Math.sqrt(k);ct<0&&(Kt=-Kt),Kt=-(ct+Kt)/2;const ae=Kt/Xt,Ke=T/Kt,Nt=Math.abs(ae)=-1&&T<=1&&(T=Math.acos(T),F=y*Math.cos(T)+X,B=M*Math.sin(T),k=F*F+B*B,kCe&&(Ve=T,Ce=k,Ae=F,$e=B)),q<=(Me+Ce)/2?(O=It-Math.atan2(Oe*r,de),W=Ut*r):(O=It-Math.atan2($e*r,Ae),W=Ve*r)}const U=Math.atan2(b,w)*E;let $=t.arotation;O=(O-U)*C.radDeg+g-$,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(s,a,$+O*l,d,t.ascaleY,0,0),$=n.arotation,W=((W+U)*C.radDeg-n.ashearX)*E+x-$,W>180?W-=360:W<-180&&(W+=360),n.updateWorldTransformWith(w,b,$+W*l,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}},Zi=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},Qi=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var pe=(c=>(c[c.Length=0]="Length",c[c.Fixed=1]="Fixed",c[c.Percent=2]="Percent",c))(pe||{});const rn=class{constructor(t,n){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let e=0,i=t.bones.length;e0,r=n>0;if(!i&&!r)return;const h=this.data,l=h.spacingMode,s=l==pe.Length,a=h.rotateMode,o=a==pt.Tangent,d=a==pt.ChainScale,f=this.bones.length,u=o?f:f+1,m=this.bones,g=v.setArraySize(this.spaces,u);let x=null;const E=this.spacing;if(d||s){d&&(x=v.setArraySize(this.lengths,f));for(let M=0,T=u-1;M0?C.degRad:-C.degRad}for(let M=0,T=3;MC.PI?D-=C.PI2:D<-C.PI&&(D+=C.PI2),D*=n,X=Math.cos(D),L=Math.sin(D),I.a=X*Y-L*q,I.c=X*N-L*z,I.b=L*Y+X*q,I.d=L*N+X*z}k.appliedValid=!1}}computeWorldPositions(t,n,e,i,r){const h=this.target;let l=this.position;const s=this.spaces,a=v.setArraySize(this.positions,n*3+2);let o=null;const d=t.closed;let f=t.worldVerticesLength,u=f/6,m=rn.NONE;if(!t.constantSpeed){const D=t.lengths;u-=d?1:2;const X=D[u];if(i&&(l*=X),r)for(let L=0;LX){m!=rn.AFTER&&(m=rn.AFTER,t.computeWorldVertices(h,f-6,4,o,0,2)),this.addAfterPosition($-X,o,0,a,O);continue}for(;;W++){const G=D[W];if(!($>G)){if(W==0)$/=G;else{const lt=D[W-1];$=($-lt)/(G-lt)}break}}W!=m&&(m=W,d&&W==u?(t.computeWorldVertices(h,f-4,4,o,0,2),t.computeWorldVertices(h,0,4,o,4,2)):t.computeWorldVertices(h,W*6+2,8,o,0,2)),this.addCurvePosition($,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,O,e||L>0&&U==0)}return a}d?(f+=2,o=v.setArraySize(this.world,f),t.computeWorldVertices(h,2,f-4,o,0,2),t.computeWorldVertices(h,0,2,o,f-4,2),o[f-2]=o[0],o[f-1]=o[1]):(u--,f-=4,o=v.setArraySize(this.world,f),t.computeWorldVertices(h,2,f,o,0,2));const g=v.setArraySize(this.curves,u);let x=0,E=o[0],w=o[1],b=0,p=0,S=0,y=0,M=0,T=0,k=0,I=0,R=0,V=0,F=0,B=0,Y=0,N=0;for(let D=0,X=2;Dx){this.addAfterPosition(U-x,o,f-4,a,X);continue}for(;;L++){const $=g[L];if(!(U>$)){if(L==0)U/=$;else{const G=g[L-1];U=(U-G)/($-G)}break}}if(L!=m){m=L;let $=L*6;for(E=o[$],w=o[$+1],b=o[$+2],p=o[$+3],S=o[$+4],y=o[$+5],M=o[$+6],T=o[$+7],k=(E-b*2+S)*.03,I=(w-p*2+y)*.03,R=((b-S)*3-E+M)*.006,V=((p-y)*3-w+T)*.006,F=k*2+R,B=I*2+V,Y=(b-E)*.3+k+R*.16666667,N=(p-w)*.3+I+V*.16666667,z=Math.sqrt(Y*Y+N*N),q[0]=z,$=1;$<8;$++)Y+=F,N+=B,F+=R,B+=V,z+=Math.sqrt(Y*Y+N*N),q[$]=z;Y+=F,N+=B,z+=Math.sqrt(Y*Y+N*N),q[8]=z,Y+=F+R,N+=B+V,z+=Math.sqrt(Y*Y+N*N),q[9]=z,O=0}for(U*=z;;O++){const $=q[O];if(!(U>$)){if(O==0)U/=$;else{const G=q[O-1];U=O+(U-G)/($-G)}break}}this.addCurvePosition(U*.1,E,w,b,p,S,y,M,T,a,X,e||D>0&&W==0)}return a}addBeforePosition(t,n,e,i,r){const h=n[e],l=n[e+1],s=n[e+2]-h,a=n[e+3]-l,o=Math.atan2(a,s);i[r]=h+t*Math.cos(o),i[r+1]=l+t*Math.sin(o),i[r+2]=o}addAfterPosition(t,n,e,i,r){const h=n[e+2],l=n[e+3],s=h-n[e],a=l-n[e+1],o=Math.atan2(a,s);i[r]=h+t*Math.cos(o),i[r+1]=l+t*Math.sin(o),i[r+2]=o}addCurvePosition(t,n,e,i,r,h,l,s,a,o,d,f){(t==0||isNaN(t))&&(t=1e-4);const u=t*t,m=u*t,g=1-t,x=g*g,E=x*g,w=g*t,b=w*3,p=g*b,S=b*t,y=n*E+i*p+h*S+s*m,M=e*E+r*p+l*S+a*m;o[d]=y,o[d+1]=M,f&&(o[d+2]=Math.atan2(M-(e*x+r*w*2+l*u),y-(n*x+i*w*2+h*u)))}getOrder(){return this.data.order}};let wn=rn;wn.NONE=-1,wn.BEFORE=-2,wn.AFTER=-3,wn.epsilon=1e-5;let Ki=class{constructor(t,n){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new un,t==null)throw new Error("data cannot be null.");if(n==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let e=0;e0?C.degRad:-C.degRad,f=this.data.offsetRotation*d,u=this.data.offsetShearY*d,m=this.bones;for(let g=0,x=m.length;gC.PI?T-=C.PI2:T<-C.PI&&(T+=C.PI2),T*=t;const k=Math.cos(T),I=Math.sin(T);b.a=k*p-I*y,b.c=k*S-I*M,b.b=I*p+k*y,b.d=I*S+k*M,w=!0}if(n!=0){const p=this.temp;r.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),b.tx+=(p.x-b.tx)*n,b.ty+=(p.y-b.ty)*n,w=!0}if(e>0){let p=Math.sqrt(b.a*b.a+b.b*b.b),S=Math.sqrt(l*l+a*a);p>1e-5&&(p=(p+(S-p+this.data.offsetScaleX)*e)/p),b.a*=p,b.b*=p,p=Math.sqrt(b.c*b.c+b.d*b.d),S=Math.sqrt(s*s+o*o),p>1e-5&&(p=(p+(S-p+this.data.offsetScaleY)*e)/p),b.c*=p,b.d*=p,w=!0}if(i>0){const p=b.c,S=b.d,y=Math.atan2(S,p);let M=Math.atan2(o,s)-Math.atan2(a,l)-(y-Math.atan2(b.b,b.a));M>C.PI?M-=C.PI2:M<-C.PI&&(M+=C.PI2),M=y+(M+u)*i;const T=Math.sqrt(p*p+S*S);b.c=Math.cos(M)*T,b.d=Math.sin(M)*T,w=!0}w&&(E.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,n=this.translateMix,e=this.scaleMix,i=this.shearMix,r=this.target,h=r.matrix,l=h.a,s=h.c,a=h.b,o=h.d,d=l*o-s*a>0?C.degRad:-C.degRad,f=this.data.offsetRotation*d,u=this.data.offsetShearY*d,m=this.bones;for(let g=0,x=m.length;gC.PI?T-=C.PI2:T<-C.PI&&(T+=C.PI2),T*=t;const k=Math.cos(T),I=Math.sin(T);b.a=k*p-I*y,b.c=k*S-I*M,b.b=I*p+k*y,b.d=I*S+k*M,w=!0}if(n!=0){const p=this.temp;r.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),b.tx+=p.x*n,b.ty+=p.y*n,w=!0}if(e>0){let p=(Math.sqrt(l*l+a*a)-1+this.data.offsetScaleX)*e+1;b.a*=p,b.b*=p,p=(Math.sqrt(s*s+o*o)-1+this.data.offsetScaleY)*e+1,b.c*=p,b.d*=p,w=!0}if(i>0){let p=Math.atan2(o,s)-Math.atan2(a,l);p>C.PI?p-=C.PI2:p<-C.PI&&(p+=C.PI2);const S=b.c,y=b.d;p=Math.atan2(y,S)+(p-C.PI/2+u)*i;const M=Math.sqrt(S*S+y*y);b.c=Math.cos(p)*M,b.d=Math.sin(p)*M,w=!0}w&&(E.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,n=this.translateMix,e=this.scaleMix,i=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();const h=this.bones;for(let l=0,s=h.length;l0&&(u>1e-5&&(u=(u+(r.ascaleX-u+this.data.offsetScaleX)*e)/u),m>1e-5&&(m=(m+(r.ascaleY-m+this.data.offsetScaleY)*e)/m));const g=a.ashearY;if(i>0){let x=r.ashearY-g+this.data.offsetShearY;x-=(16384-(16384.499999999996-x/360|0))*360,a.shearY+=x*i}a.updateWorldTransformWith(d,f,o,u,m,a.ashearX,g)}}applyRelativeLocal(){const t=this.rotateMix,n=this.translateMix,e=this.scaleMix,i=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();const h=this.bones;for(let l=0,s=h.length;l0&&(u>1e-5&&(u*=(r.ascaleX-1+this.data.offsetScaleX)*e+1),m>1e-5&&(m*=(r.ascaleY-1+this.data.offsetScaleY)*e+1));let g=a.ashearY;i>0&&(g+=(r.ashearY+this.data.offsetShearY)*i),a.updateWorldTransformWith(d,f,o,u,m,a.ashearX,g)}}getOrder(){return this.data.order}};const In=class{constructor(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,t==null)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let n=0;n1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(t),this.sortReset(i.children),e[e.length-1].sorted=!0}sortPathConstraint(t){const n=t.target,e=n.data.index,i=n.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,i),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,i);for(let s=0,a=this.data.skins.length;s-1||this.updateCacheReset.push(r)}else for(let i=0;i= 0.");if(n==null)throw new Error("name cannot be null.");if(e==null)throw new Error("boneData cannot be null.");this.index=t,this.name=n,this.boneData=e}},er=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},nr=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,n,e){if(e==null)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][n]=e}getAttachment(t,n){const e=this.attachments[t];return e?e[n]:null}attachAll(t,n){let e=0;for(let i=0;i=0;w--)u[w]==-1&&(u[w]=g[--E])}s.setFrame(o++,f.time,u)}r.push(s),h=Math.max(h,s.frames[s.getFrameCount()-1])}if(t.events){const s=new qi(t.events.length);let a=0;for(let o=0;o>1)*r;const h=c.bone.skeleton,l=c.deform;let s=this.vertices;const a=this.bones;if(!a){l.length>0&&(s=l);const u=c.bone.matrix,m=u.tx,g=u.ty,x=u.a,E=u.c,w=u.b,b=u.d;for(let p=t,S=i;S=this.regions.length&&(n=this.regions.length-1);const e=this.regions[n];t.region!=e&&(t.region=e)}getPath(c,t){let n=c;const e=(this.start+t).toString();for(let i=this.digits-e.length;i>0;i--)n+="0";return n+=e,n}static nextID(){return qn._nextID++}};let Un=qn;Un._nextID=0;var Re=(c=>(c[c.hold=0]="hold",c[c.once=1]="once",c[c.loop=2]="loop",c[c.pingpong=3]="pingpong",c[c.onceReverse=4]="onceReverse",c[c.loopReverse=5]="loopReverse",c[c.pingpongReverse=6]="pingpongReverse",c))(Re||{});const Bs=[0,1,2,3,4,5,6];class zn{constructor(t,n,e){if(this.timelines=[],this.timelineIds=new ss,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(n),this.duration=e}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let n=0;n0&&(n%=this.duration));const a=this.timelines;for(let o=0,d=a.length;on)return i-1;return e-1}static search(t,n,e){const i=t.length;for(let r=e;rn)return r-e;return i-e}}class be extends bt{constructor(t,n,e){super(t,e),this.curves=v.newFloatArray(t+n*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const n=this.getFrameCount()+t*18;if(this.curves.length>n){const e=v.newFloatArray(n);v.arrayCopy(this.curves,0,e,0,n),this.curves=e}}setBezier(t,n,e,i,r,h,l,s,a,o,d){const f=this.curves;let u=this.getFrameCount()+t*18;e==0&&(f[n]=2+u);const m=(i-h*2+s)*.03,g=(r-l*2+a)*.03,x=((h-s)*3-i+o)*.006,E=((l-a)*3-r+d)*.006;let w=m*2+x,b=g*2+E,p=(h-i)*.3+m+x*.16666667,S=(l-r)*.3+g+E*.16666667,y=i+p,M=r+S;for(let T=u+18;ut){const a=this.frames[n],o=this.frames[n+e];return o+(t-a)/(r[i]-a)*(r[i+1]-o)}const h=i+18;for(i+=2;i=t){const a=r[i-2],o=r[i-1];return o+(t-a)/(r[i]-a)*(r[i+1]-o)}n+=this.getFrameEntries();const l=r[h-2],s=r[h-1];return s+(t-l)/(this.frames[n]-l)*(this.frames[n+e]-s)}}class Ee extends be{constructor(t,n,e){super(t,n,[e])}getFrameEntries(){return 2}setFrame(t,n,e){t<<=1,this.frames[t]=n,this.frames[t+1]=e}getCurveValue(t){const n=this.frames;let e=n.length-2;for(let r=2;r<=e;r+=2)if(n[r]>t){e=r-2;break}const i=this.curves[e>>1];switch(i){case 0:const r=n[e],h=n[e+1];return h+(t-r)/(n[e+2]-r)*(n[e+2+1]-h);case 1:return n[e+1]}return this.getBezierValue(t,e,1,i-2)}}class Hn extends be{constructor(t,n,e,i){super(t,n,[e,i])}getFrameEntries(){return 3}setFrame(t,n,e,i){t*=3,this.frames[t]=n,this.frames[t+1]=e,this.frames[t+2]=i}}class Rn extends Ee{constructor(t,n,e){super(t,n,`${ot.rotate}|${e}`),this.boneIndex=0,this.boneIndex=e}apply(t,n,e,i,r,h,l){const s=t.bones[this.boneIndex];if(!s.active)return;const a=this.frames;if(e>2];switch(g){case 0:const x=a[m];d=a[m+1],f=a[m+2],u=a[m+3];const E=(e-x)/(a[m+4]-x);d+=(a[m+4+1]-d)*E,f+=(a[m+4+2]-f)*E,u+=(a[m+4+3]-u)*E;break;case 1:d=a[m+1],f=a[m+2],u=a[m+3];break;default:d=this.getBezierValue(e,m,1,g-2),f=this.getBezierValue(e,m,2,g+18-2),u=this.getBezierValue(e,m,3,g+18*2-2)}if(r==1)o.r=d,o.g=f,o.b=u;else{if(h==A.setup){const x=s.data.color;o.r=x.r,o.g=x.g,o.b=x.b}o.r+=(d-o.r)*r,o.g+=(f-o.g)*r,o.b+=(u-o.b)*r}}}class js extends Ee{constructor(t,n,e){super(t,n,`${ot.alpha}|${e}`),this.slotIndex=0,this.slotIndex=e}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(!s.bone.active)return;const a=s.color;if(e>3];switch(p){case 0:const S=a[b];f=a[b+1],u=a[b+2],m=a[b+3],g=a[b+4],x=a[b+5],E=a[b+6],w=a[b+7];const y=(e-S)/(a[b+8]-S);f+=(a[b+8+1]-f)*y,u+=(a[b+8+2]-u)*y,m+=(a[b+8+3]-m)*y,g+=(a[b+8+4]-g)*y,x+=(a[b+8+5]-x)*y,E+=(a[b+8+6]-E)*y,w+=(a[b+8+7]-w)*y;break;case 1:f=a[b+1],u=a[b+2],m=a[b+3],g=a[b+4],x=a[b+5],E=a[b+6],w=a[b+7];break;default:f=this.getBezierValue(e,b,1,p-2),u=this.getBezierValue(e,b,2,p+18-2),m=this.getBezierValue(e,b,3,p+18*2-2),g=this.getBezierValue(e,b,4,p+18*3-2),x=this.getBezierValue(e,b,5,p+18*4-2),E=this.getBezierValue(e,b,6,p+18*5-2),w=this.getBezierValue(e,b,7,p+18*6-2)}if(r==1)o.set(f,u,m,g),d.r=x,d.g=E,d.b=w;else{if(h==A.setup){o.setFromColor(s.data.color);const S=s.data.darkColor;d.r=S.r,d.g=S.g,d.b=S.b}o.add((f-o.r)*r,(u-o.g)*r,(m-o.b)*r,(g-o.a)*r),d.r+=(x-d.r)*r,d.g+=(E-d.g)*r,d.b+=(w-d.b)*r}}}class Qs extends be{constructor(t,n,e){super(t,n,[`${ot.rgb}|${e}`,`${ot.rgb2}|${e}`]),this.slotIndex=0,this.slotIndex=e}getFrameEntries(){return 7}setFrame(t,n,e,i,r,h,l,s){t*=7,this.frames[t]=n,this.frames[t+1]=e,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=s}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(!s.bone.active)return;const a=this.frames,o=s.color,d=s.darkColor;if(et){const s=this.frames[n];return e[i+1]*(t-s)/(e[i]-s)}const r=i+18;for(i+=2;i=t){const s=e[i-2],a=e[i-1];return a+(t-s)/(e[i]-s)*(e[i+1]-a)}const h=e[r-2],l=e[r-1];return l+(1-l)*(t-h)/(this.frames[n+this.getFrameEntries()]-h)}apply(t,n,e,i,r,h,l){const s=t.slots[this.slotIndex];if(!s.bone.active)return;const a=s.getAttachment();if(!a||!(a instanceof we)||a.timelineAttachment!=this.attachment)return;const o=s.deform;o.length==0&&(h=A.setup);const d=this.vertices,f=d[0].length,u=this.frames;if(e=u[u.length-1]){const w=d[u.length-1];if(r==1)if(h==A.add){const b=a;if(b.bones)for(let p=0;pn)this.apply(c,t,Number.MAX_VALUE,e,i,r,h),t=-1;else if(t>=l[s-1])return;if(n0&&l[a-1]==o;)a--}for(;a=l[a];a++)e.push(this.events[a])}};let vn=rr;vn.propertyIds=[`${ot.event}`];const ar=class extends bt{constructor(c){super(c,ar.propertyIds),this.drawOrders=new Array(c)}getFrameCount(){return this.frames.length}setFrame(c,t,n){this.frames[c]=t,this.drawOrders[c]=n}apply(c,t,n,e,i,r,h){if(h==J.mixOut){r==A.setup&&v.arrayCopy(c.slots,0,c.drawOrder,0,c.slots.length);return}if(n>2];switch(m){case 0:const g=a[u];o=a[u+1],d=a[u+2],f=a[u+3];const x=(e-g)/(a[u+4]-g);o+=(a[u+4+1]-o)*x,d+=(a[u+4+2]-d)*x,f+=(a[u+4+3]-f)*x;break;case 1:o=a[u+1],d=a[u+2],f=a[u+3];break;default:o=this.getBezierValue(e,u,1,m-2),d=this.getBezierValue(e,u,2,m+18-2),f=this.getBezierValue(e,u,3,m+18*2-2)}if(h==A.setup){const g=s.data;s.mixRotate=g.mixRotate+(o-g.mixRotate)*r,s.mixX=g.mixX+(d-g.mixX)*r,s.mixY=g.mixY+(f-g.mixY)*r}else s.mixRotate+=(o-s.mixRotate)*r,s.mixX+=(d-s.mixX)*r,s.mixY+=(f-s.mixY)*r}}const Qe=class extends bt{constructor(c,t,n){super(c,[`${ot.sequence}|${t}|${n.sequence.id}`]),this.slotIndex=t,this.attachment=n}getFrameEntries(){return Qe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(c,t,n,e,i){const r=this.frames;c*=Qe.ENTRIES,r[c]=t,r[c+Qe.MODE]=n|e<<4,r[c+Qe.DELAY]=i}apply(c,t,n,e,i,r,h){const l=c.slots[this.slotIndex];if(!l.bone.active)return;const s=l.attachment,a=this.attachment;if(s!=a&&(!(s instanceof we)||s.timelineAttachment!=a))return;const o=this.frames;if(n>4;const x=this.attachment.sequence.regions.length,E=Bs[u&15];if(E!=Re.hold)switch(g+=(n-f)/m+1e-5|0,E){case Re.once:g=Math.min(x-1,g);break;case Re.loop:g%=x;break;case Re.pingpong:{const w=(x<<1)-2;g=w==0?0:g%w,g>=x&&(g=w-g);break}case Re.onceReverse:g=Math.max(x-1-g,0);break;case Re.loopReverse:g=x-1-g%x;break;case Re.pingpongReverse:{const w=(x<<1)-2;g=w==0?0:(g+x-1)%w,g>=x&&(g=w-g)}}l.sequenceIndex=g}};let bn=Qe;bn.ENTRIES=3,bn.MODE=1,bn.DELAY=2;const ve=class{constructor(c){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new or(this),this.propertyIDs=new ss,this.animationsChanged=!1,this.trackEntryPool=new An(()=>new Gn),this.data=c}static emptyAnimation(){return ve._emptyAnimation}update(c){c*=this.timeScale;const t=this.tracks;for(let n=0,e=t.length;n0){if(i.delay-=r,i.delay>0)continue;r=-i.delay,i.delay=0}let h=i.next;if(h){const l=i.trackLast-h.delay;if(l>=0){for(h.delay=0,h.trackTime+=i.timeScale==0?0:(l/i.timeScale+c)*h.timeScale,i.trackTime+=r,this.setCurrent(n,h,!0);h.mixingFrom;)h.mixTime+=c,h=h.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){t[n]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,c)){let l=i.mixingFrom;for(i.mixingFrom=null,l&&(l.mixingTo=null);l;)this.queue.end(l),l=l.mixingFrom}i.trackTime+=r}this.queue.drain()}updateMixingFrom(c,t){const n=c.mixingFrom;if(!n)return!0;const e=this.updateMixingFrom(n,t);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,c.mixTime>0&&c.mixTime>=c.mixDuration?((n.totalAlpha==0||c.mixDuration==0)&&(c.mixingFrom=n.mixingFrom,n.mixingFrom&&(n.mixingFrom.mixingTo=c),c.interruptAlpha=n.interruptAlpha,this.queue.end(n)),e):(n.trackTime+=t*n.timeScale,c.mixTime+=t,!1)}apply(c){if(!c)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,n=this.tracks;let e=!1;for(let h=0,l=n.length;h0)continue;e=!0;const a=h==0?A.first:s.mixBlend;let o=s.alpha;s.mixingFrom?o*=this.applyMixingFrom(s,c,a):s.trackTime>=s.trackEnd&&!s.next&&(o=0);const d=s.animationLast,f=s.getAnimationTime();let u=f,m=t;s.reverse&&(u=s.animation.duration-u,m=null);const g=s.animation.timelines,x=g.length;if(h==0&&o==1||a==A.add)for(let E=0;E1&&(i=1),n!=A.first&&(n=e.mixBlend));const r=i0&&this.queueEvents(e,f),this.events.length=0,e.nextAnimationLast=f,e.nextTrackLast=e.trackTime,i}applyAttachmentTimeline(c,t,n,e,i){const r=t.slots[c.slotIndex];r.bone.active&&(n0;let E=m>=0;C.signum(g)!=C.signum(u)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*C.signum(m)),E=x),f=u+m-m%360,E!=x&&(f+=360*C.signum(m)),r[h]=f}r[h+1]=u,s.rotation=o+f*e}queueEvents(c,t){const n=c.animationStart,e=c.animationEnd,i=e-n,r=c.trackLast%i,h=this.events;let l=0;const s=h.length;for(;le||this.queue.event(c,o)}let a=!1;for(c.loop?a=i==0||r>c.trackTime%i:a=t>=e&&c.animationLast=this.tracks.length)return;const t=this.tracks[c];if(!t)return;this.queue.end(t),this.clearNext(t);let n=t;for(;;){const e=n.mixingFrom;if(!e)break;this.queue.end(e),n.mixingFrom=null,n.mixingTo=null,n=e}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(c,t,n){const e=this.expandToIndex(c);this.tracks[c]=t,t.previous=null,e&&(n&&this.queue.interrupt(e),t.mixingFrom=e,e.mixingTo=t,t.mixTime=0,e.mixingFrom&&e.mixDuration>0&&(t.interruptAlpha*=Math.min(1,e.mixTime/e.mixDuration)),e.timelinesRotation.length=0),this.queue.start(t)}setAnimation(c,t,n=!1){const e=this.data.skeletonData.findAnimation(t);if(!e)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(c,e,n)}setAnimationWith(c,t,n=!1){if(!t)throw new Error("animation cannot be null.");let e=!0,i=this.expandToIndex(c);i&&(i.nextTrackLast==-1?(this.tracks[c]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,e=!1):this.clearNext(i));const r=this.trackEntry(c,t,n,i);return this.setCurrent(c,r,e),this.queue.drain(),r}addAnimation(c,t,n=!1,e=0){const i=this.data.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(c,i,n,e)}addAnimationWith(c,t,n=!1,e=0){if(!t)throw new Error("animation cannot be null.");let i=this.expandToIndex(c);if(i)for(;i.next;)i=i.next;const r=this.trackEntry(c,t,n,i);return i?(i.next=r,r.previous=i,e<=0&&(e+=i.getTrackComplete()-r.mixDuration)):(this.setCurrent(c,r,!0),this.queue.drain()),r.delay=e,r}setEmptyAnimation(c,t=0){const n=this.setAnimationWith(c,ve.emptyAnimation(),!1);return n.mixDuration=t,n.trackEnd=t,n}addEmptyAnimation(c,t=0,n=0){const e=this.addAnimationWith(c,ve.emptyAnimation(),!1,n);return n<=0&&(e.delay+=e.mixDuration-t),e.mixDuration=t,e.trackEnd=t,e}setEmptyAnimations(c=0){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,e=this.tracks.length;n0){i[l]=Wr,r[l]=o;continue t}break}i[l]=ri}}}getCurrent(c){return c>=this.tracks.length?null:this.tracks[c]}addListener(c){if(!c)throw new Error("listener cannot be null.");this.listeners.push(c)}removeListener(c){const t=this.listeners.indexOf(c);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(c,t,n){ve.deprecatedWarning1||(ve.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(c,t,n)}addAnimationByName(c,t,n,e){ve.deprecatedWarning2||(ve.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(c,t,n,e)}hasAnimation(c){return this.data.skeletonData.findAnimation(c)!==null}hasAnimationByName(c){return ve.deprecatedWarning3||(ve.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(c)}};let En=ve;En._emptyAnimation=new zn("",[],0),En.deprecatedWarning1=!1,En.deprecatedWarning2=!1,En.deprecatedWarning3=!1;const De=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=A.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const c=this.animationEnd-this.animationStart;return c==0?this.animationStart:this.trackTime%c+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(c){this.animationLast=c,this.nextAnimationLast=c}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const c=this.animationEnd-this.animationStart;if(c!=0){if(this.loop)return c*(1+(this.trackTime/c|0));if(this.trackTime(c[c.start=0]="start",c[c.interrupt=1]="interrupt",c[c.end=2]="end",c[c.dispose=3]="dispose",c[c.complete=4]="complete",c[c.event=5]="event",c))(Qt||{});class $r{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,n){}}const ii=0,lr=1,cr=2,ri=3,Wr=4,hr=1,qr=2;class dr{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,n,e){const i=this.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);const r=this.skeletonData.findAnimation(n);if(!r)throw new Error(`Animation not found: ${n}`);this.setMixWith(i,r,e)}setMixWith(t,n,e){if(!t)throw new Error("from cannot be null.");if(!n)throw new Error("to cannot be null.");const i=`${t.name}.${n.name}`;this.animationToMixTime[i]=e}getMix(t,n){const e=`${t.name}.${n.name}`,i=this.animationToMixTime[e];return i===void 0?this.defaultMix:i}}class ai{constructor(t){this.atlas=t}loadSequence(t,n,e){const i=e.regions;for(let r=0,h=i.length;r1e-4?(x=Math.abs(f*g-u*m)/x,f/=o,m/=d,u=m*x,g=f*x,E=Math.atan2(m,f)*C.radDeg):(f=0,m=0,E=90-Math.atan2(g,u)*C.radDeg);const w=e+h-E,b=e+l-E+90,p=C.cosDeg(w)*i,S=C.cosDeg(b)*r,y=C.sinDeg(w)*i,M=C.sinDeg(b)*r;a.a=f*p-u*y,a.c=f*S-u*M,a.b=m*p+g*y,a.d=m*S+g*M;break}case j.NoScale:case j.NoScaleOrReflection:{const x=C.cosDeg(e),E=C.sinDeg(e);let w=(f*x+u*E)/o,b=(m*x+g*E)/d,p=Math.sqrt(w*w+b*b);p>1e-5&&(p=1/p),w*=p,b*=p,p=Math.sqrt(w*w+b*b),this.data.transformMode==j.NoScale&&f*g-u*m<0!=(o<0!=d<0)&&(p=-p);const S=Math.PI/2+Math.atan2(b,w),y=Math.cos(S)*p,M=Math.sin(S)*p,T=C.cosDeg(h)*i,k=C.cosDeg(90+l)*r,I=C.sinDeg(h)*i,R=C.sinDeg(90+l)*r;a.a=w*T+y*I,a.c=w*k+y*R,a.b=b*T+M*I,a.d=b*k+M*R;break}}a.a*=o,a.c*=o,a.b*=d,a.d*=d}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*C.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*C.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.b*t.b)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.c*t.c+t.d*t.d)}updateAppliedTransform(){const t=this.parent,n=this.matrix;if(!t){this.ax=n.tx-this.skeleton.x,this.ay=n.ty-this.skeleton.y,this.arotation=Math.atan2(n.b,n.a)*C.radDeg,this.ascaleX=Math.sqrt(n.a*n.a+n.b*n.b),this.ascaleY=Math.sqrt(n.c*n.c+n.d*n.d),this.ashearX=0,this.ashearY=Math.atan2(n.a*n.c+n.b*n.d,n.a*n.d-n.b*n.c)*C.radDeg;return}const e=t.matrix,i=1/(e.a*e.d-e.b*e.c),r=n.tx-e.tx,h=n.ty-e.ty;this.ax=r*e.d*i-h*e.c*i,this.ay=h*e.a*i-r*e.b*i;const l=i*e.d,s=i*e.a,a=i*e.c,o=i*e.b,d=l*n.a-a*n.b,f=l*n.c-a*n.d,u=s*n.b-o*n.a,m=s*n.d-o*n.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+u*u),this.ascaleX>1e-4){const g=d*m-f*u;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+u*m,g)*C.radDeg,this.arotation=Math.atan2(u,d)*C.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,f)*C.radDeg}worldToLocal(t){const n=this.matrix,e=n.a,i=n.c,r=n.b,h=n.d,l=1/(e*h-i*r),s=t.x-n.tx,a=t.y-n.ty;return t.x=s*h*l-a*i*l,t.y=a*e*l-s*r*l,t}localToWorld(t){const n=this.matrix,e=t.x,i=t.y;return t.x=e*n.a+i*n.c+n.tx,t.y=e*n.b+i*n.d+n.ty,t}worldToLocalRotation(t){const n=C.sinDeg(t),e=C.cosDeg(t),i=this.matrix;return Math.atan2(i.a*n-i.b*e,i.d*e-i.c*n)*C.radDeg}localToWorldRotation(t){t-=this.rotation-this.shearX;const n=C.sinDeg(t),e=C.cosDeg(t),i=this.matrix;return Math.atan2(e*i.b+n*i.d,e*i.a+n*i.c)*C.radDeg}rotateWorld(t){const n=this.matrix,e=n.a,i=n.c,r=n.b,h=n.d,l=C.cosDeg(t),s=C.sinDeg(t);n.a=l*e-s*r,n.c=l*i-s*h,n.b=s*e+l*r,n.d=s*i+l*h}}class li{constructor(t,n,e){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=j.Normal,this.skinRequired=!1,this.color=new _,t<0)throw new Error("index must be >= 0.");if(!n)throw new Error("name cannot be null.");this.index=t,this.name=n,this.parent=e}}class jn{constructor(t,n,e){this.name=t,this.order=n,this.skinRequired=e}}class ci{constructor(t,n){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!n)throw new Error("data cannot be null.");this.time=t,this.data=n}}class hi{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class fr{constructor(t,n){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let i=0;i180?u-=360:u<-180&&(u+=360);let w=t.ascaleX,b=t.ascaleY;if(i||r){switch(t.data.transformMode){case j.NoScale:case j.NoScaleOrReflection:m=n-t.worldX,g=e-t.worldY}const p=t.data.length*w,S=Math.sqrt(m*m+g*g);if(i&&Sp&&p>1e-4){const y=(S/p-1)*l+1;w*=y,h&&(b*=y)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*l,w,b,t.ashearX,t.ashearY)}apply2(t,n,e,i,r,h,l,s,a){const o=t.ax,d=t.ay;let f=t.ascaleX,u=t.ascaleY,m=f,g=u,x=n.ascaleX;const E=t.matrix;let w=0,b=0,p=0;f<0?(f=-f,w=180,p=-1):(w=0,p=1),u<0&&(u=-u,p=-p),x<0?(x=-x,b=180):b=0;const S=n.ax;let y=0,M=0,T=0,k=E.a,I=E.c,R=E.b,V=E.d;const F=Math.abs(f-u)<=1e-4;!F||h?(y=0,M=k*S+E.tx,T=R*S+E.ty):(y=n.ay,M=k*S+I*y+E.tx,T=R*S+V*y+E.ty);const B=t.parent.matrix;if(!B)throw new Error("IK parent must itself have a parent.");k=B.a,I=B.c,R=B.b,V=B.d;const Y=1/(k*V-I*R);let N=M-B.tx,q=T-B.ty;const z=(N*V-q*I)*Y-o,D=(q*k-N*R)*Y-d,X=Math.sqrt(z*z+D*D);let L=n.data.length*x,O,W;if(X<1e-4){this.apply1(t,e,i,!1,h,!1,a),n.updateWorldTransformWith(S,y,0,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY);return}N=e-B.tx,q=i-B.ty;let U=(N*V-q*I)*Y-o,$=(q*k-N*R)*Y-d,G=U*U+$*$;if(s!=0){s*=f*(x+1)*.5;const ct=Math.sqrt(G),Xt=ct-X-L*f+s;if(Xt>0){let Ut=Math.min(1,Xt/(s*2))-1;Ut=(Xt-s*(1-Ut*Ut))/ct,U-=Ut*U,$-=Ut*$,G=U*U+$*$}}t:if(F){L*=f;let ct=(G-X*X-L*L)/(2*X*L);ct<-1?(ct=-1,W=Math.PI*r):ct>1?(ct=1,W=0,h&&(k=(Math.sqrt(G)/(X+L)-1)*a+1,m*=k,l&&(g*=k))):W=Math.acos(ct)*r,k=X+L*ct,I=L*Math.sin(W),O=Math.atan2($*k-U*I,U*k+$*I)}else{k=f*L,I=u*L;const ct=k*k,Xt=I*I,Ut=Math.atan2($,U);R=Xt*X*X+ct*G-ct*Xt;const de=-2*Xt*X,Me=Xt-ct;if(V=de*de-4*Me*R,V>=0){let Nt=Math.sqrt(V);de<0&&(Nt=-Nt),Nt=-(de+Nt)*.5;const We=Nt/Me,pr=R/Nt,yn=Math.abs(We)=-1&&R<=1&&(R=Math.acos(R),N=k*Math.cos(R)+X,q=I*Math.sin(R),V=N*N+q*q,Vae&&($e=R,ae=V,Kt=N,Ke=q)),G<=(Ae+ae)*.5?(O=Ut-Math.atan2(Ce*r,Ve),W=Oe*r):(O=Ut-Math.atan2(Ke*r,Kt),W=$e*r)}const lt=Math.atan2(y,S)*p;let It=t.arotation;O=(O-lt)*C.radDeg+w-It,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(o,d,It+O*a,m,g,0,0),It=n.arotation,W=((W+lt)*C.radDeg-n.ashearX)*p+b-It,W>180?W-=360:W<-180&&(W+=360),n.updateWorldTransformWith(S,y,It+W*a,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}}class di extends jn{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class fi extends jn{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=dt.Fixed,this.spacingMode=kt.Fixed,this.rotateMode=pt.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var kt=(c=>(c[c.Length=0]="Length",c[c.Fixed=1]="Fixed",c[c.Percent=2]="Percent",c[c.Proportional=3]="Proportional",c))(kt||{});const Le=class{constructor(c,t){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!c)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=c,this.bones=new Array;for(let e=0,i=c.bones.length;e0){w=a/w*f;for(let p=1;p0?C.degRad:-C.degRad}for(let w=0,b=3;w0){const I=S.a,R=S.c,V=S.b,F=S.d;let B=0,Y=0,N=0;if(r?B=u[b-1]:o[w+1]==0?B=u[b+2]:B=Math.atan2(k,T),B-=Math.atan2(V,I),E){Y=Math.cos(B),N=Math.sin(B);const q=p.data.length;m+=(q*(Y*I-N*V)-T)*t,g+=(q*(N*I+Y*V)-k)*t}else B+=x;B>C.PI?B-=C.PI2:B<-C.PI&&(B+=C.PI2),B*=t,Y=Math.cos(B),N=Math.sin(B),S.a=Y*I-N*V,S.c=Y*R-N*F,S.b=N*I+Y*V,S.d=N*R+Y*F}p.updateAppliedTransform()}}computeWorldPositions(c,t,n){const e=this.target;let i=this.position;const r=this.spaces,h=v.setArraySize(this.positions,t*3+2);let l=this.world;const s=c.closed;let a=c.worldVerticesLength,o=a/6,d=Le.NONE;if(!c.constantSpeed){const q=c.lengths;o-=s?1:2;const z=q[o];this.data.positionMode==dt.Percent&&(i*=z);let D;switch(this.data.spacingMode){case kt.Percent:D=z;break;case kt.Proportional:D=z/t;break;default:D=1}l=v.setArraySize(this.world,8);for(let X=0,L=0,O=0;Xz){d!=Le.AFTER&&(d=Le.AFTER,c.computeWorldVertices(e,a-6,4,l,0,2)),this.addAfterPosition(U-z,l,0,h,L);continue}for(;;O++){const $=q[O];if(!(U>$)){if(O==0)U/=$;else{const G=q[O-1];U=(U-G)/($-G)}break}}O!=d&&(d=O,s&&O==o?(c.computeWorldVertices(e,a-4,4,l,0,2),c.computeWorldVertices(e,0,4,l,4,2)):c.computeWorldVertices(e,O*6+2,8,l,0,2)),this.addCurvePosition(U,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],h,L,n||X>0&&W==0)}return h}s?(a+=2,l=v.setArraySize(this.world,a),c.computeWorldVertices(e,2,a-4,l,0,2),c.computeWorldVertices(e,0,2,l,a-4,2),l[a-2]=l[0],l[a-1]=l[1]):(o--,a-=4,l=v.setArraySize(this.world,a),c.computeWorldVertices(e,2,a,l,0,2));const f=v.setArraySize(this.curves,o);let u=0,m=l[0],g=l[1],x=0,E=0,w=0,b=0,p=0,S=0,y=0,M=0,T=0,k=0,I=0,R=0,V=0,F=0;for(let q=0,z=2;qu){this.addAfterPosition(O-u,l,a-4,h,z);continue}for(;;D++){const W=f[D];if(!(O>W)){if(D==0)O/=W;else{const U=f[D-1];O=(O-U)/(W-U)}break}}if(D!=d){d=D;let W=D*6;for(m=l[W],g=l[W+1],x=l[W+2],E=l[W+3],w=l[W+4],b=l[W+5],p=l[W+6],S=l[W+7],y=(m-x*2+w)*.03,M=(g-E*2+b)*.03,T=((x-w)*3-m+p)*.006,k=((E-b)*3-g+S)*.006,I=y*2+T,R=M*2+k,V=(x-m)*.3+y+T*.16666667,F=(E-g)*.3+M+k*.16666667,N=Math.sqrt(V*V+F*F),Y[0]=N,W=1;W<8;W++)V+=I,F+=R,I+=T,R+=k,N+=Math.sqrt(V*V+F*F),Y[W]=N;V+=I,F+=R,N+=Math.sqrt(V*V+F*F),Y[8]=N,V+=I+T,F+=R+k,N+=Math.sqrt(V*V+F*F),Y[9]=N,X=0}for(O*=N;;X++){const W=Y[X];if(!(O>W)){if(X==0)O/=W;else{const U=Y[X-1];O=X+(O-U)/(W-U)}break}}this.addCurvePosition(O*.1,m,g,x,E,w,b,p,S,h,z,n||q>0&&L==0)}return h}addBeforePosition(c,t,n,e,i){const r=t[n],h=t[n+1],l=t[n+2]-r,s=t[n+3]-h,a=Math.atan2(s,l);e[i]=r+c*Math.cos(a),e[i+1]=h+c*Math.sin(a),e[i+2]=a}addAfterPosition(c,t,n,e,i){const r=t[n+2],h=t[n+3],l=r-t[n],s=h-t[n+1],a=Math.atan2(s,l);e[i]=r+c*Math.cos(a),e[i+1]=h+c*Math.sin(a),e[i+2]=a}addCurvePosition(c,t,n,e,i,r,h,l,s,a,o,d){if(c==0||isNaN(c)){a[o]=t,a[o+1]=n,a[o+2]=Math.atan2(i-n,e-t);return}const f=c*c,u=f*c,m=1-c,g=m*m,x=g*m,E=m*c,w=E*3,b=m*w,p=w*c,S=t*x+e*b+r*p+l*u,y=n*x+i*b+h*p+s*u;a[o]=S,a[o+1]=y,d&&(c<.001?a[o+2]=Math.atan2(i-n,e-t):a[o+2]=Math.atan2(y-(n*g+i*E*2+h*f),S-(t*g+e*E*2+r*f)))}};let Sn=Le;Sn.NONE=-1,Sn.BEFORE=-2,Sn.AFTER=-3,Sn.epsilon=1e-5;class ur{constructor(t,n){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!n)throw new Error("bone cannot be null.");this.data=t,this.bone=n,this.color=new _,this.darkColor=t.darkColor?new _:null,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof we)||!(this.attachment instanceof we)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class mr{constructor(t,n){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new un,this.active=!1,!t)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=t,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY,this.bones=new Array;for(let i=0;i0?C.degRad:-C.degRad,g=this.data.offsetRotation*m,x=this.data.offsetShearY*m,E=this.bones;for(let w=0,b=E.length;wC.PI?I-=C.PI2:I<-C.PI&&(I+=C.PI2),I*=t;const R=Math.cos(I),V=Math.sin(I);S.a=R*y-V*T,S.c=R*M-V*k,S.b=V*y+R*T,S.d=V*M+R*k}if(l){const y=this.temp;s.localToWorld(y.set(this.data.offsetX,this.data.offsetY)),S.tx+=(y.x-S.tx)*n,S.ty+=(y.y-S.ty)*e}if(i!=0){let y=Math.sqrt(S.a*S.a+S.b*S.b);y!=0&&(y=(y+(Math.sqrt(o*o+f*f)-y+this.data.offsetScaleX)*i)/y),S.a*=y,S.b*=y}if(r!=0){let y=Math.sqrt(S.c*S.c+S.d*S.d);y!=0&&(y=(y+(Math.sqrt(d*d+u*u)-y+this.data.offsetScaleY)*r)/y),S.c*=y,S.d*=y}if(h>0){const y=S.c,M=S.d,T=Math.atan2(M,y);let k=Math.atan2(u,d)-Math.atan2(f,o)-(T-Math.atan2(S.b,S.a));k>C.PI?k-=C.PI2:k<-C.PI&&(k+=C.PI2),k=T+(k+x)*h;const I=Math.sqrt(y*y+M*M);S.c=Math.cos(k)*I,S.d=Math.sin(k)*I}p.updateAppliedTransform()}}applyRelativeWorld(){const t=this.mixRotate,n=this.mixX,e=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=n!=0||e!=0,s=this.target,a=s.matrix,o=a.a,d=a.c,f=a.b,u=a.d,m=o*u-d*f>0?C.degRad:-C.degRad,g=this.data.offsetRotation*m,x=this.data.offsetShearY*m,E=this.bones;for(let w=0,b=E.length;wC.PI?I-=C.PI2:I<-C.PI&&(I+=C.PI2),I*=t;const R=Math.cos(I),V=Math.sin(I);S.a=R*y-V*T,S.c=R*M-V*k,S.b=V*y+R*T,S.d=V*M+R*k}if(l){const y=this.temp;s.localToWorld(y.set(this.data.offsetX,this.data.offsetY)),S.tx+=y.x*n,S.ty+=y.y*e}if(i!=0){const y=(Math.sqrt(o*o+f*f)-1+this.data.offsetScaleX)*i+1;S.a*=y,S.b*=y}if(r!=0){const y=(Math.sqrt(d*d+u*u)-1+this.data.offsetScaleY)*r+1;S.c*=y,S.d*=y}if(h>0){let y=Math.atan2(u,d)-Math.atan2(f,o);y>C.PI?y-=C.PI2:y<-C.PI&&(y+=C.PI2);const M=S.c,T=S.d;y=Math.atan2(T,M)+(y-C.PI/2+x)*h;const k=Math.sqrt(M*M+T*T);S.c=Math.cos(y)*k,S.d=Math.sin(y)*k}p.updateAppliedTransform()}}applyAbsoluteLocal(){const t=this.mixRotate,n=this.mixX,e=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,s=this.bones;for(let a=0,o=s.length;a= 0.");if(!n)throw new Error("name cannot be null.");if(!e)throw new Error("boneData cannot be null.");this.index=t,this.name=n,this.boneData=e}}class xi extends jn{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class pi{constructor(t,n,e){this.slotIndex=t,this.name=n,this.attachment=e}}class Zn{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,n,e){if(!e)throw new Error("attachment cannot be null.");const i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][n]=e}addSkin(t){for(let e=0;e>4,t.readFloat())}i.push(y);break}}}}}const h=t.readInt(!0);if(h>0){const a=new hn(h),o=e.slots.length;for(let d=0;d=0;w--)m[w]=-1;const g=v.newArray(o-u,0);let x=0,E=0;for(let w=0;w=0;w--)m[w]==-1&&(m[w]=g[--E]);a.setFrame(d,f,m)}i.push(a)}const l=t.readInt(!0);if(l>0){const a=new vn(l);for(let o=0;o=0;E--)f[E]==-1&&(f[E]=m[--x])}l.setFrame(a,P(d,"time",0),f)}r.push(l)}if(t.events){const l=new vn(t.events.length);let s=0;for(let a=0;a(c[c.UNKNOWN=0]="UNKNOWN",c[c.VER37=37]="VER37",c[c.VER38=38]="VER38",c[c.VER40=40]="VER40",c[c.VER41=41]="VER41",c))(he||{});function Kn(c){const t=c.substr(0,3),n=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:n<37?37:0}class ga{constructor(){this.scale=1}readSkeletonData(t,n){let e=null,i=this.readVersionOldFormat(n),r=Kn(i);if(r===he.VER38&&(e=new Mt(new gs(t))),i=this.readVersionNewFormat(n),r=Kn(i),(r===he.VER40||r===he.VER41)&&(e=new wi(new ai(t))),!e){const h=`Unsupported version of spine model ${i}, please update pixi-spine`;console.error(h)}return e.scale=this.scale,e.readSkeletonData(n)}readVersionOldFormat(t){const n=new Mn(t);let e;try{n.readString(),e=n.readString()}catch(i){e=""}return e||""}readVersionNewFormat(t){const n=new Mn(t);n.readInt32(),n.readInt32();let e;try{e=n.readString()}catch(i){e=""}return e||""}}class xa{constructor(){this.scale=1}readSkeletonData(t,n){const e=n.skeleton.spine,i=Kn(e);let r=null;if(i===he.VER37&&(r=new an(new Ui(t))),i===he.VER38&&(r=new sn(new gs(t))),(i===he.VER40||i===he.VER41)&&(r=new Qn(new ai(t))),!r){const h=`Unsupported version of spine model ${e}, please update pixi-spine`;console.error(h)}return r.scale=this.scale,r.readSkeletonData(n)}}class pa extends Rr{createBinaryParser(){return new ga}createJsonParser(){return new xa}parseData(t,n,e){return{spineData:t.readSkeletonData(n,e),spineAtlas:n}}}class wa extends tn{createSkeleton(t){const n=Kn(t.version);let e=null;if(n===he.VER37&&(e=Or),n===he.VER38&&(e=Nr),(n===he.VER40||n===he.VER41)&&(e=ma),!e){const i=`Cant detect version of spine model ${t.version}`;console.error(i)}this.skeleton=new e.Skeleton(t),this.skeleton.updateWorldTransform(),this.stateData=new e.AnimationStateData(t),this.state=new e.AnimationState(this.stateData)}}return new pa().installLoader(),tt.AttachmentType=Z,tt.BinaryInput=Mn,tt.Color=_,tt.DebugUtils=Mr,tt.IntSet=ns,tt.Interpolation=Si,tt.MathUtils=C,tt.MixBlend=A,tt.MixDirection=J,tt.Pool=An,tt.PositionMode=dt,tt.Pow=yi,tt.PowOut=is,tt.RotateMode=pt,tt.SkeletonBounds=xr,tt.SkeletonBoundsBase=Cn,tt.Spine=wa,tt.SpineBase=tn,tt.SpineDebugRenderer=Tr,tt.SpineMesh=Ai,tt.SpineSprite=Mi,tt.StringSet=ss,tt.TextureAtlas=Fn,tt.TextureAtlasPage=ts,tt.TextureAtlasRegion=es,tt.TextureFilter=Bt,tt.TextureRegion=Vn,tt.TextureWrap=fe,tt.TimeKeeper=Ar,tt.TransformMode=j,tt.Utils=v,tt.Vector2=un,tt.WindowedMean=Cr,tt.filterFromString=Jn,tt.settings=zt,tt.wrapFromString=Er,tt}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI); -//# sourceMappingURL=pixi-spine.js.map - -var pixi_spine = this.PIXI.spine; diff --git a/Extensions/Spine/pixi-spine/Spine-Runtimes-License-Agreement.txt b/Extensions/Spine/spine-pixi-v7/Spine-Runtimes-License-Agreement.txt similarity index 99% rename from Extensions/Spine/pixi-spine/Spine-Runtimes-License-Agreement.txt rename to Extensions/Spine/spine-pixi-v7/Spine-Runtimes-License-Agreement.txt index 496bd274cb51..df7926c6a370 100644 --- a/Extensions/Spine/pixi-spine/Spine-Runtimes-License-Agreement.txt +++ b/Extensions/Spine/spine-pixi-v7/Spine-Runtimes-License-Agreement.txt @@ -1,11 +1,11 @@ -Spine Runtimes License Agreement -Last updated February 20, 2024. Replaces all prior versions. - -Copyright (c) 2013-2024, Esoteric Software LLC - -Integration of the Spine Runtimes into software or otherwise creating derivative works of the Spine Runtimes is permitted under the terms and conditions of Section 2 of the Spine Editor License Agreement: -http://esotericsoftware.com/spine-editor-license - -Otherwise, it is permitted to integrate the Spine Runtimes into software or otherwise create derivative works of the Spine Runtimes (collectively, "Products"), provided that each user of the Products must obtain their own Spine Editor license and redistribution of the Products in any form must include this license and copyright notice. - -THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Spine Runtimes License Agreement +Last updated February 20, 2024. Replaces all prior versions. + +Copyright (c) 2013-2024, Esoteric Software LLC + +Integration of the Spine Runtimes into software or otherwise creating derivative works of the Spine Runtimes is permitted under the terms and conditions of Section 2 of the Spine Editor License Agreement: +http://esotericsoftware.com/spine-editor-license + +Otherwise, it is permitted to integrate the Spine Runtimes into software or otherwise create derivative works of the Spine Runtimes (collectively, "Products"), provided that each user of the Products must obtain their own Spine Editor license and redistribution of the Products in any form must include this license and copyright notice. + +THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Extensions/Spine/spine-pixi-v7/spine-pixi-v7-pre.js b/Extensions/Spine/spine-pixi-v7/spine-pixi-v7-pre.js new file mode 100644 index 000000000000..831a5c8101dd --- /dev/null +++ b/Extensions/Spine/spine-pixi-v7/spine-pixi-v7-pre.js @@ -0,0 +1,10 @@ +"use strict"; +// Shim: map @pixi/* package requires to the global PIXI object so the esbuild +// IIFE bundle can resolve its PixiJS dependencies in a browser