@vgai/editor 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +35 -0
- package/dist/a/b/c/test-nested.json +1 -0
- package/dist/assets/CCDIKSolver-Dz-ysxZF.js +1 -0
- package/dist/assets/SelectionBox-BXsv_6aH.js +1 -0
- package/dist/assets/browser-project-scripts-DOru4L1x.js +2 -0
- package/dist/assets/browserAll-CEkWYlFk.js +1 -0
- package/dist/assets/collision-world-DniMB0qq.glb +0 -0
- package/dist/assets/create-runtime-DYIWr3va.js +1 -0
- package/dist/assets/data-asset-Bb9sIM7i.js +5 -0
- package/dist/assets/esbuild-BHljloGq.wasm +0 -0
- package/dist/assets/fake-three-BMTQ9rl_.js +1 -0
- package/dist/assets/game-8SDZPPgH.js +1 -0
- package/dist/assets/game-BI111o5f.js +10 -0
- package/dist/assets/game-CevorxyV.js +1 -0
- package/dist/assets/game-Di1H0gFj.js +1 -0
- package/dist/assets/game-Di7XlywD.js +1 -0
- package/dist/assets/game-DjnCaw8R.js +1 -0
- package/dist/assets/game-Q9A0aXSV.js +1 -0
- package/dist/assets/game-pt_1lQLv.js +1 -0
- package/dist/assets/game-source-CvidN7AB.js +1 -0
- package/dist/assets/game-xsOho_wg.js +83 -0
- package/dist/assets/index-Bp5cecD6.js +12 -0
- package/dist/assets/index-CPVV6pjw.js +1 -0
- package/dist/assets/index-CpOnYyeD.js +213 -0
- package/dist/assets/index-Cs8xwv3e.js +1 -0
- package/dist/assets/index-DL7RcQ0n.js +27 -0
- package/dist/assets/index-Dr8H_6Rl.js +1 -0
- package/dist/assets/index-_bCaipUk.js +13650 -0
- package/dist/assets/ingest-siblings-Dz8eEqrV.js +1 -0
- package/dist/assets/mount-manifest-Bhk0ohsl.js +1 -0
- package/dist/assets/recast-navigation.wasm-compat-CvP4UGK6.js +1 -0
- package/dist/assets/scene-query-BivAHhJu.js +1 -0
- package/dist/assets/stats.module--VATS4Kh.js +1 -0
- package/dist/assets/webworkerAll-BLrH0F6F.js +1 -0
- package/dist/assets/xstate-animation-binding-1NGLmw6y.js +1 -0
- package/dist/assets/xstate.esm-BgUD33nl.js +3 -0
- package/dist/index.html +37 -0
- package/dist/ingest/racing-game/UPSTREAM.md +68 -0
- package/dist/ingest/racing-game/a/Inter-Black.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Black.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-BlackItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-BlackItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Bold.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Bold.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-BoldItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-BoldItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBold.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBold.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBoldItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBoldItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLight.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLight.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLightItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLightItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Italic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Italic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Light.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Light.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-LightItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-LightItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Medium.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Medium.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-MediumItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-MediumItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Regular.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Regular.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBold.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBold.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBoldItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBoldItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Thin.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Thin.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ThinItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ThinItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-italic.var.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-roman.var.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter.var.woff2 +0 -0
- package/dist/ingest/racing-game/a/index.css +1 -0
- package/dist/ingest/racing-game/images/bronze.png +0 -0
- package/dist/ingest/racing-game/images/gold.png +0 -0
- package/dist/ingest/racing-game/images/silver.png +0 -0
- package/dist/ingest/racing-game/index.html +15 -0
- package/dist/ingest/racing-game/models/chassis-draco.glb +0 -0
- package/dist/ingest/racing-game/models/track-draco.glb +0 -0
- package/dist/ingest/racing-game/models/wheel-draco.glb +0 -0
- package/dist/ingest/racing-game/rg-entry.js +1 -0
- package/dist/ingest/racing-game/sounds/accelerate.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/boost.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/crash.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/engine.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/honk.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/tire-brake.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/train.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/water.mp3 +0 -0
- package/dist/ingest/racing-game/textures/cursor.svg +3 -0
- package/dist/ingest/racing-game/textures/dikhololo_night_1k.hdr +0 -0
- package/dist/ingest/racing-game/textures/heightmap_1024.png +0 -0
- package/dist/ingest/racing-game/textures/mask.svg +11 -0
- package/dist/ingest/racing-game/textures/no_sound.png +0 -0
- package/dist/ingest/racing-game/three-r139.module.js +50617 -0
- package/dist/ingest/racing-game/vendor.js +179 -0
- package/dist/ingest/racing-game/vgai.game.json +20 -0
- package/dist/ingest/simcity/UPSTREAM.md +65 -0
- package/dist/ingest/simcity/favicon.ico +0 -0
- package/dist/ingest/simcity/fonts/Bebas-Regular.otf +0 -0
- package/dist/ingest/simcity/fonts/Digitalt.otf +0 -0
- package/dist/ingest/simcity/fonts/Stanberry.ttf +0 -0
- package/dist/ingest/simcity/icons/bulldozer-color.png +0 -0
- package/dist/ingest/simcity/icons/bulldozer.png +0 -0
- package/dist/ingest/simcity/icons/calendar.png +0 -0
- package/dist/ingest/simcity/icons/factory-color.png +0 -0
- package/dist/ingest/simcity/icons/factory.png +0 -0
- package/dist/ingest/simcity/icons/house-color.png +0 -0
- package/dist/ingest/simcity/icons/house.png +0 -0
- package/dist/ingest/simcity/icons/job.png +0 -0
- package/dist/ingest/simcity/icons/office.png +0 -0
- package/dist/ingest/simcity/icons/pause-color.png +0 -0
- package/dist/ingest/simcity/icons/pause.png +0 -0
- package/dist/ingest/simcity/icons/person.png +0 -0
- package/dist/ingest/simcity/icons/play-color.png +0 -0
- package/dist/ingest/simcity/icons/play.png +0 -0
- package/dist/ingest/simcity/icons/power-color.png +0 -0
- package/dist/ingest/simcity/icons/power-line-color.png +0 -0
- package/dist/ingest/simcity/icons/power.png +0 -0
- package/dist/ingest/simcity/icons/road-color.png +0 -0
- package/dist/ingest/simcity/icons/road.png +0 -0
- package/dist/ingest/simcity/icons/select-color.png +0 -0
- package/dist/ingest/simcity/icons/select.png +0 -0
- package/dist/ingest/simcity/icons/store-color.png +0 -0
- package/dist/ingest/simcity/index.html +94 -0
- package/dist/ingest/simcity/index.js +58 -0
- package/dist/ingest/simcity/main.css +233 -0
- package/dist/ingest/simcity/models/armored-truck.glb +0 -0
- package/dist/ingest/simcity/models/building-block-4floor-corner.glb +0 -0
- package/dist/ingest/simcity/models/building-block-4floor-short.glb +0 -0
- package/dist/ingest/simcity/models/building-block-5floor.glb +0 -0
- package/dist/ingest/simcity/models/building-burger-joint.glb +0 -0
- package/dist/ingest/simcity/models/building-cafe.glb +0 -0
- package/dist/ingest/simcity/models/building-casino.glb +0 -0
- package/dist/ingest/simcity/models/building-cinema.glb +0 -0
- package/dist/ingest/simcity/models/building-house-block-big.glb +0 -0
- package/dist/ingest/simcity/models/building-house-family-large.glb +0 -0
- package/dist/ingest/simcity/models/building-house-family-small.glb +0 -0
- package/dist/ingest/simcity/models/building-office-balcony.glb +0 -0
- package/dist/ingest/simcity/models/building-office-big.glb +0 -0
- package/dist/ingest/simcity/models/building-office-pyramid.glb +0 -0
- package/dist/ingest/simcity/models/building-office-tall.glb +0 -0
- package/dist/ingest/simcity/models/building-office.glb +0 -0
- package/dist/ingest/simcity/models/building-restaurant.glb +0 -0
- package/dist/ingest/simcity/models/building-skyscraper.glb +0 -0
- package/dist/ingest/simcity/models/car-ambulance-pickup.glb +0 -0
- package/dist/ingest/simcity/models/car-baywatch.glb +0 -0
- package/dist/ingest/simcity/models/car-hippie-van.glb +0 -0
- package/dist/ingest/simcity/models/car-passenger-race.glb +0 -0
- package/dist/ingest/simcity/models/car-passenger.glb +0 -0
- package/dist/ingest/simcity/models/car-police.glb +0 -0
- package/dist/ingest/simcity/models/car-taxi.glb +0 -0
- package/dist/ingest/simcity/models/car-tow-truck.glb +0 -0
- package/dist/ingest/simcity/models/car-truck-dump.glb +0 -0
- package/dist/ingest/simcity/models/car-veteran.glb +0 -0
- package/dist/ingest/simcity/models/construction-small.glb +0 -0
- package/dist/ingest/simcity/models/data-center.glb +0 -0
- package/dist/ingest/simcity/models/industry-factory-old.glb +0 -0
- package/dist/ingest/simcity/models/industry-factory.glb +0 -0
- package/dist/ingest/simcity/models/industry-refinery.glb +0 -0
- package/dist/ingest/simcity/models/industry-warehouse.glb +0 -0
- package/dist/ingest/simcity/models/power_line_pole_modified.glb +0 -0
- package/dist/ingest/simcity/models/tile-plain_grass.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-curve.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-end.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-intersection-t.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-intersection.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-straight.glb +0 -0
- package/dist/ingest/simcity/models/truck.glb +0 -0
- package/dist/ingest/simcity/statusIcons/no-power.png +0 -0
- package/dist/ingest/simcity/statusIcons/no-road-access.png +0 -0
- package/dist/ingest/simcity/textures/base.png +0 -0
- package/dist/ingest/simcity/textures/grid.png +0 -0
- package/dist/ingest/simcity/textures/specular.png +0 -0
- package/dist/ingest/simcity/three-r155.module.js +51466 -0
- package/dist/ingest/simcity/vgai.game.json +20 -0
- package/dist/ingest/tanks/UPSTREAM.md +69 -0
- package/dist/ingest/tanks/index.html +214 -0
- package/dist/ingest/tanks/models/pixelTank.fbx +0 -0
- package/dist/ingest/tanks/tanks-entry.js +92 -0
- package/dist/ingest/tanks/three-r170.module.js +54571 -0
- package/dist/ingest/tanks/vgai.game.json +20 -0
- package/dist/inputmaps/default.inputmap.json +41 -0
- package/dist/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/dist/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/dist/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/dist/scenes/untitled.vscn.json +29 -0
- package/dist/textures/waternormals.jpg +0 -0
- package/dist-server/packaged.mjs +18155 -0
- package/package.json +36 -0
- package/server/asset-library-routes.ts +833 -0
- package/server/canonical-path.ts +50 -0
- package/server/cloud-asset-catalog.ts +101 -0
- package/server/dev.ts +350 -0
- package/server/editor-server.ts +1537 -0
- package/server/editor-sse.ts +73 -0
- package/server/game-globals-shadow.ts +58 -0
- package/server/local-asset-catalog.ts +163 -0
- package/server/packaged.ts +571 -0
- package/server/prod.ts +75 -0
- package/server/project-optimize-deps-entries.ts +149 -0
- package/server/project-view.ts +65 -0
- package/server/server-utils.ts +430 -0
- package/server/session-registry.ts +93 -0
- package/src/EditorContext.tsx +87 -0
- package/src/achieved-tier.ts +126 -0
- package/src/action-registry.ts +268 -0
- package/src/adapter-resolver.ts +1858 -0
- package/src/asset-events.ts +100 -0
- package/src/authoring/active-adapter.ts +98 -0
- package/src/authoring/active-systems.ts +50 -0
- package/src/authoring/boundary-authoring-adapter.ts +178 -0
- package/src/authoring/composite-authoring-adapter.ts +891 -0
- package/src/authoring/design-time-layers.ts +776 -0
- package/src/authoring/edit-mode-authoring.ts +643 -0
- package/src/authoring/embed-only-adapter.ts +57 -0
- package/src/authoring/ephemeral-persistence.ts +26 -0
- package/src/authoring/eyedropper-session.ts +69 -0
- package/src/authoring/first-party-hierarchy-menu.ts +74 -0
- package/src/authoring/first-party-inspector/AddSectionMenu.tsx +118 -0
- package/src/authoring/first-party-inspector/EnvironmentSection.tsx +550 -0
- package/src/authoring/first-party-inspector/HeaderSection.tsx +329 -0
- package/src/authoring/first-party-inspector/is-first-party-selection.ts +44 -0
- package/src/authoring/first-party-inspector/register.tsx +108 -0
- package/src/authoring/ingest-authoring-adapter.ts +475 -0
- package/src/authoring/ingest-capture.ts +94 -0
- package/src/authoring/ingest-game-adapter.ts +291 -0
- package/src/authoring/ingest-iframe-adapter.ts +38 -0
- package/src/authoring/ingest-iframe-reachable-adapter.ts +401 -0
- package/src/authoring/ingest-overlay.ts +193 -0
- package/src/authoring/layered-pick.ts +87 -0
- package/src/authoring/mount-failure-report.ts +112 -0
- package/src/authoring/overlay-report.ts +52 -0
- package/src/authoring/project-scenes.ts +111 -0
- package/src/authoring/react-dom-authoring-adapter.ts +795 -0
- package/src/authoring/react-inspector-section.tsx +1041 -0
- package/src/authoring/react-world-authoring-adapter.ts +2400 -0
- package/src/authoring/root-activation.ts +61 -0
- package/src/authoring/scene-ui-layer.ts +485 -0
- package/src/authoring/story-overlay.ts +48 -0
- package/src/authoring/ui-authoring-adapter.ts +325 -0
- package/src/authoring/ui-hierarchy-menu.ts +40 -0
- package/src/authoring/ui-inspector-sections.tsx +156 -0
- package/src/authoring/undo-timeline.ts +145 -0
- package/src/authoring/vgai-scene-authoring-adapter.ts +746 -0
- package/src/authoring/viewport-pick-context.ts +31 -0
- package/src/authoring/viewport-raycast.ts +80 -0
- package/src/authoring/world-overlay.ts +76 -0
- package/src/authoring/world-pan-state.ts +115 -0
- package/src/authoring/world-session-state.ts +102 -0
- package/src/authoring/world2d-authoring-adapter.ts +313 -0
- package/src/browser-external-watch.ts +98 -0
- package/src/browser-play-entry.ts +112 -0
- package/src/browser-project-scripts.ts +112 -0
- package/src/browser-transpile.ts +246 -0
- package/src/browser-watch-reload.ts +100 -0
- package/src/command-listener.ts +326 -0
- package/src/components/AlignToolbar.tsx +189 -0
- package/src/components/AppRoot.tsx +73 -0
- package/src/components/AssetBrowser.tsx +502 -0
- package/src/components/BottomPanel.tsx +326 -0
- package/src/components/BuildPanel.tsx +455 -0
- package/src/components/CameraInfo.tsx +56 -0
- package/src/components/CommandPalette.tsx +265 -0
- package/src/components/ConsolePanel.tsx +272 -0
- package/src/components/DataPanel.tsx +1268 -0
- package/src/components/DefaultEditorLayout.tsx +509 -0
- package/src/components/FolderTree.tsx +179 -0
- package/src/components/GameHierarchy.tsx +1349 -0
- package/src/components/Inspector.tsx +671 -0
- package/src/components/InspectorToolSection.tsx +74 -0
- package/src/components/MountFailureBanner.tsx +110 -0
- package/src/components/NetworkSection.tsx +109 -0
- package/src/components/OnlineAssetBrowser.tsx +448 -0
- package/src/components/OverlayReportBanner.tsx +122 -0
- package/src/components/PlayBar.tsx +356 -0
- package/src/components/PrefabSaveDialog.tsx +201 -0
- package/src/components/ProjectHeader.tsx +174 -0
- package/src/components/ProjectScreen.tsx +1004 -0
- package/src/components/RightPanel.tsx +166 -0
- package/src/components/RootActivateDialog.tsx +105 -0
- package/src/components/SaveDialog.tsx +197 -0
- package/src/components/SaveStatus.tsx +69 -0
- package/src/components/StatsOverlay.tsx +35 -0
- package/src/components/ToolHost.tsx +80 -0
- package/src/components/Toolbar.tsx +307 -0
- package/src/components/ViewportOverlay.tsx +234 -0
- package/src/components/ViewportPanel.tsx +369 -0
- package/src/components/WorldContextMenu.tsx +257 -0
- package/src/components/WorldSelectionOverlay.tsx +2003 -0
- package/src/components/WorldTextEditor.tsx +86 -0
- package/src/components/asset-viewers/AssetViewer.tsx +38 -0
- package/src/components/asset-viewers/AudioViewer.tsx +149 -0
- package/src/components/asset-viewers/GenericJsonViewer.tsx +77 -0
- package/src/components/asset-viewers/ImageViewer.tsx +65 -0
- package/src/components/asset-viewers/InputMapViewer.tsx +206 -0
- package/src/components/asset-viewers/ModelViewer.tsx +180 -0
- package/src/components/asset-viewers/OnlineAssetDetail.tsx +236 -0
- package/src/components/data-csv.ts +301 -0
- package/src/components/entity-name-commit.ts +18 -0
- package/src/components/inspector-property-grouping.ts +65 -0
- package/src/components/inspector-widgets/AlignmentGrid.tsx +188 -0
- package/src/components/inspector-widgets/BorderEditor.tsx +305 -0
- package/src/components/inspector-widgets/ColorPicker.tsx +548 -0
- package/src/components/inspector-widgets/FilterEditor.tsx +108 -0
- package/src/components/inspector-widgets/FontPicker.tsx +196 -0
- package/src/components/inspector-widgets/GradientEditor.tsx +277 -0
- package/src/components/inspector-widgets/ScrubbableInput.tsx +152 -0
- package/src/components/inspector-widgets/ShadowEditor.tsx +332 -0
- package/src/components/inspector-widgets/color-utils.ts +202 -0
- package/src/components/inspector-widgets/gallery-main.tsx +167 -0
- package/src/components/inspector-widgets/index.ts +22 -0
- package/src/components/inspector-widgets/shared.tsx +135 -0
- package/src/components/inspectors/AnimationSection.tsx +143 -0
- package/src/components/inspectors/AudioSection.tsx +215 -0
- package/src/components/inspectors/BoneAttachmentSection.tsx +82 -0
- package/src/components/inspectors/CameraSection.tsx +105 -0
- package/src/components/inspectors/ComponentsSection.tsx +358 -0
- package/src/components/inspectors/JointsSection.tsx +255 -0
- package/src/components/inspectors/LightSection.tsx +116 -0
- package/src/components/inspectors/MaterialSection.tsx +1189 -0
- package/src/components/inspectors/MeshSection.tsx +99 -0
- package/src/components/inspectors/NavigationSection.tsx +58 -0
- package/src/components/inspectors/ParticleSection.tsx +681 -0
- package/src/components/inspectors/PhysicsSection.tsx +326 -0
- package/src/components/inspectors/PostProcessingSection.tsx +1290 -0
- package/src/components/inspectors/RenderingSection.tsx +109 -0
- package/src/components/inspectors/ShadowSection.tsx +84 -0
- package/src/components/inspectors/SplineSection.tsx +191 -0
- package/src/components/inspectors/TransformSection.tsx +191 -0
- package/src/components/inspectors/json-schema-fields.ts +281 -0
- package/src/components/inspectors/multi-edit-utils.ts +49 -0
- package/src/components/inspectors/zod-fields.ts +184 -0
- package/src/components/primitives/ColorInput.tsx +109 -0
- package/src/components/primitives/JsonInput.tsx +98 -0
- package/src/components/primitives/NumberInput.tsx +164 -0
- package/src/components/primitives/Panel.tsx +68 -0
- package/src/components/primitives/SectionHeader.tsx +45 -0
- package/src/components/primitives/Tooltip.tsx +82 -0
- package/src/components/primitives/Vec3Input.tsx +62 -0
- package/src/components/world-overlay-gestures.ts +1438 -0
- package/src/doctor/data-checks.ts +285 -0
- package/src/doctor/report.ts +386 -0
- package/src/editor-api.ts +700 -0
- package/src/editor-console.ts +194 -0
- package/src/editor-hotkeys.ts +441 -0
- package/src/editor-layers.ts +2 -0
- package/src/editor-mode.ts +28 -0
- package/src/editor-store.ts +2225 -0
- package/src/editor-viewport.ts +1924 -0
- package/src/entity-factory.ts +221 -0
- package/src/game-globals-prelude.ts +27 -0
- package/src/gated-globals.ts +131 -0
- package/src/generated/setup-by-example.generated.ts +53 -0
- package/src/gizmo-registry.ts +608 -0
- package/src/handle-system.ts +221 -0
- package/src/hierarchy-menu-registry.ts +70 -0
- package/src/hierarchy-rows.ts +73 -0
- package/src/hosted-example.ts +160 -0
- package/src/hotkeys.ts +142 -0
- package/src/ingest/discovery-react.ts +132 -0
- package/src/ingest/discovery.ts +205 -0
- package/src/ingest/discovery2d.ts +204 -0
- package/src/ingest/esm-entry-resolution.ts +102 -0
- package/src/ingest/games/bloom-composer/game.js +99 -0
- package/src/ingest/games/bloom-composer/vgai.game.json +21 -0
- package/src/ingest/games/embed-bundle/embed.html +10 -0
- package/src/ingest/games/embed-bundle/vgai.game.json +21 -0
- package/src/ingest/games/games-fps/assets/collision-world.glb +0 -0
- package/src/ingest/games/games-fps/game.js +479 -0
- package/src/ingest/games/games-fps/vgai.game.json +24 -0
- package/src/ingest/games/iframe-reachable/game-source.js +58 -0
- package/src/ingest/games/iframe-reachable/vgai.game.json +21 -0
- package/src/ingest/games/interactive-cubes/game.js +139 -0
- package/src/ingest/games/interactive-cubes/vgai.game.json +21 -0
- package/src/ingest/games/mismatched-three/fake-three.js +38 -0
- package/src/ingest/games/mismatched-three/game.js +10 -0
- package/src/ingest/games/mismatched-three/vgai.game.json +22 -0
- package/src/ingest/games/own-three-bundled/game.js +43 -0
- package/src/ingest/games/own-three-bundled/vgai.game.json +21 -0
- package/src/ingest/games/pointerlock-maze/game.js +288 -0
- package/src/ingest/games/pointerlock-maze/vgai.game.json +22 -0
- package/src/ingest/games-2d/_fixtures/first-party-scene.scn2d.json +124 -0
- package/src/ingest/games-2d/bubbo-bubbo/vgai.game.json +25 -0
- package/src/ingest/games-2d/bunnymark/game.ts +88 -0
- package/src/ingest/games-2d/bunnymark/vgai.game.json +21 -0
- package/src/ingest/games-2d/flappy/game.ts +148 -0
- package/src/ingest/games-2d/flappy/vgai.game.json +21 -0
- package/src/ingest/games-2d/flappy-pixi/vgai.game.json +25 -0
- package/src/ingest/games-2d/puzzling-potions/vgai.game.json +25 -0
- package/src/ingest/games-2d/tilemap-camera/game.ts +115 -0
- package/src/ingest/games-2d/tilemap-camera/vgai.game.json +21 -0
- package/src/ingest/games-react/react-rpg/entry.tsx +185 -0
- package/src/ingest/games-react/react-rpg/shims.d.ts +26 -0
- package/src/ingest/games-react/react-rpg/src/ui/game-state.tsx +129 -0
- package/src/ingest/games-react/react-rpg/vgai.game.json +21 -0
- package/src/ingest/host-namespace-registry.ts +196 -0
- package/src/ingest/types.ts +127 -0
- package/src/ingest-hierarchy-rows.ts +207 -0
- package/src/ingest-mode.ts +2092 -0
- package/src/ingest-siblings.ts +466 -0
- package/src/initial-scene.ts +194 -0
- package/src/inspector-section-registry.ts +117 -0
- package/src/interactive-edit-scope.ts +34 -0
- package/src/main.tsx +23 -0
- package/src/manifest-project.ts +43 -0
- package/src/model-thumbnail.ts +156 -0
- package/src/module-mode.ts +513 -0
- package/src/navmesh-handler.ts +94 -0
- package/src/packaged-runtime.ts +49 -0
- package/src/play-mode.ts +1148 -0
- package/src/playground/main.ts +206 -0
- package/src/project-manager.ts +173 -0
- package/src/scene-diff.ts +112 -0
- package/src/scene-serializer.ts +144 -0
- package/src/scene-sync.ts +587 -0
- package/src/scene-ui-mode/active-scene-ui.ts +58 -0
- package/src/scene-ui-mode/scene-ui-palette-panel.tsx +152 -0
- package/src/scene-ui-mode/scene-ui-timeline-tab.tsx +29 -0
- package/src/scene-ui-mode/ui-prefab-dialog-host.tsx +74 -0
- package/src/scene-ui-mode/ui-prefab-hierarchy-menu.ts +49 -0
- package/src/scene-ui-mode/ui-prefab-io.ts +76 -0
- package/src/script-loader.ts +143 -0
- package/src/storage/fsa-storage.ts +55 -0
- package/src/storage/handle-storage.ts +150 -0
- package/src/storage/handle-store.ts +116 -0
- package/src/storage/http-storage.ts +137 -0
- package/src/storage/index.ts +147 -0
- package/src/storage/mem-storage.ts +135 -0
- package/src/storage/opfs-storage.ts +25 -0
- package/src/storage/paths.ts +26 -0
- package/src/storage/seed.ts +106 -0
- package/src/storage/types.ts +110 -0
- package/src/tool-loader.ts +291 -0
- package/src/ui-editor/inspector.tsx +563 -0
- package/src/ui-editor/node-ops.ts +266 -0
- package/src/ui-editor/overlay.tsx +380 -0
- package/src/ui-editor/palette.tsx +114 -0
- package/src/ui-editor/react-store.ts +78 -0
- package/src/ui-editor/timeline-panel.tsx +443 -0
- package/src/ui-editor/ui-edit-store.ts +552 -0
- package/src/ui-editor/ui-prefab.ts +95 -0
- package/src/ui-source/inspect.ts +544 -0
- package/src/ui-source/oid-transform.ts +133 -0
- package/src/ui-source/source-write-backend.ts +203 -0
- package/src/ui-source/tailwind-map.ts +174 -0
- package/src/ui-source/writer.ts +1175 -0
- package/src/widgets/index.ts +73 -0
- package/template/.claude/skills/editor/SKILL.md +252 -0
- package/template/CLAUDE.md +512 -0
- package/template/LICENSE +30 -0
- package/template/emit-schemas.ts +42 -0
- package/template/index.html +17 -0
- package/template/package.json +53 -0
- package/template/project.json +9 -0
- package/template/public/audio/ambient-arena.wav +0 -0
- package/template/public/audio/ambient-music.wav +0 -0
- package/template/public/audio/ambient-nature.wav +0 -0
- package/template/public/audio/ambient-wind.wav +0 -0
- package/template/public/inputmaps/default.inputmap.json +41 -0
- package/template/public/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/template/public/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/template/public/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/template/public/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/template/public/scenes/default.vscn.json +43 -0
- package/template/public/scenes/untitled.vscn.json +29 -0
- package/template/public/textures/waternormals.jpg +0 -0
- package/template/server/colyseus-setup.ts +85 -0
- package/template/server/main.ts +34 -0
- package/template/server/rooms/arena-room.ts +420 -0
- package/template/server/rooms/game-room.ts +162 -0
- package/template/server/rooms.ts +15 -0
- package/template/server/tsconfig.json +19 -0
- package/template/src/data/README.md +40 -0
- package/template/src/data/assets.ts +31 -0
- package/template/src/data/tuning.data.json +5 -0
- package/template/src/data/tuning.schema.json +21 -0
- package/template/src/data/tuning.schema.ts +34 -0
- package/template/src/data/tuning.ts +24 -0
- package/template/src/main.ts +157 -0
- package/template/src/scripts/components/data-spinner.ts +45 -0
- package/template/src/scripts/components/scene-camera.ts +40 -0
- package/template/src/scripts/main.ts +94 -0
- package/template/src/scripts/registry.ts +46 -0
- package/template/src/tools/README.md +14 -0
- package/template/src/tools/example.tool.tsx +91 -0
- package/template/src/tools/spin.tool.tsx +101 -0
- package/template/src/ui/Button.tsx +27 -0
- package/template/src/ui/DefaultHud.tsx +40 -0
- package/template/src/ui/KeyHint.tsx +25 -0
- package/template/src/ui/Panel.tsx +52 -0
- package/template/src/ui/RebindPanel.tsx +129 -0
- package/template/src/ui/Slider.tsx +28 -0
- package/template/src/ui/StatusDot.tsx +22 -0
- package/template/src/ui/Toggle.tsx +19 -0
- package/template/src/ui/game-state.tsx +37 -0
- package/template/src/ui/index.ts +7 -0
- package/template/src/ui/mount-default-hud.tsx +19 -0
- package/template/src/ui/mount-ui.ts +15 -0
- package/template/tsconfig.json +36 -0
- package/template/validate-asset-content.ts +78 -0
- package/template/validate-manifest.ts +55 -0
- package/template/validate-scenes.ts +211 -0
- package/template/vgai.game.json +21 -0
- package/template/vite.config.ts +128 -0
- package/vite-plugin-example-assets.ts +60 -0
- package/vite-plugin-game-globals.ts +46 -0
- package/vite-plugin-game-static.ts +71 -0
- package/vite-plugin-project-game-static.ts +84 -0
- package/vite-plugin-react-game-static.ts +98 -0
- package/vite-plugin-react-world-provider.ts +81 -0
- package/vite-plugin-react-world-runtime.ts +76 -0
- package/vite-plugin-ui-oid.ts +561 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b6 as S,b7 as v,b8 as U,b9 as F,ba as j,bb as H,bc as T,ax as N}from"./index-_bCaipUk.js";let B;function q(s){return B=s,s}function l(){return B}class y{constructor(e,t){this.init(e,t)}init(e,t){this.destination=e,this.source=t||e}connect(e){this.source?.connect(e)}disconnect(){this.source?.disconnect()}destroy(){this.disconnect(),this.destination=null,this.source=null}}class z extends y{constructor(e=0){let t;if(!l().useLegacy){const{audioContext:i}=l().context;t=i.createWaveShaper()}super(t),this._distortion=t,this.amount=e}set amount(e){if(this._amount=e,l().useLegacy)return;const t=e*1e3,i=44100,n=new Float32Array(i),o=Math.PI/180;let r=0,a;for(;r<i;++r)a=r*2/i-1,n[r]=(3+t)*a*20*o/(Math.PI+t*Math.abs(a));this._distortion.curve=n,this._distortion.oversample="4x"}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy()}}class _{static setParamValue(e,t){if(e.setValueAtTime){const i=l().context;e.setValueAtTime(t,i.audioContext.currentTime)}else e.value=t;return t}}const u=class extends y{constructor(s=0,e=0,t=0,i=0,n=0,o=0,r=0,a=0,h=0,d=0){let c=[];const g=[{f:u.F32,type:"lowshelf",gain:s},{f:u.F64,type:"peaking",gain:e},{f:u.F125,type:"peaking",gain:t},{f:u.F250,type:"peaking",gain:i},{f:u.F500,type:"peaking",gain:n},{f:u.F1K,type:"peaking",gain:o},{f:u.F2K,type:"peaking",gain:r},{f:u.F4K,type:"peaking",gain:a},{f:u.F8K,type:"peaking",gain:h},{f:u.F16K,type:"highshelf",gain:d}];l().useLegacy||(c=g.map(f=>{const p=l().context.audioContext.createBiquadFilter();return p.type=f.type,_.setParamValue(p.Q,1),p.frequency.value=f.f,_.setParamValue(p.gain,f.gain),p})),super(c[0],c[c.length-1]),this.bands=c,this.bandsMap={};for(let f=0;f<this.bands.length;f++){const p=this.bands[f];f>0&&this.bands[f-1].connect(p),this.bandsMap[p.frequency.value]=p}}setGain(s,e=0){if(!this.bandsMap[s])throw new Error(`No band found for frequency ${s}`);_.setParamValue(this.bandsMap[s].gain,e)}getGain(s){if(!this.bandsMap[s])throw new Error(`No band found for frequency ${s}`);return this.bandsMap[s].gain.value}set f32(s){this.setGain(u.F32,s)}get f32(){return this.getGain(u.F32)}set f64(s){this.setGain(u.F64,s)}get f64(){return this.getGain(u.F64)}set f125(s){this.setGain(u.F125,s)}get f125(){return this.getGain(u.F125)}set f250(s){this.setGain(u.F250,s)}get f250(){return this.getGain(u.F250)}set f500(s){this.setGain(u.F500,s)}get f500(){return this.getGain(u.F500)}set f1k(s){this.setGain(u.F1K,s)}get f1k(){return this.getGain(u.F1K)}set f2k(s){this.setGain(u.F2K,s)}get f2k(){return this.getGain(u.F2K)}set f4k(s){this.setGain(u.F4K,s)}get f4k(){return this.getGain(u.F4K)}set f8k(s){this.setGain(u.F8K,s)}get f8k(){return this.getGain(u.F8K)}set f16k(s){this.setGain(u.F16K,s)}get f16k(){return this.getGain(u.F16K)}reset(){this.bands.forEach(s=>{_.setParamValue(s.gain,0)})}destroy(){this.bands.forEach(s=>{s.disconnect()}),this.bands=null,this.bandsMap=null}};let m=u;m.F32=32;m.F64=64;m.F125=125;m.F250=250;m.F500=500;m.F1K=1e3;m.F2K=2e3;m.F4K=4e3;m.F8K=8e3;m.F16K=16e3;class Q extends y{constructor(){let e,t;if(!l().useLegacy){const{audioContext:i}=l().context;t=i.createChannelSplitter(),e=i.createChannelMerger(),e.connect(t)}super(e,t),this._merger=e}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy()}}class W extends y{constructor(e=3,t=2,i=!1){super(null),this._seconds=this._clamp(e,1,50),this._decay=this._clamp(t,0,100),this._reverse=i,this._rebuild()}_clamp(e,t,i){return Math.min(i,Math.max(t,e))}get seconds(){return this._seconds}set seconds(e){this._seconds=this._clamp(e,1,50),this._rebuild()}get decay(){return this._decay}set decay(e){this._decay=this._clamp(e,0,100),this._rebuild()}get reverse(){return this._reverse}set reverse(e){this._reverse=e,this._rebuild()}_rebuild(){if(l().useLegacy)return;const{audioContext:e}=l().context,t=e.sampleRate,i=t*this._seconds,n=e.createBuffer(2,i,t),o=n.getChannelData(0),r=n.getChannelData(1);let a;for(let d=0;d<i;d++)a=this._reverse?i-d:d,o[d]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),r[d]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);const h=e.createConvolver();h.buffer=n,this.init(h)}}class Y extends y{constructor(e=0){let t,i,n;if(!l().useLegacy){const{audioContext:o}=l().context;o.createStereoPanner?(t=o.createStereoPanner(),n=t):(i=o.createPanner(),i.panningModel="equalpower",n=i)}super(n),this._stereo=t,this._panner=i,this.pan=e}set pan(e){this._pan=e,this._stereo?_.setParamValue(this._stereo.pan,e):this._panner&&this._panner.setPosition(e,0,1-Math.abs(e))}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null}}class Z extends y{constructor(){let e,t;if(!l().useLegacy){const{audioContext:i}=l().context;e=i.createMediaStreamDestination(),t=i.createMediaStreamSource(e.stream)}super(e,t),this._stream=e?.stream}get stream(){return this._stream}destroy(){this._stream=null,super.destroy()}}class J extends y{constructor(){let e,t;if(!l().useLegacy){const{audioContext:i}=l().context,n=i.createBiquadFilter(),o=i.createBiquadFilter(),r=i.createBiquadFilter(),a=i.createBiquadFilter();n.type="lowpass",_.setParamValue(n.frequency,2e3),o.type="lowpass",_.setParamValue(o.frequency,2e3),r.type="highpass",_.setParamValue(r.frequency,500),a.type="highpass",_.setParamValue(a.frequency,500),n.connect(o),o.connect(r),r.connect(a),e=n,t=a}super(e,t)}}const ue=Object.freeze(Object.defineProperty({__proto__:null,DistortionFilter:z,EqualizerFilter:m,Filter:y,MonoFilter:Q,ReverbFilter:W,StereoFilter:Y,StreamFilter:Z,TelephoneFilter:J},Symbol.toStringTag,{value:"Module"}));class I extends S{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(e){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}let X=0;const C=class extends S{constructor(s){super(),this.id=X++,this.init(s)}set(s,e){if(this[s]===void 0)throw new Error(`Property with name ${s} does not exist.`);switch(s){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"paused":this.paused=e;break;case"loop":this.loop=e;break;case"muted":this.muted=e;break}return this}get progress(){const{currentTime:s}=this._source;return s/this._duration}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(s){this._playing=!1,this._duration=s.source.duration;const e=this._source=s.source.cloneNode(!1);e.src=s.parent.url,e.onplay=this._onPlay.bind(this),e.onpause=this._onPause.bind(this),s.context.on("refresh",this.refresh,this),s.context.on("refreshPaused",this.refreshPaused,this),this._media=s}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(s){console.warn("HTML Audio does not support filters")}refresh(){const s=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const t=s.volume*(s.muted?0:1),i=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);this._source.volume=n*t*i,this._source.playbackRate=this._speed*s.speed*e.speed}refreshPaused(){const s=this._media.context,e=this._media.parent,t=this._paused||e.paused||s.paused;t!==this._pausedReal&&(this._pausedReal=t,t?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",t))}play(s){const{start:e,end:t,speed:i,loop:n,volume:o,muted:r}=s;t&&console.assert(t>e,"End time is before start time"),this._speed=i,this._volume=o,this._loop=!!n,this._muted=r,this.refresh(),this.loop&&t!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=e,this._end=t||this._duration,this._start=Math.max(0,this._start-C.PADDING),this._end=Math.min(this._end+C.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=e,this._source.onloadedmetadata=null,this.emit("progress",e/this._duration,this._duration),v.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){v.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){v.shared.remove(this._onUpdate,this),this.removeAllListeners();const s=this._source;s&&(s.onended=null,s.onplay=null,s.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let E=C;E.PADDING=.1;class G extends S{init(e){this.parent=e,this._source=e.options.source||new Audio,e.url&&(this._source.src=e.url)}create(){return new E(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(e){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(e){const t=this._source,i=this.parent;if(t.readyState===4){i.isLoaded=!0;const h=i.autoPlayStart();e&&setTimeout(()=>{e(null,i,h)},0);return}if(!i.url){e(new Error("sound.url or sound.source must be set"));return}t.src=i.url;const n=()=>{a(),i.isLoaded=!0;const h=i.autoPlayStart();e&&e(null,i,h)},o=()=>{a(),e&&e(new Error("Sound loading has been aborted"))},r=()=>{a();const h=`Failed to load audio element (code: ${t.error.code})`;e?e(new Error(h)):console.error(h)},a=()=>{t.removeEventListener("canplaythrough",n),t.removeEventListener("load",n),t.removeEventListener("abort",o),t.removeEventListener("error",r)};t.addEventListener("canplaythrough",n,!1),t.addEventListener("load",n,!1),t.addEventListener("abort",o,!1),t.addEventListener("error",r,!1),t.load()}}const he=Object.freeze(Object.defineProperty({__proto__:null,HTMLAudioContext:I,HTMLAudioInstance:E,HTMLAudioMedia:G},Symbol.toStringTag,{value:"Module"}));class ee{constructor(e,t){this.parent=e,Object.assign(this,t),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(e){return this.parent.play({complete:e,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const P=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],O=["audio/mpeg","audio/ogg"],A={};function R(s){const e={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...s||{}},t=document.createElement("audio"),i={},n=/^no$/;P.forEach(o=>{const r=t.canPlayType(`audio/${o}`).replace(n,""),a=e[o]?t.canPlayType(e[o]).replace(n,""):"";i[o]=!!r||!!a}),Object.assign(A,i)}R();let te=0;class V extends S{constructor(e){super(),this.id=te++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(e)}set(e,t){if(this[e]===void 0)throw new Error(`Property with name ${e} does not exist.`);switch(e){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"muted":this.muted=t;break;case"loop":this.loop=t;break;case"paused":this.paused=t;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(e){this._speed=e,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(e){this._volume=e,this.refresh()}get muted(){return this._muted}set muted(e){this._muted=e,this.refresh()}get loop(){return this._loop}set loop(e){this._loop=e,this.refresh()}get filters(){return this._filters}set filters(e){this._filters&&(this._filters?.filter(t=>t).forEach(t=>t.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=e?.length?e.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const e=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const i=e.volume*(e.muted?0:1),n=t.volume*(t.muted?0:1),o=this._volume*(this._muted?0:1);_.setParamValue(this._gain.gain,o*n*i),_.setParamValue(this._source.playbackRate,this._speed*t.speed*e.speed),this.applyFilters()}applyFilters(){if(this._filters?.length){this._source.disconnect();let e=this._source;this._filters.forEach(t=>{e.connect(t.destination),e=t}),e.connect(this._gain)}}refreshPaused(){const e=this._media.context,t=this._media.parent,i=this._paused||t.paused||e.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i))}play(e){const{start:t,end:i,speed:n,loop:o,volume:r,muted:a,filters:h}=e;i&&console.assert(i>t,"End time is before start time"),this._paused=!1;const{source:d,gain:c}=this._media.nodes.cloneBufferSource();this._source=d,this._gain=c,this._speed=n,this._volume=r,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();const g=this._source.buffer.duration;this._duration=g,this._end=i,this._lastUpdate=this._now(),this._elapsed=t,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=t,this._source.start(0,t)):i?this._source.start(0,t,i-t):this._source.start(0,t),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(e){v.shared.remove(this._updateListener,this),e&&v.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(e){this._paused=e,this.refreshPaused()}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(e=!1){if(this._source){const t=this._now(),i=t-this._lastUpdate;if(i>0||e){const n=this._source.playbackRate.value;this._elapsed+=i*n,this._lastUpdate=t;const o=this._duration;let r;if(this._source.loopStart){const a=this._source.loopEnd-this._source.loopStart;r=(this._source.loopStart+this._elapsed%a)/o}else r=this._elapsed%o/o;this._progress=r,this.emit("progress",this._progress,o)}}}init(e){this._media=e,e.context.events.on("refresh",this.refresh,this),e.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(e){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",e)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(e){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",e)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class K{constructor(e,t){this._output=t,this._input=e}get destination(){return this._input}get filters(){return this._filters}set filters(e){if(this._filters&&(this._filters.forEach(t=>{t&&t.disconnect()}),this._filters=null,this._input.connect(this._output)),e&&e.length){this._filters=e.slice(0),this._input.disconnect();let t=null;e.forEach(i=>{t===null?this._input.connect(i.destination):t.connect(i.destination),t=i}),t.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const $=class extends K{constructor(s){const e=s.audioContext,t=e.createBufferSource(),i=e.createGain(),n=e.createAnalyser();t.connect(n),n.connect(i),i.connect(s.destination),super(n,i),this.context=s,this.bufferSource=t,this.gain=i,this.analyser=n}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor($.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const s=this.bufferSource,e=this.context.audioContext.createBufferSource();e.buffer=s.buffer,_.setParamValue(e.playbackRate,s.playbackRate.value),e.loop=s.loop;const t=this.context.audioContext.createGain();return e.connect(t),t.connect(this.destination),{source:e,gain:t}}get bufferSize(){return this.script.bufferSize}};let M=$;M.BUFFER_SIZE=0;class L{init(e){this.parent=e,this._nodes=new M(this.context),this._source=this._nodes.bufferSource,this.source=e.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(e){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",e)}this._source=null,this.source=null}create(){return new V(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(e){this._nodes.filters=e}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(e){this._source.buffer=e}get nodes(){return this._nodes}load(e){this.source?this._decode(this.source,e):this.parent.url?this._loadUrl(e):e?e(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(e){const t=this.parent.url,i=await U.get().fetch(t);this._decode(await i.arrayBuffer(),e)}_decode(e,t){const i=(n,o)=>{if(n)t&&t(n);else{this.parent.isLoaded=!0,this.buffer=o;const r=this.parent.autoPlayStart();t&&t(null,this.parent,r)}};e instanceof AudioBuffer?i(null,e):this.parent.context.decode(e,i)}}const x=class{static from(s){let e={};typeof s=="string"?e.url=s:s instanceof ArrayBuffer||s instanceof AudioBuffer||s instanceof HTMLAudioElement?e.source=s:Array.isArray(s)?e.url=s:e=s,e={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...e},Object.freeze(e);const t=l().useLegacy?new G:new L;return new x(t,e)}constructor(s,e){this.media=s,this.options=e,this._instances=[],this._sprites={},this.media.init(this);const t=e.complete;this._autoPlayOptions=t?{complete:t}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=e.autoPlay,this.singleInstance=e.singleInstance,this.preload=e.preload||this.autoPlay,this.url=Array.isArray(e.url)?this.preferUrl(e.url):e.url,this.speed=e.speed,this.volume=e.volume,this.loop=e.loop,e.sprites&&this.addSprites(e.sprites),this.preload&&this._preload(e.loaded)}preferUrl(s){const[e]=s.map(t=>({url:t,ext:F.extname(t).slice(1)})).filter(({ext:t})=>A[t]).sort((t,i)=>P.indexOf(t.ext)-P.indexOf(i.ext));if(!e)throw new Error("No supported file type found");return e.url}get context(){return l().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get filters(){return this.media.filters}set filters(s){this.media.filters=s}addSprites(s,e){if(typeof s=="object"){const i={};for(const n in s)i[n]=this.addSprites(n,s[n]);return i}console.assert(!this._sprites[s],`Alias ${s} is already taken`);const t=new ee(this,e);return this._sprites[s]=t,t}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(s){if(s){const e=this._sprites[s];e!==void 0&&(e.destroy(),delete this._sprites[s])}else for(const e in this._sprites)this.removeSprites(e);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let s=this._instances.length-1;s>=0;s--)this._instances[s].stop();return this}play(s,e){let t;if(typeof s=="string"?t={sprite:s,loop:this.loop,complete:e}:typeof s=="function"?(t={},t.complete=s):t=s,t={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...t||{}},t.sprite){const n=t.sprite;console.assert(!!this._sprites[n],`Alias ${n} is not available`);const o=this._sprites[n];t.start=o.start+(t.start||0),t.end=o.end,t.speed=o.speed||1,t.loop=o.loop||t.loop,delete t.sprite}if(t.offset&&(t.start=t.offset),!this.isLoaded)return this._preloadQueue?new Promise(n=>{this._preloadQueue.push(()=>{n(this.play(t))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=t,new Promise((n,o)=>{this._preload((r,a,h)=>{this._preloadQueue.forEach(d=>d()),this._preloadQueue=null,r?o(r):(t.loaded&&t.loaded(r,a,h),n(h))})}));(this.singleInstance||t.singleInstance)&&this._removeInstances();const i=this._createInstance();return this._instances.push(i),this.isPlaying=!0,i.once("end",()=>{t.complete&&t.complete(this),this._onComplete(i)}),i.once("stop",()=>{this._onComplete(i)}),i.play(t),i}refresh(){const s=this._instances.length;for(let e=0;e<s;e++)this._instances[e].refresh()}refreshPaused(){const s=this._instances.length;for(let e=0;e<s;e++)this._instances[e].refreshPaused()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}_preload(s){this.media.load(s)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let s;return this.autoPlay&&(s=this.play(this._autoPlayOptions)),s}_removeInstances(){for(let s=this._instances.length-1;s>=0;s--)this._poolInstance(this._instances[s]);this._instances.length=0}_onComplete(s){if(this._instances){const e=this._instances.indexOf(s);e>-1&&this._instances.splice(e,1),this.isPlaying=this._instances.length>0}this._poolInstance(s)}_createInstance(){if(x._pool.length>0){const s=x._pool.pop();return s.init(this.media),s}return this.media.create()}_poolInstance(s){s.destroy(),x._pool.indexOf(s)<0&&x._pool.push(s)}};let w=x;w._pool=[];class b extends K{constructor(){const e=window,t=new b.AudioContext,i=t.createDynamicsCompressor(),n=t.createAnalyser();n.connect(i),i.connect(t.destination),super(n,i),this.autoPause=!0,this._ctx=t,this._offlineCtx=new b.OfflineAudioContext(1,2,e.OfflineAudioContext?Math.max(8e3,Math.min(96e3,t.sampleRate)):44100),this.compressor=i,this.analyser=n,this.events=new S,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=t.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const e=this._ctx.state;(e==="suspended"||e==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const e=this._ctx.createBufferSource();e.buffer=this._ctx.createBuffer(1,1,22050),e.connect(this._ctx.destination),e.start(0,0,0),e.context.state==="suspended"&&e.context.resume()}static get AudioContext(){const e=window;return e.AudioContext||e.webkitAudioContext||null}static get OfflineAudioContext(){const e=window;return e.OfflineAudioContext||e.webkitOfflineAudioContext||null}destroy(){super.destroy();const e=this._ctx;typeof e.close<"u"&&e.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(e){e&&this._ctx.state==="running"?this._ctx.suspend():!e&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=e}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(e,t){const i=o=>{t(new Error(o?.message||"Unable to decode file"))},n=this._offlineCtx.decodeAudioData(e,o=>{t(null,o)},i);n&&n.catch(i)}}class se{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new b),this._htmlAudioContext=new I,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(e){this.useLegacy||(this._context.filters=e)}get supported(){return b.AudioContext!==null}add(e,t){if(typeof e=="object"){const o={};for(const r in e){const a=this._getOptions(e[r],t);o[r]=this.add(r,a)}return o}if(console.assert(!this._sounds[e],`Sound with alias ${e} already exists.`),t instanceof w)return this._sounds[e]=t,t;const i=this._getOptions(t),n=w.from(i);return this._sounds[e]=n,n}_getOptions(e,t){let i;return typeof e=="string"?i={url:e}:Array.isArray(e)?i={url:e}:e instanceof ArrayBuffer||e instanceof AudioBuffer||e instanceof HTMLAudioElement?i={source:e}:i=e,i={...i,...t||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(e){this._useLegacy=e,this._context=!e&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(e){this._webAudioContext.autoPause=!e}remove(e){return this.exists(e,!0),this._sounds[e].destroy(),delete this._sounds[e],this}get volumeAll(){return this._context.volume}set volumeAll(e){this._context.volume=e,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(e){this._context.speed=e,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const e in this._sounds)this._sounds[e].destroy(),delete this._sounds[e];return this}stopAll(){for(const e in this._sounds)this._sounds[e].stop();return this}exists(e,t=!1){const i=!!this._sounds[e];return t&&console.assert(i,`No sound matching alias '${e}'.`),i}isPlaying(){for(const e in this._sounds)if(this._sounds[e].isPlaying)return!0;return!1}find(e){return this.exists(e,!0),this._sounds[e]}play(e,t){return this.find(e).play(t)}stop(e){return this.find(e).stop()}pause(e){return this.find(e).pause()}resume(e){return this.find(e).resume()}volume(e,t){const i=this.find(e);return t!==void 0&&(i.volume=t),i.volume}speed(e,t){const i=this.find(e);return t!==void 0&&(i.speed=t),i.speed}duration(e){return this.find(e).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}let D=0;function ie(s,e){const t=`alias${D++}`;return l().add(t,{url:s,preload:!0,autoPlay:!0,loaded:i=>{i&&(console.error(i),l().remove(t),e&&e(i))},complete:()=>{l().remove(t),e&&e(null)}}),t}function ne(s,e){const t=document.createElement("canvas");e={width:512,height:128,fill:"black",...e||{}},t.width=e.width,t.height=e.height;const i=new j({resource:t});if(!(s.media instanceof L))return i;const n=s.media;console.assert(!!n.buffer,"No buffer found, load first");const o=t.getContext("2d");o.fillStyle=e.fill;const r=n.buffer.getChannelData(0),a=Math.ceil(r.length/e.width),h=e.height/2;for(let d=0;d<e.width;d++){let c=1,g=-1;for(let f=0;f<a;f++){const p=r[d*a+f];p<c&&(c=p),p>g&&(g=p)}o.fillRect(d,(1+c)*h,1,Math.max(1,(g-c)*h))}return i}function oe(s=200,e=1){const t=w.from({singleInstance:!0});if(!(t.media instanceof L))return t;const i=t.media,n=t.context,o=1,r=48e3,a=2,h=n.audioContext.createBuffer(o,e*r,r),d=h.getChannelData(0);for(let c=0;c<d.length;c++){const g=c/h.sampleRate,f=s*g*2*Math.PI;d[c]=Math.sin(f)*a}return i.buffer=h,t.isLoaded=!0,t}const le=Object.freeze(Object.defineProperty({__proto__:null,get PLAY_ID(){return D},extensions:P,mimes:O,playOnce:ie,render:ne,sineTone:oe,supported:A,validateFormats:R},Symbol.toStringTag,{value:"Module"})),de=Object.freeze(Object.defineProperty({__proto__:null,WebAudioContext:b,WebAudioInstance:V,WebAudioMedia:L,WebAudioNodes:M,WebAudioUtils:_},Symbol.toStringTag,{value:"Module"})),k=s=>{const e=s.src;let t=s?.alias?.[0];return(!t||s.src===t)&&(t=F.basename(e,F.extname(e))),t},re={extension:T.Asset,detection:{test:async()=>!0,add:async s=>[...s,...P.filter(e=>A[e])],remove:async s=>s.filter(e=>s.includes(e))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:H.High},test(s){const e=F.extname(s).slice(1);return!!A[e]||O.some(t=>s.startsWith(`data:${t}`))},async load(s,e){const t=await new Promise((i,n)=>w.from({...e.data,url:s,preload:!0,loaded(o,r){o?n(o):i(r),e.data?.loaded?.(o,r)}}));return l().add(k(e),t),t},async unload(s,e){l().remove(k(e))}}};N.add(re);const ce=q(new se);export{y as Filter,K as Filterable,w as Sound,se as SoundLibrary,ee as SoundSprite,ue as filters,he as htmlaudio,ce as sound,re as soundAsset,le as utils,de as webaudio};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{a8 as Ve,bb as Oe,bc as Mt,ax as oe,b9 as Qt,bk as Ye,bl as Fs,bm as Nt,b8 as _e,bn as Xs,bo as Ps,bp as Fe,bq as Zt,br as Rs,bs as Bs,bt as Es,bu as Ls,bv as Ds,bw as Ns,bx as Vs,by as Os,bz as _s,bA as Ws,bB as Us,bi as qs,bC as zs,b7 as te,bD as Gs,a4 as se,bE as ue,bF as Xe,a3 as ct,a6 as $s}from"./index-_bCaipUk.js";if(typeof window<"u"&&window.PIXI){const C=window.require;window.require=t=>{if(C)return C(t);if(t.startsWith("@pixi/")||t.startsWith("pixi.js"))return window.PIXI}}class ar{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class We{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class V{r;g;b;a;static WHITE=new V(1,1,1,1);static RED=new V(1,0,0,1);static GREEN=new V(0,1,0,1);static BLUE=new V(0,0,1,1);static MAGENTA=new V(1,0,1,1);constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(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(t,e){t.r=((e&4278190080)>>>24)/255,t.g=((e&16711680)>>>16)/255,t.b=((e&65280)>>>8)/255,t.a=(e&255)/255}static rgb888ToColor(t,e){t.r=((e&16711680)>>>16)/255,t.g=((e&65280)>>>8)/255,t.b=(e&255)/255}toRgb888(){const t=e=>("0"+(e*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,e=new V){return e.setFromString(t)}}class B{static PI=3.1415927;static PI2=B.PI*2;static invPI2=1/B.PI2;static radiansToDegrees=180/B.PI;static radDeg=B.radiansToDegrees;static degreesToRadians=B.PI/180;static degRad=B.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*B.degRad)}static sinDeg(t){return Math.sin(t*B.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*B.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),.3333333333333333);return t<0?-e:e}static randomTriangular(t,e){return B.randomTriangularWith(t,e,(t+e)*.5)}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&(t&t-1)===0}}class Hs{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class js extends Hs{power=2;constructor(t){super(),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 or extends js{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}class E{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,e,s,i,n){for(let h=e,a=i;h<e+n;h++,a++)s[a]=t[h]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:E.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(E.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let s=0;s<e.length;s++)e[s]=0;return e}}static newShortArray(t){if(E.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let s=0;s<e.length;s++)e[s]=0;return e}}static toFloatArray(t){return E.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return E.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class lr{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class $t{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class ie{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}}class hr{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.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{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}class Ue{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class pt extends Ue{static nextID=0;id=pt.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,i,n,h){s=n+(s>>1)*h;let a=t.bone.skeleton,r=t.deform,o=this.vertices,l=this.bones;if(!l){r.length>0&&(o=r);let f=t.bone,m=f.worldX,g=f.worldY,w=f.a,b=f.b,p=f.c,x=f.d;for(let y=e,v=n;v<s;y+=2,v+=h){let A=o[y],k=o[y+1];i[v]=A*w+k*b+m,i[v+1]=A*p+k*x+g}return}let c=0,d=0;for(let f=0;f<e;f+=2){let m=l[c];c+=m+1,d+=m}let u=a.bones;if(r.length==0)for(let f=n,m=d*3;f<s;f+=h){let g=0,w=0,b=l[c++];for(b+=c;c<b;c++,m+=3){let p=u[l[c]],x=o[m],y=o[m+1],v=o[m+2];g+=(x*p.a+y*p.b+p.worldX)*v,w+=(x*p.c+y*p.d+p.worldY)*v}i[f]=g,i[f+1]=w}else{let f=r;for(let m=n,g=d*3,w=d<<1;m<s;m+=h){let b=0,p=0,x=l[c++];for(x+=c;c<x;c++,g+=3,w+=2){let y=u[l[c]],v=o[g]+f[w],A=o[g+1]+f[w+1],k=o[g+2];b+=(v*y.a+A*y.b+y.worldX)*k,p+=(v*y.c+A*y.d+y.worldY)*k}i[m]=b,i[m+1]=p}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class Vt{static _nextID=0;id=Vt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Vt(this.regions.length);return E.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let n=this.digits-i.length;n>0;n--)s+="0";return s+=i,s}static nextID(){return Vt._nextID++}}var et;(function(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"})(et||(et={}));const qe=[et.hold,et.once,et.loop,et.pingpong,et.onceReverse,et.loopReverse,et.pingpongReverse];class ye{name;timelines=[];timelineIds=new We;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,h,a,r){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let o=this.timelines;for(let l=0,c=o.length;l<c;l++)o[l].apply(t,e,s,n,h,a,r)}}var P;(function(C){C[C.setup=0]="setup",C[C.first=1]="first",C[C.replace=2]="replace",C[C.add=3]="add"})(P||(P={}));var nt;(function(C){C[C.mixIn=0]="mixIn",C[C.mixOut=1]="mixOut"})(nt||(nt={}));const _={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class J{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=E.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}}class Ct extends J{curves;constructor(t,e,s){super(t,s),this.curves=E.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=E.newFloatArray(e);E.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,n,h,a,r,o,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let f=(i-h*2+r)*.03,m=(n-a*2+o)*.03,g=((h-r)*3-i+l)*.006,w=((a-o)*3-n+c)*.006,b=f*2+g,p=m*2+w,x=(h-i)*.3+f+g*.16666667,y=(a-n)*.3+m+w*.16666667,v=i+x,A=n+y;for(let k=u+18;u<k;u+=2)d[u]=v,d[u+1]=A,x+=b,y+=p,b+=g,p+=w,v+=x,A+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let o=this.frames[e],l=this.frames[e+s];return l+(t-o)/(n[i]-o)*(n[i+1]-l)}let h=i+18;for(i+=2;i<h;i+=2)if(n[i]>=t){let o=n[i-2],l=n[i-1];return l+(t-o)/(n[i]-o)*(n[i+1]-l)}e+=this.getFrameEntries();let a=n[h-2],r=n[h-1];return r+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-r)}}class xt extends Ct{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}let i=this.curves[s>>1];switch(i){case 0:let n=e[s],h=e[s+1];return h+(t-n)/(e[s+2]-n)*(e[s+2+1]-h);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}let h=this.getCurveValue(t);switch(s){case P.setup:return n+h*e;case P.first:case P.replace:h+=n-i}return i+h*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}let h=this.getCurveValue(t);return s==P.setup?n+(h-n)*e:i+(h-i)*e}getAbsoluteValue2(t,e,s,i,n,h){if(t<this.frames[0]){switch(s){case P.setup:return n;case P.first:return i+(n-i)*e}return i}return s==P.setup?n+(h-n)*e:i+(h-i)*e}getScaleValue(t,e,s,i,n,h){const a=this.frames;if(t<a[0]){switch(s){case P.setup:return h;case P.first:return n+(h-n)*e}return n}let r=this.getCurveValue(t)*h;if(e==1)return s==P.add?n+r-h:r;if(i==nt.mixOut)switch(s){case P.setup:return h+(Math.abs(r)*B.signum(h)-h)*e;case P.first:case P.replace:return n+(Math.abs(r)*B.signum(n)-n)*e}else{let o=0;switch(s){case P.setup:return o=Math.abs(h)*B.signum(r),o+(r-o)*e;case P.first:case P.replace:return o=Math.abs(n)*B.signum(r),o+(r-o)*e}}return n+(r-h)*e}}class ve extends Ct{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class re extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(s,n,h,r.rotation,r.data.rotation))}}class ze extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.x+"|"+s,_.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.x=r.data.x,r.y=r.data.y;return;case P.first:r.x+=(r.data.x-r.x)*n,r.y+=(r.data.y-r.y)*n}return}let l=0,c=0,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case P.setup:r.x=r.data.x+l*n,r.y=r.data.y+c*n;break;case P.first:case P.replace:r.x+=(r.data.x+l-r.x)*n,r.y+=(r.data.y+c-r.y)*n;break;case P.add:r.x+=l*n,r.y+=c*n}}}class Ge extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(s,n,h,r.x,r.data.x))}}class $e extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(s,n,h,r.y,r.data.y))}}class He extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleX+"|"+s,_.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case P.first:r.scaleX+=(r.data.scaleX-r.scaleX)*n,r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let l,c,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}if(l*=r.data.scaleX,c*=r.data.scaleY,n==1)h==P.add?(r.scaleX+=l-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=l,r.scaleY=c);else{let f=0,m=0;if(a==nt.mixOut)switch(h){case P.setup:f=r.data.scaleX,m=r.data.scaleY,r.scaleX=f+(Math.abs(l)*B.signum(f)-f)*n,r.scaleY=m+(Math.abs(c)*B.signum(m)-m)*n;break;case P.first:case P.replace:f=r.scaleX,m=r.scaleY,r.scaleX=f+(Math.abs(l)*B.signum(f)-f)*n,r.scaleY=m+(Math.abs(c)*B.signum(m)-m)*n;break;case P.add:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}else switch(h){case P.setup:f=Math.abs(r.data.scaleX)*B.signum(l),m=Math.abs(r.data.scaleY)*B.signum(c),r.scaleX=f+(l-f)*n,r.scaleY=m+(c-m)*n;break;case P.first:case P.replace:f=Math.abs(r.scaleX)*B.signum(l),m=Math.abs(r.scaleY)*B.signum(c),r.scaleX=f+(l-f)*n,r.scaleY=m+(c-m)*n;break;case P.add:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}}}}class je extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(s,n,h,a,r.scaleX,r.data.scaleX))}}class Je extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(s,n,h,a,r.scaleY,r.data.scaleY))}}class Ke extends ve{boneIndex=0;constructor(t,e,s){super(t,e,_.shearX+"|"+s,_.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case P.first:r.shearX+=(r.data.shearX-r.shearX)*n,r.shearY+=(r.data.shearY-r.shearY)*n}return}let l=0,c=0,d=J.search(o,s,3),u=this.curves[d/3];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+3]-f);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(h){case P.setup:r.shearX=r.data.shearX+l*n,r.shearY=r.data.shearY+c*n;break;case P.first:case P.replace:r.shearX+=(r.data.shearX+l-r.shearX)*n,r.shearY+=(r.data.shearY+c-r.shearY)*n;break;case P.add:r.shearX+=l*n,r.shearY+=c*n}}}class Qe extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(s,n,h,r.shearX,r.data.shearX))}}class Ze extends xt{boneIndex=0;constructor(t,e,s){super(t,e,_.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(s,n,h,r.shearY,r.data.shearY))}}class ts extends J{boneIndex=0;constructor(t,e){super(t,[_.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,n,h,a){let r=t.bones[this.boneIndex];if(!r.active)return;if(a==nt.mixOut){h==P.setup&&(r.inherit=r.data.inherit);return}let o=this.frames;if(s<o[0]){(h==P.setup||h==P.first)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[J.search(o,s,2)+1]}}class es extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,h){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(s<o[0]){let w=r.data.color;switch(h){case P.setup:l.setFromColor(w);return;case P.first:l.add((w.r-l.r)*n,(w.g-l.g)*n,(w.b-l.b)*n,(w.a-l.a)*n)}return}let c=0,d=0,u=0,f=0,m=J.search(o,s,5),g=this.curves[m/5];switch(g){case 0:let w=o[m];c=o[m+1],d=o[m+2],u=o[m+3],f=o[m+4];let b=(s-w)/(o[m+5]-w);c+=(o[m+5+1]-c)*b,d+=(o[m+5+2]-d)*b,u+=(o[m+5+3]-u)*b,f+=(o[m+5+4]-f)*b;break;case 1:c=o[m+1],d=o[m+2],u=o[m+3],f=o[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),u=this.getBezierValue(s,m,3,g+36-2),f=this.getBezierValue(s,m,4,g+54-2)}n==1?l.set(c,d,u,f):(h==P.setup&&l.setFromColor(r.data.color),l.add((c-l.r)*n,(d-l.g)*n,(u-l.b)*n,(f-l.a)*n))}}class ss extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(s<o[0]){let g=r.data.color;switch(h){case P.setup:l.r=g.r,l.g=g.g,l.b=g.b;return;case P.first:l.r+=(g.r-l.r)*n,l.g+=(g.g-l.g)*n,l.b+=(g.b-l.b)*n}return}let c=0,d=0,u=0,f=J.search(o,s,4),m=this.curves[f>>2];switch(m){case 0:let g=o[f];c=o[f+1],d=o[f+2],u=o[f+3];let w=(s-g)/(o[f+4]-g);c+=(o[f+4+1]-c)*w,d+=(o[f+4+2]-d)*w,u+=(o[f+4+3]-u)*w;break;case 1:c=o[f+1],d=o[f+2],u=o[f+3];break;default:c=this.getBezierValue(s,f,1,m-2),d=this.getBezierValue(s,f,2,m+18-2),u=this.getBezierValue(s,f,3,m+36-2)}if(n==1)l.r=c,l.g=d,l.b=u;else{if(h==P.setup){let g=r.data.color;l.r=g.r,l.g=g.g,l.b=g.b}l.r+=(c-l.r)*n,l.g+=(d-l.g)*n,l.b+=(u-l.b)*n}}}class is extends xt{slotIndex=0;constructor(t,e,s){super(t,e,_.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(s<this.frames[0]){let c=r.data.color;switch(h){case P.setup:o.a=c.a;return;case P.first:o.a+=(c.a-o.a)*n}return}let l=this.getCurveValue(s);n==1?o.a=l:(h==P.setup&&(o.a=r.data.color.a),o.a+=(l-o.a)*n)}}class rs extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.alpha+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,h,a,r,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h,this.frames[t+5]=a,this.frames[t+6]=r,this.frames[t+7]=o}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(s<o[0]){let y=r.data.color,v=r.data.darkColor;switch(h){case P.setup:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case P.first:l.add((y.r-l.r)*n,(y.g-l.g)*n,(y.b-l.b)*n,(y.a-l.a)*n),c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n}return}let d=0,u=0,f=0,m=0,g=0,w=0,b=0,p=J.search(o,s,8),x=this.curves[p>>3];switch(x){case 0:let y=o[p];d=o[p+1],u=o[p+2],f=o[p+3],m=o[p+4],g=o[p+5],w=o[p+6],b=o[p+7];let v=(s-y)/(o[p+8]-y);d+=(o[p+8+1]-d)*v,u+=(o[p+8+2]-u)*v,f+=(o[p+8+3]-f)*v,m+=(o[p+8+4]-m)*v,g+=(o[p+8+5]-g)*v,w+=(o[p+8+6]-w)*v,b+=(o[p+8+7]-b)*v;break;case 1:d=o[p+1],u=o[p+2],f=o[p+3],m=o[p+4],g=o[p+5],w=o[p+6],b=o[p+7];break;default:d=this.getBezierValue(s,p,1,x-2),u=this.getBezierValue(s,p,2,x+18-2),f=this.getBezierValue(s,p,3,x+36-2),m=this.getBezierValue(s,p,4,x+54-2),g=this.getBezierValue(s,p,5,x+72-2),w=this.getBezierValue(s,p,6,x+90-2),b=this.getBezierValue(s,p,7,x+108-2)}if(n==1)l.set(d,u,f,m),c.r=g,c.g=w,c.b=b;else{if(h==P.setup){l.setFromColor(r.data.color);let y=r.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((d-l.r)*n,(u-l.g)*n,(f-l.b)*n,(m-l.a)*n),c.r+=(g-c.r)*n,c.g+=(w-c.g)*n,c.b+=(b-c.b)*n}}}class ns extends Ct{slotIndex=0;constructor(t,e,s){super(t,e,[_.rgb+"|"+s,_.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,h,a,r){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h,this.frames[t+5]=a,this.frames[t+6]=r}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(s<o[0]){let x=r.data.color,y=r.data.darkColor;switch(h){case P.setup:l.r=x.r,l.g=x.g,l.b=x.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case P.first:l.r+=(x.r-l.r)*n,l.g+=(x.g-l.g)*n,l.b+=(x.b-l.b)*n,c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let d=0,u=0,f=0,m=0,g=0,w=0,b=J.search(o,s,7),p=this.curves[b/7];switch(p){case 0:let x=o[b];d=o[b+1],u=o[b+2],f=o[b+3],m=o[b+4],g=o[b+5],w=o[b+6];let y=(s-x)/(o[b+7]-x);d+=(o[b+7+1]-d)*y,u+=(o[b+7+2]-u)*y,f+=(o[b+7+3]-f)*y,m+=(o[b+7+4]-m)*y,g+=(o[b+7+5]-g)*y,w+=(o[b+7+6]-w)*y;break;case 1:d=o[b+1],u=o[b+2],f=o[b+3],m=o[b+4],g=o[b+5],w=o[b+6];break;default:d=this.getBezierValue(s,b,1,p-2),u=this.getBezierValue(s,b,2,p+18-2),f=this.getBezierValue(s,b,3,p+36-2),m=this.getBezierValue(s,b,4,p+54-2),g=this.getBezierValue(s,b,5,p+72-2),w=this.getBezierValue(s,b,6,p+90-2)}if(n==1)l.r=d,l.g=u,l.b=f,c.r=m,c.g=g,c.b=w;else{if(h==P.setup){let x=r.data.color,y=r.data.darkColor;l.r=x.r,l.g=x.g,l.b=x.b,c.r=y.r,c.g=y.g,c.b=y.b}l.r+=(d-l.r)*n,l.g+=(u-l.g)*n,l.b+=(f-l.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(w-c.b)*n}}}class Dt extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[_.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(r.bone.active){if(a==nt.mixOut){h==P.setup&&this.setAttachment(t,r,r.data.attachmentName);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&this.setAttachment(t,r,r.data.attachmentName);return}this.setAttachment(t,r,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class as extends Ct{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[_.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,h,a,r,o,l,c){let d=this.curves,u=this.getFrameCount()+t*18;s==0&&(d[e]=2+u);let f=(i-h*2+r)*.03,m=o*.03-a*.06,g=((h-r)*3-i+l)*.006,w=(a-o+.33333333)*.018,b=f*2+g,p=m*2+w,x=(h-i)*.3+f+g*.16666667,y=a*.3+m+w*.16666667,v=i+x,A=y;for(let k=u+18;u<k;u+=2)d[u]=v,d[u+1]=A,x+=b,y+=p,b+=g,p+=w,v+=x,A+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let r=this.frames[e];return(t-r)/(this.frames[e+this.getFrameEntries()]-r);case 1:return 0}if(i-=2,s[i]>t){let r=this.frames[e];return s[i+1]*(t-r)/(s[i]-r)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let r=s[i-2],o=s[i-1];return o+(t-r)/(s[i]-r)*(s[i+1]-o)}let h=s[n-2],a=s[n-1];return a+(1-a)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof pt)||o.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=P.setup);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(h){case P.setup:l.length=0;return;case P.first:if(n==1){l.length=0;return}l.length=d;let p=o;if(p.bones){n=1-n;for(var f=0;f<d;f++)l[f]*=n}else{let x=p.vertices;for(var f=0;f<d;f++)l[f]+=(x[f]-l[f])*n}}return}if(l.length=d,s>=u[u.length-1]){let p=c[u.length-1];if(n==1)if(h==P.add){let x=o;if(x.bones)for(let y=0;y<d;y++)l[y]+=p[y];else{let y=x.vertices;for(let v=0;v<d;v++)l[v]+=p[v]-y[v]}}else E.arrayCopy(p,0,l,0,d);else switch(h){case P.setup:{let y=o;if(y.bones)for(let v=0;v<d;v++)l[v]=p[v]*n;else{let v=y.vertices;for(let A=0;A<d;A++){let k=v[A];l[A]=k+(p[A]-k)*n}}break}case P.first:case P.replace:for(let y=0;y<d;y++)l[y]+=(p[y]-l[y])*n;break;case P.add:let x=o;if(x.bones)for(let y=0;y<d;y++)l[y]+=p[y]*n;else{let y=x.vertices;for(let v=0;v<d;v++)l[v]+=(p[v]-y[v])*n}}return}let m=J.search1(u,s),g=this.getCurvePercent(s,m),w=c[m],b=c[m+1];if(n==1)if(h==P.add){let p=o;if(p.bones)for(let x=0;x<d;x++){let y=w[x];l[x]+=y+(b[x]-y)*g}else{let x=p.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=v+(b[y]-v)*g-x[y]}}}else for(let p=0;p<d;p++){let x=w[p];l[p]=x+(b[p]-x)*g}else switch(h){case P.setup:{let x=o;if(x.bones)for(let y=0;y<d;y++){let v=w[y];l[y]=(v+(b[y]-v)*g)*n}else{let y=x.vertices;for(let v=0;v<d;v++){let A=w[v],k=y[v];l[v]=k+(A+(b[v]-A)*g-k)*n}}break}case P.first:case P.replace:for(let x=0;x<d;x++){let y=w[x];l[x]+=(y+(b[x]-y)*g-l[x])*n}break;case P.add:let p=o;if(p.bones)for(let x=0;x<d;x++){let y=w[x];l[x]+=(y+(b[x]-y)*g)*n}else{let x=p.vertices;for(let y=0;y<d;y++){let v=w[y];l[y]+=(v+(b[y]-v)*g-x[y])*n}}}}}class Ht extends J{static propertyIds=[""+_.event];events;constructor(t){super(t,Ht.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,h,a){if(!i)return;let r=this.frames,o=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,h,a),e=-1;else if(e>=r[o-1])return;if(s<r[0])return;let l=0;if(e<r[0])l=0;else{l=J.search1(r,e)+1;let c=r[l];for(;l>0&&r[l-1]==c;)l--}for(;l<o&&s>=r[l];l++)i.push(this.events[l])}}class Xt extends J{static propertyIds=[""+_.drawOrder];drawOrders;constructor(t){super(t,Xt.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,h,a){if(a==nt.mixOut){h==P.setup&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(s<this.frames[0]){(h==P.setup||h==P.first)&&E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let r=J.search1(this.frames,s),o=this.drawOrders[r];if(!o)E.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let l=t.drawOrder,c=t.slots;for(let d=0,u=o.length;d<u;d++)l[d]=c[o[d]]}}}class os extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,h,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=h?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,h,a){let r=t.ikConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case P.first:r.mix+=(r.data.mix-r.mix)*n,r.softness+=(r.data.softness-r.softness)*n,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let l=0,c=0,d=J.search(o,s,6),u=this.curves[d/6];switch(u){case 0:let f=o[d];l=o[d+1],c=o[d+2];let m=(s-f)/(o[d+6]-f);l+=(o[d+6+1]-l)*m,c+=(o[d+6+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}h==P.setup?(r.mix=r.data.mix+(l-r.data.mix)*n,r.softness=r.data.softness+(c-r.data.softness)*n,a==nt.mixOut?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0)):(r.mix+=(l-r.mix)*n,r.softness+=(c-r.softness)*n,a==nt.mixIn&&(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0))}}class ls extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,h,a,r){let o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=i,o[t+3]=n,o[t+4]=h,o[t+5]=a,o[t+6]=r}apply(t,e,s,i,n,h,a){let r=t.transformConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){let b=r.data;switch(h){case P.setup:r.mixRotate=b.mixRotate,r.mixX=b.mixX,r.mixY=b.mixY,r.mixScaleX=b.mixScaleX,r.mixScaleY=b.mixScaleY,r.mixShearY=b.mixShearY;return;case P.first:r.mixRotate+=(b.mixRotate-r.mixRotate)*n,r.mixX+=(b.mixX-r.mixX)*n,r.mixY+=(b.mixY-r.mixY)*n,r.mixScaleX+=(b.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(b.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(b.mixShearY-r.mixShearY)*n}return}let l,c,d,u,f,m,g=J.search(o,s,7),w=this.curves[g/7];switch(w){case 0:let b=o[g];l=o[g+1],c=o[g+2],d=o[g+3],u=o[g+4],f=o[g+5],m=o[g+6];let p=(s-b)/(o[g+7]-b);l+=(o[g+7+1]-l)*p,c+=(o[g+7+2]-c)*p,d+=(o[g+7+3]-d)*p,u+=(o[g+7+4]-u)*p,f+=(o[g+7+5]-f)*p,m+=(o[g+7+6]-m)*p;break;case 1:l=o[g+1],c=o[g+2],d=o[g+3],u=o[g+4],f=o[g+5],m=o[g+6];break;default:l=this.getBezierValue(s,g,1,w-2),c=this.getBezierValue(s,g,2,w+18-2),d=this.getBezierValue(s,g,3,w+36-2),u=this.getBezierValue(s,g,4,w+54-2),f=this.getBezierValue(s,g,5,w+72-2),m=this.getBezierValue(s,g,6,w+90-2)}if(h==P.setup){let b=r.data;r.mixRotate=b.mixRotate+(l-b.mixRotate)*n,r.mixX=b.mixX+(c-b.mixX)*n,r.mixY=b.mixY+(d-b.mixY)*n,r.mixScaleX=b.mixScaleX+(u-b.mixScaleX)*n,r.mixScaleY=b.mixScaleY+(f-b.mixScaleY)*n,r.mixShearY=b.mixShearY+(m-b.mixShearY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n,r.mixScaleX+=(u-r.mixScaleX)*n,r.mixScaleY+=(f-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}}class hs extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,_.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(s,n,h,r.position,r.data.position))}}class cs extends xt{constraintIndex=0;constructor(t,e,s){super(t,e,_.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(s,n,h,r.spacing,r.data.spacing))}}class ds extends Ct{constraintIndex=0;constructor(t,e,s){super(t,e,[_.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let h=this.frames;t<<=2,h[t]=e,h[t+1]=s,h[t+2]=i,h[t+3]=n}apply(t,e,s,i,n,h,a){let r=t.pathConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(s<o[0]){switch(h){case P.setup:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case P.first:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*n,r.mixX+=(r.data.mixX-r.mixX)*n,r.mixY+=(r.data.mixY-r.mixY)*n}return}let l,c,d,u=J.search(o,s,4),f=this.curves[u>>2];switch(f){case 0:let m=o[u];l=o[u+1],c=o[u+2],d=o[u+3];let g=(s-m)/(o[u+4]-m);l+=(o[u+4+1]-l)*g,c+=(o[u+4+2]-c)*g,d+=(o[u+4+3]-d)*g;break;case 1:l=o[u+1],c=o[u+2],d=o[u+3];break;default:l=this.getBezierValue(s,u,1,f-2),c=this.getBezierValue(s,u,2,f+18-2),d=this.getBezierValue(s,u,3,f+36-2)}if(h==P.setup){let m=r.data;r.mixRotate=m.mixRotate+(l-m.mixRotate)*n,r.mixX=m.mixX+(c-m.mixX)*n,r.mixY=m.mixY+(d-m.mixY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n}}class Bt extends xt{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,n,h,a){let r;if(this.constraintIndex==-1){const o=s>=this.frames[0]?this.getCurveValue(s):0;for(const l of t.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(s,n,h,this.get(l),this.setup(l),o))}else r=t.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(s,n,h,this.get(r),this.setup(r)))}}class fs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class us extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class ms extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class gs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}}class ps extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class xs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class bs extends Bt{constructor(t,e,s){super(t,e,s,_.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class le extends J{static propertyIds=[_.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,le.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,h,a){let r;if(this.constraintIndex!=-1&&(r=t.physicsConstraints[this.constraintIndex],!r.active))return;const o=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],n,h,a),e=-1;else if(e>=o[o.length-1])return;if(!(s<o[0])&&(e<o[0]||s>=o[J.search1(o,e)+1]))if(r!=null)r.reset();else for(const l of t.physicsConstraints)l.active&&l.reset()}}class yt extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[_.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return yt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let h=this.frames;t*=yt.ENTRIES,h[t]=e,h[t+yt.MODE]=s|i<<4,h[t+yt.DELAY]=n}apply(t,e,s,i,n,h,a){let r=t.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,l=this.attachment;if(o!=l&&(!(o instanceof pt)||o.timelineAttachment!=l))return;if(a==nt.mixOut){h==P.setup&&(r.sequenceIndex=-1);return}let c=this.frames;if(s<c[0]){(h==P.setup||h==P.first)&&(r.sequenceIndex=-1);return}let d=J.search(c,s,yt.ENTRIES),u=c[d],f=c[d+yt.MODE],m=c[d+yt.DELAY];if(!this.attachment.sequence)return;let g=f>>4,w=this.attachment.sequence.regions.length,b=qe[f&15];if(b!=et.hold)switch(g+=(s-u)/m+1e-5|0,b){case et.once:g=Math.min(w-1,g);break;case et.loop:g%=w;break;case et.pingpong:{let p=(w<<1)-2;g=p==0?0:g%p,g>=w&&(g=p-g);break}case et.onceReverse:g=Math.max(w-1-g,0);break;case et.loopReverse:g=w-1-g%w;break;case et.pingpongReverse:{let p=(w<<1)-2;g=p==0?0:(g+w-1)%p,g>=w&&(g=p-g)}}r.sequenceIndex=g}}class Ot{static _emptyAnimation=new ye("<empty>",[],0);static emptyAnimation(){return Ot._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ks(this);propertyIDs=new We;animationsChanged=!1;trackEntryPool=new $t(()=>new Js);constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=t*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let a=n.next;if(a){let r=n.trackLast-a.delay;if(r>=0){for(a.delay=0,a.trackTime+=n.timeScale==0?0:(r/n.timeScale+t)*a.timeScale,n.trackTime+=h,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let r=n.mixingFrom;for(n.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((s.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,i=!1;for(let d=0,u=s.length;d<u;d++){let f=s[d];if(!f||f.delay>0)continue;i=!0;let m=d==0?P.first:f.mixBlend,g=f.alpha;f.mixingFrom?g*=this.applyMixingFrom(f,t,m):f.trackTime>=f.trackEnd&&!f.next&&(g=0);let w=g>=f.alphaAttachmentThreshold,b=f.animationLast,p=f.getAnimationTime(),x=p,y=e;f.reverse&&(x=f.animation.duration-x,y=null);let v=f.animation.timelines,A=v.length;if(d==0&&g==1||m==P.add){d==0&&(w=!0);for(let k=0;k<A;k++){E.webkit602BugfixHelper(g,m);var n=v[k];n instanceof Dt?this.applyAttachmentTimeline(n,t,x,m,w):n.apply(t,b,x,y,g,m,nt.mixIn)}}else{let k=f.timelineMode,I=f.shortestRotation,Y=!I&&f.timelinesRotation.length!=A<<1;Y&&(f.timelinesRotation.length=A<<1);for(let T=0;T<A;T++){let R=v[T],X=k[T]==me?m:P.setup;!I&&R instanceof re?this.applyRotateTimeline(R,t,x,g,X,f.timelinesRotation,T<<1,Y):R instanceof Dt?this.applyAttachmentTimeline(R,t,x,m,w):(E.webkit602BugfixHelper(g,m),R.apply(t,b,x,y,g,X,nt.mixIn))}}this.queueEvents(f,p),e.length=0,f.nextAnimationLast=p,f.nextTrackLast=f.trackTime}for(var h=this.unkeyedState+Be,a=t.slots,r=0,o=t.slots.length;r<o;r++){var l=a[r];if(l.attachmentState==h){var c=l.data.attachmentName;l.setAttachment(c?t.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;t.mixDuration==0?(n=1,s==P.first&&(s=P.setup)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),s!=P.first&&(s=i.mixBlend));let h=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,r=i.animation.timelines,o=r.length,l=i.alpha*t.interruptAlpha,c=l*(1-n),d=i.animationLast,u=i.getAnimationTime(),f=u,m=null;if(i.reverse?f=i.animation.duration-f:n<i.eventThreshold&&(m=this.events),s==P.add)for(let g=0;g<o;g++)r[g].apply(e,d,f,m,c,s,nt.mixOut);else{let g=i.timelineMode,w=i.timelineHoldMix,b=i.shortestRotation,p=!b&&i.timelinesRotation.length!=o<<1;p&&(i.timelinesRotation.length=o<<1),i.totalAlpha=0;for(let x=0;x<o;x++){let y=r[x],v=nt.mixOut,A,k=0;switch(g[x]){case me:if(!a&&y instanceof Xt)continue;A=s,k=c;break;case Pe:A=P.setup,k=c;break;case Re:A=s,k=l;break;case ge:A=P.setup,k=l;break;default:A=P.setup;let I=w[x];k=l*Math.max(0,1-I.mixTime/I.mixDuration);break}i.totalAlpha+=k,!b&&y instanceof re?this.applyRotateTimeline(y,e,f,k,A,i.timelinesRotation,x<<1,p):y instanceof Dt?this.applyAttachmentTimeline(y,e,f,A,h&&k>=i.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,s),a&&y instanceof Xt&&A==P.setup&&(v=nt.mixIn),y.apply(e,d,f,m,k,A,v))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var h=e.slots[t.slotIndex];h.bone.active&&(s<t.frames[0]?(i==P.setup||i==P.first)&&this.setAttachment(e,h,h.data.attachmentName,n):this.setAttachment(e,h,t.attachmentNames[J.search1(t.frames,s)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+Be))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Zs)}applyRotateTimeline(t,e,s,i,n,h,a,r){if(r&&(h[a]=0),i==1){t.apply(e,0,s,null,1,n,nt.mixIn);return}let o=e.bones[t.boneIndex];if(!o.active)return;let l=t.frames,c=0,d=0;if(s<l[0])switch(n){case P.setup:o.rotation=o.data.rotation;default:return;case P.first:c=o.rotation,d=o.data.rotation}else c=n==P.setup?o.data.rotation:o.rotation,d=o.data.rotation+t.getCurveValue(s);let u=0,f=d-c;if(f-=Math.ceil(f/360-.5)*360,f==0)u=h[a];else{let m=0,g=0;r?(m=0,g=f):(m=h[a],g=h[a+1]);let w=m-m%360;u=f+w;let b=f>=0,p=m>=0;Math.abs(g)<=90&&B.signum(g)!=B.signum(f)&&(Math.abs(m-w)>180?(u+=360*B.signum(m),p=b):w!=0?u-=360*B.signum(m):p=b),p!=b&&(u+=360*B.signum(m)),h[a]=u}h[a+1]=f,o.rotation=c+u*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,h=t.trackLast%n,a=this.events,r=0,o=a.length;for(;r<o;r++){let c=a[r];if(c.time<h)break;c.time>i||this.queue.event(t,c)}let l=!1;if(t.loop)if(n==0)l=!0;else{const c=Math.floor(t.trackTime/n);l=c>0&&c>Math.floor(t.trackLast/n)}else l=e>=i&&t.animationLast<i;for(l&&this.queue.complete(t);r<o;r++){let c=a[r];c.time<s||this.queue.event(t,c)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(n.nextTrackLast==-1?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let h=this.trackEntry(t,e,s,n);return this.setCurrent(t,h,i),this.queue.drain(),h}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(t,e,s,n);return n?(n.next=h,h.previous=n,i<=0&&(i=Math.max(i+n.getTrackComplete()-h.mixDuration,0))):(this.setCurrent(t,h,!0),this.queue.drain(),i<0&&(i=0)),h.delay=i,h}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,Ot.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,Ot.emptyAnimation(),!1,s);return s<=0&&(i.delay=Math.max(i.delay+i.mixDuration-e,0)),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let n=this.tracks[s];n&&this.setEmptyAnimation(n.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(E.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=P.replace,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let i=t[e];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=P.add)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let h=t.timelineHoldMix;h.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious){for(let r=0;r<i;r++)n[r]=a.addAll(s[r].getPropertyIds())?ge:Re;return}t:for(let r=0;r<i;r++){let o=s[r],l=o.getPropertyIds();if(!a.addAll(l))n[r]=me;else if(!e||o instanceof Dt||o instanceof Xt||o instanceof Ht||!e.animation.hasTimeline(l))n[r]=Pe;else{for(let c=e.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(t.mixDuration>0){n[r]=Qs,h[r]=c;continue t}break}n[r]=ge}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class Js{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=P.replace;timelineMode=new Array;timelineHoldMix=new Array;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){let 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}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}}class Ks{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(ot.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(ot.interrupt),this.objects.push(t)}end(t){this.objects.push(ot.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(ot.dispose),this.objects.push(t)}complete(t){this.objects.push(ot.complete),this.objects.push(t)}event(t,e){this.objects.push(ot.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],n=t[s+1];switch(i){case ot.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<e.length;a++){let r=e[a];r.start&&r.start(n)}break;case ot.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<e.length;a++){let r=e[a];r.interrupt&&r.interrupt(n)}break;case ot.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<e.length;a++){let r=e[a];r.end&&r.end(n)}case ot.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<e.length;a++){let r=e[a];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case ot.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<e.length;a++){let r=e[a];r.complete&&r.complete(n)}break;case ot.event:let h=t[s+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let a=0;a<e.length;a++){let r=e[a];r.event&&r.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var ot;(function(C){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"})(ot||(ot={}));class dr{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const me=0,Pe=1,Re=2,ge=3,Qs=4,Be=1,Zs=2;class ti{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}}class he extends pt{color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new he(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Yt extends pt{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Yt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class ws{_image;constructor(t){this._image=t}getImage(){return this._image}}var tt;(function(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"})(tt||(tt={}));var St;(function(C){C[C.MirroredRepeat=33648]="MirroredRepeat",C[C.ClampToEdge=33071]="ClampToEdge",C[C.Repeat=10497]="Repeat"})(St||(St={}));class ei{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class fr extends ws{setFilters(t,e){}setWraps(t,e){}dispose(){}}class be{pages=new Array;regions=new Array;constructor(t){let e=new si(t),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=E.enumValue(tt,s[1]),l.magFilter=E.enumValue(tt,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=St.Repeat),s[1].indexOf("y")!=-1&&(l.vWrap=St.Repeat)},i.pma=l=>{l.pma=s[1]=="true"};var n={};n.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},n.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},n.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},n.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},n.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},n.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},n.rotate=l=>{let c=s[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},n.index=l=>{l.index=parseInt(s[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(s,h)==0);)h=e.readLine();let a=null,r=null,o=null;for(;h!==null;)if(h.trim().length==0)a=null,h=e.readLine();else if(a){let l=new ys(a,h);for(;;){let c=e.readEntry(s,h=e.readLine());if(c==0)break;let d=n[s[0]];if(d)d(l);else{r||(r=[]),o||(o=[]),r.push(s[0]);let u=[];for(let f=0;f<c;f++)u.push(parseInt(s[f+1]));o.push(u)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),r&&r.length>0&&o&&o.length>0&&(l.names=r,l.values=o,r=null,o=null),l.u=l.x/a.width,l.v=l.y/a.height,l.degrees==90?(l.u2=(l.x+l.height)/a.width,l.v2=(l.y+l.width)/a.height):(l.u2=(l.x+l.width)/a.width,l.v2=(l.y+l.height)/a.height),this.regions.push(l)}else{for(a=new ii(h.trim());e.readEntry(s,h=e.readLine())!=0;){let l=i[s[0]];l&&l(a)}this.pages.push(a)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}}class si{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let h=e.indexOf(",",n);if(h==-1)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,h-n).trim(),n=h+1,i==4)return 4}}}class ii{name;minFilter=tt.Nearest;magFilter=tt.Nearest;uWrap=St.ClampToEdge;vWrap=St.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class ys extends ei{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}}class ft extends pt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=E.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,h=0,a=0;if(this.region instanceof ys){let r=this.region,o=r.page,l=o.width,c=o.height;switch(r.degrees){case 90:i-=(r.originalHeight-r.offsetY-r.height)/l,n-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<s;d+=2)e[d]=i+t[d+1]*h,e[d+1]=n+(1-t[d])*a;return;case 180:i-=(r.originalWidth-r.offsetX-r.width)/l,n-=r.offsetY/c,h=r.originalWidth/l,a=r.originalHeight/c;for(let d=0;d<s;d+=2)e[d]=i+(1-t[d])*h,e[d+1]=n+(1-t[d+1])*a;return;case 270:i-=r.offsetY/l,n-=r.offsetX/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<s;d+=2)e[d]=i+(1-t[d+1])*h,e[d+1]=n+t[d]*a;return}i-=r.offsetX/l,n-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/l,a=r.originalHeight/c}else this.region?(h=this.region.u2-i,a=this.region.v2-n):(i=n=0,h=a=1);for(let r=0;r<s;r+=2)e[r]=i+t[r]*h,e[r+1]=n+t[r+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new ft(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,h){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,h)}newLinkedMesh(){let t=new ft(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}}class Rt extends pt{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(t){super(t)}copy(){let t=new Rt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Ce extends pt{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*B.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,h=s*t.c+i*t.d;return B.atan2Deg(h,n)}copy(){let t=new Ce(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class dt extends Ue{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(t==null){e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,e[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,h=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,r=h+this.region.height*i,o=this.rotation*B.degRad,l=Math.cos(o),c=Math.sin(o),d=this.x,u=this.y,f=n*l+d,m=n*c,g=h*l+u,w=h*c,b=a*l+d,p=a*c,x=r*l+u,y=r*c,v=this.offset;v[0]=f-w,v[1]=g+m,v[2]=f-y,v[3]=x+m,v[4]=b-y,v[5]=x+p,v[6]=b-w,v[7]=g+p,t.degrees==90?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){this.sequence!=null&&this.sequence.apply(t,this);let n=t.bone,h=this.offset,a=n.worldX,r=n.worldY,o=n.a,l=n.b,c=n.c,d=n.d,u=0,f=0;u=h[0],f=h[1],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[2],f=h[3],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[4],f=h[5],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r,s+=i,u=h[6],f=h[7],e[s]=u*o+f*l+a,e[s+1]=u*c+f*d+r}copy(){let t=new dt(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,E.arrayCopy(this.uvs,0,t.uvs,0,8),E.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class ri{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,h=i.length;n<h;n++){let a=s.getPath(e,n),r=this.atlas.findRegion(a);if(r==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+t+")");i[n]=r}}newRegionAttachment(t,e,s,i){let n=new dt(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=h}return n}newMeshAttachment(t,e,s,i){let n=new ft(e,s);if(i!=null)this.loadSequence(e,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=h}return n}newBoundingBoxAttachment(t,e){return new he(e)}newPathAttachment(t,e){return new Rt(e)}newPointAttachment(t,e){return new Ce(e)}newClippingAttachment(t,e){return new Yt(e)}}class vs{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=K.Normal;skinRequired=!1;color=new V;icon;visible=!1;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}var K;(function(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"})(K||(K={}));class Ee{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=K.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,h,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=h,this.ashearY=a;let r=this.parent;if(!r){let u=this.skeleton;const f=u.scaleX,m=u.scaleY,g=(s+h)*B.degRad,w=(s+90+a)*B.degRad;this.a=Math.cos(g)*i*f,this.b=Math.cos(w)*n*f,this.c=Math.sin(g)*i*m,this.d=Math.sin(w)*n*m,this.worldX=t*f+u.x,this.worldY=e*m+u.y;return}let o=r.a,l=r.b,c=r.c,d=r.d;switch(this.worldX=o*t+l*e+r.worldX,this.worldY=c*t+d*e+r.worldY,this.inherit){case K.Normal:{const u=(s+h)*B.degRad,f=(s+90+a)*B.degRad,m=Math.cos(u)*i,g=Math.cos(f)*n,w=Math.sin(u)*i,b=Math.sin(f)*n;this.a=o*m+l*w,this.b=o*g+l*b,this.c=c*m+d*w,this.d=c*g+d*b;return}case K.OnlyTranslation:{const u=(s+h)*B.degRad,f=(s+90+a)*B.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(f)*n,this.c=Math.sin(u)*i,this.d=Math.sin(f)*n;break}case K.NoRotationOrReflection:{let u=1/this.skeleton.scaleX,f=1/this.skeleton.scaleY;o*=u,c*=f;let m=o*o+c*c,g=0;m>1e-4?(m=Math.abs(o*d*f-l*u*c)/m,l=c*m,d=o*m,g=Math.atan2(c,o)*B.radDeg):(o=0,c=0,g=90-Math.atan2(d,l)*B.radDeg);const w=(s+h-g)*B.degRad,b=(s+a-g+90)*B.degRad,p=Math.cos(w)*i,x=Math.cos(b)*n,y=Math.sin(w)*i,v=Math.sin(b)*n;this.a=o*p-l*y,this.b=o*x-l*v,this.c=c*p+d*y,this.d=c*x+d*v;break}case K.NoScale:case K.NoScaleOrReflection:{s*=B.degRad;const u=Math.cos(s),f=Math.sin(s);let m=(o*u+l*f)/this.skeleton.scaleX,g=(c*u+d*f)/this.skeleton.scaleY,w=Math.sqrt(m*m+g*g);w>1e-5&&(w=1/w),m*=w,g*=w,w=Math.sqrt(m*m+g*g),this.inherit==K.NoScale&&o*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(g,m);const b=Math.cos(s)*w,p=Math.sin(s)*w;h*=B.degRad,a=(90+a)*B.degRad;const x=Math.cos(h)*i,y=Math.cos(a)*n,v=Math.sin(h)*i,A=Math.sin(a)*n;this.a=m*x+b*v,this.b=m*y+b*A,this.c=g*x+p*v,this.d=g*y+p*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let 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,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let e=t.a,s=t.b,i=t.c,n=t.d,h=1/(e*n-s*i),a=n*h,r=s*h,o=i*h,l=e*h,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*a-d*r,this.ay=d*l-c*o;let u,f,m,g;if(this.inherit==K.OnlyTranslation)u=this.a,f=this.b,m=this.c,g=this.d;else{switch(this.inherit){case K.NoRotationOrReflection:{let y=Math.abs(e*n-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,n=e*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(e*n-s*i),a=n*h,r=s*h;break}case K.NoScale:case K.NoScaleOrReflection:let w=B.cosDeg(this.rotation),b=B.sinDeg(this.rotation);e=(e*w+s*b)/this.skeleton.scaleX,i=(i*w+n*b)/this.skeleton.scaleY;let p=Math.sqrt(e*e+i*i);p>1e-5&&(p=1/p),e*=p,i*=p,p=Math.sqrt(e*e+i*i),this.inherit==K.NoScale&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let x=B.PI/2+Math.atan2(i,e);s=Math.cos(x)*p,n=Math.sin(x)*p,h=1/(e*n-s*i),a=n*h,r=s*h,o=i*h,l=e*h}u=a*this.a-r*this.c,f=a*this.b-r*this.d,m=l*this.c-o*this.a,g=l*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+m*m),this.ascaleX>1e-4){let w=u*g-f*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(u*f+m*g,w)*B.radDeg,this.arotation=Math.atan2(m,u)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,f)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}}class ce{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class ur{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new ni,i=new Gt){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),i(h)},(h,a)=>{const r=`Couldn't load binary ${t}: status ${h}, ${a}`;this.error(s,t,r),n(r)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,n)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${n}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),i(h)},(h,a)=>{const r=`Couldn't load JSON ${t}: status ${h}, ${a}`;this.error(s,t,r),n(r)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],n=i!==void 0;return n&&(this.cache.assetsLoaded[t]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(s,t,h))),n}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,n)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(r=>{if(r.ok)return r.blob();const o=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),n(o)}).then(r=>r?createImageBitmap(r,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(r=>{if(r){const o=this.createTexture(t,r);this.success(e,t,o),i(o)}});else{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const o=this.createTexture(t,r);this.success(e,t,o),i(o)},r.onerror=()=>{const o=`Couldn't load image: ${t}`;this.error(s,t,o),n(o)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),h=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((a,r)=>{this.downloader.downloadText(t,o=>{try{const l=this.createTextureAtlas(t,o);let c=l.pages.length,d=!1;for(let u of l.pages)this.loadTexture(i?i[u.name]:h+u.name,(f,m)=>{d||(u.setTexture(m),--c==0&&(this.success(e,t,l),a(l)))},(f,m)=>{if(!d){const g=`Couldn't load texture ${t} page image: ${f}`;this.error(s,t,g),r(g)}d=!0})}catch(l){const c=`Couldn't parse texture atlas ${t}: ${l.message}`;this.error(s,t,c),r(c)}},(o,l)=>{const c=`Couldn't load texture atlas ${t}: status ${o}, ${l}`;this.error(s,t,c),r(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,h)=>{this.downloader.downloadText(t,a=>{try{const r=this.createTextureAtlas(t,a);this.success(e,t,r),n(r)}catch(r){const o=`Couldn't parse texture atlas ${t}: ${r.message}`;this.error(s,t,o),h(o)}},(a,r)=>{const o=`Couldn't load texture atlas ${t}: status ${a}, ${r}`;this.error(s,t,o),h(o)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,n)=>e(n),(i,n)=>s(n))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,n)=>e(n),(i,n)=>s(n))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
+
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof be){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new be(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}}class Gt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const e=Gt.AVAILABLE_CACHES.get(t);if(e)return e;const s=new Gt;return Gt.AVAILABLE_CACHES.set(t,s),s}async addAsset(t,e){this.assetsLoaded[t]=Promise.resolve(e),this.assets[t]=await e}}class ni{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(a){this.finish(t,400,JSON.stringify(a))}return}let n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",i||t,!0);let h=()=>{this.finish(t,n.status,n.responseText)};n.onload=h,n.onerror=h,n.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(a){this.finish(t,400,JSON.stringify(a))}return}let n=new XMLHttpRequest;n.open("GET",i||t,!0),n.responseType="arraybuffer";let h=()=>{this.finish(t,n.status,n.response)};n.onload=()=>{n.status==200||n.status==0?this.finish(t,200,new Uint8Array(n.response)):h()},n.onerror=h,n.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=e==200||e==0?[s]:[e,s];for(let h=n.length-1,a=i.length;h<a;h+=2)i[h].apply(null,n)}}class Cs{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class As{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class ai{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let n=e.findBone(t.bones[i].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(n)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,n,h,a){let r=t.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,l=r.b,c=r.c,d=r.d,u=-t.ashearX-t.arotation,f=0,m=0;switch(t.inherit){case K.OnlyTranslation:f=(e-t.worldX)*B.signum(t.skeleton.scaleX),m=(s-t.worldY)*B.signum(t.skeleton.scaleY);break;case K.NoRotationOrReflection:let b=Math.abs(o*d-l*c)/Math.max(1e-4,o*o+c*c),p=o/t.skeleton.scaleX,x=c/t.skeleton.scaleY;l=-x*b*t.skeleton.scaleX,d=p*b*t.skeleton.scaleY,u+=Math.atan2(x,p)*B.radDeg;default:let y=e-r.worldX,v=s-r.worldY,A=o*d-l*c;Math.abs(A)<=1e-4?(f=0,m=0):(f=(y*d-v*l)/A-t.ax,m=(v*o-y*c)/A-t.ay)}u+=Math.atan2(m,f)*B.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,w=t.ascaleY;if(i||n){switch(t.inherit){case K.NoScale:case K.NoScaleOrReflection:f=e-t.worldX,m=s-t.worldY}const b=t.data.length*g;if(b>1e-4){const p=f*f+m*m;if(i&&p<b*b||n&&p>b*b){const x=(Math.sqrt(p)/b-1)*a+1;g*=x,h&&(w*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*a,g,w,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,h,a,r,o){if(t.inherit!=K.Normal||e.inherit!=K.Normal)return;let l=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,f=d,m=u,g=e.ascaleX,w=0,b=0,p=0;d<0?(d=-d,w=180,p=-1):(w=0,p=1),u<0&&(u=-u,p=-p),g<0?(g=-g,b=180):b=0;let x=e.ax,y=0,v=0,A=0,k=t.a,I=t.b,Y=t.c,T=t.d,R=Math.abs(d-u)<=1e-4;!R||h?(y=0,v=k*x+t.worldX,A=Y*x+t.worldY):(y=e.ay,v=k*x+I*y+t.worldX,A=Y*x+T*y+t.worldY);let X=t.parent;if(!X)throw new Error("IK parent must itself have a parent.");k=X.a,I=X.b,Y=X.c,T=X.d;let M=k*T-I*Y,F=v-X.worldX,L=A-X.worldY;M=Math.abs(M)<=1e-4?0:1/M;let O=(F*T-L*I)*M-l,W=(L*k-F*Y)*M-c,N=Math.sqrt(O*O+W*W),G=e.data.length*g,H,j;if(N<1e-4){this.apply1(t,s,i,!1,h,!1,o),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}F=s-X.worldX,L=i-X.worldY;let D=(F*T-L*I)*M-l,U=(L*k-F*Y)*M-c,q=D*D+U*U;if(r!=0){r*=d*(g+1)*.5;let Q=Math.sqrt(q),st=Q-N-G*d+r;if(st>0){let it=Math.min(1,st/(r*2))-1;it=(st-r*(1-it*it))/Q,D-=it*D,U-=it*U,q=D*D+U*U}}t:if(R){G*=d;let Q=(q-N*N-G*G)/(2*N*G);Q<-1?(Q=-1,j=Math.PI*n):Q>1?(Q=1,j=0,h&&(k=(Math.sqrt(q)/(N+G)-1)*o+1,f*=k,a&&(m*=k))):j=Math.acos(Q)*n,k=N+G*Q,I=G*Math.sin(j),H=Math.atan2(U*k-D*I,D*k+U*I)}else{k=d*G,I=u*G;let Q=k*k,st=I*I,it=Math.atan2(U,D);Y=st*N*N+Q*q-Q*st;let It=-2*st*N,Wt=st-Q;if(T=It*It-4*Wt*Y,T>=0){let Et=Math.sqrt(T);It<0&&(Et=-Et),Et=-(It+Et)*.5;let Ut=Et/Wt,Me=Y/Et,Kt=Math.abs(Ut)<Math.abs(Me)?Ut:Me;if(Ut=q-Kt*Kt,Ut>=0){L=Math.sqrt(Ut)*n,H=it-Math.atan2(L,Kt),j=Math.atan2(L/u,(Kt-N)/d);break t}}let ke=B.PI,jt=N-k,de=jt*jt,Se=0,Ie=0,Jt=N+k,fe=Jt*Jt,Te=0;Y=-k*N/(Q-st),Y>=-1&&Y<=1&&(Y=Math.acos(Y),F=k*Math.cos(Y)+N,L=I*Math.sin(Y),T=F*F+L*L,T<de&&(ke=Y,de=T,jt=F,Se=L),T>fe&&(Ie=Y,fe=T,Jt=F,Te=L)),q<=(de+fe)*.5?(H=it-Math.atan2(Se*n,jt),j=ke*n):(H=it-Math.atan2(Te*n,Jt),j=Ie*n)}let ht=Math.atan2(y,x)*p,at=t.arotation;H=(H-ht)*B.radDeg+w-at,H>180?H-=360:H<-180&&(H+=360),t.updateWorldTransformWith(l,c,at+H*o,f,m,0,0),at=e.arotation,j=((j+ht)*B.radDeg-e.ashearX)*p+b-at,j>180?j-=360:j<-180&&(j+=360),e.updateWorldTransformWith(x,y,at+j*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class ks extends ce{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}}class Ss extends ce{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=vt.Fixed;spacingMode=Z.Fixed;rotateMode=Pt.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}var vt;(function(C){C[C.Fixed=0]="Fixed",C[C.Percent=1]="Percent"})(vt||(vt={}));var Z;(function(C){C[C.Length=0]="Length",C[C.Fixed=1]="Fixed",C[C.Percent=2]="Percent",C[C.Proportional=3]="Proportional"})(Z||(Z={}));var Pt;(function(C){C[C.Tangent=0]="Tangent",C[C.Chain=1]="Chain",C[C.ChainScale=2]="ChainScale"})(Pt||(Pt={}));class At{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0,n=t.bones.length;i<n;i++){let h=e.findBone(t.bones[i].name);if(!h)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(h)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof Rt))return;let s=this.mixRotate,i=this.mixX,n=this.mixY;if(s==0&&i==0&&n==0)return;let h=this.data,a=h.rotateMode==Pt.Tangent,r=h.rotateMode==Pt.ChainScale,o=this.bones,l=o.length,c=a?l:l+1,d=E.setArraySize(this.spaces,c),u=r?this.lengths=E.setArraySize(this.lengths,l):[],f=this.spacing;switch(h.spacingMode){case Z.Percent:if(r)for(let v=0,A=c-1;v<A;v++){let k=o[v],I=k.data.length,Y=I*k.a,T=I*k.c;u[v]=Math.sqrt(Y*Y+T*T)}E.arrayFill(d,1,c,f);break;case Z.Proportional:let x=0;for(let v=0,A=c-1;v<A;){let k=o[v],I=k.data.length;if(I<At.epsilon)r&&(u[v]=0),d[++v]=f;else{let Y=I*k.a,T=I*k.c,R=Math.sqrt(Y*Y+T*T);r&&(u[v]=R),d[++v]=R,x+=R}}if(x>0){x=c/x*f;for(let v=1;v<c;v++)d[v]*=x}break;default:let y=h.spacingMode==Z.Length;for(let v=0,A=c-1;v<A;){let k=o[v],I=k.data.length;if(I<At.epsilon)r&&(u[v]=0),d[++v]=f;else{let Y=I*k.a,T=I*k.c,R=Math.sqrt(Y*Y+T*T);r&&(u[v]=R),d[++v]=(y?I+f:f)*R/I}}}let m=this.computeWorldPositions(e,c,a),g=m[0],w=m[1],b=h.offsetRotation,p=!1;if(b==0)p=h.rotateMode==Pt.Chain;else{p=!1;let x=this.target.bone;b*=x.a*x.d-x.b*x.c>0?B.degRad:-B.degRad}for(let x=0,y=3;x<l;x++,y+=3){let v=o[x];v.worldX+=(g-v.worldX)*i,v.worldY+=(w-v.worldY)*n;let A=m[y],k=m[y+1],I=A-g,Y=k-w;if(r){let T=u[x];if(T!=0){let R=(Math.sqrt(I*I+Y*Y)/T-1)*s+1;v.a*=R,v.c*=R}}if(g=A,w=k,s>0){let T=v.a,R=v.b,X=v.c,M=v.d,F=0,L=0,O=0;if(a?F=m[y-1]:d[x+1]==0?F=m[y+2]:F=Math.atan2(Y,I),F-=Math.atan2(X,T),p){L=Math.cos(F),O=Math.sin(F);let W=v.data.length;g+=(W*(L*T-O*X)-I)*s,w+=(W*(O*T+L*X)-Y)*s}else F+=b;F>B.PI?F-=B.PI2:F<-B.PI&&(F+=B.PI2),F*=s,L=Math.cos(F),O=Math.sin(F),v.a=L*T-O*X,v.b=L*R-O*M,v.c=O*T+L*X,v.d=O*R+L*M}v.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,n=this.position,h=this.spaces,a=E.setArraySize(this.positions,e*3+2),r=this.world,o=t.closed,l=t.worldVerticesLength,c=l/6,d=At.NONE;if(!t.constantSpeed){let W=t.lengths;c-=o?1:2;let N=W[c];this.data.positionMode==vt.Percent&&(n*=N);let G;switch(this.data.spacingMode){case Z.Percent:G=N;break;case Z.Proportional:G=N/e;break;default:G=1}r=E.setArraySize(this.world,8);for(let H=0,j=0,D=0;H<e;H++,j+=3){let U=h[H]*G;n+=U;let q=n;if(o)q%=N,q<0&&(q+=N),D=0;else if(q<0){d!=At.BEFORE&&(d=At.BEFORE,t.computeWorldVertices(i,2,4,r,0,2)),this.addBeforePosition(q,r,0,a,j);continue}else if(q>N){d!=At.AFTER&&(d=At.AFTER,t.computeWorldVertices(i,l-6,4,r,0,2)),this.addAfterPosition(q-N,r,0,a,j);continue}for(;;D++){let ht=W[D];if(!(q>ht)){if(D==0)q/=ht;else{let at=W[D-1];q=(q-at)/(ht-at)}break}}D!=d&&(d=D,o&&D==c?(t.computeWorldVertices(i,l-4,4,r,0,2),t.computeWorldVertices(i,0,4,r,4,2)):t.computeWorldVertices(i,D*6+2,8,r,0,2)),this.addCurvePosition(q,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],a,j,s||H>0&&U==0)}return a}o?(l+=2,r=E.setArraySize(this.world,l),t.computeWorldVertices(i,2,l-4,r,0,2),t.computeWorldVertices(i,0,2,r,l-4,2),r[l-2]=r[0],r[l-1]=r[1]):(c--,l-=4,r=E.setArraySize(this.world,l),t.computeWorldVertices(i,2,l,r,0,2));let u=E.setArraySize(this.curves,c),f=0,m=r[0],g=r[1],w=0,b=0,p=0,x=0,y=0,v=0,A=0,k=0,I=0,Y=0,T=0,R=0,X=0,M=0;for(let W=0,N=2;W<c;W++,N+=6)w=r[N],b=r[N+1],p=r[N+2],x=r[N+3],y=r[N+4],v=r[N+5],A=(m-w*2+p)*.1875,k=(g-b*2+x)*.1875,I=((w-p)*3-m+y)*.09375,Y=((b-x)*3-g+v)*.09375,T=A*2+I,R=k*2+Y,X=(w-m)*.75+A+I*.16666667,M=(b-g)*.75+k+Y*.16666667,f+=Math.sqrt(X*X+M*M),X+=T,M+=R,T+=I,R+=Y,f+=Math.sqrt(X*X+M*M),X+=T,M+=R,f+=Math.sqrt(X*X+M*M),X+=T+I,M+=R+Y,f+=Math.sqrt(X*X+M*M),u[W]=f,m=y,g=v;this.data.positionMode==vt.Percent&&(n*=f);let F;switch(this.data.spacingMode){case Z.Percent:F=f;break;case Z.Proportional:F=f/e;break;default:F=1}let L=this.segments,O=0;for(let W=0,N=0,G=0,H=0;W<e;W++,N+=3){let j=h[W]*F;n+=j;let D=n;if(o)D%=f,D<0&&(D+=f),G=0;else if(D<0){this.addBeforePosition(D,r,0,a,N);continue}else if(D>f){this.addAfterPosition(D-f,r,l-4,a,N);continue}for(;;G++){let U=u[G];if(!(D>U)){if(G==0)D/=U;else{let q=u[G-1];D=(D-q)/(U-q)}break}}if(G!=d){d=G;let U=G*6;for(m=r[U],g=r[U+1],w=r[U+2],b=r[U+3],p=r[U+4],x=r[U+5],y=r[U+6],v=r[U+7],A=(m-w*2+p)*.03,k=(g-b*2+x)*.03,I=((w-p)*3-m+y)*.006,Y=((b-x)*3-g+v)*.006,T=A*2+I,R=k*2+Y,X=(w-m)*.3+A+I*.16666667,M=(b-g)*.3+k+Y*.16666667,O=Math.sqrt(X*X+M*M),L[0]=O,U=1;U<8;U++)X+=T,M+=R,T+=I,R+=Y,O+=Math.sqrt(X*X+M*M),L[U]=O;X+=T,M+=R,O+=Math.sqrt(X*X+M*M),L[8]=O,X+=T+I,M+=R+Y,O+=Math.sqrt(X*X+M*M),L[9]=O,H=0}for(D*=O;;H++){let U=L[H];if(!(D>U)){if(H==0)D/=U;else{let q=L[H-1];D=H+(D-q)/(U-q)}break}}this.addCurvePosition(D*.1,m,g,w,b,p,x,y,v,a,N,s||W>0&&j==0)}return a}addBeforePosition(t,e,s,i,n){let h=e[s],a=e[s+1],r=e[s+2]-h,o=e[s+3]-a,l=Math.atan2(o,r);i[n]=h+t*Math.cos(l),i[n+1]=a+t*Math.sin(l),i[n+2]=l}addAfterPosition(t,e,s,i,n){let h=e[s+2],a=e[s+3],r=h-e[s],o=a-e[s+1],l=Math.atan2(o,r);i[n]=h+t*Math.cos(l),i[n+1]=a+t*Math.sin(l),i[n+2]=l}addCurvePosition(t,e,s,i,n,h,a,r,o,l,c,d){if(t==0||isNaN(t)){l[c]=e,l[c+1]=s,l[c+2]=Math.atan2(n-s,i-e);return}let u=t*t,f=u*t,m=1-t,g=m*m,w=g*m,b=m*t,p=b*3,x=m*p,y=p*t,v=e*w+i*x+h*y+r*f,A=s*w+n*x+a*y+o*f;l[c]=v,l[c+1]=A,d&&(t<.001?l[c+2]=Math.atan2(n-s,i-e):l[c+2]=Math.atan2(A-(s*g+n*b*2+a*u),v-(e*g+i*b*2+h*u)))}}class oi{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,a=this.bone,r=a.data.length;switch(t){case gt.none:return;case gt.reset:this.reset();case gt.update:const o=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=o.time;const c=a.worldX,d=a.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,f=this.inertia,m=this.data.step,g=this.skeleton.data.referenceScale,w=-1,b=this.data.limit*l,p=b*Math.abs(o.scaleY);if(b*=Math.abs(o.scaleX),s||i){if(s){const x=(this.ux-c)*f;this.xOffset+=x>b?b:x<-b?-b:x,this.ux=c}if(i){const x=(this.uy-d)*f;this.yOffset+=x>p?p:x<-p?-p:x,this.uy=d}if(u>=m){w=Math.pow(this.damping,60*m);const x=this.massInverse*m,y=this.strength,v=this.wind*g*o.scaleX,A=this.gravity*g*o.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*m,this.xVelocity*=w),i&&(this.yVelocity-=(A+this.yOffset*y)*x,this.yOffset+=this.yVelocity*m,this.yVelocity*=w),u-=m;while(u>=m)}s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||h){let x=Math.atan2(a.c,a.a),y=0,v=0,A=0,k=this.cx-a.worldX,I=this.cy-a.worldY;if(k>b?k=b:k<-b&&(k=-b),I>p?I=p:I<-p&&(I=-p),n){A=(this.data.rotate+this.data.shearX)*e;let Y=Math.atan2(I+this.ty,k+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(Y-Math.ceil(Y*B.invPI2-.5)*B.PI2)*f,Y=this.rotateOffset*A+x,y=Math.cos(Y),v=Math.sin(Y),h&&(Y=r*a.getWorldScaleX(),Y>0&&(this.scaleOffset+=(k*y+I*v)*f/Y))}else{y=Math.cos(x),v=Math.sin(x);const Y=r*a.getWorldScaleX();Y>0&&(this.scaleOffset+=(k*y+I*v)*f/Y)}if(u=this.remaining,u>=m){w==-1&&(w=Math.pow(this.damping,60*m));const Y=this.massInverse*m,T=this.strength,R=this.wind,X=Ft.yDown?-this.gravity:this.gravity,M=r/g;for(;;)if(u-=m,h&&(this.scaleVelocity+=(R*y-X*v-this.scaleOffset*T)*Y,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=w),n){if(this.rotateVelocity-=((R*v+X*y)*M+this.rotateOffset*T)*Y,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=w,u<m)break;const F=this.rotateOffset*A+x;y=Math.cos(F),v=Math.sin(F)}else if(u<m)break}}this.remaining=u}this.cx=a.worldX,this.cy=a.worldY;break;case gt.pose:s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let o=this.rotateOffset*e,l=0,c=0,d=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=o*this.data.rotate,l=Math.sin(u),c=Math.cos(u),d=a.b,a.b=c*d-l*a.d,a.d=l*d+c*a.d),u+=o*this.data.shearX,l=Math.sin(u),c=Math.cos(u),d=a.a,a.a=c*d-l*a.c,a.c=l*d+c*a.c}else o*=this.data.rotate,l=Math.sin(o),c=Math.cos(o),d=a.a,a.a=c*d-l*a.c,a.c=l*d+c*a.c,d=a.b,a.b=c*d-l*a.d,a.d=l*d+c*a.d}if(h){const o=1+this.scaleOffset*e*this.data.scaleX;a.a*=o,a.c*=o}t!=gt.pose&&(this.tx=r*a.a,this.ty=r*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*B.degRad,n=Math.cos(i),h=Math.sin(i),a=this.cx-t,r=this.cy-e;this.translate(a*n-r*h-a,a*h+r*n-r)}}class li{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new V,this.darkColor=t.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof pt)||!(this.attachment instanceof pt)||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 hi{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new ie;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let n=e.findBone(t.bones[i].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(n)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=e!=0||s!=0,r=this.target,o=r.a,l=r.b,c=r.c,d=r.d,u=o*d-l*c>0?B.degRad:-B.degRad,f=this.data.offsetRotation*u,m=this.data.offsetShearY*u,g=this.bones;for(let w=0,b=g.length;w<b;w++){let p=g[w];if(t!=0){let x=p.a,y=p.b,v=p.c,A=p.d,k=Math.atan2(c,o)-Math.atan2(v,x)+f;k>B.PI?k-=B.PI2:k<-B.PI&&(k+=B.PI2),k*=t;let I=Math.cos(k),Y=Math.sin(k);p.a=I*x-Y*v,p.b=I*y-Y*A,p.c=Y*x+I*v,p.d=Y*y+I*A}if(a){let x=this.temp;r.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(x.x-p.worldX)*e,p.worldY+=(x.y-p.worldY)*s}if(i!=0){let x=Math.sqrt(p.a*p.a+p.c*p.c);x!=0&&(x=(x+(Math.sqrt(o*o+c*c)-x+this.data.offsetScaleX)*i)/x),p.a*=x,p.c*=x}if(n!=0){let x=Math.sqrt(p.b*p.b+p.d*p.d);x!=0&&(x=(x+(Math.sqrt(l*l+d*d)-x+this.data.offsetScaleY)*n)/x),p.b*=x,p.d*=x}if(h>0){let x=p.b,y=p.d,v=Math.atan2(y,x),A=Math.atan2(d,l)-Math.atan2(c,o)-(v-Math.atan2(p.c,p.a));A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A=v+(A+m)*h;let k=Math.sqrt(x*x+y*y);p.b=Math.cos(A)*k,p.d=Math.sin(A)*k}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=e!=0||s!=0,r=this.target,o=r.a,l=r.b,c=r.c,d=r.d,u=o*d-l*c>0?B.degRad:-B.degRad,f=this.data.offsetRotation*u,m=this.data.offsetShearY*u,g=this.bones;for(let w=0,b=g.length;w<b;w++){let p=g[w];if(t!=0){let x=p.a,y=p.b,v=p.c,A=p.d,k=Math.atan2(c,o)+f;k>B.PI?k-=B.PI2:k<-B.PI&&(k+=B.PI2),k*=t;let I=Math.cos(k),Y=Math.sin(k);p.a=I*x-Y*v,p.b=I*y-Y*A,p.c=Y*x+I*v,p.d=Y*y+I*A}if(a){let x=this.temp;r.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),p.worldX+=x.x*e,p.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(o*o+c*c)-1+this.data.offsetScaleX)*i+1;p.a*=x,p.c*=x}if(n!=0){let x=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*n+1;p.b*=x,p.d*=x}if(h>0){let x=Math.atan2(d,l)-Math.atan2(c,o);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=p.b,v=p.d;x=Math.atan2(v,y)+(x-B.PI/2+m)*h;let A=Math.sqrt(y*y+v*v);p.b=Math.cos(x)*A,p.d=Math.sin(x)*A}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],d=c.arotation;t!=0&&(d+=(a.arotation-d+this.data.offsetRotation)*t);let u=c.ax,f=c.ay;u+=(a.ax-u+this.data.offsetX)*e,f+=(a.ay-f+this.data.offsetY)*s;let m=c.ascaleX,g=c.ascaleY;i!=0&&m!=0&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*i)/m),n!=0&&g!=0&&(g=(g+(a.ascaleY-g+this.data.offsetScaleY)*n)/g);let w=c.ashearY;h!=0&&(w+=(a.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(u,f,d,m,g,c.ashearX,w)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],d=c.arotation+(a.arotation+this.data.offsetRotation)*t,u=c.ax+(a.ax+this.data.offsetX)*e,f=c.ay+(a.ay+this.data.offsetY)*s,m=c.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),w=c.ashearY+(a.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(u,f,d,m,g,c.ashearX,w)}}}class Ft{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ft.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i;if(!s.parent)i=new Ee(s,this,null);else{let n=this.bones[s.parent.index];i=new Ee(s,this,n),n.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],n=new li(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new ai(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new hi(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new At(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new oi(s,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let e=this.bones;for(let d=0,u=e.length;d<u;d++){let f=e[d];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let d=this.skin.bones;for(let u=0,f=this.skin.bones.length;u<f;u++){let m=this.bones[d[u].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let s=this.ikConstraints,i=this.transformConstraints,n=this.pathConstraints,h=this.physicsConstraints,a=s.length,r=i.length,o=n.length,l=this.physicsConstraints.length,c=a+r+o+l;t:for(let d=0;d<c;d++){for(let u=0;u<a;u++){let f=s[u];if(f.data.order==d){this.sortIkConstraint(f);continue t}}for(let u=0;u<r;u++){let f=i[u];if(f.data.order==d){this.sortTransformConstraint(f);continue t}}for(let u=0;u<o;u++){let f=n[u];if(f.data.order==d){this.sortPathConstraint(f);continue t}}for(let u=0;u<l;u++){const f=h[u];if(f.data.order==d){this.sortPhysicsConstraint(f);continue t}}}for(let d=0,u=e.length;d<u;d++)this.sortBone(e[d])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(t),this.sortReset(i.children);else{let n=s[s.length-1];this.sortBone(n),this._updateCache.push(t),this.sortReset(i.children),n.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let r=0,o=this.data.skins.length;r<o;r++)this.sortPathConstraintAttachment(this.data.skins[r],s,i);let n=e.getAttachment();n instanceof Rt&&this.sortPathConstraintAttachmentWith(n,i);let h=t.bones,a=h.length;for(let r=0;r<a;r++)this.sortBone(h[r]);this._updateCache.push(t);for(let r=0;r<a;r++)this.sortReset(h[r].children);for(let r=0;r<a;r++)h[r].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&E.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let i=0;i<s;i++){let n=e[i];this.sortBone(n.parent),this.sortBone(n)}else for(let i=0;i<s;i++)this.sortBone(e[i]);this._updateCache.push(t);for(let i=0;i<s;i++)this.sortReset(e[i].children);for(let i=0;i<s;i++)e[i].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let n in i)this.sortPathConstraintAttachmentWith(i[n],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Rt))return;let s=t.bones;if(!s)this.sortBone(e);else{let i=this.bones;for(let n=0,h=s.length;n<h;){let a=s[n++];for(a+=n;n<a;)this.sortBone(i[s[n++]])}}}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let i=t[e];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let e=this.bones;for(let i=0,n=e.length;i<n;i++){let h=e[i];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let s=this._updateCache;for(let i=0,n=s.length;i<n;i++)s[i].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let g=1,w=s.length;g<w;g++){let b=s[g];b.ax=b.x,b.ay=b.y,b.arotation=b.rotation,b.ascaleX=b.scaleX,b.ascaleY=b.scaleY,b.ashearX=b.shearX,b.ashearY=b.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let n=e.a,h=e.b,a=e.c,r=e.d;i.worldX=n*this.x+h*this.y+e.worldX,i.worldY=a*this.x+r*this.y+e.worldY;const o=(i.rotation+i.shearX)*B.degRad,l=(i.rotation+90+i.shearY)*B.degRad,c=Math.cos(o)*i.scaleX,d=Math.cos(l)*i.scaleY,u=Math.sin(o)*i.scaleX,f=Math.sin(l)*i.scaleY;i.a=(n*c+h*u)*this.scaleX,i.b=(n*d+h*f)*this.scaleX,i.c=(a*c+r*u)*this.scaleY,i.d=(a*d+r*f)*this.scaleY;let m=this._updateCache;for(let g=0,w=m.length;g<w;g++){let b=m[g];b!=i&&b.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;E.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.data.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.data.name==t)return n}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let n=e[s],h=n.data.attachmentName;if(h){let a=t.getAttachment(s,h);a&&n.setAttachment(a)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,n=s.length;i<n;i++){let h=s[i];if(h.data.name==t){let a=null;if(e&&(a=this.getAttachment(i,e),!a))throw new Error("Attachment not found: "+e+", for slot: "+t);h.setAttachment(a);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(e=>e.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(e=>e.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(e=>e.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(e=>e.data.name==t)??null}getBoundsRect(t){let e=new ie,s=new ie;return this.getBounds(e,s,void 0,t),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,h=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let l=0,c=n.length;l<c;l++){let d=n[l];if(!d.bone.active)continue;let u=0,f=null,m=null,g=d.getAttachment();if(g instanceof dt)u=8,f=E.setArraySize(s,u,0),g.computeWorldVertices(d,f,0,2),m=Ft.quadTriangles;else if(g instanceof ft){let w=g;u=w.worldVerticesLength,f=E.setArraySize(s,u,0),w.computeWorldVertices(d,0,u,f,0,2),m=w.triangles}else if(g instanceof Yt&&i!=null){i.clipStart(d,g);continue}if(f&&m){i!=null&&i.isClipping()&&(i.clipTriangles(f,m,m.length),f=i.clippedVertices,u=i.clippedVertices.length);for(let w=0,b=f.length;w<b;w+=2){let p=f[w],x=f[w+1];h=Math.min(h,p),a=Math.min(a,x),r=Math.max(r,p),o=Math.max(o,x)}}i?.clipEndWithSlot(d)}i?.clipEnd(),t.set(h,a),e.set(r-h,o-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,h=i.length;n<h;n++)i[n].rotate(t,e,s)}}var gt;(function(C){C[C.none=0]="none",C[C.reset=1]="reset",C[C.update=2]="update",C[C.pose=3]="pose"})(gt||(gt={}));class Is extends ce{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}}class ne{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.name==t)return n}return null}}class Le{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class ae{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let n=t.bones[i],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let i=0;i<t.constraints.length;i++){let n=t.constraints[i],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let n=t.bones[i],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let i=0;i<t.constraints.length;i++){let n=t.constraints[i],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof ft?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new Le(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new Le(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],h=n.getAttachment();if(h&&s<e.attachments.length){let a=e.attachments[s];for(let r in a){let o=a[r];if(h==o){let l=this.getAttachment(s,r);l&&n.setAttachment(l);break}}}s++}}}class Ts{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Tt.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}var Tt;(function(C){C[C.Normal=0]="Normal",C[C.Additive=1]="Additive",C[C.Multiply=2]="Multiply",C[C.Screen=3]="Screen"})(Tt||(Tt={}));class Ms extends ce{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}}class ci{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new ne;s.name="";let i=new di(t),n=i.readInt32(),h=i.readInt32();s.hash=h==0&&n==0?null:h.toString(16)+n.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let r=0;r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:s.bones[i.readInt(!0)],u=new vs(l,c,d);u.rotation=i.readFloat(),u.x=i.readFloat()*e,u.y=i.readFloat()*e,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*e,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),a&&(V.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],u=new Ts(l,c,d);V.rgba8888ToColor(u.color,i.readInt32());let f=i.readInt32();f!=-1&&V.rgb888ToColor(u.darkColor=new V,f),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),a&&(u.visible=i.readBoolean()),s.slots.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let u=new ks(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let f=i.readByte();u.skinRequired=(f&1)!=0,u.bendDirection=(f&2)!=0?1:-1,u.compress=(f&4)!=0,u.stretch=(f&8)!=0,u.uniform=(f&16)!=0,(f&32)!=0&&(u.mix=(f&64)!=0?i.readFloat():1),(f&128)!=0&&(u.softness=i.readFloat()*e),s.ikConstraints.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let u=new Ms(d);u.order=i.readInt(!0),c=i.readInt(!0);for(let m=0;m<c;m++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let f=i.readByte();u.skinRequired=(f&1)!=0,u.local=(f&2)!=0,u.relative=(f&4)!=0,(f&8)!=0&&(u.offsetRotation=i.readFloat()),(f&16)!=0&&(u.offsetX=i.readFloat()*e),(f&32)!=0&&(u.offsetY=i.readFloat()*e),(f&64)!=0&&(u.offsetScaleX=i.readFloat()),(f&128)!=0&&(u.offsetScaleY=i.readFloat()),f=i.readByte(),(f&1)!=0&&(u.offsetShearY=i.readFloat()),(f&2)!=0&&(u.mixRotate=i.readFloat()),(f&4)!=0&&(u.mixX=i.readFloat()),(f&8)!=0&&(u.mixY=i.readFloat()),(f&16)!=0&&(u.mixScaleX=i.readFloat()),(f&32)!=0&&(u.mixScaleY=i.readFloat()),(f&64)!=0&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let u=new Ss(d);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let m=0;m<c;m++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const f=i.readByte();u.positionMode=f&1,u.spacingMode=f>>1&3,u.rotateMode=f>>3&3,(f&128)!=0&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==vt.Fixed&&(u.position*=e),u.spacing=i.readFloat(),(u.spacingMode==Z.Length||u.spacingMode==Z.Fixed)&&(u.spacing*=e),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}r=i.readInt(!0);for(let l=0,c;l<r;l++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const u=new Is(d);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let f=i.readByte();u.skinRequired=(f&1)!=0,(f&2)!=0&&(u.x=i.readFloat()),(f&4)!=0&&(u.y=i.readFloat()),(f&8)!=0&&(u.rotate=i.readFloat()),(f&16)!=0&&(u.scaleX=i.readFloat()),(f&32)!=0&&(u.shearX=i.readFloat()),u.limit=((f&64)!=0?i.readFloat():5e3)*e,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=(f&128)!=0?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),f=i.readByte(),(f&1)!=0&&(u.inertiaGlobal=!0),(f&2)!=0&&(u.strengthGlobal=!0),(f&4)!=0&&(u.dampingGlobal=!0),(f&8)!=0&&(u.massGlobal=!0),(f&16)!=0&&(u.windGlobal=!0),(f&32)!=0&&(u.gravityGlobal=!0),(f&64)!=0&&(u.mixGlobal=!0),u.mix=(f&128)!=0?i.readFloat():1,s.physicsConstraints.push(u)}let o=this.readSkin(i,s,!0,a);o&&(s.defaultSkin=o,s.skins.push(o));{let l=s.skins.length;for(E.setArraySize(s.skins,r=l+i.readInt(!0));l<r;l++){let c=this.readSkin(i,s,!1,a);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[l]=c}}r=this.linkedMeshes.length;for(let l=0;l<r;l++){let c=this.linkedMeshes[l];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let u=d.getAttachment(c.slotIndex,c.parent);if(!u)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?u:c.mesh,c.mesh.setParentMesh(u),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new As(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}r=i.readInt(!0);for(let l=0;l<r;l++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let n=null,h=0;if(s){if(h=t.readInt(!0),h==0)return null;n=new ae("default")}else{let a=t.readString();if(!a)throw new Error("Skin name must not be null.");n=new ae(a),i&&V.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let r=0,o=n.bones.length;r<o;r++)n.bones[r]=e.bones[t.readInt(!0)];for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let r=0,o=t.readInt(!0);r<o;r++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let a=0;a<h;a++){let r=t.readInt(!0);for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,n,r,c,i);d&&n.setAttachment(r,c,d)}}return n}readAttachment(t,e,s,i,n,h){let a=this.scale,r=t.readByte();const o=(r&8)!=0?t.readStringRef():n;if(!o)throw new Error("Attachment name must not be null");switch(r&7){case kt.Region:{let l=(r&16)!=0?t.readStringRef():null;const c=(r&32)!=0?t.readInt32():4294967295,d=(r&64)!=0?this.readSequence(t):null;let u=(r&128)!=0?t.readFloat():0,f=t.readFloat(),m=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat();l||(l=o);let x=this.attachmentLoader.newRegionAttachment(s,o,l,d);return x?(x.path=l,x.x=f*a,x.y=m*a,x.scaleX=g,x.scaleY=w,x.rotation=u,x.width=b*a,x.height=p*a,V.rgba8888ToColor(x.color,c),x.sequence=d,d==null&&x.updateRegion(),x):null}case kt.BoundingBox:{let l=this.readVertices(t,(r&16)!=0),c=h?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l.length,d.vertices=l.vertices,d.bones=l.bones,h&&V.rgba8888ToColor(d.color,c),d):null}case kt.Mesh:{let l=(r&16)!=0?t.readStringRef():o;const c=(r&32)!=0?t.readInt32():4294967295,d=(r&64)!=0?this.readSequence(t):null,u=t.readInt(!0),f=this.readVertices(t,(r&128)!=0),m=this.readFloatArray(t,f.length,1),g=this.readShortArray(t,(f.length-u-2)*3);let w=[],b=0,p=0;h&&(w=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),p=t.readFloat()),l||(l=o);let x=this.attachmentLoader.newMeshAttachment(s,o,l,d);return x?(x.path=l,V.rgba8888ToColor(x.color,c),x.bones=f.bones,x.vertices=f.vertices,x.worldVerticesLength=f.length,x.triangles=g,x.regionUVs=m,d==null&&x.updateRegion(),x.hullLength=u<<1,x.sequence=d,h&&(x.edges=w,x.width=b*a,x.height=p*a),x):null}case kt.LinkedMesh:{const l=(r&16)!=0?t.readStringRef():o;if(l==null)throw new Error("Path of linked mesh must not be null");const c=(r&32)!=0?t.readInt32():4294967295,d=(r&64)!=0?this.readSequence(t):null,u=(r&128)!=0,f=t.readInt(!0),m=t.readStringRef();let g=0,w=0;h&&(g=t.readFloat(),w=t.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,o,l,d);return b?(b.path=l,V.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*a,b.height=w*a),this.linkedMeshes.push(new fi(b,f,i,m,u)),b):null}case kt.Path:{const l=(r&16)!=0,c=(r&32)!=0,d=this.readVertices(t,(r&64)!=0),u=E.newArray(d.length/6,0);for(let g=0,w=u.length;g<w;g++)u[g]=t.readFloat()*a;const f=h?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=c,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=u,h&&V.rgba8888ToColor(m.color,f),m):null}case kt.Point:{const l=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=h?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=c*a,f.y=d*a,f.rotation=l,h&&V.rgba8888ToColor(f.color,u),f):null}case kt.Clipping:{const l=t.readInt(!0),c=this.readVertices(t,(r&16)!=0);let d=h?t.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,o);return u?(u.endSlot=e.slots[l],u.worldVerticesLength=c.length,u.vertices=c.vertices,u.bones=c.bones,h&&V.rgba8888ToColor(u.color,d),u):null}}return null}readSequence(t){let e=new Vt(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new ui;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let h=new Array,a=new Array;for(let r=0;r<i;r++){let o=t.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(t.readInt(!0)),h.push(t.readFloat()*s),h.push(t.readFloat()*s),h.push(t.readFloat())}return n.vertices=E.toFloatArray(h),n.bones=a,n}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let n=0;n<e;n++)i[n]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,n=this.scale;for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let f=t.readByte(),m=t.readInt(!0),g=m-1;switch(f){case Si:{let w=new Dt(m,c);for(let b=0;b<m;b++)w.setFrame(b,t.readFloat(),t.readStringRef());i.push(w);break}case Ii:{let w=t.readInt(!0),b=new es(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let k=0,I=0;b.setFrame(k,p,x,y,v,A),k!=g;k++){let Y=t.readFloat(),T=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(k);break;case wt:z(t,b,I++,k,0,p,Y,x,T,1),z(t,b,I++,k,1,p,Y,y,R,1),z(t,b,I++,k,2,p,Y,v,X,1),z(t,b,I++,k,3,p,Y,A,M,1)}p=Y,x=T,y=R,v=X,A=M}i.push(b);break}case Ti:{let w=t.readInt(!0),b=new ss(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let A=0,k=0;b.setFrame(A,p,x,y,v),A!=g;A++){let I=t.readFloat(),Y=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(A);break;case wt:z(t,b,k++,A,0,p,I,x,Y,1),z(t,b,k++,A,1,p,I,y,T,1),z(t,b,k++,A,2,p,I,v,R,1)}p=I,x=Y,y=T,v=R}i.push(b);break}case Mi:{let w=t.readInt(!0),b=new rs(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;for(let T=0,R=0;b.setFrame(T,p,x,y,v,A,k,I,Y),T!=g;T++){let X=t.readFloat(),M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,G=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(T);break;case wt:z(t,b,R++,T,0,p,X,x,M,1),z(t,b,R++,T,1,p,X,y,F,1),z(t,b,R++,T,2,p,X,v,L,1),z(t,b,R++,T,3,p,X,A,O,1),z(t,b,R++,T,4,p,X,k,W,1),z(t,b,R++,T,5,p,X,I,N,1),z(t,b,R++,T,6,p,X,Y,G,1)}p=X,x=M,y=F,v=L,A=O,k=W,I=N,Y=G}i.push(b);break}case Yi:{let w=t.readInt(!0),b=new ns(m,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let Y=0,T=0;b.setFrame(Y,p,x,y,v,A,k,I),Y!=g;Y++){let R=t.readFloat(),X=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case bt:b.setStepped(Y);break;case wt:z(t,b,T++,Y,0,p,R,x,X,1),z(t,b,T++,Y,1,p,R,y,M,1),z(t,b,T++,Y,2,p,R,v,F,1),z(t,b,T++,Y,3,p,R,A,L,1),z(t,b,T++,Y,4,p,R,k,O,1),z(t,b,T++,Y,5,p,R,I,W,1)}p=R,x=X,y=M,v=F,A=L,k=O,I=W}i.push(b);break}case Fi:{let w=new is(m,t.readInt(!0),c),b=t.readFloat(),p=t.readUnsignedByte()/255;for(let x=0,y=0;w.setFrame(x,b,p),x!=g;x++){let v=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case bt:w.setStepped(x);break;case wt:z(t,w,y++,x,0,b,v,p,A,1)}b=v,p=A}i.push(w)}}}}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0);for(let d=0,u=t.readInt(!0);d<u;d++){let f=t.readByte(),m=t.readInt(!0);if(f==ki){let w=new ts(m,c);for(let b=0;b<m;b++)w.setFrame(b,t.readFloat(),t.readByte());i.push(w);continue}let g=t.readInt(!0);switch(f){case mi:i.push(rt(t,new re(m,g,c),1));break;case gi:i.push(pe(t,new ze(m,g,c),n));break;case pi:i.push(rt(t,new Ge(m,g,c),n));break;case xi:i.push(rt(t,new $e(m,g,c),n));break;case bi:i.push(pe(t,new He(m,g,c),1));break;case wi:i.push(rt(t,new je(m,g,c),1));break;case yi:i.push(rt(t,new Je(m,g,c),1));break;case vi:i.push(pe(t,new Ke(m,g,c),1));break;case Ci:i.push(rt(t,new Qe(m,g,c),1));break;case Ai:i.push(rt(t,new Ze(m,g,c),1))}}}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,f=new os(d,t.readInt(!0),c),m=t.readByte(),g=t.readFloat(),w=(m&1)!=0?(m&2)!=0?t.readFloat():1:0,b=(m&4)!=0?t.readFloat()*n:0;for(let p=0,x=0;f.setFrame(p,g,w,b,(m&8)!=0?1:-1,(m&16)!=0,(m&32)!=0),p!=u;p++){m=t.readByte();const y=t.readFloat(),v=(m&1)!=0?(m&2)!=0?t.readFloat():1:0,A=(m&4)!=0?t.readFloat()*n:0;(m&64)!=0?f.setStepped(p):(m&128)!=0&&(z(t,f,x++,p,0,g,y,w,v,1),z(t,f,x++,p,1,g,y,b,A,n)),g=y,w=v,b=A}i.push(f)}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0),d=t.readInt(!0),u=d-1,f=new ls(d,t.readInt(!0),c),m=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,A=0;f.setFrame(v,m,g,w,b,p,x,y),v!=u;v++){let k=t.readFloat(),I=t.readFloat(),Y=t.readFloat(),T=t.readFloat(),R=t.readFloat(),X=t.readFloat(),M=t.readFloat();switch(t.readByte()){case bt:f.setStepped(v);break;case wt:z(t,f,A++,v,0,m,k,g,I,1),z(t,f,A++,v,1,m,k,w,Y,1),z(t,f,A++,v,2,m,k,b,T,1),z(t,f,A++,v,3,m,k,p,R,1),z(t,f,A++,v,4,m,k,x,X,1),z(t,f,A++,v,5,m,k,y,M,1)}m=k,g=I,w=Y,b=T,p=R,x=X,y=M}i.push(f)}for(let o=0,l=t.readInt(!0);o<l;o++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let u=0,f=t.readInt(!0);u<f;u++){const m=t.readByte(),g=t.readInt(!0),w=t.readInt(!0);switch(m){case Ri:i.push(rt(t,new hs(g,w,c),d.positionMode==vt.Fixed?n:1));break;case Bi:i.push(rt(t,new cs(g,w,c),d.spacingMode==Z.Length||d.spacingMode==Z.Fixed?n:1));break;case Ei:let b=new ds(g,w,c),p=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let A=0,k=0,I=b.getFrameCount()-1;b.setFrame(A,p,x,y,v),A!=I;A++){let Y=t.readFloat(),T=t.readFloat(),R=t.readFloat(),X=t.readFloat();switch(t.readByte()){case bt:b.setStepped(A);break;case wt:z(t,b,k++,A,0,p,Y,x,T,1),z(t,b,k++,A,1,p,Y,y,R,1),z(t,b,k++,A,2,p,Y,v,X,1)}p=Y,x=T,y=R,v=X}i.push(b)}}}for(let o=0,l=t.readInt(!0);o<l;o++){const c=t.readInt(!0)-1;for(let d=0,u=t.readInt(!0);d<u;d++){const f=t.readByte(),m=t.readInt(!0);if(f==Ui){const w=new le(m,c);for(let b=0;b<m;b++)w.setFrame(b,t.readFloat());i.push(w);continue}const g=t.readInt(!0);switch(f){case Li:i.push(rt(t,new fs(m,g,c),1));break;case Di:i.push(rt(t,new us(m,g,c),1));break;case Ni:i.push(rt(t,new ms(m,g,c),1));break;case Vi:i.push(rt(t,new gs(m,g,c),1));break;case Oi:i.push(rt(t,new ps(m,g,c),1));break;case _i:i.push(rt(t,new xs(m,g,c),1));break;case Wi:i.push(rt(t,new bs(m,g,c),1))}}}for(let o=0,l=t.readInt(!0);o<l;o++){let c=s.skins[t.readInt(!0)];for(let d=0,u=t.readInt(!0);d<u;d++){let f=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){let w=t.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let b=c.getAttachment(f,w),p=t.readByte(),x=t.readInt(!0),y=x-1;switch(p){case Xi:{let v=b,A=v.bones,k=v.vertices,I=A?k.length/3*2:k.length,Y=t.readInt(!0),T=new as(x,Y,f,v),R=t.readFloat();for(let X=0,M=0;;X++){let F,L=t.readInt(!0);if(L==0)F=A?E.newFloatArray(I):k;else{F=E.newFloatArray(I);let W=t.readInt(!0);if(L+=W,n==1)for(let N=W;N<L;N++)F[N]=t.readFloat();else for(let N=W;N<L;N++)F[N]=t.readFloat()*n;if(!A)for(let N=0,G=F.length;N<G;N++)F[N]+=k[N]}if(T.setFrame(X,R,F),X==y)break;let O=t.readFloat();switch(t.readByte()){case bt:T.setStepped(X);break;case wt:z(t,T,M++,X,0,R,O,0,1,1)}R=O}i.push(T);break}case Pi:{let v=new yt(x,f,b);for(let A=0;A<x;A++){let k=t.readFloat(),I=t.readInt32();v.setFrame(A,k,qe[I&15],I>>4,t.readFloat())}i.push(v);break}}}}}let h=t.readInt(!0);if(h>0){let o=new Xt(h),l=s.slots.length;for(let c=0;c<h;c++){let d=t.readFloat(),u=t.readInt(!0),f=E.newArray(l,0);for(let b=l-1;b>=0;b--)f[b]=-1;let m=E.newArray(l-u,0),g=0,w=0;for(let b=0;b<u;b++){let p=t.readInt(!0);for(;g!=p;)m[w++]=g++;f[g+t.readInt(!0)]=g++}for(;g<l;)m[w++]=g++;for(let b=l-1;b>=0;b--)f[b]==-1&&(f[b]=m[--w]);o.setFrame(c,d,f)}i.push(o)}let a=t.readInt(!0);if(a>0){let o=new Ht(a);for(let l=0;l<a;l++){let c=t.readFloat(),d=s.events[t.readInt(!0)],u=new Cs(c,d);u.intValue=t.readInt(!1),u.floatValue=t.readFloat(),u.stringValue=t.readString(),u.stringValue==null&&(u.stringValue=d.stringValue),u.data.audioPath&&(u.volume=t.readFloat(),u.balance=t.readFloat()),o.setFrame(l,u)}i.push(o)}let r=0;for(let o=0,l=i.length;o<l;o++)r=Math.max(r,i[o].getDuration());return new ye(e,i,r)}}class di{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let 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 e="";for(let s=0;s<t;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(i),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}let fi=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};class ui{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}var kt;(function(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"})(kt||(kt={}));function rt(C,t,e){let s=C.readFloat(),i=C.readFloat()*e;for(let n=0,h=0,a=t.getFrameCount()-1;t.setFrame(n,s,i),n!=a;n++){let r=C.readFloat(),o=C.readFloat()*e;switch(C.readByte()){case bt:t.setStepped(n);break;case wt:z(C,t,h++,n,0,s,r,i,o,e)}s=r,i=o}return t}function pe(C,t,e){let s=C.readFloat(),i=C.readFloat()*e,n=C.readFloat()*e;for(let h=0,a=0,r=t.getFrameCount()-1;t.setFrame(h,s,i,n),h!=r;h++){let o=C.readFloat(),l=C.readFloat()*e,c=C.readFloat()*e;switch(C.readByte()){case bt:t.setStepped(h);break;case wt:z(C,t,a++,h,0,s,o,i,l,e),z(C,t,a++,h,1,s,o,n,c,e)}s=o,i=l,n=c}return t}function z(C,t,e,s,i,n,h,a,r,o){t.setBezier(e,s,i,n,a,C.readFloat(),C.readFloat()*o,C.readFloat(),C.readFloat()*o,h,r)}const mi=0,gi=1,pi=2,xi=3,bi=4,wi=5,yi=6,vi=7,Ci=8,Ai=9,ki=10,Si=0,Ii=1,Ti=2,Mi=3,Yi=4,Fi=5,Xi=0,Pi=1,Ri=0,Bi=1,Ei=2,Li=0,Di=1,Ni=2,Vi=4,Oi=5,_i=6,Wi=7,Ui=8,bt=1,wt=2;class Ys{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new $t(()=>E.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,h=t.slots,a=h.length;s.length=0,n.freeAll(i),i.length=0;for(let r=0;r<a;r++){let o=h[r];if(!o.bone.active)continue;let l=o.getAttachment();if(l instanceof he){let c=l;s.push(c);let d=n.obtain();d.length!=c.worldVerticesLength&&(d=E.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(o,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let h=0,a=n.length;h<a;h++){let r=n[h],o=r;for(let l=0,c=r.length;l<c;l+=2){let d=o[l],u=o[l+1];t=Math.min(t,d),e=Math.min(e,u),s=Math.max(s,d),i=Math.max(i,u)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,h=this.minY,a=this.maxX,r=this.maxY;if(t<=n&&s<=n||e<=h&&i<=h||t>=a&&s>=a||e>=r&&i>=r)return!1;let o=(i-e)/(s-t),l=o*(n-t)+e;if(l>h&&l<r||(l=o*(a-t)+e,l>h&&l<r))return!0;let c=(h-e)/o+t;return c>n&&c<a||(c=(r-e)/o+t,c>n&&c<a)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,h=n-2,a=!1;for(let r=0;r<n;r+=2){let o=i[r+1],l=i[h+1];if(o<s&&l>=s||l<s&&o>=s){let c=i[r];c+(s-o)/(l-o)*(i[h]-c)<e&&(a=!a)}h=r}return a}intersectsSegment(t,e,s,i){let n=this.polygons;for(let h=0,a=n.length;h<a;h++)if(this.intersectsSegmentPolygon(n[h],t,e,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,s,i,n){let h=t,a=t.length,r=e-i,o=s-n,l=e*n-s*i,c=h[a-2],d=h[a-1];for(let u=0;u<a;u+=2){let f=h[u],m=h[u+1],g=c*m-d*f,w=c-f,b=d-m,p=r*b-o*w,x=(l*w-r*g)/p;if((x>=c&&x<=f||x>=f&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let y=(l*b-o*g)/p;if((y>=d&&y<=m||y>=m&&y<=d)&&(y>=s&&y<=n||y>=n&&y<=s))return!0}c=f,d=m}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}class lt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new $t(()=>new Array);polygonIndicesPool=new $t(()=>new Array);triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<s;a++)i[a]=a;let n=this.isConcaveArray;n.length=0;for(let a=0,r=s;a<r;++a)n[a]=lt.isConcave(a,s,e,i);let h=this.triangles;for(h.length=0;s>3;){let a=s-1,r=0,o=1;for(;;){t:if(!n[r]){let d=i[a]<<1,u=i[r]<<1,f=i[o]<<1,m=e[d],g=e[d+1],w=e[u],b=e[u+1],p=e[f],x=e[f+1];for(let y=(o+1)%s;y!=a;y=(y+1)%s){if(!n[y])continue;let v=i[y]<<1,A=e[v],k=e[v+1];if(lt.positiveArea(p,x,m,g,A,k)&<.positiveArea(m,g,w,b,A,k)&<.positiveArea(w,b,p,x,A,k))break t}break}if(o==0){do{if(!n[r])break;r--}while(r>0);break}a=r,r=o,o=(o+1)%s}h.push(i[(s+r-1)%s]),h.push(i[r]),h.push(i[(r+1)%s]),i.splice(r,1),n.splice(r,1),s--;let l=(s+r-1)%s,c=r==s?0:r;n[l]=lt.isConcave(l,s,e,i),n[c]=lt.isConcave(c,s,e,i)}return s==3&&(h.push(i[2]),h.push(i[0]),h.push(i[1])),h}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let a=this.polygonPool.obtain();a.length=0;let r=-1,o=0;for(let l=0,c=e.length;l<c;l+=3){let d=e[l]<<1,u=e[l+1]<<1,f=e[l+2]<<1,m=s[d],g=s[d+1],w=s[u],b=s[u+1],p=s[f],x=s[f+1],y=!1;if(r==d){let v=a.length-4,A=lt.winding(a[v],a[v+1],a[v+2],a[v+3],p,x),k=lt.winding(p,x,a[0],a[1],a[2],a[3]);A==o&&k==o&&(a.push(p),a.push(x),h.push(f),y=!0)}y||(a.length>0?(i.push(a),n.push(h)):(this.polygonPool.free(a),this.polygonIndicesPool.free(h)),a=this.polygonPool.obtain(),a.length=0,a.push(m),a.push(g),a.push(w),a.push(b),a.push(p),a.push(x),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(d),h.push(u),h.push(f),o=lt.winding(m,g,w,b,p,x),r=d)}a.length>0&&(i.push(a),n.push(h));for(let l=0,c=i.length;l<c;l++){if(h=n[l],h.length==0)continue;let d=h[0],u=h[h.length-1];a=i[l];let f=a.length-4,m=a[f],g=a[f+1],w=a[f+2],b=a[f+3],p=a[0],x=a[1],y=a[2],v=a[3],A=lt.winding(m,g,w,b,p,x);for(let k=0;k<c;k++){if(k==l)continue;let I=n[k];if(I.length!=3)continue;let Y=I[0],T=I[1],R=I[2],X=i[k],M=X[X.length-2],F=X[X.length-1];if(Y!=d||T!=u)continue;let L=lt.winding(m,g,w,b,M,F),O=lt.winding(M,F,p,x,y,v);L==A&&O==A&&(X.length=0,I.length=0,a.push(M),a.push(F),h.push(R),m=w,g=b,w=M,b=F,k=0)}}for(let l=i.length-1;l>=0;l--)a=i[l],a.length==0&&(i.splice(l,1),this.polygonPool.free(a),h=n[l],n.splice(l,1),this.polygonIndicesPool.free(h));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,h=i[t]<<1,a=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[h],s[h+1],s[a],s[a+1])}static positiveArea(t,e,s,i,n,h){return t*(h-i)+s*(e-h)+n*(i-e)>=0}static winding(t,e,s,i,n,h){let a=s-t,r=i-e;return n*r-h*a+a*e-t*r>=0?1:-1}}class _t{triangulator=new lt;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=E.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;_t.makeClockwise(n);let h=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let a=0,r=h.length;a<r;a++){let o=h[a];_t.makeClockwise(o),o.push(o[0]),o.push(o[1])}return h.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,i,n,h,a,r){let o,l,c,d,u,f;typeof e=="number"?(o=s,l=i,c=n,d=h,u=a,f=r):(o=e,l=s,c=i,d=n,u=h,f=a),c&&d&&u&&typeof f=="boolean"?this.clipTrianglesRender(t,o,l,c,d,u,f):this.clipTrianglesNoRender(t,o,l)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,h=this.clippedTriangles,a=this.clippingPolygons,r=a.length,o=0;n.length=0,h.length=0;for(let l=0;l<s;l+=3){let c=e[l]<<1,d=t[c],u=t[c+1];c=e[l+1]<<1;let f=t[c],m=t[c+1];c=e[l+2]<<1;let g=t[c],w=t[c+1];for(let b=0;b<r;b++){let p=n.length;if(this.clip(d,u,f,m,g,w,a[b],i)){let x=i.length;if(x==0)continue;let y=x>>1,v=this.clipOutput,A=E.setArraySize(n,p+y*2);for(let I=0;I<x;I+=2,p+=2){let Y=v[I],T=v[I+1];A[p]=Y,A[p+1]=T}p=h.length;let k=E.setArraySize(h,p+3*(y-2));y--;for(let I=1;I<y;I++,p+=3)k[p]=o,k[p+1]=o+I,k[p+2]=o+I+1;o+=y+1}else{let x=E.setArraySize(n,p+6);x[p]=d,x[p+1]=u,x[p+2]=f,x[p+3]=m,x[p+4]=g,x[p+5]=w,p=h.length;let y=E.setArraySize(h,p+3);y[p]=o,y[p+1]=o+1,y[p+2]=o+2,o+=3;break}}}}clipTrianglesRender(t,e,s,i,n,h,a){let r=this.clipOutput,o=this.clippedVertices,l=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=a?12:8,f=0;o.length=0,l.length=0;for(let m=0;m<s;m+=3){let g=e[m]<<1,w=t[g],b=t[g+1],p=i[g],x=i[g+1];g=e[m+1]<<1;let y=t[g],v=t[g+1],A=i[g],k=i[g+1];g=e[m+2]<<1;let I=t[g],Y=t[g+1],T=i[g],R=i[g+1];for(let X=0;X<d;X++){let M=o.length;if(this.clip(w,b,y,v,I,Y,c[X],r)){let F=r.length;if(F==0)continue;let L=v-Y,O=I-y,W=w-I,N=Y-b,G=1/(L*W+O*(b-Y)),H=F>>1,j=this.clipOutput,D=E.setArraySize(o,M+H*u);for(let q=0;q<F;q+=2,M+=u){let ht=j[q],at=j[q+1];D[M]=ht,D[M+1]=at,D[M+2]=n.r,D[M+3]=n.g,D[M+4]=n.b,D[M+5]=n.a;let Q=ht-I,st=at-Y,it=(L*Q+O*st)*G,It=(N*Q+W*st)*G,Wt=1-it-It;D[M+6]=p*it+A*It+T*Wt,D[M+7]=x*it+k*It+R*Wt,a&&(D[M+8]=h.r,D[M+9]=h.g,D[M+10]=h.b,D[M+11]=h.a)}M=l.length;let U=E.setArraySize(l,M+3*(H-2));H--;for(let q=1;q<H;q++,M+=3)U[M]=f,U[M+1]=f+q,U[M+2]=f+q+1;f+=H+1}else{let F=E.setArraySize(o,M+3*u);F[M]=w,F[M+1]=b,F[M+2]=n.r,F[M+3]=n.g,F[M+4]=n.b,F[M+5]=n.a,a?(F[M+6]=p,F[M+7]=x,F[M+8]=h.r,F[M+9]=h.g,F[M+10]=h.b,F[M+11]=h.a,F[M+12]=y,F[M+13]=v,F[M+14]=n.r,F[M+15]=n.g,F[M+16]=n.b,F[M+17]=n.a,F[M+18]=A,F[M+19]=k,F[M+20]=h.r,F[M+21]=h.g,F[M+22]=h.b,F[M+23]=h.a,F[M+24]=I,F[M+25]=Y,F[M+26]=n.r,F[M+27]=n.g,F[M+28]=n.b,F[M+29]=n.a,F[M+30]=T,F[M+31]=R,F[M+32]=h.r,F[M+33]=h.g,F[M+34]=h.b,F[M+35]=h.a):(F[M+6]=p,F[M+7]=x,F[M+8]=y,F[M+9]=v,F[M+10]=n.r,F[M+11]=n.g,F[M+12]=n.b,F[M+13]=n.a,F[M+14]=A,F[M+15]=k,F[M+16]=I,F[M+17]=Y,F[M+18]=n.r,F[M+19]=n.g,F[M+20]=n.b,F[M+21]=n.a,F[M+22]=T,F[M+23]=R),M=l.length;let L=E.setArraySize(l,M+3);L[M]=f,L[M+1]=f+1,L[M+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,h=this.clippedVertices,a=this.clippedUVs,r=this.clippedTriangles,o=this.clippingPolygons,l=o.length,c=0;h.length=0,a.length=0,r.length=0;for(let d=0;d<s;d+=3){let u=e[d]<<1,f=t[u],m=t[u+1],g=i[u],w=i[u+1];u=e[d+1]<<1;let b=t[u],p=t[u+1],x=i[u],y=i[u+1];u=e[d+2]<<1;let v=t[u],A=t[u+1],k=i[u],I=i[u+1];for(let Y=0;Y<l;Y++){let T=h.length;if(this.clip(f,m,b,p,v,A,o[Y],n)){let R=n.length;if(R==0)continue;let X=p-A,M=v-b,F=f-v,L=A-m,O=1/(X*F+M*(m-A)),W=R>>1,N=this.clipOutput,G=E.setArraySize(h,T+W*2),H=E.setArraySize(a,T+W*2);for(let D=0;D<R;D+=2,T+=2){let U=N[D],q=N[D+1];G[T]=U,G[T+1]=q;let ht=U-v,at=q-A,Q=(X*ht+M*at)*O,st=(L*ht+F*at)*O,it=1-Q-st;H[T]=g*Q+x*st+k*it,H[T+1]=w*Q+y*st+I*it}T=r.length;let j=E.setArraySize(r,T+3*(W-2));W--;for(let D=1;D<W;D++,T+=3)j[T]=c,j[T+1]=c+D,j[T+2]=c+D+1;c+=W+1}else{let R=E.setArraySize(h,T+6);R[T]=f,R[T+1]=m,R[T+2]=b,R[T+3]=p,R[T+4]=v,R[T+5]=A;let X=E.setArraySize(a,T+6);X[T]=g,X[T+1]=w,X[T+2]=x,X[T+3]=y,X[T+4]=k,X[T+5]=I,T=r.length;let M=E.setArraySize(r,T+3);M[T]=c,M[T+1]=c+1,M[T+2]=c+2,c+=3;break}}}}clip(t,e,s,i,n,h,a,r){let o=r,l=!1,c;a.length%4>=2?(c=r,r=this.scratch):c=this.scratch,c.length=0,c.push(t),c.push(e),c.push(s),c.push(i),c.push(n),c.push(h),c.push(t),c.push(e),r.length=0;let d=a.length-4,u=a;for(let f=0;;f+=2){let m=u[f],g=u[f+1],w=m-u[f+2],b=g-u[f+3],p=r.length,x=c;for(let v=0,A=c.length-2;v<A;){let k=x[v],I=x[v+1];v+=2;let Y=x[v],T=x[v+1],R=b*(m-Y)>w*(g-T),X=b*(m-k)-w*(g-I);if(X>0){if(R){r.push(Y),r.push(T);continue}let M=Y-k,F=T-I,L=X/(M*b-F*w);if(L>=0&&L<=1)r.push(k+M*L),r.push(I+F*L);else{r.push(Y),r.push(T);continue}}else if(R){let M=Y-k,F=T-I,L=X/(M*b-F*w);if(L>=0&&L<=1)r.push(k+M*L),r.push(I+F*L),r.push(Y),r.push(T);else{r.push(Y),r.push(T);continue}}l=!0}if(p==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),f==d)break;let y=r;r=c,r.length=0,c=y}if(o!=r){o.length=0;for(let f=0,m=r.length-2;f<m;f++)o[f]=r[f]}else o.length=o.length-2;return l}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,h=0,a=0,r=0;for(let o=0,l=s-3;o<l;o+=2)n=e[o],h=e[o+1],a=e[o+2],r=e[o+3],i+=n*r-a*h;if(!(i<0))for(let o=0,l=s-2,c=s>>1;o<c;o+=2){let d=e[o],u=e[o+1],f=l-o;e[o]=e[f],e[o+1]=e[f+1],e[f]=d,e[f+1]=u}}}class qi{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new ne,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=S(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let a=i.bones[h],r=null,o=S(a,"parent",null);o&&(r=s.findBone(o));let l=new vs(s.bones.length,a.name,r);l.length=S(a,"length",0)*e,l.x=S(a,"x",0)*e,l.y=S(a,"y",0)*e,l.rotation=S(a,"rotation",0),l.scaleX=S(a,"scaleX",1),l.scaleY=S(a,"scaleY",1),l.shearX=S(a,"shearX",0),l.shearY=S(a,"shearY",0),l.inherit=E.enumValue(K,S(a,"inherit","Normal")),l.skinRequired=S(a,"skin",!1);let c=S(a,"color",null);c&&l.color.setFromString(c),s.bones.push(l)}if(i.slots)for(let h=0;h<i.slots.length;h++){let a=i.slots[h],r=a.name,o=s.findBone(a.bone);if(!o)throw new Error(`Couldn't find bone ${a.bone} for slot ${r}`);let l=new Ts(s.slots.length,r,o),c=S(a,"color",null);c&&l.color.setFromString(c);let d=S(a,"dark",null);d&&(l.darkColor=V.fromString(d)),l.attachmentName=S(a,"attachment",null),l.blendMode=E.enumValue(Tt,S(a,"blend","normal")),l.visible=S(a,"visible",!0),s.slots.push(l)}if(i.ik)for(let h=0;h<i.ik.length;h++){let a=i.ik[h],r=new ks(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);for(let l=0;l<a.bones.length;l++){let c=s.findBone(a.bones[l]);if(!c)throw new Error(`Couldn't find bone ${a.bones[l]} for IK constraint ${a.name}.`);r.bones.push(c)}let o=s.findBone(a.target);if(!o)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);r.target=o,r.mix=S(a,"mix",1),r.softness=S(a,"softness",0)*e,r.bendDirection=S(a,"bendPositive",!0)?1:-1,r.compress=S(a,"compress",!1),r.stretch=S(a,"stretch",!1),r.uniform=S(a,"uniform",!1),s.ikConstraints.push(r)}if(i.transform)for(let h=0;h<i.transform.length;h++){let a=i.transform[h],r=new Ms(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let d=a.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for transform constraint ${a.name}.`);r.bones.push(u)}let o=a.target,l=s.findBone(o);if(!l)throw new Error(`Couldn't find target bone ${o} for transform constraint ${a.name}.`);r.target=l,r.local=S(a,"local",!1),r.relative=S(a,"relative",!1),r.offsetRotation=S(a,"rotation",0),r.offsetX=S(a,"x",0)*e,r.offsetY=S(a,"y",0)*e,r.offsetScaleX=S(a,"scaleX",0),r.offsetScaleY=S(a,"scaleY",0),r.offsetShearY=S(a,"shearY",0),r.mixRotate=S(a,"mixRotate",1),r.mixX=S(a,"mixX",1),r.mixY=S(a,"mixY",r.mixX),r.mixScaleX=S(a,"mixScaleX",1),r.mixScaleY=S(a,"mixScaleY",r.mixScaleX),r.mixShearY=S(a,"mixShearY",1),s.transformConstraints.push(r)}if(i.path)for(let h=0;h<i.path.length;h++){let a=i.path[h],r=new Ss(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let d=a.bones[c],u=s.findBone(d);if(!u)throw new Error(`Couldn't find bone ${d} for path constraint ${a.name}.`);r.bones.push(u)}let o=a.target,l=s.findSlot(o);if(!l)throw new Error(`Couldn't find target slot ${o} for path constraint ${a.name}.`);r.target=l,r.positionMode=E.enumValue(vt,S(a,"positionMode","Percent")),r.spacingMode=E.enumValue(Z,S(a,"spacingMode","Length")),r.rotateMode=E.enumValue(Pt,S(a,"rotateMode","Tangent")),r.offsetRotation=S(a,"rotation",0),r.position=S(a,"position",0),r.positionMode==vt.Fixed&&(r.position*=e),r.spacing=S(a,"spacing",0),(r.spacingMode==Z.Length||r.spacingMode==Z.Fixed)&&(r.spacing*=e),r.mixRotate=S(a,"mixRotate",1),r.mixX=S(a,"mixX",1),r.mixY=S(a,"mixY",r.mixX),s.pathConstraints.push(r)}if(i.physics)for(let h=0;h<i.physics.length;h++){const a=i.physics[h],r=new Is(a.name);r.order=S(a,"order",0),r.skinRequired=S(a,"skin",!1);const o=a.bone,l=s.findBone(o);if(l==null)throw new Error("Physics bone not found: "+o);r.bone=l,r.x=S(a,"x",0),r.y=S(a,"y",0),r.rotate=S(a,"rotate",0),r.scaleX=S(a,"scaleX",0),r.shearX=S(a,"shearX",0),r.limit=S(a,"limit",5e3)*e,r.step=1/S(a,"fps",60),r.inertia=S(a,"inertia",1),r.strength=S(a,"strength",100),r.damping=S(a,"damping",1),r.massInverse=1/S(a,"mass",1),r.wind=S(a,"wind",0),r.gravity=S(a,"gravity",0),r.mix=S(a,"mix",1),r.inertiaGlobal=S(a,"inertiaGlobal",!1),r.strengthGlobal=S(a,"strengthGlobal",!1),r.dampingGlobal=S(a,"dampingGlobal",!1),r.massGlobal=S(a,"massGlobal",!1),r.windGlobal=S(a,"windGlobal",!1),r.gravityGlobal=S(a,"gravityGlobal",!1),r.mixGlobal=S(a,"mixGlobal",!1),s.physicsConstraints.push(r)}if(i.skins)for(let h=0;h<i.skins.length;h++){let a=i.skins[h],r=new ae(a.name);if(a.bones)for(let o=0;o<a.bones.length;o++){let l=a.bones[o],c=s.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${a.name}.`);r.bones.push(c)}if(a.ik)for(let o=0;o<a.ik.length;o++){let l=a.ik[o],c=s.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.transform)for(let o=0;o<a.transform.length;o++){let l=a.transform[o],c=s.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.path)for(let o=0;o<a.path.length;o++){let l=a.path[o],c=s.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.physics)for(let o=0;o<a.physics.length;o++){let l=a.physics[o],c=s.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}for(let o in a.attachments){let l=s.findSlot(o);if(!l)throw new Error(`Couldn't find slot ${o} for skin ${a.name}.`);let c=a.attachments[o];for(let d in c){let u=this.readAttachment(c[d],r,l.index,d,s);u&&r.setAttachment(l.index,d,u)}}s.skins.push(r),r.name=="default"&&(s.defaultSkin=r)}for(let h=0,a=this.linkedMeshes.length;h<a;h++){let r=this.linkedMeshes[h],o=r.skin?s.findSkin(r.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let l=o.getAttachment(r.slotIndex,r.parent);if(!l)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?l:r.mesh,r.mesh.setParentMesh(l),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let a=i.events[h],r=new As(h);r.intValue=S(a,"int",0),r.floatValue=S(a,"float",0),r.stringValue=S(a,"string",""),r.audioPath=S(a,"audio",null),r.audioPath&&(r.volume=S(a,"volume",1),r.balance=S(a,"balance",0)),s.events.push(r)}if(i.animations)for(let h in i.animations){let a=i.animations[h];this.readAnimation(a,h,s)}return s}readAttachment(t,e,s,i,n){let h=this.scale;switch(i=S(t,"name",i),S(t,"type","region")){case"region":{let a=S(t,"path",i),r=this.readSequence(S(t,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(e,i,a,r);if(!o)return null;o.path=a,o.x=S(t,"x",0)*h,o.y=S(t,"y",0)*h,o.scaleX=S(t,"scaleX",1),o.scaleY=S(t,"scaleY",1),o.rotation=S(t,"rotation",0),o.width=t.width*h,o.height=t.height*h,o.sequence=r;let l=S(t,"color",null);return l&&o.color.setFromString(l),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let a=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!a)return null;this.readVertices(t,a,t.vertexCount<<1);let r=S(t,"color",null);return r&&a.color.setFromString(r),a}case"mesh":case"linkedmesh":{let a=S(t,"path",i),r=this.readSequence(S(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,a,r);if(!o)return null;o.path=a;let l=S(t,"color",null);l&&o.color.setFromString(l),o.width=S(t,"width",0)*h,o.height=S(t,"height",0)*h,o.sequence=r;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new zi(o,S(t,"skin",null),s,c,S(t,"timelines",!0))),o;let d=t.uvs;return this.readVertices(t,o,d.length),o.triangles=t.triangles,o.regionUVs=d,o.region!=null&&o.updateRegion(),o.edges=S(t,"edges",null),o.hullLength=S(t,"hull",0)*2,o}case"path":{let a=this.attachmentLoader.newPathAttachment(e,i);if(!a)return null;a.closed=S(t,"closed",!1),a.constantSpeed=S(t,"constantSpeed",!0);let r=t.vertexCount;this.readVertices(t,a,r<<1);let o=E.newArray(r/3,0);for(let c=0;c<t.lengths.length;c++)o[c]=t.lengths[c]*h;a.lengths=o;let l=S(t,"color",null);return l&&a.color.setFromString(l),a}case"point":{let a=this.attachmentLoader.newPointAttachment(e,i);if(!a)return null;a.x=S(t,"x",0)*h,a.y=S(t,"y",0)*h,a.rotation=S(t,"rotation",0);let r=S(t,"color",null);return r&&a.color.setFromString(r),a}case"clipping":{let a=this.attachmentLoader.newClippingAttachment(e,i);if(!a)return null;let r=S(t,"end",null);r&&(a.endSlot=n.findSlot(r));let o=t.vertexCount;this.readVertices(t,a,o<<1);let l=S(t,"color",null);return l&&a.color.setFromString(l),a}}return null}readSequence(t){if(t==null)return null;let e=new Vt(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let r=E.toFloatArray(n);if(i!=1)for(let o=0,l=n.length;o<l;o++)r[o]*=i;e.vertices=r;return}let h=new Array,a=new Array;for(let r=0,o=n.length;r<o;){let l=n[r++];a.push(l);for(let c=r+l*4;r<c;r+=4)a.push(n[r]),h.push(n[r+1]*i),h.push(n[r+2]*i),h.push(n[r+3])}e.bones=a,e.vertices=E.toFloatArray(h)}readAnimation(t,e,s){let i=this.scale,n=new Array;if(t.slots)for(let a in t.slots){let r=t.slots[a],o=s.findSlot(a);if(!o)throw new Error("Slot not found: "+a);let l=o.index;for(let c in r){let d=r[c];if(!d)continue;let u=d.length;if(c=="attachment"){let f=new Dt(u,l);for(let m=0;m<u;m++){let g=d[m];f.setFrame(m,S(g,"time",0),S(g,"name",null))}n.push(f)}else if(c=="rgba"){let f=new es(u,u<<2,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.color);for(let b=0,p=0;;b++){f.setFrame(b,g,w.r,w.g,w.b,w.a);let x=d[b+1];if(!x){f.shrink(p);break}let y=S(x,"time",0),v=V.fromString(x.color),A=m.curve;A&&(p=$(A,f,p,b,0,g,y,w.r,v.r,1),p=$(A,f,p,b,1,g,y,w.g,v.g,1),p=$(A,f,p,b,2,g,y,w.b,v.b,1),p=$(A,f,p,b,3,g,y,w.a,v.a,1)),g=y,w=v,m=x}n.push(f)}else if(c=="rgb"){let f=new ss(u,u*3,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.color);for(let b=0,p=0;;b++){f.setFrame(b,g,w.r,w.g,w.b);let x=d[b+1];if(!x){f.shrink(p);break}let y=S(x,"time",0),v=V.fromString(x.color),A=m.curve;A&&(p=$(A,f,p,b,0,g,y,w.r,v.r,1),p=$(A,f,p,b,1,g,y,w.g,v.g,1),p=$(A,f,p,b,2,g,y,w.b,v.b,1)),g=y,w=v,m=x}n.push(f)}else if(c=="alpha")n.push(ut(d,new is(u,u,l),0,1));else if(c=="rgba2"){let f=new rs(u,u*7,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.light),b=V.fromString(m.dark);for(let p=0,x=0;;p++){f.setFrame(p,g,w.r,w.g,w.b,w.a,b.r,b.g,b.b);let y=d[p+1];if(!y){f.shrink(x);break}let v=S(y,"time",0),A=V.fromString(y.light),k=V.fromString(y.dark),I=m.curve;I&&(x=$(I,f,x,p,0,g,v,w.r,A.r,1),x=$(I,f,x,p,1,g,v,w.g,A.g,1),x=$(I,f,x,p,2,g,v,w.b,A.b,1),x=$(I,f,x,p,3,g,v,w.a,A.a,1),x=$(I,f,x,p,4,g,v,b.r,k.r,1),x=$(I,f,x,p,5,g,v,b.g,k.g,1),x=$(I,f,x,p,6,g,v,b.b,k.b,1)),g=v,w=A,b=k,m=y}n.push(f)}else if(c=="rgb2"){let f=new ns(u,u*6,l),m=d[0],g=S(m,"time",0),w=V.fromString(m.light),b=V.fromString(m.dark);for(let p=0,x=0;;p++){f.setFrame(p,g,w.r,w.g,w.b,b.r,b.g,b.b);let y=d[p+1];if(!y){f.shrink(x);break}let v=S(y,"time",0),A=V.fromString(y.light),k=V.fromString(y.dark),I=m.curve;I&&(x=$(I,f,x,p,0,g,v,w.r,A.r,1),x=$(I,f,x,p,1,g,v,w.g,A.g,1),x=$(I,f,x,p,2,g,v,w.b,A.b,1),x=$(I,f,x,p,3,g,v,b.r,k.r,1),x=$(I,f,x,p,4,g,v,b.g,k.g,1),x=$(I,f,x,p,5,g,v,b.b,k.b,1)),g=v,w=A,b=k,m=y}n.push(f)}}}if(t.bones)for(let a in t.bones){let r=t.bones[a],o=s.findBone(a);if(!o)throw new Error("Bone not found: "+a);let l=o.index;for(let c in r){let d=r[c],u=d.length;if(u!=0){if(c==="rotate")n.push(ut(d,new re(u,u,l),0,1));else if(c==="translate"){let f=new ze(u,u<<1,l);n.push(xe(d,f,"x","y",0,i))}else if(c==="translatex"){let f=new Ge(u,u,l);n.push(ut(d,f,0,i))}else if(c==="translatey"){let f=new $e(u,u,l);n.push(ut(d,f,0,i))}else if(c==="scale"){let f=new He(u,u<<1,l);n.push(xe(d,f,"x","y",1,1))}else if(c==="scalex"){let f=new je(u,u,l);n.push(ut(d,f,1,1))}else if(c==="scaley"){let f=new Je(u,u,l);n.push(ut(d,f,1,1))}else if(c==="shear"){let f=new Ke(u,u<<1,l);n.push(xe(d,f,"x","y",0,1))}else if(c==="shearx"){let f=new Qe(u,u,l);n.push(ut(d,f,0,1))}else if(c==="sheary"){let f=new Ze(u,u,l);n.push(ut(d,f,0,1))}else if(c==="inherit"){let f=new ts(u,o.index);for(let m=0;m<d.length;m++){let g=d[m];f.setFrame(m,S(g,"time",0),E.enumValue(K,S(g,"inherit","Normal")))}n.push(f)}}}}if(t.ik)for(let a in t.ik){let r=t.ik[a],o=r[0];if(!o)continue;let l=s.findIkConstraint(a);if(!l)throw new Error("IK Constraint not found: "+a);let c=s.ikConstraints.indexOf(l),d=new os(r.length,r.length<<1,c),u=S(o,"time",0),f=S(o,"mix",1),m=S(o,"softness",0)*i;for(let g=0,w=0;;g++){d.setFrame(g,u,f,m,S(o,"bendPositive",!0)?1:-1,S(o,"compress",!1),S(o,"stretch",!1));let b=r[g+1];if(!b){d.shrink(w);break}let p=S(b,"time",0),x=S(b,"mix",1),y=S(b,"softness",0)*i,v=o.curve;v&&(w=$(v,d,w,g,0,u,p,f,x,1),w=$(v,d,w,g,1,u,p,m,y,i)),u=p,f=x,m=y,o=b}n.push(d)}if(t.transform)for(let a in t.transform){let r=t.transform[a],o=r[0];if(!o)continue;let l=s.findTransformConstraint(a);if(!l)throw new Error("Transform constraint not found: "+a);let c=s.transformConstraints.indexOf(l),d=new ls(r.length,r.length*6,c),u=S(o,"time",0),f=S(o,"mixRotate",1),m=S(o,"mixX",1),g=S(o,"mixY",m),w=S(o,"mixScaleX",1),b=S(o,"mixScaleY",w),p=S(o,"mixShearY",1);for(let x=0,y=0;;x++){d.setFrame(x,u,f,m,g,w,b,p);let v=r[x+1];if(!v){d.shrink(y);break}let A=S(v,"time",0),k=S(v,"mixRotate",1),I=S(v,"mixX",1),Y=S(v,"mixY",I),T=S(v,"mixScaleX",1),R=S(v,"mixScaleY",T),X=S(v,"mixShearY",1),M=o.curve;M&&(y=$(M,d,y,x,0,u,A,f,k,1),y=$(M,d,y,x,1,u,A,m,I,1),y=$(M,d,y,x,2,u,A,g,Y,1),y=$(M,d,y,x,3,u,A,w,T,1),y=$(M,d,y,x,4,u,A,b,R,1),y=$(M,d,y,x,5,u,A,p,X,1)),u=A,f=k,m=I,g=Y,w=T,b=R,w=T,o=v}n.push(d)}if(t.path)for(let a in t.path){let r=t.path[a],o=s.findPathConstraint(a);if(!o)throw new Error("Path constraint not found: "+a);let l=s.pathConstraints.indexOf(o);for(let c in r){let d=r[c],u=d[0];if(!u)continue;let f=d.length;if(c==="position"){let m=new hs(f,f,l);n.push(ut(d,m,0,o.positionMode==vt.Fixed?i:1))}else if(c==="spacing"){let m=new cs(f,f,l);n.push(ut(d,m,0,o.spacingMode==Z.Length||o.spacingMode==Z.Fixed?i:1))}else if(c==="mix"){let m=new ds(f,f*3,l),g=S(u,"time",0),w=S(u,"mixRotate",1),b=S(u,"mixX",1),p=S(u,"mixY",b);for(let x=0,y=0;;x++){m.setFrame(x,g,w,b,p);let v=d[x+1];if(!v){m.shrink(y);break}let A=S(v,"time",0),k=S(v,"mixRotate",1),I=S(v,"mixX",1),Y=S(v,"mixY",I),T=u.curve;T&&(y=$(T,m,y,x,0,g,A,w,k,1),y=$(T,m,y,x,1,g,A,b,I,1),y=$(T,m,y,x,2,g,A,p,Y,1)),g=A,w=k,b=I,p=Y,u=v}n.push(m)}}}if(t.physics)for(let a in t.physics){let r=t.physics[a],o=-1;if(a.length>0){let l=s.findPhysicsConstraint(a);if(!l)throw new Error("Physics constraint not found: "+a);o=s.physicsConstraints.indexOf(l)}for(let l in r){let c=r[l],d=c[0];if(!d)continue;let u=c.length;if(l=="reset"){const m=new le(u,o);for(let g=0;d!=null;d=c[g+1],g++)m.setFrame(g,S(d,"time",0));n.push(m);continue}let f;if(l=="inertia")f=new fs(u,u,o);else if(l=="strength")f=new us(u,u,o);else if(l=="damping")f=new ms(u,u,o);else if(l=="mass")f=new gs(u,u,o);else if(l=="wind")f=new ps(u,u,o);else if(l=="gravity")f=new xs(u,u,o);else if(l=="mix")f=new bs(u,u,o);else continue;n.push(ut(c,f,0,1))}}if(t.attachments)for(let a in t.attachments){let r=t.attachments[a],o=s.findSkin(a);if(!o)throw new Error("Skin not found: "+a);for(let l in r){let c=r[l],d=s.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let u=d.index;for(let f in c){let m=c[f],g=o.getAttachment(u,f);for(let w in m){let b=m[w],p=b[0];if(p){if(w=="deform"){let x=g.bones,y=g.vertices,v=x?y.length/3*2:y.length,A=new as(b.length,b.length,u,g),k=S(p,"time",0);for(let I=0,Y=0;;I++){let T,R=S(p,"vertices",null);if(!R)T=x?E.newFloatArray(v):y;else{T=E.newFloatArray(v);let L=S(p,"offset",0);if(E.arrayCopy(R,0,T,L,R.length),i!=1)for(let O=L,W=O+R.length;O<W;O++)T[O]*=i;if(!x)for(let O=0;O<v;O++)T[O]+=y[O]}A.setFrame(I,k,T);let X=b[I+1];if(!X){A.shrink(Y);break}let M=S(X,"time",0),F=p.curve;F&&(Y=$(F,A,Y,I,0,k,M,0,1,1)),k=M,p=X}n.push(A)}else if(w=="sequence"){let x=new yt(b.length,u,g),y=0;for(let v=0;v<b.length;v++){let A=S(p,"delay",y),k=S(p,"time",0),I=et[S(p,"mode","hold")],Y=S(p,"index",0);x.setFrame(v,k,I,Y,A),y=A,p=b[v+1]}n.push(x)}}}}}}if(t.drawOrder){let a=new Xt(t.drawOrder.length),r=s.slots.length,o=0;for(let l=0;l<t.drawOrder.length;l++,o++){let c=t.drawOrder[l],d=null,u=S(c,"offsets",null);if(u){d=E.newArray(r,-1);let f=E.newArray(r-u.length,0),m=0,g=0;for(let w=0;w<u.length;w++){let b=u[w],p=s.findSlot(b.slot);if(!p)throw new Error("Slot not found: "+p);let x=p.index;for(;m!=x;)f[g++]=m++;d[m+b.offset]=m++}for(;m<r;)f[g++]=m++;for(let w=r-1;w>=0;w--)d[w]==-1&&(d[w]=f[--g])}a.setFrame(o,S(c,"time",0),d)}n.push(a)}if(t.events){let a=new Ht(t.events.length),r=0;for(let o=0;o<t.events.length;o++,r++){let l=t.events[o],c=s.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new Cs(E.toSinglePrecision(S(l,"time",0)),c);d.intValue=S(l,"int",c.intValue),d.floatValue=S(l,"float",c.floatValue),d.stringValue=S(l,"string",c.stringValue),d.data.audioPath&&(d.volume=S(l,"volume",1),d.balance=S(l,"balance",0)),a.setFrame(r,d)}n.push(a)}let h=0;for(let a=0,r=n.length;a<r;a++)h=Math.max(h,n[a].getDuration());s.animations.push(new ye(e,n,h))}}class zi{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}}function ut(C,t,e,s){let i=C[0],n=S(i,"time",0),h=S(i,"value",e)*s,a=0;for(let r=0;;r++){t.setFrame(r,n,h);let o=C[r+1];if(!o)return t.shrink(a),t;let l=S(o,"time",0),c=S(o,"value",e)*s;i.curve&&(a=$(i.curve,t,a,r,0,n,l,h,c,s)),n=l,h=c,i=o}}function xe(C,t,e,s,i,n){let h=C[0],a=S(h,"time",0),r=S(h,e,i)*n,o=S(h,s,i)*n,l=0;for(let c=0;;c++){t.setFrame(c,a,r,o);let d=C[c+1];if(!d)return t.shrink(l),t;let u=S(d,"time",0),f=S(d,e,i)*n,m=S(d,s,i)*n,g=h.curve;g&&(l=$(g,t,l,c,0,a,u,r,f,n),l=$(g,t,l,c,1,a,u,o,m,n)),a=u,r=f,o=m,h=d}}function $(C,t,e,s,i,n,h,a,r,o){if(C=="stepped")return t.setStepped(s),e;let l=i<<2,c=C[l],d=C[l+1]*o,u=C[l+2],f=C[l+3]*o;return t.setBezier(e,s,i,n,a,c,d,u,f,h,r),e+1}function S(C,t,e){return C[t]!==void 0?C[t]:e}typeof Math.fround>"u"&&(Math.fround=(function(C){return function(t){return C[0]=t,C[0]}})(new Float32Array(1)));class mt extends ws{static textureMap=new Map;static from(t){return mt.textureMap.has(t)?mt.textureMap.get(t):new mt(t)}texture;constructor(t){super(t.resource),this.texture=Ve.from(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=mt.toPixiTextureFilter(t),s.magFilter=mt.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=mt.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=mt.toPixiTextureWrap(t),s.addressModeV=mt.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case tt.Nearest:case tt.Linear:return!1;case tt.MipMapNearestLinear:case tt.MipMapNearestNearest:case tt.MipMapLinearLinear:case tt.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case tt.Nearest:case tt.MipMapNearestLinear:case tt.MipMapNearestNearest:return"nearest";case tt.Linear:case tt.MipMapLinearLinear:case tt.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case St.ClampToEdge:return"clamp-to-edge";case St.MirroredRepeat:return"mirror-repeat";case St.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Tt.Normal:return"normal";case Tt.Additive:return"add";case Tt.Multiply:return"multiply";case Tt.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}}const qt="spineTextureAtlasLoader",Gi={extension:Mt.Asset,resolver:{test:C=>Nt(C,".atlas"),parse:C=>{const t=C.split(".");return{resolution:parseFloat(Xs.RETINA_PREFIX?.exec(C)?.[1]??"1"),format:t[t.length-2],src:C}}},loader:{id:qt,name:qt,extension:{type:Mt.LoadParser,priority:Oe.Normal,name:qt},test(C){return Nt(C,".atlas")},async load(C){return await(await _e.get().fetch(C)).text()},testParse(C,t){const e=Nt(t.src,".atlas"),s=typeof C=="string",i=t.parser===qt||t.loadParser===qt;return Promise.resolve((e||i)&&s)},unload(C){C.dispose()},async parse(C,t,e){const s=t.data||{};let i=Qt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const n=new be(C);if(s.images instanceof Ye||typeof s.images=="string"){const a=s.images;s.images={},s.images[n.pages[0].name]=a}const h=[];for(const a of n.pages){const r=a.name,o=s?.images?s.images[r]:void 0;if(o instanceof Ye)a.setTexture(mt.from(o));else{const l=o??Qt.normalize([...i.split(Qt.sep),r].join(Qt.sep)),c={src:Fs(l,t.src),data:{...s.imageMetadata,alphaMode:a.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=e.load(c).then(u=>{a.setTexture(mt.from(u.source))});h.push(d)}}return await Promise.all(h),n}}};oe.add(Gi);const zt="spineSkeletonLoader";function $i(C){return Object.prototype.hasOwnProperty.call(C,"bones")}function Hi(C){return C instanceof Uint8Array}const ji={extension:Mt.Asset,loader:{id:zt,name:zt,extension:{type:Mt.LoadParser,priority:Oe.Normal,name:zt},test(C){return Nt(C,".skel")},async load(C){const t=await _e.get().fetch(C);return new Uint8Array(await t.arrayBuffer())},testParse(C,t){const e=Nt(t.src,".json")&&$i(C),s=Nt(t.src,".skel")&&Hi(C),i=t.parser===zt||t.loadParser===zt;return Promise.resolve(e||s||i)}}};oe.add(ji);const Ji=new Float32Array(1),Ki=new Uint32Array(1);class Qi extends Ps{constructor(){const e=new Fe({data:Ji,label:"attribute-batch-buffer",usage:Zt.VERTEX|Zt.COPY_DST,shrinkToFit:!1}),s=new Fe({data:Ki,label:"index-batch-buffer",usage:Zt.INDEX|Zt.COPY_DST,shrinkToFit:!1}),i=28;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:16},aDarkColor:{buffer:e,format:"unorm8x4",stride:i,offset:20},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:24}},indexBuffer:s})}}const Zi={name:"color-bit",vertex:{header:`
|
|
3
|
+
@in aDarkColor: vec4<f32>;
|
|
4
|
+
@out vDarkColor: vec4<f32>;
|
|
5
|
+
`,main:`
|
|
6
|
+
vDarkColor = aDarkColor;
|
|
7
|
+
`},fragment:{header:`
|
|
8
|
+
@in vDarkColor: vec4<f32>;
|
|
9
|
+
`,end:`
|
|
10
|
+
|
|
11
|
+
let alpha = outColor.a * vColor.a;
|
|
12
|
+
let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
|
|
13
|
+
|
|
14
|
+
finalColor = vec4<f32>(rgb, alpha);
|
|
15
|
+
|
|
16
|
+
`}},tr={name:"color-bit",vertex:{header:`
|
|
17
|
+
in vec4 aDarkColor;
|
|
18
|
+
out vec4 vDarkColor;
|
|
19
|
+
`,main:`
|
|
20
|
+
vDarkColor = aDarkColor;
|
|
21
|
+
`},fragment:{header:`
|
|
22
|
+
in vec4 vDarkColor;
|
|
23
|
+
`,end:`
|
|
24
|
+
|
|
25
|
+
finalColor.a = outColor.a * vColor.a;
|
|
26
|
+
finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
|
|
27
|
+
`}};class er extends Rs{constructor(t){const e=Bs({name:"dark-tint-batch",bits:[Es,tr,Ds(t),Ls]}),s=Ns({name:"dark-tint-batch",bits:[Vs,Zi,_s(t),Os]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:Ws(t)}})}}let De=null;class Ae extends Us{static extension={type:[Mt.Batcher],name:"darkTint"};geometry=new Qi;shader=De||(De=new er(this.maxTextures));name=Ae.extension.name;vertexSize=7;packAttributes(t,e,s,i,n){const h=n<<16|t.roundPixels&65535,a=t.transform,r=a.a,o=a.b,l=a.c,c=a.d,d=a.tx,u=a.ty,{positions:f,uvs:m}=t,g=t.color,w=(g>>24&255)/255,b=qs.shared.setValue(t.darkColor).premultiply(w,!0).toPremultiplied(1,!1),p=t.attributeOffset,x=p+t.attributeSize;for(let y=p;y<x;y++){const v=y*2,A=f[v],k=f[v+1];e[i++]=r*A+l*k+d,e[i++]=c*k+o*A+u,e[i++]=m[v],e[i++]=m[v+1],s[i++]=g,s[i++]=b,s[i++]=h}}packQuadAttributes(t,e,s,i,n){const h=t.texture,a=t.transform,r=a.a,o=a.b,l=a.c,c=a.d,d=a.tx,u=a.ty,f=t.bounds,m=f.maxX,g=f.minX,w=f.maxY,b=f.minY,p=h.uvs,x=t.color,y=t.darkColor,v=n<<16|t.roundPixels&65535;e[i+0]=r*g+l*b+d,e[i+1]=c*b+o*g+u,e[i+2]=p.x0,e[i+3]=p.y0,s[i+4]=x,s[i+5]=y,s[i+6]=v,e[i+7]=r*m+l*b+d,e[i+8]=c*b+o*m+u,e[i+9]=p.x1,e[i+10]=p.y1,s[i+11]=x,s[i+12]=y,s[i+13]=v,e[i+14]=r*m+l*w+d,e[i+15]=c*w+o*m+u,e[i+16]=p.x2,e[i+17]=p.y2,s[i+18]=x,s[i+19]=y,s[i+20]=v,e[i+21]=r*g+l*w+d,e[i+22]=c*w+o*g+u,e[i+23]=p.x3,e[i+24]=p.y3,s[i+25]=x,s[i+26]=y,s[i+27]=v}}oe.add(Ae);class sr{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const n=t.a*s*255;if(e!==16777215){const h=e>>16&255,a=e>>8&255,r=e&255,o=t.r*r,l=t.g*a,c=t.b*h;i=n<<24|c<<16|l<<8|o}else i=n<<24|t.b*255<<16|t.g*255<<8|t.r*255;return i}get darkColor(){const t=this.data.darkColor;return t.b*255<<16|t.g*255<<8|t.r*255}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const n=e.clippedData;this.indexSize=n.indicesCount,this.attributeSize=n.vertexCount,this.positions=n.vertices,this.indices=n.indices,this.uvs=n.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}}const ir={0:"normal",1:"add",2:"multiply",3:"screen"};class rr{static extension={type:[Mt.WebGLPipes,Mt.WebGPUPipes,Mt.CanvasPipes],name:"spine"};renderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,n=e.length;i<n;i++){const h=e[i],a=h.getAttachment();if(a instanceof dt||a instanceof ft){const r=t._getCachedData(h,a),o=s.slotBatches[r.id],l=r.texture;if(l!==o.texture&&!o._batcher.checkAndUpdateTexture(o,l))return!0}}}return!1}addRenderable(t,e){const s=this._getSpineData(t),i=this.renderer.renderPipes.batch,n=t.skeleton.drawOrder,h=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;for(let a=0,r=n.length;a<r;a++){const o=n[a],l=o.getAttachment(),c=ir[o.data.blendMode];let d=!1;if(l instanceof dt||l instanceof ft){const f=t._getCachedData(o,l),m=s.slotBatches[f.id]||=new sr;m.setData(t,f,c,h),d=f.skipRender,d||i.addToBatch(m,e)}const u=t._slotsObject[o.data.name];if(u){const f=u.container;d||(f.includeInBuild=!0,f.collectRenderables(e,this.renderer,null)),f.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;const s=t.skeleton.drawOrder;for(let i=0,n=s.length;i<n;i++){const h=s[i],a=h.getAttachment();if((a instanceof dt||a instanceof ft)&&!t._getCachedData(h,a).skipRender){const o=e.slotBatches[t._getCachedData(h,a).id];o._batcher?.updateElement(o)}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}}oe.add(rr);const ee=new ie;Ft.yDown=!0;const Lt=new _t;class gr{x;y;width;height;constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}class pr{clipping;constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new Ft(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(gt.update);const s=e.getBoundsRect(this.clipping?new _t:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}}class xr{animation;skins;timeStep;clipping;constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new Ot(t.state.data),s=new Ft(t.skeleton.data),i=this.clipping?new _t:void 0,n=s.data;if(this.skins.length>0){let a=new ae("custom-skin");for(const r of this.skins){const o=n.findSkin(r);o!=null&&a.addSkin(o)}s.setSkin(a)}s.setToSetupPose();const h=this.animation!=null?n.findAnimation(this.animation):null;if(h==null){s.updateWorldTransform(gt.update);const a=s.getBoundsRect(i);return a.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:a}else{let a=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,h,!1);const c=Math.max(h.duration/this.timeStep,1);for(let u=0;u<c;u++){const f=u>0?this.timeStep:0;e.update(f),e.apply(s),s.update(f),s.updateWorldTransform(gt.update);const m=s.getBoundsRect(i);a=Math.min(a,m.x),r=Math.min(r,m.y),o=Math.max(o,m.x+m.width),l=Math.max(l,m.y+m.height)}const d={x:a,y:r,width:o-a,height:l-r};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}}const Ne=new $t(()=>new ct);class we extends zs{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let e;if(typeof t=="number"?e=this.skeleton.slots[t]:typeof t=="string"?e=this.skeleton.findSlot(t):e=t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!1;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?te.shared.add(this.internalUpdate,this):!t&&this._autoUpdate&&te.shared.remove(this.internalUpdate,this),this._autoUpdate=t}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof ne&&(t={skeletonData:t}),super({}),this.allowChildren=!0;const e=t instanceof ne?t:t.skeletonData;this.skeleton=new Ft(e),this.state=new Ot(new ti(e)),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=t?.darkTint===void 0?this.skeleton.slots.some(i=>!!i.data.darkColor):t?.darkTint;const s=this.skeleton.slots;for(let i=0;i<s.length;i++)this.attachmentCacheData[i]=Object.create(null);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(t,e){this._updateAndApplyState(e??te.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(ee.set(e.x,e.y),t.parent){const i=t.parent.worldToLocal(ee);t.x=i.x,t.y=-i.y}else t.x=ee.x,t.y=ee.y}getBonePosition(t,e){const s=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(gt.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,i=!1;for(let n=0;n<t.length;n++){const a=t[n].getAttachment();a&&(a!==e[s]&&(i=!0,e[s]=a),s++)}s!==e.length&&(i=!0,e.length=s),this.spineAttachmentsDirty||=i}currentClippingSlot;updateAndSetPixiMask(t,e){const s=t.attachment;if(s&&s instanceof Yt){const h=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};h.maskComputed=!1,this.currentClippingSlot=h;return}let i=this.currentClippingSlot,n=this._slotsObject[t.data.name];if(i&&n){let h=i.mask;if(h||(h=Ne.obtain(),i.mask=h,this.addChild(h)),!i.maskComputed){let a=i.slot,r=a.attachment;i.maskComputed=!0;const o=r.worldVerticesLength,l=i.vertices;r.computeWorldVertices(a,0,o,l,0,2),h.clear().poly(l).stroke({width:0}).fill({alpha:.25})}n.container.mask=h}else n?.container.mask&&(n.container.mask=null);if(i&&i.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e){for(const h in this.clippingSlotToPixiMasks){const a=this.clippingSlotToPixiMasks[h];(!(a.slot.attachment instanceof Yt)||!a.maskComputed)&&a.mask&&(this.removeChild(a.mask),Ne.free(a.mask),a.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const t=this.skeleton.drawOrder;for(let e=0;e<t.length;e++){const s=t[e];this.updateAndSetPixiMask(s,e===t.length-1);const i=s.getAttachment();if(i){if(i instanceof ft||i instanceof dt){const n=this._getCachedData(s,i);i instanceof dt?i.computeWorldVertices(s,n.vertices,0,2):i.computeWorldVertices(s,0,i.worldVerticesLength,n.vertices,0,2),n.uvs.length<i.uvs.length&&(n.uvs=new Float32Array(i.uvs.length)),Gs(i.uvs.buffer,n.uvs.buffer);const a=s.bone.skeleton.color,r=s.color,o=i.color,l=a.a*r.a*o.a;if(n.color.set(a.r*r.r*o.r,a.g*r.g*o.g,a.b*r.b*o.b,l),this.alpha===0||l===0)n.skipRender||(this.spineAttachmentsDirty=!0),n.skipRender=!0;else{n.skipRender&&(this.spineAttachmentsDirty=!0),n.skipRender=n.clipped=!1,s.darkColor&&n.darkColor.setFromColor(s.darkColor);const c=i.region?.texture.texture||Ve.EMPTY;n.texture!==c&&(n.texture=c,this.spineTexturesDirty=!0),Lt.isClipping()&&this.updateClippingData(n)}}else if(i instanceof Yt){Lt.clipStart(s,i);continue}}Lt.clipEndWithSlot(s)}Lt.clipEnd()}updateClippingData(t){t.clipped=!0,Lt.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:i}=Lt,n=e.length/2,h=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(n*2),uvs:new Float32Array(n*2),vertexCount:n,indices:new Uint16Array(h),indicesCount:h},this.spineAttachmentsDirty=!0);const a=t.clippedData,r=a.vertexCount!==n||h!==a.indicesCount;t.skipRender=n===0,r&&(this.spineAttachmentsDirty=!0,a.vertexCount<n&&(a.vertices=new Float32Array(n*2),a.uvs=new Float32Array(n*2)),a.indices.length<h&&(a.indices=new Uint16Array(h)));const{vertices:o,uvs:l,indices:c}=a;for(let d=0;d<n;d++)o[d*2]=e[d*2],o[d*2+1]=e[d*2+1],l[d*2]=s[d*2],l[d*2+1]=s[d*2+1];a.vertexCount=n;for(let d=0;d<h;d++)c[d]!==i[d]&&(this.spineAttachmentsDirty=!0,c[d]=i[d]);a.indicesCount=h}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:e,container:s}=t,i=t.followAttachmentTimeline?!!e.attachment:!0;if(s.visible=this.skeleton.drawOrder.includes(e)&&i,s.visible){let n=e.bone;s.position.set(n.worldX,n.worldY),s.angle=n.getWorldRotationX();let h=1,a=1;for(;n;)h*=n.scaleX,a*=n.scaleY,n=n.parent;h<0&&(s.angle-=180),s.scale.set(e.bone.getWorldScaleX()*Math.sign(h),e.bone.getWorldScaleY()*Math.sign(a)),s.alpha=this.skeleton.color.a*e.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){let s;return e instanceof dt?(s=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}):(s=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new V(1,1,1,1),darkColor:new V(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}),this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,e,s){t=this.getSlotFromRef(t);for(const n in this._slotsObject)this._slotsObject[n]?.container===e&&this.removeSlotObject(this._slotsObject[n].slot);this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const i={container:e,slot:t,followAttachmentTimeline:s?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(t){let e;if(t instanceof se){for(const s in this._slotsObject)if(this._slotsObject[s]?.container===t){this._slotsObject[s]=null,e=t;break}}else{const s=this.getSlotFromRef(t);e=this._slotsObject[s.data.name]?.container,this._slotsObject[s.data.name]=null}e&&(this.removeChild(e),e.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([t,e])=>{e&&e.container.removeFromParent(),delete this._slotsObject[t]})}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new Ys;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const e=this._boundsProvider.calculateBounds(this),s=this._bounds;s.clear(),s.x=e.x,s.y=e.y,s.width=e.width,s.height=e.height}else if(t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const e=this.skeleton.drawOrder,s=this._bounds;s.clear();for(let i=0;i<e.length;i++){const n=e[i],h=n.getAttachment();if(h&&(h instanceof dt||h instanceof ft)){const a=this._getCachedData(n,h);s.addVertexData(a.vertices,0,a.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),te.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:t,atlas:e,scale:s=1,darkTint:i,autoUpdate:n=!0,boundsProvider:h}){const a=`${t}-${e}-${s}`;if(ue.has(a))return new we({skeletonData:ue.get(a),darkTint:i,autoUpdate:n,boundsProvider:h});const r=Xe.get(t),o=Xe.get(e),l=new ri(o),c=r instanceof Uint8Array?new ci(l):new qi(l);c.scale=s;const d=c.readSkeletonData(r);return ue.set(a,d),new we({skeletonData:d,darkTint:i,autoUpdate:n,boundsProvider:h})}}class br{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(t){if(this.registeredSpines.has(t)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);return}const e={parentDebugContainer:new se,bones:new se,skeletonXY:new ct,regionAttachmentsShape:new ct,meshTrianglesLine:new ct,meshHullLine:new ct,clippingPolygon:new ct,boundingBoxesRect:new ct,boundingBoxesCircle:new ct,boundingBoxesPolygon:new ct,pathsCurve:new ct,pathsLine:new ct,eventText:new se,eventCallback:{event:(s,i)=>{if(this.drawEvents){const n=Math.abs(t.scale.x||t.scale.y||1),h=new $s({text:i.data.name,style:{fontSize:this.eventFontSize/n,fill:this.eventFontColor,fontFamily:"monospace"}});h.scale.x=Math.sign(t.scale.x),h.anchor.set(.5),e.eventText.addChild(h),setTimeout(()=>{h.destroyed||h.destroy()},250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let n=e.bones.children.length;n>0;n--)e.bones.children[n-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const n of e.eventText.children)n.alpha-=.05,n.y-=2}drawBonesFunc(t,e,s,i){const n=t.skeleton,h=n.x,a=n.y,r=n.bones;e.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let l=0,c=r.length;l<c;l++){const d=r[l],u=d.data.length,f=h+d.worldX,m=a+d.worldY,g=h+u*d.a+d.worldX,w=a+u*d.b+d.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const b=Math.abs(f-g),p=Math.abs(m-w),x=Math.pow(b,2),y=p,v=Math.pow(p,2),A=Math.sqrt(x+v),k=Math.pow(A,2),I=Math.PI/180,Y=Math.acos((k+v-x)/(2*y*A))||0;if(A===0)continue;const T=new ct;e.bones.addChild(T);const R=A/50/i;T.context.poly([0,0,0-R,A-R*3,0,A-R,0+R,A-R*3]).fill(this.bonesColor),T.x=f,T.y=m,T.pivot.y=A;let X=0;f<g&&m<w?X=-Y+180*I:f>g&&m<w?X=180*I+Y:f>g&&m>w?X=-Y:f<g&&m>w?X=Y:m===w&&f<g?X=90*I:m===w&&f>g?X=-90*I:f===g&&m<w?X=180*I:f===g&&m>w&&(X=0),T.rotation=X,T.circle(0,A,R*1.2).fill({color:0,alpha:.6}).stroke({width:s+R/2.4,color:this.bonesColor})}const o=s*3;e.skeletonXY.context.moveTo(h-o,a-o).lineTo(h+o,a+o).moveTo(h+o,a-o).lineTo(h-o,a+o).stroke()}drawRegionAttachmentsFunc(t,e,s){const n=t.skeleton.slots;for(let h=0,a=n.length;h<a;h++){const r=n[h],o=r.getAttachment();if(o===null||!(o instanceof dt))continue;const l=o,c=new Float32Array(8);l.computeWorldVertices(r,c,0,2),e.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const n=t.skeleton.slots;for(let h=0,a=n.length;h<a;h++){const r=n[h];if(!r.bone.active)continue;const o=r.getAttachment();if(o===null||!(o instanceof ft))continue;const l=o,c=new Float32Array(l.worldVerticesLength),d=l.triangles;let u=l.hullLength;if(l.computeWorldVertices(r,0,l.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let f=0,m=d.length;f<m;f+=3){const g=d[f]*2,w=d[f+1]*2,b=d[f+2]*2;e.meshTrianglesLine.context.moveTo(c[g],c[g+1]).lineTo(c[w],c[w+1]).lineTo(c[b],c[b+1])}if(this.drawMeshHull&&u>0){u=(u>>1)*2;let f=c[u-2],m=c[u-1];for(let g=0,w=u;g<w;g+=2){const b=c[g],p=c[g+1];e.meshHullLine.context.moveTo(b,p).lineTo(f,m),f=b,m=p}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const n=t.skeleton.slots;for(let h=0,a=n.length;h<a;h++){const r=n[h];if(!r.bone.active)continue;const o=r.getAttachment();if(o===null||!(o instanceof Yt))continue;const l=o,c=l.worldVerticesLength,d=new Float32Array(c);l.computeWorldVertices(r,0,c,d,0,2),e.clippingPolygon.poly(Array.from(d))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new Ys;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=i.polygons,h=(a,r,o)=>{if(o<3)throw new Error("Polygon must contain at least 3 vertices");const l=[],c=s*2;for(let d=0,u=a.length;d<u;d+=2){const f=a[d],m=a[d+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(f,m,c),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(f,m,c).fill({color:this.boundingBoxesCircleColor}),l.push(f,m)}e.boundingBoxesPolygon.poly(l).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let a=0,r=n.length;a<r;a++){const o=n[a];h(o,0,o.length)}}drawPathsFunc(t,e,s){const n=t.skeleton.slots;for(let h=0,a=n.length;h<a;h++){const r=n[h];if(!r.bone.active)continue;const o=r.getAttachment();if(o===null||!(o instanceof Rt))continue;const l=o;let c=l.worldVerticesLength;const d=new Float32Array(c);l.computeWorldVertices(r,0,c,d,0,2);let u=d[2],f=d[3],m=0,g=0;if(l.closed){const w=d[0],b=d[1],p=d[c-2],x=d[c-1];m=d[c-4],g=d[c-3],e.pathsCurve.moveTo(u,f),e.pathsCurve.bezierCurveTo(w,b,p,x,m,g),e.pathsLine.moveTo(u,f),e.pathsLine.lineTo(w,b),e.pathsLine.moveTo(m,g),e.pathsLine.lineTo(p,x)}c-=4;for(let w=4;w<c;w+=6){const b=d[w],p=d[w+1],x=d[w+2],y=d[w+3];m=d[w+4],g=d[w+5],e.pathsCurve.moveTo(u,f),e.pathsCurve.bezierCurveTo(b,p,x,y,m,g),e.pathsLine.moveTo(u,f),e.pathsLine.lineTo(b,p),e.pathsLine.moveTo(m,g),e.pathsLine.lineTo(x,y),u=m,f=g}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}}export{gr as AABBRectangleBoundsProvider,is as AlphaTimeline,ye as Animation,Ot as AnimationState,dr as AnimationStateAdapter,ti as AnimationStateData,Gt as AssetCache,ur as AssetManagerBase,ri as AtlasAttachmentLoader,Ue as Attachment,Dt as AttachmentTimeline,di as BinaryInput,Tt as BlendMode,Ee as Bone,vs as BoneData,he as BoundingBoxAttachment,Zs as CURRENT,Yt as ClippingAttachment,V as Color,ce as ConstraintData,Ct as CurveTimeline,xt as CurveTimeline1,ve as CurveTimeline2,lr as DebugUtils,as as DeformTimeline,ni as Downloader,Xt as DrawOrderTimeline,Cs as Event,As as EventData,Ks as EventQueue,Ht as EventTimeline,ot as EventType,Pe as FIRST,fr as FakeTexture,ge as HOLD_FIRST,Qs as HOLD_MIX,Re as HOLD_SUBSEQUENT,ai as IkConstraint,ks as IkConstraintData,os as IkConstraintTimeline,K as Inherit,ts as InheritTimeline,ar as IntSet,Hs as Interpolation,B as MathUtils,ft as MeshAttachment,P as MixBlend,nt as MixDirection,Rt as PathAttachment,At as PathConstraint,Ss as PathConstraintData,ds as PathConstraintMixTimeline,hs as PathConstraintPositionTimeline,cs as PathConstraintSpacingTimeline,gt as Physics,ms as PhysicsConstraintDampingTimeline,xs as PhysicsConstraintGravityTimeline,fs as PhysicsConstraintInertiaTimeline,gs as PhysicsConstraintMassTimeline,bs as PhysicsConstraintMixTimeline,le as PhysicsConstraintResetTimeline,us as PhysicsConstraintStrengthTimeline,Bt as PhysicsConstraintTimeline,ps as PhysicsConstraintWindTimeline,Ce as PointAttachment,$t as Pool,vt as PositionMode,js as Pow,or as PowOut,ns as RGB2Timeline,rs as RGBA2Timeline,es as RGBATimeline,ss as RGBTimeline,dt as RegionAttachment,Pt as RotateMode,re as RotateTimeline,Be as SETUP,me as SUBSEQUENT,He as ScaleTimeline,je as ScaleXTimeline,Je as ScaleYTimeline,yt as SequenceTimeline,pr as SetupPoseBoundsProvider,Ke as ShearTimeline,Qe as ShearXTimeline,Ze as ShearYTimeline,Ft as Skeleton,ci as SkeletonBinary,Ys as SkeletonBounds,_t as SkeletonClipping,ne as SkeletonData,qi as SkeletonJson,ae as Skin,Le as SkinEntry,xr as SkinsAndAnimationBoundsProvider,li as Slot,Ts as SlotData,Z as SpacingMode,we as Spine,br as SpineDebugRenderer,rr as SpinePipe,mt as SpineTexture,We as StringSet,ws as Texture,be as TextureAtlas,ii as TextureAtlasPage,ys as TextureAtlasRegion,tt as TextureFilter,ei as TextureRegion,St as TextureWrap,hr as TimeKeeper,J as Timeline,Js as TrackEntry,hi as TransformConstraint,Ms as TransformConstraintData,ls as TransformConstraintTimeline,ze as TranslateTimeline,Ge as TranslateXTimeline,$e as TranslateYTimeline,lt as Triangulator,E as Utils,ie as Vector2,pt as VertexAttachment,cr as WindowedMean};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as s,aj as o,ak as i,al as u,am as l,f as d}from"./index-_bCaipUk.js";function r(e){return{peers:()=>e.peers(),networkId:t=>e.networkId(t),authority:t=>e.networkId(t)==null?"local":e.serverAuthoritative?.(t)?"server":e.ownerId(t)===e.localSessionId()?"local":"remote",editable:t=>e.networkId(t)==null?!0:e.serverAuthoritative?.(t)?!1:e.ownerId(t)===e.localSessionId(),getConnectionState:()=>e.connectionState?.()??"disconnected",getRoomInfo:()=>e.roomInfo?.()??null,getReplicationStats:()=>e.replicationStats?.()??{entities:0,msgsInPerSec:0,msgsOutPerSec:0},subscribe:t=>e.subscribe?.(t)??(()=>{})}}export{s as VgaiSceneGameAdapter,r as createColyseusNetworkingAdapter,o as createInputManagerAdapter,i as createNavigationAdapter,u as createRapierPhysicsAdapter,l as createVgaiAssetAdapter,d as fromSetup};
|